* { box-sizing: border-box; }
body {
    margin: 0;
    background: #fff;
    color: #2a2328;
    font: 14px -apple-system, BlinkMacSystemFont, 'Hiragino Sans', sans-serif;
}
main {
    max-width: 450px;
    height: calc(100svh - var(--nav-height, 52px));
    margin: auto;
    display: flex;
    flex-direction: column;
}
.stage {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: #193d35;
    isolation: isolate;
}
#field {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    user-select: none;
}
#trail {
    fill: none;
    stroke: #fff3b5;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}
.hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background: #fff;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}
.hud small { display: block; color: #6e626a; font-size: 11px; }
.hud strong { font-size: 22px; line-height: 1.3; }
button, a { -webkit-tap-highlight-color: transparent; }
button {
    font: inherit;
    color: #2a2328;
    border: 0;
    border-radius: 8px;
    background: #f3f4f6;
    touch-action: manipulation;
    cursor: pointer;
}
.hud button { pointer-events: auto; width: 44px; height: 44px; font-size: 20px; }
.guide {
    position: absolute;
    top: 68px;
    width: 100%;
    text-align: center;
    color: #dce6df;
    font-size: 12px;
    pointer-events: none;
}
#overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 16px;
    background: #102b26b8;
}
#overlay[hidden] { display: none; }
.stage:has(#overlay:not([hidden])) :is(#field, .hud, .guide) { visibility: hidden; }
main:has(#overlay:not([hidden])) .buddy { display: none; }
.panel {
    width: min(100%, 330px);
    max-height: 100%;
    overflow: auto;
    overscroll-behavior: contain;
    text-align: center;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
}
.panel-cast { display: flex; align-items: center; justify-content: center; gap: 10px; }
.panel-cast img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.name { color: #6e626a; font-size: 12px; margin: 0; }
h2 { font-size: 21px; margin: 16px 0 8px; }
#message { line-height: 1.6; margin: 8px 0 12px; }
#rules { font-size: 13px; line-height: 1.8; color: #6e626a; margin: 0 0 16px; }
.gold { color: #8b600b; font-weight: 600; }
#play { width: 100%; min-height: 48px; font-weight: 700; font-size: 16px; }
#best { font-size: 12px; color: #6e626a; margin: 12px 0 0; }
#storage { font-size: 12px; color: #915000; margin: 8px 0 0; }
#storage:empty { display: none; }
.buddy { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 64px; flex-shrink: 0; background: #fff; }
.buddy img { width: 48px; height: 48px; flex-shrink: 0; border-radius: 8px; object-fit: cover; }
.buddy b { color: #6e626a; font-weight: 500; font-size: 11px; }
.buddy p { margin: 4px 0 0; font-size: 13px; line-height: 1.4; }
#summary { white-space: pre-line; margin: 12px 0 16px; line-height: 1.8; font-size: 13px; font-weight: 500; }
#summary::first-line { font-size: 24px; font-weight: 700; }
button:focus-visible { outline: 3px solid #cd9e3a; outline-offset: 2px; }
@media (max-width: 340px) {
    .panel { padding: 16px; }
    h2 { font-size: 20px; }
}
