/* CSS DESIGN SYSTEM: GLASSMORPHISM & DYNAMIC AESTHETICS */

:root {
    --bg-dark: #0f1123;
    --primary: #6366f1; /* Indigo */
    --primary-glow: rgba(99, 102, 241, 0.4);
    --secondary: #ec4899; /* Pink */
    --secondary-glow: rgba(236, 72, 153, 0.4);
    --success: #10b981; /* Emerald */
    --success-glow: rgba(16, 185, 129, 0.3);
    --warning: #f59e0b; /* Amber */
    --warning-glow: rgba(245, 158, 11, 0.3);
    --danger: #ef4444; /* Rose */
    --danger-outline: rgba(239, 68, 68, 0.4);
    
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-highlight: rgba(255, 255, 255, 0.2);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --border-radius: 20px;
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    min-height: 100vh;
    overflow: hidden; /* Prevent body scrolling entirely */
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 12px;
    box-sizing: border-box;
}

/* Background Glowing Shapes for Depth Blur (Glassmorphism effect) */
.bg-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
    pointer-events: none;
    animation: float-slow 15s infinite alternate ease-in-out;
}

.bg-glow-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--primary) 0%, rgba(99, 102, 241, 0) 70%);
    top: -100px;
    left: -100px;
}

.bg-glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--secondary) 0%, rgba(236, 72, 153, 0) 70%);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

.bg-glow-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #3b82f6 0%, rgba(59, 130, 246, 0) 70%);
    top: 50%;
    left: 60%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes float-slow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 30px) scale(1.1); }
}

/* Container for App */
.app-container {
    width: 100%;
    height: 100%;
    max-width: 100%;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

/* GLASS CARD COMPONENT */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border-radius: var(--border-radius);
    padding: 40px;
    width: 100%;
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    display: none; /* Controlled by JS active class */
    transform: scale(0.98);
    opacity: 0;
}

.glass-card.active {
    display: block;
    transform: scale(1);
    opacity: 1;
}

/* 1. START SCREEN (HERO) STYLES */
#start-screen {
    max-width: 600px;
    text-align: center;
}

.logo-container {
    width: 90px;
    height: 90px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    animation: pulse-glow 2s infinite ease-in-out;
}

.main-icon {
    font-size: 40px;
    color: white;
}

.main-title {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    letter-spacing: -1px;
}

.text-gradient {
    background: linear-gradient(90deg, #818cf8, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.05rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 30px;
}

.features-summary {
    display: flex;
    justify-content: space-around;
    gap: 15px;
    margin-bottom: 35px;
    flex-wrap: wrap;
}

.feature-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    flex: 1;
}

.feature-item i {
    font-size: 20px;
    color: var(--primary);
}

.feature-item span {
    font-size: 0.85rem;
    font-weight: 600;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: linear-gradient(90deg, var(--primary) 0%, #4f46e5 100%);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: var(--glass-highlight);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(90deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px var(--success-glow);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5);
}

.btn-warning {
    background: linear-gradient(90deg, var(--warning) 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px var(--warning-glow);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(245, 158, 11, 0.5);
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.btn-danger-outline:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}

.btn-icon {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--glass-highlight);
    transform: scale(1.05);
}

/* 2. GAME SCREEN STYLES */
#game-screen {
    padding: 15px 20px;
    max-width: 100%;
}

#game-screen.active {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
    padding: 15px 25px;
    box-sizing: border-box;
}

.game-header {
    display: none !important; /* Hide game header completely as requested */
}

/* ACTIVE CLUE BANNER STYLING */
.active-clue-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 8px 15px;
    margin-bottom: 8px;
    gap: 15px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.banner-clue-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: all 0.2s ease;
}

.banner-clue-item.across {
    border-left: 3px solid var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.banner-clue-item.down {
    border-left: 3px solid var(--secondary);
    background: rgba(236, 72, 153, 0.05);
}

.clue-badge {
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.06);
}

.banner-clue-item.across .clue-badge {
    color: #818cf8;
}

.banner-clue-item.down .clue-badge {
    color: #f472b6;
}

.active-clue-banner .clue-text {
    font-size: 0.95rem; /* Compact smaller font size */
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-main);
}

