:root {
    color-scheme: dark;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
    background: #080c15;
    color: #f5f5fb;
    -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin: 0; --accent: #65dfed; --cast-accent: #ff91c9; --surface: #152637; }
body[data-mini=block] { --accent: #8ee6bb; --surface: #15352e; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; touch-action: manipulation; cursor: pointer; color: inherit; border: 1px solid #77879b; background: #1c293d; border-radius: 12px; }
button:focus-visible, a:focus-visible, canvas:focus-visible { outline: 3px solid #ffe4a7; outline-offset: -3px; }
button:disabled { opacity: .4; cursor: default; }
button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.mini-shell {
    max-width: 450px;
    margin: 0 auto;
    height: calc(100svh - var(--nav-height, 88px));
    height: calc(100dvh - var(--nav-height, 88px));
    min-height: 360px;
    padding: 3px 5px max(4px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
}
.mini-stage {
    position: relative;
    min-height: 0;
    flex: 1;
    border: 1px solid #b6a079;
    border-radius: 18px 18px 0 0;
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 0 0 1px #0008, inset 0 0 0 3px #e5d5a80b;
}
.mini-canvas { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; }
.mini-hud {
    position: absolute;
    z-index: 2;
    inset: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 43px;
    padding: 4px 7px;
    background: linear-gradient(180deg, #0c1426f5, #0c1426d9 70%, #0c142600);
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}
.mini-hud > span { display: flex; align-items: center; gap: 6px; font-size: 18px; font-weight: 800; }
.mini-hud > span:first-child { min-width: 76px; padding: 4px 10px; border: 1px solid #dbc18738; border-radius: 10px; background: #101b2cc9; box-shadow: inset 0 1px #ffffff0d; }
.mini-hud .score-symbol { color: #f1d39a; font-size: 16px; }
.mini-hud strong { color: #ffedca; letter-spacing: -.03em; }
.mini-time { margin-left: auto; color: #d1e1ed; font-size: 12px !important; letter-spacing: .03em; }
.mini-hud button { pointer-events: auto; width: 38px; height: 34px; display: grid; place-items: center; border-color: #b1c7e333; border-radius: 10px; background: #18263b; box-shadow: inset 0 1px #ffffff12, 0 2px 4px #0003; }
.mini-buddy {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 65px;
    flex-shrink: 0;
    padding: 0 9px;
    background: linear-gradient(115deg, var(--surface), #101725 88%);
    border: 1px solid #b6a079;
    border-top-color: #c4d8ed20;
    border-radius: 0 0 18px 18px;
}
.buddy-portrait { align-self: flex-end; flex-shrink: 0; width: 70px; height: 68px; object-fit: contain; margin-top: -5px; pointer-events: none; filter: drop-shadow(0 2px 4px #0005); }
.buddy-talk { min-width: 0; margin-right: auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 7px 10px; border: 1px solid #d2dbea15; border-radius: 11px 11px 11px 3px; background: #ffffff06; color: #e9edf5; font-size: 12px; line-height: 1.4; }
.buddy-badge { color: #dec79b; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; padding: 5px 6px; border-radius: 7px; background: #080d1666; }
.mini-overlay { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 14px; background: #050912ab; backdrop-filter: blur(7px); }
.mini-panel {
    position: relative;
    width: min(100%, 310px);
    max-height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 18px 16px;
    border: 1px solid #e0c68c85;
    border-radius: 26px;
    background: radial-gradient(ellipse at 50% 0, var(--surface), #111927 78%);
    box-shadow: inset 0 1px #fff4, inset 0 0 0 4px #f4dd9d05, 0 18px 50px #0008;
}
.mini-panel > * { flex-shrink: 0; }
.mini-hero {
    position: relative;
    display: grid;
    place-items: center;
    width: 174px;
    height: 166px;
    isolation: isolate;
    background: radial-gradient(ellipse, color-mix(in srgb, var(--cast-accent) 20%, transparent), transparent 68%);
}
.mini-hero::before { content: ''; position: absolute; z-index: -1; width: 132px; height: 132px; border: 1px solid #e9d5a35c; border-radius: 50%; box-shadow: 0 0 0 9px #f0dfb207, 0 0 0 10px #e5d8af19; }
.mini-hero::after { content: '✦'; position: absolute; right: 3px; top: 22px; color: #edd49e; font-size: 19px; text-shadow: -145px 92px #c7bd9f66; }
.panel-portrait { width: 160px; height: 160px; object-fit: contain; filter: drop-shadow(0 6px 8px #0005); }
.mini-message { margin: 0; min-height: 28px; color: #ffe2a5; font-size: 32px; font-weight: 850; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.mini-hint { margin: 0; color: #c0cadc; font-size: 12px; text-align: center; line-height: 1.6; }
.cast-picker { display: flex; gap: 10px; padding: 3px; }
.cast-choice { position: relative; width: 50px; height: 50px; padding: 3px; border-color: #8390aa50; border-radius: 15px; background: linear-gradient(145deg, #ffffff14, #0d162b); box-shadow: inset 0 1px #ffffff15; }
.cast-choice[aria-pressed=true] { border-color: #ffe3a0; background: linear-gradient(145deg, #8a694054, #322c31); box-shadow: 0 0 0 2px #e7c78420, inset 0 1px #fff5; }
.cast-choice[aria-pressed=true]::after { content: ''; position: absolute; width: 5px; height: 5px; left: calc(50% - 2px); bottom: -7px; border-radius: 50%; background: #ffe3a0; }
.cast-choice img { display: block; width: 100%; height: 100%; object-fit: contain; }
.mini-play { display: grid; place-items: center; width: 78px; height: 54px; margin-top: 1px; border-color: #fff0be; border-radius: 17px; color: #302720; background: linear-gradient(145deg, #ffedbc, #d8ad64); box-shadow: inset 0 1px #fff9, 0 4px #785a32, 0 8px 18px #0004; }
.mini-play svg { width: 26px; height: 26px; fill: currentColor; stroke: none; }
.mini-play:active { transform: translateY(2px); box-shadow: inset 0 1px #fff7, 0 2px #785a32; }
.mini-best { margin: 0; color: #96a8c0; font-size: 10px; font-weight: 650; letter-spacing: .1em; }
.mini-next { display: grid; place-items: center; min-height: 32px; padding: 0 12px; color: #d8d9e4; font-size: 12px; text-decoration: none; border-bottom: 1px solid #d8d9e433; }
.mini-controls { display: flex; flex-shrink: 0; gap: 7px; margin-left: auto; }
.mini-controls button { width: 47px; height: 45px; border-radius: 13px; font-size: 20px; touch-action: none; border-color: #9eb7ce55; background: linear-gradient(#34465e, #1d2c43); box-shadow: inset 0 1px #ffffff26, 0 3px #0b1322; }
.mini-controls button:active { transform: translateY(2px); background: #49617c; box-shadow: 0 1px #0b1322; }
.mini-controls button:last-child { margin-left: 3px; color: #ffe8b1; border-color: #d8bb8170; background: linear-gradient(#716047, #493c2e); }
.buddy-react { animation: buddy-cheer .3s ease-out; }
@keyframes buddy-cheer { 50% { transform: translateY(-6px) rotate(-4deg); } }
@media(max-height:740px) {
    .mini-panel { gap: 10px; padding: 14px; }
    .mini-hero { width: 144px; height: 126px; }
    .mini-hero::before { width: 105px; height: 105px; }
    .panel-portrait { width: 125px; height: 125px; }
}
@media(max-height:650px) {
    .mini-buddy { height: 53px; }
    .buddy-portrait { width: 56px; height: 56px; }
    .buddy-talk { font-size: 11px; padding: 5px 7px; }
    .mini-panel { gap: 8px; padding: 12px; }
    .mini-hero { width: 125px; height: 102px; }
    .mini-hero::before { width: 85px; height: 85px; }
    .mini-hero::after { right: 0; top: 10px; font-size: 14px; text-shadow: -103px 60px #c7bd9f66; }
    .panel-portrait { width: 100px; height: 100px; }
    .mini-controls button { width: 43px; height: 42px; }
    .cast-choice { width: 46px; height: 46px; }
}
@media(prefers-reduced-motion:reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .panel-portrait, .buddy-portrait { filter: none; }
    .mini-overlay { backdrop-filter: none; }
    .mini-play:active, .mini-controls button:active { transform: none; }
}

/* Keep the expanded cast roster within the play panel. */
.cast-picker { min-width: 0; max-width: 100%; overflow-x: auto; padding-bottom: 10px; }
.cast-picker > button { flex-shrink: 0; }
