/* ClubCareer — mobile-first design system */
:root {
  --bg: #080b11;
  --bg2: #0e131c;
  --panel: #141b26;
  --panel2: #1a2331;
  --panel3: #212c3d;
  --line: #26314350;
  --line2: #2c3849;
  --txt: #e8edf5;
  --txt2: #9aa8bd;
  --txt3: #6b7a91;
  --accent: #14e08a;
  --accent2: #0bb96f;
  --accent-ink: #04140c;
  --club1: #14e08a;
  --club2: #0b1220;
  --good: #35d07f;
  --ok: #f3c04a;
  --bad: #ff5d5d;
  --gk: #f6c344;
  --def: #4ea8de;
  --mid: #5ddc8b;
  --att: #ff6b6b;
  --r: 14px;
  --r2: 10px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --tab-h: 58px;
  --top-h: 54px;
  --shadow: 0 8px 28px rgba(0,0,0,.45);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; overscroll-behavior-y: none; }
body {
  background: var(--bg);
  color: var(--txt);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; padding: 0; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.02em; }

/* ------------------------------------------------------------------ layout */
#app { height: 100dvh; display: flex; flex-direction: column; }

.topbar {
  height: calc(var(--top-h) + var(--sat));
  padding: var(--sat) 12px 0;
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg2) 100%);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 30; flex: none;
}
.topbar .badge { width: 32px; height: 32px; flex: none; }
.topbar .tb-main { flex: 1; min-width: 0; }
.topbar .tb-title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .tb-sub { font-size: 11px; color: var(--txt2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .tb-right { display: flex; align-items: center; gap: 8px; flex: none; }
.iconbtn {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--panel2); color: var(--txt2); font-size: 17px; position: relative;
}
.iconbtn:active { background: var(--panel3); }
.iconbtn .dot {
  position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 800;
  display: grid; place-items: center; line-height: 1;
}

.screen { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding-bottom: 16px; }
.screen.with-fab { padding-bottom: 92px; }

.tabbar {
  height: calc(var(--tab-h) + var(--sab));
  padding-bottom: var(--sab);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--panel); border-top: 1px solid var(--line2);
  flex: none; z-index: 30;
}
.tabbar button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--txt3); font-size: 10px; font-weight: 600; letter-spacing: .01em; position: relative;
}
.tabbar button .ico { font-size: 19px; line-height: 1; }
.tabbar button.on { color: var(--accent); }
.tabbar button.on::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 26px; height: 2.5px; border-radius: 0 0 3px 3px; background: var(--accent);
}
.tabbar button .nb {
  position: absolute; top: 6px; right: 50%; margin-right: -22px; min-width: 15px; height: 15px;
  border-radius: 8px; background: var(--bad); color: #fff; font-size: 9px; font-weight: 800;
  display: grid; place-items: center; padding: 0 4px;
}

.fab {
  position: fixed; right: 14px; bottom: calc(var(--tab-h) + var(--sab) + 14px);
  height: 50px; padding: 0 20px; border-radius: 26px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: var(--accent-ink); font-weight: 800; font-size: 15px; letter-spacing: .01em;
  display: flex; align-items: center; gap: 8px; box-shadow: 0 6px 22px rgba(20,224,138,.32);
  z-index: 25;
}
.fab:active { transform: scale(.96); }
.fab.wide { left: 14px; right: 14px; justify-content: center; }

/* ------------------------------------------------------------------ blocks */
.wrap { padding: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  margin: 10px 12px; overflow: hidden;
}
.card.flush { margin-left: 0; margin-right: 0; border-radius: 0; border-left: 0; border-right: 0; }
.card-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 11px 13px 9px; font-size: 12px; font-weight: 800; letter-spacing: .07em;
  text-transform: uppercase; color: var(--txt3);
}
.card-h .link { font-size: 11px; color: var(--accent); letter-spacing: 0; text-transform: none; font-weight: 700; }
.card-b { padding: 0 13px 13px; }
.card-b.tight { padding: 0; }

