/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    /* Removed scroll-behavior to prevent jumping on mobile */
    scroll-padding-top: 80px;
}

html[data-theme="dark"] {
    color-scheme: dark;
}

html[data-theme="light"] {
    color-scheme: light;
}

/* Global Controls */
.global-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 9999;
}

.control-btn {
    width: 45px;
    height: 45px;
    border: 2px solid rgba(231, 76, 60, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: #e74c3c;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.2);
    border-color: #e74c3c;
    background: rgba(255, 255, 255, 1);
}

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

/* Theme Button Icons */
.theme-btn .sun-icon {
    display: block;
}

.theme-btn .moon-icon {
    display: none;
}

html[data-theme="dark"] .theme-btn .sun-icon {
    display: none;
}

html[data-theme="dark"] .theme-btn .moon-icon {
    display: block;
}

/* Music Button States */
.music-btn.muted {
    color: #95a5a6;
    border-color: rgba(149, 165, 166, 0.3);
}

.music-btn.muted:hover {
    border-color: #95a5a6;
}

/* Dark Mode Styles */
html[data-theme="dark"] .control-btn {
    background: rgba(20, 42, 45, 0.9);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
}

html[data-theme="dark"] .control-btn:hover {
    background: rgba(20, 42, 45, 1);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .music-btn.muted {
    color: #7f8c8d;
    border-color: rgba(127, 140, 141, 0.3);
}

/* Music Control Panel */
.music-control-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 320px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 15px;
    border: 1px solid rgba(231, 76, 60, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.3s ease;
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.music-control-panel.hidden {
    opacity: 0;
    transform: translateY(-20px);
    pointer-events: none;
    visibility: hidden;
}

.music-control-panel.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
    visibility: visible;
}

html[data-theme="dark"] .music-control-panel {
    background: rgba(20, 42, 45, 0.95);
    border-color: rgba(231, 76, 60, 0.2);
    color: #e0e0e0;
}

.music-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(231, 76, 60, 0.2);
}

.music-panel-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #e74c3c;
}

.close-panel-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.close-panel-btn:hover {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
    transform: scale(1.1);
}

.close-panel-btn:active {
    transform: scale(0.95);
    background: rgba(231, 76, 60, 0.2);
}

.music-panel-content {
    padding: 20px;
}

.current-track {
    margin-bottom: 20px;
}

.track-info {
    margin-bottom: 10px;
}

.track-label {
    font-size: 0.85rem;
    color: #666;
    display: block;
    margin-bottom: 5px;
}

.track-name {
    font-size: 1rem;
    font-weight: 600;
    color: #e74c3c;
    display: block;
}

.track-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: #666;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(231, 76, 60, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    width: 0%;
    transition: width 0.1s ease;
}

.music-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.track-btn {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #e74c3c;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.track-btn:hover {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.5);
    transform: scale(1.05);
}

.play-pause-btn {
    width: 50px;
    height: 50px;
    font-size: 1.1rem;
}

.track-list h4 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: #666;
    font-weight: 600;
}

.playlist-container {
    max-height: 200px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(231, 76, 60, 0.3) transparent;
}

.playlist-container::-webkit-scrollbar {
    width: 6px;
}

.playlist-container::-webkit-scrollbar-track {
    background: transparent;
}

.playlist-container::-webkit-scrollbar-thumb {
    background: rgba(231, 76, 60, 0.3);
    border-radius: 3px;
}

.playlist-item {
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    border: 1px solid transparent;
    margin-bottom: 2px;
}

.playlist-item:hover {
    background: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.2);
}

.playlist-item.active {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.4);
    color: #e74c3c;
    font-weight: 600;
}

/* Dark theme adjustments for music panel */
html[data-theme="dark"] .track-label,
html[data-theme="dark"] .track-progress,
html[data-theme="dark"] .track-list h4 {
    color: #b0b0b0;
}

html[data-theme="dark"] .close-panel-btn {
    color: #b0b0b0;
}

html[data-theme="dark"] .close-panel-btn:hover {
    color: #e74c3c;
}

/* Mobile responsive styles for music control panel */
@media (max-width: 768px) {
    .music-control-panel {
        width: calc(100vw - 40px);
        right: 20px;
        left: 20px;
        top: 70px;
        max-width: 350px;
    }

    .music-panel-header {
        padding: 12px 15px;
    }

    .music-panel-header h3 {
        font-size: 1rem;
    }

    .music-panel-content {
        padding: 15px;
    }

    .track-name {
        font-size: 0.9rem;
    }

    .music-controls {
        gap: 12px;
    }

    .track-btn {
        width: 36px;
        height: 36px;
        font-size: 0.8rem;
    }

    .play-pause-btn {
        width: 44px;
        height: 44px;
        font-size: 1rem;
    }

    .playlist-container {
        max-height: 150px;
    }

    .playlist-item {
        padding: 10px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .music-control-panel {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        top: 60px;
    }

    .track-progress {
        font-size: 0.75rem;
    }

    .music-controls {
        gap: 10px;
        margin-bottom: 15px;
    }
}

/* Close Rules Button - Mobile Only */
.close-rules-btn {
    .close-rules-btn.show-mobile {
        display: flex !important;
    }
}

/* Only show on mobile when rules modal is open */
@media (max-width: 768px) {
    .close-rules-btn.show-mobile {
        display: flex !important;
    }
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background-color: #ffffff;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-weight: 400;
    letter-spacing: -0.01em;
    font-size: 0.9rem;
}

html[data-theme="dark"] body {
    color: #e0e0e0;
    background-color: #0a2a2d;
}

/* Interactive Background Elements */
.parallax-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
    backdrop-filter: none;
    /* Prevent layout recalculation on mobile */
    transform: translateZ(0);
}

