/* Modern Reset & Base Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #fafaf9; /* Warm paper print background */
    --card-bg: #ffffff;
    --border-color: #1c1917; /* Slate dark border */
    --text-primary: #1c1917;
    --text-secondary: #57534e;
    --accent-cyan: #1c1917;
    --accent-purple: #44403c;
    --accent-emerald: #1c1917;
    --accent-glow: rgba(0, 0, 0, 0.05);
    --font-heading: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;

    /* Theme-specific styling variables (Default Print) */
    --bg-grad-1: transparent;
    --bg-grad-2: transparent;
    --orb-color-1: transparent;
    --orb-color-2: transparent;
    --orb-color-3: transparent;
}

body.theme-aurora {
    --bg-primary: #0b0f19;
    --card-bg: rgba(17, 24, 39, 0.55);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent-cyan: #00f2fe;
    --accent-purple: #9d4edd;
    --accent-emerald: #10b981;
    --accent-glow: rgba(0, 242, 254, 0.15);
    --bg-grad-1: rgba(20, 30, 80, 0.4);
    --bg-grad-2: rgba(80, 20, 90, 0.3);
    --orb-color-1: rgba(0, 242, 254, 0.3);
    --orb-color-2: rgba(157, 78, 221, 0.2);
    --orb-color-3: rgba(16, 185, 129, 0.15);
}

body.theme-ocean {
    --bg-primary: #071624;
    --card-bg: rgba(13, 33, 53, 0.6);
    --border-color: rgba(72, 202, 228, 0.12);
    --text-primary: #e0f2fe;
    --text-secondary: #74c69d;
    --accent-cyan: #4cc9f0;
    --accent-purple: #0096c7;
    --accent-emerald: #52b788;
    --accent-glow: rgba(76, 201, 240, 0.18);
    --orb-color-1: rgba(76, 201, 240, 0.25);
    --orb-color-2: rgba(0, 150, 199, 0.2);
    --orb-color-3: rgba(82, 183, 136, 0.15);
    --bg-grad-1: rgba(2, 62, 138, 0.4);
    --bg-grad-2: rgba(20, 83, 45, 0.25);
}

body.theme-sunset {
    --bg-primary: #1a0f1d;
    --card-bg: rgba(43, 20, 48, 0.6);
    --border-color: rgba(254, 197, 61, 0.12);
    --text-primary: #fffbeb;
    --text-secondary: #fca5a5;
    --accent-cyan: #f59e0b;
    --accent-purple: #ec4899;
    --accent-emerald: #10b981;
    --accent-glow: rgba(245, 158, 11, 0.18);
    --orb-color-1: rgba(245, 158, 11, 0.25);
    --orb-color-2: rgba(236, 72, 153, 0.2);
    --orb-color-3: rgba(251, 113, 133, 0.15);
    --bg-grad-1: rgba(120, 20, 60, 0.35);
    --bg-grad-2: rgba(124, 45, 18, 0.35);
}

body.theme-forest {
    --bg-primary: #0a100d;
    --card-bg: rgba(20, 30, 25, 0.6);
    --border-color: rgba(143, 196, 172, 0.12);
    --text-primary: #f0fdf4;
    --text-secondary: #a7f3d0;
    --accent-cyan: #10b981;
    --accent-purple: #34d399;
    --accent-emerald: #059669;
    --accent-glow: rgba(16, 185, 129, 0.18);
    --orb-color-1: rgba(16, 185, 129, 0.25);
    --orb-color-2: rgba(52, 211, 153, 0.2);
    --orb-color-3: rgba(20, 83, 45, 0.15);
    --bg-grad-1: rgba(6, 78, 59, 0.4);
    --bg-grad-2: rgba(20, 30, 15, 0.3);
}

body.theme-cyberpunk {
    --bg-primary: #0f051d;
    --card-bg: rgba(28, 5, 45, 0.65);
    --border-color: rgba(255, 0, 127, 0.25);
    --text-primary: #ffffff;
    --text-secondary: #f472b6;
    --accent-cyan: #ff007f;
    --accent-purple: #39ff14;
    --accent-emerald: #00ffff;
    --accent-glow: rgba(255, 0, 127, 0.25);
    --orb-color-1: rgba(255, 0, 127, 0.3);
    --orb-color-2: rgba(57, 255, 20, 0.25);
    --orb-color-3: rgba(0, 255, 255, 0.2);
    --bg-grad-1: rgba(15, 5, 40, 0.6);
    --bg-grad-2: rgba(0, 0, 80, 0.4);
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 10% 10%, var(--bg-grad-1) 0px, transparent 50%),
        radial-gradient(at 90% 90%, var(--bg-grad-2) 0px, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.8s ease-in-out, color 0.8s ease-in-out;
}