.sec-title { font-size: 12px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--txt3); padding: 14px 13px 6px; }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.mut { color: var(--txt2); }
.mut3 { color: var(--txt3); }
.sm { font-size: 12px; }
.xs { font-size: 11px; }
.b { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.center { text-align: center; }
.right { text-align: right; }

.chipbar { display: flex; gap: 7px; overflow-x: auto; padding: 10px 12px; scrollbar-width: none; }
.chipbar::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 13px; border-radius: 20px; background: var(--panel2);
  color: var(--txt2); font-size: 12.5px; font-weight: 600; border: 1px solid transparent;
}
.chip.on { background: var(--accent); color: var(--accent-ink); font-weight: 800; }

.pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; padding: 2px 6px; border-radius: 6px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .02em;
}
.pill.GK { background: color-mix(in srgb, var(--gk) 22%, transparent); color: var(--gk); }
.pill.DEF { background: color-mix(in srgb, var(--def) 22%, transparent); color: var(--def); }
.pill.MID { background: color-mix(in srgb, var(--mid) 22%, transparent); color: var(--mid); }
.pill.ATT { background: color-mix(in srgb, var(--att) 22%, transparent); color: var(--att); }

.tag { display: inline-block; padding: 2px 7px; border-radius: 6px; background: var(--panel3); font-size: 10.5px; font-weight: 700; color: var(--txt2); }
.tag.good { background: color-mix(in srgb, var(--good) 20%, transparent); color: var(--good); }
.tag.bad { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }
.tag.warn { background: color-mix(in srgb, var(--ok) 20%, transparent); color: var(--ok); }

.badge { border-radius: 8px; display: grid; place-items: center; font-weight: 900; flex: none; overflow: hidden; }
.badge span { font-size: .42em; letter-spacing: -.02em; }

/* -------------------------------------------------------------- list items */
.list { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: center; gap: 10px; padding: 10px 13px;
  border-bottom: 1px solid var(--line); min-height: 52px;
}
.item:last-child { border-bottom: none; }
.item:active { background: var(--panel2); }
.item .t1 { font-size: 14px; font-weight: 600; }
.item .t2 { font-size: 11.5px; color: var(--txt2); }

.rating { min-width: 34px; text-align: center; padding: 3px 5px; border-radius: 6px; font-weight: 800; font-size: 12px; }
.r-hi { background: color-mix(in srgb, var(--good) 24%, transparent); color: var(--good); }
.r-md { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.r-lo { background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad); }