.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.1s ease-out;
}

.layer-1 {
    background: radial-gradient(circle at 20% 80%, rgba(27, 184, 189, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(27, 184, 189, 0.04) 0%, transparent 50%);
    opacity: 0.6;
}

.layer-2 {
    background: linear-gradient(45deg, transparent 30%, rgba(27, 184, 189, 0.03) 50%, transparent 70%);
    opacity: 0.4;
}

.layer-3 {
    background: radial-gradient(circle at 50% 50%, rgba(27, 184, 189, 0.04) 0%, transparent 70%);
    opacity: 0.3;
}

.layer-4 {
    background: linear-gradient(135deg, transparent 0%, rgba(27, 184, 189, 0.02) 50%, transparent 100%);
    opacity: 0.2;
}

.layer-5 {
    background: radial-gradient(circle at 80% 80%, rgba(27, 184, 189, 0.03) 0%, transparent 60%);
    opacity: 0.4;
}

html[data-theme="dark"] .layer-1 {
    background: radial-gradient(circle at 20% 80%, rgba(27, 184, 189, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(27, 184, 189, 0.2) 0%, transparent 50%);
}

html[data-theme="dark"] .layer-2 {
    background: linear-gradient(45deg, transparent 30%, rgba(27, 184, 189, 0.15) 50%, transparent 70%);
}

html[data-theme="dark"] .layer-3 {
    background: radial-gradient(circle at 50% 50%, rgba(27, 184, 189, 0.2) 0%, transparent 70%);
}

html[data-theme="dark"] .layer-4 {
    background: linear-gradient(135deg, transparent 0%, rgba(27, 184, 189, 0.12) 50%, transparent 100%);
}

html[data-theme="dark"] .layer-5 {
    background: radial-gradient(circle at 80% 80%, rgba(27, 184, 189, 0.18) 0%, transparent 60%);
}

.floating-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(27, 184, 189, 0.6);
    border-radius: 50%;
    animation: float-particle 8s infinite linear;
}

html[data-theme="dark"] .particle {
    background: rgba(27, 184, 189, 0.6);
}

@keyframes float-particle {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(-100px) translateX(100px);
        opacity: 0;
    }
}

.interactive-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    pointer-events: none;
    z-index: 2;
}

.grid-cell {
    border: 1px solid rgba(27, 184, 189, 0.1);
    transition: all 0.3s ease;
}

html[data-theme="dark"] .grid-cell {
    border-color: rgba(27, 184, 189, 0.1);
}

/* Cosmic Effects */
.aurora-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg,
            rgba(27, 184, 189, 0.1) 0%,
            rgba(27, 184, 189, 0.08) 25%,
            rgba(27, 184, 189, 0.1) 50%,
            rgba(27, 184, 189, 0.08) 75%,
            rgba(27, 184, 189, 0.1) 100%);
    animation: aurora-wave 8s ease-in-out infinite;
    opacity: 0.3;
    pointer-events: none;
    z-index: 3;
}

html[data-theme="dark"] .aurora-effect {
    background: linear-gradient(45deg,
            rgba(27, 184, 189, 0.15) 0%,
            rgba(27, 184, 189, 0.12) 25%,
            rgba(27, 184, 189, 0.15) 50%,
            rgba(27, 184, 189, 0.12) 75%,
            rgba(27, 184, 189, 0.15) 100%);
}

@keyframes aurora-wave {

    0%,
    100% {
        transform: translateX(-50%) translateY(-50%) rotate(0deg);
    }

    50% {
        transform: translateX(50%) translateY(50%) rotate(180deg);
    }
}

