/* ============================================================
   SubnetQuest — arcade-warm design system
   ============================================================ */
:root {
  --bg: #1a1428;
  --bg-2: #221a36;
  --card: #2b2144;
  --card-hi: #352a52;
  --ink: #f4efff;
  --ink-dim: #b9aed6;
  --ink-faint: #8a7dab;

  --net: #7c5cff;      /* violet — network bits */
  --net-soft: #a68cff;
  --host: #2ee6a8;     /* mint — host bits */
  --host-soft: #7ff0c8;
  --bcast: #ff5c8a;    /* pink — broadcast / danger-ish */
  --amber: #ffc94d;    /* amber — accents, XP */
  --sky: #4dc3ff;

  --ok: #2ee6a8;
  --bad: #ff5c8a;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(10, 6, 24, 0.45);
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-display);
  background: radial-gradient(1200px 800px at 80% -10%, #33245c 0%, var(--bg) 55%) fixed, var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* --- ambient orbs --- */
.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.35; }
.orb-1 { width: 45vw; height: 45vw; background: var(--net); top: -15vw; left: -10vw; animation: drift 26s ease-in-out infinite alternate; }
.orb-2 { width: 35vw; height: 35vw; background: var(--host); bottom: -12vw; right: -8vw; animation: drift 32s ease-in-out infinite alternate-reverse; opacity: 0.18; }
.orb-3 { width: 25vw; height: 25vw; background: var(--bcast); top: 40%; left: 60%; animation: drift 38s ease-in-out infinite alternate; opacity: 0.14; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(6vw, 4vh) scale(1.15); }
}

/* --- header --- */
.site-header {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 40px);
  max-width: 1080px; margin: 0 auto;
}
.logo { display: flex; align-items: center; gap: 10px; }
.logo-mark { font-size: 30px; filter: drop-shadow(0 3px 8px rgba(124, 92, 255, 0.6)); }
.logo-text { font-weight: 900; font-size: 24px; letter-spacing: -0.02em; }
.logo-text em { font-style: normal; color: var(--host); }

.header-controls { display: flex; align-items: center; gap: 12px; }
.player-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 14px;
}
.chip-level { color: var(--amber); }
.chip-streak { color: var(--ink-dim); }

.icon-btn {
  background: var(--card); border: 1px solid rgba(255,255,255,0.08);
  color: var(--ink); border-radius: 12px; width: 42px; height: 42px;
  font-size: 18px; cursor: pointer; transition: transform 0.15s ease, background 0.2s;
}
.icon-btn:hover { transform: translateY(-2px); background: var(--card-hi); }
.icon-btn .sound-off { display: none; }
.icon-btn[aria-pressed="false"] .sound-on { display: none; }
.icon-btn[aria-pressed="false"] .sound-off { display: inline; }

/* --- tabs --- */
.mode-tabs {
  position: relative; z-index: 2;
  display: flex; gap: 8px; justify-content: center;
  padding: 0 16px; margin: 4px auto 22px; max-width: 1080px;
}
.tab {
  font-family: var(--font-display); font-weight: 800; font-size: 16px;
  color: var(--ink-dim); background: transparent;
  border: 2px solid transparent; border-radius: 999px;
  padding: 10px 22px; cursor: pointer;
  transition: all 0.2s ease;
}
.tab:hover { color: var(--ink); background: rgba(255,255,255,0.05); }
.tab.active {
  color: var(--bg); background: linear-gradient(135deg, var(--host), var(--sky));
  box-shadow: 0 6px 20px rgba(46, 230, 168, 0.35);
}

/* --- layout --- */
main { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 60px; }
.mode-panel { display: none; flex-direction: column; gap: 18px; }
.mode-panel.active { display: flex; animation: panelIn 0.35s ease; }
@keyframes panelIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.card {
  background: linear-gradient(160deg, var(--card-hi), var(--card));
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 28px);
}

/* --- input card --- */
.field-row { display: flex; gap: 16px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-dim); }
.ip-field { flex: 1 1 240px; }

