﻿:root {
    --bg: #0d1018;
    --bg-soft: #171d2e;
    --surface: #1f2638;
    --surface-2: #252e44;
    --ink: #eef2ff;
    --muted: #a8b1ca;
    --line: #3a4566;
    --ok: #42d67a;
    --warn: #ffcd45;
    --bad: #ff6478;
    --blue: #6f7cff;
    --pink: #8b6dff;
    --orange: #6d56f7;
    --mobile-keyboard-height: 182px;
    --mobile-battle-bar-height: 2.5rem;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: "Arial Black", Impact, "Trebuchet MS", sans-serif;
    background:
        radial-gradient(circle at 8% -10%, #344a9780 0, transparent 42%),
        radial-gradient(circle at 100% 0%, #5b326580 0, transparent 34%),
        linear-gradient(170deg, var(--bg), #0a0d14 72%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    min-width: 350px;
    user-select: none;
}

body.app-loading {
    overflow: hidden;
}

.app-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at 8% -10%, #344a9780 0, transparent 42%),
        radial-gradient(circle at 100% 0%, #5b326580 0, transparent 34%),
        linear-gradient(170deg, var(--bg), #0a0d14 72%);
    transition: opacity 240ms ease, visibility 240ms ease;
}

.app-loader-card {
    width: 200px;
    border-radius: 16px;
    border: 1px solid #455683;
    background: linear-gradient(180deg, #1f2740, #151d31);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
    padding: 1rem 1.1rem;
    display: grid;
    gap: 0.75rem;
}

.app-loader-spinner {
    width: 40px;
    height: 40px;
    border-radius: 999px;
    border: 4px solid #3b4d78;
    border-top-color: #98b8ff;
    animation: spin 1s linear infinite;
    justify-self: center;
}

.app-loader-card strong {
    text-align: center;
    color: #eef4ff;
    font-size: 0.95rem;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.22;
    background:
        repeating-linear-gradient(135deg, #ffffff08 0 2px, transparent 2px 8px),
        repeating-linear-gradient(-135deg, #0000000f 0 1px, transparent 1px 9px),
        radial-gradient(circle at 20% 30%, #ffffff12 0 1px, transparent 1px 12px);
    mix-blend-mode: screen;
}

.page-shell {
    max-width: 1080px;
    margin: 0 auto 2rem;
    padding: 1.35rem 1.2rem 1.8rem;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid #36405d;
    background: linear-gradient(180deg, #121829f2, #0f1422f2);
    backdrop-filter: blur(4px);
}

.app-header-inner {
    max-width: 1080px;
    margin: 0 auto;
    min-height: 64px;
    padding: 0.7rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}
.app-header .icon-btn {
    box-shadow: none;
}
.app-header .icon-btn:hover, .app-header .icon-btn:active {
    transform: none;
}

.app-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.queue-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    min-height: 40px;
    padding: 0.25rem 0.55rem;
    border-radius: 10px;
    border: 1px solid #5b6c9d;
    background: linear-gradient(180deg, #273454, #1a233b);
    color: #deebff;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    font-size: 0.86rem;
    font-weight: 700;
}

.queue-indicator .material-symbols-outlined {
    font-size: 1.1rem;
}

.queue-indicator strong {
    min-width: 1.3rem;
    text-align: center;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #f5f8ff;
}

.app-brand .material-symbols-outlined {
    font-size: 1.4rem;
}

.app-brand strong {
    font-size: clamp(1.1rem, 0.95rem + 0.6vw, 1.45rem);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

[data-page] {
    display: none;
    transform: scale(0);
    transition: transform 260ms ease-in-out;
}

[data-page].active {
    transform: scale(1);
}

.panel {
    background: transparent;
    border: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 16px;
    border: 1px solid #3f4b6f;
    background: linear-gradient(180deg, #1c253c, #151d31);
    padding: 1rem;
}

.panel.panel-medium {
    width: 600px;
    margin: 0 auto;
}

.glow-panel::before {
    display: none;
}

.top-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.title-pop {
    margin: 0;
    font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.45rem);
    line-height: 1.1;
    color: #f5f8ff;
    text-shadow: 0 0 18px #90aeff40;
    animation: titlePulse 3.2s ease-in-out infinite;
}

@keyframes titlePulse {
    50% {
        text-shadow: 0 0 25px #9dc3ff65;
    }
}

.subtitle {
    margin: 1.25rem 0;
    color: var(--muted);
    font-size: 0.98rem;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.6rem;
}

.keycap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3.1em;
    padding: 0.1rem 0.42rem;
    margin: 0 0.18rem;
    border-radius: 8px;
    border: 1px solid #6173a9;
    color: #eef4ff;
    background: linear-gradient(180deg, #2a3553, #1d263d);
    box-shadow: 0 2px 0 #101727, 0 0 0 1px #8ca2ff22 inset;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.86em;
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.25;
    vertical-align: baseline;
}

.stats-grid,
.duo-status,
.battle-grid,
.result-actions {
    display: grid;
    gap: 1rem;
}

.stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.duo-status,
.battle-grid,
.result-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.board-card {
    min-width: 0;
}

.board-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.7rem;
}

.player-meta {
    display: grid;
    gap: 0.35rem;
    width: 100%;
}

.player-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    width: fit-content;
    padding: 0.3rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.player-label .material-symbols-outlined {
    font-size: 0.95rem;
}

.player-label.you-role {
    color: #b6ffe5;
    background: #14382b;
    border: 1px solid #2a7f5e;
}

.player-label.opponent-role {
    color: #ffe6b8;
    background: #3a2a13;
    border: 1px solid #8f6132;
}

.opponent-secret-word {
    margin: 0 0 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    border: 1px solid #6c4b22;
    background: linear-gradient(180deg, #3a2a13, #241a0d);
    color: #ffe8c7;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.01em;
    box-shadow: 0 0 0 1px rgba(255, 205, 69, 0.18) inset;
}

.opponent-secret-word strong {
    color: #fff5d6;
    font-size: 1.05em;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.player-name {
    color: #edf2ff;
    font-size: 1.02rem;
    font-weight: 900;
    letter-spacing: 0.01em;
    height: 34px;
    display: flex;
    align-items: center;
}

.player-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

.player-row:not(:first-child) {
    margin-top: 2px;
}

.secret-word-control {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
}

.secret-toggle-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid #6878ab;
    background: linear-gradient(180deg, #2a3552, #202a41);
    color: #dbe7ff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: transform 120ms ease, filter 120ms ease, width 120ms ease;
}

.secret-toggle-btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.secret-toggle-btn:active {
    transform: translateY(1px);
}

.secret-toggle-btn .material-symbols-outlined {
    font-size: 1.1rem;
}

.secret-toggle-btn.shown {
    width: auto;
    padding: 0 0.5rem;
}

.secret-toggle-btn.shown .secret-word {
    opacity: 1;
    transform: translateX(0);
    max-width: unset;
    padding-left: 0.4rem;
}

.secret-word {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #e4eeff;
    font-family: "Consolas", "Courier New", monospace;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    padding: 0;
    max-width: 0;
    opacity: 0;
    transform: translateX(-8px);
    transition: max-width 240ms ease, opacity 180ms ease, transform 240ms ease, padding 240ms ease;
}

.stats-grid article,
.duo-status article,
.board-card {
    background: linear-gradient(180deg, var(--surface), var(--surface-2));
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1rem;
    animation: popIn 260ms ease-out;
}

.duo-status article {
    display: flex;
    justify-content: space-between;
    align-items: end;
}

.duo-status article .chip {
    min-width: 108px;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.stats-grid strong {
    font-size: clamp(1.35rem, 1.1rem + 0.95vw, 1.9rem);
    color: #f4f8ff;
}

h2 {
    margin: 0 0 0.35rem;
    color: #bec8e4;
    font-size: 0.93rem;
}

.field-group {
    margin-top: 1.2rem;
}

.nickname-row {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
}

.nickname-input-wrap {
    flex: 1 1 auto;
    min-width: 0;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #c6d0ea;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

input {
    width: 100%;
    min-height: 48px;
    border-radius: 12px;
    border: 1px solid #4e5b82;
    background: #121828;
    color: #edf2ff;
    padding: 0.75rem 0.9rem;
    font-size: 0.95rem;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

input:focus {
    outline: none;
    border-color: #79a8ff;
    box-shadow: 0 0 0 3px #4c8dff33;
}

.primary-btn,
.secondary-btn,
.green-btn,
.icon-btn {
    appearance: none;
    border: 2px solid #0d0f16;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 900;
    letter-spacing: 0.025em;
    transition: transform 120ms ease, filter 120ms ease;
    text-transform: uppercase;
    outline: none;
}

.primary-btn {
    width: 100%;
    min-height: 58px;
    margin-top: 1.2rem;
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    color: #fff1f4;
    background: linear-gradient(180deg, #8e9cff, var(--blue));
    box-shadow: 0 6px 0 #3844ba;
}

.secondary-btn {
    min-height: 48px;
    padding: 0.62rem 1rem;
    font-size: 0.84rem;
    color: #fff1f4;
    background: linear-gradient(180deg, #a394ff, var(--pink));
    box-shadow: 0 6px 0 #4a35a6;
}

.green-btn {
    color: #fff1f4;
    background: linear-gradient(180deg, #7be7a0, #2fbf68);
    box-shadow: 0 5px 0 #1c7d45;
}

.icon-btn {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(180deg, #9f8dff, var(--blue));
    box-shadow: 0 5px 0 #3744a9;
}

.primary-btn:hover,
.secondary-btn:hover,
.icon-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}


.primary-btn.danger-btn {
    color: #fff;
    background: linear-gradient(180deg, #ff869a, #e83f5b);
    box-shadow: 0 6px 0 #92283b;
}

.primary-btn:active,
.secondary-btn:active,
.icon-btn:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.queue-btn {
    width: 52px;
    min-width: 52px;
    height: 52px;
    min-height: 52px;
    margin-top: 0;
    padding: 0;
    border-radius: 12px;
    color: #f4fff8;
    background: linear-gradient(180deg, #7be7a0, #2fbf68);
    box-shadow: 0 5px 0 #1c7d45;
}

.queue-btn .material-symbols-outlined {
    font-size: 1.2rem;
    color: #f2fff7;
    text-shadow: 0 0 10px rgba(214, 255, 231, 0.38);
}

.timer {
    margin-top: 1.1rem;
    text-align: center;
    font-size: clamp(1.45rem, 1rem + 0.95vw, 2rem);
    font-weight: 900;
    color: #f2f6ff;
    animation: timerBreath 1.8s ease-in-out infinite;
}

@keyframes timerBreath {
    50% {
        transform: scale(1.02);
    }
}

.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.32rem 0.7rem;
    border-radius: 999px;
    border: 1px solid #4f5b81;
    background: #1a2235;
    font-size: 0.76rem;
    font-weight: 800;
    color: #bcc8e7;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.chip.ok {
    border-color: #3c9862;
    color: #97e5b4;
    background: #113124;
}

.hint {
    min-height: 1rem;
    margin-top: 0.8rem;
    color: #9ea9cb;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.pulse-hint {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0;
    animation: pulseHint 1.6s ease-in-out infinite;
}

@keyframes pulseHint {
    50% {
        opacity: 0.5;
    }
}

[data-spin] {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    0% {
        transform: rotateZ(0);
    }
    100% {
        transform: rotateZ(360deg);
    }
}

.alert-box {
    margin-top: 0.85rem;
    border: 1px solid #a53d56;
    border-radius: 11px;
    padding: 0.68rem 0.8rem;
    background: #3c1725;
    color: #ffc9d5;
    font-weight: 800;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.alert-box.show {
    animation: shake 240ms linear 1;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px);
    }

    75% {
        transform: translateX(3px);
    }
}

.help-modal {
    width: min(92vw, 540px);
    border: 1px solid #4a587f;
    border-radius: 16px;
    padding: 1.2rem;
    background:
        linear-gradient(180deg, #212941, #171d2f),
        repeating-linear-gradient(135deg, #ffffff05 0 2px, transparent 2px 8px);
    color: #ebf1ff;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
}

.help-modal h2 {
    margin: 0 0 0.7rem;
    font-size: 1.28rem;
    color: #ffffff;
}

.help-modal ol {
    margin: 0 0 1.1rem;
    padding-left: 1.2rem;
    color: #c2cce8;
    line-height: 1.55;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    font-size: 0.95rem;
}

.help-modal li {
    margin-bottom: 0.5rem;
}

.help-modal .secondary-btn {
    width: 100%;
}

.help-modal::backdrop {
    background: rgba(3, 6, 14, 0.76);
    backdrop-filter: blur(2px);
}

.battle-panel .top-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.round-row {
    display: flex;
    justify-content: center;
    margin: 0.45rem auto 0.85rem;
}

.turn-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    min-width: 124px;
    max-width: 160px;
    text-align: center;
    font-weight: 900;
    color: #d3dcff;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.3rem 0.55rem;
    font-size: 0.72rem;
    line-height: 1.15;
    transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease, color 140ms ease;
}

.turn-chip.turn-player {
    color: #d9ffe8;
    border-color: #2e8d56;
    animation: blinkTurnPlayer 1.05s ease-in-out infinite;
}

.turn-chip.turn-waiting {
    color: #ffeccd;
    border-color: #c27622;
    animation: blinkTurnWaiting 1.05s ease-in-out infinite;
}

.turn-chip.turn-dead {
    animation: none;
    color: #ffd6dc;
    border-color: #a53d56;
    background: linear-gradient(180deg, #4a1a2a, #31111d);
    box-shadow: 0 0 0 2px rgba(165, 61, 86, 0.25) inset;
}

.round-badge {
    min-height: 42px;
    min-width: 112px;
    padding: 0.45rem 0.8rem;
    font-size: 0.9rem;
    border-color: #6878ab;
    color: #eef2ff;
    background: linear-gradient(180deg, #2a3552, #202a41);
    box-shadow: 0 0 0 2px #8ca2ff22 inset;
}

.battle-mobile-bar {
    display: none;
}

@keyframes blinkTurnPlayer {

    0%,
    100% {
        background: rgba(46, 141, 86, 0.2);
        box-shadow: 0 0 0 0 rgba(46, 141, 86, 0.2);
    }

    50% {
        background: rgba(66, 214, 122, 0.42);
        box-shadow: 0 0 0 4px rgba(66, 214, 122, 0.16);
    }
}

@keyframes blinkTurnWaiting {

    0%,
    100% {
        background: rgba(194, 118, 34, 0.2);
        box-shadow: 0 0 0 0 rgba(194, 118, 34, 0.2);
    }

    50% {
        background: rgba(255, 180, 72, 0.45);
        box-shadow: 0 0 0 4px rgba(255, 180, 72, 0.16);
    }
}

.type-instruction {
    margin: 0.6rem 0 0;
    text-align: center;
    color: #a0aac8;
    font-weight: 600;
    font-size: 0.87rem;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.row-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.4rem;
}

.tile {
    min-height: 48px;
    border-radius: 11px;
    border: 1px solid #4c5a81;
    background: #141b2d;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 1rem;
    text-transform: uppercase;
    color: #dde5ff;
}

.tile.ok {
    border-color: #42d67a;
    background: #42d67a;
    color: #082114;
}

.tile.warn {
    border-color: #ffcd45;
    background: #ffcd45;
    color: #2d2206;
}

.tile.bad {
    border-color: #ff6478;
    background: #ff6478;
    color: #300912;
}

.tile.ready {
    color: #b6ffe5;
    background: #14382b;
    border: 1px solid #2a7f5e;
}

.history-grid {
    display: grid;
    gap: 0.4rem;
    margin-top: 0.48rem;
}

.keyboard {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.keyboard .keys-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
}

.key {
    flex: 1 1 0;
    max-width: 66px;
    min-height: 44px;
    min-width: 0;
    border-radius: 11px;
    border: 1px solid #53618c;
    background: #161d31;
    color: #c8d2ec;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 0.84rem;
    cursor: pointer;
    user-select: none;
}

.key.ok {
    border-color: #42d67a;
    background: #42d67a;
    color: #0b2216;
}

.key.warn {
    border-color: #ffcd45;
    background: #ffcd45;
    color: #2d2206;
}

.key.bad {
    border-color: #ff6478;
    background: #ff6478;
    color: #300912;
}

.key.mix-cp {
    border-color: #65cf7f;
    background: linear-gradient(135deg, #42d67a 50%, #ffcd45 50%);
    color: #1f220d;
}

.key.mix-pa {
    border-color: #ffcd45;
    background: linear-gradient(135deg, #ffcd45 50%, #ff6478 50%);
    color: #2a170c;
}

.key.mix-ca {
    border-color: #42d67a;
    background: linear-gradient(135deg, #42d67a 50%, #ff6478 50%);
    color: #220f12;
}

.key.backspace {
    border-color: #ffcf9a;
    background: #ffcf9a;
    color: #4b2b00;
}

.key.enter {
    border-color: #bdf2c9;
    background: #bdf2c9;
    color: #0d3a1c;
}

.link-btn {
    text-decoration: none;
}

.icon-only-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.icon-only-btn .material-symbols-outlined {
    font-size: 1.35rem;
}

.icon-btn.icon-only-btn .material-symbols-outlined {
    font-size: 1.2rem;
}

.hidden {
    display: none;
}

@media (max-width: 900px) {
    .stats-grid,
    .duo-status,
    .battle-grid,
    .result-actions {
        grid-template-columns: 1fr;
    }

    .battle-panel .top-actions {
        width: 100%;
        justify-content: stretch;
    }

    .board-head {
        flex-wrap: wrap;
    }
}

@media (max-width: 620px) {
    .panel {
        width: 100%;
        border: unset;
        padding: 0;
        background: unset;
    }

    .panel.panel-medium {
        width: 100%;
    }

    .page-shell {
        padding: 0.75rem;
    }

    .app-header-inner {
        padding: 0.65rem 0.75rem;
        min-height: 58px;
    }

    .queue-indicator {
        min-height: 36px;
        padding: 0.2rem 0.45rem;
        font-size: 0.78rem;
    }

    .title-pop {
        font-size: 1.25rem;
    }

    .top-actions {
        width: 100%;
    }

    .key {
        max-width: none;
        min-height: 36px;
        font-size: 0.74rem;
    }

    .tile {
        min-height: 42px;
    }

    .primary-btn {
        min-height: 52px;
    }

    .subtitle,
    .hint,
    .chip {
        overflow-wrap: anywhere;
    }

    .queue-btn {
        width: 48px;
        min-width: 48px;
        height: 48px;
        min-height: 48px;
    }

    [data-page="battle"] {
        transform: none !important;
        padding-bottom: calc(var(--mobile-keyboard-height) + var(--mobile-battle-bar-height) + 1rem);
    }

    [data-page="battle"] .player-meta {
        display: flex;
        justify-content: start;
        align-items: center;
        width: 100%;
        gap: 0.5rem;
    }
    [data-page="battle"] .player-row {
        margin-top: 0;
        width: auto;
    }
    [data-page="battle"] .player-row:nth-child(2) {
        flex: 1;
    }
    [data-page="battle"] .player-label {
        padding: 0.5rem;
    }
    [data-page="battle"] .player-label span:nth-child(2) {
        display: none;
    }
    [data-page="battle"] .player-name {
        display: block;
        padding-top: 4px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        width: calc(100% - 44px);
    }
    [data-page="battle"] .player-name[data-opponent-nickname] {
        width: 100%;
    }
    [data-page="battle"] .secret-word-control {
        position: absolute;
        right: 0;
    }
    [data-page="battle"] .secret-toggle-btn.shown {
        max-width: 136px;
        padding: 0.28rem 0.55rem;
    }

    [data-page="battle"] .turn-chip {
        display: none !important;
    }

    [data-page="chooseSecret"] {
        transform: none !important;
        padding-bottom: 10.5rem;
    }

    [data-page="battle"] .keyboard,
    [data-page="chooseSecret"] .keyboard {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        padding: 0.24rem 0.18rem calc(0.24rem + env(safe-area-inset-bottom));
        gap: 0.12rem;
        border-top: 1px solid #3b476a;
        background: linear-gradient(180deg, #141c30f2, #0f1525f5);
        backdrop-filter: blur(6px);
        z-index: 30;
        height: var(--mobile-keyboard-height);
    }

    [data-page="battle"] .keyboard .keys-row,
    [data-page="chooseSecret"] .keyboard .keys-row {
        gap: 0.12rem;
    }

    [data-page="battle"] .key,
    [data-page="chooseSecret"] .key {
        flex: 1 1 0;
        min-height: 56px;
        border-radius: 8px;
        font-size: 0.9rem;
        max-width: 40px;
    }

    [data-page="battle"] .key .material-symbols-outlined,
    [data-page="chooseSecret"] .key .material-symbols-outlined {
        font-size: 1.2rem;
    }

    [data-page="battle"] .round-row,
    [data-page="battle"] .timer {
        display: none;
    }

    [data-page="battle"] .battle-mobile-bar {
        position: fixed;
        left: 0;
        right: 0;
        bottom: calc(var(--mobile-keyboard-height) - 1px);
        height: var(--mobile-battle-bar-height);
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 0.45rem;
        padding: 0 0.55rem;
        border-top: 1px solid #3b476a;
        border-bottom: 1px solid #3b476a;
        background: linear-gradient(180deg, #18223af2, #141d32f4);
        z-index: 31;
    }
    [data-page="battle"].finished .battle-mobile-bar,
    [data-page="battle"].finished .keyboard {
        display: none;
    }

    [data-page="battle"] .battle-mobile-info {
        font-size: 0.78rem;
        font-weight: 900;
        letter-spacing: 0.01em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: #dce6ff;
    }

    [data-page="battle"] .battle-mobile-turn {
        text-align: left;
    }

    [data-page="battle"] .battle-mobile-timer {
        text-align: center;
        color: #fff2ce;
    }

    [data-page="battle"] .battle-mobile-round {
        text-align: right;
        color: #cfe0ff;
    }
}

.secret-row .tile {
    min-height: 54px;
}

/* Botao disabled */
.primary-btn:disabled,
.secondary-btn:disabled,
.icon-btn:disabled,
.primary-btn.disabled,
.secondary-btn.disabled,
.icon-btn.disabled {
    cursor: not-allowed;
    opacity: 0.72;
    filter: grayscale(0.35) saturate(0.75);
    transform: none !important;
    box-shadow: none !important;
    border-color: #2d344b;
    background: linear-gradient(180deg, #4b546d, #3b4359) !important;
    color: #bcc5de !important;
    pointer-events: none;
}

.primary-btn:disabled:hover,
.secondary-btn:disabled:hover,
.icon-btn:disabled:hover,
.primary-btn.disabled:hover,
.secondary-btn.disabled:hover,
.icon-btn.disabled:hover {
    transform: none;
    filter: grayscale(0.35) saturate(0.75);
}

.result-modal {
    width: min(92vw, 520px);
    border: 1px solid #4a587f;
    border-radius: 16px;
    padding: 1.2rem;
    background: linear-gradient(180deg, #212941, #171d2f);
    color: #ebf1ff;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55);
}

.result-winner {
    padding: 32px 12px;
    margin: 0 0 1rem;
    font-size: clamp(2rem, 1.2rem + 2.4vw, 3.1rem);
    font-weight: 900;
    line-height: 2;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    text-shadow: 0 0 18px rgba(255, 255, 255, 0.28);
}

.result-modal-actions {
    display: flex;
    gap: 0.6rem;
    align-items: stretch;
}

@media (max-width: 620px) {
    .result-modal {
        width: min(94vw, 520px);
        padding: 1rem;
    }
}

.result-modal-actions .icon-only-btn {
    flex: 1;
    min-height: 48px;
    margin-top: 0;
    width: 100%;
    justify-self: stretch;
    align-self: stretch;
    padding: 0;
}

.result-modal-actions [data-close-modal] {
    color: #fff1f4;
    background: linear-gradient(180deg, #ff8ea2, #e34a66);
    box-shadow: 0 6px 0 #8f2a3e;
}


.result-winner.win {
    color: #7fffc0;
    text-shadow: 0 0 18px rgba(66, 214, 122, 0.6);
}

.result-winner.lose {
    color: #ff8c9d;
    text-shadow: 0 0 18px rgba(255, 91, 115, 0.58);
}

.result-winner.draw {
    color: #d8c7ff;
    text-shadow: 0 0 18px rgba(139, 109, 255, 0.55);
}
