:root {
  --ink: #171815;
  --paper: #f4f1e8;
  --paper-deep: #e7e0d0;
  --acid: #d6f044;
  --red: #e54d37;
  --blue: #3975d4;
  --muted: #78786f;
  --line: rgba(23, 24, 21, .14);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--ink); color: var(--ink); font-family: Manrope, Arial, sans-serif; letter-spacing: 0; }
body { display: flex; justify-content: center; }
button { font: inherit; }
.app-shell { width: 100%; max-width: 520px; min-height: 100vh; background: var(--paper); padding-bottom: calc(82px + env(safe-area-inset-bottom)); position: relative; overflow: hidden; }
.topbar { height: 68px; display: flex; align-items: center; gap: 10px; padding: env(safe-area-inset-top) 18px 0; border-bottom: 1px solid var(--line); }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; background: var(--ink); color: var(--acid); font: 15px/1 "Russo One", sans-serif; transform: rotate(-3deg); }
.brand-copy { display: grid; line-height: 1.05; flex: 1; }
.brand-copy strong { font-size: 15px; }
.brand-copy span { color: var(--muted); font-size: 11px; margin-top: 4px; text-transform: uppercase; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-weight: 800; font-size: 18px; cursor: pointer; }
.view { display: none; animation: enter .22s ease; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } }
.hero-band { min-height: 190px; padding: 30px 22px; background: var(--ink); color: white; display: flex; align-items: end; justify-content: space-between; position: relative; overflow: hidden; }
.hero-band::after { content: "ИМЕЮ ПРАВО"; position: absolute; right: -48px; top: 16px; color: rgba(214,240,68,.08); font: 58px/.9 "Russo One", sans-serif; width: 230px; transform: rotate(8deg); }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 11px; line-height: 1.2; text-transform: uppercase; font-weight: 800; }
.hero-band .eyebrow { color: var(--acid); }
.hero-band h1 { margin: 0; font: 74px/.9 "Russo One", sans-serif; letter-spacing: 0; position: relative; }
.hero-band h1 small { font: 16px/1 Manrope, sans-serif; color: #a7a89f; margin-left: 6px; }
.rank-badge { width: 82px; height: 82px; border-radius: 50%; background: var(--acid); color: var(--ink); display: grid; place-content: center; text-align: center; transform: rotate(5deg); position: relative; z-index: 1; }
.rank-badge span { font-size: 10px; text-transform: uppercase; font-weight: 800; }
.rank-badge strong { font: 28px/1 "Russo One", sans-serif; }
.mission-section, .recent-section { padding: 24px 20px; }
.mission-section { border-bottom: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-heading h2, .sheet-head h2 { margin: 0; font-size: 21px; line-height: 1.15; }
.reward { background: var(--red); color: white; padding: 6px 10px; font-size: 12px; font-weight: 800; transform: rotate(2deg); }
.mission-copy { color: #505149; line-height: 1.5; font-size: 14px; margin: 12px 0 20px; }
.route { display: grid; grid-template-columns: repeat(5, 1fr); position: relative; }
.route::before { content: ""; position: absolute; left: 9%; right: 9%; top: 20px; height: 3px; background: var(--paper-deep); }
.route-stop { display: grid; justify-items: center; gap: 8px; position: relative; z-index: 1; min-width: 0; }
.route-dot { width: 42px; height: 42px; border: 3px solid var(--paper); background: var(--paper-deep); border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.route-stop.done .route-dot { background: var(--acid); }
.route-stop span { font-size: 9px; max-width: 58px; text-align: center; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-button { width: calc(100% - 40px); min-height: 76px; margin: 0 20px; border: 0; background: var(--acid); color: var(--ink); display: flex; align-items: center; gap: 15px; padding: 15px 18px; cursor: pointer; box-shadow: 5px 5px 0 var(--ink); text-align: left; }
.scan-button:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.scan-button span:last-child { display: grid; gap: 3px; }
.scan-button strong { font-size: 17px; }
.scan-button small { color: #4c5324; }
.scan-icon { font-size: 35px; font-weight: 500; }
.text-button { border: 0; background: transparent; color: var(--blue); font-size: 12px; font-weight: 800; cursor: pointer; }
.visit-list { margin-top: 14px; display: grid; gap: 8px; }
.empty-state { border: 1px dashed #bdb8aa; padding: 17px; color: var(--muted); font-size: 13px; text-align: center; }
.visit-item, .bar-item, .leader-item { min-height: 62px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.visit-icon, .bar-index { width: 36px; height: 36px; flex: 0 0 36px; background: var(--ink); color: var(--acid); display: grid; place-items: center; font-weight: 800; }
.visit-copy, .bar-copy, .leader-copy { display: grid; gap: 3px; flex: 1; min-width: 0; }
.visit-copy strong, .bar-copy strong, .leader-copy strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visit-copy span, .bar-copy span, .leader-copy span { color: var(--muted); font-size: 11px; }
.visit-points { color: var(--red); font-weight: 800; font-size: 12px; }
.page-heading { padding: 32px 20px 24px; }
.page-heading h1 { margin: 0; font: 42px/1 "Russo One", sans-serif; }
.page-heading > p:last-child { color: var(--muted); font-size: 13px; line-height: 1.5; max-width: 330px; }
.my-position { margin: 0 20px 16px; padding: 18px; background: var(--acid); display: grid; grid-template-columns: 1fr auto; align-items: center; }
.my-position span { font-size: 12px; font-weight: 800; text-transform: uppercase; }
.my-position strong { grid-row: span 2; font: 36px/1 "Russo One", sans-serif; }
.my-position small { margin-top: 4px; }
.leaderboard, .bar-list { padding: 0 20px 24px; }
.leader-item { min-height: 58px; }
.leader-rank { width: 28px; font: 17px/1 "Russo One", sans-serif; }
.leader-item.me { background: var(--ink); color: white; margin: 4px -8px; padding: 0 8px; border: 0; }
.leader-item.me .leader-copy span { color: #aaa99f; }
.leader-points { font-size: 12px; font-weight: 800; }
.bar-item { min-height: 76px; }
.bar-index { background: var(--paper-deep); color: var(--ink); }
.bar-item.done .bar-index { background: var(--acid); }
.bar-status { font-size: 11px; color: var(--muted); font-weight: 800; }
.bar-item.done .bar-status { color: #65740c; }
.bottom-nav { position: fixed; z-index: 10; bottom: 0; width: 100%; max-width: 520px; height: calc(70px + env(safe-area-inset-bottom)); padding: 7px 20px env(safe-area-inset-bottom); background: rgba(244,241,232,.96); backdrop-filter: blur(10px); display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.nav-item { border: 0; background: transparent; color: var(--muted); display: grid; place-content: center; justify-items: center; gap: 2px; cursor: pointer; }
.nav-item span { font-size: 21px; line-height: 1; }
.nav-item small { font-size: 10px; font-weight: 700; }
.nav-item.active { color: var(--ink); }
.sheet-backdrop { display: none; position: fixed; z-index: 19; inset: 0; background: rgba(0,0,0,.56); }
.sheet-backdrop.open { display: block; }
.bottom-sheet { position: fixed; z-index: 20; bottom: 0; left: 50%; width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; background: var(--paper); padding: 10px 20px calc(22px + env(safe-area-inset-bottom)); transform: translate(-50%, 105%); transition: transform .25s ease; }
.bottom-sheet.open { transform: translate(-50%, 0); }
.bottom-sheet.compact { max-height: 70vh; }
.sheet-handle { width: 38px; height: 4px; background: #b9b5a9; margin: 0 auto 18px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.camera-box { aspect-ratio: 4/3; background: var(--ink); position: relative; overflow: hidden; color: white; display: grid; place-items: center; }
.camera-box video { width: 100%; height: 100%; object-fit: cover; display: none; }
.camera-box.live video { display: block; }
.scan-frame { position: absolute; width: 52%; aspect-ratio: 1; border: 3px solid var(--acid); z-index: 2; }
.camera-placeholder { position: absolute; display: grid; text-align: center; gap: 5px; margin-top: 170px; }
.camera-placeholder span { color: #aaa; font-size: 11px; }
.camera-box.live .camera-placeholder { display: none; }
.secondary-button { width: 100%; min-height: 48px; margin-top: 10px; border: 1px solid var(--ink); background: transparent; font-weight: 800; cursor: pointer; }
.divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 10px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.demo-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.demo-code { min-height: 54px; border: 1px solid var(--line); background: white; padding: 9px; text-align: left; cursor: pointer; display: grid; gap: 2px; }
.demo-code strong { font-size: 12px; }
.demo-code span { font-size: 10px; color: var(--muted); }
.demo-code.done { opacity: .45; }
.rules { padding: 0; margin: 0; list-style: none; counter-reset: rules; display: grid; gap: 20px; }
.rules li { counter-increment: rules; display: grid; grid-template-columns: 42px 1fr; column-gap: 12px; }
.rules li::before { content: counter(rules); grid-row: span 2; width: 42px; height: 42px; background: var(--acid); display: grid; place-items: center; font: 18px/1 "Russo One", sans-serif; }
.rules span { color: var(--muted); font-size: 12px; margin-top: 3px; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); max-width: min(88%, 440px); transform: translate(-50%, 20px); background: var(--ink); color: white; padding: 13px 16px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: 4px 4px 0 var(--red); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 521px) { body { padding: 24px 0; } .app-shell { min-height: calc(100vh - 48px); } .bottom-nav { bottom: 24px; } }
