/* =====================================================
   0.012% — THE FOOTBALL REALITY SIMULATOR
   Theme: Matchday Floodlight Night, Tactical Board & Retro 8-Bit
   ===================================================== */

:root {
  --bg: #070b18;
  --bg2: #0f172e;
  --panel: #131d3b;
  --panel2: #19264d;
  --line: #283a70;
  --ink: #f3ecd9;
  --dim: #a9b4d4;
  --faint: #67749c;
  --gold: #ffd75e;
  --teal: #3fd1c4;
  --good: #38e07b;
  --bad: #ff4d6d;
  --warn: #ffcf4d;
  --blue: #54a0ff;
  --f-disp: "Chakra Petch", "IBM Plex Sans Thai", system-ui, sans-serif;
  --f-body: "IBM Plex Sans Thai", "Chakra Petch", system-ui, sans-serif;
  --f-px: "Silkscreen", "Chakra Petch", monospace;
  color-scheme: dark;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 15% 0%, #17362b 0%, transparent 45%),
    radial-gradient(circle at 90% 100%, #1a224d 0%, transparent 50%);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.55;
}

button, select {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px 128px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Top Utility Bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 12px;
  background: #0a1024;
  border: 2px solid var(--line);
  padding: 6px 12px;
  box-shadow: 0 3px 0 #040610;
}

.brand-mini {
  font-family: var(--f-px);
  font-size: 12.5px;
  color: var(--gold);
  letter-spacing: 0.04em;
}

.run-counter {
  font-size: 13px;
  color: var(--dim);
}

.run-counter .gold, .gold {
  color: var(--gold);
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.linkbtn {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 4px 10px;
  font-size: 12.5px;
  border-radius: 2px;
  transition: background 0.15s, border-color 0.15s;
}

.linkbtn:hover {
  background: var(--panel2);
  border-color: var(--gold);
}

/* Player HUD */
.hud {
  position: relative;
  overflow: visible;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 16px;
  background: var(--bg2);
  border: 2px solid var(--line);
  padding: 10px 14px;
  box-shadow: 0 4px 0 #040610;
}

.who {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.who b {
  font-family: var(--f-disp);
  font-size: 18px;
}

.pos-badge {
  background: var(--teal);
  color: #06101e;
  font-family: var(--f-px);
  font-size: 10.5px;
  padding: 1px 6px;
  font-weight: 700;
}

.who .age {
  font-family: var(--f-px);
  font-size: 12px;
  color: var(--gold);
}

.who .club {
  color: var(--dim);
  font-size: 13px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}

.stat-pill {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-px);
  font-size: 11px;
  background: #090e22;
  border: 1px solid #223160;
  padding: 3px 8px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.stat-pill:hover, .stat-pill:focus {
  border-color: var(--gold);
  background: #141d3d;
  transform: translateY(-1px);
  outline: none;
}

.icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.px-stat-svg {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  shape-rendering: crispEdges;
}

/* Rich Pixel Art Stat Tooltip */
.stat-tooltip {
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #080d1f;
  border: 2px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.9);
  padding: 8px 12px;
  border-radius: 2px;
  min-width: 220px;
  max-width: 280px;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  text-align: left;
}

.stat-tooltip::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--gold);
}

.stat-pill:hover .stat-tooltip,
.stat-pill:focus .stat-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.tt-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  border-bottom: 1px dashed #243566;
  padding-bottom: 4px;
  margin-bottom: 5px;
}

.tt-title {
  font-family: var(--f-disp);
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.tt-val {
  font-family: var(--f-px);
  font-size: 11px;
}

.tt-desc {
  font-family: var(--f-body);
  font-size: 12px;
  line-height: 1.45;
  color: var(--dim);
}

.stat-pill .bar {
  width: 38px;
  height: 6px;
  background: #050814;
  border: 1px solid #2b3a72;
  position: relative;
}

.stat-pill .bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: currentColor;
}

