/* Охота на минималках — лесная палитра: тёмно-зелёный, мох, охотничий оранжевый; светлая и тёмная темы */
:root {
  --bg: #f4f1e8; --card: #fffdf7; --ink: #1d2a1f; --muted: #66705f; --line: #dcd6c4;
  --brand: #234a33; --brand2: #3f6b45; --accent: #e06a1b; --accent-ink: #fff;
  --ok: #2f8a4b; --ok-bg: #e3f3e6; --bad: #c0392b; --bad-bg: #fbe5e2; --warn-bg: #fff3d6;
  --shadow: 0 1px 2px rgba(30,40,20,.06), 0 4px 14px rgba(30,40,20,.06);
  --r: 14px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141a15; --card: #1d251e; --ink: #e8eadf; --muted: #9aa58f; --line: #2f3a30;
    --brand: #8cc79a; --brand2: #6ea978; --accent: #f08a3c; --ok: #6cc985; --ok-bg: #1f3526; --bad: #f07a6b; --bad-bg: #3a2220;
    --warn-bg: #3a3220; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand2); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* шапка */
.top { background: #234a33; color: #fff; position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 14px; min-height: 56px; flex-wrap: wrap; }
.logo { color: #fff; text-decoration: none; font-weight: 800; font-size: 19px; display: flex; align-items: center; gap: 8px; }
.logo svg { width: 28px; height: 28px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { color: #e6efe0; text-decoration: none; padding: 7px 11px; border-radius: 9px; white-space: nowrap; font-size: 15px; }
.nav a:hover, .nav a.on { background: rgba(255,255,255,.14); color: #fff; }
.who { display: flex; gap: 8px; align-items: center; }
.who a { color: #fff; text-decoration: none; font-size: 14px; }
.who .lv { background: var(--accent); color: #fff; border-radius: 999px; padding: 3px 10px; font-weight: 700; font-size: 13px; }
@media (max-width: 720px) {
  .top .wrap { gap: 6px; padding-top: 6px; }
  .nav { order: 3; flex-basis: 100%; padding-bottom: 6px; }
  .who { margin-left: auto; }
}

main { padding: 20px 0 40px; }
h1 { font-size: 26px; margin: 4px 0 14px; line-height: 1.2; }
h2 { font-size: 20px; margin: 26px 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
.msgs { margin: 0 0 14px; }
.msg { padding: 10px 14px; border-radius: 10px; margin-bottom: 8px; background: var(--ok-bg); }
.msg.error { background: var(--bad-bg); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; padding: 12px 20px; text-decoration: none; min-height: 46px; }
.btn:hover { filter: brightness(1.06); }
.btn.alt { background: transparent; color: var(--brand2); border: 2px solid var(--brand2); }
.btn.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 600; }
.btn.danger { background: var(--bad); }
.btn:disabled { opacity: .5; cursor: default; }

/* главная */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; align-items: stretch; }
.hero h1 { font-size: 30px; }
@media (max-width: 720px) { .hero { grid-template-columns: 1fr; } .hero h1 { font-size: 24px; } }
.lvl { display: flex; flex-direction: column; gap: 8px; }
.lvl .name { font-size: 22px; font-weight: 800; color: var(--brand); }
.bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand2), var(--accent)); border-radius: 99px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; padding: 16px; border-radius: var(--r);
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .12s; min-height: 118px; }
.tile:hover { transform: translateY(-2px); border-color: var(--brand2); }
.tile .ico { font-size: 28px; line-height: 1; }
.tile b { font-size: 18px; }
.tile.main { background: var(--brand); color: #fff; border-color: transparent; }
.tile.main .muted { color: #cfe3d2; }
.tile .tag { align-self: flex-start; margin-top: auto; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--warn-bg); color: var(--ink); }
.tile .tag.done { background: var(--ok-bg); }
@media (max-width: 520px) {
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tile { min-height: 0; padding: 13px; }
  .tile .ico { font-size: 24px; }
  .tile b { font-size: 16px; }
  .tile .muted.small { font-size: 13px; line-height: 1.35; }
  .tile.main { grid-column: 1 / -1; }
}
.topics { display: grid; gap: 8px; }
.topic { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 12px 14px; text-decoration: none; color: inherit; }
.topic .ico { font-size: 24px; }
.topic .t { font-weight: 600; }
.topic .bar { margin-top: 6px; height: 6px; }

/* игра */
.play { max-width: 760px; margin: 0 auto; }
.hud { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 12px; }
.hud .grow { flex: 1; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 5px 12px; font-weight: 700; font-size: 14px; white-space: nowrap; }
.chip.timer.low { background: var(--bad-bg); color: var(--bad); }
.qcard { padding: 20px; }
.qnum { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.qtext { font-size: 19px; font-weight: 600; line-height: 1.45; margin-bottom: 16px; }
.opts { display: grid; gap: 10px; }
.opt { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; text-align: left; width: 100%; cursor: pointer;
  background: var(--bg); border: 2px solid var(--line); border-radius: 12px; padding: 12px; font: inherit; color: inherit; min-height: 52px; }
.opt:hover:not(:disabled) { border-color: var(--brand2); }
.opt .l { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); font-weight: 800; }
.opt.pick { border-color: var(--brand2); background: var(--ok-bg); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt:disabled { cursor: default; }
.feedback { margin-top: 14px; padding: 12px 14px; border-radius: 12px; font-weight: 600; }
.feedback.ok { background: var(--ok-bg); color: var(--ok); }
.feedback.bad { background: var(--bad-bg); color: var(--bad); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.grid30 { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; margin: 14px 0; }
.grid30 button { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line); background: var(--card); font: inherit; font-size: 13px; cursor: pointer; color: inherit; padding: 0; }
.grid30 button.done { background: var(--ok-bg); border-color: var(--ok); }
.grid30 button.cur { outline: 2px solid var(--accent); }
@media (max-width: 520px) { .grid30 { grid-template-columns: repeat(6, 1fr); } .qtext { font-size: 17px; } }
.hearts { letter-spacing: 2px; }
.result { text-align: center; padding: 26px 16px; }
.result .big { font-size: 46px; font-weight: 900; line-height: 1.1; }
.result.pass .big { color: var(--ok); }
.result.fail .big { color: var(--bad); }
.review { display: grid; gap: 10px; margin-top: 16px; }
.review .card { padding: 14px; }
.review .ok { border-left: 5px solid var(--ok); }
.review .no { border-left: 5px solid var(--bad); }
.ans { margin-top: 6px; font-size: 15px; }
.ans .r { color: var(--ok); font-weight: 700; }
.ans .w { color: var(--bad); text-decoration: line-through; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--brand); color: #fff; padding: 12px 18px;
  border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.25); z-index: 30; max-width: calc(100% - 32px); animation: pop .3s ease; }
@keyframes pop { from { transform: translate(-50%, 20px); opacity: 0; } }

/* таблицы, формы, прочее */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a { padding: 7px 14px; border-radius: 99px; text-decoration: none; color: inherit; border: 1px solid var(--line); background: var(--card); font-size: 15px; }
.tabs a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
table.t { width: 100%; border-collapse: collapse; }
table.t td, table.t th { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.t th { font-size: 13px; color: var(--muted); font-weight: 600; }
table.t tr.me td { background: var(--warn-bg); }
.num { text-align: right !important; white-space: nowrap; }
form p { margin: 0 0 14px; }
label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=number], input[type=search] { width: 100%; font: inherit; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: inherit; }
.helptext { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.errorlist { color: var(--bad); margin: 4px 0; padding-left: 18px; font-size: 14px; }
.check label { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.hp { position: absolute; left: -9999px; }
.narrow { max-width: 460px; margin: 0 auto; }
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.ach { display: flex; gap: 10px; align-items: center; padding: 12px; }
.ach .i { font-size: 28px; }
.ach.off { opacity: .45; filter: grayscale(1); }
.qlist .card { margin-bottom: 10px; }
.qlist ol { margin: 8px 0 0; padding-left: 0; list-style: none; }
.qlist li { padding: 3px 0; }
.qlist li.r { color: var(--ok); font-weight: 700; }
.foot { border-top: 1px solid var(--line); padding: 18px 0 28px; color: var(--muted); font-size: 14px; }
.foot a { color: var(--muted); }
.stat { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.stat .card b { display: block; font-size: 24px; }
.warn { background: var(--warn-bg); border-radius: 12px; padding: 10px 14px; }

/* пасхалка: при ошибке из травы выскакивает пиксельная собака и хихикает (своя, в духе Денди) */
.dog { position: fixed; right: 4px; bottom: 0; width: 176px; height: 190px; z-index: 40; pointer-events: none; overflow: hidden; }
.dog .pup { position: absolute; left: 24px; bottom: 30px; width: 128px; height: 116px; image-rendering: pixelated; transform: translateY(150px);
  animation: dogup 1.9s steps(1, end) forwards; }
.dog .pup svg { width: 100%; height: 100%; animation: doghee .16s steps(1, end) 7 .35s; }
.dog .grass { position: absolute; left: 0; right: 0; bottom: 0; height: 40px; image-rendering: pixelated; }
.dog .say { position: absolute; left: 96px; top: 2px; font: 900 14px/1 monospace; color: #fff; background: #1a1a1a; padding: 5px 7px;
  border-radius: 3px; white-space: nowrap; opacity: 0; animation: dogsay 1.9s steps(1, end) forwards; }
@keyframes dogup { 0% { transform: translateY(150px); } 6% { transform: translateY(110px); } 12% { transform: translateY(60px); }
  18% { transform: translateY(20px); } 22% { transform: translateY(0); } 80% { transform: translateY(0); } 86% { transform: translateY(40px); }
  92% { transform: translateY(100px); } 100% { transform: translateY(150px); } }
@keyframes doghee { 0% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes dogsay { 0% { opacity: 0; } 24% { opacity: 1; } 80% { opacity: 0; } }
.dogtoggle { cursor: pointer; }

/* оригинальная собака Duck Hunt (35×47 пикселей NES, ×4) — только на сайте, по разрешению Nintendo */
.dog.nes { width: 160px; height: 200px; }
.dog.nes .pup { left: 10px; bottom: 0; width: 140px; height: 188px; transform: translateY(200px); image-rendering: pixelated; }
.dog.nes .pup { animation: nesup 2.4s steps(1, end) forwards, nesbob .25s steps(1, end) .5s 6; }
@keyframes nesup { 0% { transform: translateY(200px); } 5% { transform: translateY(150px); } 10% { transform: translateY(100px); }
  15% { transform: translateY(50px); } 20% { transform: translateY(0); } 82% { transform: translateY(0); } 87% { transform: translateY(70px); }
  93% { transform: translateY(140px); } 100% { transform: translateY(200px); } }
@keyframes nesbob { 0% { margin-bottom: 0; } 50% { margin-bottom: 4px; } }
.credit { margin-top: 18px; }
@media (max-width: 420px) { .logo { font-size: 16px; gap: 6px; } .logo img { width: 24px; height: 24px; } .who a { font-size: 13px; } .who .lv { padding: 3px 8px; } }

/* поощрение в тренинге: своя собака с уткой (32×33 пикселя) */
.dog.duck { height: 210px; }
.dog.duck .pup { width: 150px; height: 145px; left: 10px; bottom: 26px; animation: duckup 1.7s steps(1, end) forwards; }
.dog.duck .pup svg { animation: none; }
.dog.duck .say { left: 0; top: 4px; background: #2f8a4b; }
@keyframes duckup { 0% { transform: translateY(180px); } 8% { transform: translateY(120px); } 16% { transform: translateY(60px); }
  22% { transform: translateY(0); } 80% { transform: translateY(0); } 88% { transform: translateY(90px); } 100% { transform: translateY(180px); } }
