/* style.css */
:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-deep: #040a13;
  --panel: rgba(15, 30, 50, .92);
  --panel-soft: rgba(21, 42, 70, .64);
  --line: rgba(156, 196, 234, .16);
  --text: #eff7ff;
  --muted: #9db2c8;
  --blue: #54a7ff;
  --cyan: #72e4ea;
  --purple: #a891ff;
  --mint: #72efc2;
  --gold: #f7c663;
  --danger: #ff747e;
  --radius: 20px;
  --shadow: 0 20px 70px rgba(0, 0, 0, .28);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #edf5fc;
    --bg-deep: #dcebf8;
    --panel: rgba(255, 255, 255, .92);
    --panel-soft: rgba(234, 244, 252, .86);
    --line: rgba(43, 83, 125, .16);
    --text: #10233a;
    --muted: #587189;
    --shadow: 0 20px 70px rgba(34, 69, 106, .14);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edf5fc;
  --bg-deep: #dcebf8;
  --panel: rgba(255, 255, 255, .92);
  --panel-soft: rgba(234, 244, 252, .86);
  --line: rgba(43, 83, 125, .16);
  --text: #10233a;
  --muted: #587189;
  --shadow: 0 20px 70px rgba(34, 69, 106, .14);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg-deep); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 5%, rgba(66, 143, 255, .16), transparent 30rem),
    radial-gradient(circle at 90% 28%, rgba(151, 105, 255, .11), transparent 28rem),
    linear-gradient(145deg, var(--bg) 0%, var(--bg-deep) 100%);
  font-size: 16px;
  line-height: 1.5;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}