#ipInput {
  font-family: var(--font-mono); font-size: 22px; font-weight: 700;
  background: rgba(0,0,0,0.3); color: var(--host-soft);
  border: 2px solid rgba(255,255,255,0.1); border-radius: var(--radius-sm);
  padding: 12px 16px; width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#ipInput:focus { outline: none; border-color: var(--host); box-shadow: 0 0 0 4px rgba(46,230,168,0.15); }
#ipInput.invalid { border-color: var(--bad); animation: shake 0.35s ease; }
@keyframes shake {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}
.field-error { margin: 0; color: var(--bcast); font-weight: 600; font-size: 14px; }

.prefix-field { flex: 0 0 auto; }
.prefix-wrap {
  display: flex; align-items: center;
  background: rgba(0,0,0,0.3); border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm); padding: 0 12px;
}
.prefix-wrap:focus-within { border-color: var(--net); box-shadow: 0 0 0 4px rgba(124,92,255,0.15); }
.prefix-wrap .slash { font-family: var(--font-mono); font-size: 22px; font-weight: 800; color: var(--net-soft); }
#prefixInput, #splitBase {
  font-family: var(--font-mono); font-size: 22px; font-weight: 800;
  background: transparent; border: none; color: var(--net-soft);
  width: 72px; padding: 12px 4px; text-align: center;
  -moz-appearance: textfield; appearance: textfield;
}
#prefixInput::-webkit-inner-spin-button, #splitBase::-webkit-inner-spin-button { -webkit-appearance: none; }
#prefixInput:focus, #splitBase:focus { outline: none; }

/* --- slider --- */
.slider-row { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.slider-end { font-family: var(--font-mono); font-weight: 700; color: var(--ink-faint); font-size: 13px; }
#prefixSlider {
  flex: 1; -webkit-appearance: none; appearance: none; height: 12px;
  border-radius: 999px; cursor: pointer;
  background: linear-gradient(90deg, var(--host) 0%, var(--host) var(--fill, 81.25%), rgba(255,255,255,0.12) var(--fill, 81.25%));
}
#prefixSlider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--host) 70%);
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(46,230,168,0.5);
  transition: transform 0.15s;
}
#prefixSlider::-webkit-slider-thumb:hover { transform: scale(1.15); }
#prefixSlider::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--host) 70%);
  border: 3px solid #fff; box-shadow: 0 4px 14px rgba(46,230,168,0.5);
}

/* --- prefix chips --- */
.prefix-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pchip {
  font-family: var(--font-mono); font-weight: 700; font-size: 13px;
  background: rgba(255,255,255,0.06); color: var(--ink-dim);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 999px;
  padding: 6px 13px; cursor: pointer; transition: all 0.15s ease;
}
.pchip:hover { background: rgba(124,92,255,0.25); color: var(--ink); transform: translateY(-1px); }
.pchip.active { background: var(--net); color: #fff; border-color: var(--net); box-shadow: 0 4px 12px rgba(124,92,255,0.4); }

.playful-label {
  margin: 16px 0 0; font-size: 17px; font-weight: 600; color: var(--amber);
  min-height: 26px; text-align: center;
}

/* --- hero card --- */
.hero-top { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.hero-kicker { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-dim); }
.hero-number {
  font-family: var(--font-mono); font-weight: 800; font-size: clamp(44px, 8vw, 72px);
  line-height: 1; color: var(--host);
  text-shadow: 0 0 30px rgba(46,230,168,0.35);
  font-variant-numeric: tabular-nums;
}
.capacity-block { flex: 1 1 260px; }
.capacity-label { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; color: var(--ink-dim); margin-bottom: 6px; }
.capacity-pct { font-family: var(--font-mono); color: var(--host-soft); }
.capacity-meter {
  position: relative; height: 22px; border-radius: 999px; overflow: hidden;
  background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.08);
}
.capacity-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: linear-gradient(90deg, var(--net), var(--sky) 50%, var(--host));
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.capacity-shine {
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.25) 50%, transparent 60%);
  background-size: 250% 100%; animation: shine 3.2s linear infinite;
}
@keyframes shine { from { background-position: 200% 0; } to { background-position: -50% 0; } }
.capacity-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-faint); margin-top: 5px; font-weight: 600; }

