/* Dusk over a floating stone board: deep blue ground with the four elements as
   the only saturated colour on the screen, so an aura reads at a glance. */
:root {
    --bg: #0d1420;
    --panel: #16203040;
    --panel-solid: #172131;
    --line: #2a3648;
    --ink: #eaf1fb;
    --muted: #8ea1bb;
    --gold: #ffcf6b;
    --fire: #ff7a4d;
    --water: #4fc3f7;
    --wind: #6fe0a8;
    --thunder: #c08bff;
    --foe: #ff5c7a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0; padding: 0; height: 100%; overflow: hidden;
    background: var(--bg); color: var(--ink);
    font-family: 'PingFang SC', 'Hiragino Sans', 'Microsoft YaHei', system-ui, sans-serif;
    user-select: none; -webkit-user-select: none;
}

.shell {
    display: flex; flex-direction: column; height: 100%;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 2px; }
.toolbar-spacer { flex: 1; }
.icon-btn {
    min-width: 40px; height: 38px; padding: 0 10px;
    display: flex; align-items: center; justify-content: center;
    border: 0; border-radius: 12px; background: rgba(255, 255, 255, 0.08);
    color: var(--ink); font-size: 17px; text-decoration: none; cursor: pointer;
    font-family: inherit;
}
.icon-btn:active { background: rgba(255, 255, 255, 0.16); }
.icon-btn-text { font-size: 13px; font-weight: 700; }

.hud { display: flex; justify-content: space-around; gap: 6px; padding: 4px 12px 6px; }
.hud span { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.hud b { font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud i { font-size: 10px; font-style: normal; color: var(--muted); letter-spacing: 0.1em; }
#foeValue { color: var(--foe); }

.stage-area {
    flex: 1; min-height: 0; position: relative;
    display: flex; align-items: center; justify-content: center; padding: 0 8px;
}
#board { display: block; touch-action: manipulation; border-radius: 14px; }

/* The reaction shout. Anime games put it right across the middle and so does
   this: it is the one thing that must not be missed. */
.banner {
    position: absolute; left: 0; right: 0; top: 38%;
    text-align: center; pointer-events: none;
    font-size: 30px; font-weight: 900; letter-spacing: 0.16em;
    opacity: 0; transform: scale(0.7);
}
.banner.is-on { animation: shout 0.9s ease-out; }
@keyframes shout {
    0% { opacity: 0; transform: scale(0.6) rotate(-4deg); }
    18% { opacity: 1; transform: scale(1.12) rotate(-2deg); }
    70% { opacity: 1; transform: scale(1) rotate(0deg); }
    100% { opacity: 0; transform: scale(1.05); }
}

.dock { padding: 6px 10px 10px; }
.who {
    display: flex; align-items: center; gap: 8px;
    padding: 5px 10px; margin-bottom: 6px;
    border-radius: 11px; background: rgba(255, 255, 255, 0.05);
    min-height: 30px;
}
.who-name { font-size: 13.5px; font-weight: 700; }
.who-hp { flex: 1; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.who-hp i { display: block; height: 100%; width: 0; background: var(--wind); transition: width 0.25s; }
.who-num { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.acts { display: flex; gap: 7px; }
.act {
    flex: 1; padding: 11px 6px; border: 1px solid var(--line); border-radius: 12px;
    background: rgba(255, 255, 255, 0.05); color: var(--ink);
    font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.act i { font-size: 10px; font-style: normal; color: var(--muted); }
.act:active { background: rgba(255, 255, 255, 0.14); }
.act[disabled] { opacity: 0.32; }
.act-end { flex: 0 0 32%; background: rgba(255, 207, 107, 0.14); border-color: rgba(255, 207, 107, 0.4); color: var(--gold); }

.overlay {
    position: fixed; inset: 0; display: none;
    align-items: center; justify-content: center; padding: 20px;
    background: rgba(6, 10, 18, 0.9); backdrop-filter: blur(6px); z-index: 20;
}
.overlay.is-open { display: flex; }
.panel {
    width: 100%; max-width: 430px; max-height: 88vh; overflow-y: auto;
    padding: 24px 22px; border-radius: 20px; text-align: center;
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(79, 195, 247, 0.2), transparent 62%),
        var(--panel-solid);
    border: 1px solid var(--line);
}
.kicker { margin: 0 0 4px; font-size: 11px; letter-spacing: 0.3em; color: var(--water); }
.title {
    margin: 0 0 10px; font-size: 36px; font-weight: 900; letter-spacing: 0.1em;
    background: linear-gradient(180deg, #ffffff, var(--water));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.panel-title { margin: 0 0 6px; font-size: 25px; font-weight: 800; }
.panel-note { margin: 0 0 14px; font-size: 14px; color: var(--muted); }
.subtitle { margin: 0 0 16px; font-size: 13.5px; color: var(--muted); line-height: 1.65; }

.picks { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 4px; }
.pick {
    padding: 9px 15px; border-radius: 999px; border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05); color: var(--ink);
    font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.pick.is-on { background: rgba(79, 195, 247, 0.18); border-color: var(--water); color: var(--water); }
.pick[disabled] { opacity: 0.35; }
.pick-done { color: var(--wind); }

.legend { text-align: left; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 16px; }
.legend h3 { margin: 0 0 10px; font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: 0.14em; }
.legend-row { display: flex; gap: 8px; align-items: baseline; margin-bottom: 9px; font-size: 13px; line-height: 1.55; }
.legend-row b { flex: 0 0 auto; font-size: 13px; font-weight: 800; }
.legend-row span { color: var(--muted); flex: 1; margin-left: 4px; }
.e-fire { color: var(--fire); }
.e-water { color: var(--water); }
.e-wind { color: var(--wind); }
.e-thunder { color: var(--thunder); }

.result { display: flex; justify-content: center; gap: 20px; margin: 4px 0 18px; flex-wrap: wrap; }
.result div { display: flex; flex-direction: column; gap: 3px; }
.result b { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.result i { font-size: 10px; font-style: normal; color: var(--muted); letter-spacing: 0.1em; }

.btn {
    display: block; width: 100%; margin-top: 9px; padding: 14px;
    border: 0; border-radius: 13px; font: inherit; font-size: 15px; font-weight: 700;
    letter-spacing: 0.08em; cursor: pointer;
}
.btn-primary { background: linear-gradient(180deg, var(--water), #2196c9); color: #04202c; }
.btn-ghost { background: rgba(255, 255, 255, 0.08); color: var(--ink); }

@media (max-height: 640px) {
    .hud { padding: 0 12px 4px; }
    .hud b { font-size: 15px; }
    .toolbar { padding: 4px 10px 0; }
}