/* Decorative Background Orbs */
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.5;
    pointer-events: none;
}
.orb-1 {
    top: 15%;
    left: 10%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, var(--orb-color-1) 0%, transparent 70%);
    animation: float 20s infinite ease-in-out;
    transition: background 0.8s ease-in-out;
}
.orb-2 {
    bottom: 15%;
    right: 10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--orb-color-2) 0%, transparent 70%);
    animation: float 25s infinite ease-in-out reverse;
    transition: background 0.8s ease-in-out;
}
.orb-3 {
    top: 50%;
    left: 45%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--orb-color-3) 0%, transparent 70%);
    animation: float 15s infinite ease-in-out 5s;
    transition: background 0.8s ease-in-out;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-40px) scale(1.1); }
    100% { transform: translateY(0) scale(1); }
}

/* App Layout */
.app-container {
    width: 100%;
    max-width: 1200px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: relative;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.logo-area {
    display: flex;
    flex-direction: column;
}

.logo-area h1 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 28px;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 24px;
    filter: drop-shadow(0 0 8px var(--accent-cyan));
}

.subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 2px;
}

.audio-controls {
    display: flex;
    gap: 12px;
}

/* General Buttons & Inputs */
.control-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: 12px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.control-btn.active {
    background: rgba(0, 242, 254, 0.1);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.2);
}

.primary-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
    border: none;
    color: #ffffff;
    padding: 14px;
    border-radius: 12px;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(157, 78, 221, 0.25);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 242, 254, 0.4);
    filter: brightness(1.1);
}

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

.hint-btn-premium {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #ffffff !important;
    border: none !important;
    padding: 8px 16px !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    border-radius: 8px !important;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
    animation: hint-glow 1.5s infinite alternate ease-in-out;
    transition: all 0.3s ease;
}

@keyframes hint-glow {
    0% { box-shadow: 0 0 4px rgba(245, 158, 11, 0.4); }
    100% { box-shadow: 0 0 15px rgba(245, 158, 11, 0.8); }
}

.hint-btn-premium:hover {
    transform: scale(1.05) translateY(-1px);
    filter: brightness(1.1);
}

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

/* Glassmorphism Panel Setup */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

/* Main Game Layout */
.game-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
}

@media (max-width: 850px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
}

/* Sidebar Styling */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
    height: fit-content;
}

.sidebar-panel .panel-section:nth-child(1) {
    order: 2; /* Game Settings second */
}

.sidebar-panel .panel-section:nth-child(2) {
    order: 1; /* Words to Find first */
}

.panel-section h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    border-left: 3px solid var(--accent-cyan);
    padding-left: 8px;
    color: var(--text-primary);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.control-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-group select {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 10px 12px;
    font-family: var(--font-body);
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.control-group select option {
    background: #1e293b;
    color: var(--text-primary);
    transition: none;
}

.control-group select:hover {
    background: #334155;
    border-color: rgba(255, 255, 255, 0.3);
}

.control-group select:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.2);
}

/* Word List & Progress */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    border-radius: 3px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.word-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.word-list::-webkit-scrollbar {
    width: 4px;
}

.word-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.word-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.word-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    user-select: none;
}

.word-item.found {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--accent-emerald);
    text-decoration: line-through;
    opacity: 0.75;
    box-shadow: inset 0 0 10px rgba(16, 185, 129, 0.05);
}

.word-item.found::after {
    content: "✓";
    font-weight: 800;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: space-around;
    padding: 16px;
    margin-bottom: 24px;
    gap: 16px;
}

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

.stat .label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat .value {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 22px;
    color: #ffffff;
    margin-top: 4px;
    text-shadow: 0 2px 10px rgba(255, 255, 255, 0.05);
}

#streak.burning {
    animation: pulse-fire 0.8s infinite alternate;
    color: #f97316;
}