.placeholder-clue {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

.game-title-info {
    flex-grow: 1;
    margin-left: 15px;
}

.game-title-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.badge {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    padding: 2px 10px;
    border-radius: 30px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stats-panel {
    display: flex;
    gap: 12px;
}

.stat-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.stat-box i {
    color: var(--primary);
}

/* Game Content Grid & Panel Layout */
.game-content {
    display: flex;
    flex: 1;
    gap: 15px;
    width: 100%;
    overflow: hidden;
    align-items: stretch;
    box-sizing: border-box;
}

/* Crossword Grid Section */
.grid-section {
    flex: 1;
    display: flex;
    flex-direction: row; /* Side-by-side layout: Grid on left, Controls on right */
    gap: 15px;
    height: 100%;
    overflow: hidden;
    transition: all 0.3s ease;
}

.grid-scroll-wrapper {
    flex: 1;
    width: 100%;
    overflow: hidden;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.crossword-grid {
    display: grid;
    gap: 2px;
    user-select: none;
    container-type: size;
    transition: width 0.3s ease, height 0.3s ease;
    box-sizing: border-box;
}

/* Crossword Cell Item */
.grid-cell {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

/* Empty grid slots */
.grid-cell.empty {
    background: transparent;
    border: none;
    pointer-events: none;
}

/* Active puzzle slot containing character */
.grid-cell.letter {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
}

.grid-cell.letter:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.3);
}

.grid-cell .cell-number {
    position: absolute;
    top: 0.2cqw;
    left: 0.3cqw;
    font-size: 0.75cqw;
    font-weight: 800;
    color: var(--text-muted);
    line-height: 1;
    pointer-events: none;
    z-index: 2;
}

.grid-cell input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    text-align: center;
    font-size: 1.8cqw;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    caret-color: transparent;
    cursor: pointer;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 6%;
    box-sizing: border-box;
}

/* Interactive States */
.grid-cell.highlight-word {
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(99, 102, 241, 0.4);
}

.grid-cell.active-cell {
    background: rgba(99, 102, 241, 0.35) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Check Status Validation colors */
.grid-cell.correct {
    background: rgba(16, 185, 129, 0.2) !important;
    border-color: var(--success) !important;
}

.grid-cell.incorrect {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: var(--danger) !important;
}

/* Action Controls Column (Side Right) */
.control-actions {
    display: flex;
    flex-direction: column; /* Stacked vertically */
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 60px; /* Small width */
    height: 100%;
    flex-shrink: 0;
    margin-top: 0; /* Clear bottom margin */
}

.control-actions .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 58px;
    padding: 0;
    font-size: 0.68rem; /* Very small text label */
    font-weight: 700;
    border-radius: 10px;
    text-transform: none;
    letter-spacing: 0.1px;
    gap: 4px;
}

.control-actions .btn i {
    font-size: 1.15rem; /* Icon size */
}

.control-actions .btn span {
    display: block;
}

/* Clues / Petunjuk Panel */
.clues-section {
    width: 360px;
    min-width: 360px;
    display: none !important; /* Hide sidebar globally - clues list is only in popup modal */
    flex-direction: column;
    height: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.clues-section.collapsed {
    width: 0;
    min-width: 0;
    opacity: 0;
    pointer-events: none;
    border-color: transparent;
    margin-right: -15px;
}

.clues-header-title {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--glass-border);
    text-align: center;
    font-weight: 700;
    color: white;
    font-size: 1.1rem;
}

.clue-section-title {
    font-weight: 700;
    color: var(--primary);
    margin: 5px 0 8px 0;
    padding-bottom: 3px;
    border-bottom: 1px dashed var(--glass-border);
    font-size: 0.85rem;
}

.clue-section-title:first-child {
    margin-top: 5px;
}

.clues-lists-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px 15px;
}

.clues-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Clue Items */
.clue-item {
    padding: 4px 6px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 6px;
}

.clue-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.clue-item.active {
    background: rgba(99, 102, 241, 0.12);
    border-color: var(--primary);
}

.clue-item.resolved {
    opacity: 0.5;
}

.clue-item.resolved .clue-number {
    background: var(--success);
    color: white;
}

.clue-number {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    border-radius: 3px;
    background: var(--glass-border);
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-main);
}

