/* Sõnamäng - Word Search Game Styles */

:root {
    --tile-base: #D4A574;
    --tile-light: #E8C9A8;
    --tile-dark: #B8956A;
    --bg-color: #F5F0E8;
    --vowel-color: #E53935;
    --plosive-color: #43A047;
    --consonant-color: #1E88E5;
    --selected-glow: rgba(255, 215, 0, 0.9);
    --valid-glow: rgba(50, 205, 50, 0.9);
    --invalid-glow: rgba(255, 69, 0, 0.7);
}

.section {
    background: linear-gradient(135deg, #F5F0E8 0%, #E8DFD0 100%);
    min-height: calc(100vh - 52px);
    padding: 1.2rem;
}

.game-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

/* Side Panels */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.left-panel {
    align-items: center;
    padding-top: 95px; /* Align with game board top */
    align-self: stretch;
}

.left-controls {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: auto;
    margin-bottom: calc(46px + 0.6rem);
}

/* Bombs - stacked vertically */
.bombs-container {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.bomb-icon {
    width: 38px;
    height: 38px;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.bomb-icon.active:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.3));
}

.bomb-icon.active:active {
    transform: scale(0.9);
}

.bomb-icon.used {
    cursor: not-allowed;
    opacity: 0.3;
}

.bomb-icon svg {
    width: 100%;
    height: 100%;
}

/* Game Buttons */
.game-btn {
    width: 46px;
    height: 46px;
    border: none;
    background: rgba(255,255,255,0.85);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 9px;
    color: #444;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.game-btn:hover {
    transform: scale(1.08);
    background: white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    color: #222;
}

.game-btn:active {
    transform: scale(0.95);
}

.game-btn.active {
    background: #4CAF50;
    color: white;
}

.btn-svg {
    width: 100%;
    height: 100%;
}

.game-btn.muted {
    opacity: 0.5;
}

.game-btn.muted .sound-wave {
    opacity: 0;
}

.game-btn.end-game-btn {
    background: rgba(156, 39, 176, 0.2);
    color: #9C27B0;
}

.game-btn.end-game-btn:hover {
    background: rgba(156, 39, 176, 0.3);
    color: #7B1FA2;
}

.game-btn.home-btn {
    background: rgba(255, 152, 0, 0.15);
    color: #FF9800;
}

.game-btn.home-btn:hover {
    background: rgba(255, 152, 0, 0.25);
    color: #F57C00;
}

.game-btn.is-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.4);
    pointer-events: none;
}

.game-btn.is-disabled:hover {
    transform: none;
    background: rgba(255,255,255,0.85);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    color: #444;
}

/* Game Area */
.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Stats Row - Score and Time */
.stats-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    margin-bottom: 0.5rem;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stat-divider {
    color: #999;
    font-size: 1.5rem;
    font-weight: 300;
}

.stat-label-small {
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

#score {
    font-family: 'Georgia', serif;
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    display: inline-block;
    width: 70px;
    text-align: center;
}

#time-left {
    font-family: 'Georgia', serif;
    font-size: 2rem;
    font-weight: bold;
    color: #333;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    display: inline-block;
    width: 60px;
    text-align: center;
}

.time-value-container {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.time-display #time-left.time-warning {
    color: #E53935;
    animation: time-pulse 1s ease infinite;
}

@keyframes time-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.time-display #time-left.time-bonus {
    color: #4CAF50 !important;
    animation: time-bonus-flash 0.6s ease !important;
}

@keyframes time-bonus-flash {
    0% { transform: scale(1); }
    30% { transform: scale(1.25); color: #4CAF50; }
    100% { transform: scale(1); }
}

.score-pop {
    animation: score-bounce 0.4s ease;
}

@keyframes score-bounce {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(1.2); }
    60% { transform: scale(0.95); }
}

/* Progress Bar */
.progress-container {
    width: 100%;
    max-width: 480px;
    height: 8px;
    background: #ddd;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    width: 100%;
    transition: width 0.3s ease, background 0.3s ease;
    border-radius: 4px;
}

