/* Районы: мультяшные карточки-наклейки на тёмном асфальте. */
:root {
  --bg: #1c1a24; --bg2: #26232f; --card: #fff4dc; --ink: #1c1a24; --muted: #5b5566;
  --red: #e8453d; --yellow: #ffd23f; --green: #3fbf6a; --blue: #3d8ee8; --violet: #6b4dff;
  --line: 3px solid var(--ink); --shadow: 4px 4px 0 var(--ink); --r: 14px;
  --font: "Rubik", "Segoe UI", system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); color: #f6f1ff; line-height: 1.4;
  background: var(--bg) radial-gradient(circle at 20% 10%, #2e2a3a 0, transparent 40%) fixed;
  padding-bottom: calc(5.5rem + var(--safe-b));
}
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 99; background: var(--yellow); color: var(--ink); padding: .5rem 1rem; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.15; }
h1 { font-size: 1.75rem; font-weight: 900; letter-spacing: -.02em; }
h2 { font-size: 1.35rem; font-weight: 900; }
h3 { font-size: 1.05rem; font-weight: 800; }
p { margin: 0 0 .5rem; }
main { max-width: 560px; margin: 0 auto; padding: 1rem; outline: none; }
.loading { text-align: center; margin-top: 30vh; color: #cfc6e0; }

/* наклейка */
.card { background: var(--card); color: var(--ink); border: var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; }
.card.tilt-l { transform: rotate(-.6deg); } .card.tilt-r { transform: rotate(.5deg); }
.muted { color: var(--muted); }
.on-dark .muted, .section-title .muted { color: #cfc6e0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin: 1.25rem 0 .75rem; }
.row { display: flex; align-items: center; gap: .75rem; }
.grow { flex: 1; min-width: 0; }
.tag { display: inline-block; font-size: .8rem; font-weight: 800; padding: .1rem .5rem; border: 2px solid var(--ink); border-radius: 999px; background: var(--yellow); color: var(--ink); }

/* кнопки */
.btn {
  font: inherit; font-weight: 900; font-size: 1rem; min-height: 48px; padding: .6rem 1.1rem; cursor: pointer;
  border: var(--line); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); background: var(--yellow); color: var(--ink);
  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn.red { background: var(--red); color: #fff; } .btn.green { background: var(--green); color: var(--ink); }
.btn.ghost { background: transparent; box-shadow: none; border-color: var(--muted); color: inherit; }
.btn.small { min-height: 44px; padding: .4rem .8rem; font-size: .95rem; }
.btn.wide { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn[disabled]:active { transform: none; box-shadow: 3px 3px 0 var(--ink); }

/* шапка */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg2); border-bottom: 3px solid #000; padding: .6rem 1rem; }
.top .inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr auto; gap: .5rem .75rem; align-items: center; }
.meter { font-size: .85rem; font-weight: 800; }
.bar { height: 10px; border-radius: 6px; background: #3a3646; border: 2px solid #000; overflow: hidden; margin-top: 2px; }
.bar > i { display: block; height: 100%; background: var(--green); }
.bar.en > i { background: var(--yellow); } .bar.xp > i { background: var(--violet); } .bar.hp.low > i { background: var(--red); }
.money { font-weight: 900; font-size: 1.05rem; white-space: nowrap; }
.card .bar { background: #e7dcc4; }

/* нижние вкладки */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--bg2); border-top: 3px solid #000;
  display: grid; grid-template-columns: repeat(5, 1fr); padding: .35rem .25rem calc(.35rem + var(--safe-b));
}
.tabs button {
  font: inherit; font-size: .8rem; font-weight: 800; color: #d8d0e8; background: none; border: 0; border-radius: 10px;
  min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; position: relative;
}
.tabs button .ico { font-size: 1.4rem; line-height: 1; }
.tabs button[aria-current="page"] { color: var(--ink); background: var(--yellow); }
.tabs .dot { position: absolute; top: 6px; right: 22%; width: 10px; height: 10px; border-radius: 50%; background: var(--red); border: 2px solid var(--bg2); }

/* аватар */
.ava { flex: none; width: 56px; height: 56px; border-radius: 50%; border: var(--line); display: grid; place-items: center; font-size: 1.8rem; background: var(--yellow); }
.ava.big { width: 76px; height: 76px; font-size: 2.6rem; }

/* карта районов */
.map { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.map .district {
  font: inherit; text-align: left; color: var(--ink); cursor: pointer; border: var(--line); border-radius: 16px; box-shadow: var(--shadow);
  padding: .75rem; min-height: 112px; display: flex; flex-direction: column; justify-content: space-between;
}
.map .district:nth-child(odd) { transform: rotate(-1deg); } .map .district:nth-child(even) { transform: rotate(1deg); }
.map .district[aria-pressed="true"] { outline: 4px solid #fff; outline-offset: 3px; }
.district .em { font-size: 2rem; line-height: 1; }
.district .nm { font-weight: 900; font-size: 1.1rem; }
.district .bn { font-size: .85rem; font-weight: 600; }

/* списки */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { margin-bottom: .75rem; }
.item .em { font-size: 2rem; width: 48px; text-align: center; flex: none; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; text-align: center; }
.stats3 .v { font-size: 1.5rem; font-weight: 900; }
.stats3 .k { font-size: .85rem; color: var(--muted); }
.kv { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .9rem; font-weight: 700; }
.chips { display: flex; gap: .5rem; overflow-x: auto; padding: .25rem .1rem .75rem; scrollbar-width: none; }
.chips button { flex: none; }

/* стрелка */
.vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem; align-items: center; text-align: center; }
.vs .who { font-weight: 900; overflow-wrap: anywhere; }
.vs .x { font-size: 1.6rem; font-weight: 900; color: var(--red); }
.zones { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin: .25rem 0 1rem; }
.zones button { min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.zones button .ico { font-size: 1.4rem; }
.zones button[aria-pressed="true"] { background: var(--red); color: #fff; }
.zones.block button[aria-pressed="true"] { background: var(--blue); }
.log { list-style: none; padding: 0; margin: 0; font-size: .95rem; }
.log li { padding: .45rem 0; border-top: 2px dashed #d7cbb0; }
.log li:first-child { border-top: 0; }
.result { text-align: center; }
.result .big { font-size: 3rem; line-height: 1; }
.hit { animation: shake .35s; }
@keyframes shake { 20% { transform: translateX(-6px) rotate(-2deg); } 50% { transform: translateX(5px) rotate(1deg); } 80% { transform: translateX(-3px); } }

/* формы */
label { display: block; font-weight: 800; margin-bottom: .35rem; }
input[type=text] { font: inherit; font-size: 1.1rem; width: 100%; min-height: 48px; padding: .6rem .8rem; border: var(--line); border-radius: 12px; background: #fff; color: var(--ink); }

/* уведомления */
.toasts { position: fixed; left: 1rem; right: 1rem; bottom: calc(6rem + var(--safe-b)); z-index: 50; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; max-width: 520px; width: 100%; background: var(--card); color: var(--ink); border: var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: .75rem 1rem; font-weight: 800; display: flex; gap: .75rem; align-items: center; }
.toast.err { background: #ffd9d6; } .toast.good { background: #d8f7e0; }
.toast button { margin-left: auto; font: inherit; font-weight: 900; background: none; border: 0; min-width: 44px; min-height: 44px; cursor: pointer; color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card.tilt-l, .card.tilt-r, .map .district { transform: none !important; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.top .muted { color: #c9c0da; }
