:root {
  --bg: #F9F7F4;
  --surface: #FFFFFF;
  --surface2: #F2F0ED;
  --border: #E5E2DC;
  --border-strong: #CCC9C2;
  --text: #1A1814;
  --text-2: #6B6760;
  --text-3: #9C998F;
  --primary: #1A6B4A;
  --primary-hover: #155c3e;
  --green: #1A6B4A;
  --green-bg: #EAF5F0;
  --red: #9B2C2C;
  --red-bg: #FDF0F0;
  --blue: #1B4B8A;
  --blue-bg: #EBF1FB;
  --gold: #8A6200;
  --gold-bg: #FDF4DC;
  --purple: #5B3FAF;
  --purple-bg: #F1EDFC;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --font: 'Inter', system-ui, sans-serif;
  --mono: 'DM Mono', monospace;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

.page {
  max-width: 520px;
  margin: 0 auto;
  padding: 0 16px 80px;
}

/* ── SCREENS ── */
.screen { display: none; }
.screen.active { display: block; }

/* ── BUTTONS ── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; border: none; border-radius: var(--radius);
  font-family: var(--font); font-size: 14px; font-weight: 500;
  padding: 11px 20px; cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { background: var(--surface2); color: var(--text-3); cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--surface2); }
.btn-secondary:disabled { opacity: .45; cursor: not-allowed; }
.btn-green { background: var(--green); color: white; }
.btn-green:hover { background: #155c3e; }
.btn + .btn { margin-top: 8px; }
.btn-row .btn + .btn { margin-top: 0; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.card-pad { padding: 16px; }

/* ── AVATAR ── */
.av {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
  font-family: var(--mono);
}
.av-sm {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 600; flex-shrink: 0;
}

/* ── SG COLOURS ── */
.pos { color: var(--green); }
.neg { color: var(--red); }
.pos-bg { background: var(--green-bg); color: var(--green); }
.neg-bg { background: var(--red-bg); color: var(--red); }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 500; padding: 3px 8px;
  border-radius: var(--radius-sm); white-space: nowrap;
}
.badge-win  { background: var(--gold-bg);   color: var(--gold); }
.badge-top5 { background: var(--green-bg);  color: var(--green); }
.badge-top25{ background: var(--blue-bg);   color: var(--blue); }
.badge-field{ background: var(--surface2);  color: var(--text-2); }
.badge-cut  { background: var(--red-bg);    color: var(--red); }
.badge-major{ background: var(--purple-bg); color: var(--purple); font-size: 10px; margin-left: 5px; padding: 2px 6px; vertical-align: middle; }