.clue-text {
    font-size: 0.72rem;
    line-height: 1.3;
    color: var(--text-main);
}

.clue-item.resolved .clue-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Custom Scrollbar for clues and lists */
.clues-lists-wrapper::-webkit-scrollbar,
.grid-scroll-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.clues-lists-wrapper::-webkit-scrollbar-track,
.grid-scroll-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.clues-lists-wrapper::-webkit-scrollbar-thumb,
.grid-scroll-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.clues-lists-wrapper::-webkit-scrollbar-thumb:hover,
.grid-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 3. MODAL OVERLAY (SUCCESS SCREEN) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 17, 35, 0.6);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: none; /* Hide completely from DOM layout tree when inactive */
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    display: flex !important; /* Show as flex container when active */
    opacity: 1;
    pointer-events: all;
}

.modal-overlay.active .glass-card {
    display: block !important;
    opacity: 1 !important;
    transform: scale(1) !important;
}

.modal-content {
    max-width: 550px;
    text-align: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.15);
    animation: modal-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-enter {
    0% { transform: scale(0.8) translateY(20px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.win-icon-wrapper {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.4);
}

.win-icon {
    font-size: 36px;
    color: white;
}

.win-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 25px 0;
}

.win-stat-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.win-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.win-stat-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
}

.win-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* 4. TOAST NOTIFICATION */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(15, 17, 35, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 12px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 200;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.toast.active {
    transform: translateX(-50%) translateY(0);
}

.toast-icon {
    color: var(--primary);
}

/* CONFETTI STYLES */
.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #f00;
    opacity: 0.8;
    z-index: 10;
    border-radius: 20%;
    animation: confetti-fall 3s linear infinite;
}

@keyframes confetti-fall {
    0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(400px) rotate(360deg); opacity: 0; }
}

/* ANIMATION UTILITIES */
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 10px 35px rgba(99, 102, 241, 0.7); }
}

/* Start Screen Name Input styling */
.name-input-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 15px;
    margin: 0 auto 25px;
    max-width: 320px;
    gap: 10px;
    transition: all var(--transition-speed) ease;
}

.name-input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.name-input-container i {
    color: var(--primary);
    font-size: 1.1rem;
}

.name-input-container input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    width: 100%;
}

.name-input-container input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

/* Admin Link button on Start Screen */
.admin-portal-link {
    margin-top: 20px;
}

.btn-admin-link {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--transition-speed) ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-admin-link:hover {
    color: var(--primary);
}

/* Timer Box Side Control */
.timer-box-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 58px;
    height: 52px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    font-size: 0.7rem;
    font-weight: 700;
    gap: 2px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.timer-box-side i {
    color: var(--secondary);
    font-size: 0.95rem;
}

.timer-box-side span {
    display: block;
    line-height: 1.1;
}

/* ADMIN PORTAL PANEL STYLING */
.admin-card {
    max-width: 680px !important;
    text-align: left !important;
    padding: 30px !important;
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.admin-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.btn-close:hover {
    color: var(--danger);
}

.admin-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.admin-input-group {
    display: flex;
    gap: 10px;
}

.admin-input-group input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 10px 15px;
    color: white;
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s ease;
}

.admin-input-group input:focus {
    border-color: var(--primary);
}

.dashboard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.dashboard-controls h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
}

.table-wrapper {
    max-height: 280px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.15);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.admin-table th, .admin-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-table th {
    background: rgba(15, 17, 35, 0.9);
    backdrop-filter: blur(4px);
    font-weight: 700;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 10;
}

.admin-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.admin-table td {
    color: var(--text-main);
    font-weight: 500;
}

/* Small helper button */
.btn-sm {
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
    border-radius: 8px !important;
}