/* --- range viz --- */
.range-viz {
  position: relative; display: flex; height: 64px;
  border-radius: var(--radius-sm); overflow: hidden;
  background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.08);
}
.range-seg {
  position: relative; display: flex; align-items: center; justify-content: center;
  transition: flex-grow 0.6s cubic-bezier(0.22, 1, 0.36, 1), min-width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}
.seg-network { background: linear-gradient(180deg, var(--net-soft), var(--net)); flex-grow: 0; min-width: 0; }
.seg-usable { background: linear-gradient(180deg, var(--host-soft), var(--host)); flex-grow: 1; }
.seg-broadcast { background: linear-gradient(180deg, #ff8fb0, var(--bcast)); flex-grow: 0; min-width: 0; }
.seg-tag {
  font-family: var(--font-mono); font-weight: 800; font-size: 11px; letter-spacing: 0.08em;
  color: rgba(20, 12, 40, 0.85); white-space: nowrap; padding: 0 4px;
}
.range-marker {
  position: absolute; top: -4px; bottom: -4px; width: 0;
  transition: left 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 2;
}
.marker-dot {
  position: absolute; left: -7px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 52px; border-radius: 8px;
  background: #fff; border: 3px solid var(--amber);
  box-shadow: 0 0 16px rgba(255,201,77,0.8);
}
.range-marker::after {
  content: 'YOU'; position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 10px; font-weight: 800; color: var(--amber);
  opacity: 0; transition: opacity 0.3s;
}
.range-viz:hover .range-marker::after { opacity: 1; }
.range-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 13px; color: var(--ink-dim); font-weight: 600; }
.range-legend span, .bits-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.dot-net { background: var(--net); }
.dot-host { background: var(--host); }
.dot-bcast { background: var(--bcast); }
.dot-you { background: #fff; border: 2px solid var(--amber); }

/* --- bit board --- */
.bits-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.bits-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.bits-hint { font-size: 14px; font-weight: 600; color: var(--ink-faint); }
.bits-legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-dim); font-weight: 600; }

