/* ============================================================
   LEGACY XI V2 — landscape console-style UI
   Left nav rail · minimal home · playable match arena
   ============================================================ */

/* ---------- V3.1 rating displays ---------- */
.ratecol { display: flex; flex-direction: column; align-items: center; line-height: 1; gap: 2px; }
.ratecol .stars { font-size: 14px; }
.ovrnum { font-size: 14px; color: var(--gold); font-family: var(--font-body); }
.sheet-rate { display: flex; align-items: center; gap: 5px; margin-top: 4px; flex-wrap: wrap; }
.ovrhuge { font-family: var(--font-pix); font-size: 22px; color: var(--gold); text-shadow: 0 2px 0 #7a6000; }
.pothuge { font-family: var(--font-pix); font-size: 18px; color: var(--blue); }
.ratelbl { font-size: 12px; color: var(--dim); margin-right: 4px; align-self: flex-end; }
/* positional ratings row on the player sheet */
.posrate { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.prchip { font-size: 14px; padding: 3px 8px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line2); color: var(--dim); }
.prchip b { color: var(--text); }
.prchip.nat { border-color: var(--gold); color: var(--gold); }
.prchip.nat b { color: var(--gold); }
/* attribute dashes (one per 0.5): blue up to 4.5, yellow for a maxed 5.0 */
/* attribute dashes: paired into whole numbers (each pair = 1 star, the two
   dashes being its .5 and 1.0) with a wider gap marking each whole point */
.dashes { flex: 1; display: flex; gap: 2px; }
.dashes i { flex: 1; height: 11px; background: #232b52; border-radius: 1px; }
.dashes i:nth-child(2n) { margin-right: 7px; }
.dashes i:last-child { margin-right: 0; }
.dashes i.b { background: var(--blue); }
.dashes i.y { background: var(--gold); }
/* chip headline: stars + a small exact overall number */
.chip .crow1 { display: flex; align-items: center; justify-content: center; gap: 3px; line-height: 1; }
.chip .crow1 .stars { font-size: 10px; letter-spacing: 0; }
.chip .covr { font-size: 12px; color: var(--gold); }

:root {
  --z: 1; /* global UI scale, set from the viewport in JS (UI.fitScale) */
  --bg: #0b0e1a;
  --bg2: #10142a;
  --panel: #161b33;
  --panel2: #1d2440;
  --line: #2c3560;
  --line2: #3a4578;
  --text: #eaeeff;
  --dim: #8f97c0;
  --gold: #ffd23f;
  --good: #3ddc84;
  --bad: #ff5470;
  --blue: #4cc9f0;
  --purple: #b388ff;
  --font-pix: 'Press Start 2P', monospace;
  --font-body: 'VT323', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; background: #05060d; overflow: hidden; }

body {
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 1.25;
  color: var(--text);
  overscroll-behavior: none;
  user-select: none;
}

#app {
  width: 100vw;
  height: 100dvh;
  background:
    radial-gradient(1000px 460px at 50% -160px, #1a2150 0%, var(--bg) 60%),
    var(--bg);
  position: relative;
  overflow: hidden;
  /* safe margins on every edge for notches, rounded corners & gesture areas */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* The whole interface is laid out at a reference size, then uniformly scaled
   to fit ANY viewport (small phones → desktop) while staying landscape. --z is
   computed from the screen in JS (UI.fitScale); zooming the frame keeps text
   crisp and proportions identical across every device. No element inside needs
   fixed-pixel breakpoints — they all scale together. */
.frame {
  position: relative;
  width: calc(100% / var(--z));
  height: calc(100% / var(--z));
  transform: scale(var(--z));
  transform-origin: top left;
  display: flex;
  flex-direction: row;
}

.pix { font-family: var(--font-pix); }

/* ---------- rotate hint (portrait phones) ---------- */
.rotate-overlay { display: none; }
@media (orientation: portrait) {
  .rotate-overlay {
    display: flex; position: fixed; inset: 0; z-index: 999;
    background: #05060d;
    flex-direction: column; align-items: center; justify-content: center; gap: 16px;
    font-family: var(--font-pix); font-size: 13px; color: var(--gold); text-align: center;
  }
  .rotate-overlay .ico { font-size: 52px; animation: spin90 1.6s ease-in-out infinite; }
  @keyframes spin90 { 0%,20% { transform: rotate(0) } 60%,100% { transform: rotate(90deg) } }
}

/* ---------- nav rail (landscape) ---------- */
.rail {
  /* small left gutter keeps the icons clear of the bezel even on devices that
     don't report a safe-area inset (the frame is already inset by #app). */
  width: 82px;
  background: #0d1126;
  border-right: 2px solid var(--line);
  display: flex; flex-direction: column;
  padding: 6px 0 6px 10px;
  z-index: 20;
  flex-shrink: 0;
}
.rail button {
  position: relative;
  background: none; border: none; color: var(--dim);
  font-family: var(--font-body); font-size: 14px;
  padding: 9px 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.rail button .ico { font-size: 22px; line-height: 1; }
.rail button.on { color: var(--gold); }
.rail button.on .ico { filter: drop-shadow(0 0 6px rgba(255,210,63,.6)); }
.rail .badge {
  position: absolute; top: 4px; right: 14px;
  min-width: 16px; height: 16px; border-radius: 8px;
  background: var(--bad); color: #fff;
  font-size: 12px; line-height: 16px; text-align: center; padding: 0 4px;
}

/* ---------- main column ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 16px 8px 14px;
  background: linear-gradient(180deg, #131840, var(--bg2));
  border-bottom: 2px solid var(--line);
  flex-shrink: 0;
}
.tb-club { font-family: var(--font-pix); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-sub { font-size: 15px; color: var(--dim); }
.tb-stats { display: flex; gap: 16px; margin-left: auto; align-items: center; font-size: 18px; white-space: nowrap; }
.tb-stats .lbl { color: var(--dim); font-size: 14px; margin-right: 3px; }
.tb-gear { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--dim); padding: 4px 6px; }

.content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 14px 16px 20px 16px; scrollbar-width: thin; }

/* ---------- generic bits ---------- */
.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  box-shadow: 0 3px 0 rgba(0,0,0,.45);
}
.panel.hot { border-color: var(--gold); }
.panel-title {
  font-family: var(--font-pix); font-size: 10px;
  color: var(--gold); letter-spacing: 1px;
  margin-bottom: 8px; text-transform: uppercase;
}
.row { display: flex; align-items: center; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.dim { color: var(--dim); } .good { color: var(--good); } .bad { color: var(--bad); }
.gold { color: var(--gold); } .blue { color: var(--blue); }
.small { font-size: 16px; } .big { font-size: 25px; }
.nowrap { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt4 { margin-top: 4px; } .mt8 { margin-top: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font-pix); font-size: 11px;
  padding: 12px 14px;
  color: #0b0e1a; background: var(--gold);
  border: 2px solid #b8920a; border-radius: 8px;
  box-shadow: 0 4px 0 #7a6000, 0 6px 10px rgba(0,0,0,.4);
  cursor: pointer; text-transform: uppercase; letter-spacing: .5px;
  transition: transform .05s;
  /* treat as a tap target: stops mobile from reading a tap inside a scrollable
     list as a scroll-start (which cancelled the first tap → needed two taps). */
  touch-action: manipulation;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #7a6000; }
.btn.block { display: flex; width: 100%; }
.btn.big-btn { font-size: 13px; padding: 16px 18px; }
.btn.ghost { background: var(--panel2); color: var(--text); border-color: var(--line2); box-shadow: 0 4px 0 #10142a; }
.btn.ghost:active { box-shadow: 0 1px 0 #10142a; }
.btn.danger { background: var(--bad); color: #fff; border-color: #a51c3a; box-shadow: 0 4px 0 #7c1029; }
.btn.good-btn { background: var(--good); color: #052b16; border-color: #1d9a55; box-shadow: 0 4px 0 #0e5e33; }
.btn.mini { font-size: 9px; padding: 8px 10px; box-shadow: 0 3px 0 #7a6000; }
.btn.ghost.mini { box-shadow: 0 3px 0 #10142a; }
.btn:disabled { opacity: .45; pointer-events: none; }

.crest { display: inline-block; vertical-align: middle; flex-shrink: 0; }

.stars { position: relative; display: inline-block; font-size: 15px; line-height: 1; letter-spacing: 1px; color: #3a4374; white-space: nowrap; }
.stars .fill { position: absolute; top: 0; left: 0; overflow: hidden; color: var(--gold); }
.stars.lg { font-size: 21px; }

.pips { display: inline-flex; gap: 2px; }
.pips i { width: 11px; height: 11px; background: #2b3358; border-radius: 2px; }
.pips i.on { background: var(--blue); }
.pips i.hi { background: var(--gold); }
/* ten-level facility bar: slimmer squares so a full row fits comfortably */
.pips.ten i { width: 7px; height: 9px; }

.form-up { color: var(--good); } .form-dn { color: var(--bad); } .form-eq { color: var(--dim); }

/* premium list card — echoes the starting-XI pitch cards */
.prow {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px 7px 8px;
  min-width: 0; /* let the card shrink to its grid column so names ellipsise */
  background: linear-gradient(180deg, #232b52, #161d38);
  border: 1.5px solid var(--line2); border-left-width: 4px; border-radius: 9px;
  margin-bottom: 7px; cursor: pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.05);
}
.prow.starter { background: linear-gradient(180deg, #283163, #1a2140); }
.prow .prname { font-size: 19px; color: var(--text); }
.prow .prright { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.prow .prstam { display: flex; flex-direction: column; align-items: center; gap: 2px; }
/* position-coloured accent bar down the left edge */
.prow.p-GK { border-left-color: #ff6b6b; }
.prow.p-CB { border-left-color: #ffa94d; }
.prow.p-FB { border-left-color: var(--gold); }
.prow.p-CM { border-left-color: var(--good); }
.prow.p-WG { border-left-color: var(--purple); }
.prow.p-ST { border-left-color: var(--blue); }
.prow .pos-badge {
  font-family: var(--font-pix); font-size: 8px;
  width: 34px; height: 24px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
/* V2.5 position colours: GK red · CB orange · FB yellow · CM green · WG purple · ST blue */
.pos-GK { background: #431414; color: #ff6b6b; }
.pos-CB { background: #43280e; color: #ffa94d; }
.pos-FB { background: #3d3510; color: var(--gold); }
.pos-CM { background: #14401f; color: var(--good); }
.pos-WG { background: #2d1a4a; color: var(--purple); }
.pos-ST { background: #0e3a4c; color: var(--blue); }

/* stamina: 10 notches */
.stam10 { display: inline-flex; gap: 1px; vertical-align: middle; }
.stam10 i { width: 5px; height: 8px; background: #232b52; border-radius: 1px; }
.stam10.ok i.on { background: var(--good); }
.stam10.mid i.on { background: var(--gold); }
.stam10.low i.on { background: var(--bad); }

/* search filter chips */
.fchip {
  font-family: var(--font-pix); font-size: 8px;
  padding: 6px 8px; margin: 2px 3px;
  background: var(--panel2); color: var(--dim);
  border: 2px solid var(--line); border-radius: 6px; cursor: pointer;
}
.fchip.on { color: #0b0e1a; background: var(--blue); border-color: #2a86a8; }
/* legacy classes from v1 saves' HOF entries */

.face { flex-shrink: 0; image-rendering: pixelated; border-radius: 4px; background: #1a2142; }
.prow .face { border: 1px solid var(--line2); }
.chip .face { display: block; margin: 0 auto 2px auto; }

.int-chip { font-family: var(--font-pix); font-size: 8px; padding: 3px 6px; border-radius: 5px; }
.int-chip.hi { background: #12381f; color: var(--good); }
.int-chip.md { background: #3d2d00; color: var(--gold); }
.int-chip.lo { background: #431425; color: var(--bad); }

.neg-card { border-color: var(--blue); }
.mmin.running { animation: minpulse 1s ease-in-out infinite; }
@keyframes minpulse { 0%,100% { color: var(--blue); } 50% { color: var(--gold); } }

table.tbl { width: 100%; border-collapse: collapse; font-size: 18px; }
table.tbl th { color: var(--dim); font-size: 14px; text-align: right; padding: 3px 4px; font-weight: normal; }
table.tbl th:first-child, table.tbl td:first-child { text-align: left; }
table.tbl td { padding: 3px 4px; text-align: right; border-top: 1px solid #222a4e; }
table.tbl tr.me td { background: rgba(255,210,63,.09); color: var(--gold); }
table.tbl tr.zone-up td { border-left: 3px solid var(--good); }
table.tbl tr.zone-dn td { border-left: 3px solid var(--bad); }

.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs button {
  font-family: var(--font-pix); font-size: 9px;
  padding: 8px 11px;
  background: var(--panel); color: var(--dim);
  border: 2px solid var(--line); border-radius: 7px; cursor: pointer;
}
.tabs button.on { color: #0b0e1a; background: var(--blue); border-color: #2a86a8; }

.tag { display: inline-block; font-size: 14px; padding: 1px 7px; border: 1px solid var(--line2); border-radius: 999px; color: var(--dim); margin-right: 4px; }
.tag.hot { color: var(--gold); border-color: var(--gold); }

/* ---------- main menu ---------- */
.menu-wrap { flex: 1; display: flex; align-items: center; justify-content: center; gap: 60px; padding: 24px; }
.logo {
  font-family: var(--font-pix); font-size: 38px; color: var(--gold);
  text-shadow: 0 4px 0 #7a6000, 0 8px 24px rgba(255,210,63,.35);
  line-height: 1.3;
}
.logo small { display: block; font-size: 10px; color: var(--blue); text-shadow: none; margin-top: 12px; letter-spacing: 2px; }
.menu-side { display: flex; flex-direction: column; gap: 12px; width: 320px; }
.menu-pitch {
  width: 170px; height: 110px; margin: 0 auto 14px auto;
  border: 3px solid var(--good); border-radius: 6px; position: relative; opacity: .85;
  background:
    linear-gradient(90deg, transparent 49%, var(--good) 49%, var(--good) 51%, transparent 51%),
    repeating-linear-gradient(90deg, #123c22 0 25px, #0e321c 25px 50px);
}
.menu-pitch::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 38px; height: 38px; margin: -21px 0 0 -21px;
  border: 3px solid var(--good); border-radius: 50%;
}

/* ---------- club select ---------- */
.cs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.club-card {
  background: var(--panel); border: 2px solid var(--line); border-radius: 10px;
  padding: 10px 12px; cursor: pointer;
}
.club-card:active { background: var(--panel2); }
.club-card .name { font-family: var(--font-pix); font-size: 10px; line-height: 1.5; }

/* ---------- first-launch onboarding (language + terms) ----------
   The card is a flex column capped at the frame height, so the title is ALWAYS
   pinned at the top (never clipped), the body scrolls inside, and the button
   stays at the bottom — fits every screen size / resolution. */
.onb-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 14px; min-height: 0; overflow: hidden; }
.onb-card {
  width: 100%; max-width: 520px; max-height: 100%;
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: 16px;
}
.onb-card > * { flex: 0 0 auto; }
.onb-card h3 { font-family: var(--font-pix); font-size: 12px; line-height: 1.5; margin-bottom: 6px; }
.onb-terms { max-width: 560px; }
.lang-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.lang-btn { justify-content: flex-start; gap: 8px; min-width: 0; }
.lang-btn.on { border-color: var(--gold); color: var(--gold); }
.lang-flag { font-size: 16px; }
.terms-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 4px 0 12px; padding-right: 6px; font-size: 13px; line-height: 1.55; color: var(--text); }
.terms-body p { margin: 0 0 8px; }
/* the two "read the full document" links at the foot of the consent screen */
.terms-body .legal-links { gap: 6px; margin: 14px 0 4px; }

/* ---------- full legal text on the consent screen ----------
   The complete Terms + Privacy Policy + deletion notice are rendered inside
   the existing scroll area, so the Accept button stays pinned below however
   long the document runs. */
.legal-full .lt-head {
  background: var(--panel2); border: 1px solid var(--line2);
  border-left: 3px solid var(--gold); border-radius: 8px;
  padding: 9px 11px; margin: 0 0 12px;
}
.legal-full .lt-head p { margin: 0 0 6px; }
.legal-full .lt-head p:last-child { margin-bottom: 0; }
.legal-full .meta { color: var(--dim); }
.legal-full .meta b { color: var(--text); }
.legal-full h2 { font-size: 13px; margin: 14px 0 5px; color: var(--text); line-height: 1.4; }
.legal-full h2.lt-doc {
  font-family: var(--font-pix); font-size: 11px; color: var(--gold);
  margin: 6px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line2);
  line-height: 1.6;
}
.legal-full h3 { font-size: 12px; margin: 10px 0 4px; color: var(--blue); }
.legal-full ul { margin: 0 0 8px; padding-left: 17px; }
.legal-full li { margin: 0 0 4px; }
.legal-full a { color: var(--blue); }
.legal-full .lt-sep { border-top: 2px solid var(--line2); margin: 18px 0 12px; }
.legal-full .lt-lede {
  background: var(--panel2); border-left: 3px solid var(--line2);
  border-radius: 6px; padding: 8px 10px; margin: 0 0 10px;
}
.legal-full .lt-lede p:last-child { margin-bottom: 0; }
.legal-full .card { background: var(--panel2); border: 1px solid var(--line2);
  border-radius: 6px; padding: 8px 10px; margin: 0 0 10px; }
.legal-full .card p:last-child, .legal-full .card ul:last-child { margin-bottom: 0; }
.legal-full .lt-table { overflow-x: auto; margin: 0 0 10px; }
.legal-full table { border-collapse: collapse; width: 100%; font-size: 12px; }
.legal-full th, .legal-full td {
  text-align: left; vertical-align: top; padding: 4px 6px;
  border-bottom: 1px solid var(--line);
}
.legal-full th { color: var(--gold); font-weight: 600; }
.legal-full .steps { list-style: none; padding-left: 0; }
.legal-full .steps li { padding-left: 0; }
html.short .onb-card h3 { font-size: 11px; margin-bottom: 4px; }
html.tiny .onb-card { padding: 12px; }

/* ---------- investor / rewarded-ad panel (Home) ---------- */
.panel.invest { border-color: var(--gold); }
.panel.invest .btn.mini { white-space: nowrap; }

/* ---------- interstitial ad break placeholder ---------- */
/* the between-seasons loading beat (the game's only interstitial slot) */
.onb-card.seasonbreak { max-width: 460px; }
.season-loading { color: var(--dim); font-size: 18px; margin: 10px 0 4px; }
.season-dots { display: flex; gap: 7px; justify-content: center; }
.season-dots i {
  width: 9px; height: 9px; border-radius: 50%; background: var(--gold);
  animation: seasondot 1.1s ease-in-out infinite;
}
.season-dots i:nth-child(2) { animation-delay: .16s; }
.season-dots i:nth-child(3) { animation-delay: .32s; }
@keyframes seasondot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .season-dots i { animation: none; opacity: .7; } }

/* ---------- HOME ---------- */
.home-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; align-items: start; }
.fixture-vs { display: flex; align-items: center; justify-content: space-around; gap: 6px; margin: 10px 0; }
.fixture-vs .team { text-align: center; width: 40%; }
.fixture-vs .team .tn { font-family: var(--font-pix); font-size: 9px; margin-top: 6px; line-height: 1.5; }
.fixture-vs .vs { font-family: var(--font-pix); font-size: 13px; color: var(--dim); }
.window-banner {
  font-size: 16px; text-align: center; padding: 5px;
  border-radius: 7px; margin-bottom: 10px;
  background: #12381f; border: 1px solid #1d9a55; color: var(--good);
}
.window-banner.closed { background: #2b1220; border-color: #a51c3a; color: var(--bad); }

/* ---------- SQUAD (landscape pitch: you attack RIGHT) ---------- */
.squad-row { display: flex; gap: 12px; height: 100%; }
.pitch-wrap { flex: 1.45; display: flex; flex-direction: column; min-width: 0; }
.pitch2 {
  flex: 1; position: relative; border-radius: 10px; overflow: hidden;
  border: 3px solid #0e5e33;
  min-height: 0;
  background: repeating-linear-gradient(90deg, #17813f 0 12.5%, #126b34 12.5% 25%);
}
.pitch2::before {
  content: ''; position: absolute; inset: 8px;
  border: 2px solid rgba(255,255,255,.55); border-radius: 4px; pointer-events: none;
}
/* pitch furniture (landscape: our goal left, theirs right) */
.pm { position: absolute; pointer-events: none; }
.pm-hband { inset: 0; background: repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 12%, transparent 12% 24%); }
.pm-box-l { left: 8px; top: 22%; bottom: 22%; width: 14%; border: 2px solid rgba(255,255,255,.5); border-left: none; }
.pm-six-l { left: 8px; top: 36%; bottom: 36%; width: 6%; border: 2px solid rgba(255,255,255,.45); border-left: none; }
.pm-box-r { right: 8px; top: 22%; bottom: 22%; width: 14%; border: 2px solid rgba(255,255,255,.5); border-right: none; }
.pm-six-r { right: 8px; top: 36%; bottom: 36%; width: 6%; border: 2px solid rgba(255,255,255,.45); border-right: none; }
.pm-circle { left: 50%; top: 50%; width: 17%; aspect-ratio: 1; transform: translate(-50%, -50%); border: 2px solid rgba(255,255,255,.5); border-radius: 50%; }
.pm-halfway { left: 50%; top: 8px; bottom: 8px; width: 2px; background: rgba(255,255,255,.5); }
.pm-spot-l { left: 11%; top: 50%; width: 5px; height: 5px; margin-top: -2px; background: rgba(255,255,255,.6); border-radius: 50%; }
.pm-spot-r { right: 11%; top: 50%; width: 5px; height: 5px; margin-top: -2px; background: rgba(255,255,255,.6); border-radius: 50%; }
/* compact premium card — fits the landscape pitch, reads in a glance */
.chip {
  position: absolute; transform: translate(-50%, -50%);
  width: 74px; text-align: center; cursor: grab; touch-action: none; z-index: 2;
}
.chip.p-GK { width: 64px; }
.chip .cbody {
  background: linear-gradient(180deg, #232b52, #141a33);
  border: 1.5px solid var(--line2); border-radius: 6px;
  padding: 1px 2px 2px 2px;
  box-shadow: 0 2px 0 rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.06);
  line-height: 1;
}
.chip .cname {
  font-family: var(--font-body); font-size: 15px; color: var(--text);
  margin: 0; line-height: 1; height: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chip .cmeta { font-size: 10px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 1px; line-height: 1; height: 10px; }
.chip .stam10 { display: flex; justify-content: center; }
.chip .stam10 i { width: 4px; height: 4px; }
.chip.p-GK .cbody { border-color: #ff6b6b; }
.chip.p-CB .cbody { border-color: #ffa94d; }
.chip.p-FB .cbody { border-color: var(--gold); }
.chip.p-CM .cbody { border-color: var(--good); }
.chip.p-WG .cbody { border-color: var(--purple); }
.chip.p-ST .cbody { border-color: var(--blue); }
.chip .cname { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.dragging { opacity: .35; }
.drag-ghost {
  position: fixed; z-index: 200; pointer-events: none;
  transform: translate(-50%, -50%) scale(1.05); width: 88px;
}
.bench-col { flex: 1; overflow-y: auto; min-width: 250px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
/* pan-y lets a finger on a row scroll the list vertically (tap-to-view and
   mouse drag-swap still work); 'none' here used to block all touch scrolling. */
.bench-col .prow { touch-action: pan-y; }
/* always-visible thin scroller so it's obvious the list scrolls on mobile */
.bench-col::-webkit-scrollbar { width: 7px; }
.bench-col::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.bench-col::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* ---------- MATCH (arena) ---------- */
.match2 { position: absolute; inset: 0; display: flex; flex-direction: column; background: #071108; z-index: 30; }
.mtop {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 16px 4px 14px;
  background: linear-gradient(180deg, #131840, #0d1126);
  border-bottom: 2px solid var(--line);
  flex-shrink: 0;
}
.mtop .mscore { font-family: var(--font-pix); font-size: 27px; color: var(--gold); letter-spacing: 2px; text-shadow: 0 3px 0 #7a6000; }
.mtop .mteam { font-family: var(--font-pix); font-size: 11px; }
.mtop .mmin {
  font-family: var(--font-pix); font-size: 16px; color: var(--blue);
  background: var(--panel2); border: 2px solid var(--line2); border-radius: 999px; padding: 4px 12px;
}
.mtop .mom { width: 90px; height: 11px; }
.mtop .mcomp { margin-left: auto; font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32%; }

.arena { flex: 1; position: relative; min-height: 0; }
.arena-pitch {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, #14522c 0 64px, #114a27 64px 128px);
}
.arena-pitch::before {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 32%; height: auto; aspect-ratio: 1; transform: translate(-50%, -50%);
  border: 3px solid rgba(255,255,255,.18); border-radius: 50%;
}
.arena-pitch::after {
  content: ''; position: absolute; left: 50%; top: 0; bottom: 0;
  width: 3px; background: rgba(255,255,255,.18);
}

/* Fixed geometry: the feed fills the top, the controls NEVER move.
   Every Continue press lands in exactly the same place, all match. */
.arena-overlay {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column;
  background: rgba(5, 8, 16, .68); padding: 6px 10px 10px 10px;
}
.decision-wrap { width: 100%; height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.decision-wrap .feedbox {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  width: 100%; margin-bottom: 8px; scrollbar-width: thin;
  /* newest line stays pinned to the bottom natively — no JS scroll needed.
     Feed is rendered newest-first in the DOM (see matchui.js). */
  display: flex; flex-direction: column-reverse;
  -webkit-overflow-scrolling: touch;
}
/* don't let flexbox compress the lines — they keep height and the box scrolls */
.feedbox .feed-line { flex: 0 0 auto; }
/* the control zone has a RESERVED height: whether it holds one Continue
   button or three tactical options, its edges never move all match.
   Landscape: the zone owns most of the arena; the feed peeks above and
   scrolls for history. */
.mctl { flex-shrink: 0; width: 100%; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; justify-content: flex-end; min-height: min(196px, 54%); }
.mctl .btn { width: 100%; }
.mctl .opt-btn:last-child { margin-bottom: 0; }
/* slim in-match controls so text + three options fit while the feed keeps room */
.mctl .opt-btn { padding: 5px 12px; font-size: 16px; margin-bottom: 5px; }
.mctl .opt-btn .oh { font-size: 12px; }
.mctl .scenario-text { padding: 5px 12px; font-size: 15px; margin-bottom: 6px; }
.decision-wrap .feedbox { max-width: 640px; margin-left: auto; margin-right: auto; }
.decision-wrap .scenario-text, .decision-wrap .opt-btn { width: 100%; }

.scenario-text {
  font-size: 21px; padding: 9px 12px; margin-bottom: 8px;
  background: var(--panel2); border: 2px solid var(--line2); border-radius: 8px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.step-dots { color: var(--gold); font-size: 13px; letter-spacing: 2px; white-space: nowrap; }

.opt-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 7px;
  padding: 9px 13px;
  background: var(--panel);
  color: var(--text);
  border: 2px solid var(--line2);
  border-radius: 9px;
  font-family: var(--font-body); font-size: 21px;
  cursor: pointer;
  text-align: left;
}
.opt-btn:active { background: var(--panel2); transform: translateY(2px); }
.opt-btn .oh { display: block; font-size: 15px; color: var(--dim); }
.risk { font-family: var(--font-pix); font-size: 8px; padding: 4px 7px; border-radius: 5px; flex-shrink: 0; }
.risk.SAFE { background: #12381f; color: var(--good); }
.risk.RISKY { background: #3d2d00; color: var(--gold); }
.risk.BOLD { background: #431425; color: var(--bad); }

.mom { width: 96px; height: 10px; background: #1a2142; border: 1px solid var(--line2); border-radius: 5px; overflow: hidden; flex-shrink: 0; }
.mom i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--gold)); transition: width .4s; }
.feed-line {
  padding: 4px 9px; border-radius: 8px; margin-bottom: 4px;
  background: rgba(22,27,51,.9); border: 1px solid #232b52; font-size: 15px;
}
.feed-line .fm { color: var(--blue); font-size: 11px; margin-right: 6px; font-family: var(--font-pix); }
.feed-line.good { border-color: #1d9a55; }
.feed-line.bad { border-color: #a51c3a; }
.feed-line.goal { border-color: var(--gold); background: rgba(61,44,0,.6); color: var(--gold); font-size: 17px; }
.feed-line.latest { animation: popin .18s ease-out; }
@keyframes popin { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.goal-overlay {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
  animation: goalfade 1.15s ease-out forwards;
}
.goal-overlay .gtxt {
  font-family: var(--font-pix); font-size: 46px; color: var(--gold);
  text-shadow: 0 5px 0 #7a6000, 0 0 40px rgba(255,210,63,.8); text-align: center;
  animation: goalpop 1.15s cubic-bezier(.2,1.6,.4,1) forwards;
}
.goal-overlay.against .gtxt { color: var(--bad); text-shadow: 0 5px 0 #7c1029, 0 0 40px rgba(255,84,112,.8); }
@keyframes goalpop { 0% { transform: scale(.2) rotate(-6deg); } 22% { transform: scale(1.15) rotate(2deg); } 34% { transform: scale(1); } 100% { transform: scale(1); } }
@keyframes goalfade { 0%,72% { opacity: 1; } 100% { opacity: 0; } }

.reward-line { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #222a4e; font-size: 19px; gap: 18px; }
.reward-line:last-child { border-bottom: none; }

/* ---------- modals ---------- */
.modal-back {
  position: absolute; inset: 0; z-index: 60;
  background: rgba(4,6,14,.8);
  display: flex; align-items: center; justify-content: center;
  animation: fadein .15s ease-out;
}
@keyframes fadein { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: min(560px, 92%); max-height: 88%;
  overflow-y: auto;
  background: var(--bg2);
  border: 2px solid var(--line2); border-top: 3px solid var(--gold);
  border-radius: 14px;
  padding: 16px;
  animation: slideup .18s ease-out;
  scrollbar-width: thin;
}
@keyframes slideup { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.modal h3 { font-family: var(--font-pix); font-size: 12px; color: var(--gold); margin-bottom: 10px; line-height: 1.6; }
.event-icon { font-size: 40px; text-align: center; margin-bottom: 6px; }
.event-body { font-size: 20px; margin-bottom: 14px; }

/* ---------- text fields (Legacy Account) ----------
   The game had no input anywhere until sign-in arrived, so this is the whole
   of it: same panel colours, same borders, same focus gold as every button. */
.field { display: block; margin-top: 8px; }
.field .fl { display: block; font-size: 15px; color: var(--dim); margin-bottom: 3px; }
.field input {
  width: 100%; box-sizing: border-box;
  font-family: var(--font-body); font-size: 19px; color: var(--text);
  background: var(--panel2);
  border: 1px solid var(--line2); border-radius: 8px;
  padding: 10px 11px;
  outline: none;
  -webkit-appearance: none; appearance: none;
}
.field input::placeholder { color: #4a5480; }
.field input:focus { border-color: var(--gold); background: #171d3a; }
.field input:disabled { opacity: .5; }

.acct-msg {
  font-size: 16px; line-height: 1.4;
  margin-top: 8px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line2); background: var(--panel2);
}
.acct-msg.ok { color: var(--good); border-color: #1d9a55; }
.acct-msg.err { color: var(--bad); border-color: #a51c3a; }
html.short .field { margin-top: 4px; }
html.short .field input { padding: 7px 10px; font-size: 17px; }

.stat-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.stat-row .sl { width: 44px; color: var(--dim); font-size: 16px; }
.stat-row .sv { width: 34px; text-align: right; font-size: 18px; color: var(--text); }

.toast {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 80;
  max-width: 70%;
  background: #23294d; border: 2px solid var(--gold); border-radius: 9px;
  padding: 9px 16px; font-size: 18px; text-align: center;
  animation: toastin 2.6s ease forwards; pointer-events: none;
}
@keyframes toastin { 0% { transform: translate(-50%, 16px); opacity: 0 } 8%,80% { transform: translate(-50%, 0); opacity: 1 } 100% { opacity: 0 } }

/* ---------- legacy / history ---------- */
.legacy-hero {
  text-align: center; padding: 14px 10px;
  background: linear-gradient(180deg, #241d00, var(--panel));
  border: 2px solid var(--gold); border-radius: 10px; margin-bottom: 10px;
}
.legacy-pts { font-family: var(--font-pix); font-size: 28px; color: var(--gold); text-shadow: 0 3px 0 #7a6000; }
.legacy-tier { font-size: 18px; color: var(--blue); margin-top: 6px; }
.trophy-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.trophy-cell { text-align: center; background: var(--panel2); border: 1px solid var(--line2); border-radius: 8px; padding: 7px 2px; }
.trophy-cell .tc-n { font-family: var(--font-pix); font-size: 13px; color: var(--gold); }
.trophy-cell .tc-l { font-size: 13px; color: var(--dim); margin-top: 3px; }
.timeline-item { display: flex; gap: 9px; padding: 4px 0; border-bottom: 1px solid #202849; font-size: 18px; }
.timeline-item .yr { color: var(--gold); font-family: var(--font-pix); font-size: 10px; padding-top: 4px; flex-shrink: 0; }
.news-item { display: flex; gap: 8px; padding: 5px 0; border-bottom: 1px solid #202849; font-size: 18px; }
.news-item:last-child { border-bottom: none; }
.news-item .when { color: var(--dim); font-size: 14px; flex-shrink: 0; width: 44px; }

/* minmax(0,1fr) lets each column shrink to its share of the width instead of
   growing to fit its widest content — so two cards always fit a row and the
   long name just ellipsises. Prevents the left/right scroll. */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }

/* ---------- review ---------- */
.review-hero { text-align: center; padding: 12px 10px; }
.review-hero .season-yr { font-family: var(--font-pix); font-size: 12px; color: var(--blue); }
.review-hero .headline { font-family: var(--font-pix); font-size: 16px; color: var(--gold); margin-top: 10px; line-height: 1.7; }

.prospect-card { border-color: var(--purple); }
.prospect-card .panel-title { color: var(--purple); }

/* Short-viewport compaction is keyed to the LOGICAL height after scaling
   (UI.fitScale toggles html.tiny / html.short) rather than raw px, so it kicks
   in correctly whether the device is a small phone or a wide screen scaled up. */
html.tiny body { font-size: 18px; }
html.tiny .topbar { padding-top: 4px; padding-bottom: 5px; }
html.tiny .opt-btn { padding: 7px 11px; font-size: 19px; }
html.tiny .logo { font-size: 28px; }

/* short screens: compress the player card so the whole bio + Close button fit
   on screen and nothing has to be scrolled to close it */
html.short .modal { max-height: 94%; padding: 11px 14px; }
html.short .modal h3 { margin-bottom: 4px; line-height: 1.3; }
html.short .sheet-rate { margin-top: 2px; gap: 4px; }
html.short .ovrhuge { font-size: 18px; }
html.short .pothuge { font-size: 15px; }
html.short .posrate { margin-top: 5px; gap: 4px; }
html.short .modal .two-col { gap: 8px; }
html.short .modal .mt8 { margin-top: 4px; }
html.short .modal .panel { padding: 6px 9px; }
html.short .modal .stat-row { padding: 1px 0; }
html.short .modal .stat-row .sl { font-size: 15px; }
html.short .modal .stat-row .sv { font-size: 16px; }
html.short .modal .reward-line { padding: 2px 0; font-size: 16px; }

/* ---------- accessibility: respect reduced-motion ----------
   Vestibular-safe mode. Animations are decorative here (goal pop, feed
   slide-in, the rotate hint, the ticking clock pulse) — the game reads
   identically without them, so we simply stop them rather than redesign. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .goal-overlay { opacity: 1; }
}

/* ---------- accessibility: visible keyboard focus ----------
   Pointer users never see this (:focus-visible), but anyone tabbing through
   the game gets an unmistakable ring instead of an invisible cursor. */
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- touch reliability ----------
   Small pixel-art controls get an invisible, larger hit area so a fingertip
   doesn't have to be precise. The expansion is capped at the existing gap
   between neighbours, so no two controls ever overlap and steal each other's
   taps. Nothing moves visually. */
.fchip, .tabs button, .btn.mini, .tb-gear { position: relative; }
.fchip::after,
.tabs button::after,
.btn.mini::after,
.tb-gear::after {
  content: '';
  position: absolute;
  inset: -6px -3px;   /* vertical breathing room; horizontal stays inside the gap */
}
/* Buttons are tap targets, never scroll-starts or double-tap-to-zoom targets
   (the frame does its own scaling).
   DELIBERATELY EXCLUDED: `.chip` needs `touch-action: none` to be draggable on
   the pitch, and `.bench-col .prow` needs `pan-y` so the bench list still
   scrolls under a finger. Overriding either would break those gestures. */
.btn, .fchip, .tabs button, .tb-gear, .rail button, .opt-btn, .club-card {
  touch-action: manipulation;
}
