:root {
  --orange: #ff8a1f; --orange-d: #d96f0c; --navy: #0b2a40; --ink: #1b2430; --paper: #fff8ee;
  --card: rgba(255, 248, 238, .96); --shadow: 0 8px 28px rgba(0, 0, 0, .28);
  --font-d: 'Baloo 2', system-ui, sans-serif; --font-b: 'Hind', system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0e4466; font-family: var(--font-b); color: var(--ink); }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; transform: translate(-50%, -100%); font: 600 12px var(--font-b); color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); white-space: nowrap; pointer-events: none; }
.lbl b { display: inline-block; background: var(--orange); color: #fff; font: 700 10px var(--font-d); border-radius: 8px; padding: 0 5px; margin-left: 4px; vertical-align: 1px; }
.lbl.big { font-size: 15px; }
.lbl.house { font: 700 12px var(--font-d); background: rgba(255,248,238,.95); color: var(--ink); padding: 2px 8px; border-radius: 10px; text-shadow: none; box-shadow: 0 2px 6px rgba(0,0,0,.3); }

#loading { position: fixed; inset: 0; display: grid; place-content: center; gap: 10px; text-align: center; color: #fff; font: 600 16px var(--font-b); background: #0e4466; z-index: 50; transition: opacity .5s; }
#loading .logo { width: 64px; height: 64px; margin: 0 auto; border-radius: 16px; background: var(--orange); display: grid; place-content: center; font: 800 26px var(--font-d); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { transform: scale(.92); } }
#loading.hide { opacity: 0; pointer-events: none; }

#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }

.top { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font: 800 18px var(--font-d); text-decoration: none; }
.brand i { width: 30px; height: 30px; border-radius: 9px; background: var(--orange); display: grid; place-content: center; font-style: normal; font-size: 14px; }
.badge { font: 800 13px var(--font-d); padding: 5px 11px; border-radius: 999px; background: #ffd23f; color: #3a2a00; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.badge.pop { background: var(--navy); color: #fff; }
.spacer { flex: 1; }

.search { position: absolute; top: 54px; left: 10px; right: 10px; max-width: 520px; margin: 0 auto; }
.search input { width: 100%; height: 44px; border: 3px solid var(--orange); border-radius: 999px; padding: 0 16px 0 40px; font: 500 15px var(--font-b); background: var(--paper); outline: none; box-shadow: var(--shadow); }
.search::before { content: '🔍'; position: absolute; left: 14px; top: 11px; font-size: 16px; }
.sugg { position: absolute; left: 8px; right: 8px; top: 48px; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; display: none; }
.sugg div { padding: 10px 14px; cursor: pointer; font-size: 14px; }
.sugg div:hover, .sugg div.active { background: #ffe7cc; }
.sugg small { color: #666; margin-left: 6px; }

.bottom { position: absolute; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); max-width: 560px; margin: 0 auto; display: grid; gap: 8px; }
.row { display: flex; gap: 8px; }
.btn { flex: 1; height: 48px; border: 0; border-radius: 14px; font: 800 16px var(--font-d); cursor: pointer; background: var(--orange); color: #fff; box-shadow: var(--shadow); padding: 0 14px; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn.sec { background: var(--paper); color: var(--ink); }
.btn.sm { height: 40px; font-size: 14px; flex: 0 0 auto; }
.btn.ghost { background: rgba(11,42,64,.85); color: #fff; }
.hint { position: absolute; left: 10px; bottom: calc(130px + var(--safe-b)); color: #fff; font: 500 11px var(--font-b); opacity: .8; text-shadow: 0 1px 2px #000; }

.modal-bg { position: absolute; inset: 0; background: rgba(5, 20, 35, .55); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 420px; background: var(--card); border-radius: 22px; padding: 20px; box-shadow: var(--shadow); max-height: calc(100vh - 40px); overflow: auto; }
.modal h2 { font: 800 24px var(--font-d); margin: 0 0 6px; }
.modal p { margin: 6px 0 12px; font-size: 15px; line-height: 1.4; }
.modal label { display: block; font: 600 13px var(--font-b); margin: 12px 0 4px; color: #444; }
.modal input { width: 100%; height: 46px; border: 2px solid #e2d3bd; border-radius: 12px; padding: 0 14px; font: 500 16px var(--font-b); background: #fff; outline: none; }
.modal input:focus { border-color: var(--orange); }
.modal .btn { width: 100%; margin-top: 12px; }
.modal .link { background: none; border: 0; color: #555; font: 600 14px var(--font-b); margin-top: 10px; cursor: pointer; width: 100%; }
.err { color: #c0392b; font-size: 13px; margin-top: 6px; }
.field { position: relative; }
.field .sugg { top: 50px; left: 0; right: 0; }

.card { position: absolute; left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); max-width: 560px; margin: 0 auto; background: var(--card); border-radius: 22px; padding: 16px; box-shadow: var(--shadow); }
.card h3 { font: 800 22px var(--font-d); margin: 0; }
.card .meta { color: #555; font-size: 14px; }
.grow { margin: 10px 0; }
.bar { height: 10px; background: #efe3d0; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), #ffd23f); border-radius: 99px; }
.grow small { display: block; margin-top: 4px; font-size: 12px; color: #555; }
.linkbox { display: flex; gap: 6px; margin-top: 8px; }
.linkbox input { flex: 1; height: 40px; border: 2px solid #e2d3bd; border-radius: 10px; padding: 0 10px; font: 500 13px var(--font-b); background: #fff; }
.x { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 22px; cursor: pointer; color: #777; }

.toast { position: absolute; top: 108px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 999px; font: 600 14px var(--font-b); box-shadow: var(--shadow); white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }

.joy { position: absolute; left: 18px; bottom: calc(80px + var(--safe-b)); width: 120px; height: 120px; border-radius: 50%; background: rgba(255,255,255,.15); border: 2px solid rgba(255,255,255,.4); display: none; }
.joy i { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px; border-radius: 50%; background: rgba(255,255,255,.7); }
body.walk .joy { display: block; }

/* record mode: clean frame for reels */
body.record .top, body.record .search, body.record .bottom, body.record .hint, body.record .card, body.record .joy { display: none !important; }
.rec { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; }
.rec .badge { font-size: 20px; padding: 8px 18px; border-radius: 14px; }
.rec-cap { position: absolute; left: 0; right: 0; bottom: 34%; text-align: center; font: 800 42px var(--font-d); color: #fff; text-shadow: 0 3px 8px rgba(0,0,0,.6); padding: 0 20px; pointer-events: none; }
.rec-cap em { font-style: normal; color: #ffd23f; }
.rec-help { position: absolute; left: 10px; bottom: 10px; color: #fff; font: 500 11px var(--font-b); opacity: .7; background: rgba(0,0,0,.4); padding: 6px 8px; border-radius: 8px; }
body.record.clean .rec, body.record.clean .rec-help { display: none; }

@media (max-width: 480px) { .modal h2 { font-size: 21px; } .btn { font-size: 15px; } }