.bit-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px;
  max-width: 640px; margin: 0 auto;
}
.bit {
  position: relative; aspect-ratio: 1; border: none; cursor: pointer;
  border-radius: 8px; font-family: var(--font-mono); font-weight: 800;
  font-size: clamp(14px, 3.4vw, 20px);
  color: #fff; transition: transform 0.12s ease, background 0.25s ease, box-shadow 0.25s;
  transform-style: preserve-3d;
}
.bit.net { background: linear-gradient(160deg, #4a3a86, #372a66); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.3); }
.bit.host { background: linear-gradient(160deg, #1f5e49, #17453a); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.3); }
.bit.net.on { background: linear-gradient(160deg, var(--net-soft), var(--net)); box-shadow: 0 0 14px rgba(124,92,255,0.55); }
.bit.host.on { background: linear-gradient(160deg, var(--host-soft), var(--host)); box-shadow: 0 0 14px rgba(46,230,168,0.55); color: #122; }
.bit:hover { transform: translateY(-3px) scale(1.06); }
.bit:active { transform: scale(0.94); }
.bit.flip { animation: bitFlip 0.28s ease; }
@keyframes bitFlip {
  0% { transform: rotateX(0); }
  50% { transform: rotateX(90deg) scale(1.1); }
  100% { transform: rotateX(0); }
}
.bit.boundary-left { border-top-left-radius: 14px; border-bottom-left-radius: 14px; }
.bit.octet-gap { margin-left: 6px; }
.bit .bit-val {
  position: absolute; bottom: 1px; right: 3px;
  font-size: 8px; font-weight: 500; opacity: 0;
  transition: opacity 0.2s ease;
}
.bit-grid:hover .bit-val, .bit:focus-visible .bit-val { opacity: 0.7; }

.octet-readout {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; font-family: var(--font-mono); font-weight: 700;
}
.octet-readout .oct {
  background: rgba(0,0,0,0.3); border-radius: 8px; padding: 4px 10px;
  color: var(--host-soft); font-size: 17px;
}
.octet-readout .oct .oct-bin { display: block; font-size: 10px; color: var(--ink-faint); letter-spacing: 0.06em; }

.mask-readout { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.mask-line { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.mask-key { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-dim); width: 110px; }
.mask-line code { font-family: var(--font-mono); font-weight: 700; font-size: 16px; color: var(--ink); }
.mask-line code.mask-bin { font-size: 12px; color: var(--ink-faint); word-break: break-all; }

/* --- results grid --- */
.results-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.result-card {
  background: linear-gradient(160deg, var(--card-hi), var(--card));
  border: 1px solid rgba(255,255,255,0.07); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
  border-top: 4px solid var(--sky);
  transition: transform 0.15s ease;
}
.result-card:hover { transform: translateY(-3px); }
.rc-network { border-top-color: var(--net); }
.rc-broadcast { border-top-color: var(--bcast); }
.rc-first, .rc-last { border-top-color: var(--host); }
.rc-total { border-top-color: var(--amber); }
.rc-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-dim); display: flex; align-items: center; gap: 8px; }
.rc-badge {
  font-size: 10px; background: rgba(255,92,138,0.18); color: var(--bcast);
  border-radius: 999px; padding: 2px 8px; letter-spacing: 0.05em;
}
.rc-value { font-family: var(--font-mono); font-weight: 800; font-size: 21px; margin-top: 6px; font-variant-numeric: tabular-nums; }
.rc-value.tick { animation: tick 0.3s ease; }
@keyframes tick { 0% { transform: translateY(-6px); opacity: 0.2; } 100% { transform: none; opacity: 1; } }

.special-note {
  border-left: 5px solid var(--amber);
  font-weight: 600; font-size: 16px; color: var(--amber);
}

/* --- buttons --- */
.btn {
  font-family: var(--font-display); font-weight: 800; font-size: 16px;
  border: none; border-radius: var(--radius-sm); padding: 13px 26px;
  cursor: pointer; transition: transform 0.15s ease, box-shadow 0.2s;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { cursor: not-allowed; }

:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; border-radius: 6px; }
#ipInput:focus-visible, #prefixInput:focus-visible, #splitBase:focus-visible,
#quizAnswer:focus-visible, #prefixSlider:focus-visible { outline: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--host), var(--sky)); color: var(--bg);
  box-shadow: 0 6px 18px rgba(46,230,168,0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(46,230,168,0.45); }
.btn-ghost {
  background: rgba(255,255,255,0.07); color: var(--ink);
  border: 1px solid rgba(255,255,255,0.12);
}
.btn-ghost:hover { background: rgba(255,255,255,0.12); }

/* --- quiz --- */
.quiz-card { display: flex; flex-direction: column; gap: 22px; }
.quiz-hud { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.hud-item { display: flex; flex-direction: column; gap: 2px; }
.hud-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); }
.hud-value { font-family: var(--font-mono); font-weight: 800; font-size: 20px; }
.hud-xp { flex: 1 1 160px; }
.xp-bar { height: 12px; border-radius: 999px; background: rgba(0,0,0,0.35); overflow: hidden; border: 1px solid rgba(255,255,255,0.08); }
.xp-fill { height: 100%; width: 0%; border-radius: 999px; background: linear-gradient(90deg, var(--amber), #ff9d4d); transition: width 0.5s cubic-bezier(0.22,1,0.36,1); }

.quiz-stage { text-align: center; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.quiz-category {
  display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--sky); background: rgba(77,195,255,0.12); border-radius: 999px; padding: 4px 14px;
}
.quiz-question { font-size: clamp(20px, 4.4vw, 30px); font-weight: 800; margin: 10px 0 4px; }
.quiz-question code { font-family: var(--font-mono); color: var(--host-soft); }
.quiz-context { color: var(--ink-dim); font-weight: 600; }
.quiz-answer-row { display: flex; gap: 10px; width: 100%; max-width: 460px; }
#quizAnswer {
  flex: 1; font-family: var(--font-mono); font-size: 18px; font-weight: 700;
  background: rgba(0,0,0,0.3); color: var(--host-soft);
  border: 2px solid rgba(255,255,255,0.12); border-radius: var(--radius-sm);
  padding: 12px 16px;
}
#quizAnswer:focus { outline: none; border-color: var(--host); box-shadow: 0 0 0 4px rgba(46,230,168,0.15); }
.quiz-answer-row.hidden, #quizStart.hidden { display: none; }

.quiz-feedback { min-height: 30px; font-weight: 700; font-size: 17px; }
.quiz-feedback.good { color: var(--ok); animation: popIn 0.3s ease; }
.quiz-feedback.bad { color: var(--bad); animation: shake 0.35s ease; }
@keyframes popIn { 0% { transform: scale(0.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.badges-shelf h3 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-faint); }
.badges { display: flex; flex-wrap: wrap; gap: 10px; }
.badge {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 14px;
  color: var(--ink-faint); filter: grayscale(1); opacity: 0.55;
  transition: all 0.3s ease;
}
.badge.earned { filter: none; opacity: 1; color: var(--ink); border-color: var(--amber); box-shadow: 0 0 14px rgba(255,201,77,0.25); animation: popIn 0.4s ease; }
.badge .badge-icon { font-size: 17px; }

/* --- split mode --- */
.split-controls { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; }
.split-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.split-story { margin: 0 0 14px; font-weight: 600; color: var(--ink-dim); min-height: 24px; }
.split-story strong { color: var(--amber); }

.cake { display: flex; flex-direction: column; gap: 6px; }
.cake-row { display: flex; gap: 6px; }
.slice {
  flex: 1; min-width: 0; height: 54px; border-radius: 10px; border: none; cursor: pointer;
  font-family: var(--font-mono); font-weight: 800; font-size: 13px; color: #122;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.2s, opacity 0.3s;
  animation: sliceIn 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
  overflow: hidden; white-space: nowrap;
}
@keyframes sliceIn { from { transform: scaleY(0.2); opacity: 0; } to { transform: none; opacity: 1; } }
.slice:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(0,0,0,0.35); z-index: 1; }
.slice.selected { outline: 3px solid #fff; outline-offset: 2px; }
.slice .slice-label { overflow: hidden; text-overflow: ellipsis; }

.split-detail {
  margin-top: 16px; background: rgba(0,0,0,0.25); border-radius: var(--radius-sm);
  padding: 14px 18px; font-family: var(--font-mono); font-size: 14px; line-height: 1.9;
}
.split-detail-empty { color: var(--ink-faint); font-family: var(--font-display); font-weight: 600; margin: 0; }
.split-detail .sd-head { font-size: 17px; font-weight: 800; color: var(--host-soft); }
.split-detail .sd-res { color: var(--bcast); }

/* --- toasts & confetti --- */
.toast-layer { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  background: linear-gradient(135deg, var(--amber), #ff9d4d); color: #3a2500;
  font-weight: 800; font-size: 16px; border-radius: 999px; padding: 12px 26px;
  box-shadow: 0 10px 30px rgba(255,157,77,0.4);
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), toastOut 0.4s ease 2.6s forwards;
}
@keyframes toastIn { from { transform: translateY(-24px) scale(0.8); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateY(-18px); opacity: 0; } }

.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti { position: absolute; top: -12px; border-radius: 3px; animation: confettiFall linear forwards; }
@keyframes confettiFall {
  to { transform: translateY(105vh) rotate(720deg); opacity: 0.9; }
}

/* --- footer --- */
.site-footer { position: relative; z-index: 1; text-align: center; color: var(--ink-faint); font-size: 13px; font-weight: 600; padding: 10px 20px 34px; }

/* --- level-up flash --- */
.level-flash { animation: levelFlash 0.7s ease; }
@keyframes levelFlash {
  0% { box-shadow: 0 0 0 0 rgba(255,201,77,0.7); }
  100% { box-shadow: 0 0 0 26px rgba(255,201,77,0); }
}

/* --- responsive --- */
@media (max-width: 640px) {
  .hero-top { gap: 18px; }
  .quiz-answer-row { flex-direction: column; }
  .field-row { flex-direction: column; }
  .prefix-wrap { align-self: flex-start; }
  .rc-value { font-size: 18px; }
  .mask-line code.mask-bin { font-size: 10px; }
  .range-viz { height: 52px; }
  .slice { font-size: 10px; height: 44px; }
  .tab { padding: 9px 16px; font-size: 14px; }
}

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