/* ── DIFFICULTY BADGE ── */
.diff-badge { display:inline-block; font-size:10px; font-weight:600; letter-spacing:.06em; text-transform:uppercase; padding:2px 7px; border-radius:5px; }
.diff-badge-easy    { background:#EAF5F0; color:#1A6B4A; }
.diff-badge-normal  { background:#E6F1FB; color:#0C447C; }
.diff-badge-hard    { background:#FDF0F0; color:#9B2C2C; }
.diff-badge-extreme { background:#1A1814; color:#F9F7F4; }

/* ── DIFFICULTY BUTTONS ── */
.diff-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.diff-btn {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 12px;
  cursor: pointer; text-align: left; transition: all .15s;
  font-family: var(--font);
}
.diff-btn:hover { border-color: var(--border-strong); }
.diff-btn.selected { border-color: var(--primary); background: var(--primary); color: white; }
.diff-btn.selected .diff-sub { color: rgba(255,255,255,.65); }
.diff-btn.extreme.selected { background: var(--red); border-color: var(--red); }
.diff-name { font-size: 14px; font-weight: 600; display: block; margin-bottom: 2px; }
.diff-sub  { font-size: 11px; color: var(--text-2); }

/* ── TOGGLE ── */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  margin-top: 8px;
}
.toggle-label { font-size: 14px; font-weight: 500; }
.toggle-sub   { font-size: 12px; color: var(--text-2); margin-top: 1px; }
.toggle {
  position: relative; width: 42px; height: 24px;
  background: var(--border-strong); border-radius: 12px; cursor: pointer;
  transition: background .2s; flex-shrink: 0;
}
.toggle.on { background: var(--primary); }
.toggle.disabled { opacity: .4; cursor: not-allowed; }
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; background: white; border-radius: 50%;
  transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle.on::after { transform: translateX(18px); }

/* ── PIPS (reroll counter) ── */
.pips { display: flex; gap: 5px; }
.pip { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); transition: background .3s; }
.pip.used { background: var(--border-strong); }

/* ── SLOT GRID ── */
.slots-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.slot-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
}
.slot-card.filled { background: var(--surface); box-shadow: var(--shadow); }
.slot-cat { font-size: 10px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.slot-player { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.slot-val { font-size: 14px; font-weight: 600; font-family: var(--mono); }
.slot-empty-txt { font-size: 12px; color: var(--text-3); }

/* ── PLAYER REVEAL ── */
.reveal-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.reveal-name { font-size: 17px; font-weight: 600; }
.reveal-sub  { font-size: 12px; color: var(--text-2); margin-top: 1px; }

.attr-btn {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 14px;
  cursor: pointer; text-align: left; display: flex;
  justify-content: space-between; align-items: center;
  transition: all .15s; font-family: var(--font); margin-bottom: 6px;
}
.attr-btn:last-child { margin-bottom: 0; }
.attr-btn:hover:not(.filled) { border-color: var(--primary); }
.attr-btn.filled { opacity: .4; cursor: not-allowed; }
.attr-cat  { font-size: 11px; color: var(--text-2); margin-bottom: 2px; }
.attr-val  { font-size: 20px; font-weight: 600; font-family: var(--mono); }
.attr-rank { font-size: 11px; margin-top: 2px; }
.attr-arrow { font-size: 18px; color: var(--border-strong); flex-shrink: 0; margin-left: 8px; }

/* ── CONFIRM FLASH ── */
.confirm-flash {
  background: var(--green-bg); border: 1px solid #b8dfc9;
  border-radius: var(--radius); padding: 10px 14px;
  font-size: 13px; color: var(--green); margin-bottom: 10px;
  display: flex; align-items: center; gap: 7px;
}

/* ── SG TOTAL STRIP ── */
.total-strip {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin: 10px 0;
}
.total-strip .lbl { font-size: 13px; color: var(--text-2); }
.total-strip .val { font-size: 22px; font-weight: 600; font-family: var(--mono); }

/* ── SEASON ANIMATION ── */
.season-header {
  padding: 16px 0 12px;
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
}
.season-player-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.season-player-name { font-size: 16px; font-weight: 600; }
.season-player-meta { font-size: 12px; color: var(--text-2); }

.live-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 6px; }
.live-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px; text-align: center;
}
.live-stat .n { font-size: 20px; font-weight: 600; font-family: var(--mono); }
.live-stat .l { font-size: 10px; color: var(--text-2); margin-top: 1px; text-transform: uppercase; letter-spacing: .04em; }
.live-stat-wide {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 12px;
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.live-stat-wide .l { font-size: 12px; color: var(--text-2); }
.live-stat-wide .n { font-size: 16px; font-weight: 600; font-family: var(--mono); }

.progress-track {
  height: 3px; background: var(--border); border-radius: 2px;
  margin-bottom: 12px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--primary);
  border-radius: 2px; transition: width .8s ease;
}

/* ── EVENT ROWS ── */
.event-row {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 10px; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.event-row:last-child { border-bottom: none; }
.event-name { font-size: 13px; font-weight: 500; }
.event-sg   { font-size: 11px; color: var(--text-3); margin-top: 1px; font-family: var(--mono); }
.event-earn { font-size: 12px; color: var(--text-2); min-width: 70px; text-align: right; font-family: var(--mono); }

.event-row.new-row { animation: fadeSlide .4s ease; }
.event-row-clickable { cursor: pointer; }
.event-row-clickable:hover { background: var(--surface2); }

/* ── LEADERBOARD MODAL ── */
.lb-overlay {
  display:none; position:fixed; inset:0;
  background:rgba(0,0,0,.45); z-index:200;
  overflow-y:auto; padding:20px 16px;
}
.lb-sheet {
  max-width:520px; margin:0 auto;
  background:var(--surface); border-radius:var(--radius-lg);
  overflow:hidden; box-shadow:var(--shadow-md);
}
.lb-header { padding:16px; border-bottom:1px solid var(--border); }
.lb-list { overflow-y:auto; max-height:65vh; }
.lb-row {
  display:grid; grid-template-columns:44px 22px 1fr auto;
  align-items:center; gap:8px;
  padding:9px 14px; border-bottom:1px solid var(--border);
  font-size:13px;
}
.lb-row:last-child { border-bottom:none; }
.lb-row-self { background:var(--gold-bg); }
.lb-pos { font-family:var(--mono); font-size:11px; color:var(--text-2); text-align:right; }
.lb-name { font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.lb-score { font-family:var(--mono); font-weight:600; font-size:13px; }
.lb-footer { padding:12px 16px; border-top:1px solid var(--border); }

/* ── STATIC PAGES ── */
.static-page { padding:24px 0; }
.static-page h1 { font-size:22px; font-weight:700; letter-spacing:-.3px; margin-bottom:6px; }
.static-page .meta { font-size:12px; color:var(--text-3); margin-bottom:20px; }
.static-page h2 { font-size:14px; font-weight:600; margin:18px 0 6px; }
.static-page p, .static-page li { font-size:13px; color:var(--text-2); line-height:1.7; margin-bottom:8px; }
.static-page ul { padding-left:18px; }
.static-page a { color:var(--primary); }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── RESULTS SUMMARY ── */
.results-big-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.big-stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; text-align: center;
  box-shadow: var(--shadow);
}
.big-stat .n   { font-size: 26px; font-weight: 700; font-family: var(--mono); line-height: 1; }
.big-stat .l   { font-size: 10px; color: var(--text-2); margin-top: 3px; text-transform: uppercase; letter-spacing: .05em; }
.big-stat .sub { font-size: 11px; color: var(--text-3); margin-top: 3px; font-family: var(--mono); }

/* ── DNA GRID ── */
.dna-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.dna-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
}
.dna-cat { font-size: 10px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.dna-from { font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 5px; margin-bottom: 3px; }
.dna-val  { font-size: 14px; font-weight: 600; font-family: var(--mono); }

/* ── TABS ── */
.tabs { display: flex; gap: 2px; background: var(--surface2); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 12px; }
.tab-btn {
  flex: 1; padding: 6px 4px; border: none; background: transparent;
  border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  cursor: pointer; color: var(--text-2); transition: all .15s;
  font-family: var(--font);
}
.tab-btn.active {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--primary); box-shadow: var(--shadow);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── BANNER ── */
.banner {
  border-radius: var(--radius); padding: 12px 14px;
  font-size: 13px; margin: 10px 0; line-height: 1.5;
}
.banner-win    { background: var(--gold-bg);   color: var(--gold);   border: 1px solid #e8d48a; }
.banner-good   { background: var(--green-bg);  color: var(--green);  border: 1px solid #a8d8be; }
.banner-decent { background: var(--blue-bg);   color: var(--blue);   border: 1px solid #a8c4e8; }

/* ── MISC ── */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.mono { font-family: var(--mono); }
.section-label {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .06em;
  margin: 16px 0 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border-strong); border-top-color: var(--text);
  border-radius: 50%; animation: spin .6s linear infinite; vertical-align: middle;
}

/* ── INTRO SCREEN ── */
.logo-mark {
  width: 56px; height: 56px; background: var(--primary); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; margin: 32px auto 20px; box-shadow: var(--shadow-md);
}
.intro-title { text-align: center; font-size: 26px; font-weight: 700; letter-spacing: -.5px; margin-bottom: 6px; }
.intro-sub   { text-align: center; font-size: 14px; color: var(--text-2); margin-bottom: 24px; }

.rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.rule-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px;
}
.rule-num  { font-size: 22px; font-weight: 700; font-family: var(--mono); color: var(--text-3); margin-bottom: 4px; }
.rule-title{ font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.rule-body { font-size: 12px; color: var(--text-2); line-height: 1.5; }

/* ── TIGER COMPARISON ── */
.tiger-block {
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--border); margin: 12px 0;
  box-shadow: var(--shadow);
}
.tiger-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.tiger-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #1A1814;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}
.tiger-title { font-size: 14px; font-weight: 700; }
.tiger-sub   { font-size: 11px; color: var(--text-2); margin-top: 1px; }
.tiger-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  border-bottom: 1px solid var(--border);
}
.tiger-cell {
  padding: 10px 12px; text-align: center;
  border-right: 1px solid var(--border);
}
.tiger-cell:last-child { border-right: none; }
.tiger-cell .tc-lbl    { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.tiger-cell .tc-you    { font-size: 22px; font-weight: 700; font-family: var(--mono); line-height: 1; }
.tiger-cell .tc-tiger  { font-size: 11px; color: var(--text-2); margin-top: 4px; font-family: var(--mono); }
.tiger-cell.beat .tc-you { color: var(--green); }
.tiger-cell.lost .tc-you { color: var(--red); }
.tiger-verdict {
  padding: 12px 14px; text-align: center;
  font-size: 13px; font-weight: 600; line-height: 1.5;
}
.tiger-verdict.beat { background: var(--green-bg); color: var(--green); }
.tiger-verdict.lost { background: var(--red-bg);   color: var(--red); }

/* ── NEW RESULTS GRID ── */
.res-grid-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 8px; }
.res-earnings-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 8px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: var(--shadow);
}
.res-earnings-card .ec-lbl { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; }
.res-earnings-card .ec-val { font-size: 24px; font-weight: 700; font-family: var(--mono); }
.res-earnings-card .ec-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; font-family: var(--mono); }

