/* Minimal Japanese-inspired arena UI */
:root {
    color-scheme: light;
    --ink: #20242a;
    --muted-ink: #656b70;
    --paper: #e9e6df;
    --paper-deep: #d9d5cc;
    --vermilion: #bd3438;
    --cyan: #168f98;
    --line: rgba(35, 41, 46, .18);
    --jp-sans: "Noto Sans JP", "Yu Gothic", "Meiryo", sans-serif;
    --jp-serif: "Shippori Mincho", "Yu Mincho", serif;
}

* { box-sizing: border-box; }

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--jp-sans);
}

button { font: inherit; }

#gameBox {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: var(--paper);
    isolation: isolate;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.startMessage {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    color: var(--ink);
    background: rgba(233, 230, 223, .76);
    backdrop-filter: blur(2px);
    pointer-events: none;
    text-shadow: none;
}

.eyebrow {
    margin: 0 0 14px;
    color: var(--vermilion);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .28em;
}

.startMessage h1 {
    margin: 0 0 18px;
    font-family: var(--jp-serif);
    font-size: clamp(34px, 7vw, 76px);
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1.15;
}

.startMessage h1 span {
    color: var(--vermilion);
    font-family: var(--jp-sans);
    font-size: .62em;
    font-weight: 800;
    letter-spacing: .12em;
}

.startPrompt {
    margin: 12px 0 0;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .22em;
}

.startMessage small {
    margin-top: 18px;
    color: var(--muted-ink);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .08em;
}

.keyDivider { padding: 0 7px; color: var(--vermilion); }

.joystick {
    position: absolute;
    left: max(22px, env(safe-area-inset-left));
    bottom: max(22px, env(safe-area-inset-bottom));
    width: 138px;
    height: 138px;
    border-radius: 50%;
    border: 1px solid rgba(32, 36, 42, .32);
    background: rgba(233, 230, 223, .88);
    box-shadow: 0 8px 24px rgba(32, 36, 42, .12);
    touch-action: none;
    display: none;
    z-index: 10;
}

.joystick::before {
    content: "";
    position: absolute;
    inset: 13px;
    border-radius: 50%;
    border: 1px solid rgba(22, 143, 152, .38);
}

.joystickInner {
    position: absolute;
    width: 58px;
    height: 58px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid #fff;
    background: radial-gradient(circle at 35% 28%, #f1a2a0, var(--vermilion) 68%, #782326);
    box-shadow: 0 3px 10px rgba(32, 36, 42, .2);
    pointer-events: none;
}

.dashButton {
    position: absolute;
    right: max(26px, env(safe-area-inset-right));
    bottom: max(40px, env(safe-area-inset-bottom));
    width: 82px;
    height: 82px;
    border-radius: 50%;
    border: 1px solid rgba(22, 143, 152, .8);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .12em;
    background: var(--ink);
    box-shadow: 0 8px 22px rgba(32, 36, 42, .2);
    display: none;
    z-index: 10;
    touch-action: none;
}

.dashButton:active {
    transform: scale(.94);
    background: var(--vermilion);
}

@media (pointer: coarse) {
    .joystick, .dashButton { display: block; }
    .startMessage small { max-width: 80%; }
}

.endScreen {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 30;
    padding: 20px;
    background: rgba(28, 32, 37, .76);
    backdrop-filter: blur(5px);
    text-align: center;
}

.endScreen.visible { display: flex; }

.endPanel {
    width: min(88%, 430px);
    padding: 38px 28px 34px;
    background: var(--paper);
    border: 1px solid rgba(32, 36, 42, .22);
    border-top: 4px solid var(--vermilion);
    border-radius: 2px;
    color: var(--ink);
    box-shadow: 0 18px 60px rgba(0, 0, 0, .2);
}

.endPanel .eyebrow { margin-bottom: 10px; }

.endPanel h1 {
    margin: 0 0 12px;
    font-family: var(--jp-serif);
    font-size: clamp(27px, 6vw, 42px);
    letter-spacing: .04em;
}

.endPanel p:not(.eyebrow) {
    color: var(--muted-ink);
    margin: 0 0 26px;
    font-size: 14px;
}

.endPanel button {
    padding: 14px 28px;
    border: 0;
    border-radius: 2px;
    background: var(--vermilion);
    color: #fff;
    font-weight: 800;
    font-size: 12px;
    letter-spacing: .16em;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease;
}

.endPanel button:hover { background: #98282d; }
.endPanel button:active { transform: scale(.97); }

@media (max-width: 520px) {
    .eyebrow { font-size: 9px; letter-spacing: .2em; }
    .startMessage h1 { letter-spacing: .04em; }
    .startMessage small { font-size: 9px; }
}
