* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}

body {
    height: 100vh;
    overflow: hidden;
    background-color: #2e63c5;
    background-image: url('data:image/svg+xml;utf8,<svg opacity="0.1" xmlns="http://www.w3.org/2000/svg" width="100" height="100"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="none"/></svg>');
    /* Placeholder pattern */
}

.screen {
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ============== HOME SCREEN ============== */
.container {
    width: 650px;
}

.title {
    text-align: center;
    color: white;
    font-size: 70px;
    margin-bottom: 30px;
    text-shadow: 4px 4px black;
}

.menu {
    background: #204bb3;
    padding: 25px;
    border-radius: 12px;
}

.top {
    display: flex;
    gap: 15px;
}

.top input {
    flex: 1;
    padding: 12px;
    font-size: 20px;
}

.top select {
    width: 180px;
    font-size: 20px;
}

.characterBox {
    margin-top: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    position: relative;
}

.character {
    width: 170px;
    height: 170px;
    border-radius: 10px;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
}

.character img {
    width: 150px;
}

.arrow {
    width: 50px;
    height: 50px;
    font-size: 32px;
    cursor: pointer;
}

#randomBtn {
    position: absolute;
    right: 0;
    top: 0;
    width: 45px;
    height: 45px;
    font-size: 22px;
    cursor: pointer;
}

#createRoom {
    margin-top: 30px;
    width: 100%;
    padding: 18px;
    font-size: 32px;
    background: #55d045;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 8px;
}

#joinRoom {
    margin-top: 12px;
    width: 100%;
    padding: 18px;
    font-size: 32px;
    background: #2a7af3;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 8px;
}

/* ============== WAITING SCREEN ============== */
.waiting-container {
    width: 900px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* Header */
.waiting-header {
    background: white;
    color: black;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    font-weight: bold;
    border-bottom: 2px solid #ccc;
}

.round-info {
    font-size: 18px;
}

.room-status {
    font-size: 14px;
    letter-spacing: 1px;
    color: #555;
}

.room-code-box {
    display: flex;
    align-items: center;
    gap: 10px;
}

.room-code-box span {
    font-size: 16px;
}

#copyRoomCode {
    background: #eee;
    border: 1px solid #ccc;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

#copyRoomCode:hover {
    background: #ddd;
}

/* Body (Left Settings + Right Players) */
.waiting-body {
    display: flex;
    background: #2c3140;
    /* Darker background from image */
}

/* Left - Settings */
.waiting-left {
    flex: 2;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #eee;
    font-size: 16px;
    padding: 5px 0;
}

.setting-row label {
    font-weight: normal;
}

.setting-row select,
.setting-row .fixed-val {
    width: 200px;
    padding: 6px;
    font-size: 14px;
    border-radius: 4px;
    background: white;
    color: black;
    border: none;
}

.setting-row .fixed-val {
    background: #eee;
    color: #555;
    cursor: not-allowed;
}

/* Action Buttons */
.waiting-actions {
    display: flex;
    gap: 10px;
}

.btn-start {
    flex: 2;
    background: #55d045;
    color: white;
    border: none;
    padding: 15px;
    font-size: 24px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
}

.btn-start:hover {
    background: #47b839;
}

.btn-invite {
    flex: 1;
    background: #2a7af3;
    color: white;
    border: none;
    padding: 15px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
}

.btn-invite:hover {
    background: #1f65d1;
}

/* Right - Player List */
.waiting-right {
    flex: 1;
    background: white;
    padding: 15px;
    min-height: 400px;
}

#player-list {
    list-style: none;
}

.system-msg {
    color: #ff9800;
    font-weight: bold;
    font-size: 14px;
    margin-top: 10px;
}

/* ============== GAME SCREEN ============== */
/* GAME SCREEN */

#game-screen {
    background: #2e63c5;
}

.game-container {
    width: 95%;
    height: 95%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}


/* HEADER */

.game-header {

    height: 60px;
    background: white;

    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 0 25px;
    font-size: 24px;
    font-weight: bold;
}


/* BODY */

.game-body {

    flex: 1;
    display: flex;
    gap: 10px;
}


/* PLAYER PANEL */

.players-panel {

    width: 220px;
    background: white;
    padding: 15px;
}


.players-panel h3 {

    margin-bottom: 15px;
}


#game-player-list {

    list-style: none;
}


#game-player-list li {

    padding: 12px;
    margin-bottom: 8px;

    background: #f4f4f4;
    border-radius: 6px;
}



/* CANVAS */

#canvas-container {

    flex: 1;

    background: white;

    display: flex;
    justify-content: center;
    align-items: center;
}


#canvas-container canvas {

    border: 2px solid black;
}

#drawing-tools {
    position: absolute;
    bottom: 4%;
    display: flex;
    gap: 8px;
}

#drawing-tools button {
    padding: 8px 12px;
    border: 1px solid #333;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

