:root {
    --bg-top: #a7c8e6;
    --bg-bottom: #d6e7c4;
    --panel-bg: rgba(14, 26, 35, 0.76);
    --panel-border: rgba(255, 255, 255, 0.2);
    --text-main: #f3f7fb;
    --text-subtle: #c8d9e6;
    --accent: #9fd37d;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

#game-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.hidden {
    display: none !important;
}

.auth-screen {
    position: fixed;
    inset: 0;
    z-index: 12;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background:
        radial-gradient(90vmax 70vmax at 12% 8%, rgba(42, 78, 120, 0.28), transparent),
        radial-gradient(90vmax 70vmax at 88% 92%, rgba(30, 66, 42, 0.24), transparent),
        rgba(6, 13, 19, 0.8);
    backdrop-filter: blur(6px);
}

.auth-card {
    width: min(95vw, 470px);
    max-height: min(92vh, 900px);
    overflow: auto;
    border: 1px solid rgba(223, 243, 255, 0.22);
    border-radius: 14px;
    padding: 14px;
    background: rgba(11, 21, 30, 0.9);
    color: var(--text-main);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
}

.auth-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #d9f6e9;
}

.auth-status {
    margin-top: 6px;
    font-size: 13px;
    color: #cfe5f3;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 12px;
}

.auth-tab {
    border: 1px solid rgba(199, 226, 208, 0.24);
    border-radius: 8px;
    padding: 7px 8px;
    color: #f2fff8;
    background: rgba(35, 56, 71, 0.58);
    cursor: pointer;
}

.auth-tab.active {
    background: rgba(77, 138, 102, 0.66);
    border-color: rgba(183, 237, 202, 0.42);
}

.auth-form {
    margin-top: 11px;
    display: grid;
    gap: 7px;
}

.auth-form label {
    font-size: 12px;
    color: #bfd5e5;
}

.auth-form input {
    width: 100%;
    border: 1px solid rgba(193, 218, 234, 0.24);
    border-radius: 8px;
    padding: 9px 10px;
    color: #eefaff;
    background: rgba(20, 35, 48, 0.88);
    outline: none;
}

.auth-form input:focus {
    border-color: rgba(171, 227, 193, 0.64);
    box-shadow: 0 0 0 2px rgba(119, 178, 143, 0.2);
}

.auth-form button,
.character-row button,
.danger {
    border: 1px solid rgba(198, 227, 208, 0.3);
    border-radius: 8px;
    padding: 8px 9px;
    color: #ebfff6;
    background: rgba(58, 111, 84, 0.72);
    cursor: pointer;
}

.character-panel {
    margin-top: 12px;
    border-top: 1px solid rgba(220, 236, 248, 0.18);
    padding-top: 11px;
}

.character-headline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 13px;
    color: #d6ebf8;
}

.character-list {
    margin-top: 10px;
    display: grid;
    gap: 8px;
}

.character-row {
    border: 1px solid rgba(197, 223, 238, 0.2);
    border-radius: 8px;
    padding: 7px 8px;
    background: rgba(17, 30, 40, 0.82);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
}

.character-row.active {
    border-color: rgba(160, 228, 186, 0.5);
    background: rgba(36, 64, 48, 0.5);
}

.character-meta {
    font-size: 12px;
    color: #c5dceb;
}

.danger {
    background: rgba(117, 59, 59, 0.72);
    border-color: rgba(246, 191, 191, 0.28);
}

.hud {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 4;
    max-width: min(92vw, 390px);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 10px 12px;
    background: var(--panel-bg);
    color: var(--text-main);
    backdrop-filter: blur(5px);
}

.hud-title {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--accent);
}

#hud-status,
#hud-stats {
    margin-top: 6px;
    font-size: 13px;
}

.hud-help {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-subtle);
}

.hud-link {
    display: inline-flex;
    margin-top: 9px;
    font-size: 12px;
    color: #ecffe4;
    text-decoration: none;
    border: 1px solid rgba(205, 240, 186, 0.35);
    border-radius: 7px;
    padding: 5px 8px;
    background: rgba(42, 75, 36, 0.45);
}

.hud-link:hover {
    background: rgba(61, 102, 52, 0.62);
}

.hud-logout {
    display: inline-flex;
    margin-top: 8px;
    border: 1px solid rgba(245, 197, 197, 0.32);
    border-radius: 7px;
    padding: 5px 8px;
    font-size: 12px;
    color: #fff1f1;
    background: rgba(102, 44, 44, 0.52);
    cursor: pointer;
}

.hud-logout:hover {
    background: rgba(128, 51, 51, 0.64);
}

@media (max-width: 700px) {
    .hud {
        top: 8px;
        left: 8px;
        right: 8px;
        max-width: none;
        padding: 9px 10px;
    }

    .hud-title {
        font-size: 14px;
    }

    #hud-status,
    #hud-stats,
    .hud-help {
        font-size: 12px;
    }

    .auth-card {
        width: min(98vw, 470px);
        padding: 11px;
    }
}
