:root {
    color-scheme: dark;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
    background: #070a14;
    color: #f8f9fa;
    -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    --gold: #ffd166;
    --gold-deep: #b8860b;
    --cast-accent: #ff91c9;
    --surface: #141c30;
    background: radial-gradient(circle at 50% 15%, #1c1632, #070a14 75%);
}
button, a { -webkit-tap-highlight-color: transparent; }
button {
    font: inherit;
    touch-action: manipulation;
    cursor: pointer;
    color: inherit;
    border: 1px solid #b89852;
    background: #1a243b;
    border-radius: 12px;
}
button:focus-visible, a:focus-visible, canvas:focus-visible {
    outline: 3px solid #ffe49e;
    outline-offset: -3px;
}
button:disabled { opacity: 0.45; cursor: default; }
button svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
[hidden] { display: none !important; }

.strike-shell {
    max-width: 450px;
    margin: 0 auto;
    height: calc(100svh - var(--nav-height, 88px));
    height: calc(100dvh - var(--nav-height, 88px));
    min-height: 380px;
    padding: 3px 5px max(4px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
}

.strike-stage {
    position: relative;
    min-height: 0;
    flex: 1;
    border: 1.5px solid #d4af37;
    border-radius: 18px 18px 0 0;
    overflow: hidden;
    background: #090d1a;
    box-shadow: 0 0 18px #000b, inset 0 0 0 2px #ffd16622;
}

.strike-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    user-select: none;
}

.strike-hud {
    position: absolute;
    z-index: 2;
    inset: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 40px;
    padding: 4px 8px;
    background: linear-gradient(180deg, #070b18f2, #070b18a8 72%, transparent);
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

.hud-score {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 78px;
    padding: 3px 10px;
    border: 1px solid #ffd16655;
    border-radius: 10px;
    background: #0f182be0;
    box-shadow: inset 0 1px #ffffff1c;
    font-size: 17px;
    font-weight: 800;
}
.hud-score .score-symbol { color: #ffd166; font-size: 15px; }
.hud-score strong { color: #fff1c2; }

.hud-wave {
    margin-left: auto;
    padding: 3px 10px;
    border: 1px solid #ffd16666;
    border-radius: 999px;
    background: linear-gradient(135deg, #3a230a, #191326);
    color: #ffd166;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.06em;
}

.strike-hud button {
    pointer-events: auto;
    width: 36px;
    height: 32px;
    display: grid;
    place-items: center;
    border-color: #ffd16655;
    border-radius: 10px;
    background: #162238;
}

/* Gold-framed Strike Shot Cut-in */
.cutin-banner {
    position: absolute;
    z-index: 3;
    left: 8px;
    right: 8px;
    top: 28%;
    pointer-events: none;
    animation: cutin-slide 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}
.cutin-frame {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border: 2px solid #ffe599;
    border-radius: 18px;
    background: linear-gradient(125deg, #3d0e1e 0%, #6b4c08 48%, #1a1228 100%);
    box-shadow: 0 0 0 2px #b8860b, 0 0 28px #ffd166cc, inset 0 1px 0 #ffffff88;
}
.cutin-portrait {
    width: 82px;
    height: 82px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid #ffd166;
    background: radial-gradient(circle, #ffd16644, #120d1d);
}
.cutin-copy {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.cutin-skill {
    color: #ffffff;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 8px #b8860b;
}
.cutin-line {
    color: #ffefc2;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes cutin-slide {
    from { opacity: 0; transform: scale(0.88) translateX(-24px); }
    to { opacity: 1; transform: scale(1) translateX(0); }
}

.strike-cockpit {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 58px;
    flex-shrink: 0;
    padding: 0 8px;
    background: linear-gradient(115deg, #1a233a, #0e1322 88%);
    border: 1.5px solid #d4af37;
    border-top-color: #ffd16633;
    border-radius: 0 0 18px 18px;
}

.buddy-portrait {
    width: 56px;
    height: 56px;
    object-fit: contain;
    flex-shrink: 0;
    pointer-events: none;
    filter: drop-shadow(0 2px 4px #0008);
}

.buddy-status { min-width: 0; flex: 1; }
.turn-preview {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 22px;
    color: #ffe599;
    font-size: 10px;
    white-space: nowrap;
}
.turn-current { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.turn-preview > span:not(.turn-current), .turn-preview img { flex-shrink: 0; }
.turn-preview img { width: 20px; height: 20px; object-fit: contain; border-radius: 50%; }
.buddy-talk {
    display: block;
    min-width: 0;
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    padding: 3px 6px;
    border: 1px solid #ffd16630;
    border-radius: 10px 10px 10px 3px;
    background: #ffffff09;
    color: #f1f5f9;
    font-size: 12px;
    font-weight: 700;
}

.strike-skill-btn {
    position: relative;
    flex-shrink: 0;
    min-width: 68px;
    height: 44px;
    padding: 4px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 1.5px solid #ffd16688;
    border-radius: 13px;
    background: linear-gradient(145deg, #2b3550, #161d2f);
    color: #e2e8f0;
}
.strike-skill-btn:not(:disabled) {
    border-color: #fff0b3;
    background: linear-gradient(145deg, #ffdf73, #c98a14);
    color: #261700;
    box-shadow: 0 0 14px #ffd16688, inset 0 1px #fff9;
}
.strike-skill-btn[aria-pressed="true"] {
    border-color: #ffffff;
    background: linear-gradient(145deg, #fff3b0, #ff9f1c);
    box-shadow: 0 0 20px #ffd166, inset 0 1px #fff;
}
.skill-label {
    font-size: 13px;
    line-height: 1;
}
.skill-meter {
    font-size: 13px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.strike-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-items: center;
    padding: 12px;
    background: #050811bf;
    backdrop-filter: blur(6px);
}

.strike-panel {
    width: min(100%, 304px);
    max-height: 100%;
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px 14px;
    border: 1.5px solid #ffd166aa;
    border-radius: 24px;
    background: radial-gradient(ellipse at 50% 0%, #2a1f3d, #0f1626 78%);
    box-shadow: inset 0 1px #fff5, 0 16px 42px #000b;
}

.strike-hero {
    position: relative;
    display: grid;
    place-items: center;
    width: 152px;
    height: 144px;
    background: radial-gradient(circle, color-mix(in srgb, var(--cast-accent) 30%, transparent), transparent 70%);
}
.strike-hero::before {
    content: "";
    position: absolute;
    width: 122px;
    height: 122px;
    border: 1.5px solid #ffd16688;
    border-radius: 50%;
    box-shadow: 0 0 20px #ffd16628;
}
.panel-portrait {
    width: 142px;
    height: 142px;
    object-fit: contain;
    position: relative;
    filter: drop-shadow(0 6px 10px #0007);
}

.panel-status {
    margin: 0;
    color: #ffe599;
    font-size: 14px;
    font-weight: 800;
    text-align: center;
}

.strike-message {
    margin: 0;
    color: #ffd166;
    font-size: 30px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.cast-picker {
    display: flex;
    gap: 10px;
}
.cast-choice {
    width: 50px;
    height: 50px;
    padding: 3px;
    border-radius: 15px;
    border: 1px solid #8a99b555;
    background: linear-gradient(145deg, #ffffff18, #0d1528);
}
.cast-choice[aria-pressed="true"] {
    border-color: #ffd166;
    background: linear-gradient(145deg, #9c732266, #2d2330);
    box-shadow: 0 0 0 2px #ffd16655;
}
.cast-choice img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.strike-hint {
    margin: 0;
    color: #cbd5e1;
    font-size: 11px;
    text-align: center;
}

.run-summary {
    margin: 0;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px;
    border: 1px solid #ffd16640;
    border-radius: 14px;
    background: #090e1c99;
    text-align: center;
}
.run-summary div { display: flex; flex-direction: column; gap: 2px; }
.run-summary dt { font-size: 10px; color: #94a3b8; }
.run-summary dd { margin: 0; font-size: 14px; font-weight: 800; color: #ffe599; }

.strike-play {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 136px;
    height: 48px;
    padding: 0 18px;
    border-color: #fff2bd;
    border-radius: 16px;
    color: #291b02;
    font-weight: 900;
    background: linear-gradient(145deg, #ffefad, #d69e2e);
    box-shadow: inset 0 1px #fff9, 0 4px #785312, 0 8px 18px #0006;
}
.strike-play svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }

.strike-best {
    margin: 0;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
}

@media (max-height: 680px) {
    .strike-hero { width: 118px; height: 112px; }
    .strike-hero::before { width: 94px; height: 94px; }
    .panel-portrait { width: 108px; height: 108px; }
    .strike-cockpit { height: 52px; }
    .buddy-portrait { width: 48px; height: 48px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .strike-overlay { backdrop-filter: 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; }
