/* Knock Empire — portrait, phone-first */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0A0A0A;
  --panel: #161616;
  --panel-2: #1E1E1E;
  --border: #2A2A2A;
  --text: #F0F0F0;
  --muted: #9A9A9A;
  --green: #00E676;
  --green-dim: rgba(0, 230, 118, 0.14);
  --gold: #F5C518;
  --gold-dim: rgba(245, 197, 24, 0.14);
  --red: #FF5252;
  --blue: #4FC3F7;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
:root[data-theme="light"] {
  --bg: #F4F5F7; --panel: #FFFFFF; --panel-2: #EEF0F3; --border: #D8DCE2;
  --text: #14171C; --muted: #5C6470; --green: #008A45; --green-dim: rgba(0, 138, 69, 0.12);
  --gold: #A87900; --gold-dim: rgba(168, 121, 0, 0.14); --red: #C62828; --blue: #0277BD;
}

html, body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
/* A painted backdrop (the empire at night), dimmed behind the game; the page keeps the plain colour underneath */
body { background: transparent; }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 8, 14, 0.5) 0%, rgba(8, 8, 14, 0.78) 40%, rgba(8, 8, 14, 0.92) 100%), url('/assets/ui/ke-bg-night.webp') center top / cover no-repeat; }
button { font: inherit; color: inherit; touch-action: manipulation; }

#app { height: 100%; height: 100dvh; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; }

