:root {
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
    color: #2a2328;
    background: #fff;
    -webkit-text-size-adjust: 100%;
    color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; }
button {
    font: inherit;
    border: 0;
    border-radius: 8px;
    background: #f3f4f6;
    color: #2a2328;
    min-height: 44px;
    padding: 10px 16px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
button:disabled { opacity: .35; }
button:focus-visible, a:focus-visible { outline: 2px solid #855f27; outline-offset: 2px; }
[hidden] { display: none !important; }
.shell {
    height: calc(100dvh - var(--nav-height, 44px));
    padding-bottom: env(safe-area-inset-bottom);
    display: flex;
    flex-direction: column;
}
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #36536d; }
.stage, .stage * {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
canvas { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; }
.hud {
    position: absolute;
    inset: 0 0 auto;
    padding: 0 12px 9px;
    color: #2a2328;
    background: #fff;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}
.hud-row { display: flex; align-items: center; gap: 14px; min-height: 46px; font-size: 13px; }
.score { margin-right: auto; white-space: nowrap; font-size: 12px; }
.score strong { font-size: 19px; font-weight: 750; }
#clock { white-space: nowrap; }
#health { color: #956326; font-size: 13px; letter-spacing: 1px; white-space: nowrap; }
#pause { pointer-events: auto; width: 44px; height: 44px; padding: 0; font-weight: 700; font-size: 18px; }
#objective { margin: 0; color: #6e626a; font-size: 11px; line-height: 1.4; }
.companion { position: absolute; bottom: 0; left: 0; right: 0; padding: 8px 12px 10px; background: #fff; pointer-events: none; }
.pilot { display: flex; align-items: center; gap: 8px; min-height: 48px; }
.pilot img { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; }
.pilot div { min-width: 0; }
.pilot b { display: block; color: #6e626a; font-size: 10px; font-weight: 500; margin-bottom: 3px; }
.pilot span { font-size: 12px; line-height: 1.5; display: block; }
.guide { margin: 7px 0 0; color: #2a2328; font-size: 13px; line-height: 1.5; font-weight: 650; text-align: center; }
.guide.holding { color: #855f27; }
#feedback { position: absolute; top: 88px; right: 12px; width: 172px; text-align: right; pointer-events: none; color: #fff2ce; font-weight: 700; font-size: 17px; min-height: 26px; text-shadow: 0 1px 3px #172d43, 0 0 1px #172d43; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; background: #172d4366; }
.panel { width: min(100%, 322px); max-height: 100%; overflow: auto; overscroll-behavior: contain; background: #fff; border-radius: 12px; padding: 20px; }
.panel h2 { font-size: 19px; margin: 0 0 17px; line-height: 1.4; font-weight: 700; text-align: center; }
.panel-cast { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.portrait { object-fit: contain; width: 64px; height: 64px; flex-shrink: 0; }
.panel-cast div { min-width: 0; }
.panel p { margin: 0; font-size: 13px; line-height: 1.65; }
.panel #eyebrow { color: #6e626a; font-size: 11px; margin-bottom: 3px; }
.panel #message { font-size: 13px; }
#instructions p { font-size: 12px; line-height: 1.8; }
#instructions .rules { color: #6e626a; margin-top: 12px; }
.panel #play { width: 100%; margin-top: 18px; font-weight: 700; }
.panel #best { font-size: 11px; color: #6e626a; margin-top: 10px; text-align: center; }
.panel #storage-note { font-size: 11px; color: #6e626a; margin-top: 6px; text-align: center; }
#result { font-variant-numeric: tabular-nums; text-align: center; font-size: 12px; }
#result strong { display: inline-block; font-size: 25px; font-weight: 700; margin-bottom: 6px; }
.stage:not([data-mode=playing]) .hud, .stage:not([data-mode=playing]) .companion, .stage:not([data-mode=playing]) #feedback { visibility: hidden; }
@media (max-height: 650px) {
    .panel { padding: 16px; }
    .panel h2 { margin-bottom: 12px; }
    .panel-cast { margin-bottom: 12px; }
    .portrait { width: 56px; height: 56px; }
    .companion { padding-top: 5px; padding-bottom: 7px; }
    .guide { margin-top: 4px; }
}