/* Grid Container */
.grid-container {
    position: relative;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 14px;
    padding: 10px;
    box-shadow: 
        0 6px 24px rgba(0,0,0,0.1),
        inset 0 0 0 1px rgba(255,255,255,0.5);
}

/* Start Overlay */
.start-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, #3a3a3a 0%, #2d2d2d 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 20;
}

.start-overlay.active {
    opacity: 1;
    visibility: visible;
}

.start-content {
    text-align: center;
    color: white;
    padding: 1.5rem;
}

.start-title {
    font-family: 'Georgia', serif;
    font-size: 2.2rem;
    font-weight: bold;
    letter-spacing: 4px;
    margin-bottom: 1.5rem;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.start-rules {
    text-align: left;
    margin-bottom: 2rem;
    font-size: 0.95rem;
    line-height: 1.8;
}

.start-rules p {
    margin-bottom: 0.6rem;
    opacity: 0.9;
}

.rules-toggle-btn {
    margin-bottom: 0.6rem;
}

/* Game Mode Selection */
.mode-selection {
    margin-bottom: 1.2rem;
}

.mode-label {
    font-size: 0.85rem;
    color: #ccc;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mode-buttons {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
}

.mode-btn {
    padding: 0.6rem 0.4rem;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #ddd;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    min-width: 100px;
}

.mode-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

.mode-btn.active {
    background: rgba(255, 215, 0, 0.2);
    border-color: #FFD700;
    color: #FFD700;
}

.mode-btn .mode-icon {
    font-size: 1.4rem;
}

.mode-btn .mode-name {
    font-size: 0.75rem;
}

.mode-hint {
    font-size: 0.75rem;
    color: #aaa;
    margin-top: 0.5rem;
    min-height: 1.2em;
    transition: color 0.2s ease;
}

/* Relaxed mode sub-options */
.relaxed-options {
    margin-top: 0.4rem;
}

.relaxed-option-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.relaxed-opt-btn {
    padding: 0.3rem 0.65rem;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.08);
    border-radius: 6px;
    color: #ccc;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.relaxed-opt-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.4);
}

.relaxed-opt-btn.active {
    background: rgba(156, 39, 176, 0.25);
    border-color: #CE93D8;
    color: #CE93D8;
}

/* Bomb infinity label */
.bomb-inf-label {
    font-size: 1.1rem;
    font-weight: bold;
    color: #9C27B0;
    text-align: center;
    line-height: 1;
}

.mode-hint.warning {
    color: #FFB74D;
}

.start-status {
    margin-top: 0.9rem;
    margin-bottom: 0;
    font-weight: 600;
    color: #FFE082;
    opacity: 1;
}

.start-status.ready {
    display: none;
}

.start-status.warning {
    color: #FFCC80;
    animation: start-status-pop 0.25s ease;
}

@keyframes start-status-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#start-btn.start-btn-disabled {
    opacity: 0.6;
    filter: grayscale(0.2);
    cursor: not-allowed;
}

#start-btn.start-btn-disabled:hover {
    transform: none;
}

/* Pause Overlay */
.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #2d2d2d;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 20;
}

.pause-overlay.active {
    opacity: 1;
    visibility: visible;
}

.pause-content {
    text-align: center;
    color: white;
}

.pause-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.pause-text {
    font-size: 1.8rem;
    font-weight: bold;
    letter-spacing: 4px;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    user-select: none;
    touch-action: none;
}

/* Letter Tiles */
.letter-tile {
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Georgia', serif;
    font-size: 1.55rem;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    background: linear-gradient(145deg, var(--tile-light) 0%, var(--tile-base) 50%, var(--tile-dark) 100%);
    border-radius: 7px;
    box-shadow: 
        inset 2px 2px 4px rgba(255,255,255,0.4),
        inset -2px -2px 4px rgba(0,0,0,0.1),
        2px 2px 6px rgba(0,0,0,0.18);
}

.letter-tile::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    background: linear-gradient(145deg, var(--tile-light) 0%, var(--tile-base) 100%);
    border-radius: 5px;
    z-index: 0;
}

