/* =========================================================================
   Süper Lig Draft — mobile-first dark/teal sports app (light/dark themed).
   ========================================================================= */

:root {
  --ink: #081311;
  --ink-2: #0e1c1b;
  --ink-3: #142927;
  --ink-4: #1d3a37;
  --bone: #eaf4f3;
  --dim: #93aeac;
  --faint: #5f7674;

  --accent: #2fd9e3;
  --accent-2: #19b8c2;
  --accent-deep: #0c8088;
  --gold: #ffcf5a;
  --crimson: #ff6b63;
  --green: #45c98f;

  --line: rgba(234, 244, 243, 0.08);
  --line-2: rgba(234, 244, 243, 0.16);

  --display: "Sora", system-ui, sans-serif;
  --body: "Manrope", system-ui, sans-serif;
  --mono: "Spline Sans Mono", ui-monospace, monospace;

  --r: 22px;
  --r-sm: 14px;
  --shadow: 0 22px 50px -26px rgba(0, 0, 0, 0.85);
  --maxw: 600px;
  --topbar-bg: rgba(8, 19, 17, 0.82);
}

[data-theme="light"] {
  --ink: #eaf1f0;
  --ink-2: #ffffff;
  --ink-3: #e7efed;
  --ink-4: #d2e0dd;
  --bone: #0b1b19;
  --dim: #4a6360;
  --faint: #7d9592;
  --accent: #12a3ad;
  --accent-2: #0c8088;
  --accent-deep: #0a6970;
  --gold: #c2841a;
  --crimson: #db463f;
  --green: #169367;
  --line: rgba(11, 27, 25, 0.1);
  --line-2: rgba(11, 27, 25, 0.18);
  --shadow: 0 20px 44px -28px rgba(20, 70, 66, 0.4);
  --topbar-bg: rgba(234, 241, 240, 0.85);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body); background: var(--ink); color: var(--bone);
  min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden;
  line-height: 1.45; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }

