@import url('https://fonts.googleapis.com/css2?family=Zen+Kaku+Gothic+New:wght@400;500;700;900&family=Bebas+Neue&display=swap');

:root {
    --felt-dark: #0f3c2e;
    --felt-mid: #145c44;
    --felt-light: #1f7a57;
    --wood-dark: #3a2518;
    --wood-mid: #5a3a22;
    --wood-light: #7a4a2a;
    --gold: #f5d062;
    --ink: #eaf0ef;
    --ink-soft: rgba(234, 240, 239, 0.75);
    --ink-dark: #1b2321;
    --chip-blue: #2f6fed;
    --chip-green: #2bb673;
    --chip-red: #d83a3a;
    --chip-yellow: #d1a21b;
    --panel-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

html,
body {
    height: 100%;
    margin: 0;
    font-family: 'Zen Kaku Gothic New', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--ink);
    background-color: var(--felt-dark);
    background-image:
        radial-gradient(1200px 720px at 50% 28%, rgba(255, 255, 255, 0.08), transparent 60%),
        radial-gradient(900px 500px at 50% 30%, rgba(0, 0, 0, 0.35), transparent 70%),
        repeating-radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.03) 0 2px, rgba(0, 0, 0, 0.03) 2px 4px);
    background-attachment: fixed;
    overflow: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(120% 90% at 50% 10%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.4) 100%);
    z-index: 1;
}

/* ===== Top Bar ===== */
#topbar {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    background: linear-gradient(180deg, var(--wood-light), var(--wood-dark));
    border-bottom: 2px solid rgba(245, 208, 98, 0.45);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    z-index: 10;
}

#topbar .left {
    display: flex;
    gap: 12px;
    align-items: center;
}

#topbar .left strong {
    font-family: 'Bebas Neue', 'Zen Kaku Gothic New', sans-serif;
    font-size: 1.4rem;
    letter-spacing: 0.12em;
    color: var(--gold);
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

#topbar .right {
    display: flex;
    gap: 8px;
    align-items: center;
}

#status {
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    max-width: 40vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Buttons ===== */
button {
    --btn: var(--chip-blue);
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.5), transparent 40%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(0, 0, 0, 0.2)),
        var(--btn);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    padding: 9px 18px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    box-shadow:
        0 8px 18px rgba(0, 0, 0, 0.25),
        inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

button:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.3),
        inset 0 0 0 2px rgba(255, 255, 255, 0.2);
    filter: brightness(1.05);
}

button:active {
    transform: translateY(0);
    box-shadow:
        0 6px 14px rgba(0, 0, 0, 0.25),
        inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

button:focus-visible {
    outline: 3px solid rgba(245, 208, 98, 0.8);
    outline-offset: 2px;
}

#btnStart {
    --btn: var(--chip-green);
}

#btnLeave {
    --btn: var(--chip-red);
}

.hidden {
    display: none !important;
}

/* ===== Lobby Panel ===== */
#panel {
    position: fixed;
    inset: 60px 0 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9;
}

#panel .card {
    width: min(560px, 92vw);
    background:
        linear-gradient(180deg, rgba(17, 78, 55, 0.96), rgba(10, 51, 36, 0.96));
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 26px;
    padding: 30px 26px;
    box-shadow: var(--panel-shadow);
    position: relative;
    animation: cardSlideIn 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

#panel .card::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 20px;
    border: 1px dashed rgba(245, 208, 98, 0.25);
    pointer-events: none;
}

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 14px 0;
}

label {
    width: 90px;
    color: var(--ink-soft);
    font-size: 14px;
    font-weight: 600;
}

input {
    flex: 1;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink-dark);
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

input:focus {
    border-color: rgba(245, 208, 98, 0.8);
    box-shadow:
        0 0 0 3px rgba(245, 208, 98, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

select {
    flex: 1;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink-dark);
    outline: none;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

select:focus {
    border-color: rgba(245, 208, 98, 0.8);
    box-shadow:
        0 0 0 3px rgba(245, 208, 98, 0.3),
        inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.buttons {
    justify-content: flex-end;
    gap: 10px;
}

.hint {
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    margin-top: 14px;
    line-height: 1.6;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 12px;
    border-left: 3px solid rgba(245, 208, 98, 0.7);
}

/* ===== Canvas ===== */
#game {
    position: fixed;
    left: 0;
    top: 60px;
    width: 100vw;
    height: calc(100vh - 60px);
    display: block;
    touch-action: manipulation;
    z-index: 2;
}

/* ===== Color Choice Modal ===== */
#overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.modal {
    width: min(420px, 92vw);
    background: rgba(248, 247, 242, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
    animation: cardSlideIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    color: var(--ink-dark);
}

.modalTitle {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--ink-dark);
}

.colors {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.colors button {
    flex: 1;
    min-width: 85px;
    padding: 14px 10px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.colors button:hover {
    transform: translateY(-4px) scale(1.05);
}

.colors button.recommended {
    outline: 3px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        0 6px 20px rgba(0, 0, 0, 0.12),
        0 0 0 6px rgba(245, 208, 98, 0.35);
}

.cR {
    --btn: var(--chip-red);
}

.cG {
    --btn: var(--chip-green);
}

.cB {
    --btn: var(--chip-blue);
}

.cY {
    --btn: var(--chip-yellow);
    color: #1b1b1b;
}

/* ===== Room Info Badge ===== */
#roomInfo {
    font-size: 0.82rem;
    color: #1e1a12;
    background: rgba(245, 208, 98, 0.9);
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