.stat-phy { color: #ff6b81; }
.stat-tec { color: #3fd1c4; }
.stat-iq  { color: #b58cff; }
.stat-men { color: #ffcf4d; }
.stat-con { color: #54a0ff; }
.stat-pop { color: #ff9ff3; }
.stat-fol { color: #00d2d3; }
.stat-mv  { color: var(--gold); }
.stat-ok  { color: #38e07b; }
.stat-bad { color: #ff4757; }
.stat-fin { color: #2ed573; }

.stat-divider {
  width: 2px;
  height: 22px;
  background: #233464;
  margin: 0 4px;
  align-self: center;
  flex-shrink: 0;
}

.captain-badge {
  display: inline-block;
  background: var(--gold);
  color: #070b18;
  font-weight: 900;
  font-size: 11px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.stat-pill .v {
  color: var(--ink);
  min-width: 2ch;
}

/* Main Split Layout */
.main {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .main {
    grid-template-columns: minmax(0, 1fr);
  }
}

.screen {
  position: relative;
  border: 3px solid #040611;
  outline: 2px solid var(--line);
  background: #000;
  box-shadow: 0 6px 0 #040611;
}

.screen canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.scan {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 0px,
    rgba(255, 255, 255, 0) 2px,
    rgba(0, 0, 0, 0.22) 3px,
    rgba(0, 0, 0, 0.22) 4px
  );
}

/* Right Decision Panel */
.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  padding: 18px;
  box-shadow: 0 6px 0 #040611;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel h2 {
  font-family: var(--f-disp);
  font-size: 21px;
  margin: 0;
  line-height: 1.3;
  color: #fff;
}

.ev-tag {
  font-family: var(--f-px);
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 0.04em;
}

.ev-txt {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

/* Title Hero & Funnel Box */
.title-hero {
  text-align: center;
  padding: 10px;
  background: #0b1229;
  border: 1px solid var(--line);
}

.big-pct {
  font-family: var(--f-px);
  font-size: 36px;
  color: var(--gold);
  line-height: 1.1;
}

.sub-pct {
  font-family: var(--f-disp);
  font-size: 13px;
  color: var(--teal);
  letter-spacing: 0.08em;
  margin-top: 4px;
}

.funnel-box {
  background: #0b1228;
  border: 1px solid #233366;
  padding: 10px 12px;
}

.f-title {
  font-family: var(--f-px);
  font-size: 11px;
  color: var(--dim);
  margin-bottom: 8px;
}

.f-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13.5px;
}

.f-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.f-item .pct {
  font-family: var(--f-px);
  font-size: 12px;
  min-width: 58px;
  text-align: right;
}

.pct.bad { color: var(--bad); }
.pct.warn { color: var(--warn); }
.pct.teal { color: var(--teal); }
.pct.blue { color: var(--blue); }
.pct.gold { color: var(--gold); }

.country-picker {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: #0b1228;
  padding: 10px 12px;
  border: 1px solid var(--line);
}

.country-picker label {
  font-size: 13px;
  color: var(--dim);
}

.country-picker select {
  background: var(--panel2);
  border: 1px solid var(--line);
  padding: 8px 10px;
  color: #fff;
}

/* Choices List */
.choices-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 4px;
}

.choice-btn {
  position: relative;
  overflow: visible;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  background: #0d1530;
  border: 2px solid #26386e;
  padding: 11px 13px;
  transition: transform 0.1s, border-color 0.15s, background 0.15s;
}

.choice-btn:hover, .choice-btn:focus-within {
  background: #17244d;
  border-color: var(--gold);
  transform: translateY(-1px);
  outline: none;
  z-index: 50;
}

/* Inline Choice Stat Badge */
.choice-stat-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #070c20;
  border: 1px solid #283a70;
  padding: 1px 5px;
  border-radius: 2px;
  vertical-align: middle;
  cursor: pointer;
  margin: 0 2px;
  font-family: var(--f-px);
  font-size: 11px;
  line-height: 1.4;
  transition: border-color 0.15s, background 0.15s;
}

.choice-stat-badge:hover, .choice-stat-badge:focus {
  border-color: var(--gold);
  background: #121c40;
  outline: none;
}

.choice-stat-badge .badge-num {
  font-weight: 700;
  font-size: 10.5px;
}

.choice-stat-badge .badge-num.pos {
  color: var(--good);
}

.choice-stat-badge .badge-num.neg {
  color: var(--bad);
}

/* Tooltip inside choice button pops upward */
.choice-stat-badge .stat-tooltip {
  position: absolute;
  bottom: calc(100% + 9px);
  top: auto;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #080d1f;
  border: 2px solid var(--gold);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.95);
  padding: 8px 12px;
  border-radius: 2px;
  min-width: 220px;
  max-width: 280px;
  z-index: 999;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  text-align: left;
}

.choice-stat-badge .stat-tooltip::before {
  content: "";
  position: absolute;
  top: auto;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--gold);
  border-bottom: none;
}

.choice-stat-badge:hover .stat-tooltip,
.choice-stat-badge:focus .stat-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.num-key {
  font-family: var(--f-px);
  font-size: 12px;
  background: var(--line);
  color: var(--gold);
  padding: 2px 7px;
  flex-shrink: 0;
}

.ch-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ch-body b {
  font-size: 15px;
  color: #fff;
}

.ch-body small {
  font-size: 12.5px;
  color: var(--dim);
}

.kbd-hint {
  font-size: 12px;
  color: var(--faint);
  text-align: center;
  margin-top: 4px;
}

/* Birth & Outcome Box */
.birth-card, .outcome-box {
  background: #0b1228;
  border: 1px solid var(--line);
  padding: 12px 14px;
}

.outcome-box.good { border-left: 4px solid var(--good); }
.outcome-box.bad  { border-left: 4px solid var(--bad); }
.outcome-box.warn { border-left: 4px solid var(--warn); }

.b-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed #1f2d59;
  font-size: 14px;
}

.origin-desc {
  margin: 10px 0 0;
  font-style: italic;
  color: var(--dim);
  font-size: 13.5px;
}

.go-btn {
  background: var(--gold);
  color: #090d1a;
  border: 2px solid #fff2b2;
  padding: 11px 16px;
  font-family: var(--f-disp);
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  box-shadow: 0 4px 0 #8f6814;
  transition: transform 0.1s;
}

.go-btn:hover {
  background: #ffe285;
  transform: translateY(-1px);
}

/* End Screen: Wikipedia & Transfermarkt Cards */
.end-header {
  background: #0b1228;
  padding: 10px 14px;
}

.tier-badge {
  font-family: var(--f-px);
  font-size: 11.5px;
  margin-bottom: 3px;
}

.end-summary {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--dim);
}

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vtab {
  flex: 1 1 auto;
  background: #0b1228;
  border: 1px solid var(--line);
  padding: 7px 10px;
  font-size: 13px;
  color: var(--dim);
}

.vtab.active {
  background: var(--panel2);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}

/* Authentic Wikipedia Infobox Look */
.wiki-card {
  background: #101833;
  border: 1px solid #354988;
  padding: 12px;
  font-size: 13.5px;
}

.wiki-title {
  text-align: center;
  font-weight: 700;
  font-size: 17px;
  background: #1d2b59;
  padding: 5px;
  color: #fff;
}

.wiki-sub {
  text-align: center;
  font-size: 12px;
  color: var(--teal);
  padding: 3px 0 8px;
}

.wiki-table {
  width: 100%;
  border-collapse: collapse;
}

.wiki-table th.sec {
  background: #192650;
  color: var(--gold);
  text-align: center;
  padding: 4px;
  font-size: 12.5px;
  border-top: 1px solid #2b3c75;
  border-bottom: 1px solid #2b3c75;
}

.wiki-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #182347;
}

.wiki-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Transfermarkt Card */
.tm-card {
  background: #0b132b;
  border: 1px solid #283f78;
  padding: 12px;
}

.tm-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tm-label {
  font-family: var(--f-px);
  font-size: 10px;
  color: var(--dim);
}

.tm-val {
  font-family: var(--f-disp);
  font-size: 22px;
  font-weight: 700;
  color: var(--gold);
}

.tm-svg {
  width: 100%;
  height: auto;
  background: #070d1f;
  border: 1px solid #1c2b59;
}

.tm-badges {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  font-size: 12.5px;
}

.badge-item {
  padding: 2px 7px;
  font-size: 11.5px;
  border-radius: 2px;
  background: #162247;
}

.badge-item.gold { border: 1px solid var(--gold); color: var(--gold); }
.badge-item.bad  { border: 1px solid var(--bad); color: #ff8a9d; }

/* =====================================================
   In-Game Career Timeline Stepper (By Age)
   ===================================================== */
.timeline-stepper {
  width: 100%;
  overflow-x: auto;
  padding: 4px 0 10px;
  margin-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.timeline-stepper::-webkit-scrollbar {
  height: 4px;
}
.timeline-stepper::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 2px;
}

.stepper-track {
  display: flex;
  align-items: center;
  min-width: 480px;
  justify-content: space-between;
  padding: 2px 4px;
}

.step-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: default;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.node-dot {
  width: 22px;
  height: 22px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-px);
  font-size: 10px;
  border: 1px solid var(--line);
  background: #090e21;
  color: var(--dim);
  transition: all 0.2s ease;
}

.step-node.done .node-dot {
  background: #143828;
  border-color: var(--good);
  color: var(--good);
  font-weight: 700;
}

.step-node.current .node-dot {
  background: #3b300f;
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 700;
  box-shadow: 0 0 10px rgba(255, 215, 94, 0.4);
  transform: scale(1.15);
  animation: pulseDot 1.4s infinite alternate;
}

@keyframes pulseDot {
  from { box-shadow: 0 0 6px rgba(255, 215, 94, 0.3); }
  to { box-shadow: 0 0 14px rgba(255, 215, 94, 0.7); }
}

.step-node.future .node-dot {
  background: #070b18;
  border-color: #1a2548;
  color: var(--faint);
  opacity: 0.7;
}

.node-label {
  font-family: var(--f-disp);
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.step-node.done .node-label {
  color: var(--dim);
}

.step-node.current .node-label {
  color: var(--gold);
  font-weight: 700;
}

.step-line {
  flex: 1 1 auto;
  height: 2px;
  background: #1b2850;
  margin: 0 4px 14px;
  min-width: 14px;
}

/* =====================================================
   Chronological Life Timeline Tab (End Screen)
   ===================================================== */
.timeline-card {
  background: #0b132b;
  border: 1px solid #283f78;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.timeline-header {
  border-bottom: 1px solid #1c2b59;
  padding-bottom: 8px;
}

.timeline-sub {
  font-family: var(--f-disp);
  font-size: 15px;
  color: #fff;
  margin-top: 2px;
}

.timeline-vlist {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 6px;
}

.tl-row {
  display: flex;
  gap: 12px;
  position: relative;
}

.tl-left {
  width: 76px;
  flex-shrink: 0;
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-top: 2px;
}

.tl-age-pill {
  font-family: var(--f-px);
  font-size: 10.5px;
  background: #172449;
  color: var(--gold);
  border: 1px solid #2b3e78;
  padding: 2px 6px;
  border-radius: 2px;
}

.tl-year {
  font-family: var(--f-disp);
  font-size: 11px;
  color: var(--faint);
  margin-top: 2px;
}

.tl-axis {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 16px;
  flex-shrink: 0;
}

.tl-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #070b18;
  z-index: 2;
  margin-top: 4px;
  flex-shrink: 0;
}

.tl-line {
  flex: 1;
  width: 2px;
  background: #1f2f5c;
  margin-top: 2px;
}

.tl-right {
  flex: 1;
  background: #101a38;
  border: 1px solid #253768;
  border-left: 3px solid #3fd1c4;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tl-right.out-good { border-left-color: var(--good); }
.tl-right.out-bad  { border-left-color: var(--bad); }
.tl-right.out-warn { border-left-color: var(--warn); }

.tl-tag {
  font-family: var(--f-px);
  font-size: 9.5px;
  color: var(--teal);
  letter-spacing: 0.04em;
}

.tl-title {
  font-family: var(--f-disp);
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.tl-choice {
  font-size: 12.5px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.2);
  padding: 3px 6px;
  border-radius: 2px;
}

.tl-res {
  font-size: 12.5px;
  color: var(--dim);
  line-height: 1.45;
}

/* Compendium Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 18, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-in {
  background: var(--panel);
  border: 2px solid var(--gold);
  max-width: 880px;
  width: 100%;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.7);
}

.dex-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dex-top h3 {
  margin: 0;
  font-family: var(--f-disp);
  color: var(--gold);
}

.dex-body {
  overflow-y: auto;
  padding-right: 4px;
}

.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.dex-card {
  background: #0b1228;
  border: 1px solid #22305e;
  padding: 10px;
  font-size: 13px;
}

.dex-card.locked {
  opacity: 0.55;
}

.dex-tier {
  font-family: var(--f-px);
  font-size: 10px;
  margin-bottom: 4px;
}

.dex-card p {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--dim);
}

.hall-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.hall-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: #0b1228;
  border: 1px solid #1e2c59;
  padding: 7px 10px;
  font-size: 13px;
}

.run-no {
  font-family: var(--f-px);
  font-size: 11px;
  color: var(--faint);
}

.mv-col {
  font-family: var(--f-px);
  font-size: 11.5px;
  color: var(--teal);
}

/* =====================================================
   RESPONSIVE & MOBILE TOUCH OPTIMIZATIONS
   ===================================================== */

/* Mobile Touch Support: .active-tip shows tooltip on tap */
.stat-pill.active-tip .stat-tooltip,
.choice-stat-badge.active-tip .stat-tooltip {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.stat-pill.active-tip .stat-tooltip {
  transform: translateX(-50%) translateY(0) !important;
}

.choice-stat-badge.active-tip .stat-tooltip {
  transform: translateX(-50%) translateY(0) !important;
}

@media (max-width: 900px) {
  #app {
    padding: 8px 10px 24px;
    gap: 10px;
  }
  .main {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 14px;
  }
  #app {
    padding-left: max(8px, env(safe-area-inset-left, 8px));
    padding-right: max(8px, env(safe-area-inset-right, 8px));
    padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
    gap: 8px;
  }

  /* Top Bar */
  .topbar {
    padding: 6px 8px;
    gap: 6px;
  }
  .brand-mini {
    width: 100%;
    text-align: center;
    font-size: 11px;
    padding-bottom: 4px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
  }
  .run-counter {
    width: 100%;
    text-align: center;
    font-size: 11.5px;
  }
  .top-actions {
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 5px;
  }
  .linkbtn {
    flex: 1 1 auto;
    text-align: center;
    padding: 6px 4px;
    font-size: 11px;
    min-height: 32px;
  }

  /* HUD */
  .hud {
    padding: 8px;
    gap: 8px;
  }
  .who {
    width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: 4px 8px;
  }
  .who b {
    font-size: 15px;
  }
  .who .age {
    font-size: 11px;
  }
  .who .club {
    width: 100%;
    font-size: 11.5px;
  }

  /* Stats row on mobile: clean 4-column compact grid */
  .stats {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }
  .stat-pill {
    padding: 3px 4px;
    font-size: 9.5px;
    gap: 3px;
    justify-content: space-between;
  }
  .stat-pill .bar {
    width: 18px;
    height: 5px;
  }
  .stat-pill .icon-wrap {
    width: 14px;
    height: 14px;
  }
  .stat-pill .px-stat-svg {
    width: 14px;
    height: 14px;
  }
  .stat-pill.stat-fin,
  .stat-pill.stat-fol,
  .stat-pill.stat-mv {
    grid-column: span 2;
  }
  .stat-divider {
    display: none;
  }

  /* Tooltips inside mobile screens */
  .stat-tooltip {
    min-width: 190px;
    max-width: 85vw;
    padding: 7px 10px;
    font-size: 11px;
  }
  .choice-stat-badge .stat-tooltip {
    min-width: 200px;
    max-width: 85vw;
    padding: 7px 10px;
  }

  /* Panel & Decisions */
  .panel {
    padding: 12px;
    gap: 10px;
  }
  .panel h2 {
    font-size: 17px;
  }
  .ev-txt {
    font-size: 13.5px;
  }
  .choice-btn {
    padding: 10px 10px;
    gap: 8px;
    min-height: 48px;
  }
  .ch-body b {
    font-size: 13.5px;
  }
  .ch-body small {
    font-size: 11.5px;
    line-height: 1.4;
  }
  .num-key {
    padding: 2px 5px;
    font-size: 10px;
  }

  /* Title screen */
  .big-pct {
    font-size: 28px;
  }
  .sub-pct {
    font-size: 11.5px;
  }
  .f-bars {
    font-size: 12px;
  }
  .f-item {
    gap: 6px;
  }
  .f-item .pct {
    min-width: 44px;
    font-size: 10.5px;
  }

  /* End Screen */
  .end-header {
    padding: 8px 10px;
  }
  .end-header h2 {
    font-size: 18px;
  }
  .wiki-card {
    padding: 6px;
    overflow-x: auto;
  }
  .wiki-title {
    font-size: 15px;
  }
  .wiki-table td, .wiki-table th {
    padding: 4px 2px;
    font-size: 11px;
  }
  .tm-val {
    font-size: 18px;
  }
  .tm-card {
    padding: 8px;
  }

  /* Modal Compendium */
  .modal {
    padding: 8px;
  }
  .modal-in {
    padding: 10px;
    max-height: 92vh;
    width: 98%;
    gap: 8px;
  }
  .dex-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .dex-card {
    padding: 8px;
  }
  .view-tabs {
    gap: 4px;
  }
  .vtab {
    padding: 6px 8px;
    font-size: 11px;
  }
}

@media (max-width: 380px) {
  .stat-pill .bar {
    display: none;
  }
}

/* =====================================================
   Anti-Tamper Referee Card Modal
   ===================================================== */
.tamper-modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 16, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
  animation: tamperFadeIn 0.2s ease-out;
}

@keyframes tamperFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.tamper-box {
  background: var(--panel2);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  max-width: 440px;
  width: 100%;
  padding: 22px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tamper-badge {
  font-family: var(--f-disp);
  font-size: 17px;
  letter-spacing: 0.5px;
  color: var(--ink);
}

.tamper-msg {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--dim);
}

.tamper-rule {
  color: var(--faint);
  font-family: var(--f-px);
  font-size: 11px;
}

.tamper-btn {
  background: var(--line);
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--f-disp);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.15s ease;
}