/* ---- atmosphere -------------------------------------------------------- */
.floods {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(70% 45% at 15% -10%, rgba(47, 217, 227, 0.18), transparent 70%),
    radial-gradient(70% 45% at 90% -6%, rgba(25, 184, 194, 0.12), transparent 72%),
    radial-gradient(120% 90% at 50% 118%, rgba(12, 128, 136, 0.12), transparent 60%);
}
.pitch-lines {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.5;
  background-image: linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 58px 58px;
  -webkit-mask-image: radial-gradient(85% 65% at 50% 25%, #000 30%, transparent 85%);
          mask-image: radial-gradient(85% 65% at 50% 25%, #000 30%, transparent 85%);
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- topbar ------------------------------------------------------------ */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 0.8rem; padding: 0.9rem clamp(1rem, 5vw, 1.4rem); padding-top: max(0.9rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line); background: var(--topbar-bg); backdrop-filter: blur(12px);
}
.wordmark { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(1rem, 4.2vw, 1.25rem); letter-spacing: 0.01em; white-space: nowrap; display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.wordmark:hover { color: var(--accent); }
/* Neon-glowing logo mark replaces the old accent bar. Layered drop-shadows in
   the accent colour read as neon; a gentle pulse keeps it alive. */
.wordmark-logo {
  height: 1.7em; width: auto; display: block; flex: none;
  filter: drop-shadow(0 0 4px var(--accent)) drop-shadow(0 0 11px var(--accent));
  animation: neonPulse 2.8s ease-in-out infinite;
  transition: filter 0.2s ease, transform 0.2s ease;
}
.wordmark:hover .wordmark-logo {
  filter: drop-shadow(0 0 6px var(--accent)) drop-shadow(0 0 18px var(--accent));
  transform: scale(1.06) rotate(-2deg);
}
@keyframes neonPulse {
  0%, 100% { filter: drop-shadow(0 0 3px var(--accent)) drop-shadow(0 0 8px var(--accent)); }
  50%      { filter: drop-shadow(0 0 6px var(--accent)) drop-shadow(0 0 16px var(--accent)); }
}
@media (prefers-reduced-motion: reduce) {
  .wordmark-logo { animation: none; }
}
.wordmark .tag { font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--line-2); padding: 0.2rem 0.45rem; border-radius: 100px; }
.phase-rail { display: flex; gap: 0.25rem; }
.phase-rail span { font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); padding: 0.32rem 0.6rem; border-radius: 100px; border: 1px solid transparent; }
.phase-rail span.on { color: var(--ink); background: var(--accent); font-weight: 600; }
.phase-rail span.done { color: var(--dim); border-color: var(--line); }
.topbar-right { display: flex; align-items: center; gap: 0.55rem; }
.theme-toggle { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 1px solid var(--line-2); background: var(--ink-2); color: var(--bone); font-size: 0.95rem; display: grid; place-items: center; transition: all 0.15s ease; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

/* Install-app button — same shape as the theme toggle, but ONLY on mobile
   (the install guide covers phone Chrome/Safari). */
.install-btn { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 1px solid var(--accent); background: var(--ink-2); color: var(--accent); display: grid; place-items: center; transition: all 0.15s ease; }
.install-btn:hover { background: var(--accent); color: #05201f; transform: translateY(-1px); }
@media (min-width: 768px) { .install-btn { display: none; } }

/* Install guide modal (two tabs × three screenshots) */
.install-overlay { position: fixed; inset: 0; z-index: 9995; display: flex; align-items: flex-end; justify-content: center; padding: 0; background: rgba(4, 12, 11, 0.72); backdrop-filter: blur(4px); animation: pvpIn 0.2s ease both; }
.install-modal { width: 100%; max-width: 460px; max-height: 90vh; display: flex; flex-direction: column; border: 1px solid var(--accent); border-bottom: none; border-radius: var(--r) var(--r) 0 0; background: var(--ink); box-shadow: 0 -20px 60px -16px rgba(0, 0, 0, 0.7); animation: sheetUp 0.25s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.install-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.1rem 0.6rem; }
.install-title { font-family: var(--display); font-weight: 800; font-size: 1.05rem; color: var(--bone); }
.install-x { width: 32px; height: 32px; flex: none; border-radius: 50%; border: 1px solid var(--line-2); background: transparent; color: var(--dim); font-size: 1.3rem; line-height: 1; display: grid; place-items: center; }
.install-x:hover { color: var(--bone); border-color: var(--accent); }
.install-tabbar { display: flex; gap: 0.4rem; padding: 0 1.1rem 0.8rem; }
.install-tab { flex: 1; padding: 0.6rem; border-radius: 100px; border: 1px solid var(--line-2); background: var(--ink-2); color: var(--dim); font-family: var(--body); font-weight: 700; font-size: 0.85rem; transition: all 0.15s ease; }
.install-tab.on { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: #05201f; border-color: transparent; }
.install-body { overflow-y: auto; padding: 0 1.1rem calc(1.1rem + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.install-steps { display: flex; flex-direction: column; gap: 1.1rem; }
/* each step is its own card so the screenshots don't blend into one image */
.install-step { border: 1px solid var(--line-2); border-radius: 14px; padding: 0.85rem; background: var(--ink-2); }
.install-step-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.55rem; }
.install-step-num { width: 1.4rem; height: 1.4rem; flex: none; border-radius: 50%; background: var(--accent); color: #05201f; font-family: var(--mono); font-weight: 700; font-size: 0.8rem; display: grid; place-items: center; }
.install-step-cap { font-size: 0.9rem; font-weight: 600; color: var(--bone); }
.install-step-img { width: 100%; height: auto; display: block; border-radius: 10px; border: 1px solid var(--line-2); box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.6); }
.install-note { margin: 0; padding: 0.7rem 0.85rem; border: 1px solid var(--line-2); border-left: 3px solid var(--accent); border-radius: 10px; background: var(--ink-2); color: var(--dim); font-size: 0.8rem; line-height: 1.55; }

/* ---- layout ------------------------------------------------------------ */
#app { position: relative; z-index: 2; flex: 1; width: 100%; max-width: var(--maxw); margin: 0 auto; padding: clamp(1rem, 5vw, 1.6rem) clamp(1rem, 5vw, 1.4rem) 2.4rem; }
.footer { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 0.2rem; align-items: center; text-align: center; padding: 1rem 1.2rem calc(1rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); font-family: var(--mono); font-size: 0.62rem; color: var(--faint); }
.footer-note { font-style: italic; }
/* The fixed match bar owns the bottom edge — a footer there just sits behind the
   bar and steals clicks. Hide it whenever the bar is on screen (single-player
   season AND multiplayer sim). */
body[data-view="season"] .footer { display: none; }
body:has(.match-bar) .footer { display: none; }

/* Crawlable description below the app. Stays in the raw HTML (good for SEO /
   no-JS crawlers) but is only shown on the main page; hidden on every other
   view (setup/draft/season/result/rooms) so it never competes with the game. */
.seo-about { max-width: 46ch; margin: 0.5rem auto 2rem; padding: 0 1.2rem; text-align: center; color: var(--dim); }
.seo-about h2 { font-family: var(--display); font-size: 1.05rem; color: var(--bone); margin: 0 0 0.5rem; }
.seo-about p { font-size: 0.82rem; line-height: 1.55; margin: 0 0 0.6rem; }
.seo-about strong { color: var(--bone); }
body[data-view]:not([data-view="intro"]) .seo-about { display: none; }
.footer-links { display: flex; gap: 1rem; }
.footer-links a, .footer-links a:visited { color: var(--dim); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.eyebrow { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); }

/* ---- buttons ----------------------------------------------------------- */
.btn { font-family: var(--body); font-weight: 800; font-size: 0.98rem; letter-spacing: 0.01em; border-radius: 100px; padding: 1rem 1.6rem; color: #05201f; background: linear-gradient(180deg, var(--accent), var(--accent-2)); box-shadow: 0 14px 30px -12px rgba(47, 217, 227, 0.5); transition: transform 0.14s ease, box-shadow 0.2s ease, opacity 0.2s; width: 100%; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -14px rgba(47, 217, 227, 0.6); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; box-shadow: none; transform: none; }
.btn--ghost { background: transparent; color: var(--bone); border: 1px solid var(--line-2); box-shadow: none; }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); box-shadow: none; }
.btn--x { background: #0f1419; color: #fff; box-shadow: none; border: 1px solid rgba(255, 255, 255, 0.18); }
.btn--x:hover { background: #20262c; box-shadow: none; }
.btn--roll { font-size: 1.15rem; letter-spacing: 0.05em; padding: 1.15rem; }
.btn--roll .dice { display: inline-block; animation: dicebob 1.6s ease-in-out infinite; }
.btn--roll:hover .dice { animation: diceroll 0.6s linear infinite; }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.btn-row .btn { width: auto; flex: 1; min-width: 130px; }
.mode-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
/* selectable chip (mode on intro, season-scope on setup) — toggle .sel, don't navigate */
.mode-btn { display: flex; flex-direction: column; gap: 0.18rem; align-items: center; padding: 0.95rem 0.6rem; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--ink-3); color: var(--bone); transition: all 0.15s ease; }
.mode-btn:hover { border-color: var(--dim); }
.mode-btn strong { font-size: 1.05rem; font-weight: 800; }
.mode-btn small { font-family: var(--mono); font-size: 0.54rem; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.8; }
.mode-btn.sel { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: #05201f; border-color: var(--accent); }
.mode-btn.sel small { color: rgba(5, 32, 31, 0.72); opacity: 1; }
/* season-scope chips selected in a distinct colour so they don't read like the mode chips */
.mode-btn.scope-btn.sel { background: linear-gradient(180deg, var(--gold), #d9a72f); border-color: var(--gold); }
.mode-btn.scope-btn.sel small { color: rgba(32, 24, 5, 0.72); }

/* auto-reconnect toast (multiplayer) */
.reconnect-toast {
  position: fixed; left: 50%; bottom: 1.1rem; transform: translateX(-50%);
  z-index: 1200; background: rgba(12, 27, 28, 0.96); color: var(--bone);
  border: 1px solid var(--accent); border-radius: 999px; padding: 0.55rem 1.1rem;
  font-size: 0.85rem; font-weight: 600; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

/* ---- panels ------------------------------------------------------------ */
.panel { background: linear-gradient(180deg, var(--ink-2), var(--ink)); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.panel-pad { padding: clamp(1.1rem, 4vw, 1.5rem); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.9rem; }

/* ---- intro ------------------------------------------------------------- */
.hero { display: grid; gap: 1.4rem; padding: clamp(1rem, 5vh, 2.4rem) 0; }
.hero-art { border-radius: var(--r); padding: 1.6rem; min-height: 200px; display: flex; align-items: flex-end; position: relative; overflow: hidden; border: 1px solid var(--line-2);
  background: radial-gradient(120% 120% at 80% 10%, rgba(47, 217, 227, 0.22), transparent 55%), repeating-linear-gradient(110deg, rgba(255,255,255,0.03) 0 2px, transparent 2px 22px), linear-gradient(150deg, #0c2b2c, #071413); }
.hero-art .ball { position: absolute; top: 1.1rem; right: 1.3rem; font-size: 2.4rem; filter: drop-shadow(0 8px 14px rgba(0,0,0,.5)); animation: float 4s ease-in-out infinite; }
.hero-title { font-family: var(--display); font-weight: 800; font-size: clamp(2.5rem, 11vw, 3.6rem); line-height: 1.0; letter-spacing: -0.02em; white-space: pre-line; }
.hero-title em { font-style: normal; color: var(--accent); }
.hero-lede { color: var(--dim); font-size: 1.02rem; max-width: 42ch; }
.hero-lede b { color: var(--bone); font-weight: 700; }
.hero-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.hero-meta div { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0.7rem 0.4rem; text-align: center; font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.04em; color: var(--faint); text-transform: uppercase; }
.hero-meta b { display: block; font-family: var(--display); font-size: 1.4rem; color: var(--accent); margin-bottom: 0.1rem; }
.hint { font-family: var(--mono); font-size: 0.72rem; color: var(--dim); }

/* ---- setup ------------------------------------------------------------- */
.stack { display: grid; gap: 1.1rem; }
.field-label { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); margin-bottom: 0.6rem; display: block; }
.text-input { width: 100%; background: var(--ink-3); border: 1px solid var(--line-2); color: var(--bone); border-radius: var(--r-sm); padding: 0.95rem 1rem; font-size: 1.2rem; font-weight: 700; }
.text-input:focus { outline: none; border-color: var(--accent); }
.formation-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
.formation-chip { border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0.9rem; background: var(--ink-3); display: flex; flex-direction: column; gap: 0.25rem; align-items: center; transition: all 0.15s ease; font-family: var(--mono); font-size: 1rem; font-weight: 600; }
.formation-chip small { font-size: 0.58rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.formation-chip.sel { background: linear-gradient(180deg, var(--accent), var(--accent-2)); color: #05201f; border-color: var(--accent); }
.formation-chip.sel small { color: rgba(5, 32, 31, 0.72); }

/* club picker (kickoff) */
.club-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.55rem; }
.club-chip { display: flex; align-items: center; gap: 0.55rem; padding: 0.6rem 0.7rem; text-align: left; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--ink-2); color: var(--bone); transition: all 0.15s ease; }
.club-chip:hover { border-color: var(--dim); transform: translateY(-1px); }
.club-chip.sel { border-color: var(--accent); background: rgba(47, 217, 227, 0.1); box-shadow: inset 0 0 0 1px var(--accent); }
.club-chip .ci { min-width: 0; flex: 1; }
.club-chip .ci .cn { font-weight: 700; font-size: 0.82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.club-chip .ci .cs { font-family: var(--mono); font-size: 0.58rem; color: var(--faint); }
.club-chip.weak .cs { color: var(--crimson); }
.club-chip .ov { font-family: var(--mono); font-size: 0.82rem; color: var(--accent); }

/* ---- multiplayer rooms ------------------------------------------------- */
.or-divider { text-align: center; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.room-code { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; }
.room-code-big { font-family: var(--display); font-weight: 800; font-size: 2rem; letter-spacing: 0.18em; color: var(--accent); }
.room-players { display: grid; gap: 0.5rem; }
.room-player { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.7rem 0.9rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--ink-2); }
.room-player.me { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.room-player .rp-name { font-weight: 700; }
.room-player .rp-host { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }
.room-player .rp-right { display: flex; align-items: center; gap: 0.5rem; }
.room-player .rp-kick { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 1.05rem; line-height: 1; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--ink-3); color: var(--dim); cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.room-player .rp-kick:hover { color: var(--crimson); border-color: var(--crimson); }
.draft-draw { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin: 0.6rem 0 0.9rem; }
.draft-draw-team { font-family: var(--display); font-weight: 800; font-size: 1.1rem; }
.room-player .rp-host.done { color: var(--green); }
.emoji-bar { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.emoji-btn { font-size: 1.5rem; line-height: 1; padding: 0.4rem 0.5rem; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--ink-3); transition: transform 0.1s ease, opacity 0.2s; }
.emoji-btn:hover { transform: translateY(-2px); border-color: var(--accent); }
.emoji-btn:disabled { opacity: 0.35; }
.emoji-pop { position: fixed; bottom: 12vh; z-index: 9999; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 0.2rem; animation: emojiPop 3s ease-out forwards; }
.emoji-pop-em { font-size: clamp(3rem, 12vw, 5rem); filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.5)); }
.emoji-pop-name { font-family: var(--mono); font-size: 0.72rem; color: var(--bone); background: rgba(0, 0, 0, 0.55); padding: 0.15rem 0.5rem; border-radius: 100px; }
@keyframes emojiPop {
  0% { opacity: 0; transform: translateY(20px) scale(0.5); }
  15% { opacity: 1; transform: translateY(0) scale(1.15); }
  30% { transform: scale(1); }
  80% { opacity: 1; transform: translateY(-40px) scale(1); }
  100% { opacity: 0; transform: translateY(-110px) scale(0.95); }
}

/* emoji tooltip on the sticky bar */
.emoji-tip { position: relative; }
.emoji-toggle { width: auto !important; padding: 0.6rem 0.9rem; font-size: 1.1rem; }
.emoji-menu { position: absolute; bottom: calc(100% + 0.5rem); right: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; width: 232px; padding: 0.55rem; background: var(--ink-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); box-shadow: var(--shadow); z-index: 60; }
.emoji-menu.hidden { display: none; }

/* other player teams in the standings */
.row.rival .nm { color: var(--accent); }
.fixture.pvp { border: 1px solid rgba(47, 217, 227, 0.35); border-radius: var(--r-sm); }

/* player-vs-player match popup (slow reveal) */
.pvp-overlay { position: fixed; inset: 0; z-index: 9990; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: rgba(4, 12, 11, 0.72); backdrop-filter: blur(4px); animation: pvpIn 0.25s ease both; }
@keyframes pvpIn { from { opacity: 0; } to { opacity: 1; } }
.pvp-card { width: 100%; max-width: 460px; padding: 2rem 1.6rem; border-radius: var(--r); border: 1px solid var(--accent); background: linear-gradient(160deg, var(--ink-2), var(--ink)); text-align: center; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7); }
.pvp-tag { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--accent); margin-bottom: 1.2rem; }
/* Vertical stack: home / score / away. Robust to long or single-word team
   names on narrow phones (the old 3-col grid overflowed and split the score). */
.pvp-teams { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.pvp-team { font-family: var(--display); font-weight: 800; font-size: 1.3rem; line-height: 1.15; text-align: center; max-width: 100%; overflow-wrap: anywhere; transition: color 0.3s, transform 0.3s; }
.pvp-team.win { color: var(--accent); transform: scale(1.05); }
.pvp-team.lose { color: var(--faint); }
.pvp-score { font-family: var(--display); font-weight: 800; font-size: 3rem; line-height: 1; letter-spacing: 0.03em; color: var(--bone); white-space: nowrap; margin: 0.1rem 0; }
.pvp-overlay.revealed .pvp-score { animation: pvpScore 0.4s ease; }
@keyframes pvpScore { 0% { transform: scale(0.6); opacity: 0.3; } 60% { transform: scale(1.2); } 100% { transform: scale(1); opacity: 1; } }

/* ---- badges ------------------------------------------------------------ */
.badge { display: inline-grid; place-items: center; flex: none; border-radius: 30% 30% 34% 34% / 30% 30% 42% 42%; background: linear-gradient(135deg, var(--c1) 0 50%, var(--c2) 50% 100%); color: #fff; font-family: var(--display); font-weight: 700; border: 1px solid rgba(255, 255, 255, 0.16); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); letter-spacing: -0.02em; }

/* ---- draft ------------------------------------------------------------- */
.draft-wrap { display: grid; gap: 1.1rem; }
.draft-right { display: grid; gap: 1.1rem; }
.kadro-head { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
/* top-left back button lives in the Kadro header — web only (see ≥900px) */
.draft-back-top { display: none; align-items: center; gap: 0.3rem; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.04em; color: var(--dim); background: transparent; border: 1px solid var(--line-2); border-radius: 100px; padding: 0.32rem 0.7rem; transition: all 0.15s ease; }
.draft-back-top:hover { border-color: var(--accent); color: var(--accent); }
.pos-cue { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; font-size: 0.82rem; color: var(--dim); margin-bottom: 0.7rem; }
.pos-cue b { color: var(--accent); }
.pos-cue button { font-family: var(--mono); font-size: 0.66rem; color: var(--faint); text-decoration: underline; }

/* dual-slot machine */
.dual-slot {
  display: grid; grid-template-columns: 1fr 0.52fr; border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--line-2); background: linear-gradient(180deg, var(--ink-3), var(--ink-2));
  box-shadow: inset 0 2px 16px rgba(0,0,0,0.5); margin-bottom: 0.7rem;
}
.dual-slot.single { grid-template-columns: 1fr; }
.dual-slot.spinning .reel-cell { animation: reelblur 0.09s linear infinite; }
.reel {
  position: relative; min-height: 84px; display: grid; place-items: center; padding: 0.8rem; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
          mask-image: linear-gradient(180deg, transparent, #000 22%, #000 78%, transparent);
}
.reel-team { border-right: 1px solid var(--line-2); }
.reel-year { background: rgba(47,217,227,0.05); }
.reel .windowline { position: absolute; left: 0; right: 0; height: 1px; background: var(--accent); opacity: 0.2; }
.reel .windowline.top { top: 26%; } .reel .windowline.bot { bottom: 26%; }
.reel-cell { display: flex; align-items: center; justify-content: center; width: 100%; }
.reel-cell .name { font-family: var(--display); font-weight: 800; font-size: clamp(0.95rem, 4.5vw, 1.3rem); letter-spacing: -0.01em; line-height: 1.1; text-align: center; }
.reel-cell .name.idle { color: var(--faint); font-size: 0.66rem; letter-spacing: 0.22em; text-transform: uppercase; }
.reel-cell .name.yr { color: var(--accent); font-size: clamp(1rem, 5vw, 1.5rem); }
@keyframes reelblur { 0% { transform: translateY(-14px); filter: blur(3px); opacity: 0.4; } 100% { transform: translateY(14px); filter: blur(3px); opacity: 0.4; } }

.drawn {
  display: flex; flex-direction: column; gap: 0.55rem;
  padding: 0.85rem 1rem; border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--ink-2); margin-bottom: 0.6rem;
}
.drawn-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.drawn-tag { font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.18em; color: var(--accent); text-transform: uppercase; }
/* team name and season sit on the same row, split by a vertical line (mirrors
   the spin reels' divider) */
.drawn-body { display: flex; align-items: center; gap: 0.9rem; }
.drawn-club { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; font-family: var(--display); font-weight: 800; font-size: 1.1rem; }
.drawn-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawn-year { flex: none; font-family: var(--mono); font-weight: 700; font-size: 1.2rem; color: var(--accent); white-space: nowrap; padding-left: 0.9rem; border-left: 1px solid var(--line-2); }
.reroll { width: 100%; }

.year-tag { font-family: var(--mono); font-size: 0.64rem; color: var(--accent); background: rgba(47,217,227,0.12); border-radius: 6px; padding: 0.1rem 0.4rem; margin-left: 0.25rem; vertical-align: middle; }
.list-head-club { display: flex; align-items: center; gap: 0.45rem; }

/* scrollable player list */
.list-panel { overflow: hidden; }
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1rem 0.6rem; }
.player-list { max-height: min(46vh, 360px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.player-row { width: 100%; display: grid; grid-template-columns: 1fr auto 2.4rem; align-items: center; gap: 0.6rem; padding: 0.75rem 1rem; border-top: 1px solid var(--line); text-align: left; transition: background 0.12s; }
.player-row:hover { background: var(--ink-3); }
.player-row.sel { background: rgba(47, 217, 227, 0.12); box-shadow: inset 3px 0 0 var(--accent); }
.player-row.disabled { opacity: 0.4; cursor: not-allowed; }
.player-row.disabled:hover { background: none; }
.pr-name { font-weight: 700; font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr-pos { font-family: var(--mono); font-size: 0.62rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; }
.pr-ovr { font-family: var(--mono); font-weight: 600; font-size: 1.1rem; color: var(--accent); text-align: right; }

/* responsive pitch (absolute-positioned by formation coords) */
.pitch {
  position: relative; width: 100%; aspect-ratio: 2 / 3; border-radius: var(--r); overflow: hidden;
  border: 1px solid rgba(69, 201, 143, 0.28);
  background: repeating-linear-gradient(180deg, rgba(255,255,255,0.04) 0 7%, transparent 7% 14%), linear-gradient(180deg, #0f3330, #0a201d);
}
.pitch-mark { position: absolute; border: 1px solid rgba(255, 255, 255, 0.16); pointer-events: none; }
.pitch-mark.center { left: 50%; top: 50%; width: 30%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; }
.pitch-mark.box { left: 24%; width: 52%; bottom: 0; height: 13%; border-bottom: none; border-radius: 8px 8px 0 0; }
.node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 0.28rem; width: clamp(42px, 15%, 62px); z-index: 1; }
.node .circle { width: 100%; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; border: 2px dashed rgba(255, 255, 255, 0.5); color: rgba(255, 255, 255, 0.85); background: rgba(0, 0, 0, 0.18); }
.node .role { font-family: var(--mono); font-size: clamp(0.5rem, 2.6vw, 0.64rem); letter-spacing: 0.02em; }
.node .circle b { font-family: var(--mono); font-weight: 700; font-size: clamp(0.72rem, 3.4vw, 0.98rem); }
.node.filled .circle { border-style: solid; border-color: rgba(255, 255, 255, 0.45); background: var(--bone); color: var(--ink); }
.node.gk.filled .circle { background: var(--crimson); color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.node.avail .circle { border-style: solid; border-color: var(--accent); color: var(--accent); background: rgba(47, 217, 227, 0.18); cursor: pointer; animation: availpulse 1.1s ease-in-out infinite; }
.node.avail:hover .circle { background: rgba(47, 217, 227, 0.32); }
.node.dim { opacity: 0.32; }
.node .nlabel { font-size: clamp(0.5rem, 2.4vw, 0.6rem); font-weight: 700; background: rgba(8, 19, 17, 0.82); color: #eaf4f3; padding: 1px 6px; border-radius: 5px; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes availpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(47, 217, 227, 0); } 50% { box-shadow: 0 0 0 6px rgba(47, 217, 227, 0.22); } }

.strength-bars { display: grid; gap: 0.4rem; margin-top: 1rem; }
.sbar { display: grid; grid-template-columns: 2.6rem 1fr 1.8rem; gap: 0.6rem; align-items: center; font-family: var(--mono); font-size: 0.64rem; color: var(--dim); }
.sbar .track { height: 7px; background: var(--ink-4); border-radius: 100px; overflow: hidden; }
.sbar .fill { height: 100%; background: var(--accent); border-radius: 100px; transition: width 0.6s cubic-bezier(.4,0,.2,1); }
.sbar b { text-align: right; color: var(--accent); }
.pill { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); border: 1px solid var(--line); border-radius: 100px; padding: 0.4rem 0.8rem; }
.pill b { color: var(--accent); }
.pill.win { color: var(--green); border-color: var(--green); }
.pill.lose { color: var(--crimson); border-color: var(--crimson); }

/* ---- season ------------------------------------------------------------ */
.season-wrap { display: grid; gap: 1.1rem; padding-bottom: 160px; /* space for sticky bar */ }
.table-head, .row { display: grid; grid-template-columns: 1.7rem 1fr 2.1rem 2.4rem 2.6rem; gap: 0.4rem; align-items: center; padding: 0.55rem 0.7rem; font-family: var(--mono); font-size: 0.8rem; }
.table-head { font-size: 0.58rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); border-bottom: 1px solid var(--line-2); }
.row { border-bottom: 1px solid var(--line); will-change: transform; }
.row .nm { font-family: var(--body); font-weight: 700; font-size: 0.86rem; display: flex; align-items: center; gap: 0.5rem; overflow: hidden; }
.row .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .num { text-align: center; color: var(--dim); }
.row .pts { font-weight: 700; text-align: right; }
.row .rank { color: var(--faint); text-align: center; }
.row.you { background: linear-gradient(90deg, rgba(47,217,227,0.16), transparent); box-shadow: inset 3px 0 0 var(--accent); border-radius: 8px; }
.row.you .nm { color: var(--accent); }
.row.ucl { box-shadow: inset 3px 0 0 var(--green); }
.row.releg { background: linear-gradient(90deg, rgba(255,107,99,0.12), transparent); }
.row.releg .rank { color: var(--crimson); }
.row.champ .rank { color: var(--gold); }
.legend { display: flex; gap: 0.9rem; flex-wrap: wrap; margin-top: 0.8rem; font-family: var(--mono); font-size: 0.6rem; color: var(--faint); }
.legend i { width: 0.75rem; height: 0.75rem; border-radius: 3px; display: inline-block; vertical-align: -1px; margin-right: 0.3rem; }
.md-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.md-no { font-family: var(--display); font-weight: 800; font-size: 2rem; }
.md-no small { font-family: var(--mono); font-size: 0.66rem; color: var(--faint); }
.progress-track { height: 7px; background: var(--ink-3); border-radius: 100px; overflow: hidden; margin: 0.8rem 0 1rem; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-deep), var(--accent)); transition: width 0.4s ease; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.controls .btn { padding: 0.85rem 0.6rem; font-size: 0.82rem; }
.fixtures { display: grid; gap: 0.4rem; margin-top: 1rem; max-height: 50vh; overflow-y: auto; }
.fixture { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.5rem; padding: 0.5rem 0.55rem; border-radius: 12px; background: var(--ink-2); border: 1px solid var(--line); animation: rise 0.3s both; }
.fixture .side { display: flex; align-items: center; gap: 0.4rem; font-size: 0.76rem; min-width: 0; }
.fixture .side.h { justify-content: flex-end; text-align: right; }
.fixture .side .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fixture .score { font-family: var(--mono); font-weight: 600; font-size: 0.92rem; background: var(--ink-4); padding: 0.2rem 0.5rem; border-radius: 7px; }
.fixture .t.me { font-weight: 800; color: var(--bone); }
.star { color: var(--gold); font-size: 0.85em; line-height: 1; flex: none; }
.fixture.win { border-color: var(--green); }
.fixture.win .score { background: var(--green); color: #05201f; }
.fixture.lose { border-color: var(--crimson); }
.fixture.lose .score { background: var(--crimson); color: #fff; }
.fixture.draw .score { background: var(--ink-4); color: var(--bone); }

/* sticky match bar */
.match-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: var(--ink-2); border-top: 1px solid var(--line-2);
  backdrop-filter: blur(12px);
  padding: 0.7rem clamp(1rem, 5vw, 1.4rem) calc(0.7rem + env(safe-area-inset-bottom));
}
.match-bar-inner { max-width: var(--maxw); margin: 0 auto; display: grid; gap: 0.55rem; }
.match-bar-score {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.5rem;
}
.match-bar-team { font-weight: 800; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-bar-team.opp { text-align: right; color: var(--dim); font-weight: 600; }
.match-score-pill {
  font-family: var(--mono); font-weight: 700; font-size: 1.2rem;
  background: var(--ink-4); color: var(--bone);
  border-radius: 100px; padding: 0.3rem 0.9rem; text-align: center;
  min-width: 4rem;
}
.match-score-pill.win { background: var(--green); color: #05201f; }
.match-score-pill.lose { background: var(--crimson); color: #fff; }
.match-score-pill.draw { background: var(--ink-4); color: var(--bone); }

/* ---- result ------------------------------------------------------------ */
.result-wrap { display: grid; gap: 1.2rem; }
.verdict { position: relative; overflow: hidden; border-radius: var(--r); padding: clamp(1.6rem, 7vw, 2.6rem); border: 1px solid var(--line-2); background: linear-gradient(160deg, var(--ink-2), var(--ink)); text-align: center; }
.verdict.win { border-color: var(--gold); }
.verdict.win::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(80% 60% at 50% 0%, rgba(255,207,90,0.22), transparent 70%); }
.verdict .crown { font-family: var(--mono); letter-spacing: 0.26em; text-transform: uppercase; font-size: 0.66rem; color: var(--gold); }
.verdict.lose .crown { color: var(--accent); }
.verdict .big { font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 14vw, 4.4rem); line-height: 0.9; margin: 0.5rem 0; letter-spacing: -0.02em; }
.verdict .big em { font-style: normal; color: var(--gold); }
.verdict .sub { color: var(--dim); font-size: 1rem; }
.verdict .shine { position: absolute; top: 0; bottom: 0; width: 40%; left: -50%; background: linear-gradient(105deg, transparent, rgba(255,255,255,0.12), transparent); animation: sweep 3.5s ease-in-out infinite; pointer-events: none; }
/* 2×2 on phones so a wide value like "12-10-12" fits on one line; 4-across on
   wider screens. nowrap stops any value from breaking mid-number. */
.statline { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; margin-top: 1.5rem; }
.statline .s { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0.7rem 0.3rem; }
.statline .s b { display: block; font-family: var(--display); font-weight: 800; font-size: 1.5rem; color: var(--accent); white-space: nowrap; }
.statline .s span { font-family: var(--mono); font-size: 0.54rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
@media (min-width: 560px) { .statline { grid-template-columns: repeat(4, 1fr); } }

/* ---- animations -------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(0.82); } to { opacity: 1; transform: none; } }
@keyframes sweep { 0% { left: -50%; } 55%, 100% { left: 130%; } }
@keyframes float { 0%,100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-10px) rotate(6deg); } }
@keyframes dicebob { 0%,100% { transform: translateY(0) rotate(-10deg); } 50% { transform: translateY(-3px) rotate(10deg); } }
@keyframes diceroll { from { transform: rotate(0); } to { transform: rotate(360deg); } }

.reveal > * { animation: rise 0.5s both; }
.reveal > *:nth-child(1) { animation-delay: 0.04s; }
.reveal > *:nth-child(2) { animation-delay: 0.1s; }
.reveal > *:nth-child(3) { animation-delay: 0.16s; }
.reveal > *:nth-child(4) { animation-delay: 0.22s; }
.reveal > *:nth-child(5) { animation-delay: 0.28s; }

@media (min-width: 720px) { :root { --maxw: 680px; } }

/* ---- Drafted XI on result page ----------------------------------------- */
.drafted-xi { display: grid; gap: 0; }
.drafted-row {
  display: grid; grid-template-columns: 2.8rem 1fr auto;
  align-items: center; gap: 0.5rem;
  padding: 0.55rem 0.2rem; border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.drafted-row:last-child { border-bottom: none; }
.dr-pos { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--faint); }
.dr-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-right { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.dr-club { font-family: var(--mono); font-size: 0.62rem; color: var(--dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 110px; }
.dr-ovr { font-family: var(--mono); font-weight: 700; font-size: 0.95rem; color: var(--accent); }

/* ---- Desktop two-column layouts (≥ 900px) ------------------------------ */
@media (min-width: 900px) {
  :root { --maxw: 1120px; }

  /* Draft: pitch on left (sticky), machine + player list on right, back below */
  .draft-wrap {
    grid-template-columns: 0.85fr 1.15fr;
    align-items: start;
  }
  .draft-wrap > .pitch-panel {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: calc(3.6rem + 1rem);
  }
  .draft-wrap > .draft-right { grid-column: 2; grid-row: 1; }
  /* web: back button lives top-left of the Kadro card; hide the bottom one */
  .draft-back-top { display: inline-flex; }
  .draft-wrap > .draft-back { display: none; }

  /* Season: standings left, fixtures right; sticky bar stays full-width (position:fixed) */
  .season-wrap {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  /* fixtures panel (2nd panel child) goes to right column */
  .season-wrap > .panel:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    position: sticky;
    top: calc(3.6rem + 1rem);
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
  }
  /* standings panel stays left */
  .season-wrap > .panel:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }
  /* fixtures list inside the panel: relax the max-height since the panel itself scrolls */
  .season-wrap > .panel:nth-child(2) .fixtures {
    max-height: none;
  }
}

@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