.letter-tile span {
    position: relative;
    z-index: 1;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.12);
}

/* Letter Colors by Type */
.letter-tile.color-vowel span { color: var(--vowel-color); }
.letter-tile.color-plosive span { color: var(--plosive-color); }
.letter-tile.color-consonant span { color: var(--consonant-color); }

/* Tile States */
.letter-tile:hover {
    transform: translateY(-2px);
    box-shadow: 
        inset 2px 2px 4px rgba(255,255,255,0.4),
        inset -2px -2px 4px rgba(0,0,0,0.1),
        4px 4px 12px rgba(0,0,0,0.22);
}

/* Pending removal - tile is queued for removal, can't be selected */
.letter-tile.pending-removal {
    opacity: 0.6;
    pointer-events: none;
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.6);
}

.letter-tile.selected {
    transform: scale(1.06);
    box-shadow: 
        0 0 0 3px var(--selected-glow),
        inset 2px 2px 4px rgba(255,255,255,0.5),
        4px 4px 16px rgba(0,0,0,0.25);
    z-index: 10;
}

.letter-tile.deselecting {
    animation: deselect-pop 0.12s ease;
}

@keyframes deselect-pop {
    0% { transform: scale(1.06); }
    50% { transform: scale(0.94); }
    100% { transform: scale(1); }
}

.letter-tile.celebrating {
    animation: celebrate 0.4s ease;
    box-shadow: 0 0 0 3px var(--valid-glow), 0 0 16px var(--valid-glow);
}

@keyframes celebrate {
    0% { transform: scale(1); }
    30% { transform: scale(1.15) rotate(-4deg); }
    60% { transform: scale(1.1) rotate(4deg); }
    100% { transform: scale(1); }
}

.letter-tile.invalid {
    animation: shake 0.35s ease;
    box-shadow: 0 0 0 3px var(--invalid-glow);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px) rotate(-2deg); }
    40% { transform: translateX(5px) rotate(2deg); }
    60% { transform: translateX(-4px) rotate(-1deg); }
    80% { transform: translateX(4px) rotate(1deg); }
}

/* Removing animation */
.letter-tile.removing {
    animation: tile-remove 0.25s ease-out forwards;
    pointer-events: none;
}

@keyframes tile-remove {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08) rotate(8deg); opacity: 0.6; }
    100% { transform: scale(0) rotate(20deg); opacity: 0; }
}