.nebula-clouds {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 30% 20%, rgba(27, 184, 189, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(27, 184, 189, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 90% 10%, rgba(27, 184, 189, 0.06) 0%, transparent 50%);
    animation: nebula-drift 12s ease-in-out infinite;
    opacity: 0.4;
    pointer-events: none;
    z-index: 4;
}

html[data-theme="dark"] .nebula-clouds {
    background:
        radial-gradient(circle at 30% 20%, rgba(27, 184, 189, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(27, 184, 189, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 90% 10%, rgba(27, 184, 189, 0.1) 0%, transparent 50%);
}

@keyframes nebula-drift {

    0%,
    100% {
        transform: translateX(0) translateY(0) scale(1);
    }

    33% {
        transform: translateX(20px) translateY(-20px) scale(1.1);
    }

    66% {
        transform: translateX(-20px) translateY(20px) scale(0.9);
    }
}

.energy-rings {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    border: 2px solid rgba(27, 184, 189, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: energy-pulse 4s ease-in-out infinite;
    pointer-events: none;
    z-index: 5;
}

.energy-rings::before,
.energy-rings::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 1px solid rgba(27, 184, 189, 0.2);
    border-radius: 50%;
    animation: energy-pulse 4s ease-in-out infinite reverse;
}

.energy-rings::after {
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    border-width: 1px;
}

html[data-theme="dark"] .energy-rings {
    border-color: rgba(27, 184, 189, 0.4);
}

html[data-theme="dark"] .energy-rings::before,
html[data-theme="dark"] .energy-rings::after {
    border-color: rgba(27, 184, 189, 0.3);
}

@keyframes energy-pulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }

    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
}

/* Theme Toggle Button */
.theme-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(27, 184, 189, 0.3), transparent);
    transition: left 0.5s ease;
}

.theme-icon:hover::before {
    left: 100%;
}

.theme-icon svg {
    width: 24px;
    height: 24px;
    color: #ffffff;
    transition: all 0.3s ease;
}

html[data-theme="dark"] .theme-icon svg {
    color: #e0e0e0;
}

.theme-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(27, 184, 189, 0.3);
}

.theme-icon:active {
    transform: scale(0.95);
}

.theme-icon:hover svg {
    color: #1bb8bd;
}

.sun-icon {
    display: block;
}

.moon-icon {
    display: none;
}

html[data-theme="dark"] .sun-icon {
    display: none;
}

html[data-theme="dark"] .moon-icon {
    display: block;
}