.tamper-btn:hover {
  background: #3b528b;
  color: #fff;
}

/* =====================================================
   ADVERTISING LAYOUT & RAILS (LEFT, RIGHT & BOTTOM)
   ===================================================== */

.ad-layout-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  position: relative;
}

/* Left & Right Skyscraper Ad Rails */
.ad-rail {
  display: none;
  width: 160px;
  flex-shrink: 0;
  position: sticky;
  top: 14px;
  margin-top: 12px;
  z-index: 15;
}

@media (min-width: 1440px) {
  .ad-rail {
    display: block;
  }
  .ad-rail-left {
    margin-right: 14px;
  }
  .ad-rail-right {
    margin-left: 14px;
  }
}

.ad-box {
  background: #090f24;
  border: 2px solid var(--line);
  box-shadow: 0 4px 0 #040610;
  display: flex;
  flex-direction: column;
}

.ad-skyscraper {
  min-height: 600px;
}

.ad-header {
  background: #0c1430;
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  text-align: center;
}

.ad-tag {
  font-family: var(--f-px);
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ad-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  position: relative;
}

.ad-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 24px 10px;
  width: 100%;
  height: 100%;
  min-height: 540px;
  background: rgba(10, 16, 36, 0.6);
}

.ad-ph-icon {
  font-size: 26px;
}