#drawing-tools button.active {
    background: #2e63c5;
    color: white;
}


/* CHAT */

#chat-container {

    width: 320px;
    background: white;

    display: flex;
    flex-direction: column;
}


#chat-header {

    background: #333;
    color: white;

    padding: 12px;
    text-align: center;
}


#chat-box {

    flex: 1;
    overflow-y: auto;
    padding: 10px;
}


.message {

    margin-bottom: 10px;
    padding: 8px;

    background: #f4f4f4;
    border-radius: 5px;
}

.message.system {
    background: #fff3cd;
    font-style: italic;
    text-align: center;
}

#game-player-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#game-player-list li.is-drawer {
    background: #ffe680;
    font-weight: bold;
}

.player-points {
    color: #555;
    font-size: 14px;
}

/* OVERLAYS (word select / round end / game over) */

.game-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(90, 90, 90, 0.55);

    display: flex;
    justify-content: center;
    align-items: center;

    z-index: 9999;
}

.overlay-box {
    background: white;
    border-radius: 12px;
    padding: 30px;
    min-width: 320px;
    max-width: 480px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 10000;
}

.overlay-box h2 {
    color: #2e63c5;
    font-size: 24px;
    margin-bottom: 20px;
    font-weight: 700;
}

#word-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
    margin-top: 15px;
}

.word-option-btn {
    flex: 1;
    min-width: 100px;
    padding: 14px 10px;
    font-size: 18px;
    font-weight: 600;
    border: 2px solid #2e63c5;
    border-radius: 8px;
    background: white;
    color: #2e63c5;
    cursor: pointer;
    transition: all 0.2s ease;
}

.word-option-btn:hover {
    background: #2e63c5;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 99, 197, 0.3);
}

.word-option-btn:active {
    transform: translateY(0);
}

#round-end-scores,
#game-over-scores {
    list-style: none;
    margin-top: 15px;
    text-align: left;
}

#round-end-scores li,
#game-over-scores li {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f4f4f4;
    border-radius: 6px;
    margin-bottom: 6px;
}


#chat-input-container {

    display: flex;
}


#message-input {

    flex: 1;
    padding: 12px;

    border: none;
    outline: none;
}


#send-btn {

    width: 80px;
}

/* ============== FINISHING PASS ============== */
:root {
    --ink: #17233f;
    --blue: #3672e6;
    --blue-dark: #2458bd;
    --surface: #ffffff;
    --muted: #68738a;
    --line: #dbe3f2;
    --success: #38b86a;
    --gold: #f6b73c;
}

body {
    background-color: #3975dc;
    background-image: radial-gradient(circle at 15% 15%, rgba(255,255,255,.16) 0 2px, transparent 3px), radial-gradient(circle at 85% 80%, rgba(23,35,63,.13) 0 2px, transparent 3px);
    background-size: 28px 28px, 34px 34px;
    color: var(--ink);
}

button, input, select { font: inherit; }
button { transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
button:not(:disabled):hover { transform: translateY(-1px); }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(246,183,60,.65); outline-offset: 2px; }