.bar { height: 5px; border-radius: 3px; background: var(--panel3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; }

.attrgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.attr { display: flex; align-items: center; gap: 7px; font-size: 12.5px; padding: 2px 0; }
.attr .an { flex: 1; color: var(--txt2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attr .av { width: 22px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.attr .ab { width: 46px; }

/* ------------------------------------------------------------------- table */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--txt3);
  font-weight: 800; padding: 8px 4px; text-align: right; position: sticky; top: 0;
  background: var(--panel); z-index: 2;
}
table.tbl th:first-child, table.tbl td:first-child { text-align: left; padding-left: 12px; }
table.tbl th:last-child, table.tbl td:last-child { padding-right: 12px; }
table.tbl td { padding: 8px 4px; text-align: right; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.tbl tr.me td { background: color-mix(in srgb, var(--accent) 11%, transparent); font-weight: 700; }
table.tbl tr:active td { background: var(--panel2); }
.zone { display: inline-block; width: 3px; height: 15px; border-radius: 2px; margin-right: 6px; vertical-align: -2px; }

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll-x::-webkit-scrollbar { height: 0; }

/* --------------------------------------------------------------- form bits */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--txt3); margin-bottom: 6px; }
.input, select.input {
  width: 100%; padding: 11px 12px; border-radius: var(--r2); background: var(--panel2);
  border: 1px solid var(--line2); color: var(--txt); font-size: 15px; appearance: none;
}
.input:focus { outline: none; border-color: var(--accent); }
select.input { background-image: linear-gradient(45deg, transparent 50%, var(--txt3) 50%), linear-gradient(135deg, var(--txt3) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%;
  padding: 13px 16px; border-radius: var(--r2); background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 15px;
}
.btn:active { filter: brightness(.9); }
.btn.ghost { background: var(--panel2); color: var(--txt); border: 1px solid var(--line2); }
.btn.danger { background: color-mix(in srgb, var(--bad) 88%, #000); color: #fff; }
.btn.sm { padding: 9px 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btnrow { display: flex; gap: 8px; }

.seg { display: flex; background: var(--panel2); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; padding: 8px 6px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--txt2); }
.seg button.on { background: var(--accent); color: var(--accent-ink); }

input[type=range] { width: 100%; appearance: none; -webkit-appearance: none; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: var(--panel3); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); margin-top: -8.5px; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
input[type=range]::-moz-range-track { height: 5px; border-radius: 3px; background: var(--panel3); }
input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border: none; border-radius: 50%; background: var(--accent); }

/* ------------------------------------------------------------------- pitch */
.pitch {
  position: relative; width: 100%; aspect-ratio: 68/100; border-radius: 12px; overflow: hidden;
  background: linear-gradient(180deg, #17462e 0%, #12603a 50%, #17462e 100%);
  background-color: #14512f;
}
.pitch::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 10%, transparent 10% 20%);
}
.pitch .lines { position: absolute; inset: 0; }
.pitch .lines i { position: absolute; border: 1.5px solid rgba(255,255,255,.22); }
.tok {
  position: absolute; transform: translate(-50%, -50%); width: 15.5%; display: flex;
  flex-direction: column; align-items: center; gap: 2px; z-index: 2;
}
.tok .shirt {
  width: 100%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 900; color: #fff; border: 2px solid rgba(255,255,255,.5);
  box-shadow: 0 3px 8px rgba(0,0,0,.4); position: relative;
}
.tok .nm { font-size: 9px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000; max-width: 130%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tok .ps { font-size: 8px; font-weight: 800; color: rgba(255,255,255,.7); text-shadow: 0 1px 2px #000; }
.tok.sel .shirt { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); }
.tok .warn { position: absolute; top: -4px; right: -4px; font-size: 10px; }

/* ------------------------------------------------------------------- match */
.mv { display: flex; flex-direction: column; height: 100%; background: var(--bg); }
.mv-head { background: linear-gradient(180deg, var(--panel2), var(--bg2)); padding: 10px 12px 12px; border-bottom: 1px solid var(--line2); flex: none; }
.mv-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.mv-team { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.mv-team .badge { width: 38px; height: 38px; }
.mv-team .nm { font-size: 12px; font-weight: 700; text-align: center; line-height: 1.15; }
.mv-goals { font-size: 34px; font-weight: 900; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.mv-clock { text-align: center; font-size: 12px; font-weight: 800; color: var(--accent); margin-top: 2px; }
.mv-prog { height: 3px; background: var(--panel3); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.mv-prog i { display: block; height: 100%; background: var(--accent); transition: width .3s linear; }
.mv-body { flex: 1; overflow-y: auto; }
.mv-foot { flex: none; padding: 9px 12px calc(9px + var(--sab)); background: var(--panel); border-top: 1px solid var(--line2); display: flex; gap: 8px; align-items: center; }

.feed { padding: 4px 0 20px; }
.fev { display: flex; gap: 9px; padding: 8px 13px; border-bottom: 1px solid var(--line); animation: fadein .25s ease; }
.fev .min { width: 30px; flex: none; font-size: 11px; font-weight: 800; color: var(--txt3); font-variant-numeric: tabular-nums; padding-top: 1px; }
.fev .txt { font-size: 13.5px; line-height: 1.35; }
.fev.goal { background: color-mix(in srgb, var(--good) 12%, transparent); }
.fev.goal .txt { font-weight: 700; }
.fev.red { background: color-mix(in srgb, var(--bad) 12%, transparent); }
.fev.ht, .fev.ft, .fev.et { background: var(--panel2); }
.fev.ht .txt, .fev.ft .txt { font-weight: 800; }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.statrow { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 8px; padding: 7px 13px; font-size: 12.5px; }
.statrow .lbl { grid-column: 1/-1; text-align: center; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--txt3); font-weight: 800; margin-bottom: -4px; }
.statbar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--panel3); }
.statbar i:first-child { background: var(--club1); }
.statbar i:last-child { background: var(--txt3); }

/* ------------------------------------------------------------ modal/sheet */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; animation: fadein .18s ease; backdrop-filter: blur(2px); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 88dvh;
  background: var(--panel); border-radius: 20px 20px 0 0; border-top: 1px solid var(--line2);
  display: flex; flex-direction: column; padding-bottom: var(--sab);
  animation: slideup .26s cubic-bezier(.2,.8,.25,1);
  box-shadow: var(--shadow);
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: none; } }
.sheet-h { padding: 14px 16px 10px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-h h3 { font-size: 16px; flex: 1; }
.sheet-b { overflow-y: auto; padding: 12px 0; }
.sheet-b.pad { padding: 14px 16px calc(18px + var(--sab)); }
.grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line2); margin: 8px auto 0; flex: none; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tab-h) + var(--sab) + 74px); z-index: 90;
  background: var(--panel3); color: var(--txt); padding: 11px 16px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow); max-width: 88vw; text-align: center;
  border: 1px solid var(--line2); animation: fadein .2s ease;
}
.toast.good { border-color: var(--good); }
.toast.bad { border-color: var(--bad); }

