:root {
  /* v20 reskin: near-black charcoal + aged gold "military command" theme (poster look). */
  --bg: #0b0b0c;
  --panel: rgba(23, 23, 26, 0.94);
  --panel-soft: rgba(33, 32, 35, 0.82);
  --line: rgba(201, 162, 74, 0.32);
  --text: #f2efe6;
  --muted: #a8a091;
  --gold: #d8b45a;
  --gold-bright: #f3d98c;
  --gold-deep: #6e4e13;
  --cyan: #e2c98a; /* retired the navy-era cyan; now pale brass so gradients read warm gold */
  --danger: #e06b6b;
  --ok: #8fc46e;   /* olive service green */
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.6);
  --head-font: "Oswald", "Saira Condensed", "Arial Narrow", "Helvetica Neue", system-ui, sans-serif;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); min-height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 50% -8%, rgba(216, 180, 90, 0.12), transparent 45%),
    radial-gradient(circle at bottom right, rgba(216, 180, 90, 0.06), transparent 34rem),
    linear-gradient(180deg, #0e0e0f, #0a0a0b 58%, #060606);
  color: var(--text);
  position: relative;
}
/* v20: CSS-only grunge + scanline texture (no image files — keeps the PWA fast). */
body::before, body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1; }
body::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05;
  mix-blend-mode: overlay;
}
body::after {
  background-image: repeating-linear-gradient(to bottom, rgba(255,255,255,0.028) 0 1px, transparent 1px 3px);
  opacity: 0.5;
}
.app-shell { position: relative; z-index: 2; }