.ad-ph-dim {
  font-family: var(--f-px);
  font-size: 12px;
  color: var(--gold);
}

.ad-ph-desc {
  font-size: 11.5px;
  color: var(--dim);
  line-height: 1.4;
}

.ad-ph-cta {
  display: inline-block;
  background: var(--teal);
  color: #06101e;
  font-family: var(--f-px);
  font-size: 10.5px;
  font-weight: 700;
  padding: 6px 10px;
  text-decoration: none;
  border-radius: 2px;
  margin-top: 8px;
  transition: transform 0.15s, background 0.15s;
}

.ad-ph-cta:hover {
  background: #5ff5e7;
  transform: translateY(-1px);
}

/* =====================================================
   BOTTOM FULL-WIDTH STANDARD IAB AD LEADERBOARD
   (Full Width Bottom, Standard 728x90 / 320x50 with Left & Right Close Buttons)
   ===================================================== */

.ad-bottom-bar.ad-bottom-full,
.ad-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 95;
  background: #060a18;
  border-top: 2px solid var(--gold);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.9);
  padding: 6px 14px 8px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 108px;
  transition: transform 0.25s ease-in-out;
}

.ad-bottom-bar.collapsed {
  transform: translateY(120%);
  pointer-events: none;
}

.ad-bottom-container {
  width: 100%;
  max-width: 1120px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Small Close Button on Top-Right */
.ad-close-btn {
  position: absolute;
  top: 6px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #94a3b8;
  font-size: 13px;
  font-weight: 700;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.15s ease;
  z-index: 10;
  padding: 0;
}

.ad-close-btn:hover {
  background: rgba(239, 68, 68, 0.35);
  border-color: #ef4444;
  color: #fff;
  transform: scale(1.1);
}

.ad-close-btn:active {
  transform: scale(0.95);
}

/* Center standard unit wrapper */
.ad-bottom-unit {
  flex: 1;
  max-width: 780px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-standard-placeholder {
  width: 100%;
  min-height: 90px;
  background: rgba(11, 19, 44, 0.92);
  border: 1px dashed rgba(255, 215, 94, 0.5);
  border-radius: 4px;
  padding: 8px 16px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.ad-std-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ad-std-note {
  font-family: var(--f-px);
  font-size: 9px;
  color: #64748b;
  letter-spacing: 0.5px;
}

.ad-std-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.ad-std-icon {
  font-size: 26px;
  flex-shrink: 0;
}

.ad-std-text-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ad-std-headline {
  font-family: var(--f-disp);
  font-size: 14px;
  color: #f8fafc;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ad-std-sub {
  font-family: var(--f-mono), monospace;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.ad-std-cta-btn {
  background: var(--gold);
  color: #060a18;
  font-family: var(--f-disp);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 3px;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(255, 215, 94, 0.35);
  transition: all 0.15s ease;
}

.ad-std-cta-btn:hover {
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.45);
}

@media (max-width: 768px) {
  #app {
    padding-bottom: 90px;
  }
  .ad-bottom-bar.ad-bottom-full,
  .ad-bottom-bar {
    min-height: 70px;
    padding: 6px 8px;
  }
  .ad-standard-placeholder {
    min-height: 54px;
    padding: 4px 8px;
  }
  .ad-std-sub, .ad-std-icon, .ad-std-note {
    display: none;
  }
  .ad-std-headline {
    font-size: 11px;
    max-width: 180px;
  }
  .ad-close-btn {
    top: 4px;
    right: 6px;
    width: 20px;
    height: 20px;
    font-size: 11px;
  }
  .ad-std-cta-btn {
    padding: 6px 10px;
    font-size: 11px;
  }
}

/* Floating Pill to Restore Collapsed Ad */
.ad-open-pill {
  position: fixed;
  bottom: 10px;
  right: 14px;
  z-index: 85;
  background: #0c1430;
  border: 1px solid var(--line);
  color: var(--dim);
  font-family: var(--f-px);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: all 0.15s;
}

.ad-open-pill:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* =====================================================
   GDPR / COOKIE CONSENT BANNER
   ===================================================== */

.cookie-banner {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 110;
  background: #0a1129;
  border: 2px solid var(--teal);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
  padding: 10px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 660px;
  width: calc(100% - 32px);
  border-radius: 4px;
}

.cookie-content {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.cookie-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.cookie-text {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
}

.cookie-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cookie-link {
  color: var(--dim);
  font-size: 12px;
  text-decoration: underline;
}

.cookie-link:hover {
  color: var(--gold);
}

.cookie-accept-btn {
  background: var(--teal);
  color: #06101e;
  border: none;
  font-family: var(--f-px);
  font-size: 11.5px;
  font-weight: 700;
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s;
}

.cookie-accept-btn:hover {
  background: #5ff5e7;
}

/* =====================================================
   SITE FOOTER & LEGAL DISCLAIMER
   ===================================================== */

.site-footer {
  margin-top: 32px;
  padding: 24px 16px 85px; /* extra bottom padding so bottom ad doesn't block content */
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.footer-legal {
  background: #080d22;
  border: 1px solid var(--line);
  padding: 14px 18px;
  margin-bottom: 14px;
  border-radius: 4px;
  text-align: left;
}

.disclaimer-text {
  margin: 0 0 8px;
  color: var(--dim);
  font-size: 12px;
}

.disclaimer-text.th-sub {
  margin-bottom: 0;
  font-family: "IBM Plex Sans Thai", sans-serif;
  color: var(--faint);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.footer-link, .footer-link-btn {
  color: var(--teal);
  text-decoration: none;
  font-family: var(--f-disp);
  font-size: 13px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.15s;
}

.footer-link:hover, .footer-link-btn:hover {
  color: var(--gold);
  text-decoration: underline;
}

.footer-link.gold {
  color: var(--gold);
}

.footer-copy {
  color: var(--faint);
  font-size: 11.5px;
}

.sep {
  color: var(--line);
}

/* =====================================================
   Career Summary, Dual Trophy Showcase & Share System
   ===================================================== */
.action-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.action-row > * {
  flex: 1;
}

@media (max-width: 520px) {
  .action-row {
    flex-direction: column;
  }
}

.share-btn {
  background: linear-gradient(135deg, #0e8a75 0%, #15b99b 100%);
  color: #ffffff;
  border: 2px solid #5eead4;
  padding: 11px 16px;
  font-family: var(--f-disp);
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  box-shadow: 0 4px 0 #085548;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.share-btn:hover {
  background: linear-gradient(135deg, #12a68d 0%, #2dd4bf 100%);
  transform: translateY(-1px);
}

.share-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #085548;
}

.career-summary-card {
  background: #0c142c;
  border: 1px solid #233464;
  border-radius: 4px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-card-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid #1a254a;
}

.summary-player-badge {
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-flag {
  font-size: 26px;
  line-height: 1;
}

.player-info-txt {
  display: flex;
  flex-direction: column;
}

.player-name {
  font-family: var(--f-disp);
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
}

.player-meta {
  font-size: 12px;
  color: var(--teal);
}

.summary-fate-pill {
  font-family: var(--f-px);
  font-size: 11px;
  padding: 3px 9px;
  border: 1px solid currentColor;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.3);
  text-align: right;
}

.summary-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

@media (max-width: 600px) {
  .summary-stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.sum-stat-box {
  background: #080d1f;
  border: 1px solid #1d2b56;
  padding: 7px 10px;
  border-radius: 3px;
}

.sum-stat-label {
  font-family: var(--f-px);
  font-size: 9.5px;
  color: var(--dim);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.sum-stat-val {
  font-family: var(--f-disp);
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.sum-stat-val.gold { color: var(--gold); }
.sum-stat-val.green { color: #38e07b; }
.sum-stat-val.teal { color: #3fd1c4; }

/* Dual Trophy Cabinet */
.trophy-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 640px) {
  .trophy-columns {
    grid-template-columns: 1fr;
  }
}

.trophy-col {
  background: #070b1a;
  border: 1px solid #1c274c;
  border-radius: 4px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trophy-col.club-col {
  border-color: #3b3117;
}

.trophy-col.indiv-col {
  border-color: #2b224d;
}

.trophy-col-hdr {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-disp);
  font-size: 13.5px;
  font-weight: 700;
  padding-bottom: 6px;
  border-bottom: 1px solid #151e3c;
}

.club-col .trophy-col-hdr {
  color: var(--gold);
}

.indiv-col .trophy-col-hdr {
  color: #c4b5fd;
}

.badge-count {
  margin-left: auto;
  font-family: var(--f-px);
  font-size: 10px;
  background: #ffd75e22;
  color: var(--gold);
  border: 1px solid var(--gold);
  padding: 1px 6px;
  border-radius: 10px;
}

.badge-count.indiv {
  background: #a78bfa22;
  color: #c4b5fd;
  border-color: #a78bfa;
}

.trophy-badges-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.trophy-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 3px;
  font-size: 12px;
  line-height: 1.35;
}

.trophy-badge.club-badge {
  background: rgba(255, 215, 94, 0.08);
  border: 1px solid rgba(255, 215, 94, 0.28);
  color: #ffe699;
}

.trophy-badge.indiv-badge {
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.28);
  color: #ddd6fe;
}

.trophy-badge .t-icon {
  font-size: 15px;
  flex-shrink: 0;
}

.trophy-badge .t-name {
  font-weight: 500;
}

.no-trophies-msg {
  font-size: 12px;
  color: var(--dim);
  font-style: italic;
  padding: 8px 4px;
  text-align: center;
}

/* Share Modal & Card Preview */
.share-preview-box {
  background: #050814;
  border: 1px solid #233261;
  border-radius: 4px;
  overflow: hidden;
}

.share-preview-bar {
  background: #0c152f;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #1c294e;
}

.preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.preview-dot.red { background: #ff5f56; }
.preview-dot.yellow { background: #ffbd2e; }
.preview-dot.green { background: #27c93f; }

.preview-label {
  font-family: var(--f-px);
  font-size: 9px;
  color: var(--dim);
  margin-left: 6px;
  letter-spacing: 0.5px;
}

.share-card-text {
  margin: 0;
  padding: 12px;
  font-family: var(--f-mono), "Courier New", monospace;
  font-size: 11.5px;
  line-height: 1.5;
  color: #f3ecd9;
  white-space: pre-wrap;
  max-height: 240px;
  overflow-y: auto;
}

.share-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.share-action-btn {
  flex: 1;
  padding: 10px 14px;
  font-family: var(--f-disp);
  font-size: 14px;
  font-weight: 700;
  border-radius: 3px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s;
}

.share-action-btn.copy-btn {
  background: var(--gold);
  color: #090e1e;
  border: 1px solid #fff2b2;
}

.share-action-btn.copy-btn:hover {
  background: #ffe385;
}

.share-action-btn.copy-btn.copied {
  background: #22c55e !important;
  color: #ffffff !important;
  border-color: #86efac !important;
}

.share-action-btn.system-btn {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #475569;
}

.share-action-btn.system-btn:hover {
  background: #334155;
  color: #ffffff;
}

.share-social-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.social-share-btn {
  padding: 8px 10px;
  border-radius: 3px;
  font-family: var(--f-disp);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: opacity 0.15s, transform 0.1s;
  color: #ffffff;
}

.social-share-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.social-share-btn.line-btn {
  background: #06c755;
}

.social-share-btn.x-btn {
  background: #000000;
  border: 1px solid #333333;
}

.social-share-btn.fb-btn {
  background: #1877f2;
}

/* =====================================================
   Google Auth, Guest Session & Cloud Sync Profile UI
   ===================================================== */
.auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-color: #2b3966;
  font-family: var(--f-px);
  font-size: 10px;
  transition: all 0.2s ease;
}

.auth-pill.is-logged-in {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
}

.topbar-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  vertical-align: middle;
  object-fit: cover;
}

.auth-top h3 {
  margin: 0;
  font-family: var(--f-disp);
  font-size: 16px;
  letter-spacing: 0.5px;
  color: var(--gold);
}

.auth-sub {
  margin: 4px 0 0 0;
  font-family: var(--f-px);
  font-size: 9px;
  color: var(--dim);
}

.auth-modal-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 4px;
}

.auth-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 3px;
  font-family: var(--f-px);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  width: fit-content;
}

.auth-status-badge.is-guest {
  background: rgba(110, 120, 163, 0.18);
  border: 1px solid #3e4a77;
  color: #cbd5e1;
}

.auth-status-badge.is-google {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid #22c55e;
  color: #86efac;
}

.auth-notice-p {
  margin: 8px 0;
  font-family: var(--f-mono), monospace;
  font-size: 12px;
  line-height: 1.5;
  color: #cbd5e1;
}

.auth-merge-alert {
  padding: 8px 12px;
  background: rgba(255, 215, 94, 0.08);
  border-left: 3px solid var(--gold);
  font-family: var(--f-px);
  font-size: 10px;
  color: var(--gold);
  line-height: 1.4;
  margin-bottom: 10px;
}

.auth-login-card {
  background: #060a17;
  border: 1px solid #1f2b50;
  padding: 14px;
  border-radius: 4px;
}

.auth-login-card h4 {
  margin: 0 0 10px 0;
  font-family: var(--f-disp);
  font-size: 14px;
  color: #f8fafc;
}

.gis-button-row {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 14px 0;
  color: #475569;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #1e293b;
}

.auth-divider span {
  padding: 0 10px;
  font-family: var(--f-px);
  font-size: 9px;
  color: var(--dim);
}

.auth-label-small {
  display: block;
  font-family: var(--f-px);
  font-size: 9px;
  color: #94a3b8;
  margin-bottom: 6px;
}

.auth-input-group {
  display: flex;
  gap: 8px;
}

.auth-input {
  flex: 1;
  background: #030712;
  border: 1px solid #334155;
  color: #f8fafc;
  padding: 8px 12px;
  font-family: var(--f-mono), monospace;
  font-size: 13px;
  border-radius: 3px;
  outline: none;
}

.auth-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 6px rgba(255, 215, 94, 0.2);
}

.auth-action-btn {
  padding: 8px 12px;
  font-family: var(--f-disp);
  font-size: 13px;
  border-radius: 3px;
  cursor: pointer;
}

.auth-action-btn.gold-btn {
  background: var(--gold);
  color: #050814;
  border: 1px solid #fff2b2;
  font-weight: 700;
}

.auth-action-btn.gold-btn:hover {
  background: #ffe385;
}

.auth-action-btn.danger-btn {
  background: #7f1d1d;
  color: #fecaca;
  border: 1px solid #b91c1c;
}

.auth-action-btn.danger-btn:hover {
  background: #991b1b;
}

.auth-profile-box {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #060a17;
  border: 1px solid #1f2b50;
  padding: 12px 14px;
  border-radius: 4px;
  margin-top: 8px;
}

.auth-avatar-lg {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  object-fit: cover;
}

.auth-avatar-lg.default-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e293b;
  font-size: 24px;
}

.auth-profile-details {
  flex: 1;
}

.auth-profile-name {
  font-family: var(--f-disp);
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}

.auth-profile-email {
  font-family: var(--f-mono), monospace;
  font-size: 12px;
  color: #38bdf8;
  margin-top: 2px;
}

.auth-profile-time {
  font-family: var(--f-px);
  font-size: 9px;
  color: var(--dim);
  margin-top: 4px;
}

.auth-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 10px 0;
}

.kpi-box {
  background: #070d1e;
  border: 1px solid #1c2747;
  border-radius: 3px;
  padding: 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.kpi-box.highlight {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
}

.kpi-box.gold {
  border-color: var(--gold);
  background: rgba(255, 215, 94, 0.08);
}

.kpi-num {
  font-family: var(--f-disp);
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}

.kpi-box.gold .kpi-num {
  color: var(--gold);
}

.kpi-box.highlight .kpi-num {
  color: #86efac;
}

.kpi-lbl {
  font-family: var(--f-px);
  font-size: 8px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.auth-action-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 10px 0;
}

.auth-history-wrap {
  margin-top: 14px;
  background: #060a17;
  border: 1px solid #1f2b50;
  border-radius: 4px;
  padding: 12px;
}

.auth-history-wrap h4 {
  margin: 0 0 10px 0;
  font-family: var(--f-disp);
  font-size: 13px;
  color: var(--gold);
  letter-spacing: 0.5px;
}

.auth-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}

.auth-history-row {
  display: grid;
  grid-template-columns: 36px 1fr 140px 80px 80px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: #030611;
  border: 1px solid #16203a;
  border-radius: 3px;
  font-family: var(--f-mono), monospace;
  font-size: 11px;
}

.h-col-run {
  font-family: var(--f-px);
  font-size: 9px;
  color: var(--dim);
}

.h-col-player {
  display: flex;
  flex-direction: column;
}

.h-col-player b {
  color: #f8fafc;
  font-size: 11.5px;
}

.h-col-player small {
  font-size: 10px;
  color: #94a3b8;
}

.h-col-fate {
  font-family: var(--f-disp);
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.h-col-mv {
  color: #38bdf8;
  font-weight: 700;
  text-align: right;
}

.h-col-stats {
  font-size: 10px;
  color: #cbd5e1;
  text-align: right;
}

/* =====================================================
   Achievements Dex Cards (Compendium)
   ===================================================== */
.dex-grid-achievements {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.ach-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  background: #060a17;
  border: 1px solid #1c2747;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.ach-card.unlocked {
  border-color: rgba(255, 215, 94, 0.5);
  background: rgba(255, 215, 94, 0.05);
}

.ach-card.locked {
  opacity: 0.6;
}

.ach-badge-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.ach-card.locked .ach-badge-icon {
  filter: grayscale(1) brightness(0.7);
}

.ach-body {
  flex: 1;
  min-width: 0;
}

.ach-body b {
  display: block;
  font-family: var(--f-disp);
  font-size: 13px;
  margin: 3px 0 2px 0;
  color: #f8fafc;
}

.ach-body p {
  margin: 0;
  font-family: var(--f-mono), monospace;
  font-size: 10.5px;
  line-height: 1.35;
  color: #94a3b8;
}

/* =====================================================
   Achievement Toast Notification
   ===================================================== */
.achievement-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  background: #090e1f;
  border: 2px solid var(--gold);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7), 0 0 16px rgba(255, 215, 94, 0.35);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 380px;
  animation: achSlideIn 0.35s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  pointer-events: none;
}

.achievement-toast.hide {
  animation: achFadeOut 0.35s ease forwards;
}

.toast-icon {
  font-size: 30px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(255, 215, 94, 0.6));
}

.toast-txt {
  flex: 1;
}

.toast-title {
  font-family: var(--f-disp);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
}

.toast-desc {
  font-family: var(--f-mono), monospace;
  font-size: 11px;
  color: #e2e8f0;
  margin-top: 2px;
}

@keyframes achSlideIn {
  from {
    transform: translateY(40px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes achFadeOut {
  from {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  to {
    transform: translateY(20px) scale(0.95);
    opacity: 0;
  }
}

@media (max-width: 640px) {
  .auth-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .auth-action-buttons {
    grid-template-columns: 1fr 1fr;
  }
  .auth-history-row {
    grid-template-columns: 28px 1fr 60px;
  }
  .h-col-mv, .h-col-stats {
    display: none;
  }
}

/* =====================================================
   Dropbox-style Auth Modal (Retro 16-Bit Cyber Theme)
   ===================================================== */
.auth-dropbox-card {
  max-width: 440px;
  margin: 0 auto;
  padding: 6px 8px 12px;
  display: flex;
  flex-direction: column;
}

.auth-card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.auth-dropbox-title {
  font-family: var(--f-disp);
  font-size: 23px;
  font-weight: 800;
  color: #ffffff;
  margin: 0;
  letter-spacing: 0.5px;
  text-align: center;
  flex: 1;
}

.auth-close-x {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
  transition: all 0.15s;
}

.auth-close-x:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
}

/* Inner Action Card: Agree and Sign up */
.auth-sub-card {
  background: rgba(15, 23, 42, 0.75);
  border: 1.5px solid #283763;
  border-radius: 8px;
  padding: 16px 18px 18px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  margin-bottom: 6px;
}

.auth-sub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-sub-title {
  font-family: var(--f-disp);
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.5px;
}

.auth-sub-disclaimer {
  font-family: var(--f-mono), monospace;
  font-size: 11px;
  line-height: 1.5;
  color: #94a3b8;
  margin: 10px 0 16px 0;
}

.auth-sub-disclaimer a {
  color: #38bdf8;
  text-decoration: underline;
  transition: color 0.15s;
}

.auth-sub-disclaimer a:hover {
  color: #7dd3fc;
}

.auth-btn-agree {
  width: 100%;
  padding: 12px 16px;
  background: #0061fe;
  border: 1px solid #3b82f6;
  border-radius: 6px;
  color: #ffffff;
  font-family: var(--f-disp);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 97, 254, 0.4);
}

.auth-btn-agree:hover {
  background: #0050d4;
  border-color: #60a5fa;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 97, 254, 0.5);
}

.auth-btn-agree:active {
  transform: translateY(0);
}

.auth-g-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  color: #0061fe;
  font-family: Arial, sans-serif;
  font-size: 12px;
  font-weight: 900;
}

/* Or Divider */
.auth-or-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 18px 0 14px;
  color: #64748b;
}

.auth-or-divider::before,
.auth-or-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #1e293b;
}

.auth-or-divider span {
  padding: 0 12px;
  font-family: var(--f-mono), monospace;
  font-size: 12px;
  color: #64748b;
  text-transform: lowercase;
}

/* Email Form */
.auth-email-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-input-dropbox {
  width: 100%;
  box-sizing: border-box;
  background: #030612;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 12px 14px;
  font-family: var(--f-mono), monospace;
  font-size: 13.5px;
  color: #f8fafc;
  outline: none;
  transition: all 0.15s;
}

.auth-input-dropbox:focus {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(255, 215, 94, 0.25);
  background: #050a1a;
}

.auth-input-dropbox.pulse-focus {
  animation: inputPulse 0.4s ease 2;
  border-color: #ef4444;
}

@keyframes inputPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); border-color: var(--gold); }
  100% { transform: scale(1); }
}

.auth-btn-continue {
  width: 100%;
  padding: 12px 16px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  color: #94a3b8;
  font-family: var(--f-disp);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-btn-continue.has-input,
.auth-btn-continue:hover {
  background: var(--gold);
  border-color: #fff2b2;
  color: #060a16;
  box-shadow: 0 2px 10px rgba(255, 215, 94, 0.35);
  transform: translateY(-1px);
}

.auth-btn-continue:active {
  transform: translateY(0);
}

/* Guest Progress Footnote */
.auth-guest-footnote {
  margin-top: 16px;
  font-family: var(--f-mono), monospace;
  font-size: 10.5px;
  line-height: 1.4;
  color: #64748b;
  text-align: center;
  padding: 6px 10px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.02);
}