@keyframes pulse-fire {
    0% { transform: scale(1); filter: drop-shadow(0 0 2px #f97316); }
    100% { transform: scale(1.15); filter: drop-shadow(0 0 12px #ef4444); }
}

/* Grid Board Panel */
.board-panel {
    display: flex;
    flex-direction: column;
}

.grid-container {
    position: relative;
    padding: 16px;
    width: 100%;
    max-width: min(100%, 60vh); /* Prevents game from being too tall on desktop */
    aspect-ratio: 1;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(10, 15, 30, 0.4);
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    container-type: inline-size; /* Added container query support */
}

.selection-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.word-grid {
    display: grid;
    width: 100%;
    height: 100%;
    gap: 6px;
    user-select: none;
    touch-action: none; /* Prevents scrolling when drawing on touch screens */
}

/* Individual Cell Styling */
.grid-cell {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(10px, 4.2cqw, 22px); /* Proportional scaling inside container */
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.25s, border-color 0.25s, color 0.25s, transform 0.25s;
    position: relative;
    z-index: 2;
}

.grid-cell:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
    z-index: 3;
}

.grid-cell.selected {
    background: rgba(0, 242, 254, 0.2);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.3);
    transform: scale(1.05);
}

.grid-cell.found {
    font-weight: 800;
    animation: cell-found-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes cell-found-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.grid-cell.hint {
    background: rgba(251, 191, 36, 0.3) !important;
    border-color: #fbbf24 !important;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.6);
    animation: hint-pulse 0.5s infinite alternate ease-in-out;
    z-index: 5;
}

@keyframes hint-pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

/* Modals & Overlays */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.3s ease;
}

.modal-content {
    width: 90%;
    max-width: 450px;
    padding: 40px 32px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    border-color: rgba(255, 255, 255, 0.12);
}

.modal-icon {
    font-size: 64px;
    filter: drop-shadow(0 0 16px rgba(255, 215, 0, 0.4));
    animation: trophy-bounce 2s infinite ease-in-out;
}

@keyframes trophy-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

.modal-content h2 {
    font-family: var(--font-heading);
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-content p {
    color: var(--text-secondary);
    font-size: 14px;
}

.modal-stats {
    display: flex;
    justify-content: space-around;
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.modal-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modal-stat span {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.modal-stat strong {
    font-family: var(--font-heading);
    font-size: 20px;
    color: #ffffff;
}

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

.animate-pop {
    animation: pop-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes pop-in {
    0% { transform: scale(0.85); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Print Theme Specific UI Adjustments (Applied when body has no theme- class or theme-print) */
body.theme-print,
body:not([class*="theme-"]) {
    background-color: #fafaf9;
    background-image: none !important; /* No gradients */
}

body.theme-print .orb,
body:not([class*="theme-"]) .orb {
    display: none !important;
}

body.theme-print .glass-card,
body:not([class*="theme-"]) .glass-card {
    background: #ffffff;
    backdrop-filter: none;
    box-shadow: none;
    border: 2px solid #1c1917;
    border-radius: 0px;
}

body.theme-print header,
body:not([class*="theme-"]) header {
    background: #ffffff;
    backdrop-filter: none;
    box-shadow: none;
    border: 2px solid #1c1917;
    border-radius: 0px;
}

body.theme-print .logo-area h1,
body:not([class*="theme-"]) .logo-area h1 {
    background: none;
    -webkit-text-fill-color: initial;
    color: #1c1917;
}

body.theme-print .logo-icon,
body:not([class*="theme-"]) .logo-icon {
    filter: none;
}

body.theme-print .grid-container,
body:not([class*="theme-"]) .grid-container {
    background: #ffffff;
    box-shadow: none;
    border: 2px solid #1c1917;
    border-radius: 0px;
}

body.theme-print .grid-cell,
body:not([class*="theme-"]) .grid-cell {
    background: transparent;
    border: 1px solid #d6d3d1;
    border-radius: 0px;
    color: #1c1917;
}

body.theme-print .grid-cell:hover,
body:not([class*="theme-"]) .grid-cell:hover {
    background: #f5f5f4;
    transform: scale(1.02);
}

body.theme-print .grid-cell.selected,
body:not([class*="theme-"]) .grid-cell.selected {
    background: rgba(253, 224, 71, 0.4); /* Highlighter yellow */
    color: #000000;
    box-shadow: none;
    transform: scale(1.02);
}

body.theme-print .grid-cell.found,
body:not([class*="theme-"]) .grid-cell.found {
    font-weight: 900;
    color: #000000;
}

body.theme-print .primary-btn,
body:not([class*="theme-"]) .primary-btn {
    background: #1c1917;
    color: #ffffff;
    border: 2px solid #1c1917;
    border-radius: 0px;
    box-shadow: none;
}

body.theme-print .primary-btn:hover,
body:not([class*="theme-"]) .primary-btn:hover {
    background: #ffffff;
    color: #1c1917;
    transform: translateY(-2px);
    box-shadow: none;
}

body.theme-print .control-btn,
body:not([class*="theme-"]) .control-btn {
    background: #ffffff;
    border: 2px solid #1c1917;
    border-radius: 0px;
    color: #1c1917;
    box-shadow: none;
}

body.theme-print .control-btn:hover,
body:not([class*="theme-"]) .control-btn:hover {
    background: #f5f5f4;
    transform: translateY(-2px);
    box-shadow: none;
}

body.theme-print .control-btn.active,
body:not([class*="theme-"]) .control-btn.active {
    background: #1c1917;
    color: #ffffff;
    box-shadow: none;
}

body.theme-print .hint-btn-premium,
body:not([class*="theme-"]) .hint-btn-premium {
    background: #ffffff !important;
    color: #1c1917 !important;
    border: 2px solid #1c1917 !important;
    box-shadow: none !important;
    animation: none !important;
    border-radius: 0px !important;
}

body.theme-print .word-item,
body:not([class*="theme-"]) .word-item {
    background: #f5f5f4;
    border: 1px solid #d6d3d1;
    border-radius: 0px;
    color: #1c1917;
}

body.theme-print .word-item.found,
body:not([class*="theme-"]) .word-item.found {
    background: #e7e5e4;
    border-color: #d6d3d1;
    color: #78716c;
    text-decoration: line-through;
}

body.theme-print .stat .value,
body:not([class*="theme-"]) .stat .value {
    color: #1c1917;
    text-shadow: none;
}

body.theme-print .control-group select,
body:not([class*="theme-"]) .control-group select {
    background: #ffffff;
    border: 2px solid #1c1917;
    border-radius: 0px;
    color: #1c1917;
}

body.theme-print .control-group select option,
body:not([class*="theme-"]) .control-group select option {
    background: #ffffff;
    color: #1c1917;
}

body.theme-print .modal-content,
body:not([class*="theme-"]) .modal-content {
    background: #ffffff;
    border: 2px solid #1c1917;
    border-radius: 0px;
    box-shadow: none;
}

body.theme-print .modal-content h2,
body:not([class*="theme-"]) .modal-content h2 {
    background: none;
    -webkit-text-fill-color: initial;
    color: #1c1917;
    font-size: 32px;
}

body.theme-print .modal-stats,
body:not([class*="theme-"]) .modal-stats {
    background: #f5f5f4;
    border: 1px solid #d6d3d1;
    border-radius: 0px;
}

body.theme-print .modal-stat strong,
body:not([class*="theme-"]) .modal-stat strong {
    color: #1c1917;
}

/* Responsive Stacking & Aspect Ratio Formatting for 1080p Viewports */
@media (max-aspect-ratio: 1.15/1) or (max-width: 850px) {
    .game-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .board-panel {
        order: 1; /* Board goes to the top */
    }
    
    .sidebar-panel {
        order: 2; /* Sidebar controls go below */
        display: flex;
        flex-direction: column;
        padding: 16px;
        gap: 16px;
        height: auto;
    }
    
    .sidebar-panel .panel-section:nth-child(1) {
        order: 2; /* Game Settings goes second (at the bottom) */
    }
    
    .sidebar-panel .panel-section:nth-child(2) {
        order: 1; /* Words to Find goes first (directly below board) */
    }
    
    .grid-container {
        max-width: min(100%, 50vh); /* Enforces height constraint so word list stays visible */
    }
    
    .word-list {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        max-height: 120px;
        overflow-y: auto;
        justify-content: center;
    }
    
    .word-item {
        padding: 6px 12px;
        font-size: 13px;
        flex: 0 1 auto;
    }
    
    .app-container {
        padding: 12px;
        gap: 12px;
    }
    
    header {
        padding: 12px 16px;
    }
    
    .logo-area h1 {
        font-size: 22px;
    }
}