/* ── RESPONSIVE ── */
@media (max-width: 400px) {
  .results-big-grid { grid-template-columns: repeat(2, 1fr); }
  .rules-grid { grid-template-columns: 1fr; }
}
/* ── DUAL RANGE SLIDER ── */
.dual-range { position:relative; height:20px; margin:12px 0 6px; }
.dual-range-track {
  position:absolute; top:50%; left:0; right:0;
  transform:translateY(-50%); height:4px;
  background:var(--border-strong); border-radius:2px; pointer-events:none;
}
.dual-range-fill {
  position:absolute; height:100%;
  background:var(--primary); border-radius:2px;
}
.dual-range input[type=range] {
  position:absolute; top:50%; width:100%; left:0;
  transform:translateY(-50%); appearance:none; -webkit-appearance:none;
  background:transparent; pointer-events:none; height:4px; margin:0; padding:0;
}
.dual-range input[type=range]::-webkit-slider-thumb {
  -webkit-appearance:none; appearance:none; pointer-events:all;
  width:18px; height:18px; border-radius:50%;
  background:var(--primary); border:2px solid white;
  box-shadow:0 1px 4px rgba(0,0,0,.25); cursor:pointer;
}
.dual-range input[type=range]::-moz-range-thumb {
  width:14px; height:14px; border-radius:50%;
  background:var(--primary); border:2px solid white;
  box-shadow:0 1px 4px rgba(0,0,0,.25); cursor:pointer; pointer-events:all;
  border:none;
}