/* -------------------------------------------------------------- start flow */
.splash {
  height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--sat) + 20px) 20px calc(var(--sab) + 20px);
  background: radial-gradient(120% 80% at 50% 0%, #14352a 0%, var(--bg) 60%);
  overflow-y: auto;
}
.logo { text-align: center; margin: 20px 0 8px; }
.logo .mark { font-size: 54px; line-height: 1; }
.logo h1 { font-size: 34px; letter-spacing: -.04em; margin-top: 6px; background: linear-gradient(100deg, #fff 10%, var(--accent) 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo p { color: var(--txt2); font-size: 13px; margin: 6px 0 0; }

.clubpick { display: flex; flex-direction: column; gap: 8px; }
.clubrow {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line);
}
.clubrow.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.clubrow .badge { width: 36px; height: 36px; }
.stars { color: var(--ok); font-size: 12px; letter-spacing: 1px; }

.empty { text-align: center; color: var(--txt3); padding: 34px 20px; font-size: 13.5px; }
.loading { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 100; }
.spin { width: 34px; height: 34px; border: 3px solid var(--panel3); border-top-color: var(--accent); border-radius: 50%; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

.formline { display: flex; gap: 3px; }
.formline i {
  width: 17px; height: 17px; border-radius: 4px; display: grid; place-items: center;
  font-size: 9.5px; font-weight: 900; font-style: normal; color: #06110b;
}
.formline i.W { background: var(--good); }
.formline i.D { background: var(--txt3); color: #fff; }
.formline i.L { background: var(--bad); color: #fff; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--txt2); }
.kv .v { font-weight: 700; text-align: right; }

.bracket { display: flex; gap: 10px; padding: 12px; overflow-x: auto; }
.br-col { flex: none; width: 168px; display: flex; flex-direction: column; justify-content: space-around; gap: 8px; }
.br-col .rn { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--txt3); font-weight: 800; text-align: center; margin-bottom: 2px; }
.br-tie { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; font-size: 11.5px; }
.br-tie .t { display: flex; justify-content: space-between; gap: 6px; padding: 1px 0; }
.br-tie .t.win { font-weight: 800; }
.br-tie .t.lose { color: var(--txt3); }
.br-tie.me { border-color: var(--accent); }

.msg { padding: 12px 13px; border-bottom: 1px solid var(--line); display: flex; gap: 11px; }
.msg .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; background: var(--panel2); flex: none; }
.msg.unread { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.msg.unread .sub { font-weight: 800; }
.msg .sub { font-size: 13.5px; }
.msg .prev { font-size: 11.5px; color: var(--txt2); }
.msgbody { font-size: 14px; line-height: 1.55; }
.msgbody b { color: var(--txt); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  background: var(--panel2); border-radius: 11px; padding: 10px; text-align: center;
}
.stat .v { font-size: 19px; font-weight: 900; letter-spacing: -.02em; }
.stat .k { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--txt3); font-weight: 700; margin-top: 2px; }

.hr { height: 1px; background: var(--line); margin: 10px 0; }
.tiny { font-size: 10.5px; }
.nowrap { white-space: nowrap; }

@media (min-width: 700px) {
  #app { max-width: 520px; margin: 0 auto; border-left: 1px solid var(--line2); border-right: 1px solid var(--line2); }
  .fab { right: calc(50vw - 260px + 14px); }
  .sheet { max-width: 520px; left: 50%; transform: translateX(-50%); }
  @keyframes slideup { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
}
