:root {
    color-scheme: light;
    --ink: #18202f;
    --muted: #5d697c;
    --surface: #ffffff;
    --line: #d8dee8;
    --accent: #0f8b8d;
    --ground: #6f9f49;
    --sky: #c7ebff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: linear-gradient(var(--sky), #f8fbff 65%);
}

.app-shell {
    width: min(960px, calc(100% - 32px));
    margin: 0 auto;
    padding: 48px 0;
}

.hero {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 28px;
}

h1 {
    margin: 0 0 12px;
    font-size: 32px;
    line-height: 1.2;
}

p {
    color: var(--muted);
}

.button {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
}

.button.secondary {
    background: #eef5f5;
    color: var(--accent);
    border: 1px solid #b8d7d8;
}

.button.danger {
    background: #b83f3f;
    color: #fff;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.auth-shell {
    width: min(420px, calc(100% - 32px));
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    align-items: center;
    padding: 32px 0;
}

.auth-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 24px;
    box-shadow: 0 14px 40px rgba(24, 32, 47, 0.08);
}

.form-stack {
    display: grid;
    gap: 14px;
}

.form-stack label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
}

.form-stack input {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    font: inherit;
    color: var(--ink);
    background: #fff;
}

.form-stack input:focus {
    outline: 2px solid rgba(15, 139, 141, 0.22);
    border-color: var(--accent);
}

button {
    min-height: 42px;
    border: 0;
    border-radius: 6px;
    padding: 0 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    background: var(--accent);
}

.alert {
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 14px;
}

.alert-error {
    color: #8a1f1f;
    background: #ffe9e9;
    border: 1px solid #ffc4c4;
}

.auth-link {
    margin: 16px 0 0;
    font-size: 14px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.topbar h1,
.topbar p {
    margin: 0;
}

.topbar p {
    margin-top: 6px;
}

.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 18px;
    margin-bottom: 16px;
}

.panel h2 {
    margin: 0 0 12px;
    font-size: 20px;
}

.inline-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.inline-form input {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    font: inherit;
}

.rooms-list,
.player-list {
    display: grid;
    gap: 10px;
}

.room-card,
.player-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    background: #fbfdff;
}

.room-card h3,
.room-card p {
    margin: 0;
}

.room-card p,
.player-row span,
.small-message,
.empty {
    color: var(--muted);
}

.small-message {
    min-height: 20px;
    margin-top: 10px;
    font-size: 14px;
}

.small-message.error {
    color: #8a1f1f;
}

@media (max-width: 640px) {
    .topbar,
    .room-card {
        align-items: stretch;
        flex-direction: column;
    }

    .inline-form {
        grid-template-columns: 1fr;
    }
}

.game-shell {
    width: min(1180px, calc(100% - 24px));
    margin: 0 auto;
    padding: 20px 0;
}

.game-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.game-topbar h1,
.game-topbar p {
    margin: 0;
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.game-layout {
    display: grid;
    grid-template-columns: minmax(0, 960px) 220px;
    gap: 14px;
    align-items: start;
}

.canvas-wrap {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #dff4ff;
}

#game-canvas {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
}

.control-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 14px;
}

.stat-line,
.range-control {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
}

.stat-line {
    grid-template-columns: 1fr auto;
}

.range-control input {
    width: 100%;
}

@media (max-width: 900px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
}