/* MOBILE RESPONSIVE OPTIMIZATION */
@media (max-width: 768px) {
    body {
        padding: 6px;
        overflow: hidden !important; /* Force no scroll on body level */
        height: 100vh !important;
    }
    
    #start-screen {
        padding: 24px;
        width: 100%;
        max-width: 90%;
    }
    
    #game-screen.active {
        padding: 10px 12px;
        height: 100vh !important; /* Fullscreen height */
        display: flex !important;
        flex-direction: column;
        overflow: hidden;
        
        /* FIX FOR VISIBILITY: Force active card to display */
        opacity: 1 !important;
        transform: scale(1) !important;
    }
    
    .game-content {
        flex-direction: column;
        flex: 1; /* Stretch to fill remaining space between banner and bottom */
        height: 100% !important;
        overflow: hidden;
        gap: 10px;
    }
    
    .grid-section {
        flex-direction: column; /* Grid above, controls below */
        flex: 1;
        overflow: hidden;
        gap: 8px;
        height: 100% !important;
    }
    
    .grid-scroll-wrapper {
        flex: 1 !important; /* Fill space dynamically, no hardcoded heights! */
        overflow: auto !important; /* Enable scrolling in both directions! */
        -webkit-overflow-scrolling: touch; /* Kinetic scrolling on iOS devices */
        display: block !important;
        width: 100%;
        height: 100% !important;
        max-height: none !important;
        padding: 10px;
        position: relative;
        background: rgba(0, 0, 0, 0.25);
    }
    
    .crossword-grid {
        /* Force minimum size on mobile for scrolling two directions */
        width: 864px !important; /* 32 cols * 26px cells + gaps */
        height: 621px !important; /* 23 rows * 26px cells + gaps */
        aspect-ratio: 32 / 23;
        margin: 0;
    }
    
    .grid-cell {
        border-radius: 3px;
    }
    
    .grid-cell input {
        font-size: 13px !important; /* readable fixed font sizes for touch keys */
        padding-top: 4px !important;
    }
    
    .grid-cell .cell-number {
        font-size: 7px !important;
        top: 1.5px !important;
        left: 2px !important;
    }
    
    .control-actions {
        flex-direction: row; /* Horizontal control row at bottom */
        width: 100%;
        height: 42px; /* Static height at bottom */
        flex-shrink: 0; /* Pinned statics, do not collapse! */
        gap: 8px;
        margin-top: 0;
        align-items: center;
        justify-content: center;
    }
    
    .control-actions .btn {
        flex-direction: row;
        width: auto;
        height: 38px;
        flex: 1;
        font-size: 0.74rem; /* Optimasi font size untuk 5 tombol */
        padding: 0 6px; /* Perkecil padding horizontal */
        border-radius: 8px;
        gap: 4px;
        white-space: nowrap; /* Mencegah pembungkusan teks */
    }
    
    .control-actions .btn i {
        font-size: 0.95rem;
    }
    
    .timer-box-side {
        flex-direction: row;
        width: auto;
        height: 38px;
        padding: 0 6px; /* Perkecil padding horizontal */
        font-size: 0.74rem;
        gap: 4px;
    }
    
    .timer-box-side i {
        font-size: 0.95rem;
    }
    
    .active-clue-banner {
        flex-direction: column !important; /* Stack clues vertically on mobile */
        align-items: stretch !important;
        padding: 8px 12px !important;
        gap: 6px !important;
        margin-bottom: 6px;
    }
    
    .banner-clue-item {
        width: 100% !important;
    }
    
    .active-clue-banner .clue-text {
        font-size: 0.85rem !important;
    }
    
    .modal-content, .admin-card {
        max-width: 92% !important;
        width: 92% !important;
        padding: 20px !important;
        box-sizing: border-box;
    }
    
    .win-stats {
        grid-template-columns: 1fr;
    }
    
    .win-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .win-actions button {
        width: 100%;
    }
    
    /* Responsive adjustment for clues modal */
    .clues-modal-columns {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .clues-modal-card {
        padding: 20px !important;
        width: 95% !important;
    }
}

/* CLUES MODAL POPUP SPECIFIC STYLES (DESKTOP/ALL) */
.clues-modal-card {
    max-width: 800px !important;
    width: 90% !important;
    padding: 30px !important;
    text-align: left !important;
}

.clues-modal-body {
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 5px;
}

.clues-modal-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.clues-modal-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.clues-modal-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Custom list item inside modal */
.clues-modal-list .clue-item {
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-align: left;
}

.clues-modal-list .clue-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.clues-modal-list .clue-item.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
}

.clues-modal-list .clue-item.resolved {
    opacity: 0.5;
}

.clues-modal-list .clue-item.resolved .clue-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

