/* ===== Game layer (shared with IT Academy) ===== */
:root { --xp: #f7c948; --xp2: #ff9f43; --boss: #ff5c7a; --boss-bg: rgba(255,92,122,.10); --lock: #6b7280; }
[data-theme="light"] { --xp: #d99a00; --xp2: #e8590c; --boss: #d6334f; --boss-bg: rgba(214,51,79,.07); --lock: #9aa3b2; }
.kicker { font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--accent2); }
.chip { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--card2); border: 1px solid var(--border); margin: 2px 4px 2px 0; }
.lv-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 54px; height: 32px; padding: 0 10px; border-radius: 10px; font-weight: 800; color: #1b1300;
  background: linear-gradient(135deg, var(--xp), var(--xp2)); box-shadow: 0 2px 0 rgba(0,0,0,.25); white-space: nowrap; }
.lv-badge.big { min-width: 76px; height: 46px; font-size: 1.25rem; border-radius: 14px; }
.xpbar { height: 12px; border-radius: 999px; background: var(--card2); border: 1px solid var(--border); overflow: hidden; }
.xpbar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--xp), var(--xp2)); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.xp-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.small-btn { font-size: .82rem; padding: 5px 11px; }

/* top bar */
.track-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.track-chip:hover { text-decoration: none; background: var(--card2); }
.tc-switch { color: var(--muted); }
.xp-chip { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text); }
.xp-chip:hover { text-decoration: none; }
.xp-chip .lv { font-size: .76rem; font-weight: 800; color: #1b1300; background: linear-gradient(135deg, var(--xp), var(--xp2)); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.xp-track { width: 90px; height: 8px; border-radius: 999px; background: var(--card2); overflow: hidden; }
.xp-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--xp), var(--xp2)); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.xp-chip.pulse { animation: xp-pulse .6s ease; }
@keyframes xp-pulse { 40% { transform: scale(1.08); box-shadow: 0 0 0 4px color-mix(in srgb, var(--xp) 35%, transparent); } }
.xp-float { position: absolute; right: 4px; top: 100%; font-size: .8rem; font-weight: 800; color: var(--xp2); pointer-events: none; animation: xp-float 1.2s ease-out forwards; white-space: nowrap; }
@keyframes xp-float { from { opacity: 0; transform: translateY(-6px); } 20% { opacity: 1; } to { opacity: 0; transform: translateY(14px); } }
.streak-chip { font-size: .85rem; font-weight: 700; white-space: nowrap; }
.streak-chip.cold { opacity: .55; filter: grayscale(.6); }
.hq-btn { width: auto; padding: 0 10px; display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-size: .95rem; }
.hq-btn:hover { text-decoration: none; }
.hq-label { font-size: .8rem; font-weight: 700; }
body[data-route="hq"] .hq-btn { border-color: var(--accent); }
.side-switch { display: inline-block; margin-top: 6px; font-size: .82rem; font-weight: 600; }

/* popups / confetti / victory */
.game-pop { position: fixed; z-index: 75; left: 50%; top: 76px; transform: translate(-50%, -16px) scale(.96); opacity: 0; display: flex; gap: 12px; align-items: center; max-width: min(92vw, 420px);
  background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; box-shadow: var(--shadow); transition: opacity .25s, transform .3s cubic-bezier(.2,1.4,.4,1); }
.game-pop.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.game-pop.level-up { border-color: var(--xp); box-shadow: 0 0 0 3px color-mix(in srgb, var(--xp) 30%, transparent), var(--shadow); }
.game-pop.badge-pop { border-color: var(--accent); }
.gp-icon { font-size: 2rem; line-height: 1; }
.gp-kicker { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent2); }
.gp-title { font-weight: 800; font-size: 1.05rem; }
.gp-sub { font-size: .85rem; color: var(--muted); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: confetti-fall 2s ease-in forwards; }
@keyframes confetti-fall { to { top: 105vh; transform: translateX(40px) rotate(720deg); opacity: .7; } }
.victory-overlay { position: fixed; inset: 0; z-index: 65; display: grid; place-items: center; padding: 16px; background: rgba(5,8,15,.6); backdrop-filter: blur(3px); animation: fade-in .25s ease; }
.victory { max-width: 480px; width: 100%; text-align: center; padding: 26px 24px; border: 2px solid var(--xp); animation: pop-in .4s cubic-bezier(.2,1.4,.4,1); }
.victory h2 { margin: .2em 0 .4em; }
.v-kicker { font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--boss); font-size: .8rem; }
.v-icon { font-size: 3.4rem; line-height: 1.1; }
.v-xp { font-weight: 800; color: var(--xp2); }
.victory .hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { transform: scale(.85); opacity: 0; } }

