:root {
    --bg-color: #1A0A14;
    --primary: #E84393;
    --secondary: #FD79A8;
    --accent: #6C5CE7;
    --text-color: #ffffff;
    --surface: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);

    /* Game Colors */
    --correct: #00b894;
    --present: #e17055;
    --absent: #3a3a3c;

    --key-bg: #818384;
    --key-text: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
    height: 100%;
    position: relative;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    height: 50px;
}

h1 {
    font-size: 1.8rem;
    margin: 0;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(232, 67, 147, 0.5);
    letter-spacing: 2px;
}

.controls button {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: pointer;
    margin-left: 10px;
    transition: transform 0.2s;
}

.controls button:hover {
    transform: scale(1.1);
    color: var(--secondary);
}

main {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    overflow: hidden;
}

#game-board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

#game-board {
    max-width: 100%;
    max-height: 100%;
}

#keyboard {
    width: 100%;
    padding: 10px;
    padding-bottom: 30px; /* Safe area */
}

.row {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
    width: 100%;
}

.row button {
    background-color: var(--key-bg);
    color: var(--key-text);
    border: none;
    border-radius: 4px;
    padding: 0;
    margin: 0 3px;
    height: 58px;
    font-weight: bold;
    font-size: 1.2rem;
    flex: 1;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    user-select: none;
    touch-action: manipulation;
}

.row button:active {
    transform: scale(0.95);
}

.row button.wide {
    flex: 1.5;
    font-size: 0.8rem; /* Fit text */
}

.spacer {
    flex: 0.5;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s;
}

.hidden {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: rgba(26, 10, 20, 0.95);
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    border: 1px solid var(--primary);
    box-shadow: 0 0 30px rgba(232, 67, 147, 0.2);
    position: relative;
    color: var(--text-color);
    text-align: center;
}

.glass {
    backdrop-filter: blur(10px);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--secondary);
}

.stats-grid {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    margin-top: 5px;
}

h2, h3 {
    margin: 0;
    margin-bottom: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#guess-distribution {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-start; /* Left align bars */
}

.dist-bar-container {
    display: flex;
    align-items: center;
    width: 100%;
    font-size: 0.9rem;
}

.dist-bar {
    background-color: var(--absent);
    color: white;
    padding: 2px 8px;
    margin-left: 5px;
    min-width: 20px; /* To show text 0 */
    text-align: right;
    font-weight: bold;
}

.dist-bar.highlight {
    background-color: var(--correct);
}

#next-word-timer {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

#timer {
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
}

/* Toast Messages */
#message-container {
    position: fixed;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 200;
    pointer-events: none;
}

.message {
    background-color: var(--text-color);
    color: var(--bg-color);
    padding: 12px 20px;
    border-radius: 4px;
    font-weight: bold;
    opacity: 1;
    transition: opacity 0.5s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Key States - applied by JS */
button.correct {
    background-color: var(--correct) !important;
    border-color: var(--correct) !important;
}
button.present {
    background-color: var(--present) !important;
    border-color: var(--present) !important;
}
button.absent {
    background-color: var(--absent) !important;
    border-color: var(--absent) !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