button:disabled { cursor: default; }
.app-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding-bottom: 42px; }

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.brand { display: flex; align-items: center; gap: 11px; letter-spacing: .07em; }
.brand strong { display: block; font-size: .95rem; line-height: 1.1; }
.brand small { display: block; color: var(--muted); font-size: .67rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.brand-mark {
  width: 39px; height: 39px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px;
  padding: 5px; border: 1px solid rgba(103, 198, 255, .42); border-radius: 12px;
  background: linear-gradient(145deg, rgba(80, 172, 255, .22), rgba(126, 91, 255, .18));
  box-shadow: inset 0 0 18px rgba(77, 198, 255, .13);
}
.brand-mark span { border-radius: 3px; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.brand-mark span:nth-child(2), .brand-mark span:nth-child(3) { opacity: .52; }
.top-actions { display: flex; gap: 8px; }
.icon-button {
  width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line);
  border-radius: 13px; background: var(--panel-soft); color: var(--text);
}
.icon-button:hover { border-color: rgba(114, 228, 234, .6); background: rgba(83, 153, 230, .17); }
.sound-bars { width: 18px; height: 16px; display: flex; align-items: center; gap: 3px; }
.sound-bars::before, .sound-bars::after, .sound-bars {
  background: linear-gradient(to top, var(--cyan) 0 35%, transparent 35% 45%, var(--cyan) 45% 80%, transparent 80%);
}
.sound-bars::before, .sound-bars::after { content: ""; width: 4px; height: 16px; display: block; background: var(--cyan); border-radius: 5px; }
.sound-bars::before { opacity: .55; height: 10px; }
.sound-bars::after { height: 14px; }
.muted .sound-bars, .muted .sound-bars::after { opacity: .24; }
.corner-icon { width: 17px; height: 17px; border: 2px solid var(--cyan); border-radius: 3px; box-shadow: inset 0 0 0 3px var(--panel-soft); }

.hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 1.2fr .8fr; gap: 26px;
  padding: clamp(27px, 5vw, 58px); border: 1px solid rgba(117, 180, 255, .22); border-radius: 28px;
  background: linear-gradient(125deg, rgba(17, 42, 72, .95), rgba(13, 29, 53, .89));
  box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; width: 280px; height: 280px; right: -100px; top: -150px; border: 1px solid rgba(114, 228, 234, .19);
  border-radius: 50%; box-shadow: 0 0 0 36px rgba(114, 228, 234, .04), 0 0 0 72px rgba(114, 228, 234, .025);
}
.hero-copy, .player-card { position: relative; z-index: 1; }
.eyebrow { margin: 0 0 7px; color: var(--cyan); font-size: .71rem; letter-spacing: .16em; font-weight: 800; text-transform: uppercase; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { max-width: 670px; margin-bottom: 12px; font-size: clamp(2.2rem, 6vw, 4.65rem); line-height: .98; letter-spacing: -.055em; }
h2 { margin-bottom: 10px; font-size: clamp(1.55rem, 3.2vw, 2.45rem); line-height: 1.08; letter-spacing: -.035em; }
h3 { font-size: 1.15rem; }
.hero-text { max-width: 620px; color: var(--muted); font-size: 1.04rem; }
.hero-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.pill { padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; color: #c6dded; background: rgba(255,255,255,.04); font-size: .75rem; font-weight: 700; }
.player-card { align-self: end; padding: 19px; border: 1px solid rgba(140, 201, 255, .23); border-radius: 19px; background: rgba(4, 13, 27, .43); backdrop-filter: blur(12px); }
.rank-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tiny-label, .player-card span, .arena-footer span, .collection-summary span { display: block; color: var(--muted); font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.rank-line strong { display: block; font-size: 1.1rem; }
.level-orb {
  width: 48px; height: 48px; display: grid; place-content: center; border: 1px solid var(--cyan); border-radius: 50%;
  text-align: center; background: rgba(84, 167, 255, .13); box-shadow: 0 0 24px rgba(84, 167, 255, .18);
}
.level-orb span { color: var(--text); font-size: 1.1rem; line-height: 1; }
.level-orb small { color: var(--cyan); font-size: .48rem; font-weight: 900; letter-spacing: .08em; }
.xp-label { display: flex; justify-content: space-between; margin-top: 17px; }
.xp-label span { font-size: .68rem; letter-spacing: .04em; text-transform: none; }
.xp-track, .timer-track { height: 8px; overflow: hidden; margin-top: 6px; border-radius: 999px; background: rgba(173, 211, 245, .12); }
.xp-fill, .timer-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width .35s ease; }
.player-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; margin-top: 17px; border-top: 1px solid var(--line); padding-top: 14px; }
.player-stats > div, .crate-stat { min-width: 0; padding: 0 8px; border-right: 1px solid var(--line); text-align: center; }
.player-stats > :last-child { border-right: 0; }
.player-stats strong, .crate-stat b { display: block; color: var(--text); font-size: 1.08rem; }
.crate-stat { border-top: 0; border-bottom: 0; border-left: 0; background: transparent; color: var(--text); }
.crate-stat:hover b { color: var(--gold); }

.tabs {
  display: flex; gap: 5px; overflow-x: auto; margin: 25px 0; padding: 5px; border: 1px solid var(--line);
  border-radius: 15px; background: rgba(9, 23, 40, .54); scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  min-width: max-content; min-height: 44px; flex: 1; padding: 0 16px; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); font-size: .88rem; font-weight: 800;
}
.tab:hover { color: var(--text); background: rgba(255,255,255,.05); }
.tab.active { color: #fff; background: linear-gradient(120deg, rgba(63, 138, 230, .85), rgba(104, 87, 196, .82)); box-shadow: 0 7px 18px rgba(46, 96, 174, .27); }

.view { display: none; animation: enter .3s ease both; }
.view.active { display: block; }
@keyframes enter { from { opacity: .2; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.section-heading { display: grid; grid-template-columns: 1.1fr .9fr; align-items: end; gap: 24px; margin: 8px 0 22px; }
.section-heading > p { max-width: 470px; margin: 0 0 8px; color: var(--muted); }
.section-heading.compact { margin-bottom: 19px; }
.lesson-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.lesson-card, .steps-card, .cheatsheet, .calculator-form, .calc-results, .quiz-board, .collection-summary, .badge-section, .achievement-section {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 12px 35px rgba(0,0,0,.08);
}
.lesson-card { min-height: 250px; position: relative; overflow: hidden; padding: 21px; }
.lesson-card::after { content: ""; position: absolute; right: -30px; bottom: -42px; width: 145px; height: 145px; border: 1px solid currentColor; opacity: .2; border-radius: 50%; }
.accent-blue { color: var(--blue); }
.accent-purple { color: var(--purple); }
.accent-mint { color: var(--mint); }
.lesson-card h3 { color: var(--text); margin: 20px 0 11px; }
.lesson-card p { position: relative; z-index: 1; color: var(--muted); font-size: .91rem; }
.lesson-card p b { color: var(--text); }
.lesson-number { display: inline-grid; width: 30px; height: 30px; place-items: center; border: 1px solid currentColor; border-radius: 8px; font-size: .72rem; font-weight: 900; }
.address-display { position: relative; z-index: 1; display: flex; align-items: center; gap: 3px; color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: clamp(.98rem, 2.5vw, 1.22rem); }
.address-display b { padding: 4px 5px; border-radius: 5px; background: rgba(83, 164, 255, .16); }
.address-display i { color: var(--muted); font-style: normal; }
.slash-display { position: relative; z-index: 1; color: var(--purple); font-family: ui-monospace, monospace; font-size: 2.2rem; font-weight: 300; }
.slash-display b { color: var(--text); }
.mini-map { position: relative; z-index: 1; display: flex; width: 100%; overflow: hidden; border: 1px solid rgba(114, 239, 194, .26); border-radius: 8px; color: #dffdf2; font-family: ui-monospace, monospace; font-size: .76rem; }
.network-zone { flex: 3; padding: 9px 5px; background: rgba(51, 203, 153, .19); text-align: center; }
.host-zone { flex: 1; padding: 9px 5px; background: rgba(255,255,255,.07); text-align: center; }

.ruleboard { display: grid; grid-template-columns: 1.2fr .8fr; gap: 25px; margin: 14px 0; padding: clamp(22px, 4vw, 42px); border: 1px solid rgba(114, 228, 234, .28); border-radius: var(--radius); background: linear-gradient(100deg, rgba(20, 68, 93, .64), rgba(34, 25, 74, .62)); }
.ruleboard-main h2 { margin-bottom: 7px; font-size: clamp(1.65rem, 4vw, 3.25rem); }
.ruleboard-main p:last-child, .rule-example p { color: var(--muted); margin: 0; }
.ruleboard-main b, .rule-example b { color: var(--cyan); }
.rule-example { align-self: center; padding: 21px; border: 1px solid rgba(218, 207, 255, .22); border-radius: 15px; background: rgba(6, 13, 32, .36); }
.rule-example span { color: var(--purple); font-size: .77rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.rule-example strong { display: block; margin: 5px 0; font-size: 1.25rem; }
.steps-card { display: grid; grid-template-columns: .7fr 1.3fr; gap: 25px; padding: 25px; }
.steps-intro p { color: var(--muted); }
.steps-list { display: grid; gap: 12px; padding: 0; margin: 0; list-style: none; }
.steps-list li { display: flex; gap: 13px; }
.steps-list li > span { flex: 0 0 29px; width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; color: var(--bg-deep); background: var(--cyan); font-size: .75rem; font-weight: 900; }
.steps-list b, .steps-list small { display: block; }
.steps-list small { margin-top: 2px; color: var(--muted); }
.cheatsheet { display: grid; grid-template-columns: .75fr 1.25fr; gap: 20px; align-items: center; margin-top: 14px; padding: 24px; }
.mask-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { color: var(--muted); font-size: .66rem; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
th, td { padding: 8px 8px; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
td:first-child { color: var(--cyan); font-family: ui-monospace, monospace; font-weight: 800; }
.cta-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 14px; padding: 24px; border: 1px solid rgba(84, 167, 255, .31); border-radius: var(--radius); background: rgba(43, 83, 130, .27); }
.cta-card h2 { margin-bottom: 0; font-size: 1.35rem; }

.primary-button, .next-button {
  min-height: 47px; border: 0; border-radius: 12px; padding: 0 17px; color: #061525;
  background: linear-gradient(110deg, var(--cyan), #6bafff); box-shadow: 0 10px 26px rgba(74, 181, 255, .22);
  font-weight: 900;
}
.primary-button:hover, .next-button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.primary-button span, .next-button span { margin-left: 8px; font-size: 1.2em; }
.full-width { width: 100%; }

.calculator-layout { display: grid; grid-template-columns: minmax(260px, .75fr) minmax(0, 1.25fr); gap: 14px; }
.calculator-form { padding: 22px; }
.calculator-form label { display: block; margin: 0 0 7px; color: var(--muted); font-size: .77rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.calculator-form input[type="text"], .calculator-form input:not([type]) { width: 100%; }
#ipInput { width: 100%; min-height: 48px; margin-bottom: 18px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; outline: none; color: var(--text); background: rgba(0,0,0,.14); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.prefix-row { display: grid; grid-template-columns: 1fr 57px; gap: 11px; align-items: center; margin-bottom: 21px; }
#prefixInput { width: 100%; accent-color: var(--cyan); }
#prefixOutput { padding: 9px 5px; border-radius: 9px; color: var(--cyan); background: rgba(114,228,234,.1); font-family: ui-monospace, monospace; text-align: center; font-weight: 800; }
.form-error { min-height: 22px; margin: 10px 0 0; color: var(--danger); font-size: .81rem; }
.calc-results { overflow: hidden; }
.result-highlight { padding: 25px; color: var(--text); background: linear-gradient(120deg, rgba(41, 112, 174, .55), rgba(89, 61, 172, .34)); }
.result-highlight span, .result-grid span { display: block; color: #b9d5ee; font-size: .68rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.result-highlight strong { display: block; margin: 5px 0; font-family: ui-monospace, monospace; font-size: clamp(1.35rem, 3.4vw, 2.1rem); letter-spacing: -.06em; }
.result-highlight small { color: var(--cyan); }
.result-grid { display: grid; grid-template-columns: repeat(2, 1fr); }
.result-grid > div { min-height: 92px; padding: 17px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.result-grid > div:nth-child(2n) { border-right: 0; }
.result-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
.result-grid b { display: block; margin-top: 5px; font-size: .95rem; overflow-wrap: anywhere; }
.calc-explainer { padding: 17px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .89rem; }
.calc-explainer b { color: var(--text); }

.arena-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.arena-header h2 { margin-bottom: 6px; }
.arena-header p:not(.eyebrow) { max-width: 620px; margin-bottom: 0; color: var(--muted); }
.session-score { min-width: 105px; padding: 11px 15px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); text-align: center; }
.session-score span { display: block; color: var(--muted); font-size: .63rem; font-weight: 800; letter-spacing: .09em; }
.session-score strong { display: block; color: var(--gold); font-size: 1.55rem; line-height: 1.1; }
.difficulty-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.difficulty { min-height: 57px; padding: 8px; border: 1px solid var(--line); border-radius: 13px; color: var(--muted); background: var(--panel-soft); text-align: left; }
.difficulty b, .difficulty small { display: block; }
.difficulty b { color: var(--text); font-size: .89rem; }
.difficulty small { font-size: .71rem; }
.difficulty.active { border-color: var(--cyan); background: rgba(55, 153, 197, .18); box-shadow: inset 0 0 0 1px rgba(114,228,234,.15); }
.quiz-board { overflow: hidden; }
.quiz-topline { display: grid; grid-template-columns: 1fr minmax(140px, 200px) 80px; gap: 18px; align-items: center; padding: 17px 20px; border-bottom: 1px solid var(--line); background: rgba(4, 13, 28, .28); }
.question-type { color: var(--cyan); font-size: .73rem; font-weight: 900; letter-spacing: .12em; }
.timer-wrap { text-align: right; }
.timer-wrap > span { color: var(--muted); font-family: ui-monospace, monospace; font-size: .76rem; font-weight: 800; }
.timer-track { margin-top: 4px; }
.timer-fill.urgent { background: linear-gradient(90deg, var(--gold), var(--danger)); }
.streak-display { padding-left: 13px; border-left: 1px solid var(--line); text-align: center; }
.streak-display span { display: block; color: var(--muted); font-size: .61rem; font-weight: 900; letter-spacing: .1em; }
.streak-display b { color: var(--gold); font-size: 1.2rem; }
.question-panel { padding: clamp(23px, 5vw, 47px); text-align: center; }
.question-panel > p { margin-bottom: 10px; color: var(--muted); font-size: 1.02rem; }
.question-ip { display: inline-block; margin-bottom: 28px; padding: 10px 16px; border: 1px solid rgba(94, 174, 255, .25); border-radius: 11px; color: var(--text); background: rgba(46, 104, 165, .13); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: clamp(1.4rem, 5vw, 2.55rem); font-weight: 800; letter-spacing: -.07em; }
.question-ip span { margin-left: 4px; color: var(--cyan); }
.answer-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; max-width: 730px; margin: 0 auto; }
.answer-button { min-height: 62px; display: flex; align-items: center; gap: 11px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 13px; color: var(--text); background: rgba(13, 35, 59, .62); text-align: left; }
.answer-button:hover:not(:disabled) { border-color: var(--blue); background: rgba(53, 115, 184, .26); transform: translateY(-1px); }
.answer-button > span { width: 26px; height: 26px; display: grid; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 7px; color: var(--cyan); font-size: .71rem; font-weight: 900; }
.answer-button b { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: clamp(.82rem, 2.3vw, 1rem); overflow-wrap: anywhere; }
.answer-button.correct { border-color: var(--mint); background: rgba(54, 190, 142, .2); }
.answer-button.correct > span { color: #08261d; border-color: var(--mint); background: var(--mint); }
.answer-button.wrong { border-color: var(--danger); background: rgba(255, 91, 108, .12); }
.answer-button.wrong > span { color: var(--danger); border-color: var(--danger); }
.feedback { max-width: 730px; min-height: 0; margin: 15px auto 0; text-align: left; }
.feedback strong, .feedback span { display: block; }
.feedback strong { margin-bottom: 3px; }
.feedback span { color: var(--muted); font-size: .88rem; }
.correct-feedback strong { color: var(--mint); }
.wrong-feedback strong { color: var(--danger); }
.next-button { margin-top: 18px; }
.arena-footer { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.arena-footer div { padding: 15px; border-right: 1px solid var(--line); text-align: center; }
.arena-footer div:last-child { border-right: 0; }
.arena-footer b { display: block; margin-top: 3px; font-size: 1.05rem; }
.arena-tips { display: flex; gap: 13px; align-items: center; margin-top: 14px; padding: 14px 16px; border: 1px solid rgba(114, 228, 234, .16); border-radius: 13px; background: rgba(25, 65, 79, .25); }
.tip-index { flex: 0 0 auto; padding: 4px 7px; border: 1px solid rgba(114,228,234,.4); border-radius: 6px; color: var(--cyan); font-size: .65rem; font-weight: 900; letter-spacing: .1em; }
.arena-tips p { margin: 0; color: var(--muted); font-size: .87rem; }

.collection-summary { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 14px; }
.collection-summary > div { padding: 18px; border-right: 1px solid var(--line); text-align: center; }
.collection-summary > div:last-child { border-right: 0; }
.collection-summary b { display: block; margin-top: 5px; color: var(--cyan); font-size: 1.36rem; }
.badge-section, .achievement-section { padding: 21px; margin-top: 14px; }
.subheading { display: flex; justify-content: space-between; gap: 15px; align-items: baseline; margin-bottom: 15px; }
.subheading h3 { margin: 0; }
.subheading span { color: var(--muted); font-size: .8rem; }
.inventory-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.inventory-item { display: flex; align-items: center; gap: 13px; min-height: 93px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel-soft); }
.item-shape { width: 47px; height: 47px; flex: 0 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 7px; border: 1px solid currentColor; border-radius: 12px; color: var(--blue); transform: rotate(7deg); }
.item-shape span { border-radius: 3px; background: currentColor; box-shadow: 0 0 9px currentColor; }
.item-shape span:last-child { grid-column: span 2; }
.rarity-common { border-color: rgba(117, 188, 255, .31); }
.rarity-uncommon { border-color: rgba(114, 239, 194, .4); }
.rarity-uncommon .item-shape { color: var(--mint); }
.rarity-rare { border-color: rgba(169, 145, 255, .44); }
.rarity-rare .item-shape { color: var(--purple); }
.rarity-epic { border-color: rgba(247, 198, 99, .52); }
.rarity-epic .item-shape { color: var(--gold); }
.inventory-item small { color: var(--muted); font-size: .61rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.inventory-item h4 { margin: 1px 0 2px; }
.inventory-item p { margin: 0; color: var(--muted); font-size: .78rem; }
.empty-collection { grid-column: 1 / -1; min-height: 110px; display: grid; place-content: center; gap: 3px; padding: 20px; border: 1px dashed var(--line); border-radius: 13px; color: var(--muted); text-align: center; }
.empty-collection strong { color: var(--text); }
.achievement-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.achievement { display: flex; gap: 10px; align-items: center; min-height: 87px; padding: 11px; border: 1px solid var(--line); border-radius: 13px; opacity: .56; }
.achievement.unlocked { border-color: rgba(114,239,194,.34); opacity: 1; background: rgba(41, 123, 95, .15); }
.achievement-mark { width: 42px; height: 42px; display: grid; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: .55rem; font-weight: 900; letter-spacing: .05em; }
.unlocked .achievement-mark { border-color: var(--mint); color: #08261d; background: var(--mint); }
.achievement h4 { margin: 0 0 1px; font-size: .86rem; }
.achievement p { margin: 0; color: var(--muted); font-size: .73rem; }

.modal-backdrop { position: fixed; z-index: 5; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(1, 6, 15, .72); backdrop-filter: blur(9px); }
.modal-backdrop[hidden] { display: none; }
.crate-modal { position: relative; width: min(100%, 420px); padding: 30px; border: 1px solid rgba(247,198,99,.47); border-radius: 23px; background: linear-gradient(145deg, #172d4b, #101b35); box-shadow: 0 30px 100px rgba(0,0,0,.56); text-align: center; }
.close-modal { position: absolute; top: 11px; right: 12px; width: 44px; height: 44px; border: 0; border-radius: 50%; color: var(--muted); background: transparent; font-size: 1.7rem; }
.close-modal:hover { color: var(--text); background: rgba(255,255,255,.08); }
.crate-art { position: relative; width: 120px; height: 91px; margin: 0 auto 17px; filter: drop-shadow(0 13px 17px rgba(0,0,0,.3)); }
.crate-lid { position: absolute; z-index: 1; top: 10px; left: 8px; width: 104px; height: 29px; border: 3px solid #ffd475; border-radius: 9px 9px 4px 4px; background: linear-gradient(145deg, #f5b74b, #bd6d2f); }
.crate-body { position: absolute; top: 34px; left: 13px; width: 94px; height: 51px; border: 3px solid #ffd475; border-radius: 3px 3px 11px 11px; background: linear-gradient(145deg, #d88a33, #804027); }
.crate-body span { position: absolute; left: 39px; top: 0; width: 14px; height: 45px; border-right: 3px solid #ffd475; border-left: 3px solid #ffd475; background: rgba(255,236,166,.25); }
.crate-modal > p:not(.eyebrow) { color: var(--muted); }
.reward-rarity { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: .67rem; letter-spacing: .08em; text-transform: uppercase; }
.reward-rarity.common { color: var(--blue); background: rgba(84,167,255,.14); }
.reward-rarity.uncommon { color: var(--mint); background: rgba(114,239,194,.12); }
.reward-rarity.rare { color: var(--purple); background: rgba(168,145,255,.14); }
.reward-rarity.epic { color: var(--gold); background: rgba(247,198,99,.13); }
.toast { position: fixed; z-index: 8; left: 50%; bottom: 20px; width: min(calc(100% - 32px), 430px); padding: 13px 16px; border: 1px solid rgba(114,228,234,.35); border-radius: 12px; color: var(--text); background: rgba(10, 28, 48, .96); box-shadow: var(--shadow); opacity: 0; pointer-events: none; text-align: center; transform: translate(-50%, 18px); transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 780px) {
  .hero, .section-heading, .calculator-layout, .steps-card, .cheatsheet, .ruleboard { grid-template-columns: 1fr; }
  .hero { padding: 27px; }
  .player-card { max-width: 520px; }
  .section-heading { gap: 0; }
  .lesson-grid { grid-template-columns: 1fr; }
  .lesson-card { min-height: 0; }
  .cheatsheet { gap: 8px; }
  .arena-header { align-items: start; }
  .achievement-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .app-shell { width: min(100% - 18px, 1180px); }
  .topbar { min-height: 64px; }
  .hero { border-radius: 21px; padding: 23px; }
  h1 { font-size: 2.25rem; }
  .tabs { margin: 16px 0; }
  .tab { flex: 0 0 auto; min-width: 94px; }
  .ruleboard, .steps-card, .cheatsheet, .calculator-form, .badge-section, .achievement-section { padding: 18px; }
  .cta-card { align-items: flex-start; flex-direction: column; padding: 19px; }
  .cta-card .primary-button { width: 100%; }
  .result-grid { grid-template-columns: 1fr; }
  .result-grid > div, .result-grid > div:nth-child(2n) { border-right: 0; border-bottom: 1px solid var(--line); }
  .result-grid > div:last-child { border-bottom: 0; }
  .arena-header { display: block; }
  .session-score { width: 120px; margin-top: 14px; }
  .difficulty-row { grid-template-columns: 1fr; }
  .difficulty { min-height: 52px; }
  .quiz-topline { grid-template-columns: 1fr 80px; gap: 10px; }
  .timer-wrap { grid-column: 1 / -1; grid-row: 2; text-align: left; }
  .streak-display { grid-column: 2; grid-row: 1; }
  .answer-grid, .inventory-grid { grid-template-columns: 1fr; }
  .question-panel { padding: 25px 16px; }
  .question-ip { margin-bottom: 20px; font-size: 1.25rem; }
  .arena-footer div { padding: 12px 5px; }
  .arena-footer span { font-size: .56rem; }
  .collection-summary { grid-template-columns: repeat(2, 1fr); }
  .collection-summary > div:nth-child(2) { border-right: 0; }
  .collection-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .achievement-grid { grid-template-columns: 1fr; }
}
