﻿:root { --green:#4f6b3a; --moss:#6f8a45; --yellow:#e3b93c; --orange:#d9772b; --brown:#6b4f35; --gray:#5d6663; --blue:#4a6f86; --cream:#efe6cc; --ink:#23291f; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin:0; height:100%; overflow:hidden; background:#a9b8bc; font-family: "Trebuchet MS", system-ui, sans-serif; color:var(--ink); touch-action:none; user-select:none; }
canvas#game { position:fixed; inset:0; width:100%; height:100%; display:block; image-rendering:pixelated; }
.hidden { display:none !important; }
#tilt-top, #tilt-bottom { position:fixed; left:0; right:0; height:14%; pointer-events:none; backdrop-filter:blur(2px); z-index:2; }
#tilt-top { top:0; -webkit-mask-image:linear-gradient(#000,transparent); mask-image:linear-gradient(#000,transparent); }
#tilt-bottom { bottom:0; -webkit-mask-image:linear-gradient(transparent,#000); mask-image:linear-gradient(transparent,#000); }
#hud { position:fixed; inset:0; pointer-events:none; z-index:5; }
#hud > * { pointer-events:auto; }
#hud-top { position:absolute; top:calc(8px + env(safe-area-inset-top)); right:10px; display:flex; gap:8px; }
#hud-top button { width:44px; height:44px; font-size:20px; border-radius:12px; border:2px solid var(--ink); background:var(--cream); box-shadow:0 3px 0 var(--ink); }
#hud-top button:active { transform:translateY(2px); box-shadow:0 1px 0 var(--ink); }
#btn-cs-exit { display:none; }
#prompt { position:absolute; left:50%; bottom:150px; transform:translateX(-50%); background:rgba(35,41,31,.85); color:var(--cream); padding:6px 14px; border-radius:16px; font-size:14px; pointer-events:none; display:none; max-width:80vw; text-align:center; }
#notifs { position:absolute; top:calc(140px + env(safe-area-inset-top)); left:10px; display:flex; flex-direction:column; gap:6px; max-width:min(340px,60vw); }
.notif { background:var(--cream); border:2px solid var(--ink); border-left:8px solid var(--yellow); border-radius:10px; padding:6px 10px; font-size:13px; box-shadow:0 3px 0 rgba(0,0,0,.35); cursor:pointer; animation:pop .25s; }
.notif.news { border-left-color:var(--blue); } .notif.decision { border-left-color:var(--orange); } .notif.chat { border-left-color:var(--moss); }
@keyframes pop { from { transform:translateX(-30px); opacity:0; } }
/* white controller style */
.pad { position:absolute; left:calc(14px + env(safe-area-inset-left)); bottom:calc(14px + env(safe-area-inset-bottom)); width:132px; height:132px; display:grid; grid-template-columns:repeat(3,1fr); grid-template-rows:repeat(3,1fr); background:#f4f4f0; border:3px solid #cfcfc6; border-radius:50%; box-shadow:0 5px 0 #b9b9ae, inset 0 0 12px #fff; padding:6px; opacity:.93; }
.pad .d { border:0; background:transparent; font-size:16px; color:#555; padding:0; }
.pad .dn, .pad .ds, .pad .dw, .pad .de { background:#e7e7df; border-radius:8px; margin:1px; box-shadow:0 2px 0 #b9b9ae; }
.pad .d.on { background:var(--yellow); }
#abtns { position:absolute; right:calc(14px + env(safe-area-inset-right)); bottom:calc(14px + env(safe-area-inset-bottom)); width:150px; height:150px; }
.ab { position:absolute; width:62px; height:62px; border-radius:50%; border:3px solid #cfcfc6; background:#f4f4f0; font-size:26px; box-shadow:0 5px 0 #b9b9ae; padding:0; }
.ab:active, .ab.on { transform:translateY(3px); box-shadow:0 2px 0 #b9b9ae; background:#fff3c4; }
.a1 { left:0; top:44px; } .a2 { left:44px; top:0; } .a3 { right:0; top:44px; } .a4 { left:44px; bottom:0; }
/* overlays/cards */
.overlay { position:fixed; inset:0; z-index:20; display:flex; align-items:center; justify-content:center; background:rgba(40,50,40,.55); padding:10px; }
#intro { background:radial-gradient(circle at 50% 30%, #fff1a8, #e3b93c 55%, #c98a1e 100%); }
.card { background:var(--cream); border:3px solid var(--ink); border-radius:16px; padding:18px 22px; max-width:640px; width:100%; max-height:94vh; overflow:auto; box-shadow:0 8px 0 rgba(0,0,0,.35); touch-action:pan-y; user-select:text; }
.intro { text-align:center; }
.intro h1 { margin:4px 0 0; font-size:38px; letter-spacing:1px; color:var(--green); }
.slogan { margin:0 0 8px; color:var(--orange); font-style:italic; }
#intro-logo svg { width:110px; height:110px; }
.controls-info { background:#e0d7b8; border-radius:10px; padding:8px; font-size:13px; margin:10px 0; }
kbd { background:#fff; border:1px solid #999; border-radius:4px; padding:0 5px; font-size:12px; }
.row { display:flex; gap:10px; justify-content:center; flex-wrap:wrap; margin:8px 0; }
button.big, button.btn { font:inherit; font-weight:bold; padding:10px 22px; border-radius:12px; border:2px solid var(--ink); background:var(--yellow); color:var(--ink); -webkit-text-fill-color:var(--ink); box-shadow:0 4px 0 var(--ink); cursor:pointer; }
button.big.alt, button.btn.alt { background:#587342; color:#fff; -webkit-text-fill-color:#fff; }
button.btn { padding:6px 12px; font-size:13px; } button.btn.warn { background:#f0a35a; color:var(--ink); -webkit-text-fill-color:var(--ink); }
button:disabled { opacity:.5; }
.credit, .small { font-size:12px; color:#555; } a { color:var(--blue); }
/* dialogue & venue */
.say { background:#fff; border:2px solid var(--ink); border-radius:12px; padding:8px 12px; margin:6px 0; }
.say.me { background:#dfe9c8; margin-left:30px; } .say b { color:var(--green); }
.menu-items { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:10px; }
.menu-item { background:#fff; border:2px solid var(--ink); border-radius:12px; padding:8px; text-align:center; cursor:pointer; }
.menu-item img { width:100%; height:110px; object-fit:contain; }
/* phone */
#phone { position:fixed; z-index:30; right:12px; bottom:12px; top:12px; width:min(380px,calc(100vw - 24px)); background:#1d221c; border-radius:36px; border:4px solid #0d100c; padding:14px 10px 18px; display:flex; flex-direction:column; box-shadow:0 12px 40px rgba(0,0,0,.6); animation:rise .25s; }
@keyframes rise { from { transform:translateY(60px); opacity:0; } }
/* Ask AI app: elaborate "no AI" spinner */
.orb-wrap { display:flex; flex-direction:column; align-items:center; margin:14px 0 6px; }
.orb { position:relative; width:150px; height:150px; }
.orb-wrap.small { margin:6px 0; } .orb-wrap.small .orb { width:44px; height:44px; }
.orb .ring { position:absolute; inset:0; border-radius:50%; border:4px solid transparent; }
.orb .r1 { border-top-color:var(--orange); border-right-color:var(--orange); animation:orbspin 1.6s linear infinite; }
.orb .r2 { inset:14%; border-bottom-color:var(--green); border-left-color:var(--green); animation:orbspin 2.4s linear infinite reverse; }
.orb .r3 { inset:28%; border-top-color:var(--blue); border-bottom-color:var(--blue); animation:orbspin 1.1s linear infinite; }
.orb .orbit { position:absolute; inset:0; }
.orb .orbit i { position:absolute; top:-3px; left:calc(50% - 6px); width:12px; height:12px; border-radius:50%; background:#e3b93c; box-shadow:0 0 10px #e3b93c; }
.orb .o1 { animation:orbspin 3.2s linear infinite; }
.orb .o2 { inset:10%; animation:orbspin 4.6s linear infinite reverse; } .orb .o2 i { background:#6f8f4e; box-shadow:0 0 10px #6f8f4e; }
.orb .o3 { inset:22%; animation:orbspin 2.1s linear infinite; } .orb .o3 i { background:#d9772b; box-shadow:0 0 10px #d9772b; width:9px; height:9px; }
.orb .core { position:absolute; inset:36%; display:flex; align-items:center; justify-content:center; font-size:30px; border-radius:50%; background:#fff; border:2px solid var(--ink); animation:orbpulse 1.8s ease-in-out infinite; }
.orb-wrap.small .core { font-size:12px; } .orb-wrap.small .ring, .orb-wrap.small .orbit { display:none; } .orb-wrap.small .core { inset:0; }
.orb-cap { margin-top:10px; font-style:italic; text-align:center; min-height:2.4em; }
.mapwrap { border-radius:10px; overflow:hidden; border:2px solid #2b2f2a; }
.mapsvg { width:100%; display:block; }
.mapsvg .mt { font:bold 6px sans-serif; fill:#2b2f2a; paint-order:stroke; stroke:#fff8; stroke-width:1.2px; }
@keyframes orbspin { to { transform:rotate(360deg); } }
@keyframes orbpulse { 50% { transform:scale(1.18); } }
#phone .screen { flex:1; overflow:auto; background:var(--cream); border-radius:22px; padding:10px; touch-action:pan-y; user-select:text; }
#phone .bar { display:flex; justify-content:space-between; color:#ccc; font-size:11px; padding:0 14px 6px; }
#phone .bar { align-items:center; }
#phone .ph-title { display:flex; align-items:center; gap:8px; }
#phone .ph-logo { width:28px; height:28px; display:inline-block; }
#phone .ph-logo svg { width:100%; height:100%; }
#phone .ph-x { background:#3a4238; color:#eee; border:0; border-radius:14px; padding:0 12px; height:28px; font-size:13px; font-weight:600; line-height:1; cursor:pointer; }
#phone .ph-x:hover { background:#d9772b; }
#phone .ph-btns { display:flex; align-items:center; gap:8px; }
#phone .ph-live { width:28px; height:28px; border-radius:50%; border:1px solid #4a5346; background:transparent; color:#aab3a6; font-size:12px; line-height:1; cursor:pointer; opacity:.7; }
#phone .ph-live:hover, #phone .ph-live.on { opacity:1; background:#3a4238; color:#fff; }
#phone .ph-live.on { border-color:#8fbf6a; }
#phone .home { align-self:center; margin-top:8px; width:90px; height:8px; border-radius:6px; background:#555; border:0; }
#phone .ph-foot { position:relative; display:flex; justify-content:center; align-items:center; }
#phone .ph-shot { position:absolute; right:14px; bottom:-4px; width:16px; height:16px; border-radius:4px; border:1px solid #444; background:#3a3d3a; color:#777; font-size:8px; line-height:1; padding:0; opacity:.45; cursor:pointer; }
#phone .ph-shot:hover { opacity:1; background:#555; }
#phone .ph-shot::after { content:''; position:absolute; inset:-14px; }
.apps { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; padding:10px 4px; }
.app { background:#fff; border:2px solid var(--ink); border-radius:16px; padding:10px 2px; text-align:center; font-size:12px; cursor:pointer; }
.app span { display:block; font-size:30px; }
.tabs { display:flex; flex-wrap:wrap; gap:4px; margin-bottom:8px; }
.tabs button { font:inherit; font-size:12px; padding:4px 8px; border:2px solid var(--ink); border-radius:8px; background:#e0d7b8; }
.tabs button.on { background:var(--yellow); }
.kv { display:flex; justify-content:space-between; border-bottom:1px dotted #aaa; padding:2px 0; font-size:13px; }
.bizcard { background:#fff; border:2px solid var(--ink); border-radius:10px; padding:6px 8px; margin:6px 0; font-size:13px; }
.bizcard h4 { margin:0 0 4px; } .tag { background:var(--moss); color:#fff; border-radius:6px; padding:0 5px; font-size:11px; }
.tag.bad { background:var(--orange); }
input, select, textarea { font:inherit; padding:4px 6px; border:2px solid var(--ink); border-radius:8px; max-width:100%; }
.diary { display:grid; grid-template-columns:repeat(2,1fr); gap:8px; } .diary img { width:100%; height:80px; object-fit:contain; background:#fff; border-radius:8px; }
#shot-box img, #shot-box canvas { max-width:100%; border:2px solid var(--ink); margin-top:8px; }
@media (max-width:700px) { .pad { width:116px; height:116px; } #abtns { width:136px; height:136px; } .ab { width:56px; height:56px; } .a1 { top:40px; } .a3 { top:40px; } .a2, .a4 { left:40px; } }
@media print {
  body > *:not(#print-sheet) { display:none !important; }
  #print-sheet { display:block !important; position:static; color:#000; background:#fff; font-family:Georgia,serif; padding:20px; }
  html, body { overflow:visible; height:auto; }
}
#print-sheet { display:none; }

/* ---- racing HUD ---- */
#race-hud { position:absolute; top:calc(8px + env(safe-area-inset-top)); left:10px; display:grid; grid-template-columns:auto auto; gap:2px 12px; background:rgba(35,41,31,.82); color:var(--cream); padding:8px 12px; border-radius:14px; font-weight:bold; pointer-events:none; min-width:150px; }
#race-hud.hidden { display:none; }
#rh-pos { font-size:26px; } #rh-time { font-size:18px; align-self:center; text-align:right; font-variant-numeric:tabular-nums; }
#rh-speed { font-size:15px; } #rh-boost { font-size:15px; text-align:right; }
#rh-bar { grid-column:1 / 3; position:relative; height:8px; margin-top:4px; background:#5b6150; border-radius:4px; }
#rh-bar i { position:absolute; top:-3px; width:14px; height:14px; margin-left:-7px; border-radius:50%; border:2px solid var(--ink); }
#rh-me { background:#e3b93c; z-index:2; } #rh-ai { background:#7fe9ff; }
#countdown { position:absolute; left:50%; top:32%; transform:translate(-50%,-50%); font-size:min(24vw,150px); font-weight:bold; color:#fff6dc; -webkit-text-stroke:4px var(--ink); paint-order:stroke fill; pointer-events:none; text-shadow:0 6px 0 rgba(0,0,0,.35); }
.select-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px; margin:8px 0; }
.opt { border:3px solid var(--ink); border-radius:12px; padding:8px; background:#fff; text-align:left; font:inherit; color:var(--ink); cursor:pointer; }
.opt.sel { background:#fff3c4; box-shadow:0 0 0 3px #d9772b; }
.opt.locked { opacity:.55; cursor:not-allowed; }
.opt small { display:block; opacity:.8; }
.split { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.split > div { min-width:0; }
.split .chat { max-height:46vh; overflow:auto; }
@media (max-width:700px) { .split { grid-template-columns:1fr; } #race-hud { min-width:130px; } }
