.stats-section {
    background-color: #3e2723;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    border-left: 4px solid #ffcc80;
}

.stats-section h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #5d4037;
    font-size: 0.9rem;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item span:first-child {
    color: #ccc;
}

.room-stat {
    background-color: #3e2723;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 15px;
    border-left: 4px solid #80cbc4;
}

.room-stat h4 {
    color: #80cbc4;
    margin-bottom: 10px;
    font-size: 1rem;
}

.room-stat .stat-item {
    padding: 6px 0;
    border-bottom: 1px solid #5d4037;
    font-size: 0.85rem;
}* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #0a0a0a;
    color: #e0e0e0;
    font-family: "Noto Serif SC", "Songti SC", serif;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

#game-container {
    width: 100%;
    max-width: 600px;
    background-color: #1a1a1f;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.2);
    position: relative;
}

/* LOGIN SCREEN */
#login-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 20px;
    gap: 20px;
}

#login-screen h1 {
    font-size: 2rem;
    color: #667eea;
    text-align: center;
    line-height: 1.4;
}

.sub-title {
    font-size: 0.6em;
    color: #aaa;
    display: block;
    font-weight: normal;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 400px;
}

.login-form input {
    padding: 12px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    font-size: 0.9rem;
}

.login-btn {
    padding: 15px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.login-btn:hover {
    background-color: #764ba2;
}

.btn-sub {
    display: block;
    font-size: 0.75em;
    opacity: 0.8;
    font-weight: normal;
}

.login-divider {
    text-align: center;
    color: #777;
    font-size: 0.9em;
}

.error-msg {
    color: #ef5350;
    font-size: 0.85rem;
    min-height: 20px;
    text-align: center;
}

.secondary-btn {
    padding: 12px;
    background-color: #764ba2;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.secondary-btn:hover {
    background-color: #667eea;
}

/* CODE ENTRY SCREEN */
#code-screen {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 20px;
    gap: 20px;
}

/* GAME SCREEN */
#game-screen {
    display: none;
    flex-direction: column;
    height: 100vh;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px;
    text-align: center;
    border-bottom: 2px solid #667eea;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 1.2rem;
    color: #ffcc80;
    flex: 1;
    line-height: 1.2;
}

.header-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-header {
    padding: 6px 12px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: bold;
    transition: opacity 0.2s;
}

.btn-header:hover {
    opacity: 0.8;
}

.toggle-stats {
    background-color: #ffcc80;
    color: #3e2723;
}

.logout-btn {
    background-color: #ef5350;
    color: white;
}

#chat-window {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 10px;
    line-height: 1.5;
}

.ai-msg {
    align-self: flex-start;
    background-color: #2a2a3e;
    border-left: 4px solid #667eea;
}

.user-msg {
    align-self: flex-end;
    background-color: #263238;
    border-right: 4px solid #80cbc4;
}

.system-msg {
    align-self: center;
    color: #ef5350;
    font-style: italic;
    font-size: 0.9rem;
    text-align: center;
}

#stats-display {
    display: none;
    background-color: #2a2a3e;
    padding: 10px;
    border-top: 2px solid #667eea;
    border-bottom: 2px solid #667eea;
    font-size: 0.85rem;
    text-align: center;
    color: #667eea;
}

#input-area {
    padding: 20px;
    background-color: #1a1a1d;
    display: flex;
    gap: 10px;
}

#user-input {
    flex: 1;
    padding: 12px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    font-size: 1rem;
}

#send-btn {
    padding: 10px 15px;
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s;
}

#send-btn:hover:not(:disabled) {
    background-color: #764ba2;
}

#send-btn:disabled {
    background-color: #555;
    cursor: not-allowed;
}

/* MODALS */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal {
    background-color: #1a1a1f;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.3);
    border: 1px solid #3a3a4e;
}

.modal h2 {
    color: #667eea;
    margin-bottom: 20px;
    text-align: center;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.modal-form input {
    padding: 12px;
    border-radius: 5px;
    border: 1px solid #555;
    background-color: #333;
    color: white;
    font-size: 0.9rem;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.modal-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}

.modal-btn.primary {
    background-color: #667eea;
    color: white;
}

.modal-btn.secondary {
    background-color: #764ba2;
    color: white;
}

.modal-btn:hover {
    opacity: 0.9;
}

.win-overlay {
    background: linear-gradient(135deg, #4e342e 0%, #3e2723 100%);
    text-align: center;
}

.win-overlay h2 {
    color: #ffcc80;
    font-size: 1.8rem;
    margin-bottom: 10px;
}

.win-overlay p {
    margin-bottom: 20px;
    line-height: 1.5;
}

.fireworks {
    font-size: 2rem;
    margin-bottom: 20px;
}

.back-btn {
    background: transparent;
    border: none;
    color: #ffcc80;
    cursor: pointer;
    font-size: 0.9em;
    margin-bottom: 10px;
    text-decoration: underline;
    align-self: flex-start;
}



#session-stats-bar {
    background-color: #3e2723;
    padding: 10px 20px;
    border-top: 2px solid #8d6e63;
    display: flex;
    justify-content: center;
    gap: 30px;
    font-size: 0.9rem;
    color: #ccc;
}

#session-stats-bar span {
    display: flex;
    gap: 5px;
}

#session-stats-bar span span {
    color: #ffcc80;
    font-weight: bold;
}
