:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #182640;
  --muted: #6b7a90;
  --accent: #2e7d32;
  --accent-2: #1b5e20;
  --border: #d9e1ec;
  --danger: #c62828;
  --ok: #2e7d32;
  --warn: #ef6c00;
  --map-fill: #e8efe4;
  --map-hover: #cfe1c9;
  --map-hit: #90c58f;
  --map-target: #ffab40;
  --map-wrong: #ef9a9a;
  --map-right: #a5d6a7;
  --map-stroke: #4d5f7a;
  --btn: #eef2f8;
  --btn-hover: #e2e9f2;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }

.top { display:flex; align-items:center; justify-content: space-between; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--border); position: sticky; top:0; z-index:20; }
.brand { display:flex; align-items:center; gap:10px; font-weight:600; font-size:15px; }
.back { text-decoration:none; color: var(--ink); font-size: 22px; padding: 4px 10px; border-radius: 8px; }
.back:hover { background: var(--btn); }
.userbar { color: var(--muted); font-size:13px; display:flex; gap:8px; align-items:center; }
.userbar .btn { padding: 5px 10px; font-size:13px; }

.wrap { padding: 12px; max-width: 900px; margin: 0 auto; }
.loading { text-align:center; color: var(--muted); padding: 40px 0; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.card h2 { margin: 0 0 8px; font-size: 17px; }
.card h3 { margin: 10px 0 6px; font-size: 15px; color: var(--muted); font-weight:600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.btn { display: inline-flex; align-items:center; justify-content:center; gap: 6px; padding: 10px 14px; background: var(--btn); color: var(--ink); border: 1px solid var(--border); border-radius: 10px; font-size: 15px; cursor: pointer; user-select: none; }
.btn:hover { background: var(--btn-hover); }
.btn.primary { background: var(--accent); color: #fff !important; -webkit-text-fill-color: #fff; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.primary:active, .btn.primary:focus { color: #fff !important; -webkit-text-fill-color: #fff; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.big { padding: 14px 18px; font-size: 16px; }
.btn.danger { color: var(--danger); border-color: #f5c1c1; }
.row { display:flex; flex-wrap: wrap; gap: 8px; }
.row.between { justify-content: space-between; align-items: center; }

.grid.mechs { display:grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.mech { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 12px; text-align:left; cursor:pointer; }
.mech:hover { border-color: var(--accent); background: #f0f8f1; }
.mech .ico { font-size: 22px; }
.mech .t { font-weight: 600; margin-top: 4px; }
.mech .d { color: var(--muted); font-size: 13px; margin-top: 4px; }
.mech .st { display:flex; gap: 6px; margin-top: 8px; }
.mech .st span { font-size: 11px; color: var(--muted); padding: 2px 6px; background: var(--btn); border-radius: 6px; }
.mech .st span.ok { background:#dcedc8; color: #33691e; }

.qcard { min-height: 200px; }
.q-title { font-size: 20px; font-weight: 700; margin: 6px 0 12px; text-align:center; }
.q-flag { display:block; width: 240px; max-width: 90%; height: 160px; object-fit: contain; margin: 12px auto; background: #eef2f6; border-radius: 12px; padding: 8px; }
.q-hint { color: var(--muted); text-align:center; font-size: 13px; }

.answers { display:grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.answers.one { grid-template-columns: 1fr; }
.ans { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer; text-align:left; font-size: 15px; min-height: 44px; }
.ans:hover { border-color: var(--accent); background: #f0f8f1; }
.ans.right { background: #e8f5e9; border-color: var(--ok); }
.ans.wrong { background: #ffebee; border-color: var(--danger); }
.ans.disabled { pointer-events:none; opacity: 0.75; }
.ans .cap { font-size:13px; color: var(--muted); margin-top: 2px; }

.progress { display:flex; align-items:center; gap: 8px; font-size:13px; color: var(--muted); margin-bottom: 8px; }
.progress .bar { flex:1; height: 6px; background: var(--btn); border-radius: 4px; overflow: hidden; }
.progress .bar > i { display:block; height: 100%; background: var(--accent); width: 0; transition: width .3s; }

.stat { display:flex; gap: 10px; flex-wrap: wrap; }
.stat .b { background: var(--btn); border-radius: 8px; padding: 4px 8px; font-size: 12px; }
.stat .b b { font-weight: 700; color: var(--accent); }

.map-wrap { position: relative; width: 100%; overflow: hidden; touch-action: none; background: #d7ecff; border-radius: 12px; border: 1px solid var(--border); }
.map-wrap.mode-ru { background: #e6f3ff; }
.map-wrap svg { display: block; width: 100%; height: auto; user-select: none; touch-action: none; }
.map-wrap .path { fill: var(--map-fill); stroke: var(--map-stroke); stroke-width: 0.35; transition: fill 0.12s; cursor: pointer; }
.map-wrap.mode-ru .path { stroke-width: 0.55; }
.map-wrap .path.hover { fill: var(--map-hover); }
.map-wrap .path.hit { fill: var(--map-hit); }
.map-wrap .path.target-glow { animation: glow 1.3s ease-in-out infinite; }
.map-wrap .path.right { fill: var(--map-right); }
.map-wrap .path.wrong { fill: var(--map-wrong); }
.map-wrap .marker { fill: #ff5722; stroke: #fff; stroke-width: 0.6; pointer-events: none; }
.map-wrap .cap-dot { fill: #ff9800; stroke: #fff; stroke-width: 0.4; }
.map-wrap .obj-dot { fill: #d81b60; stroke: #fff; stroke-width: 0.4; cursor: pointer; }
.map-wrap .obj-dot.target { fill: #ffa000; }

@keyframes glow { 0%,100% { filter: drop-shadow(0 0 0 rgba(255,152,0,0.0)); } 50% { filter: drop-shadow(0 0 8px rgba(255,152,0,1)); } }

.map-tools { display:flex; gap: 8px; justify-content: space-between; margin-top: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.map-tools .btns { display:flex; gap: 6px; }
.map-tools button { padding: 6px 10px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: rgba(24,38,64,0.94); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 14px; z-index: 100; }

.auth { max-width: 340px; margin: 40px auto; }
.auth input { width: 100%; padding: 12px; font-size: 16px; border: 1px solid var(--border); border-radius: 10px; margin-top: 8px; }
.pinpad { display:grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.pinpad button { padding: 16px; font-size: 20px; }

.list { display:flex; flex-direction: column; gap: 6px; }
.list .item { display:flex; justify-content: space-between; align-items:center; padding: 8px 12px; background: var(--btn); border-radius: 8px; font-size: 14px; }

.result-card { text-align: center; padding: 20px 14px; }
.result-card .big { font-size: 40px; margin: 8px 0; }
.result-card .txt { color: var(--muted); white-space: pre-line; text-align: left; padding: 0 8px; }
.result-card.right .big { color: var(--ok); }
.result-card.wrong .big { color: var(--danger); }

.hint-block { background: #fff8e1; border: 1px solid #ffe082; padding: 8px 12px; border-radius: 10px; font-size: 14px; }

/* Мобильный отзыв */
@media (max-width: 500px) {
  .brand span { font-size: 14px; }
  .grid.mechs { grid-template-columns: repeat(2, 1fr); }
  .answers { grid-template-columns: 1fr; }
  .q-title { font-size: 18px; }
  .btn.big { padding: 12px 14px; font-size: 15px; }
}