/* v20: condensed military display type for headings; body copy stays Inter for readability. */
h1, h2, h3, .eyebrow, .nav-label, .league-topline span, .ladder-title, .tab-btn, .live-pill { font-family: var(--head-font); }
h1, h2, h3 { text-transform: uppercase; letter-spacing: 0.01em; }
h1 { letter-spacing: -0.01em; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 0 max(28px, env(safe-area-inset-bottom));
}
.card {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 26px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}
.glow { position: relative; overflow: hidden; }
.glow::before {
  content: "";
  position: absolute;
  inset: -2px;
  background: linear-gradient(120deg, rgba(246,211,91,0.35), transparent, rgba(125,227,255,0.22));
  pointer-events: none;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  padding: 1px;
  border-radius: inherit;
}
.hero {
  display: grid;
  grid-template-columns: 1fr 270px;
  gap: 24px;
  align-items: center;
  padding: 30px;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
}
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(2.1rem, 7vw, 4.7rem); line-height: 0.92; margin-bottom: 16px; letter-spacing: -0.07em; }
h2 { margin-bottom: 0; font-size: clamp(1.25rem, 4vw, 1.7rem); }
h3 { font-size: clamp(1.35rem, 5vw, 2rem); line-height: 1.05; margin-bottom: 8px; }
.subhead, .helper-text { color: var(--muted); line-height: 1.6; max-width: 760px; margin-bottom: 0; }
.badge-card {
  background: linear-gradient(160deg, rgba(246,211,91,0.16), rgba(125,227,255,0.08));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 22px;
  text-align: center;
  min-height: 230px;
  display: grid;
  place-items: center;
  align-content: center;
}
.badge-ring {
  width: 92px;
  height: 92px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  background: linear-gradient(145deg, var(--gold), #fff2a2 45%, var(--gold-deep));
  color: #07101d;
  font-size: 2.6rem;
  font-weight: 1000;
  box-shadow: inset 0 0 0 4px rgba(0,0,0,0.18), 0 12px 40px rgba(246,211,91,0.25);
}
.badge-card p { margin: 0; font-weight: 900; }
/* v19: rank name is the headline; the 0–100 rating is a small secondary detail. */
#tierName { font-size: 1.5rem; line-height: 1.12; letter-spacing: -0.01em; }
.badge-card strong { font-size: 1.1rem; line-height: 1; font-weight: 900; letter-spacing: 0; color: var(--muted); }
#scoreNumber::before { content: 'Rating '; }
#scoreNumber::after { content: ' / 100'; }
.badge-card span:last-child { color: var(--muted); font-size: 0.92rem; }
.quick-card { padding: 22px; margin-bottom: 22px; }
.grid-two { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(350px, 0.88fr); gap: 22px; align-items: start; }
.form-card, .results-card, .history-card { padding: 22px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.upload-panel {
  background: var(--panel-soft);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 18px;
}
.upload-panel summary { cursor: pointer; font-weight: 900; color: var(--gold); }
.upload-drop {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  border: 1px dashed rgba(246,211,91,0.5);
  border-radius: 18px;
  padding: 18px;
  min-height: 116px;
  place-items: center;
  text-align: center;
  background: rgba(255,255,255,0.03);
}
.upload-drop input { display: none; }
.upload-drop span { font-weight: 900; color: var(--text); }
.upload-drop small { color: var(--muted); line-height: 1.45; }
.preview-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.preview-strip img {
  width: 76px;
  height: 100px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
}
.ocr-status {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(0,0,0,0.24);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--muted);
  line-height: 1.45;
}
.ocr-status.good { color: var(--ok); border-color: rgba(141,255,178,0.25); }
.ocr-status.warn { color: var(--gold); border-color: rgba(246,211,91,0.25); }
.ocr-status.bad { color: var(--danger); border-color: rgba(255,122,122,0.25); }
.ocr-debug { margin-top: 12px; color: var(--muted); }
.ocr-debug summary { cursor: pointer; color: var(--muted); }
.ocr-debug textarea {
  width: 100%;
  margin: 10px 0;
  resize: vertical;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  padding: 12px;
  color: var(--text);
  background: rgba(4,9,17,0.8);
}
.input-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
label { color: var(--muted); font-size: 0.88rem; font-weight: 760; }
input {
  width: 100%;
  margin-top: 6px;
  color: var(--text);
  background: rgba(5, 9, 18, 0.82);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 13px 12px;
  outline: none;
}
input:focus, textarea:focus { border-color: rgba(246,211,91,0.7); box-shadow: 0 0 0 4px rgba(246,211,91,0.1); }
input.autofilled { border-color: rgba(141,255,178,0.9); box-shadow: 0 0 0 3px rgba(141,255,178,0.09); }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.button-row.compact { margin-top: 12px; }
.primary-btn, .secondary-btn, .ghost-btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  color: #07101d;
  background: var(--gold);
  font-weight: 950;
  box-shadow: 0 10px 30px rgba(246,211,91,0.18);
  touch-action: manipulation;
}
.secondary-btn { background: #99e8ff; box-shadow: 0 10px 30px rgba(125,227,255,0.12); }
.ghost-btn {
  color: var(--text);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: none;
}
.league-card {
  background: linear-gradient(160deg, rgba(246,211,91,0.14), rgba(7,16,29,0.96) 45%, rgba(125,227,255,0.10));
  border: 1px solid rgba(246,211,91,0.28);
  border-radius: 24px;
  padding: 20px;
  overflow: hidden;
}
.league-topline { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.league-topline span {
  color: #07101d;
  background: var(--gold);
  font-weight: 1000;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
}
.league-topline span:last-child { background: rgba(255,255,255,0.1); color: var(--text); border: 1px solid rgba(255,255,255,0.08); }
#roastLine { color: var(--muted); line-height: 1.5; }
.progress-wrap { margin: 18px 0; }
.progress-meta { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 0.84rem; margin-bottom: 8px; }
.progress-bar { height: 12px; background: rgba(255,255,255,0.08); border-radius: 999px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--cyan)); border-radius: inherit; transition: width 0.35s ease; }
.metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.metric-grid div { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; padding: 12px; }
.metric-grid small { color: var(--muted); display: block; margin-bottom: 4px; }
.metric-grid strong { font-size: 1.35rem; }
.breakdown { display: grid; gap: 10px; margin-top: 18px; }
.breakdown-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.07); border-radius: 16px; padding: 12px; }
.breakdown-row small { display: block; color: var(--muted); margin-top: 3px; }
.breakdown-row strong { color: var(--gold); font-size: 1.2rem; }
.history-card { margin-top: 22px; }
.history-list.empty { color: var(--muted); border: 1px dashed rgba(255,255,255,0.14); border-radius: 16px; padding: 18px; }
.history-list { display: grid; gap: 10px; }
.history-item { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.04); }
.history-item small, .history-item span { color: var(--muted); }
footer { text-align: center; color: var(--muted); padding: 22px; line-height: 1.5; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  z-index: 1400;
  transform: translateX(-50%);
  background: rgba(6, 14, 25, 0.96);
  color: var(--text);
  border: 1px solid rgba(246,211,91,0.35);
  box-shadow: var(--shadow);
  border-radius: 999px;
  padding: 12px 16px;
  z-index: 20;
  max-width: min(92vw, 520px);
  text-align: center;
}
@media (max-width: 900px) {
  .hero, .grid-two { grid-template-columns: 1fr; }
  .badge-card { min-height: unset; }
  .grid-two { gap: 18px; }
}
@media (max-width: 640px) {
  .app-shell { width: min(100% - 22px, 1180px); padding-top: 12px; }
  .hero, .form-card, .results-card, .history-card, .quick-card { padding: 16px; border-radius: 22px; }
  .section-heading, .stacked-mobile { align-items: stretch; flex-direction: column; }
  .inline-actions, .button-row { width: 100%; }
  .primary-btn, .secondary-btn, .ghost-btn { width: 100%; min-height: 46px; }
  .input-grid, .metric-grid { grid-template-columns: 1fr; }
  .league-topline { align-items: flex-start; flex-direction: column; }
  .progress-meta { font-size: 0.78rem; }
  h1 { font-size: 2.65rem; }
}
.ocr-options {
  margin-top: 12px;
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.08);
}
.ocr-options label { display: grid; gap: 6px; }
.ocr-options select {
  width: 100%;
  color: var(--text);
  background: rgba(5, 9, 18, 0.82);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 13px 12px;
  outline: none;
}
.ocr-options p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
  margin: 0;
}
.ocr-review {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(141,255,178,0.22);
  background: rgba(141,255,178,0.06);
  color: var(--text);
  line-height: 1.45;
}
.ocr-review strong { color: var(--ok); }
.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.review-grid span {
  background: rgba(0,0,0,0.22);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 8px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.review-grid b {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 2px;
}
.ocr-review small { color: var(--muted); }
@media (max-width: 640px) {
  .review-grid { grid-template-columns: 1fr; }
}

/* v6: dopamine layer */
.league-card { position: relative; }
.shine-sweep {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,0.08) 42%, rgba(255,255,255,0.24) 50%, rgba(255,255,255,0.08) 58%, transparent 100%);
  transform: translateX(-130%);
  animation: sweep 4.2s ease-in-out infinite;
}
@keyframes sweep {
  0%, 48% { transform: translateX(-130%); opacity: 0; }
  58% { opacity: 0.85; }
  78%, 100% { transform: translateX(130%); opacity: 0; }
}
.badge-ring { transition: transform 0.28s ease, filter 0.28s ease, box-shadow 0.28s ease; }
.badge-ring[data-tier="Bronze"] { background: linear-gradient(145deg, #c68d52, #fff2c6 45%, #794515); }
.badge-ring[data-tier="Silver"] { background: linear-gradient(145deg, #b9c3d1, #ffffff 45%, #687486); }
.badge-ring[data-tier="Gold"] { background: linear-gradient(145deg, #f6d35b, #fff2a2 45%, #a86b00); }
.badge-ring[data-tier="Platinum"] { background: linear-gradient(145deg, #c6f7ff, #ffffff 45%, #319eb2); }
.badge-ring[data-tier="Diamond"] { background: linear-gradient(145deg, #7de3ff, #f7ffff 45%, #4c68ff); }
.badge-ring[data-tier="Master"] { background: linear-gradient(145deg, #ffdc73, #ffffff 45%, #a31cff); }
.badge-ring[data-tier="Grandmaster"] { background: linear-gradient(145deg, #ff7a7a, #fff2a2 45%, #5d0404); }
/* v19: rank ladder gradients — escalating prestige, Cadet (steel) → Hero (Super Earth red-gold).
   Placed after the tier rules so they win when both attributes are set on the ring. */
.badge-ring[data-rank="Cadet"] { background: linear-gradient(145deg, #8a97a6, #d7dee6 45%, #4a5563); }
.badge-ring[data-rank="Trooper"] { background: linear-gradient(145deg, #c68d52, #ffe6b0 45%, #7a4a1e); }
.badge-ring[data-rank="Sergeant"] { background: linear-gradient(145deg, #9caf6a, #e7f0c2 45%, #566a2f); }
.badge-ring[data-rank="Lieutenant"] { background: linear-gradient(145deg, #a9c6e0, #eef6ff 45%, #4f6f92); }
.badge-ring[data-rank="Captain"] { background: linear-gradient(145deg, #69d6e6, #e0feff 45%, #2b7f8c); }
.badge-ring[data-rank="Major"] { background: linear-gradient(145deg, #f6d35b, #fff2a2 45%, #a86b00); }
.badge-ring[data-rank="Colonel"] { background: linear-gradient(145deg, #e0b64b, #fff0c0 45%, #6a3fb0); }
.badge-ring[data-rank="Hero of the Federation"] {
  background: linear-gradient(145deg, #ff7a5c, #ffe08a 45%, #b21212);
  box-shadow: inset 0 0 0 4px rgba(0,0,0,0.18), 0 12px 44px rgba(255,90,60,0.5);
}
.badge-ring.promote {
  animation: badgePop 0.9s cubic-bezier(.22,1.4,.36,1) both;
  filter: saturate(1.4) drop-shadow(0 0 28px rgba(246,211,91,.55));
}
@keyframes badgePop {
  0% { transform: scale(1) rotate(0deg); }
  35% { transform: scale(1.22) rotate(-4deg); }
  70% { transform: scale(0.94) rotate(3deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.rank-pop { animation: cardPop 0.85s ease both; }
@keyframes cardPop {
  0% { transform: scale(1); box-shadow: var(--shadow); }
  35% { transform: scale(1.018); box-shadow: 0 0 0 1px rgba(246,211,91,.35), 0 22px 80px rgba(246,211,91,.24); }
  100% { transform: scale(1); box-shadow: var(--shadow); }
}
.dopamine-deck {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 12px;
  margin-top: 14px;
}
.mini-brief {
  background: linear-gradient(160deg, rgba(255,255,255,0.07), rgba(255,255,255,0.035));
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 18px;
  padding: 14px;
  overflow: hidden;
}
.mini-brief small {
  color: var(--muted);
  display: block;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 900;
  font-size: .72rem;
  margin-bottom: 5px;
}
.mini-brief strong { display: block; font-size: 1.08rem; margin-bottom: 4px; }
.mini-brief span, .mini-brief li { color: var(--muted); line-height: 1.4; }
.mini-brief ol { margin: 6px 0 0 18px; padding: 0; display: grid; gap: 4px; }
.delta-panel, .ribbon-case {
  margin-top: 14px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 22px;
  padding: 14px;
}
.delta-empty {
  display: grid;
  gap: 4px;
  color: var(--muted);
  line-height: 1.45;
}
.delta-empty b { color: var(--gold); }
.mini-heading { margin-bottom: 12px; }
.comparison-date, .ribbon-count {
  color: var(--muted);
  font-size: .78rem;
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 7px 10px;
  white-space: nowrap;
}
.delta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.delta-chip {
  border-radius: 16px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.045);
}
.delta-chip small { color: var(--muted); display: block; margin-bottom: 4px; }
.delta-chip strong { font-size: 1.24rem; }
.delta-chip.good { border-color: rgba(141,255,178,.28); background: rgba(141,255,178,.08); }
.delta-chip.good strong { color: var(--ok); }
.delta-chip.bad { border-color: rgba(255,122,122,.25); background: rgba(255,122,122,.07); }
.delta-chip.bad strong { color: var(--danger); }
.delta-chip.flat strong { color: var(--muted); }
.ribbon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.ribbon {
  position: relative;
  min-height: 112px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.20);
  display: grid;
  align-content: start;
  gap: 5px;
  overflow: hidden;
}
.ribbon::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -18px;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
}
.ribbon span { font-size: 1.45rem; }
.ribbon b { line-height: 1.12; }
.ribbon small { color: var(--muted); line-height: 1.25; }
.ribbon.unlocked {
  background: linear-gradient(160deg, rgba(246,211,91,.14), rgba(125,227,255,.07));
  border-color: rgba(246,211,91,.28);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
  animation: ribbonIn .38s ease both;
}
.ribbon.locked { filter: grayscale(1); opacity: .54; }
.ribbon.locked span { opacity: .45; }
@keyframes ribbonIn {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.history-helper { margin: -6px 0 14px; }
.history-delta {
  display: inline-block;
  font-style: normal;
  font-size: .76rem;
  padding: 3px 7px;
  border-radius: 999px;
  margin-left: 4px;
  vertical-align: middle;
}
.history-delta.good { color: #06120b; background: var(--ok); }
.history-delta.bad { color: #fff; background: var(--danger); }
.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  overflow: hidden;
}
.confetti-layer span {
  position: absolute;
  top: -42px;
  font-size: 22px;
  animation: confettiFall 2.35s cubic-bezier(.17,.67,.21,1) forwards;
  transform: translate3d(0,0,0);
}
@keyframes confettiFall {
  0% { transform: translate3d(0, -60px, 0) rotate(0deg) scale(.8); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translate3d(var(--drift), 110vh, 0) rotate(var(--spin)) scale(1.08); opacity: 0; }
}
@media (max-width: 760px) {
  .dopamine-deck, .delta-grid, .ribbon-grid { grid-template-columns: 1fr; }
  .comparison-date, .ribbon-count { align-self: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .shine-sweep, .badge-ring.promote, .rank-pop, .ribbon.unlocked, .confetti-layer span { animation: none !important; }
}

/* v7 growth mode additions */
.extra-grid { margin-top: 22px; }
.import-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin: 14px 0; }
.import-row input { width: 100%; border-radius: 14px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.06); color: #fff; padding: 13px 14px; font: inherit; }
.season-panel { margin: 16px 0; padding: 16px; border-radius: 18px; border: 1px solid rgba(255, 226, 122, .22); background: radial-gradient(circle at top left, rgba(255, 226, 122, .14), rgba(255,255,255,.04)); }
.season-top { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.season-top h3 { margin: 0; font-size: 1.05rem; }
.season-top strong { font-size: 1.15rem; color: #ffe37a; padding: 8px 12px; border-radius: 999px; background: rgba(255, 227, 122, .10); border: 1px solid rgba(255, 227, 122, .22); }
.season-xp { height: 13px; border-radius: 999px; overflow: hidden; background: rgba(0,0,0,.28); margin: 12px 0 8px; border: 1px solid rgba(255,255,255,.10); }
.season-xp span { display:block; height:100%; border-radius: inherit; background: linear-gradient(90deg, #72f7a2, #ffe37a, #ff8c42); box-shadow: 0 0 18px rgba(255, 227, 122, .45); transition: width .7s ease; }
.season-panel p { margin: 8px 0 0; color: rgba(255,255,255,.78); }
.season-target { color: #ffe37a !important; font-weight: 800; }
.squad-list, .war-list { display:grid; gap: 10px; margin-top: 12px; }
.squad-list.empty { color: rgba(255,255,255,.62); padding: 16px; border-radius: 16px; background: rgba(255,255,255,.04); }
.squad-row, .war-row { display:grid; grid-template-columns: 42px 1fr auto; gap: 10px; align-items:center; padding: 12px; border-radius: 16px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); }
.squad-row > b, .war-row > b { display:grid; place-items:center; width: 34px; height: 34px; border-radius: 12px; background: rgba(255,227,122,.12); color:#ffe37a; }
.squad-row strong, .war-row strong { display:flex; gap: 8px; flex-wrap:wrap; align-items:center; }
.squad-row strong span { color:#72f7a2; }
.squad-row small, .war-row small { display:block; color: rgba(255,255,255,.62); margin-top: 2px; }
.squad-row em, .war-row em { font-style: normal; color:#ffe37a; font-weight: 900; }
.war-status { margin-top: 8px; padding: 14px; border-radius: 16px; background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.08); color: rgba(255,255,255,.78); }
.war-status b, .war-status span { display:block; }
.war-status b { color:#fff; margin-bottom: 4px; }
.war-row em { min-width: 72px; text-align: right; }
@media (max-width: 640px) {
  .import-row { grid-template-columns: 1fr; }
  .squad-row, .war-row { grid-template-columns: 34px 1fr; }
  .squad-row em, .war-row em { grid-column: 2; text-align:left; }
}


/* v8 category/button navigation */
.command-tabs {
  position: sticky;
  top: max(10px, env(safe-area-inset-top));
  z-index: 30;
  display: grid;
  gap: 14px;
  border-color: rgba(255, 220, 93, 0.22);
  backdrop-filter: blur(18px);
}
.command-tabs h2 { margin-bottom: 0; }
.tab-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.tab-btn {
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  color: var(--text, #f4f7ff);
  padding: 12px 10px;
  min-height: 46px;
  font-weight: 900;
  letter-spacing: .01em;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.tab-btn.active {
  color: #07101f;
  background: linear-gradient(135deg, #ffe46a, #4effb2);
  border-color: rgba(255,255,255,.55);
  box-shadow: 0 10px 28px rgba(78,255,178,.18), 0 0 0 1px rgba(255,255,255,.16) inset;
}
.tab-btn.ghost-tab:not(.active) {
  background: rgba(64, 114, 255, .10);
}
.tab-helper { margin: -2px 0 0; }
[data-panel][hidden], .panel-wrapper-hidden { display: none !important; }
.panel-pop {
  animation: panelPop .22s ease-out;
}
@keyframes panelPop {
  from { opacity: .3; transform: translateY(8px) scale(.992); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 840px) {
  .command-tabs {
    top: max(8px, env(safe-area-inset-top));
    margin-left: -2px;
    margin-right: -2px;
  }
  .tab-buttons {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scroll-snap-type: x mandatory;
  }
  .tab-btn {
    flex: 0 0 auto;
    min-width: 132px;
    scroll-snap-align: start;
    white-space: nowrap;
    padding-inline: 12px;
  }
}


/* v9 My Profile */
.profile-card { margin-top: 22px; }
.profile-summary.empty {
  color: var(--muted);
  border: 1px dashed rgba(255,255,255,0.14);
  border-radius: 16px;
  padding: 18px;
  background: rgba(255,255,255,0.035);
}
.profile-hero {
  position: relative;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(246,211,91,0.28);
  background:
    radial-gradient(circle at 16% 20%, rgba(246,211,91,0.20), transparent 32%),
    linear-gradient(145deg, rgba(255,255,255,0.09), rgba(255,255,255,0.035));
  box-shadow: 0 18px 45px rgba(0,0,0,0.25);
  overflow: hidden;
}
.profile-hero:before {
  content: '';
  position: absolute;
  inset: -40%;
  background: linear-gradient(115deg, transparent 0 38%, rgba(255,255,255,0.10) 48%, transparent 58% 100%);
  transform: translateX(-30%);
  animation: profileSweep 5s ease-in-out infinite;
  pointer-events: none;
}
@keyframes profileSweep {
  0%, 55% { transform: translateX(-46%) rotate(4deg); opacity: 0; }
  70% { opacity: 1; }
  100% { transform: translateX(46%) rotate(4deg); opacity: 0; }
}
.profile-emblem {
  width: 120px;
  height: 120px;
  border-radius: 32px;
  display: grid;
  place-items: center;
  font-size: 3.7rem;
  background: radial-gradient(circle, rgba(246,211,91,0.30), rgba(96,210,255,0.10));
  border: 2px solid rgba(246,211,91,0.45);
  box-shadow: inset 0 0 26px rgba(246,211,91,0.14), 0 0 30px rgba(246,211,91,0.12);
}
.profile-main h3 { margin: 0 0 6px; font-size: clamp(1.35rem, 5vw, 2rem); }
.profile-rating { font-size: 0.72rem; font-weight: 800; color: var(--muted); letter-spacing: 0.02em; white-space: nowrap; }
.profile-main p { color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.profile-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.profile-pills span {
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.07);
  color: var(--text);
  font-weight: 800;
  font-size: 0.82rem;
}
.profile-card-preview { margin-top: 14px; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; }
.profile-stat {
  background: rgba(255,255,255,0.055);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 12px;
}
.profile-stat small { color: var(--muted); display:block; margin-bottom: 4px; }
.profile-stat strong { font-size: 1.15rem; }
@media (max-width: 720px) {
  .profile-hero { grid-template-columns: 1fr; text-align: center; }
  .profile-emblem { margin: 0 auto; }
  .profile-pills { justify-content: center; }
  .profile-card-preview { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 430px) {
  .profile-card-preview { grid-template-columns: 1fr; }
}

/* ===== v10: Difficulty Resume ===== */
.difficulty-card { padding: 22px; margin-bottom: 22px; }
.difficulty-grid { margin-bottom: 16px; }
.difficulty-mismatch {
  background: rgba(246, 211, 91, 0.10);
  border: 1px solid rgba(246, 211, 91, 0.35);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
  color: var(--gold);
  font-size: 0.9rem;
  line-height: 1.5;
}
.difficulty-results {
  background: var(--panel-soft);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 16px;
}
.difficulty-results.empty { color: var(--muted); text-align: center; padding: 22px 16px; }
.diff-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.diff-chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  padding: 10px 12px;
  display: grid;
  gap: 3px;
}
.diff-chip small { color: var(--muted); font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 800; }
.diff-chip strong { font-size: 1.15rem; letter-spacing: -0.02em; }
.diff-chip.good strong { color: var(--ok); }
.diff-chip.bad strong { color: var(--danger); }
.strength-meter { margin-bottom: 14px; }
.strength-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.74rem; font-weight: 800; margin-bottom: 6px; }
.strength-bar {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  overflow: hidden;
}
.strength-bar span {
  position: absolute; inset: 0 auto 0 0;
  background: linear-gradient(90deg, #6d7f9c, var(--gold) 55%, #ff9b54);
  border-radius: inherit;
  transition: width .5s ease;
}
.strength-bar i {
  position: absolute; top: -2px; bottom: -2px; width: 3px;
  background: rgba(255,255,255,0.75);
  border-radius: 2px;
}
.strength-meter small { display: block; margin-top: 8px; color: var(--muted); line-height: 1.5; }
.diff-adjusted-line {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 800;
}
.diff-adjusted-line b { font-size: 1.3rem; letter-spacing: -0.03em; }
.diff-adjusted-line b.good { color: var(--ok); }
.diff-adjusted-line b.bad { color: var(--danger); }
.diff-arrow { color: var(--gold); font-size: 1.2rem; }
.diff-tier { margin-left: auto; color: var(--gold); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; }
.difficulty-badges { margin-top: 16px; }
.ribbon.roast { border-color: rgba(255,122,122,0.45); }
.ribbon.roast b { color: var(--danger); }
@media (max-width: 720px) {
  .diff-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .diff-tier { margin-left: 0; width: 100%; }
}
@media (max-width: 640px) {
  .difficulty-card { padding: 16px; border-radius: 22px; }
  /* Short numeric inputs: keep two columns even on phones so the resume isn't a 10-row scroll. */
  .difficulty-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .difficulty-grid label { font-size: 0.8rem; }
}

/* ===== v13: Mission Log ===== */
.missions-card { padding: 22px; margin-bottom: 22px; }
.mission-form {
  background: var(--panel-soft);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 16px;
}
.mission-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.mission-form select {
  width: 100%;
  margin-top: 6px;
  background: rgba(6, 12, 22, 0.9);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  color: var(--text);
  padding: 10px 12px;
  min-height: 44px;
}
.form-panel { margin-bottom: 16px; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.form-chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 16px;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  align-content: start;
}
.form-chip small { color: var(--muted); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 800; }
.form-chip strong { font-size: 1.5rem; letter-spacing: -0.03em; line-height: 1; }
.form-chip strong i { font-style: normal; font-size: 0.85rem; color: var(--muted); }
.form-chip span { color: var(--muted); font-size: 0.8rem; line-height: 1.4; }
.form-chip.hero-chip { border-color: rgba(246,211,91,0.4); background: linear-gradient(160deg, rgba(246,211,91,0.14), rgba(255,255,255,0.04)); }
.form-chip.hero-chip strong { font-size: 2rem; }
.form-chip.good strong { color: var(--ok); }
.form-chip.warn strong { color: var(--gold); }
.form-chip.bad strong { color: var(--danger); }
.mission-list { display: grid; gap: 8px; }
.mission-list.empty { color: var(--muted); text-align: center; padding: 20px; background: var(--panel-soft); border-radius: 16px; border: 1px dashed rgba(255,255,255,0.14); }
.mission-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 82px 30px;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-left: 4px solid rgba(255,255,255,0.15);
  border-radius: 14px;
  padding: 10px 12px;
}
.mission-row.won { border-left-color: var(--ok); }
.mission-row.lost { border-left-color: var(--danger); }
.m-faction { font-size: 1.4rem; text-align: center; }
.m-main strong { display: block; font-size: 0.92rem; letter-spacing: 0.01em; }
.m-main small { color: var(--muted); font-size: 0.78rem; }
/* v19: each dive shows the RANK it earned as a badge; the 0–100 score is the small line under it. */
.m-rank {
  display: grid;
  justify-items: center;
  gap: 1px;
  text-align: center;
  background: rgba(246,211,91,0.12);
  border: 1px solid rgba(246,211,91,0.3);
  border-radius: 10px;
  padding: 5px 4px;
  line-height: 1.05;
}
.m-rank-emoji { font-size: 1rem; }
.m-rank-label { font-size: 0.64rem; font-weight: 900; letter-spacing: 0.02em; color: var(--gold); text-transform: uppercase; }
.m-rank-score { font-style: normal; font-size: 0.66rem; font-weight: 800; color: var(--muted); }
.m-delete {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  color: var(--muted);
  min-height: 30px;
}
.m-delete:hover { color: var(--danger); border-color: rgba(255,122,122,0.5); }
.mission-more { color: var(--muted); text-align: center; font-size: 0.8rem; padding: 6px; }
.install-hint { margin-top: 8px; color: var(--gold); }
@media (max-width: 760px) {
  .mission-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .missions-card { padding: 16px; border-radius: 22px; }
}

/* ===== v13.1: Score Trend + Backup ===== */
.score-trend {
  background: var(--panel-soft);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 14px 14px 10px;
  margin-bottom: 14px;
}
.trend-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-weight: 800; font-size: 0.86rem; margin-bottom: 8px; }
.trend-head span { color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.72rem; }
.trend-head b.good { color: var(--ok); }
.trend-head b.bad { color: var(--danger); }
.trend-svg { width: 100%; height: 150px; display: block; }
.trend-line { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.trend-dot { fill: var(--gold); stroke: rgba(8,17,31,0.9); stroke-width: 1.5; }
.trend-dot.last { fill: #fff2a2; }
.trend-tier { stroke: rgba(255,255,255,0.12); stroke-dasharray: 4 5; stroke-width: 1; }
.trend-tick { fill: rgba(255,255,255,0.4); font-size: 9px; font-weight: 700; }
.trend-dates { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.74rem; margin-top: 4px; padding: 0 2px; }
.trend-note { color: var(--muted); text-align: center; padding: 8px; font-size: 0.9rem; }

.data-vault {
  margin-top: 18px;
  background: var(--panel-soft);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: 16px;
}
.backup-status { display: grid; gap: 4px; color: var(--muted); font-size: 0.85rem; }
.backup-stale { color: var(--gold); font-weight: 700; }
.backup-rescue { color: var(--gold); font-weight: 700; }

.form-bars { width: 100%; height: 26px; margin-top: 8px; display: block; opacity: 0.95; }
.form-bars .bar-win { fill: var(--ok); }
.form-bars .bar-loss { fill: var(--danger); }

/* ===== v14: bottom nav, More sheet, monthly reports, juice ===== */
body { padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 2px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(7, 13, 24, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(246, 211, 91, 0.22);
  box-shadow: 0 -8px 30px rgba(0,0,0,0.45);
}
.nav-item {
  display: grid; justify-items: center; gap: 2px;
  background: transparent; border: 0; color: var(--muted);
  padding: 6px 2px; border-radius: 14px; min-height: 52px;
  font-weight: 800; transition: transform .12s ease, color .15s ease, background .15s ease;
}
.nav-ico { font-size: 1.35rem; line-height: 1; transition: transform .18s cubic-bezier(.3,1.6,.5,1); }
.nav-label { font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; }
.nav-item.active { color: var(--gold); background: rgba(246,211,91,0.10); }
.nav-item.active .nav-ico { transform: translateY(-2px) scale(1.18); }
.nav-item:active { transform: scale(0.9); }
.nav-log {
  color: #1b1405;
  background: linear-gradient(160deg, #ffe37a, var(--gold));
  border-radius: 18px; margin-top: -18px; min-height: 62px;
  box-shadow: 0 6px 18px rgba(246,211,91,0.45), inset 0 1px 0 rgba(255,255,255,0.6);
}
.nav-log .nav-label { color: #1b1405; }
.nav-log.active { outline: 2px solid rgba(255,255,255,0.65); background: linear-gradient(160deg, #fff0a8, #ffd84d); }

.more-backdrop {
  position: fixed; inset: 0; z-index: 950;
  background: rgba(3, 6, 12, 0.6); opacity: 0; transition: opacity .2s ease;
}
.more-backdrop.open { opacity: 1; }
.more-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 960;
  background: linear-gradient(180deg, #101a2c, #0a121f);
  border-radius: 22px 22px 0 0;
  border: 1px solid rgba(246,211,91,0.25); border-bottom: 0;
  padding: 10px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateY(102%); transition: transform .22s cubic-bezier(.2,.9,.3,1);
  display: grid; gap: 8px;
}
.more-sheet.open { transform: translateY(0); }
.sheet-grip { width: 44px; height: 4px; border-radius: 999px; background: rgba(255,255,255,0.25); margin: 2px auto 6px; }
.sheet-item {
  display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto;
  align-items: center; column-gap: 12px; text-align: left;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09);
  border-radius: 16px; padding: 12px 14px; color: var(--text); min-height: 60px;
  transition: transform .12s ease, background .15s ease;
}
.sheet-item span { grid-row: 1 / span 2; font-size: 1.5rem; text-align: center; }
.sheet-item b { font-size: 0.98rem; }
.sheet-item small { color: var(--muted); font-size: 0.78rem; }
.sheet-item:active { transform: scale(0.97); background: rgba(246,211,91,0.10); }
.sheet-item.active { border-color: rgba(246,211,91,0.5); }

/* monthly reports */
.monthly-reports { margin-bottom: 14px; }
.month-grid { display: grid; gap: 10px; }
.month-card {
  background: var(--panel-soft); border: 1px solid rgba(255,255,255,0.09);
  border-radius: 18px; padding: 14px;
}
.month-card.active-month { border-color: rgba(246,211,91,0.5); background: linear-gradient(160deg, rgba(246,211,91,0.10), var(--panel-soft)); }
.month-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.month-head b { font-size: 1.02rem; letter-spacing: 0.01em; }
.live-pill {
  background: var(--gold); color: #1b1405; font-size: 0.62rem; font-weight: 900;
  letter-spacing: 0.1em; padding: 4px 8px; border-radius: 999px;
  animation: livePulse 2.2s ease-in-out infinite;
}
@keyframes livePulse { 0%,100% { box-shadow: 0 0 0 0 rgba(246,211,91,0.5); } 50% { box-shadow: 0 0 0 7px rgba(246,211,91,0); } }
.month-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-bottom: 8px; }
.month-stats > div { display: grid; gap: 2px; background: rgba(255,255,255,0.05); border-radius: 12px; padding: 8px 10px; }
.month-stats small { color: var(--muted); font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 800; }
.month-stats strong { font-size: 1.2rem; letter-spacing: -0.02em; }
.month-stats em, .month-stats b { font-style: normal; font-size: 0.72rem; font-weight: 800; color: var(--muted); }
.month-stats .good, .month-foot .good { color: var(--ok); }
.month-stats .bad { color: var(--danger); }
.month-foot { color: var(--muted); font-size: 0.78rem; }
@media (max-width: 640px) { .month-stats { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* juice */
button { transition: transform .1s ease; }
button:active { transform: scale(0.95); }
.tap-spark {
  position: fixed; z-index: 9999; width: 6px; height: 6px; border-radius: 999px;
  background: var(--gold); pointer-events: none;
  animation: sparkFly .5s ease-out forwards;
}
@keyframes sparkFly {
  0% { transform: translate(-50%,-50%) scale(1); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.2); opacity: 0; }
}
.row-enter { animation: rowEnter .55s cubic-bezier(.2,1.4,.4,1); }
@keyframes rowEnter {
  0% { transform: translateY(-14px) scale(0.96); opacity: 0; }
  60% { transform: translateY(2px) scale(1.02); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}
.deploy-streak {
  border-radius: 14px; padding: 10px 14px; margin-bottom: 12px;
  font-size: 0.92rem; border: 1px solid rgba(246,211,91,0.4);
  background: linear-gradient(90deg, rgba(246,211,91,0.16), rgba(246,211,91,0.04));
}
.deploy-streak.lit { animation: streakGlow 2.4s ease-in-out infinite; }
.deploy-streak.expiring { border-color: rgba(255,122,122,0.5); background: linear-gradient(90deg, rgba(255,122,122,0.14), rgba(255,122,122,0.03)); }
@keyframes streakGlow { 0%,100% { box-shadow: 0 0 0 0 rgba(246,211,91,0.25); } 50% { box-shadow: 0 0 16px 2px rgba(246,211,91,0.22); } }
.so-close { animation: soClose 1.1s ease-in-out infinite; color: var(--gold) !important; font-weight: 900; }
@keyframes soClose { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

@media (prefers-reduced-motion: reduce) {
  .tap-spark, .row-enter, .so-close, .deploy-streak.lit, .live-pill { animation: none !important; }
  .nav-ico, .nav-item, button { transition: none !important; }
}

/* ===== v15: toast actions, season strip, tour ===== */
.toast-action { display: flex; align-items: center; gap: 12px; }
.toast-action button {
  background: var(--gold); color: #1b1405; border: 0; border-radius: 10px;
  padding: 6px 12px; font-weight: 900; letter-spacing: 0.04em; min-height: 32px;
}

.season-strip {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  text-align: left; margin-bottom: 14px; padding: 12px 14px;
  background: linear-gradient(90deg, rgba(246,211,91,0.16), rgba(246,211,91,0.05));
  border: 1px solid rgba(246,211,91,0.4); border-radius: 16px;
  color: var(--text); font-size: 0.9rem;
}
.season-strip b { color: var(--gold); }
.season-strip em { font-style: normal; color: var(--gold); font-size: 1.3rem; font-weight: 900; }

#seTour .tour-backdrop { position: fixed; inset: 0; z-index: 1200; background: rgba(3,6,12,0.72); backdrop-filter: blur(3px); }
#seTour .tour-card {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 1210; width: min(92vw, 380px);
  background: linear-gradient(170deg, #14203a, #0b1424);
  border: 1px solid rgba(246,211,91,0.45); border-radius: 22px;
  padding: 22px 20px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: tourIn .3s cubic-bezier(.2,1.3,.4,1);
}
@keyframes tourIn { from { transform: translate(-50%, -46%) scale(0.94); opacity: 0; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.tour-emoji { font-size: 2.4rem; margin-bottom: 6px; }
#seTour h3 { margin: 0 0 8px; font-size: 1.2rem; letter-spacing: 0.02em; }
#seTour p { margin: 0 0 14px; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }
.tour-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 14px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 999px; background: rgba(255,255,255,0.25); }
.tour-dots i.on { background: var(--gold); width: 18px; }
.tour-actions { display: flex; gap: 10px; justify-content: center; }
.tour-actions button { min-width: 110px; }
@media (prefers-reduced-motion: reduce) { #seTour .tour-card { animation: none; } }

/* ===== v16: Squad HQ ===== */
.hq-auth { background: var(--panel-soft); border: 1px solid rgba(246,211,91,0.3); border-radius: 18px; padding: 16px; margin-bottom: 14px; }
.hq-auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.hq-auth-grid input { width: 100%; margin-top: 6px; }
.hq-fine { margin-top: 10px; font-size: 0.78rem; }
.hq-status {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(126,231,135,0.12), rgba(255,255,255,0.04));
  border: 1px solid rgba(126,231,135,0.35); border-radius: 14px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 0.9rem;
}
.hq-rows { display: grid; gap: 8px; }
.hq-row {
  display: grid; grid-template-columns: 44px minmax(0,1fr) 34px;
  align-items: center; gap: 10px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px; padding: 10px 12px;
}
.hq-row b { color: var(--gold); font-size: 1.05rem; }
.hq-row.me { border-color: rgba(246,211,91,0.6); background: linear-gradient(90deg, rgba(246,211,91,0.14), rgba(255,255,255,0.04)); }
.hq-main strong { display: flex; justify-content: space-between; gap: 8px; font-size: 0.95rem; }
.hq-main strong span { color: var(--gold); }
.hq-main small { color: var(--muted); font-size: 0.78rem; }
.hq-empty { text-align: center; color: var(--muted); padding: 18px; background: var(--panel-soft); border-radius: 14px; border: 1px dashed rgba(255,255,255,0.15); }
/* v24: Season / All-Time segmented toggle above the global board */
.board-toggle { display: flex; gap: 6px; padding: 4px; margin: 0 0 12px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.09); border-radius: 12px; }
.board-tab {
  flex: 1; padding: 8px 10px; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--muted); font-family: var(--head-font);
  font-weight: 800; font-size: 0.82rem; letter-spacing: 0.02em;
  transition: background 0.15s ease, color 0.15s ease;
}
.board-tab:hover:not(.active) { color: var(--gold-bright); }
.board-tab.active { background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: #17130a; box-shadow: 0 6px 16px rgba(216,180,90,0.2); }
.board-hint {
  display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 9px 12px;
  font-size: 0.82rem; color: var(--gold-bright); border-radius: 12px;
  background: linear-gradient(90deg, rgba(246,211,91,0.12), rgba(255,255,255,0.03));
  border: 1px solid rgba(246,211,91,0.3);
}
.board-hint b { color: #fff; }
@media (prefers-reduced-motion: reduce) { .board-tab { transition: none; } }
.local-links { margin-top: 16px; }
.local-links summary { cursor: pointer; color: var(--muted); font-weight: 700; padding: 8px 0; }
.local-links[open] summary { color: var(--gold); }
@media (max-width: 560px) { .hq-auth-grid { grid-template-columns: 1fr; } }

/* v16.1 */
.season-details { line-height: 1.6; }


/* v16.4: inline auth feedback */
.hq-auth-msg {
  margin-top: 12px; padding: 10px 14px; border-radius: 12px;
  font-size: 0.88rem; line-height: 1.5; font-weight: 600;
}
.hq-auth-msg.info { background: rgba(133,193,255,0.12); border: 1px solid rgba(133,193,255,0.4); color: #bcdcff; }
.hq-auth-msg.bad { background: rgba(255,122,122,0.12); border: 1px solid rgba(255,122,122,0.45); color: #ffc9c9; }
button[disabled] { opacity: 0.55; }

/* ===== v17: welcome screen ===== */
.welcome-card { text-align: left; }
.welcome-card .tour-emoji, .welcome-card h3 { text-align: center; }
.welcome-label { display: block; font-weight: 800; font-size: 0.82rem; color: var(--muted); margin-bottom: 10px; }
.welcome-label input { width: 100%; margin-top: 6px; }
.welcome-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.welcome-skip {
  width: 100%; margin-top: 12px; background: transparent; border: 0;
  color: var(--muted); text-decoration: underline; font-size: 0.85rem; padding: 8px;
}
.welcome-fine { margin: 10px 0 0; color: var(--muted); font-size: 0.75rem; text-align: center; }

/* v17.1: log gate */
.log-gate {
  text-align: center; padding: 26px 18px;
  background: var(--panel-soft); border: 1px dashed rgba(246,211,91,0.45);
  border-radius: 18px;
}
.log-gate-emoji { font-size: 2.2rem; margin-bottom: 6px; }
.log-gate h3 { margin: 0 0 8px; }
.log-gate p { color: var(--muted); margin: 0 0 14px; line-height: 1.55; }
.welcome-reason {
  background: rgba(246,211,91,0.12); border: 1px solid rgba(246,211,91,0.4);
  border-radius: 12px; padding: 10px 12px; font-weight: 700;
}

/* ===== v21: welcome polish + "What is this?" info screen + legal footer ===== */
.welcome-tagline { margin: 0 0 12px; color: var(--muted); font-size: 0.9rem; line-height: 1.55; text-align: center; }
.welcome-tagline b { color: var(--gold); }
.welcome-whatis {
  width: 100%; margin-top: 4px; background: transparent; border: 0;
  color: #bcdcff; font-size: 0.85rem; padding: 6px; cursor: pointer;
}

#seInfo .tour-backdrop { position: fixed; inset: 0; z-index: 1200; background: rgba(3,6,12,0.72); backdrop-filter: blur(3px); }
#seInfo .tour-card {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 1210; width: min(92vw, 420px); max-height: 88vh; overflow-y: auto;
  background: linear-gradient(170deg, #14203a, #0b1424);
  border: 1px solid rgba(246,211,91,0.45); border-radius: 22px;
  padding: 22px 20px; text-align: left;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: tourIn .3s cubic-bezier(.2,1.3,.4,1);
}
#seInfo .tour-emoji, #seInfo h3 { text-align: center; }
#seInfo h3 { margin: 0 0 12px; font-size: 1.2rem; letter-spacing: 0.02em; }
#seInfo p { margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }
#seInfo p b { color: #eef2f8; }
.info-scoring { background: rgba(246,211,91,0.1); border: 1px solid rgba(246,211,91,0.32); border-radius: 12px; padding: 10px 12px; }
.info-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
@media (prefers-reduced-motion: reduce) { #seInfo .tour-card { animation: none; } }

.footer-legal { font-size: 0.82rem; opacity: 0.92; max-width: 660px; margin: 0 auto 10px; }
.footer-link {
  background: transparent; border: 0; color: #bcdcff; text-decoration: underline;
  font: inherit; cursor: pointer; padding: 0;
}

/* ============================================================
   v20 REDESIGN — near-black charcoal + aged-gold "military command"
   theme (poster look). Retires the navy/cyan era, adds the faction
   picker and the Rank Ladder screen. Appended last so it wins.
   ============================================================ */
.card { border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.glow::before { background: linear-gradient(120deg, rgba(216,180,90,0.42), transparent 46%, rgba(216,180,90,0.16)); }

/* Buttons — gold primary, gunmetal secondary, hairline ghost */
.primary-btn { background: linear-gradient(160deg, var(--gold-bright), var(--gold)); color: #17130a; box-shadow: 0 8px 22px rgba(216,180,90,0.22); }
.secondary-btn { background: linear-gradient(160deg, #4a4636, #2d2a22); color: var(--gold-bright); border: 1px solid var(--line); box-shadow: none; }
.ghost-btn { background: rgba(255,255,255,0.05); color: var(--text); border: 1px solid rgba(216,180,90,0.22); box-shadow: none; }
.eyebrow { color: var(--gold); letter-spacing: 0.16em; }

/* Rank badge medallion — the real PNG art keeps its black background, so we frame it on a
   matching black plate (gold hairline + inset/drop shadow). The image self-frames, so it
   blends into any panel and needs no per-context plate. */
.rank-badge-img {
  display: block; background: #000; object-fit: contain;
  border-radius: 18%;
  border: 1px solid rgba(216,180,90,0.34);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 6px 18px rgba(0,0,0,0.55);
}
.badge-card { background: linear-gradient(160deg, rgba(216,180,90,0.10), rgba(0,0,0,0.4)); border: 1px solid var(--line); }
/* Hero card badge: the ring is just a sizing box now; the medallion image is the visual. */
.badge-ring, .badge-ring[data-rank], .badge-ring[data-tier] {
  width: 116px; height: 116px; border-radius: 22px;
  background: none; box-shadow: none; padding: 0;
}
.badge-ring .rank-badge-img { width: 100%; height: 100%; border-radius: 22px; }
#tierName { color: var(--gold-bright); }
/* Ladder + crest badge sizing */
.ladder-badge { display: grid; place-items: center; }
.ladder-badge .rank-badge-img { width: 100%; height: auto; max-width: 78px; border-radius: 16px; }
.ladder-crest .rank-badge-img { width: 66px; height: 66px; border-radius: 16px; }
#scoreNumber { color: var(--muted); }

/* League card + progress */
.league-card { background: linear-gradient(160deg, rgba(216,180,90,0.10), rgba(15,15,16,0.97) 46%, rgba(0,0,0,0.62)); border: 1px solid var(--line); }
.league-topline span { background: linear-gradient(160deg, var(--gold-bright), var(--gold)); color: #17130a; letter-spacing: 0.08em; }
.league-topline span:last-child { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid var(--line); }
.progress-bar span { background: linear-gradient(90deg, var(--gold), var(--gold-bright)); }
.breakdown-row strong { color: var(--gold-bright); }

/* Retire leftover cyan/navy accents on shared components */
.season-xp span { background: linear-gradient(90deg, #7a5f1e, var(--gold) 55%, var(--gold-bright)); box-shadow: 0 0 16px rgba(216,180,90,0.4); }
.season-top strong, .season-target { color: var(--gold-bright) !important; }
.squad-row strong span, .hq-main strong span { color: var(--gold-bright); }
.trend-line { stroke: var(--gold); }
.trend-dot { fill: var(--gold); }
.trend-dot.last { fill: var(--gold-bright); }
.hq-status { border-color: var(--line); background: linear-gradient(90deg, rgba(216,180,90,0.10), rgba(255,255,255,0.03)); }

/* Tabs / bottom nav / sheet */
.tab-btn.active { background: linear-gradient(135deg, var(--gold-bright), var(--gold)); color: #17130a; border-color: rgba(216,180,90,0.6); box-shadow: 0 10px 26px rgba(216,180,90,0.2); }
.bottom-nav { background: rgba(10,10,11,0.95); border-top: 1px solid var(--line); }
.nav-item.active { color: var(--gold-bright); background: rgba(216,180,90,0.10); }
.nav-log { background: linear-gradient(160deg, var(--gold-bright), var(--gold)); color: #17130a; box-shadow: 0 6px 18px rgba(216,180,90,0.45), inset 0 1px 0 rgba(255,255,255,0.5); }
.nav-log .nav-label { color: #17130a; }
.more-sheet { background: linear-gradient(180deg, #171718, #0d0d0e); border-color: var(--line); }

/* Modals */
#seTour .tour-card, .welcome-card, #seWelcome .tour-card { background: linear-gradient(170deg, #1c1c1e, #101011); border: 1px solid var(--line); }

/* Profile hero */
.profile-hero { border: 1px solid var(--line); background: radial-gradient(circle at 16% 20%, rgba(216,180,90,0.18), transparent 34%), linear-gradient(150deg, rgba(255,255,255,0.05), rgba(0,0,0,0.35)); }
.profile-emblem { border: 2px solid var(--line); background: radial-gradient(circle, rgba(216,180,90,0.22), rgba(0,0,0,0.3)); }

/* ---- Faction picker ---- */
.faction-pick { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px 14px; margin: 6px 0 2px; background: var(--panel-soft); }
.faction-pick legend { padding: 0 6px; color: var(--gold); font-weight: 800; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.faction-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.faction-options label { position: relative; display: block; }
.faction-options input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.faction-options span { display: grid; place-items: center; text-align: center; min-height: 52px; padding: 8px 6px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.12); background: rgba(0,0,0,0.28); color: var(--muted); font-weight: 700; font-size: 0.92rem; transition: border-color .15s, background .15s, color .15s; }
.faction-options input:checked + span { border-color: var(--gold); background: rgba(216,180,90,0.16); color: var(--gold-bright); box-shadow: inset 0 0 0 1px rgba(216,180,90,0.4); }
.faction-options input:focus-visible + span { outline: 2px solid var(--gold-bright); outline-offset: 1px; }
.form-intro { margin: -2px 0 14px; }
@media (max-width: 420px) { .faction-options { grid-template-columns: 1fr; } .faction-options span { min-height: 46px; } }

/* ---- Rank Ladder screen ---- */
.ladder-card { padding: 20px; }
.rank-ladder { text-align: center; }
.ladder-crest { display: flex; justify-content: center; margin-bottom: 4px; }
.ladder-title { font-size: clamp(2.1rem, 9vw, 3.4rem); margin: 0; letter-spacing: 0.02em; color: #efe9dc; text-shadow: 0 2px 0 rgba(0,0,0,0.55); }
.ladder-sub { color: var(--gold); letter-spacing: 0.3em; text-transform: uppercase; font-size: 0.72rem; font-weight: 700; margin: 3px 0 2px; }
.ladder-standing { color: var(--muted); margin: 0 0 16px; font-size: 0.92rem; }
.ladder-standing b { color: var(--gold-bright); }
.ladder-rows { display: grid; gap: 12px; text-align: left; }
.ladder-row { display: grid; grid-template-columns: 82px 1fr; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.08); background: linear-gradient(120deg, rgba(255,255,255,0.03), rgba(0,0,0,0.28)); }
.ladder-row.current { border-color: var(--gold); background: linear-gradient(120deg, rgba(216,180,90,0.18), rgba(0,0,0,0.32)); box-shadow: 0 0 0 1px rgba(216,180,90,0.35), 0 10px 30px rgba(0,0,0,0.45); }
.ladder-badge { display: grid; place-items: center; }
.ladder-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ladder-info h3 { margin: 0; font-size: 1.4rem; color: #efe9dc; }
.ladder-you { font-family: var(--head-font); font-size: 0.62rem; letter-spacing: 0.1em; background: var(--gold); color: #17130a; padding: 3px 8px; border-radius: 999px; font-weight: 700; }
.ladder-tag { margin: 3px 0 8px; color: var(--gold); font-size: 0.83rem; }
.ladder-divs { display: flex; gap: 6px; flex-wrap: wrap; }
.ladder-div { display: grid; gap: 1px; justify-items: center; min-width: 56px; padding: 5px 8px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.28); color: var(--muted); font-weight: 800; font-size: 0.82rem; }
.ladder-div i { font-style: normal; font-weight: 600; font-size: 0.68rem; color: var(--muted); }
.ladder-div.on { border-color: var(--gold); background: rgba(216,180,90,0.18); color: var(--gold-bright); }
.ladder-div.on i { color: var(--gold-bright); }
.ladder-foot { margin: 18px 0 2px; text-align: center; font-family: var(--head-font); letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); font-size: 0.82rem; border-top: 1px solid var(--line); padding-top: 14px; }
@media (max-width: 480px) { .ladder-row { grid-template-columns: 62px 1fr; } .ladder-info h3 { font-size: 1.2rem; } }

/* Condensed caps want looser tracking than the old navy-era display type */
h1 { letter-spacing: 0; }
h2 { letter-spacing: 0.01em; }
.subhead, .helper-text, #roastLine, .mini-brief span, .mini-brief li, .season-panel p { font-family: Inter, ui-sans-serif, system-ui, sans-serif; text-transform: none; letter-spacing: normal; }

/* ============================================================
   v18: Medals & Honors — black-and-gold medallions, a service-record
   screen, featured medals on the player card, and a dramatic unlock overlay.
   ============================================================ */
/* Player-card emblem shows the real rank insignia art (same PNG as the hero card + ladder),
   not a bare emoji — so it can never be mistaken for one of the new medals. Scoped to
   .profile-emblem-rank; the shared .rank-badge-img rank-badge rules are left untouched. */
.profile-emblem-rank {
  padding: 0;
  overflow: hidden;
  background: none;
  border: none;
  box-shadow: none;
}
.profile-emblem-rank .rank-badge-img {
  width: 100%;
  height: 100%;
  border-radius: 26px;
}

/* Medal medallions — echo the rank-badge plaques (badge-designs/rank-*.png): a black
   rounded-square plate, brushed-steel bezel, a thin gold hairline border, a gold wreath-ring,
   and a brass-toned emblem. Tier ramps the bezel from bronze → radiant gold. NOTE: this is
   deliberately SEPARATE from the .rank-badge-img / .badge-ring rank art, which is left
   untouched so existing rank level badges never change. */
.medal-ico {
  --bezel: rgba(216,180,90,0.55);
  --glow: transparent;
  position: relative;
  width: 54px; height: 54px;
  flex: 0 0 auto;
  border-radius: 20%;
  display: grid; place-items: center;
  background:
    radial-gradient(120% 85% at 50% 16%, rgba(255,255,255,0.12), transparent 52%),
    linear-gradient(158deg, #5c626a, #1a1c20 46%, #050506 100%);
  border: 1px solid var(--bezel);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.16),
    inset 0 -9px 16px rgba(0,0,0,0.66),
    0 0 14px var(--glow),
    0 6px 18px rgba(0,0,0,0.55);
}
/* inner black medallion disc with a gold wreath-ring, like the rank emblems */
.medal-ico::before {
  content: ""; position: absolute; inset: 5px;
  border-radius: 15%;
  background: radial-gradient(circle at 50% 32%, #1c1d22, #08080a 74%);
  box-shadow: inset 0 0 0 1px rgba(216,180,90,0.40), inset 0 2px 6px rgba(0,0,0,0.75);
  pointer-events: none;
}
.medal-ico i {
  position: relative; z-index: 1;
  font-style: normal; font-size: 1.3rem; line-height: 1;
  /* brass-tint the emoji so it reads like the engraved metal emblems on the rank badges */
  filter: grayscale(1) brightness(0.92) sepia(1) saturate(4.2) hue-rotate(2deg) drop-shadow(0 1px 1px rgba(0,0,0,0.85));
}
.medal-ico.tier-1 { --bezel: rgba(181,118,46,0.70); }                                  /* bronze */
.medal-ico.tier-2 { --bezel: rgba(216,180,90,0.65); }                                  /* brass */
.medal-ico.tier-3 { --bezel: rgba(243,217,140,0.85); --glow: rgba(216,180,90,0.28); }  /* bright gold */
.medal-ico.tier-4 { --bezel: #f3d98c; --glow: rgba(243,217,140,0.50); }                /* radiant gold */
.medal-ico.tier-4 i { filter: grayscale(1) brightness(1.05) sepia(1) saturate(5) hue-rotate(4deg) drop-shadow(0 0 3px rgba(243,217,140,0.6)); }
.medal-ico.locked {
  --bezel: rgba(120,124,130,0.40);
  --glow: transparent;
  background:
    radial-gradient(120% 85% at 50% 16%, rgba(255,255,255,0.05), transparent 52%),
    linear-gradient(158deg, #34383e, #131417 50%, #050506 100%);
}
.medal-ico.locked::before { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), inset 0 2px 6px rgba(0,0,0,0.75); }
.medal-ico.locked i { filter: grayscale(1) brightness(0.5) drop-shadow(0 1px 1px rgba(0,0,0,0.8)); opacity: 0.7; }

/* featured medals on the player (profile) card */
.profile-medals { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.profile-medals .pm-count {
  font-family: var(--head-font); font-weight: 700; letter-spacing: 0.04em;
  color: var(--gold-bright); font-size: 0.86rem;
  padding: 5px 11px; border-radius: 999px;
  background: rgba(216,180,90,0.14); border: 1px solid var(--line);
}
.profile-medals .pm-icons { display: flex; gap: 7px; }
.profile-medals .pm-icons .medal-ico { width: 38px; height: 38px; }
.profile-medals .pm-icons .medal-ico i { font-size: 1rem; }
.profile-medals .pm-empty { color: var(--muted); font-size: 0.82rem; }

/* the Medals screen */
.medals-panel { margin-top: 6px; }
.medal-groups { display: grid; gap: 20px; }
.medal-group-head { margin-bottom: 10px; }
.medal-group-head h3 { margin: 0; font-family: var(--head-font); letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold-bright); font-size: 1.05rem; }
.medal-group-head small { color: var(--muted); font-size: 0.82rem; }
.medal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.medal {
  display: grid; grid-template-columns: 54px 1fr; gap: 12px; align-items: start;
  padding: 14px; border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.22);
}
.medal.earned {
  border-color: rgba(216,180,90,0.34);
  background: linear-gradient(160deg, rgba(216,180,90,0.13), rgba(0,0,0,0.20));
  animation: medalIn 0.4s ease both;
}
.medal.locked { opacity: 0.9; }
.medal-body { display: grid; gap: 4px; min-width: 0; }
.medal-body b { line-height: 1.15; color: var(--text); }
.medal-desc { color: var(--muted); line-height: 1.28; font-size: 0.82rem; }
.medal-earned { color: var(--gold-bright); font-weight: 800; font-size: 0.8rem; letter-spacing: 0.02em; }
.medal-howto { color: var(--gold); font-size: 0.8rem; font-weight: 600; }
.medal-progress { position: relative; height: 7px; border-radius: 999px; background: rgba(255,255,255,0.10); overflow: hidden; margin-top: 4px; }
.medal-progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--gold-bright)); transition: width 0.4s ease; }
.medal-progress-label { color: var(--muted); font-size: 0.72rem; font-weight: 700; }
@keyframes medalIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* dramatic unlock overlay — centered & z-index > 900 so the bottom nav never hides it (rule 7) */
.medal-unlock {
  position: fixed; left: 50%; top: 42%;
  transform: translate(-50%, -50%) scale(0.86);
  z-index: 1200;
  width: min(340px, 86vw);
  padding: 22px 20px 18px;
  border-radius: 22px;
  text-align: center;
  color: var(--text);
  background: linear-gradient(165deg, #1c1a15, #0c0c0d 78%);
  border: 1px solid var(--gold);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.6), 0 24px 70px rgba(0,0,0,0.72), 0 0 40px rgba(216,180,90,0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s ease, transform 0.32s cubic-bezier(.2,.9,.25,1.2);
}
.medal-unlock.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.medal-unlock .mu-inner { display: grid; justify-items: center; gap: 8px; }
.medal-unlock .medal-ico { width: 76px; height: 76px; }
.medal-unlock .medal-ico i { font-size: 2rem; }
.mu-eyebrow { margin: 0; font-family: var(--head-font); letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); font-size: 0.72rem; }
.medal-unlock h3 { margin: 4px 0 0; font-family: var(--head-font); font-size: 1.5rem; letter-spacing: 0.02em; color: var(--gold-bright); }
.mu-desc { margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.3; }
.mu-foot { margin: 4px 0 0; font-family: var(--head-font); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); font-size: 0.68rem; }

@media (max-width: 760px) {
  .medal-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .medal.earned, .medal-unlock { animation: none !important; }
  .medal-unlock { transition: opacity 0.2s ease; }
  .medal-unlock.show { transform: translate(-50%, -50%) scale(1); }
}
