/* Design language after FotMob's team pages: Inter, flat cards on a near-black
   canvas, grey hints, green/red result semantics, 8–12 px radii, line icons.
   Fonts: Inter (OFL, public/fonts). Icons: Lucide (ISC, public/vendor/lucide). */
@font-face { font-family: 'Inter'; src: url('/fonts/InterVariable.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  /* FotMob-derived tokens (dark is the default scheme) */
  --bg: #1a1a1a; --card: #262626; --card-2: #2b2b2b; --border: #383838; --border-soft: #2f2f2f;
  --text: #ffffff; --text-2: #d0d0d0; --hint: #8d9499; --muted: #6d7782;
  --green: #61df6e; --green-deep: #00985f; --red: #dd3636; --orange: #f08022; --blue: #14a0ff;
  --win-bg: #61df6e26; --draw-bg: #6d778226; --lose-bg: #dd363626;
  --brand: #1663c7; --brand-2: #0b3d91; --on-brand: #ffffff;
  --seg-bg: #111111;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px;
  --tab-h: 60px; --top-h: 56px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
:root[data-theme="light"] {
  --bg: #f5f5f5; --card: #ffffff; --card-2: #f0f0f0; --border: #e8e8e8; --border-soft: #efefef;
  --text: #222222; --text-2: #333333; --hint: #717171; --muted: #8d9499;
  --win-bg: #61df6e33; --draw-bg: #6d77821f; --lose-bg: #dd363626; --seg-bg: #e8e8e8;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.35; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); min-height: 100vh; }
a { color: var(--blue); text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; }
.hidden { display: none !important; }
.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; flex: none; }
.ic.sm { width: 16px; height: 16px; } .ic.xs { width: 14px; height: 14px; }
.num { font-variant-numeric: tabular-nums; }

/* header */
.top { position: sticky; top: 0; z-index: 5; height: var(--top-h); background: var(--bg); border-bottom: 1px solid var(--border-soft); padding: 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand .crest { width: 34px; height: 34px; object-fit: contain; }
.brand .name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.brand .sub { font-size: 11px; color: var(--hint); display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.live { background: var(--green); box-shadow: 0 0 0 0 rgba(97,223,110,.6); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(97,223,110,.55);} 70% { box-shadow: 0 0 0 7px rgba(97,223,110,0);} 100% { box-shadow: 0 0 0 0 rgba(97,223,110,0);} }
.iconbtn { background: var(--card); color: var(--text-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px 10px; font-size: 12px; font-weight: 600; height: 32px; display: inline-flex; align-items: center; gap: 6px; }

/* layout */
.view { padding: 10px 10px 8px; max-width: 720px; margin: 0 auto; }
.card { background: var(--card); border-radius: var(--r-lg); padding: 12px; margin-bottom: 10px; }
.card.flush { padding: 0; overflow: hidden; }
.card h2 { margin: 0 0 8px; font-size: 15px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card.flush h2 { padding: 12px 12px 6px; margin: 0; }
.card h2 .sub { font-weight: 500; font-size: 12px; color: var(--hint); }
.card h2 a, .seeall { font-size: 12px; font-weight: 600; color: var(--blue); display: inline-flex; align-items: center; gap: 2px; }
.muted { color: var(--hint); font-size: 12px; }
.banner { background: #f0802226; color: var(--orange); border-radius: var(--r-md); padding: 8px 10px; font-size: 12px; margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }
.empty { text-align: center; color: var(--hint); padding: 24px 8px; }
.err { color: var(--red); }
.row { display: flex; align-items: center; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--card-2); color: var(--hint); white-space: nowrap; }
.pill.live { background: var(--green); color: #0b2b10; }
.seg { display: inline-flex; background: var(--seg-bg); border-radius: 999px; padding: 3px; }
.seg button { background: transparent; color: var(--hint); border: 0; padding: 6px 12px; font-size: 12px; font-weight: 600; border-radius: 999px; }
.seg button.on { background: var(--card); color: var(--text); }
.chips { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1px solid var(--border); background: var(--card); color: var(--hint); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.chips button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tile { background: var(--card-2); border-radius: var(--r-md); padding: 10px 6px; text-align: center; }
.tile .v { font-size: 20px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile .k { font-size: 10px; color: var(--hint); text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; font-weight: 600; }
.tile.w .v { color: var(--green); } .tile.l .v { color: var(--red); }

/* hero (next / live / detail header) */
.hero { text-align: center; padding: 4px 0 2px; }
.hero .compline { font-size: 12px; color: var(--hint); display: flex; justify-content: center; gap: 6px; align-items: center; }
.hero .teams { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px; margin-top: 12px; }
.hero .t { display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; line-height: 1.2; }
.hero .t img { width: 52px; height: 52px; object-fit: contain; }
.hero .big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; padding-top: 8px; min-width: 88px; }
.hero .big small { display: block; font-size: 12px; font-weight: 600; color: var(--hint); letter-spacing: 0; margin-top: 2px; }
.hero .big.live small { color: var(--green); }
.hero .big .time { font-size: 24px; }
.countdown { font-size: 12px; color: var(--hint); margin-top: 10px; }

/* match rows (FotMob fixtures) */
.timeline .month { font-size: 12px; font-weight: 700; color: var(--hint); text-transform: uppercase; letter-spacing: .04em; padding: 14px 12px 6px; }
.timeline .month:first-child { padding-top: 10px; }
.now-sep { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 11px; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: .05em; }
.now-sep::before, .now-sep::after { content: ""; flex: 1; height: 1px; background: var(--green); opacity: .45; }
.mrow { display: grid; grid-template-columns: 50px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--border-soft); cursor: pointer; }
.mrow:active { background: var(--card-2); }
.timeline .mrow:first-child, .month + .mrow, .now-sep + .mrow, .card > .mrow:first-of-type { border-top: 0; }
.mrow .when { font-size: 11px; color: var(--hint); line-height: 1.3; text-align: center; font-weight: 500; }
.mrow .when b { display: block; color: var(--text-2); font-weight: 600; }
.mrow .who { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 14px; }
.mrow .who div { display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.mrow .who img { width: 20px; height: 20px; object-fit: contain; flex: none; }
.mrow .who .me { font-weight: 700; color: var(--text); }
.mrow .who .comp { font-size: 11px; color: var(--hint); margin-top: 1px; }
.mrow .res { display: flex; align-items: center; gap: 10px; }
.mrow .sc { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; min-width: 16px; }
.mrow .sc.time { font-weight: 600; color: var(--text-2); }
.mrow .sc .lead { color: var(--text); } .mrow .sc .trail { color: var(--hint); }
.badge { width: 22px; height: 22px; border-radius: var(--r-sm); font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.badge.W { background: var(--win-bg); color: var(--green); } .badge.D { background: var(--draw-bg); color: var(--hint); } .badge.L { background: var(--lose-bg); color: var(--red); } .badge.q { background: var(--card-2); color: var(--hint); }
.mrow .livemin { font-size: 11px; font-weight: 700; color: var(--green); }

/* standings */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.st { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.st th { font-size: 11px; color: var(--hint); font-weight: 600; text-align: center; padding: 6px 4px; border-bottom: 1px solid var(--border-soft); }
table.st th.l, table.st td.l { text-align: left; }
table.st td { padding: 8px 4px; text-align: center; border-bottom: 1px solid var(--border-soft); white-space: nowrap; color: var(--text-2); }
table.st tr:last-child td { border-bottom: 0; }
table.st tr.me td { background: color-mix(in srgb, var(--brand) 22%, var(--card)); color: var(--text); font-weight: 700; }
table.st td.pos { width: 30px; position: relative; font-weight: 600; color: var(--text); padding-left: 10px; }
table.st td.pos::before { content: ""; position: absolute; left: 3px; top: 7px; bottom: 7px; width: 3px; border-radius: 2px; background: var(--zone, transparent); }
table.st td.team { max-width: 160px; overflow: hidden; text-overflow: ellipsis; color: var(--text); padding-left: 6px; }
table.st td.team img { width: 20px; height: 20px; object-fit: contain; vertical-align: middle; margin-right: 8px; display: inline-block; }
table.st td.pts { font-weight: 700; color: var(--text); }
table.st td.gd { color: var(--hint); }
.form { display: inline-flex; gap: 3px; }
.form i { width: 16px; height: 16px; border-radius: 4px; font-style: normal; font-size: 9px; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.form i.W { background: var(--green); color: #0b2b10; } .form i.D { background: var(--muted); color: #fff; } .form i.L { background: var(--red); color: #fff; } .form i.q { background: var(--card-2); }
.form.lg i { width: 24px; height: 24px; font-size: 11px; border-radius: 6px; }
.trend { display: inline-flex; vertical-align: middle; margin-left: 2px; } .trend.up { color: var(--green); } .trend.down { color: var(--red); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11px; color: var(--hint); padding: 10px 12px 12px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; vertical-align: 0; margin-right: 6px; }
.gap td { padding: 2px; border-bottom: 0; color: var(--muted); font-size: 11px; }

/* stats bars */
.statrow { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.statrow .n { text-align: center; font-size: 12px; color: var(--hint); margin-bottom: 4px; }
.statrow .bar { display: flex; gap: 4px; height: 5px; }
.statrow .bar i { display: block; height: 100%; border-radius: 3px; background: var(--card-2); }
.statrow .bar i.h { background: var(--brand); } .statrow .bar i.a { background: var(--muted); }
.statrow .v { font-weight: 700; color: var(--text-2); } .statrow .v.lead { color: var(--text); }
.statrow .v.a { text-align: right; }

/* events */
.ev { display: grid; grid-template-columns: 1fr 48px 1fr; align-items: center; gap: 8px; padding: 7px 0; font-size: 13px; border-top: 1px solid var(--border-soft); }
.ev:first-child { border-top: 0; }
.ev .min { text-align: center; font-weight: 700; color: var(--hint); font-size: 12px; font-variant-numeric: tabular-nums; }
.ev .h { text-align: right; display: flex; justify-content: flex-end; align-items: center; gap: 6px; } .ev .a { text-align: left; display: flex; align-items: center; gap: 6px; }
.ev .sub { color: var(--hint); font-size: 11px; }
.ev.goal { font-weight: 700; }
.ev .ic { width: 16px; height: 16px; }
.ev .lbl { font-size: 9px; font-weight: 800; color: var(--hint); }
.cardic { width: 10px; height: 14px; border-radius: 2px; display: inline-block; flex: none; }
.cardic.y { background: #ffce2c; } .cardic.r { background: var(--red); }
.lineup { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 12px; }
.lineup h4 { margin: 0 0 6px; font-size: 12px; color: var(--hint); font-weight: 600; }
.lineup ul { list-style: none; margin: 0; padding: 0; }
.lineup li { padding: 5px 0; border-bottom: 1px solid var(--border-soft); display: flex; gap: 8px; align-items: center; }
.lineup li b { color: var(--hint); font-weight: 600; min-width: 18px; text-align: right; font-variant-numeric: tabular-nums; }
.lineup li .meta { color: var(--hint); margin-left: auto; font-size: 11px; }
.detail-tabs { display: flex; gap: 6px; margin: 2px 0 10px; overflow-x: auto; scrollbar-width: none; }
.detail-tabs::-webkit-scrollbar { display: none; }
.detail-tabs button { flex: none; border: 1px solid var(--border); background: var(--card); color: var(--hint); border-radius: 999px; padding: 7px 14px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.detail-tabs button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.back { background: transparent; border: 0; color: var(--text-2); font-weight: 600; padding: 6px 0 10px; font-size: 13px; display: inline-flex; align-items: center; gap: 2px; }

/* leaders / key-values */
.leader { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--border-soft); font-size: 13px; }
.leader:first-of-type { border-top: 0; }
.leader .rk { color: var(--hint); font-weight: 600; font-variant-numeric: tabular-nums; }
.leader .nm { display: flex; align-items: center; gap: 8px; min-width: 0; }
.leader .nm img { width: 18px; height: 18px; object-fit: contain; }
.leader .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leader .nm small { color: var(--hint); font-size: 11px; margin-left: 4px; }
.leader.me .nm span { color: var(--text); font-weight: 700; }
.leader .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 13px; }
.kv .k { color: var(--hint); }
.kv b { font-variant-numeric: tabular-nums; }

/* bottom tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--bg); border-top: 1px solid var(--border-soft); display: flex; z-index: 10; }
.tabs button { flex: 1; background: transparent; border: 0; color: var(--hint); font-size: 10px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px 0; }
.tabs button .ic { width: 22px; height: 22px; }
.tabs button.on { color: var(--text); }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--card), var(--card-2), var(--card)); background-size: 200% 100%; animation: sh 1.2s infinite; margin: 8px 0; }
@keyframes sh { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.foot { text-align: center; font-size: 11px; color: var(--muted); padding: 8px 0 4px; }

/* gate */
.gate { text-align: center; padding: 28px 16px; margin-top: 24px; }
.gate-logo img { width: 84px; height: 84px; border-radius: 22px; margin: 0 auto; }
.gate h1 { font-size: 22px; margin: 12px 0 6px; letter-spacing: -.01em; }
.gate p { margin: 6px 0 14px; color: var(--text-2); }
.gate-btn { display: inline-flex; align-items: center; gap: 8px; background: var(--brand); color: var(--on-brand); font-weight: 700; padding: 12px 22px; border-radius: var(--r-lg); font-size: 15px; margin: 6px 0 14px; }