.waiting-container {
    width: min(930px, 94vw);
    border-radius: 16px;
    box-shadow: 0 22px 55px rgba(17, 38, 87, .32);
    border: 1px solid rgba(255,255,255,.3);
}
.waiting-header { min-height: 66px; padding: 14px 22px; border: 0; color: var(--ink); }
.round-info { color: var(--blue-dark); }
.room-status { color: var(--success); font-size: 12px; padding: 6px 10px; background: #e5f8ec; border-radius: 999px; }
.room-code-box { background: #f1f5fd; padding: 7px 8px 7px 12px; border-radius: 9px; }
#copyRoomCode { border: 0; background: var(--surface); color: var(--blue-dark); box-shadow: 0 1px 3px rgba(23,35,63,.14); }

.waiting-body { background: #f5f8fe; min-height: 430px; }
.waiting-left { padding: 26px 28px; }
.settings-list { gap: 9px; margin: 0; }
.setting-row { padding: 8px 10px; border-bottom: 1px solid var(--line); color: #34405a; }
.setting-row:last-child { border-bottom: 0; }
.setting-row label { font-weight: 700; }
.setting-row select, .setting-row .fixed-val { width: 205px; min-height: 38px; border: 1px solid var(--line); border-radius: 8px; }
.setting-row select { color: var(--ink); background: var(--surface); cursor: pointer; }
.setting-row .fixed-val { display: flex; align-items: center; background: #edf2fa; color: #526079; font-weight: 600; cursor: default; }
.waiting-actions { margin-top: 28px; }
.btn-start { flex: 1; border-radius: 9px; padding: 14px; font-size: 18px; box-shadow: 0 4px 0 #258850, 0 8px 16px rgba(56,184,106,.24); }
.btn-start:not(:disabled):hover { background: #38b86a; box-shadow: 0 3px 0 #258850, 0 9px 18px rgba(56,184,106,.3); }
.btn-start:disabled, .setting-row select:disabled { cursor: not-allowed; opacity: .55; box-shadow: none; transform: none; }

.waiting-right { padding: 22px; min-height: auto; border-left: 1px solid var(--line); background: var(--surface); }
.players-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-weight: 800; font-size: 18px; }
#player-count { color: var(--blue-dark); background: #e7efff; padding: 4px 9px; border-radius: 999px; font-size: 13px; }
#player-list { display: flex; flex-direction: column; gap: 8px; }
.lobby-player { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #f8faff; color: var(--ink); }
.lobby-player-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.host-badge { color: #8b5b00; background: #fff1c9; border-radius: 999px; padding: 4px 7px; font-size: 10px; font-weight: 800; letter-spacing: .5px; }

.game-container { width: min(1440px, 96vw); height: min(920px, 95vh); gap: 12px; }
.game-header { min-height: 66px; height: 66px; border-radius: 14px; padding: 0 26px; box-shadow: 0 8px 20px rgba(19,49,110,.17); color: var(--ink); }
#round-display, #timer-display { font-size: 16px; color: var(--blue-dark); }
#word-display { font-size: clamp(18px, 2vw, 26px); letter-spacing: 3px; }
.game-body { gap: 12px; min-height: 0; }
.players-panel, #chat-container, #canvas-container { border-radius: 14px; box-shadow: 0 10px 24px rgba(19,49,110,.18); overflow: hidden; }
.players-panel { width: 245px; padding: 17px; background: var(--surface); }
.players-panel h3 { margin: 0 0 14px; padding-bottom: 11px; border-bottom: 1px solid var(--line); color: var(--ink); }
#game-player-list { display: flex; flex-direction: column; gap: 8px; }
#game-player-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; padding: 11px 12px; margin: 0; border: 1px solid var(--line); border-radius: 9px; background: #f8faff; color: var(--ink); }
#game-player-list li.is-drawer { background: #fff4d1; border-color: #f4cc65; color: #704c00; }
.player-points { background: #e6efff; color: var(--blue-dark); border-radius: 999px; padding: 3px 7px; font-weight: 800; }
.game-player-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.player-role { grid-column: 1; margin-top: 3px; color: #7b879b; font-size: 10px; font-weight: 800; letter-spacing: .4px; }
#canvas-container { position: relative; min-width: 0; background: #eef3fd; padding: 16px; }
#canvas-container canvas { max-width: 100%; max-height: 100%; object-fit: contain; border: 2px solid #c9d7f0; border-radius: 6px; box-shadow: 0 3px 10px rgba(23,35,63,.12); }
#drawing-tools { position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 1; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.92); box-shadow: 0 3px 12px rgba(23,35,63,.15); }
#drawing-tools button { padding: 9px 12px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); font-weight: 700; }
#drawing-tools button:hover { background: #edf3ff; }
#drawing-tools button.active { background: var(--blue); border-color: var(--blue); }
#chat-container { width: 320px; background: var(--surface); }
#chat-header { display: flex; justify-content: space-between; align-items: center; padding: 15px; background: var(--ink); font-weight: 800; }
.chat-status { color: #a7f3c3; font-size: 10px; letter-spacing: 1px; }
#chat-box { background: #f8faff; padding: 12px; }
.message { margin-bottom: 8px; padding: 9px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; color: #34405a; box-shadow: 0 1px 2px rgba(23,35,63,.04); }
.message.system { border: 0; background: #fff4d5; color: #765309; }
#chat-input-container { padding: 10px; gap: 8px; border-top: 1px solid var(--line); }
#message-input { padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
#send-btn { width: auto; padding: 0 15px; border: 0; border-radius: 8px; background: var(--blue); color: var(--surface); font-weight: 800; cursor: pointer; }
#send-btn:hover { background: var(--blue-dark); }

@media (max-width: 900px) {
    body { overflow: auto; }
    .waiting-body, .game-body { flex-direction: column; overflow: auto; }
    .waiting-right, .players-panel, #chat-container { width: 100%; border-left: 0; }
    .waiting-right { border-top: 1px solid var(--line); }
    .game-container { height: auto; min-height: 95vh; }
    #canvas-container { min-height: 620px; flex: none; }
    #drawing-tools { bottom: 22px; }
    #chat-container { min-height: 270px; }
}

@media (max-width: 560px) {
    .waiting-header { gap: 8px; flex-wrap: wrap; }
    .waiting-left { padding: 18px; }
    .setting-row select, .setting-row .fixed-val { width: 150px; }
    .game-container { width: 94vw; }
    .game-header { padding: 0 14px; }
    #canvas-container { min-height: 420px; padding: 8px; }
}