.container {
    background: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    backdrop-filter: none;
    max-width: 900px;
    width: 100%;
    height: 725px;
    margin: 0.5rem auto;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.top-controls {
    position: fixed;
    /* top: 3rem; */
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
    pointer-events: auto;
    /* Prevent layout recalculation on mobile */
    transform: translateZ(0);
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    color: #4a5568;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    color: #718096;
    font-size: 1.1rem;
    margin-top: 0.5rem;
    font-style: italic;
}

.etymology {
    color: #a0aec0;
    font-size: 0.9rem;
    margin-top: 0.25rem;
    font-style: italic;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.etymology-note {
    color: #a0aec0;
    font-size: 0.9rem;
    font-style: italic;
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    border-left: 3px solid #e2e8f0;
    background: #f7fafc;
    border-radius: 0 4px 4px 0;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.6);
    padding: 1rem;
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.player-info {
    display: flex;
    gap: 1rem;
}

.player {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: #f7fafc;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 1.1rem;
}

.player.active {
    border-color: #4299e1 !important;
    background: #ebf8ff !important;
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3) !important;
}

.stone {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.stone1 {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
}

.stone2 {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
}

.stone-count {
    background: #4299e1;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.game-status {
    background: #edf2f7;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    color: #4a5568;
    min-width: 200px;
    text-align: center;
    font-size: 1.02rem;
}

.game-board {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    background: transparent;
    border: none;
    box-shadow: none;
    height: 0;
    overflow: visible;
}

.graph-container {
    position: relative;
    width: 300px;
    height: 300px;
    margin: 0 auto;
}

.node {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(145deg, #fff, #e6e6e6);
    border: 3px solid #cbd5e0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.node:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    border-color: #4299e1;
}

.node.occupied {
    /* cursor: not-allowed; */
}

.node.occupied:hover {
    transform: none;
}

.node-content {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.node.player1 .node-content {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
}

.node.player2 .node-content {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
}

.node.valid-move {
    border-color: #48bb78;
    background: linear-gradient(145deg, #f0fff4, #e6fffa);
    animation: pulse 1.5s infinite;
}

.node.selected {
    border-color: #4299e1;
    background: linear-gradient(145deg, #ebf8ff, #bee3f8);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.3);
    animation: selectedPulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes selectedPulse {

    0%,
    100% {
        box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.3);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(66, 153, 225, 0.5);
    }
}

/* Node positions for "4" shape */
#A {
    top: 30px;
    left: 125px;
}

#B {
    top: 115px;
    left: 30px;
}

#C {
    top: 115px;
    left: 125px;
}

#D {
    top: 215px;
    left: 125px;
}

#E {
    top: 115px;
    left: 225px;
}

.edges {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Hide mobile edges by default */
.mobile-edges,
.small-mobile-edges {
    display: none;
}

.edge {
    stroke: #a0aec0;
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke 0.3s ease;
}

.edge.highlighted {
    stroke: #48bb78;
    stroke-width: 8;
    animation: edgePulse 1.5s infinite;
}

@keyframes edgePulse {

    0%,
    100% {
        stroke-width: 8;
    }

    50% {
        stroke-width: 10;
    }
}

.controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
    padding: 1rem;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: absolute;
    top: 81.2%;
    left: 50%;
    transform: translateX(-50%);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.btn-home {
    background: linear-gradient(45deg, #f093fb, #f5576c);
    color: white;
}

.btn-reset {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.btn-rules {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: modalSlideIn 0.3s ease-out;
    color: #e0e0e0;
}

html[data-theme="light"] .modal-content {
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    backdrop-filter: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    color: #2d3748;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close,
.close-rules-btn {
    position: absolute;
    right: 1rem;
    top: 1rem;
    width: 40px;
    height: 40px;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: #a0aec0;
    background: #fff;
    border: none;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.3s, background 0.3s, box-shadow 0.3s;
    z-index: 10;
}

.close:hover,
.close-rules-btn:hover {
    color: #fff;
    background: #4a5568;
    box-shadow: 0 4px 16px rgba(66, 153, 225, 0.15);
}

.rules-content h3 {
    color: #4a5568;
    margin: 1.5rem 0 0.5rem 0;
    font-size: 1.2rem;
}

.rules-content p,
.rules-content ul {
    color: #718096;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.rules-content ul {
    padding-left: 1.5rem;
}

.rules-content li {
    margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
    .modal-content {
        padding: 1rem;
        max-width: 98vw;
        font-size: 0.98rem;
    }

    .rules-content h3 {
        font-size: 1rem;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        margin: 0.5rem;
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .game-info {
        flex-direction: column;
        align-items: stretch;
    }

    .player-info {
        justify-content: center;
    }

    .graph-container {
        width: 300px;
        height: 300px;
    }

    .node {
        width: 40px;
        height: 40px;
    }

    .node-content {
        width: 28px;
        height: 28px;
    }

    /* Node positions for "4" shape */
    #A {
        top: 15px;
        left: 130px;
    }

    #B {
        top: 90px;
        left: 60px;
    }

    #C {
        top: 90px;
        left: 130px;
    }

    #D {
        top: 160px;
        left: 130px;
    }

    #E {
        top: 90px;
        left: 200px;
    }

    .edges {
        width: 300px;
        height: 225px;
    }

    /* Show mobile edges, hide desktop */
    .desktop-edges,
    .small-mobile-edges {
        display: none;
    }

    .mobile-edges {
        display: block;
    }
}

@media (max-width: 480px) {
    body {
        margin: 0;
        padding: 0;
        min-height: 100vh;
        /* Use 100dvh for dynamic viewport height on mobile */
        min-height: 100dvh;
    }

    .container {
        margin: 0.5rem;
        padding: 1rem;
        width: auto;
        height: auto;
        min-height: auto;
        display: flex;
        flex-direction: column;
        /* justify-content: center; */
    }

    header {
        margin-top: 2.5rem;
        margin-bottom: 1rem;
    }

    header h1 {
        font-size: 1.8rem;
    }

    .game-info {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
        margin-bottom: 2rem;
    }

    .player-info {
        display: flex;
        justify-content: center;
        gap: 0.5rem;
    }

    .player {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    .game-status {
        text-align: center;
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
        background: #edf2f7;
        border-radius: 10px;
        margin-top: 0.5rem;
        margin-bottom: 0.25rem;
    }

    .game-board {
        display: flex;
        justify-content: center;
        margin: 0rem 0;
        position: relative;
        z-index: 1;
    }

    .graph-container {
        width: 250px;
        height: 187px;
    }

    .node {
        width: 50px;
        height: 50px;
    }

    .node-content {
        width: 36px;
        height: 36px;
    }

    /* Further adjust positions */
    #A {
        top: -15px;
        left: 100px;
    }

    #B {
        top: 65px;
        left: 15px;
    }

    #C {
        top: 65px;
        left: 100px;
    }

    #D {
        top: 145px;
        left: 100px;
    }

    #E {
        top: 65px;
        left: 185px;
    }

    .edges {
        width: 250px;
        height: 187px;
    }

    /* Show small mobile edges, hide others */
    .desktop-edges,
    .mobile-edges {
        display: none;
    }

    .small-mobile-edges {
        display: block;
    }

    .controls {
        margin-top: 16rem;
        gap: 0.5rem;
        position: relative;
        top: auto;
        left: auto;
        transform: none;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .modal-content {
        padding: 1rem;
        max-width: 98vw;
        font-size: 0.9rem;
    }

    .rules-content h3 {
        font-size: 1rem;
    }

    .rules-content {
        max-width: 100vw;
        overflow-x: auto;
        word-break: break-word;
    }

    /* Mobile theme and audio buttons positioning */
    .theme-icon,
    .audio-btn,
    #musicToggle,
    #sfxToggle {
        position: fixed;
        top: 20px;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        color: #fff;
        transition: all 0.3s ease;
        /* Prevent layout recalculation on mobile */
        transform: translateZ(0);
    }

    .theme-icon {
        right: 140px;
    }

    #musicToggle {
        right: 80px;
    }

    #sfxToggle {
        right: 20px;
    }

    .theme-icon:hover,
    .audio-btn:hover,
    #musicToggle:hover,
    #sfxToggle:hover {
        background: rgba(255, 255, 255, 0.2);
        transform: scale(1.1);
    }
}