/* choose path */
.choose-head { max-width: 720px; }
.path-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 18px; }
.path-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left; font: inherit; color: var(--text); cursor: pointer; padding: 20px; border: 2px solid var(--border); transition: transform .15s, border-color .15s; }
.path-card:hover, .path-card:focus-visible { transform: translateY(-3px); border-color: var(--accent); }
.path-card.is-current { border-color: var(--xp); }
.path-icon { font-size: 2.2rem; line-height: 1; }
.path-name { font-size: 1.2rem; font-weight: 800; }
.path-blurb { color: var(--muted); font-size: .92rem; flex: 1; }
.path-stats { color: var(--muted); }

/* quest map */
.map-head { margin-bottom: 18px; }
.map-title { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.map-title h1 { margin: 0; }
.map-icon { font-size: 2.6rem; }
.map-level { margin-left: auto; }
.map-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.world { margin: 0 0 16px; position: relative; }
.world-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.world-head h2 { margin: 0; font-size: 1.15rem; }
.world-no { font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.world-count { margin-left: auto; font-weight: 700; color: var(--muted); }
.world-done { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.world-locked { opacity: .72; }
.side-quest { border-style: dashed; }
.quest-path { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 18px 6px; }
.qnode { position: relative; width: 104px; }
.qnode::before { content: ""; position: absolute; top: 22px; left: -6px; width: 12px; height: 4px; border-radius: 2px; background: var(--border); }
.qnode:first-child::before { display: none; }
.qnode.done::before { background: var(--ok); }
.qnode a { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--text); text-align: center; }
.qnode a:hover { text-decoration: none; }
.qdot { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; font-weight: 800; background: var(--card2); border: 3px solid var(--border); transition: transform .15s; }
.qnode a:hover .qdot, .qnode a:focus-visible .qdot { transform: scale(1.1); }
.qlabel { font-size: .76rem; line-height: 1.3; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.qnode.done .qdot { background: var(--ok); border-color: var(--ok); color: #04130c; }
.qnode.open .qdot { border-color: var(--accent); color: var(--accent); }
.qnode.current .qdot { border-color: var(--xp); background: color-mix(in srgb, var(--xp) 22%, var(--card)); box-shadow: 0 0 0 5px color-mix(in srgb, var(--xp) 25%, transparent); animation: node-glow 1.8s ease-in-out infinite; }
.qnode.current .qlabel { color: var(--text); font-weight: 700; }
.qnode.locked .qdot { color: var(--lock); font-size: .9rem; border-style: dashed; }
.qnode.locked .qlabel { opacity: .7; }
.qnode.boss .qdot { width: 58px; height: 58px; margin-top: -6px; border-radius: 16px; border-color: var(--boss); background: var(--boss-bg); font-size: 1.25rem;
  box-shadow: 0 0 0 4px var(--boss-bg), inset 0 0 0 2px color-mix(in srgb, var(--boss) 35%, transparent); }
.qnode.boss.locked .qdot { border-style: dashed; }
.qnode.boss.done .qdot { background: var(--ok); border-color: var(--ok); }
.qnode.boss .qlabel { color: var(--boss); font-weight: 700; }
@keyframes node-glow { 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--xp) 12%, transparent); } }

/* lesson banners */
.lock-banner { border-left: 4px solid var(--lock); background: var(--card2); margin: 8px 0 14px; padding: 12px 16px; }
.boss-brief { border: 2px solid var(--boss); background: linear-gradient(135deg, var(--boss-bg), transparent 70%), var(--card); margin: 10px 0 18px; }
.boss-brief h2 { margin: .25em 0 .3em; }
.boss-brief.beaten { border-color: var(--ok); }
.boss-kicker { font-size: .74rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--boss); }
.boss-brief.beaten .boss-kicker { color: var(--ok); }
.boss-tag { display: inline-block; vertical-align: middle; font-size: .8rem; letter-spacing: .1em; font-weight: 900; color: #fff; background: var(--boss); padding: 3px 9px; border-radius: 6px; }
.quest-reward { margin: 4px 0 10px; color: var(--muted); }

/* HQ */
.hq-hero { margin-bottom: 8px; }
.hq-hero h1 { margin: .1em 0 .1em; }
.hq-player { display: flex; gap: 14px; align-items: center; margin: 14px 0; }
.grow { flex: 1; min-width: 0; }
.hq-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.hq-stats > div { background: var(--card2); border-radius: 10px; padding: 10px; text-align: center; }
.hq-stats strong { display: block; font-size: 1.25rem; }
.hq-stats span { font-size: .78rem; color: var(--muted); }
.hq-tracks { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.hq-track header { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.hq-track h3 { margin: 0; }
.hq-track header .badge { margin-left: auto; }
.hq-track.is-focus { border-color: var(--xp); }
.hq-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.hq-grid h2, .hq-search h2, #settings h2, .hq-grid + .card h2 { margin-top: 0; font-size: 1.15rem; }
main[data-route="hq"] > .card, main[data-route="hq"] > .hq-grid { margin-top: 14px; }
.streak-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; max-width: 280px; }
.streak-cal .day { aspect-ratio: 1; border-radius: 5px; background: var(--card2); border: 1px solid var(--border); }
.streak-cal .day.on { background: linear-gradient(135deg, var(--xp), var(--xp2)); border-color: transparent; }
.streak-cal .day.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.activity { list-style: none; margin: 0; padding: 0; }
.activity li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.activity li:last-child { border-bottom: 0; }
.activity li .small { white-space: nowrap; }
.badge-row { display: flex; flex-wrap: wrap; gap: 10px; }
.badge-mini { display: flex; flex-direction: column; align-items: center; font-size: 1.6rem; width: 78px; text-align: center; }
.badge-mini small { font-size: .7rem; color: var(--muted); line-height: 1.2; }
.hq-search-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hq-search-form input[type=search] { flex: 1; min-width: 180px; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .9rem; cursor: pointer; }
.settings { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.save-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.act-import-label { cursor: pointer; }

/* badges page */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.badge-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 16px 12px; }

.b-icon { font-size: 2.3rem; line-height: 1.1; }
.badge-card.got { border-color: color-mix(in srgb, var(--xp) 55%, var(--border)); }
.badge-card.locked { opacity: .6; }
.b-date { color: var(--ok); }

/* daily */
.daily.done { border-color: var(--ok); }
.daily h1 { margin-top: .2em; }
.daily-opts { display: grid; gap: 8px; margin: 12px 0; }
.daily-opt { justify-content: flex-start; text-align: left; white-space: normal; }
.daily-opt.right { border-color: var(--ok); background: var(--ok-bg); }
.daily-opt.wrong { border-color: var(--bad); background: var(--bad-bg); }

/* arcade */
.arcade { border: 2px solid var(--accent); }
.arcade-hud { display: flex; flex-wrap: wrap; gap: 8px 20px; font-family: var(--mono); font-size: .95rem; padding-bottom: 10px; border-bottom: 1px dashed var(--border); margin-bottom: 12px; }
.arcade-hud b { font-size: 1.2rem; color: var(--xp2); }
.arcade.hurry .hud-time b { color: var(--bad); animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .35; } }
.arcade-start, .arcade-over { text-align: center; padding: 18px 0; }
.arcade-final { font-size: 3.6rem; font-weight: 900; line-height: 1; color: var(--xp2); font-family: var(--mono); }
.arcade-flash { margin: 0 0 8px; font-weight: 700; }
.arcade-cta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

@media (max-width: 960px) { .hq-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .tc-name, .hq-label { display: none; } .xp-track { width: 56px; } }
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 0 10px; }
  .topbar-right { gap: 6px; }
  .brand-logo { display: none; }
  .tc-switch { display: none; }
  .xp-track { display: none; }
  .hq-btn { padding: 0 8px; }
  #soundBtn, #themeBtn { width: 34px; height: 34px; }
  .hq-stats { grid-template-columns: repeat(2, 1fr); }
  .qnode { width: 86px; }
  .map-icon { font-size: 2rem; }
}
@media (max-width: 400px) { .streak-chip { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .xpbar > span, .xp-fill, .qdot, .path-card, .game-pop { transition: none !important; }
  .qnode.current .qdot, .xp-chip.pulse, .xp-float, .victory, .victory-overlay, .arcade.hurry .hud-time b { animation: none !important; }
}
.map-head, .world, .boss-brief, .hq-hero, .hq-track, .hq-grid > .card, main[data-route="hq"] > .card, .daily, .arcade, .victory, .badge-card, .path-card { padding: 16px 20px; }
.badge-card { padding: 16px 12px; }
.quest-path .qnode:first-child::before, .qnode.wrap-start::before { display: none; }
.subnet-trainer .st-q, .subnet-trainer .st-fb, .arcade-flash { overflow-wrap: anywhere; }
