/* HONDACIVIC Tap — styles. Night-street look; Telegram theme colors are ignored on purpose
   so the game looks the same everywhere (like Hamster Kombat). */

@font-face { font-family: 'Display'; src: url(fonts/BigShouldersDisplay-Black.ttf) format('truetype'); font-display: swap; }
@font-face { font-family: 'Mono'; src: url(fonts/IBMPlexMono-SemiBold.ttf) format('truetype'); font-display: swap; }

:root {
  --bg: #0b0b0f;
  --bg2: #15151c;
  --bg3: #1e1e28;
  --line: #2a2a36;
  --fg: #f4f4f6;
  --dim: #9a9aa8;
  --red: #ff3b30;
  --gold: #ffd60a;
  --neon: #b14cff;
  --green: #34c759;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --display: 'Display', Impact, sans-serif;
}

* { box-sizing: border-box; }
/* `hidden` must win over any display rule below (e.g. .coach is display:flex). */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: var(--font); }
body { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1 { font-family: var(--display); font-size: 34px; letter-spacing: .02em; text-align: center; margin: 8px 0 4px; }
h2 { font-size: 15px; margin: 22px 0 8px; }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.center { text-align: center; }
.row { display: flex; gap: 8px; justify-content: center; }

#app { max-width: 480px; margin: 0 auto; min-height: 100%; padding: 12px 16px 96px; position: relative;
  background: radial-gradient(120% 60% at 50% 0%, #1d0f2a 0%, var(--bg) 60%); }

/* --- coin --- */
.coin { display: inline-block; width: 22px; height: 22px; border-radius: 50%; vertical-align: -4px; flex: none;
  background: radial-gradient(circle at 35% 30%, #fff2a8, var(--gold) 45%, #b8860b 100%);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.18), 0 0 12px rgba(255,214,10,.35); position: relative; }
.coin::after { content: 'HC'; position: absolute; inset: 0; display: grid; place-items: center;
  font: 900 9px/1 var(--display); color: #6b4a00; letter-spacing: .02em; }
.coin.sm { width: 14px; height: 14px; vertical-align: -2px; } .coin.sm::after { font-size: 6px; }
.coin.lg { width: 40px; height: 40px; } .coin.lg::after { font-size: 15px; }
.coin.xl { width: 96px; height: 96px; } .coin.xl::after { font-size: 34px; }

/* --- top bar --- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; text-align: left; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800;
  background: linear-gradient(135deg, var(--red), #8f1612); }
.me-text { display: flex; flex-direction: column; line-height: 1.2; }
.me-name { font-weight: 700; font-size: 14px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-level { font-size: 12px; }
.pph { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; display: flex; flex-direction: column; align-items: flex-end; }
.pph-val { font-family: var(--display); font-size: 20px; display: flex; align-items: center; gap: 4px; }
.lvlbar { height: 6px; background: var(--bg3); border-radius: 3px; margin: 10px 0 14px; overflow: hidden; }
#levelFill { height: 100%; width: 0; background: linear-gradient(90deg, var(--neon), var(--red), var(--gold)); transition: width .4s; }

/* --- garage --- */
.dailies { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.daily { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; position: relative; }
.d-ico { font-size: 24px; }
.dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.dot.done { background: var(--green); }
.balance { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 18px 0 6px;
  font-family: var(--display); font-size: 52px; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.small-bal { font-size: 34px; margin: 4px 0 10px; }
.stage { position: relative; height: 300px; margin: 6px -16px 0; touch-action: manipulation; cursor: pointer; overflow: hidden; }
.glow { position: absolute; left: 50%; top: 55%; width: 400px; height: 240px; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(255,59,48,.35), rgba(177,76,255,.18) 60%, transparent); filter: blur(6px); }
.road { position: absolute; left: 0; right: 0; bottom: 18px; height: 36px; background: #0f0f14; border-top: 1px solid #22222c; }
.road::after { content: ''; position: absolute; left: 0; right: 0; top: 16px; height: 4px;
  background: repeating-linear-gradient(90deg, rgba(255,214,10,.55) 0 46px, transparent 46px 100px); animation: road 1.2s linear infinite paused; }
.stage.driving .road::after { animation-play-state: running; }
@keyframes road { to { background-position: -100px 0; } }
.car { position: absolute; left: 50%; bottom: 34px; width: min(380px, 96vw); transform: translateX(-50%); transition: transform .06s; animation: idle 2.4s ease-in-out infinite; }
@keyframes idle { 50% { transform: translateX(-50%) translateY(-1.5px); } }
.stage.driving .car { animation: rumble .12s linear infinite; }
@keyframes rumble { 50% { transform: translateX(-50%) translateY(1px); } }
.car.hit { transform: translateX(-50%) translateY(3px) scale(.97); }
.car .wheel { transition: transform .4s; }
.stage.driving .car .wheel { animation: spin .35s linear infinite; }
@keyframes spin { to { transform: rotate(-360deg); } }
.floats { position: absolute; inset: 0; pointer-events: none; }
.float { position: absolute; font-family: var(--display); font-size: 30px; color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.5);
  animation: up .9s ease-out forwards; white-space: nowrap; }
.float.meme { color: var(--gold); font-size: 34px; }
@keyframes up { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -110px); } }
.energy-row { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.energy { font-family: var(--display); font-size: 22px; }
.bolt { margin-right: 4px; }
.meter { height: 10px; background: var(--bg3); border-radius: 5px; overflow: hidden; margin-top: 8px; }
#energyFill { height: 100%; width: 0; background: linear-gradient(90deg, #ff9f0a, var(--gold)); transition: width .2s; }
.cipher-bar { background: var(--bg2); border: 1px solid var(--gold); border-radius: 14px; padding: 10px; text-align: center; font-size: 13px; }
.morse { font-family: var(--display); font-size: 30px; letter-spacing: .15em; min-height: 40px; margin: 6px 0; }
.morse .sym { color: var(--gold); }

/* --- buttons --- */
.btn { background: linear-gradient(180deg, #ff5a4f, var(--red)); color: #fff; font-weight: 800; border-radius: 12px; padding: 12px 18px; }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.big { flex: 1; padding: 16px; font-size: 16px; }
.btn.ghost { background: var(--bg2); border: 1px solid var(--line); }
.btn.gold { background: linear-gradient(180deg, #ffe066, var(--gold)); color: #3a2a00; }
.btn.burn { background: linear-gradient(180deg, #ff7a1a, #e8322b); }
.btn:disabled { opacity: .4; }

/* --- mods --- */
.combo-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.combo-slot { background: var(--bg2); border: 1px dashed var(--line); border-radius: 12px; height: 56px; display: grid; place-items: center; font-size: 11px; text-align: center; padding: 4px; }
.combo-slot.found { border: 1px solid var(--gold); color: var(--gold); }
.cats { display: flex; gap: 4px; background: var(--bg2); border-radius: 12px; padding: 4px; margin-bottom: 12px; overflow-x: auto; }
.cats button { flex: 1; padding: 8px 6px; border-radius: 9px; font-size: 12px; color: var(--dim); white-space: nowrap; }
.cats button.active { background: var(--bg3); color: var(--fg); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: left; display: flex; flex-direction: column; gap: 6px; min-height: 132px; position: relative; }
.card.special { border-color: #6b2a10; background: linear-gradient(180deg, #2a140c, var(--bg2)); }
.card .c-name { font-weight: 700; font-size: 13px; }
.card .c-flavor { font-size: 11px; color: var(--dim); min-height: 28px; }
.card .c-pph { font-size: 11px; color: var(--dim); }
.card .c-pph b { color: var(--fg); }
.card .c-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 6px; font-size: 12px; }
.card .c-price { display: flex; align-items: center; gap: 4px; font-weight: 700; }
.card.locked { opacity: .55; }
.card .lock { font-size: 11px; color: var(--gold); }
.card.poor .c-price { color: var(--dim); }

/* --- lists (friends, tasks, board) --- */
.list { display: flex; flex-direction: column; gap: 8px; }
.task, .perk, .rowitem { display: flex; align-items: center; gap: 12px; background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: left; width: 100%; }
.task > span:first-child, .perk > span:first-child { font-size: 26px; }
.task > div, .perk > div { flex: 1; }
.task i { font-style: normal; color: var(--dim); font-size: 20px; }
.task i.ok { color: var(--green); }
.perk { margin: 8px 0; }
.rowitem .rank { width: 28px; font-family: var(--display); font-size: 20px; color: var(--dim); text-align: center; }
.rowitem .who { flex: 1; min-width: 0; }
.rowitem .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rowitem .score { text-align: right; font-family: var(--display); font-size: 18px; }
.rowitem.me { border-color: var(--gold); }
.hero-coin { display: grid; place-items: center; margin: 12px 0; }
.sticky-cta { position: sticky; bottom: 84px; display: flex; gap: 8px; margin-top: 16px; }

/* --- tabs --- */
.tabs { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 480px; display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(11,11,15,.92); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 5; }
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--dim); padding: 6px 0; border-radius: 10px; }
.tabs button span { font-size: 20px; filter: grayscale(1); }
.tabs button.active { color: var(--fg); background: var(--bg2); }
.tabs button.active span { filter: none; }

/* --- sheet --- */
.sheet-wrap { position: fixed; inset: 0; z-index: 10; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.sheet { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  background: var(--bg2); border-top: 2px solid var(--red); border-radius: 22px 22px 0 0; padding: 26px 18px calc(22px + env(safe-area-inset-bottom)); animation: rise .2s ease-out; }
@keyframes rise { from { transform: translate(-50%, 40px); opacity: 0; } }
.sheet-x { position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border-radius: 50%; background: var(--bg3); color: var(--dim); }
.sheet h3 { font-family: var(--display); font-size: 30px; text-align: center; margin: 4px 0 6px; letter-spacing: .02em; }
.sheet p { text-align: center; color: var(--dim); margin: 6px 0 14px; font-size: 14px; }
.sheet .big-num { display: flex; justify-content: center; align-items: center; gap: 8px; font-family: var(--display); font-size: 40px; margin: 10px 0 16px; }
.sheet .btn { width: 100%; margin-top: 8px; }
.sheet .car-show { width: 280px; margin: 0 auto; }
.cal { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0; }
.cal div { background: var(--bg3); border-radius: 10px; padding: 8px 2px; text-align: center; font-size: 10px; border: 1px solid transparent; }
.cal div b { display: block; font-size: 12px; margin-top: 2px; }
.cal .got { border-color: var(--green); color: var(--green); }
.cal .today { border-color: var(--gold); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; margin: 12px 0; }
.kv dt { color: var(--dim); } .kv dd { margin: 0; word-break: break-all; font-weight: 700; }
.paints { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.paints button { border-radius: 12px; padding: 8px 4px; background: var(--bg3); font-size: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 1px solid transparent; }
.paints button.on { border-color: var(--gold); }
.paints i { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.2); }

.toast { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); background: var(--bg3); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 12px; font-size: 13px; z-index: 20; max-width: calc(100% - 32px); text-align: center; }

.badges { text-align: center; font-size: 18px; margin: 0 0 10px; }
.addr-row { display: flex; gap: 8px; margin-top: 12px; }
.addr-row input { flex: 1; min-width: 0; background: var(--bg3); border: 1px solid var(--line); border-radius: 10px; color: var(--fg); padding: 10px; font: 13px var(--font); -webkit-user-select: text; user-select: text; }
.addr-row .btn { width: auto; margin: 0; }
textarea.hex { width: 100%; height: 80px; background: var(--bg3); color: var(--dim); border: 1px solid var(--line); border-radius: 10px; font: 11px monospace; padding: 8px; -webkit-user-select: text; user-select: text; }
details.manual { margin: 12px 0; font-size: 13px; color: var(--dim); }
details.manual summary { cursor: pointer; text-align: center; }
.morse-chart { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 8px; margin-top: 8px; font-size: 12px; text-align: left; }
.morse-chart b { color: var(--gold); display: inline-block; width: 14px; }
/* Text people need to copy by hand (the page otherwise blocks selection). */
.sel, .kv dd, textarea, input { -webkit-user-select: text; user-select: text; }
.sheet a { color: var(--gold); }
textarea.hex + .btn, textarea.hex { margin-top: 8px; }

/* --- retention features --- */
.goal { text-align: center; font-size: 12px; color: var(--dim); margin: -8px 0 10px; }
.goal b { color: var(--fg); }
.event { text-align: center; font-size: 12px; font-weight: 700; color: #1a1200; background: linear-gradient(90deg, var(--gold), #ff9f0a); border-radius: 10px; padding: 6px; margin-bottom: 10px; }
.daily .count { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font: 700 11px/18px var(--font); font-style: normal; padding: 0 5px; }
.tabs button { position: relative; }
.tabdot { position: absolute; top: 4px; right: calc(50% - 18px); }
.coach { margin-top: 12px; background: linear-gradient(180deg, #2a1f05, var(--bg2)); border: 1px solid var(--gold); border-radius: 14px; padding: 10px 12px; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.coach .c-text { flex: 1; }
.coach .btn { width: auto; margin: 0; }
.card.pulse { animation: pulse 1.2s ease-in-out infinite; border-color: var(--gold); }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(255,214,10,.35); } }
.reel { height: 90px; display: grid; place-items: center; font-size: 56px; margin: 8px 0; }
.reel.spinning { animation: wobble .12s linear infinite; }
@keyframes wobble { 50% { transform: translateY(-4px); } }
.sets { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.set { background: var(--bg3); border-radius: 12px; padding: 10px; }
.set.done { border: 1px solid var(--gold); }
.set h4 { margin: 0 0 6px; font-size: 13px; display: flex; justify-content: space-between; }
.parts-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.part { border-radius: 10px; padding: 6px 4px; text-align: center; font-size: 10px; background: var(--bg2); border: 1px solid var(--line); min-height: 52px; }
.part.common { border-color: #7a7a86; } .part.rare { border-color: #2f8cff; } .part.legend { border-color: var(--gold); }
.part.missing { opacity: .35; }
.part b { display: block; font-size: 16px; }
.r-common { color: #b8b8c4; } .r-rare { color: #5aa8ff; } .r-legend { color: var(--gold); }

/* --- short windows (Telegram Desktop opens at about 384×600) ---
   Fit the tap screen (car + energy) without scrolling, and hide scrollbars that
   eat width on desktop (wheel and touch scrolling still work). */
html, .cats { scrollbar-width: none; }
html::-webkit-scrollbar, .cats::-webkit-scrollbar { display: none; }
@media (max-height: 760px) {
  h1 { font-size: 28px; margin: 4px 0 2px; }
  .lvlbar { margin: 6px 0 8px; }
  .event { padding-top: 6px; padding-bottom: 6px; font-size: 12px; }
  .daily { padding: 6px 4px; font-size: 10px; gap: 2px; }
  .d-ico { font-size: 18px; }
  .balance { font-size: 40px; margin: 8px 0 0; }
  .coin.lg { width: 32px; height: 32px; } .coin.lg::after { font-size: 12px; }
  .small-bal { font-size: 28px; margin: 2px 0 8px; }
  .stage { height: clamp(140px, calc(100vh - 462px), 300px); }
  .car { width: min(380px, 96vw, calc((100vh - 462px) * 1.9)); min-width: 250px; }
}

/* --- weekly prize banner (board) --- */
.prize { background: linear-gradient(180deg, #2a1f05, var(--bg2)); border: 1px solid var(--gold); border-radius: 14px;
  padding: 10px 12px; margin-bottom: 10px; font-size: 12px; line-height: 1.4; display: flex; flex-direction: column; gap: 4px; }
.prize b { color: var(--gold); }

/* --- Race Night pick'em --- */
.race-list { gap: 6px; }
.race-list .rowitem { padding: 6px 8px 6px 10px; gap: 8px; border-radius: 12px; }
.race-list .who b { font-size: 14px; }
.race-list .swatch { width: 14px; height: 14px; border-radius: 4px; flex: none; border: 1px solid rgba(255,255,255,.2); }
.race-pay { display: flex; align-items: center; gap: 8px; flex: none; }
.race-pay .btn { width: auto; margin: 0; padding: 6px 12px; }
.race-pay .picked { color: var(--green); font-weight: 700; padding: 0 6px; }
.race-last { background: var(--bg3); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-size: 13px; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.race-last.won { border-color: var(--green); }
.race-last .btn { width: auto; align-self: flex-start; margin: 0; }
.tag { font-size: 12px; background: var(--gold); color: #1a1200; border-radius: 6px; padding: 2px 6px; vertical-align: middle; }