/* Squid Game Elements */
.squid-game-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.squid-shape {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    animation: squid-float 6s ease-in-out infinite;
}

.circle-shape {
    top: 10%;
    left: 10%;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border-radius: 50%;
}

.triangle-shape {
    top: 20%;
    right: 15%;
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.square-shape {
    bottom: 25%;
    left: 20%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 0;
}

.circle-shape-2 {
    top: 60%;
    right: 25%;
    background: linear-gradient(45deg, #f093fb, #f5576c);
    border-radius: 50%;
}

.triangle-shape-2 {
    bottom: 15%;
    right: 10%;
    background: linear-gradient(45deg, #4facfe, #00f2fe);
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.square-shape-2 {
    top: 40%;
    left: 5%;
    background: linear-gradient(45deg, #43e97b, #38f9d7);
    border-radius: 0;
}

@keyframes squid-float {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

.pink-soldier {
    position: absolute;
    width: 30px;
    height: 50px;
    background: linear-gradient(45deg, #ff69b4, #ff1493);
    border-radius: 5px;
    animation: soldier-patrol 8s ease-in-out infinite;
}

.soldier-1 {
    top: 15%;
    left: 5%;
    animation-delay: 0s;
}

.soldier-2 {
    top: 45%;
    right: 8%;
    animation-delay: 2s;
}

.soldier-3 {
    bottom: 20%;
    left: 15%;
    animation-delay: 4s;
}

@keyframes soldier-patrol {

    0%,
    100% {
        transform: translateX(0) scale(1);
    }

    25% {
        transform: translateX(50px) scale(1.1);
    }

    50% {
        transform: translateX(0) scale(1);
    }

    75% {
        transform: translateX(-50px) scale(0.9);
    }
}

.game-mask {
    position: absolute;
    width: 35px;
    height: 35px;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    border-radius: 50%;
    animation: mask-glow 4s ease-in-out infinite;
}

.mask-1 {
    top: 30%;
    left: 80%;
    animation-delay: 0s;
}

.mask-2 {
    top: 70%;
    left: 85%;
    animation-delay: 1s;
}

.mask-3 {
    bottom: 30%;
    left: 75%;
    animation-delay: 2s;
}

@keyframes mask-glow {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
        transform: scale(1.2);
    }
}

.glass-panel {
    position: absolute;
    width: 60px;
    height: 40px;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    animation: glass-shimmer 3s ease-in-out infinite;
}

.panel-1 {
    top: 10%;
    left: 60%;
    animation-delay: 0s;
}

.panel-2 {
    top: 25%;
    left: 70%;
    animation-delay: 0.5s;
}

.panel-3 {
    top: 40%;
    left: 65%;
    animation-delay: 1s;
}

.panel-4 {
    top: 55%;
    left: 75%;
    animation-delay: 1.5s;
}

.panel-5 {
    top: 70%;
    left: 60%;
    animation-delay: 2s;
}

.panel-6 {
    top: 85%;
    left: 70%;
    animation-delay: 2.5s;
}

@keyframes glass-shimmer {

    0%,
    100% {
        opacity: 0.7;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.honeycomb-game {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    width: 60px;
    height: 40px;
}

.honeycomb-cell {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    border-radius: 2px;
    animation: honeycomb-pulse 2s ease-in-out infinite;
}

.cell-1 {
    animation-delay: 0s;
}

.cell-2 {
    animation-delay: 0.2s;
}

.cell-3 {
    animation-delay: 0.4s;
}

.cell-4 {
    animation-delay: 0.6s;
}

.cell-5 {
    animation-delay: 0.8s;
}

.cell-6 {
    animation-delay: 1s;
}

@keyframes honeycomb-pulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.tug-rope {
    position: absolute;
    top: 60%;
    left: 10%;
    width: 80px;
    height: 4px;
    background: linear-gradient(45deg, #8b4513, #a0522d);
    border-radius: 2px;
    animation: rope-tug 3s ease-in-out infinite;
}

.rope-segment {
    position: absolute;
    width: 20px;
    height: 4px;
    background: linear-gradient(45deg, #8b4513, #a0522d);
    border-radius: 2px;
}

.segment-1 {
    left: 0;
    animation-delay: 0s;
}

.segment-2 {
    left: 20px;
    animation-delay: 0.2s;
}

.segment-3 {
    left: 40px;
    animation-delay: 0.4s;
}

.segment-4 {
    left: 60px;
    animation-delay: 0.6s;
}

@keyframes rope-tug {

    0%,
    100% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(10px);
    }
}

.marbles-container {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
}

.marble {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    animation: marble-roll 2s ease-in-out infinite;
}

.marble-1 {
    animation-delay: 0s;
}

.marble-2 {
    animation-delay: 0.2s;
}

.marble-3 {
    animation-delay: 0.4s;
}

.marble-4 {
    animation-delay: 0.6s;
}

.marble-5 {
    animation-delay: 0.8s;
}

.marble-6 {
    animation-delay: 1s;
}

@keyframes marble-roll {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(180deg);
    }
}

.doll-container {
    position: absolute;
    top: 80%;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 60px;
    animation: doll-scan 5s ease-in-out infinite;
}

.doll-head {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    border-radius: 50%;
    border: 2px solid #8b4513;
}

.doll-body {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 30px;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    border-radius: 10px;
    border: 2px solid #8b4513;
}

.doll-arm {
    position: absolute;
    top: 30px;
    width: 8px;
    height: 20px;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    border-radius: 4px;
    border: 1px solid #8b4513;
}

.arm-left {
    left: 5px;
    transform: rotate(-30deg);
}

.arm-right {
    right: 5px;
    transform: rotate(30deg);
}

.doll-eye {
    position: absolute;
    top: 8px;
    width: 6px;
    height: 6px;
    background: #000;
    border-radius: 50%;
    animation: eye-blink 3s ease-in-out infinite;
}

.eye-left {
    left: 8px;
}

.eye-right {
    right: 8px;
}

@keyframes doll-scan {

    0%,
    100% {
        transform: translateX(-50%) rotate(0deg);
    }

    50% {
        transform: translateX(-50%) rotate(5deg);
    }
}

@keyframes eye-blink {

    0%,
    90%,
    100% {
        opacity: 1;
    }

    95% {
        opacity: 0;
    }
}

.vip-chair {
    position: absolute;
    width: 25px;
    height: 35px;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    border-radius: 5px;
    animation: chair-glow 4s ease-in-out infinite;
}

.chair-1 {
    top: 15%;
    left: 90%;
    animation-delay: 0s;
}

.chair-2 {
    top: 35%;
    left: 92%;
    animation-delay: 1s;
}

.chair-3 {
    top: 55%;
    left: 88%;
    animation-delay: 2s;
}

@keyframes chair-glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
        transform: scale(1.1);
    }
}

.money-pile {
    position: absolute;
    width: 30px;
    height: 20px;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    border-radius: 3px;
    animation: money-shine 3s ease-in-out infinite;
}

.pile-1 {
    bottom: 10%;
    left: 85%;
    animation-delay: 0s;
}

.pile-2 {
    bottom: 15%;
    left: 88%;
    animation-delay: 0.5s;
}

.pile-3 {
    bottom: 20%;
    left: 82%;
    animation-delay: 1s;
}

@keyframes money-shine {

    0%,
    100% {
        opacity: 0.7;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.arena-light {
    position: absolute;
    width: 20px;
    height: 20px;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border-radius: 50%;
    animation: light-sweep 4s ease-in-out infinite;
}

.light-1 {
    top: 5%;
    left: 20%;
    animation-delay: 0s;
}

.light-2 {
    top: 5%;
    right: 20%;
    animation-delay: 1s;
}

.light-3 {
    bottom: 5%;
    left: 20%;
    animation-delay: 2s;
}

.light-4 {
    bottom: 5%;
    right: 20%;
    animation-delay: 3s;
}

@keyframes light-sweep {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

.squid-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    animation: logo-spin 10s linear infinite;
}

.logo-circle {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    background: #ff6b6b;
    border-radius: 50%;
}

.logo-triangle {
    position: absolute;
    top: 0;
    left: 20px;
    width: 20px;
    height: 20px;
    background: #4ecdc4;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.logo-square {
    position: absolute;
    top: 0;
    left: 40px;
    width: 20px;
    height: 20px;
    background: #667eea;
}

@keyframes logo-spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.player-number {
    position: absolute;
    padding: 5px 10px;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    color: white;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: bold;
    animation: number-pulse 3s ease-in-out infinite;
}

.number-456 {
    top: 25%;
    left: 5%;
    animation-delay: 0s;
}

.number-067 {
    top: 45%;
    left: 3%;
    animation-delay: 1s;
}

.number-001 {
    top: 65%;
    left: 7%;
    animation-delay: 2s;
}

@keyframes number-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.game-instruction {
    position: absolute;
    padding: 8px 15px;
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: bold;
    animation: instruction-flash 4s ease-in-out infinite;
}

.instruction-1 {
    top: 35%;
    right: 5%;
    animation-delay: 0s;
}

.instruction-2 {
    top: 50%;
    right: 3%;
    animation-delay: 1s;
}

.instruction-3 {
    top: 65%;
    right: 7%;
    animation-delay: 2s;
}

@keyframes instruction-flash {

    0%,
    100% {
        opacity: 0.7;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.elimination-effect {
    position: absolute;
    width: 30px;
    height: 30px;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border-radius: 50%;
    animation: elimination-blast 2s ease-out infinite;
}

.elim-1 {
    top: 30%;
    left: 40%;
    animation-delay: 0s;
}

.elim-2 {
    top: 60%;
    left: 35%;
    animation-delay: 1s;
}

.elim-3 {
    bottom: 30%;
    left: 45%;
    animation-delay: 2s;
}

@keyframes elimination-blast {
    0% {
        transform: scale(0);
        opacity: 1;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.money-counter {
    position: absolute;
    top: 10%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    font-weight: bold;
    color: #ffd700;
}

.counter-digit {
    animation: counter-flicker 2s ease-in-out infinite;
}

.counter-digit:nth-child(1) {
    animation-delay: 0s;
}

.counter-digit:nth-child(2) {
    animation-delay: 0.1s;
}

.counter-digit:nth-child(3) {
    animation-delay: 0.2s;
}

.counter-digit:nth-child(4) {
    animation-delay: 0.3s;
}

.counter-digit:nth-child(5) {
    animation-delay: 0.4s;
}

.counter-digit:nth-child(6) {
    animation-delay: 0.5s;
}

.counter-digit:nth-child(7) {
    animation-delay: 0.6s;
}

.counter-digit:nth-child(8) {
    animation-delay: 0.7s;
}

.counter-digit:nth-child(9) {
    animation-delay: 0.8s;
}

.counter-digit:nth-child(10) {
    animation-delay: 0.9s;
}

.counter-digit:nth-child(11) {
    animation-delay: 1s;
}

.counter-digit:nth-child(12) {
    animation-delay: 1.1s;
}

.counter-digit:nth-child(13) {
    animation-delay: 1.2s;
}

.counter-digit:nth-child(14) {
    animation-delay: 1.3s;
}

.counter-digit:nth-child(15) {
    animation-delay: 1.4s;
}

.counter-digit:nth-child(16) {
    animation-delay: 1.5s;
}

@keyframes counter-flicker {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.1);
    }
}

.game-timer {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: #ff6b6b;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: bold;
}

.timer-display {
    margin-bottom: 5px;
    animation: timer-blink 1s ease-in-out infinite;
}

.timer-progress {
    width: 60px;
    height: 4px;
    background: rgba(255, 107, 107, 0.3);
    border-radius: 2px;
    overflow: hidden;
    animation: timer-progress 5s linear infinite;
}

@keyframes timer-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes timer-progress {
    0% {
        width: 0%;
    }

    100% {
        width: 100%;
    }
}

.camera {
    position: absolute;
    width: 25px;
    height: 20px;
    animation: camera-scan 6s ease-in-out infinite;
}

.camera-1 {
    top: 15%;
    left: 15%;
    animation-delay: 0s;
}

.camera-2 {
    top: 15%;
    right: 15%;
    animation-delay: 2s;
}

.camera-3 {
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 4s;
}

.camera-body {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #2d3748, #4a5568);
    border-radius: 5px;
    position: relative;
}

.camera-lens {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
}

.camera-light {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 4px;
    height: 4px;
    background: #ff6b6b;
    border-radius: 50%;
    animation: camera-light-blink 2s ease-in-out infinite;
}

@keyframes camera-scan {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(5deg);
    }
}

@keyframes camera-light-blink {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

.guard-tower {
    position: absolute;
    width: 30px;
    height: 50px;
    animation: tower-sway 8s ease-in-out infinite;
}

.tower-1 {
    bottom: 10%;
    left: 10%;
    animation-delay: 0s;
}

.tower-2 {
    bottom: 10%;
    right: 10%;
    animation-delay: 4s;
}

.tower-base {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(45deg, #2d3748, #4a5568);
    border-radius: 5px;
}

.tower-top {
    position: absolute;
    top: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border-radius: 5px 5px 0 0;
}

.guard-spotlight {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 4px;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    border-radius: 2px;
    animation: spotlight-sweep 4s ease-in-out infinite;
}

@keyframes tower-sway {

    0%,
    100% {
        transform: rotate(0deg);
    }

    50% {
        transform: rotate(2deg);
    }
}

@keyframes spotlight-sweep {

    0%,
    100% {
        transform: translateX(-50%) rotate(0deg);
    }

    50% {
        transform: translateX(-50%) rotate(30deg);
    }
}

.arena-fence {
    position: absolute;
    background: linear-gradient(45deg, #2d3748, #4a5568);
    border-radius: 2px;
}

.fence-top {
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.fence-bottom {
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.fence-left {
    top: 0;
    bottom: 0;
    left: 0;
    width: 4px;
}

.fence-right {
    top: 0;
    bottom: 0;
    right: 0;
    width: 4px;
}

.audio-controls {
    position: fixed;
    top: 100px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
    pointer-events: auto;
    /* Prevent layout recalculation on mobile */
    transform: translateZ(0);
}

.audio-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(27, 184, 189, 0.1);
    color: #4a5568;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-btn:hover {
    background: rgba(27, 184, 189, 0.2);
    transform: scale(1.1);
}

.audio-btn.active {
    background: rgba(27, 184, 189, 0.3);
    color: #1bb8bd;
}

/* Light Mode Adjustments */
html[data-theme="light"] .squid-shape {
    opacity: 0.8;
}

html[data-theme="light"] .pink-soldier {
    opacity: 0.7;
}

html[data-theme="light"] .game-mask {
    opacity: 0.8;
}

html[data-theme="light"] .glass-panel {
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.2));
}

html[data-theme="light"] .honeycomb-cell {
    opacity: 0.8;
}

html[data-theme="light"] .rope-segment {
    opacity: 0.7;
}

html[data-theme="light"] .doll-head {
    opacity: 0.8;
}

html[data-theme="light"] .doll-body {
    opacity: 0.8;
}

html[data-theme="light"] .doll-arm {
    opacity: 0.8;
}

html[data-theme="light"] .vip-chair {
    opacity: 0.8;
}

html[data-theme="light"] .money-pile {
    opacity: 0.8;
}

html[data-theme="light"] .arena-light {
    opacity: 0.7;
}

html[data-theme="light"] .squid-logo {
    opacity: 0.8;
}

html[data-theme="light"] .player-number {
    opacity: 0.8;
}

html[data-theme="light"] .game-instruction {
    opacity: 0.8;
}

html[data-theme="light"] .money-counter {
    opacity: 0.8;
}

html[data-theme="light"] .game-timer {
    opacity: 0.8;
}

html[data-theme="light"] .camera-body {
    opacity: 0.7;
}

html[data-theme="light"] .guard-tower .tower-base {
    opacity: 0.7;
}

html[data-theme="light"] .arena-fence {
    opacity: 0.6;
}

html[data-theme="light"] .audio-btn {
    background: rgba(27, 184, 189, 0.15);
}

/* Dark Mode Styles for Game Elements */
html[data-theme="dark"] .container {
    background: rgba(26, 26, 26, 0.7);
    color: #e0e0e0;
    border: 1px solid rgba(59, 175, 189, 0.3);
}

html[data-theme="dark"] header h1 {
    color: #1bb8bd;
}

html[data-theme="dark"] .etymology {
    color: #a0aec0;
}

html[data-theme="dark"] .game-info {
    background: rgba(26, 26, 26, 0.6);
    border: 1px solid rgba(59, 175, 179, 0.3);
}

html[data-theme="dark"] .player {
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid rgba(59, 175, 179, 0.3);
    color: #e0e0e0;
}

html[data-theme="dark"] .player.active {
    background: rgba(59, 175, 179, 0.2) !important;
    border-color: #3bafb3 !important;
    box-shadow: 0 4px 12px rgba(59, 175, 179, 0.3) !important;
}

html[data-theme="dark"] .game-status {
    background: rgba(26, 26, 26, 0.9);
    color: #e0e0e0;
    border: 1px solid rgba(59, 175, 179, 0.3);
}

html[data-theme="dark"] .game-board {
    background: transparent;
    border: none;
}

html[data-theme="dark"] .node {
    background: linear-gradient(145deg, #2d2d2d, #1a1a1a);
    border-color: #4a5568;
}

html[data-theme="dark"] .node:hover {
    border-color: #3bafb3;
    box-shadow: 0 6px 12px rgba(59, 175, 179, 0.3);
}

html[data-theme="dark"] .node.occupied {
    background: linear-gradient(145deg, #2d2d2d, #1a1a1a);
}

html[data-theme="dark"] .node.valid-move {
    border-color: #3bafb3;
    box-shadow: 0 0 10px rgba(59, 175, 179, 0.5);
}

html[data-theme="dark"] .node.selected {
    border-color: #3bafb3;
    box-shadow: 0 0 15px rgba(59, 175, 179, 0.7);
}

html[data-theme="dark"] .edge {
    stroke: #4a5568;
}

html[data-theme="dark"] .edge.highlighted {
    stroke: #3bafb3;
    stroke-width: 3;
}

html[data-theme="dark"] .controls {
    background: rgba(26, 26, 26, 0.6);
    border: 1px solid rgba(59, 175, 179, 0.3);
}

html[data-theme="dark"] .controls button {
    background: rgba(27, 184, 189, 0.1);
    border: 1px solid rgba(27, 184, 189, 0.3);
    color: #e0e0e0;
}

html[data-theme="dark"] .controls button:hover {
    background: linear-gradient(45deg, #4ecdc4, #3bafb3);
    box-shadow: 0 6px 12px rgba(59, 175, 179, 0.4);
}

html[data-theme="dark"] .close-rules-btn {
    background: #2d2d2d;
    color: #a0aec0;
    border: 1px solid rgba(59, 175, 179, 0.3);
}

html[data-theme="dark"] .close-rules-btn:hover {
    background: #3bafb3;
    color: #ffffff;
}