/* ── HUD ── */
#hud { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--border); background: var(--bg); }
.hud-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hud-row.sub { margin-top: 2px; font-size: 0.85rem; }
.cash { font-family: var(--mono); font-size: 1.9rem; font-weight: 800; color: var(--gold); letter-spacing: -0.02em; }
.date { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
/* Next goal, always visible */
.goal { margin-top: 8px; font-size: 0.78rem; color: var(--muted); }
.goal .progress { margin-top: 4px; height: 4px; }
.goal b { color: var(--text); }
.item .desc .ms { color: var(--gold); }
.income { font-family: var(--mono); color: var(--green); font-weight: 700; }
.hud-right { color: var(--muted); white-space: nowrap; }

/* ── Main view ── */
#view { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 16px 24px; }
.section-title { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; display: flex; justify-content: space-between; align-items: center; }
.section-title:first-child { margin-top: 0; }

/* ── Knock area ── */
/* Stays pinned while the upgrade list scrolls underneath */
.knock-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 0 8px; margin: -14px -16px 6px; position: sticky; top: -14px; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--border); }
.knock-stats { display: flex; gap: 14px; font-size: 0.8rem; color: var(--muted); flex-wrap: wrap; justify-content: center; }
.knock-stats b { color: var(--text); font-family: var(--mono); }
.knock-btn { position: relative; width: 170px; height: 170px; touch-action: none; border-radius: 50%; border: none; background: transparent; cursor: pointer; user-select: none; -webkit-user-select: none; }
.knock-btn svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.knock-btn .ring-bg { fill: var(--panel); stroke: var(--border); stroke-width: 8; }
.knock-btn .ring-fg { fill: none; stroke: var(--green); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 0.08s linear; }
.knock-btn .face { position: absolute; inset: 22px; border-radius: 50%; background: var(--green); color: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 900; font-size: 1.5rem; letter-spacing: 0.04em; box-shadow: 0 6px 0 #00934a, 0 12px 28px rgba(0, 230, 118, 0.25); transition: transform 0.05s; }
.knock-btn .face small { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; opacity: 0.7; }
.knock-btn:active .face { transform: translateY(4px); box-shadow: 0 2px 0 #00934a, 0 6px 16px rgba(0, 230, 118, 0.2); }
.knock-btn.frenzy .face { background: var(--gold); box-shadow: 0 6px 0 #a88400, 0 12px 28px rgba(245, 197, 24, 0.35); }
.streak { min-height: 24px; font-weight: 800; color: var(--gold); font-size: 0.95rem; }
.streak .bar { display: block; height: 3px; background: var(--gold); border-radius: 2px; margin-top: 3px; transition: width 0.2s linear; }
.last-door { min-height: 20px; font-size: 0.85rem; color: var(--muted); }
.last-door.sale { color: var(--green); font-weight: 700; }

.hot-door { position: absolute; top: 48px; right: 12px; min-width: 84px; min-height: 84px; border-radius: 16px; border: 2px solid var(--gold); background: var(--gold-dim); color: var(--gold); font-weight: 800; font-size: 0.75rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; animation: hotPulse 0.7s ease-in-out infinite alternate; }
.hot-door span { font-size: 1.9rem; line-height: 1; }
@keyframes hotPulse { from { transform: scale(1); box-shadow: 0 0 0 rgba(245,197,24,0); } to { transform: scale(1.06); box-shadow: 0 0 22px rgba(245,197,24,0.5); } }

.float { position: absolute; left: 50%; top: 60px; transform: translateX(-50%); font-family: var(--mono); font-weight: 800; color: var(--green); pointer-events: none; animation: floatUp 0.9s ease-out forwards; white-space: nowrap; }
.float.big { color: var(--gold); font-size: 1.4rem; }
@keyframes floatUp { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -70px; } }

/* ── Lists ── */
.buy-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.buy-toggle button { min-width: 44px; min-height: 32px; padding: 4px 8px; border: none; background: transparent; font-size: 0.72rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.buy-toggle button.on { background: var(--green-dim); color: var(--green); }
.item { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.item .ico { width: 44px; height: 44px; border-radius: 10px; background: var(--panel-2); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.item .ico img { width: 32px; height: 32px; object-fit: contain; }
.item .name { font-weight: 700; font-size: 0.95rem; }
.item .name .lvl { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); font-weight: 600; margin-left: 6px; }
.item .desc { font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.buy { min-width: 92px; min-height: 44px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); font-family: var(--mono); font-weight: 800; font-size: 0.85rem; color: var(--muted); cursor: pointer; line-height: 1.15; }
.buy small { display: block; font-family: var(--font); font-size: 0.62rem; font-weight: 600; opacity: 0.8; }
.buy.can { border-color: var(--green); background: var(--green-dim); color: var(--green); }
.buy.can.pulse { animation: canPulse 1.2s ease-in-out 2; }
.buy:disabled { cursor: not-allowed; }
.buy.done { border-color: transparent; background: transparent; color: var(--muted); }
@keyframes canPulse { 50% { box-shadow: 0 0 14px rgba(0, 230, 118, 0.45); } }

.progress { height: 6px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.progress i { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.progress.gold i { background: var(--gold); }

/* ── Team ── */
.summary { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.summary .big { font-family: var(--mono); font-weight: 800; font-size: 1.15rem; color: var(--green); }
.summary .small { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.rep { display: grid; grid-template-columns: 1fr auto; gap: 8px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; text-align: left; width: 100%; min-height: 64px; }
.rep .who { font-weight: 700; font-size: 0.92rem; }
.rep .who .lv { font-size: 0.68rem; font-weight: 700; color: var(--blue); border: 1px solid var(--blue); border-radius: 4px; padding: 1px 5px; margin-left: 6px; }
.rep .stats { font-size: 0.74rem; color: var(--muted); margin-top: 3px; }
.rep .rate { font-family: var(--mono); font-weight: 800; color: var(--green); font-size: 0.9rem; text-align: right; }
.rep .morale { grid-column: 1 / -1; }
.full-btn { width: 100%; min-height: 52px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel-2); font-weight: 800; font-size: 0.95rem; color: var(--muted); cursor: pointer; margin-bottom: 12px; }
.full-btn.can { border-color: var(--green); background: var(--green); color: #000; }
.full-btn small { display: block; font-weight: 600; font-size: 0.72rem; opacity: 0.8; }

/* ── Locked tab ── */
.locked { text-align: center; padding: 60px 20px; color: var(--muted); }
.locked .lock { font-size: 3rem; margin-bottom: 10px; }
.locked h2 { color: var(--text); font-size: 1.2rem; margin-bottom: 6px; }

/* ── Tabs ── */
#tabs { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--border); background: var(--bg); padding-bottom: env(safe-area-inset-bottom); }
#tabs button { position: relative; min-height: 56px; border: none; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 0.62rem; font-weight: 700; color: var(--muted); cursor: pointer; }
#tabs button .ti { font-size: 1.25rem; line-height: 1; }
#tabs button.on { color: var(--green); }
#tabs button.is-locked { opacity: 0.45; }
#tabs button .dot { position: absolute; top: 8px; right: calc(50% - 18px); width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }

/* ── Toasts ── */
#toasts { position: fixed; top: calc(104px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(480px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 6px; z-index: 50; pointer-events: none; }
.toast { background: var(--panel); border: 1px solid var(--gold); color: var(--text); border-radius: 10px; padding: 9px 12px; font-size: 0.85rem; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,0.4); animation: toastIn 0.2s ease-out; }
.toast.green { border-color: var(--green); }
.toast.out { opacity: 0; transition: opacity 0.3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* ── Modal ── */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-card { width: 100%; max-width: 420px; max-height: 86dvh; overflow-y: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.modal-card h2 { font-size: 1.15rem; margin-bottom: 8px; }
.modal-card p { font-size: 0.9rem; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.modal-card .bignum { font-family: var(--mono); font-weight: 800; font-size: 1.8rem; color: var(--gold); margin: 8px 0 12px; }
.modal-card .row { display: flex; justify-content: space-between; font-size: 0.88rem; padding: 6px 0; border-bottom: 1px solid var(--border); }
.modal-card .row:last-of-type { border-bottom: none; }
.modal-card .row b { font-family: var(--mono); }
.modal-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.btn { min-height: 48px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel-2); font-weight: 800; cursor: pointer; padding: 8px 14px; }
.btn.primary { background: var(--green); color: #000; border-color: var(--green); }
.btn.danger { color: var(--red); border-color: var(--red); background: transparent; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
textarea.save-box { width: 100%; min-height: 90px; background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-family: var(--mono); font-size: 0.7rem; }
.setting { display: flex; justify-content: space-between; align-items: center; min-height: 48px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.switch { min-width: 76px; min-height: 36px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-2); font-weight: 800; font-size: 0.78rem; color: var(--muted); cursor: pointer; }
.switch.on { background: var(--green-dim); border-color: var(--green); color: var(--green); }

/* ── Confidence, Focus button, Mastery ── */
.conf { margin: 4px 0 10px; }
.conf-row { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.conf-row b { color: var(--text); font-weight: 700; }
.conf-fog i { background: var(--muted); }
.conf-locked i { background: var(--gold); }
.small-note { font-size: 0.82rem; color: var(--muted); }
.focus-btn { background: var(--gold) !important; border-color: var(--gold) !important; }
.mastery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.badge { text-align: center; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 8px 4px; }
.badge .ring { width: 48px; height: 48px; margin: 0 auto 4px; border-radius: 50%; background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--panel-2) 0); display: flex; align-items: center; justify-content: center; }
.badge .ring span { width: 38px; height: 38px; border-radius: 50%; background: var(--panel); display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.badge .bn { font-size: 0.62rem; font-weight: 700; line-height: 1.2; min-height: 2.4em; }
.badge .bl { font-size: 0.6rem; color: var(--muted); font-family: var(--mono); }
/* Brain Fog washes the color out; Locked In glows gold */
#app.conf-fog #view { filter: saturate(0.35); }
#app.conf-locked #hud { box-shadow: inset 0 -2px 0 var(--gold), 0 6px 18px rgba(245, 197, 24, 0.18); }

/* ── Focus door (full-screen) ── */
.door { position: fixed; inset: 0; z-index: 90; background: var(--bg); display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; }
.door[hidden] { display: none; }
.door-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.door-top .leave { min-width: 44px; min-height: 44px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); font-size: 1rem; cursor: pointer; }
.steps { display: flex; gap: 4px; flex: 1; margin-right: 12px; }
.steps i { flex: 1; height: 5px; border-radius: 3px; background: var(--panel-2); }
.steps i.done { background: var(--green); } .steps i.now { background: var(--gold); }
.step-name { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.owner { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.owner-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.owner .face { font-size: 2.4rem; line-height: 1; }
.owner .nm { font-weight: 800; font-size: 1.05rem; }
.chip { display: inline-block; font-size: 0.68rem; font-weight: 700; border: 1px solid var(--border); border-radius: 999px; padding: 2px 9px; margin-top: 3px; color: var(--muted); }
.chip.warm { border-color: var(--gold); color: var(--gold); }
.owner .clue { font-size: 0.85rem; color: var(--blue); margin-bottom: 6px; }
.owner .says { font-size: 0.98rem; line-height: 1.45; }
.prompt { font-size: 0.85rem; color: var(--muted); margin: 4px 0 8px; }
.choice { display: block; width: 100%; text-align: left; min-height: 56px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; font-size: 0.9rem; line-height: 1.4; cursor: pointer; }
.choice:active { border-color: var(--green); }
.choice.right { border-color: var(--green); background: var(--green-dim); }
.choice.wrong { border-color: var(--red); opacity: 0.7; }
.choice b { display: block; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); margin-bottom: 2px; }
.rtac-timer { height: 4px; background: var(--panel-2); border-radius: 2px; overflow: hidden; margin-bottom: 10px; }
.rtac-timer i { display: block; height: 100%; background: var(--gold); width: 100%; }
.feedback { font-size: 0.85rem; min-height: 1.4em; margin-bottom: 6px; font-weight: 700; }
.feedback.good { color: var(--green); } .feedback.bad { color: var(--red); }
.result { text-align: center; padding: 10px 0; }
.result .big { font-size: 1.5rem; font-weight: 900; margin-bottom: 4px; }
.result .big.sale { color: var(--green); } .result .big.cb { color: var(--gold); } .result .big.no { color: var(--muted); }
.result .amt { font-family: var(--mono); font-size: 1.8rem; font-weight: 800; color: var(--gold); margin-bottom: 10px; }
.result .line { font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.result .line b { color: var(--text); }
.result .lesson { text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 12px 0; font-size: 0.85rem; line-height: 1.5; }
.result .lesson b { color: var(--gold); display: block; font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 2px; }

@media (max-height: 700px) { .knock-btn { width: 132px; height: 132px; } .knock-btn .face { inset: 18px; font-size: 1.15rem; } }
textarea { -webkit-user-select: text; user-select: text; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ── Rep cards ── */
.rep { border-left-width: 4px; }
.rep .who .rar, .modal-card h2 .rar { font-size: 0.62rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid; border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: middle; }
.rep .traits { font-size: 0.72rem; color: var(--text); opacity: 0.85; margin-top: 3px; }
.rep.r-legendary, .rep.r-mythic { background: linear-gradient(100deg, var(--gold-dim), var(--panel) 45%); }
.full-btn.method { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; text-align: left; padding: 8px 12px; margin-bottom: 8px; min-height: 58px; }
.full-btn.method .m-ico { font-size: 1.4rem; }
.full-btn.method .m-txt b { display: block; font-size: 0.92rem; }
.full-btn.method .m-cost { font-family: var(--mono); font-weight: 800; font-size: 0.9rem; }
.full-btn.method:disabled { opacity: 0.5; cursor: not-allowed; }
.pity { font-size: 0.74rem; color: var(--muted); text-align: center; margin: 2px 0 12px; }
.pity b { color: var(--gold); font-family: var(--mono); }
.syns { display: grid; gap: 6px; margin-bottom: 12px; }
.syn { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px; opacity: 0.6; }
.syn.on { opacity: 1; border-color: var(--green); background: var(--green-dim); }
.syn b { font-size: 0.84rem; display: block; }
.syn small { font-size: 0.7rem; color: var(--muted); }
.syn .s-ico { font-size: 1.2rem; }
.syn .s-n { font-family: var(--mono); font-weight: 800; font-size: 0.8rem; color: var(--muted); }
.syn.on .s-n { color: var(--green); }
.trait { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; background: var(--panel-2); border-radius: 10px; padding: 7px 10px; margin-bottom: 6px; font-size: 1.1rem; }
.trait b { display: block; font-size: 0.86rem; }
.trait small { font-size: 0.74rem; color: var(--muted); }
.story { border: 1px solid var(--gold); background: var(--gold-dim); border-radius: 10px; padding: 10px 12px; margin: 8px 0 10px; }
.story p { color: var(--text) !important; font-size: 0.84rem !important; margin-bottom: 6px !important; }
.story b { font-size: 0.86rem; color: var(--gold); display: block; }
.story small { font-size: 0.74rem; color: var(--muted); display: block; margin: 2px 0 6px; }
.reveal { text-align: center; border: 2px solid var(--rc); border-radius: 14px; padding: 18px 12px; margin-bottom: 10px; background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--rc) 22%, transparent), transparent 70%); animation: reveal 0.45s cubic-bezier(.2,1.4,.4,1); }
.reveal .rv-rar { color: var(--rc); font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.8rem; }
.reveal .rv-name { font-size: 1.5rem; font-weight: 900; margin: 4px 0; }
.reveal .rv-stats { font-size: 0.8rem; color: var(--muted); font-family: var(--mono); }
@keyframes reveal { from { transform: scale(0.7) rotate(-3deg); opacity: 0; } to { transform: none; opacity: 1; } }
.text-msg { background: var(--green-dim); border: 1px solid var(--green); border-radius: 14px 14px 14px 4px; padding: 10px 12px; font-size: 0.9rem; line-height: 1.45; margin-bottom: 10px; }
.text-msg span { display: block; font-size: 0.7rem; color: var(--muted); margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .reveal { animation: none; } }

/* ── Markets ── */
.market { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.mk-head { display: flex; justify-content: space-between; align-items: baseline; }
.mk-head b { font-size: 1rem; }
.mk-head span { font-family: var(--mono); font-weight: 800; color: var(--green); font-size: 0.85rem; }
.mk-sub { font-size: 0.74rem; color: var(--muted); margin: 2px 0 8px; }
.mk-sat span { font-size: 0.72rem; color: var(--muted); display: block; margin-bottom: 4px; }
.mk-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; margin-top: 10px; }
.mk-row b { font-size: 0.86rem; display: block; }
.mk-row small { font-size: 0.72rem; color: var(--muted); }
.mk-row .maxed { font-size: 0.74rem; color: var(--gold); font-weight: 700; }
.mk-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.mk-actions .btn { min-height: 40px; font-size: 0.82rem; flex: 1; }
.mk-actions .here { font-size: 0.8rem; color: var(--green); font-weight: 700; flex: 1; text-align: center; }
.btn.gold { background: var(--gold); color: #000; border-color: var(--gold); }
.moves { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 0; }
.moves span { font-size: 0.78rem; color: var(--muted); margin-right: 4px; }
.mv { min-height: 36px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-2); font-size: 0.76rem; font-weight: 700; cursor: pointer; }
.mv.on { border-color: var(--green); color: var(--green); }

/* ── Morale & perks ── */
.morale-sum .big2 { font-size: 1.3rem; font-weight: 800; margin: 2px 0; }
.morale-sum.warn { border-color: var(--gold); background: var(--gold-dim); }
.warn-tag { color: var(--gold); font-size: 0.68rem; border: 1px solid var(--gold); border-radius: 4px; padding: 0 4px; margin-left: 2px; }

/* ── Neighborhoods ── */
.hood-bar { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin: 10px 0; min-height: 44px; font-size: 0.8rem; cursor: pointer; }
.hood-bar b { color: var(--green); font-size: 0.76rem; white-space: nowrap; }
.hood { display: block; width: 100%; text-align: left; background: var(--panel-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer; }
.hood.on { border-color: var(--green); }
.hood.shut { opacity: 0.55; }
.hd-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.hd-top b { font-size: 0.92rem; }
.hd-top span { font-size: 0.7rem; color: var(--gold); font-weight: 700; white-space: nowrap; }
.hd-sub { font-size: 0.72rem; color: var(--muted); margin: 3px 0 6px; line-height: 1.35; }
.hd-bars { display: grid; grid-template-columns: auto 1fr; gap: 4px 8px; align-items: center; font-size: 0.68rem; color: var(--muted); }
.chip.clover { border-color: var(--green); color: var(--green); }

/* ── Objectives & Big Mo ── */
.board { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px 4px; margin: 10px 0; }
.goal-row { padding: 5px 0; border-bottom: 1px solid var(--border); }
.g-top { display: flex; justify-content: space-between; gap: 8px; font-size: 0.8rem; }
.g-top b { font-family: var(--mono); color: var(--gold); font-size: 0.76rem; white-space: nowrap; }
.g-bot { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; margin-top: 4px; }
.g-bot small { font-family: var(--mono); font-size: 0.66rem; color: var(--muted); }
.daily-btn { width: 100%; display: flex; justify-content: space-between; align-items: center; background: none; border: none; min-height: 40px; font-size: 0.8rem; font-weight: 700; cursor: pointer; padding: 4px 0; }
.daily-btn b { color: var(--green); }
.daily-btn.ready { color: var(--gold); }
.login-btn { background: var(--gold) !important; border-color: var(--gold) !important; margin: 10px 0 0; }
.conf.mo { margin-top: 8px; }
.task { padding: 8px 0; border-bottom: 1px solid var(--border); }
.task b { font-size: 0.86rem; display: block; }
.task small { font-size: 0.72rem; color: var(--muted); font-family: var(--mono); }
.task.done b { color: var(--green); }
.task .progress { margin-top: 5px; }
.login-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin: 8px 0; }
.login-row i { font-style: normal; text-align: center; padding: 8px 0; border-radius: 8px; border: 1px solid var(--border); font-weight: 800; font-size: 0.8rem; color: var(--muted); }
.login-row i.got { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.login-row i.now { background: var(--gold); border-color: var(--gold); color: #000; }

/* ── Rivals, wars, texts ── */
.hud-rgroup { display: flex; align-items: center; gap: 8px; }
.texts-btn { position: relative; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; min-width: 36px; min-height: 30px; font-size: 0.9rem; cursor: pointer; }
.texts-btn[hidden] { display: none; }
.texts-btn i { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; font-style: normal; font-size: 0.6rem; font-weight: 800; border-radius: 999px; min-width: 16px; height: 16px; line-height: 16px; text-align: center; padding: 0 3px; }
.texts-btn i[hidden] { display: none; }
.txt { background: var(--panel-2); border-radius: 14px 14px 14px 4px; padding: 9px 12px; margin-bottom: 8px; border: 1px solid transparent; }
.txt.new { border-color: var(--gold); }
.txt-from { font-size: 0.7rem; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.txt-body { font-size: 0.88rem; line-height: 1.4; }
.rival-card { display: block; width: 100%; text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
button.rival-card { cursor: pointer; }
.rival-card b { display: block; font-size: 0.92rem; }
.rival-card span, .rival-card small { font-size: 0.76rem; color: var(--muted); }
.rival-card.war { border-color: var(--gold); }
.rival-card .btn { margin-top: 8px; min-height: 40px; width: 100%; }
.tug { height: 12px; border-radius: 999px; background: var(--red); overflow: hidden; margin: 8px 0 3px; }
.tug i { display: block; height: 100%; background: var(--green); transition: width 0.4s; }
.tug-n { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 0.72rem; }
.share { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; margin: 2px 0 4px; }
.share i { display: block; height: 100%; background: var(--blue); }
.rival { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.rival.beat { opacity: 0.6; }
.rival .rv-face { font-size: 1.5rem; }
.rival b { font-size: 0.9rem; display: block; }
.rival small { font-size: 0.72rem; color: var(--muted); display: block; margin-bottom: 4px; }
.gold-btn { background: var(--gold) !important; border-color: var(--gold) !important; }
.modal-card .row.me { color: var(--green); font-weight: 800; }

/* ── Life ── */
.item.owned { opacity: 0.75; }
.maxed-tag { font-size: 0.72rem; font-weight: 800; color: var(--green); white-space: nowrap; padding: 0 6px; }
.buy small { display: block; font-family: var(--font); font-size: 0.62rem; font-weight: 700; opacity: 0.85; }
.knock-btn.away { filter: grayscale(1); opacity: 0.6; }

/* ── Wealth ── */
.spark { width: 100%; height: 44px; display: block; margin: 6px 0 2px; }
.mv:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Growth tree & career rank ── */
.btn.back { min-height: 38px; margin-bottom: 10px; }
.node { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; margin-bottom: 6px; }
.node b { font-size: 0.88rem; display: block; }
.node i { font-style: italic; font-size: 0.68rem; color: var(--gold); display: block; }
.node small { font-size: 0.74rem; color: var(--muted); display: block; margin-top: 1px; }
.node.got { border-color: var(--green); background: var(--green-dim); }
.node.got b { color: var(--green); }
.node.far { opacity: 0.5; }
.node .gp { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); white-space: nowrap; }
.node .buy { min-width: 70px; }
.summary.career { border-color: var(--rc); }
.rankup { text-align: center; padding: 26px 10px; border: 2px solid var(--rc); border-radius: 16px; background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--rc) 30%, transparent), transparent 75%); animation: reveal 0.6s cubic-bezier(.2,1.4,.4,1); }
.rankup .ru-small { text-transform: uppercase; letter-spacing: 0.3em; font-size: 0.72rem; color: var(--muted); }
.rankup .ru-name { font-size: 2rem; font-weight: 900; color: var(--rc); margin: 8px 0 10px; line-height: 1.1; }
.rankup .ru-line { font-size: 0.9rem; font-weight: 700; }

/* ── Summer Track, looks, chapters ── */
.knock-btn .face { background: linear-gradient(160deg, var(--knock-a, var(--green)), var(--knock-b, var(--green))); }
.knock-btn .ring-fg { stroke: var(--knock-a, var(--green)); }
.cash { font-family: var(--cash-font, var(--mono)); }
.goal-row.chapter small { font-size: 0.7rem; color: var(--muted); display: block; margin-top: 2px; }
.goal-row.chapter .g-top b { color: var(--blue); }
.btn small { display: block; font-size: 0.7rem; font-weight: 600; opacity: 0.85; margin-top: 2px; }
.wrapped { border: 2px solid var(--gold); border-radius: 16px; padding: 16px 14px 6px; background: radial-gradient(circle at 50% 0%, var(--gold-dim), transparent 70%); }
.wrapped .wr-small { text-transform: uppercase; letter-spacing: 0.25em; font-size: 0.7rem; color: var(--muted); text-align: center; }
.wrapped .wr-year { font-size: 1.5rem; font-weight: 900; color: var(--gold); text-align: center; margin: 4px 0 10px; }
.wrapped .row b { font-family: var(--font); text-align: right; }

/* ── Empire ── */
.mk-actions .buy { flex: 1; }
.full-btn.method[data-cost].can { border-color: var(--green); background: var(--green); color: #000; }

/* ── Events ── */
.fx-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }

/* ── Achievements, collections, juice ── */
.ach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
.ach { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; opacity: 0.55; }
.ach b { font-size: 0.8rem; display: block; }
.ach small { font-size: 0.68rem; color: var(--muted); display: block; line-height: 1.3; }
.ach.got { opacity: 1; border-color: var(--gold); background: var(--gold-dim); }
.ach.got b { color: var(--gold); }
.coll { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; margin-bottom: 6px; }
.coll.done { border-color: var(--green); background: var(--green-dim); }
.c-top { display: flex; justify-content: space-between; font-size: 0.86rem; }
.c-top span { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); }
.c-items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.c-items i { font-style: normal; text-align: center; font-size: 1.3rem; min-width: 64px; flex: 1; background: var(--panel-2); border-radius: 8px; padding: 5px 4px; }
.c-items i small { display: block; font-size: 0.56rem; color: var(--muted); line-height: 1.2; }
.c-items i.miss { filter: grayscale(1) brightness(0.35); }
.c-items i.miss small { filter: brightness(3); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: confettiFall 1.6s linear forwards; }
@keyframes confettiFall { to { transform: translateY(105vh) rotate(720deg); opacity: 0.7; } }
#app.shake { animation: shake 0.3s; }
@keyframes shake { 20% { transform: translateX(-4px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.float.huge { color: var(--gold); font-size: 1.9rem; text-shadow: 0 0 14px var(--gold-dim); }
.pulse { animation: afford 0.5s ease-out 2; }
@keyframes afford { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }
#view.fade { animation: viewFade 0.18s ease-out; }
@keyframes viewFade { from { opacity: 0.3; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.reveal { animation: flipIn 0.6s cubic-bezier(.2,1.2,.4,1); box-shadow: 0 0 26px color-mix(in srgb, var(--rc) 45%, transparent); }
.reveal.r-mythic { border-image: linear-gradient(90deg, #FF5252, #F5C518, #00E676, #4FC3F7, #B388FF) 1; }
@keyframes flipIn { from { transform: perspective(600px) rotateY(90deg) scale(0.8); opacity: 0; } to { transform: none; opacity: 1; } }
.date { cursor: default; }

/* ── Goal swap ── */
.swap { background: none; border: none; font-size: 0.7rem; padding: 2px 4px; opacity: 0.55; cursor: pointer; }

/* ── The ending ── */
.scene { text-align: center; padding: 6px 2px 2px; animation: viewFade 0.5s ease-out; }
.scene .sc-ico { font-size: 3rem; margin-bottom: 6px; }
.scene h2 { font-size: 1.3rem; margin-bottom: 12px; }
.scene p { color: var(--text) !important; font-size: 0.98rem !important; line-height: 1.6 !important; margin-bottom: 12px !important; text-align: left; }
.btn.link { display: block; text-align: center; text-decoration: none; line-height: 1.3; padding: 13px 14px; }

/* ── Art that replaces emoji ── */
.item .ico img.art { width: 40px; height: 40px; object-fit: contain; }
img.art.inline { height: 1.5em; width: auto; vertical-align: -0.35em; margin-right: 4px; }
img.art.avatar { width: 30px; height: 30px; object-fit: cover; object-position: top; border-radius: 50%; vertical-align: -9px; margin-right: 6px; background: var(--panel-2); }
img.art.portrait { display: block; height: 130px; width: auto; max-width: 70%; margin: 0 auto 8px; object-fit: contain; }
.owner .face img.art { width: 64px; height: 64px; object-fit: contain; }
.rival .rv-face img.art, .m-ico img.art { width: 40px; height: 40px; object-fit: contain; }

/* For screen readers and search engines only */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* The night backdrop: the top bar and the KNOCK area let it show through softly.
   The light theme keeps its plain page instead. */
#hud, .knock-wrap { background: color-mix(in srgb, var(--bg) 70%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
:root[data-theme="light"] body::before { display: none; }