/* Cascade falling animation */
.letter-tile.cascade-fall {
    animation: cascade-fall 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes cascade-fall {
    0% { transform: translateY(var(--fall-distance, -70px)) scale(0.88); opacity: 0; }
    30% { opacity: 1; }
    70% { transform: translateY(5px) scale(1.01); }
    85% { transform: translateY(-2px) scale(0.99); }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

/* Pop-in animation for replace mode */
.letter-tile.pop-in {
    animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes pop-in {
    0% { transform: scale(0) rotate(-15deg); opacity: 0; }
    50% { transform: scale(1.15) rotate(5deg); opacity: 1; }
    75% { transform: scale(0.95) rotate(-2deg); }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* Bomb animations */
.grid-container.bomb-shake {
    animation: bomb-shake 0.4s ease;
}

@keyframes bomb-shake {
    0%, 100% { transform: translate(0, 0); }
    10% { transform: translate(-6px, -4px); }
    20% { transform: translate(6px, 4px); }
    30% { transform: translate(-5px, 3px); }
    40% { transform: translate(5px, -3px); }
    50% { transform: translate(-4px, 4px); }
    60% { transform: translate(4px, -2px); }
    70% { transform: translate(-3px, 2px); }
    80% { transform: translate(2px, -1px); }
    90% { transform: translate(-1px, 1px); }
}

.explosion-ring {
    position: fixed;
    width: 60px;
    height: 60px;
    border: 4px solid #FFD700;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: explosion-ring 0.5s ease-out forwards;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 0 20px #FF6B35, 0 0 40px #FF4444;
}

@keyframes explosion-ring {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; border-width: 8px; }
    100% { transform: translate(-50%, -50%) scale(8); opacity: 0; border-width: 1px; }
}

.bomb-spark {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: bomb-spark 0.5s ease-out forwards;
    pointer-events: none;
    z-index: 1000;
    box-shadow: 0 0 6px currentColor;
}

@keyframes bomb-spark {
    0% { 
        transform: translate(-50%, -50%) rotate(var(--angle)) translateX(0) scale(1);
        opacity: 1;
    }
    100% { 
        transform: translate(-50%, -50%) rotate(var(--angle)) translateX(var(--distance)) scale(0);
        opacity: 0;
    }
}

.letter-tile.bomb-flash {
    animation: bomb-flash 0.25s ease;
}

@keyframes bomb-flash {
    0% { filter: brightness(1); transform: scale(1); }
    50% { filter: brightness(2.5) saturate(0.3); transform: scale(1.08); background: #FFF8E0; }
    100% { filter: brightness(1); transform: scale(1); }
}

.letter-tile.bomb-remove {
    animation: bomb-remove 0.35s ease-out forwards;
}

@keyframes bomb-remove {
    0% { transform: scale(1) rotate(0deg); opacity: 1; }
    40% { transform: scale(1.1) rotate(10deg); }
    100% { transform: scale(0) rotate(180deg); opacity: 0; }
}

/* Current Word Display */
.current-word {
    min-height: 45px;
    margin-top: 0.75rem;
    font-family: 'Georgia', serif;
    font-size: 1.6rem;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.08);
}

/* Bonus Time Display */
.bonus-time {
    font-family: 'Georgia', serif;
    font-size: 1.4rem;
    font-weight: bold;
    color: #4CAF50;
    opacity: 0;
    min-width: 45px;
    text-shadow: 0 1px 4px rgba(76, 175, 80, 0.4);
}

.bonus-time.show {
    animation: bonus-pop 1.5s ease forwards;
}

@keyframes bonus-pop {
    0% { opacity: 0; transform: translateX(-10px) scale(0.7); }
    15% { opacity: 1; transform: translateX(3px) scale(1.15); }
    30% { transform: translateX(0) scale(1); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translateY(-8px); }
}

/* Right Panel */
.right-panel {
    padding-top: 76px;
    align-items: flex-start;
}

/* Found Words Container */
.found-words-container {
    background: transparent;
    border-radius: 14px;
    padding: 0.75rem;
    box-shadow: none;
    width: 130px;
}

.found-words-title {
    font-size: 0.8rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.found-words-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 429px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.found-word {
    background: linear-gradient(145deg, var(--tile-light), var(--tile-base));
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #333;
    box-shadow: 1px 2px 4px rgba(0,0,0,0.1);
    animation: word-slide-in 0.25s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.found-word .points {
    color: #2e7d32;
    font-weight: bold;
    font-size: 0.7rem;
}

@keyframes word-slide-in {
    from { opacity: 0; transform: translateX(15px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Instructions Box */
.instructions-box {
    max-width: 600px;
    margin: 1.5rem auto 0;
    background: white;
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.instructions-title {
    font-size: 1rem;
    font-weight: bold;
    color: #333;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.instructions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.instructions-list li {
    padding: 0.4rem 0;
    padding-left: 1.4rem;
    position: relative;
    color: #555;
    font-size: 0.9rem;
    line-height: 1.35;
}

.instructions-list li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--consonant-color);
    font-weight: bold;
}

/* Modal Styles */
.modal-card-wide {
    max-width: 700px;
    width: 95%;
}

.modal-columns {
    display: flex;
    gap: 1.5rem;
}

.modal-left {
    flex: 1;
    text-align: center;
}

.modal-right {
    flex: 1;
    border-left: 1px solid #eee;
    padding-left: 1.5rem;
}

.result-stats {
    padding: 0.5rem 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
}

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

.stat-label {
    color: #666;
}

.stat-value {
    font-weight: bold;
    color: #333;
    font-size: 1rem;
}

/* Name Submit Section */
.name-submit-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.name-label {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.name-input-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.name-input-row .input {
    max-width: 160px;
    text-align: center;
}

.name-hint {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.3rem;
}

.name-submitted {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f0fff0;
    border-radius: 8px;
}

.name-not-qualified {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f5f5f5;
    border-radius: 8px;
    color: #666;
}

.name-relaxed-mode {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f3e5f5;
    border-radius: 8px;
    color: #7b1fa2;
}

/* Leaderboard Tabs */
.leaderboard-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tab-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: none;
    background: #eee;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: #ddd;
}

.tab-btn.active {
    background: var(--tile-base);
    color: white;
}

/* Leaderboard Content */
.leaderboard-content {
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-loading {
    text-align: center;
    padding: 2rem;
    color: #999;
}

.leaderboard-empty {
    text-align: center;
    padding: 2rem;
    color: #999;
    font-style: italic;
}

/* Leaderboard Header */
.leaderboard-header {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.25rem;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lbh-rank {
    width: 28px;
}

.lbh-name {
    flex: 1;
}

.lbh-stats {
    display: flex;
    gap: 0.4rem;
    margin-right: 0.5rem;
}

.lbh-longest {
    min-width: 32px;
    text-align: center;
}

.lbh-avg {
    min-width: 38px;
    text-align: center;
}

.lbh-score {
    min-width: 52px;
    text-align: right;
}

.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.25rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
}

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

.leaderboard-item.highlight {
    background: #fffde7;
    border-radius: 4px;
    margin: 0 -0.25rem;
    padding: 0.5rem;
}

.lb-rank {
    width: 28px;
    font-weight: bold;
    color: #999;
}

.lb-rank.gold { color: #FFD700; }
.lb-rank.silver { color: #C0C0C0; }
.lb-rank.bronze { color: #CD7F32; }

.lb-name {
    flex: 1;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-stats {
    display: flex;
    gap: 0.4rem;
    margin-right: 0.5rem;
}

.lb-longest {
    font-size: 0.75rem;
    color: var(--plosive-color);
    min-width: 32px;
    text-align: center;
    font-weight: 600;
}

.lb-avg {
    font-size: 0.75rem;
    color: #999;
    min-width: 38px;
    text-align: center;
}

.lb-score {
    font-weight: bold;
    color: var(--consonant-color);
    min-width: 52px;
    text-align: right;
}

.lb-mode {
    font-size: 0.7rem;
    margin-left: 0.3rem;
    opacity: 0.7;
}

/* Leaderboard scrollbar */
.leaderboard-content::-webkit-scrollbar {
    width: 4px;
}

.leaderboard-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.leaderboard-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* Leaderboard modal z-index */
#leaderboard-modal {
    z-index: 200;
}

#rules-modal {
    z-index: 300;
}

/* Modal responsive */
@media screen and (max-width: 600px) {
    .modal-columns {
        flex-direction: column;
    }
    
    .modal-right {
        border-left: none;
        border-top: 1px solid #eee;
        padding-left: 0;
        padding-top: 1rem;
    }
}

/* Responsive */
@media screen and (max-width: 768px) {
    .game-wrapper {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-areas:
            "controls controls"
            "stats stats"
            "progress progress"
            "grid grid"
            "bombs word"
            "found found";
        align-items: center;
        gap: 0.6rem;
        --board-width: 400px;
        width: min(100%, var(--board-width));
    }
    
    .side-panel {
        flex-direction: row;
        justify-content: center;
        gap: 0.6rem;
    }
    
    .left-panel {
        display: contents;
        padding-top: 0;
        align-self: auto;
    }
    
    .left-controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 0;
        margin-bottom: 0;
        width: 100%;
        grid-area: controls;
    }
    
    .bombs-container {
        flex-direction: row;
        justify-content: flex-start;
        width: auto;
        margin-top: 0;
        grid-area: bombs;
        justify-self: start;
        align-self: center;
    }

    .game-area {
        display: contents;
    }

    .stats-row {
        grid-area: stats;
        justify-self: center;
    }

    .progress-container {
        grid-area: progress;
        justify-self: center;
    }

    #grid-container {
        grid-area: grid;
        justify-self: center;
        width: 100%;
        box-sizing: border-box;
        padding: 8px;
    }

    .current-word {
        grid-area: word;
        margin-top: 12px;
        text-align: left;
        justify-self: start;
        align-self: start;
    }

    .right-panel {
        grid-area: found;
        width: 100%;
        padding-top: 0;
        align-items: center;
        justify-content: center;
    }

    .right-panel .found-words-container {
        width: 100%;
        max-width: 384px;
    }

    .found-words-list {
        width: 100%;
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        max-height: none;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
        scrollbar-width: thin;
    }

    .found-words-list::-webkit-scrollbar {
        height: 4px;
    }

    .found-word {
        white-space: nowrap;
        flex: 0 0 auto;
    }
    
    .letter-tile {
        width: 100%;
        height: auto;
        aspect-ratio: 1 / 1;
        font-size: clamp(1rem, 4.8vw, 1.25rem);
    }
    
    .stats-row {
        gap: 1.5rem;
    }
    
    .score-display span:last-child,
    .time-display span:last-child {
        font-size: 1.8rem;
    }
    
    .game-btn {
        width: 42px;
        height: 42px;
    }

    .start-rules {
        margin-bottom: 1rem;
    }
}

@media screen and (max-width: 400px) {
    .game-wrapper {
        --board-width: 380px;
    }

    .letter-tile {
        border-radius: 5px;
    }
    
    .letter-tile::before {
        top: 2px;
        left: 2px;
        right: 2px;
        bottom: 2px;
    }
    
    .game-grid {
        gap: 3px;
    }
    
    .grid-container {
        padding: 7px;
    }

    .right-panel .found-words-container {
        max-width: 323px;
    }
}

/* Scrollbar styling */
.found-words-list::-webkit-scrollbar {
    width: 4px;
}

.found-words-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.found-words-list::-webkit-scrollbar-thumb {
    background: var(--tile-base);
    border-radius: 2px;
}

.found-words-list::-webkit-scrollbar-thumb:hover {
    background: var(--tile-dark);
}

/* Right panel on smaller screens */
@media screen and (max-width: 900px) {
    .right-panel {
        display: flex;
    }
}

/* ========================================
   TUMEDA REŽIIMI STIILID
   ======================================== */
[data-theme="dark"] {
    --bg-color: #1a1a2e;
    --tile-base: #3a3a5a;
    --tile-light: #4a4a6a;
    --tile-dark: #2a2a4a;
}

/* Section taust */
[data-theme="dark"] .section {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* Mänguala kontainer */
[data-theme="dark"] .grid-container {
    background: rgba(255, 255, 255, 0.06);
}

/* Juhiste kast */
[data-theme="dark"] .instructions-box {
    background: var(--bg-card, #1f2940);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

[data-theme="dark"] .instructions-title {
    color: #e4e4e7;
}

[data-theme="dark"] .instructions-list li {
    color: #a1a1aa;
}

/* Nime sisestamise ala */
[data-theme="dark"] .name-submitted {
    background: rgba(34, 197, 94, 0.15);
}

[data-theme="dark"] .name-relaxed-mode {
    background: rgba(156, 39, 176, 0.15);
    color: #ce93d8;
}

/* Edetabeli highlight */
[data-theme="dark"] .leaderboard-item.highlight {
    background: rgba(255, 215, 0, 0.1);
}

/* Progressibaar taust */
[data-theme="dark"] .progress-container {
    background: #2a2a4a;
}

/* Stat-item border */
[data-theme="dark"] .stat-item {
    border-bottom-color: #3f3f46;
}

[data-theme="dark"] .name-submit-section {
    border-top-color: #3f3f46;
}

/* Leaderboard scrollbar */
[data-theme="dark"] .leaderboard-content::-webkit-scrollbar-track {
    background: #1a1a2e;
}

[data-theme="dark"] .leaderboard-content::-webkit-scrollbar-thumb {
    background: #3a3a5a;
}

[data-theme="dark"] .found-words-list::-webkit-scrollbar-track {
    background: #1a1a2e;
}

[data-theme="dark"] .found-words-list::-webkit-scrollbar-thumb {
    background: #3a3a5a;
}

/* Game buttons */
[data-theme="dark"] .game-btn {
    background: rgba(255,255,255,0.1);
    color: #e4e4e7;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .game-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* Rules/Instructions */
[data-theme="dark"] .start-rules {
    color: #e4e4e7;
}

/* Start overlay */
[data-theme="dark"] .start-overlay {
    background: rgba(26, 26, 46, 0.95);
}

[data-theme="dark"] .start-content {
    color: #e4e4e7;
}

[data-theme="dark"] .bomb-inf-label {
    color: #CE93D8;
}

/* Result stats */
[data-theme="dark"] .result-stats {
    color: #e4e4e7;
}

[data-theme="dark"] .stat-label {
    color: #a1a1aa;
}

[data-theme="dark"] .stat-value {
    color: #e4e4e7;
}

/* Leaderboard */
[data-theme="dark"] .leaderboard-tabs .tab-btn {
    background: #16213e;
    color: #a1a1aa;
    border-color: #3f3f46;
}

[data-theme="dark"] .leaderboard-tabs .tab-btn.active {
    background: #2a3a5a;
    color: #e4e4e7;
}

[data-theme="dark"] .leaderboard-content {
    background: transparent;
}

[data-theme="dark"] .leaderboard-loading,
[data-theme="dark"] .leaderboard-empty {
    color: #a1a1aa;
}

[data-theme="dark"] .leaderboard-header {
    background: #16213e;
    color: #a1a1aa;
    border-bottom-color: #3f3f46;
}

[data-theme="dark"] .leaderboard-list {
    background: transparent;
}

[data-theme="dark"] .leaderboard-item {
    border-bottom-color: #3f3f46;
    color: #e4e4e7;
}

[data-theme="dark"] .leaderboard-item:hover {
    background: #2a3a5a;
}

[data-theme="dark"] .lb-rank {
    color: #a1a1aa;
}

[data-theme="dark"] .lb-name {
    color: #e4e4e7;
}

[data-theme="dark"] .lb-words,
[data-theme="dark"] .lb-time {
    color: #a1a1aa;
}

[data-theme="dark"] .lb-score {
    color: #22d3ee;
}

[data-theme="dark"] .lb-mode {
    color: #71717a;
}

/* Found words panel */
[data-theme="dark"] .found-words-container {
    background: rgba(31, 41, 64, 0.5);
}

[data-theme="dark"] .found-words-title {
    color: #e4e4e7;
}

[data-theme="dark"] .found-word {
    background: linear-gradient(145deg, #3a4a6a, #2a3a5a);
    color: #e4e4e7;
}

[data-theme="dark"] .found-word .points {
    color: #86efac;
}

/* Current word preview */
[data-theme="dark"] .current-word {
    color: #e4e4e7;
}

/* Name label in game over modal */
[data-theme="dark"] .name-label {
    color: #e4e4e7;
}

[data-theme="dark"] .name-hint {
    color: #a1a1aa;
}

[data-theme="dark"] .name-not-qualified {
    color: #a1a1aa;
}

/* Score and Timer display */
[data-theme="dark"] #score,
[data-theme="dark"] #time-left,
[data-theme="dark"] .time-value-container,
[data-theme="dark"] .bonus-time,
[data-theme="dark"] .stat-box {
    color: #e4e4e7;
}

[data-theme="dark"] .stat-label-small {
    color: #a1a1aa;
}

[data-theme="dark"] .stat-divider {
    color: #71717a;
}

/* Game info text */
[data-theme="dark"] .game-info {
    color: #a1a1aa;
}

/* Modal columns */
[data-theme="dark"] .modal-left,
[data-theme="dark"] .modal-right {
    background: transparent;
}

[data-theme="dark"] .modal-right {
    border-left-color: #3f3f46;
}
