:root {
    --bg-color: #FFFBF0;
    /* Cream */
    --text-color: #5D5D5D;
    --card-bg: #FFFFFF;

    /* Cozy Palette */
    --primary-color: #B5EAD7;
    /* Pastel Green */
    --secondary-color: #87CEEB;
    /* Sky Blue */
    --accent-color: #FFB7B2;
    /* Pastel Red/Pink */
    --peach: #FFDAC1;
    --warm-gray: #D3C4BE;
    --highlight-color: #FFB7B2;

    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --radius: 12px;
}

body {
    margin: 0;
    font-family: 'Nunito', 'Segoe UI', Roboto, sans-serif;
    /* Updated Font */
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

.game-container {
    width: 100%;
    max-width: 500px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
}

header {
    text-align: center;
    flex-shrink: 0;
}



h1 {
    margin: 0;
    color: var(--peach);
    font-size: 2.5rem;
    text-shadow: 2px 2px 0px var(--accent-color);
    letter-spacing: 1px;
}

.subtitle {
    margin: 5px 0 15px 0;
    color: var(--primary-color);
    font-weight: bold;
    letter-spacing: 0.5px;
}

.score-board {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}



.score-card {
    background: var(--card-bg);
    padding: 10px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 2px solid transparent;
}

.score-card.active {
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.score-label {
    font-size: 0.9rem;
    /* Increased size */
    text-transform: uppercase;
    color: var(--warm-gray);
    font-weight: bold;
}

.score-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-color);
}

#game-area {
    flex-grow: 1;
    overflow-y: auto;
    background: var(--card-bg);
    /* Or transparent */
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.03);
    /* Subtle inset for depth */
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;

    /* Hide Scrollbar but keep functionality */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

#game-area::-webkit-scrollbar {
    display: none;
}

.word-bubble {
    background: var(--bg-color);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    align-self: flex-start;
    animation: popIn 0.3s ease;
    border: 2px solid transparent;
}

.word-bubble.current {
    border-color: var(--primary-color);
    background: #fff;
    order: 9999;
    /* Just in case */
}

/* Player Bubble Colors */
.word-bubble.p1 {
    align-self: flex-start;
    background: var(--primary-color);
    /* Green */
    color: #555;
    border-bottom-left-radius: 4px;
}

.word-bubble.p2 {
    align-self: flex-end;
    background: var(--secondary-color);
    /* Blue */
    color: #fff;
    border-bottom-right-radius: 4px;
}

.word-bubble.system {
    align-self: center;
    background: var(--warm-gray);
    color: #fff;
    font-size: 0.9rem;
    border-radius: 12px;
}

.input-group {
    margin-bottom: 15px;
}

.input-group input {
    padding: 10px;
    font-size: 1rem;
    border: 2px solid var(--default-border);
    border-radius: 8px;
    width: 80%;
    text-align: center;
}

#input-area {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding-bottom: 10px;
    /* Safe area for mobile */
}

#word-input {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    border: 2px solid var(--warm-gray);
    border-radius: var(--radius);
    outline: none;
    text-align: center;
    font-family: inherit;
    font-weight: bold;
    color: var(--text-color);
    box-shadow: var(--shadow);
    transition: border-color 0.3s;
}

#word-input:focus {
    border-color: var(--primary-color);
}

#next-letter-hint {
    margin-top: 10px;
    color: var(--warm-gray);
    font-weight: bold;
    font-size: 0.9rem;
}

#target-letter {
    color: var(--accent-color);
    font-size: 1.1rem;
    text-transform: uppercase;
}

/* Message Container Centered */
#message-container {
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--incorrect-color);
    font-size: 0.9rem;
    font-weight: bold;
}

/* Round Indicators */
.round-container {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    justify-content: center;
}

.round-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s;
}

.round-dot.filled {
    background-color: var(--highlight-color);
    /* Default highlight */
}

/* Player specific dot colors if needed, but highlight is fine */
#p1-rounds .round-dot.filled {
    background-color: var(--primary-color);
}

#p2-rounds .round-dot.filled {
    background-color: var(--secondary-color);
}

.message {
    background-color: var(--peach);
    color: var(--text-color);
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    border: 2px solid var(--accent-color);
}

.message.show {
    opacity: 1;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 251, 240, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 80%;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-content h2 {
    color: var(--primary-color);
    margin-top: 0;
    font-size: 2rem;
}

.modal-content p {
    font-size: 1.2rem;
    margin-bottom: 25px;
}

button {
    background: var(--primary-color);
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #555;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, background 0.2s;
}

button:hover {
    transform: scale(1.05);
    background: #9fd8c4;
}

/* Animations */
@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

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

/* Game Overlay */
.game-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    backdrop-filter: blur(5px);
}

.game-overlay.hidden {
    display: none;
}

.overlay-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 90%;
    width: 400px;
}

/* Lobby Styles */
input[type="text"] {
    padding: 15px;
    font-size: 1.2rem;
    border: 3px solid #EEE;
    border-radius: 12px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    color: #555;
    font-weight: bold;
    margin-bottom: 20px;
    transition: border-color 0.3s;
}

input[type="text"]:focus {
    border-color: #B5EAD7;
}

.lobby-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.join-section {
    display: flex;
    gap: 10px;
}

.join-section input {
    margin-bottom: 0;
    flex: 1;
    text-transform: uppercase;
}

.join-section button {
    flex: 1;
}

/* General Button Styles for Lobby */
button {
    flex: 1;
    /* Default flex behavior used in WordPlay */
    padding: 15px;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

button:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: #B5EAD7;
    color: #444;
}

.btn-secondary {
    background-color: #EEE;
    color: #333;
}

.room-code-display {
    font-size: 2.5rem;
    font-family: monospace;
    letter-spacing: 5px;
    color: var(--text-color);
    background: #f9f9f9;
    padding: 10px 20px;
    border-radius: 10px;
    margin: 10px 0;
    border: 2px dashed var(--warm-gray);
}

.instruction {
    font-size: 0.9rem;
    color: var(--warm-gray);
}