* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    color-scheme: light dark;
}

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(255, 193, 7, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    color: #ffc107;
    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(255, 193, 7, 0.2);
    border-color: #ffc107;
    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(255, 193, 7, 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(255, 193, 7, 0.2);
    color: #e0e0e0;
}

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

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

.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(255, 193, 7, 0.1);
    color: #ffc107;
    transform: scale(1.1);
}

.close-panel-btn:active {
    transform: scale(0.95);
    background: rgba(255, 193, 7, 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: #ffc107;
    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(255, 193, 7, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

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

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

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

.track-btn:hover {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 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(255, 193, 7, 0.3) transparent;
}

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

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

.playlist-container::-webkit-scrollbar-thumb {
    background: rgba(255, 193, 7, 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(255, 193, 7, 0.1);
    border-color: rgba(255, 193, 7, 0.2);
}

.playlist-item.active {
    background: rgba(255, 193, 7, 0.2);
    border-color: rgba(255, 193, 7, 0.4);
    color: #ffc107;
    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: #ffc107;
}

/* 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 {
    font-size: 20px;
    font-weight: bold;
    display: flex;
    /* Show by default on all devices */
}

/* Ensure visibility 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: #ffffff;
    background: #0a2a2d;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: auto;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    position: relative;
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

html[data-theme="light"] body {
    background: #f0f8ff;
    color: #2d3748;
}

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

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

.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(10, 42, 45, 0.8) 100%);
}

.layer-1 {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.05) 0%, rgba(10, 42, 45, 0.9) 100%);
}

.layer-2 {
    background: linear-gradient(45deg, rgba(255, 193, 7, 0.03) 0%, rgba(10, 42, 45, 0.85) 100%);
}

.layer-3 {
    background: linear-gradient(225deg, rgba(255, 193, 7, 0.02) 0%, rgba(10, 42, 45, 0.8) 100%);
}

.layer-4 {
    background: linear-gradient(315deg, rgba(255, 193, 7, 0.01) 0%, rgba(10, 42, 45, 0.75) 100%);
}

.layer-5 {
    background: linear-gradient(180deg, rgba(255, 193, 7, 0.005) 0%, rgba(10, 42, 45, 0.7) 100%);
}

html[data-theme="light"] .layer-1 {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(240, 248, 255, 0.95) 100%);
}

html[data-theme="light"] .layer-2 {
    background: linear-gradient(45deg, rgba(255, 193, 7, 0.08) 0%, rgba(240, 248, 255, 0.9) 100%);
}

html[data-theme="light"] .layer-3 {
    background: linear-gradient(225deg, rgba(255, 193, 7, 0.06) 0%, rgba(240, 248, 255, 0.85) 100%);
}

html[data-theme="light"] .layer-4 {
    background: linear-gradient(315deg, rgba(255, 193, 7, 0.04) 0%, rgba(240, 248, 255, 0.8) 100%);
}

html[data-theme="light"] .layer-5 {
    background: linear-gradient(180deg, rgba(255, 193, 7, 0.02) 0%, rgba(240, 248, 255, 0.75) 100%);
}

html[data-theme="dark"] .layer-1 {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.1) 0%, rgba(10, 42, 45, 0.95) 100%);
}

html[data-theme="dark"] .layer-2 {
    background: linear-gradient(45deg, rgba(255, 193, 7, 0.08) 0%, rgba(10, 42, 45, 0.9) 100%);
}

html[data-theme="dark"] .layer-3 {
    background: linear-gradient(225deg, rgba(255, 193, 7, 0.06) 0%, rgba(10, 42, 45, 0.85) 100%);
}

html[data-theme="dark"] .layer-4 {
    background: linear-gradient(315deg, rgba(255, 193, 7, 0.04) 0%, rgba(10, 42, 45, 0.8) 100%);
}

html[data-theme="dark"] .layer-5 {
    background: linear-gradient(180deg, rgba(255, 193, 7, 0.02) 0%, rgba(10, 42, 45, 0.75) 100%);
}

.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(255, 193, 7, 0.6);
    border-radius: 50%;
    animation: float-particle 8s infinite linear;
    animation-delay: var(--delay);
}

html[data-theme="dark"] .particle {
    background: rgba(255, 193, 7, 0.8);
}

@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(20, 1fr);
    grid-template-rows: repeat(20, 1fr);
    pointer-events: none;
    z-index: 1;
}

.grid-cell {
    border: 1px solid rgba(255, 193, 7, 0.1);
    transition: all 0.3s ease;
}

html[data-theme="dark"] .grid-cell {
    border-color: rgba(255, 193, 7, 0.2);
}

.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;
}

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;
}

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

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

.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(255, 193, 7, 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(255, 193, 7, 0.3);
}

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

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

.sun-icon {
    display: block;
}

.moon-icon {
    display: none;
}

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

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



.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;
}

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

.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;
}

.game-board {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    flex: 1;
}

.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 {
    background: rgba(255, 193, 7, 0.6);
    border-color: #ffc107;
}

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

.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;
}

.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);
}

@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 3x3 grid on 300x300 board */
[id="0,0"] {
    top: -5px;
    left: -5px;
}

[id="0,1"] {
    top: -5px;
    left: 125px;
}

[id="0,2"] {
    top: -5px;
    left: 255px;
}

[id="1,0"] {
    top: 125px;
    left: -5px;
}

[id="1,1"] {
    top: 125px;
    left: 125px;
}

[id="1,2"] {
    top: 125px;
    left: 255px;
}

[id="2,0"] {
    top: 255px;
    left: -5px;
}

[id="2,1"] {
    top: 255px;
    left: 125px;
}

[id="2,2"] {
    top: 255px;
    left: 255px;
}

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

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

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

@keyframes edgePulse {

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

    50% {
        stroke-width: 6;
    }
}

.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: #666;
    background: #fff;
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.3s ease;
    z-index: 1001;
    opacity: 1;
    visibility: visible;
}

.close:hover,
.close-rules-btn:hover {
    color: #fff;
    background: #ffc107;
    box-shadow: 0 4px 16px rgba(255, 193, 7, 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;
        box-sizing: border-box;
    }

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

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

    .game-info {
        flex-direction: row;
        flex-wrap: nowrap;
        gap: 0.75rem;
        align-items: center;
    }

    .player-info {
        flex-shrink: 0;
    }

    .game-status {
        flex: 1;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    body {
        margin: 0;
        padding: 0;
        min-height: 100vh;
    }

    .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: 1rem;
    }

    .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;
    }

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

    .graph-container {
        width: 250px;
        height: 250px;
        padding: 10px;
        margin: 0 auto;
    }

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

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

    /* Correct node positions for 250x250 mobile board */
    [id="0,0"] {
        top: 0px;
        left: 0px;
    }

    [id="0,1"] {
        top: 0px;
        left: 108px;
    }

    [id="0,2"] {
        top: 0px;
        left: 215px;
    }

    [id="1,0"] {
        top: 108px;
        left: 0px;
    }

    [id="1,1"] {
        top: 108px;
        left: 108px;
    }

    [id="1,2"] {
        top: 108px;
        left: 215px;
    }

    [id="2,0"] {
        top: 215px;
        left: 0px;
    }

    [id="2,1"] {
        top: 215px;
        left: 108px;
    }

    [id="2,2"] {
        top: 215px;
        left: 215px;
    }

    .controls {
        margin-top: -0.5rem;
        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);
    }
}

/* 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, 179, 0.3);
}



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(45, 45, 45, 0.8);
    color: #e0e0e0;
}

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

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;
}

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(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 193, 7, 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(255, 193, 7, 0.3);
}

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

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

.squid-shape {
    position: absolute;
    width: 60px;
    height: 60px;
    opacity: 0.3;
    animation: squid-float 20s infinite linear;
}

.circle-shape {
    background: #ff6b6b;
    border-radius: 50%;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.triangle-shape {
    background: #4ecdc4;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    top: 20%;
    right: 15%;
    animation-delay: 3s;
}

.square-shape {
    background: #45b7d1;
    top: 60%;
    left: 20%;
    animation-delay: 6s;
}

.circle-shape-2 {
    background: #96ceb4;
    border-radius: 50%;
    bottom: 20%;
    right: 10%;
    animation-delay: 9s;
}

.triangle-shape-2 {
    background: #feca57;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    top: 40%;
    left: 60%;
    animation-delay: 12s;
}

.square-shape-2 {
    background: #ff9ff3;
    bottom: 40%;
    right: 30%;
    animation-delay: 15s;
}

@keyframes squid-float {

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

    25% {
        transform: translateY(-20px) rotate(90deg);
        opacity: 0.6;
    }

    50% {
        transform: translateY(-40px) rotate(180deg);
        opacity: 0.3;
    }

    75% {
        transform: translateY(-20px) rotate(270deg);
        opacity: 0.6;
    }
}

.pink-soldier {
    position: absolute;
    width: 40px;
    height: 60px;
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
    border-radius: 20px 20px 5px 5px;
    opacity: 0.4;
    animation: soldier-patrol 15s infinite linear;
}

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

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

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

@keyframes soldier-patrol {

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

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

    50% {
        transform: translateX(100px) scale(1);
        opacity: 0.4;
    }

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

.game-mask {
    position: absolute;
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, #2c3e50, #34495e);
    border-radius: 50%;
    opacity: 0.3;
    animation: mask-glow 8s infinite ease-in-out;
}

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

.mask-2 {
    top: 50%;
    right: 20%;
    animation-delay: 2s;
}

.mask-3 {
    bottom: 30%;
    left: 40%;
    animation-delay: 4s;
}

@keyframes mask-glow {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(44, 62, 80, 0.3);
        opacity: 0.3;
    }

    50% {
        box-shadow: 0 0 20px rgba(44, 62, 80, 0.6);
        opacity: 0.5;
    }
}

.glass-panel {
    position: absolute;
    width: 80px;
    height: 120px;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    opacity: 0.2;
    animation: glass-shimmer 12s infinite linear;
}

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

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

.panel-3 {
    top: 40%;
    left: 20%;
    animation-delay: 4s;
}

.panel-4 {
    bottom: 20%;
    right: 10%;
    animation-delay: 6s;
}

.panel-5 {
    bottom: 40%;
    left: 30%;
    animation-delay: 8s;
}

.panel-6 {
    top: 60%;
    right: 25%;
    animation-delay: 10s;
}

@keyframes glass-shimmer {

    0%,
    100% {
        opacity: 0.2;
        transform: rotateY(0deg);
    }

    50% {
        opacity: 0.4;
        transform: rotateY(180deg);
    }
}

.honeycomb-game {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    opacity: 0.2;
}

.honeycomb-cell {
    width: 30px;
    height: 30px;
    background: linear-gradient(45deg, #feca57, #ff9ff3);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    animation: honeycomb-pulse 6s infinite ease-in-out;
}

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

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

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

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

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

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

@keyframes honeycomb-pulse {

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

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

.tug-rope {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    opacity: 0.3;
}

.rope-segment {
    width: 8px;
    height: 40px;
    background: linear-gradient(45deg, #8b4513, #a0522d);
    border-radius: 4px;
    animation: rope-tug 4s infinite ease-in-out;
}

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

.segment-2 {
    animation-delay: 0.5s;
}

.segment-3 {
    animation-delay: 1s;
}

.segment-4 {
    animation-delay: 1.5s;
}

@keyframes rope-tug {

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

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

.marbles-container {
    position: absolute;
    bottom: 20%;
    left: 20%;
    display: flex;
    gap: 10px;
    opacity: 0.3;
}

.marble {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    animation: marble-roll 8s infinite linear;
}

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

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

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

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

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

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

@keyframes marble-roll {

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

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

.doll-container {
    position: absolute;
    top: 20%;
    right: 30%;
    opacity: 0.3;
}

.doll-head {
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #feca57, #ff9ff3);
    border-radius: 50%;
    position: relative;
    animation: doll-scan 10s infinite ease-in-out;
}

.doll-body {
    width: 30px;
    height: 50px;
    background: linear-gradient(45deg, #2c3e50, #34495e);
    border-radius: 15px 15px 5px 5px;
    margin: 0 auto;
    margin-top: 5px;
}

.doll-arm {
    position: absolute;
    width: 15px;
    height: 30px;
    background: linear-gradient(45deg, #feca57, #ff9ff3);
    border-radius: 7px;
    top: 10px;
}

.arm-left {
    left: -20px;
    transform: rotate(-45deg);
}

.arm-right {
    right: -20px;
    transform: rotate(45deg);
}

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

.eye-left {
    left: 10px;
}

.eye-right {
    right: 10px;
}

@keyframes doll-scan {

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

    25% {
        transform: rotate(15deg);
    }

    75% {
        transform: rotate(-15deg);
    }
}

@keyframes eye-blink {

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

    95% {
        opacity: 0;
    }
}

.vip-chair {
    position: absolute;
    width: 60px;
    height: 80px;
    background: linear-gradient(45deg, #8b4513, #a0522d);
    border-radius: 10px 10px 5px 5px;
    opacity: 0.3;
    animation: chair-glow 12s infinite ease-in-out;
}

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

.chair-2 {
    bottom: 25%;
    right: 15%;
    animation-delay: 4s;
}

.chair-3 {
    bottom: 35%;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 8s;
}

@keyframes chair-glow {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(139, 69, 19, 0.3);
        opacity: 0.3;
    }

    50% {
        box-shadow: 0 0 20px rgba(139, 69, 19, 0.6);
        opacity: 0.5;
    }
}

.money-pile {
    position: absolute;
    width: 40px;
    height: 30px;
    background: linear-gradient(45deg, #feca57, #ff9ff3);
    border-radius: 5px;
    opacity: 0.3;
    animation: money-shine 8s infinite ease-in-out;
}

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

.pile-2 {
    top: 25%;
    right: 25%;
    animation-delay: 2s;
}

.pile-3 {
    bottom: 15%;
    left: 40%;
    animation-delay: 4s;
}

@keyframes money-shine {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(254, 202, 87, 0.3);
        opacity: 0.3;
    }

    50% {
        box-shadow: 0 0 20px rgba(254, 202, 87, 0.6);
        opacity: 0.5;
    }
}

.arena-light {
    position: absolute;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.2));
    border-radius: 50%;
    opacity: 0.2;
    animation: light-sweep 15s infinite linear;
}

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

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

.light-3 {
    bottom: 20%;
    left: 30%;
    animation-delay: 6s;
}

.light-4 {
    bottom: 10%;
    right: 30%;
    animation-delay: 9s;
}

@keyframes light-sweep {

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

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

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

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

.logo-triangle {
    position: absolute;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-bottom: 30px solid #4ecdc4;
    bottom: 0;
    left: 25px;
}

.logo-square {
    position: absolute;
    width: 30px;
    height: 30px;
    background: #45b7d1;
    top: 25px;
    right: 0;
}

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

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

.player-number {
    position: absolute;
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, #2c3e50, #34495e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: bold;
    font-size: 1.2rem;
    opacity: 0.3;
    animation: number-pulse 8s infinite ease-in-out;
}

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

.number-067 {
    top: 25%;
    right: 20%;
    animation-delay: 2s;
}

.number-001 {
    bottom: 20%;
    left: 25%;
    animation-delay: 4s;
}

@keyframes number-pulse {

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

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

.game-instruction {
    position: absolute;
    width: 120px;
    height: 40px;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.8rem;
    opacity: 0.3;
    animation: instruction-flash 10s infinite ease-in-out;
}

.instruction-1 {
    top: 35%;
    left: 10%;
    animation-delay: 0s;
}

.instruction-2 {
    top: 45%;
    right: 15%;
    animation-delay: 3s;
}

.instruction-3 {
    bottom: 30%;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 6s;
}

@keyframes instruction-flash {

    0%,
    100% {
        opacity: 0.3;
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
    }

    50% {
        opacity: 0.5;
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
    }
}

.elimination-effect {
    position: absolute;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, #ff6b6b, #ee5a24);
    border-radius: 50%;
    opacity: 0;
    animation: elimination-blast 6s infinite ease-in-out;
}

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

.elim-2 {
    top: 40%;
    right: 25%;
    animation-delay: 2s;
}

.elim-3 {
    bottom: 25%;
    left: 40%;
    animation-delay: 4s;
}

@keyframes elimination-blast {

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

    50% {
        opacity: 0.6;
        transform: scale(1.5);
    }
}

.money-counter {
    position: absolute;
    top: 10%;
    right: 10%;
    display: flex;
    gap: 2px;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 10px;
    opacity: 0.3;
    animation: counter-flicker 12s infinite ease-in-out;
}

.counter-digit {
    width: 20px;
    height: 30px;
    background: linear-gradient(45deg, #feca57, #ff9ff3);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2c3e50;
    font-weight: bold;
    font-size: 0.8rem;
    animation: counter-flicker 2s infinite ease-in-out;
}

.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.7;
        transform: scale(1.05);
    }
}

.game-timer {
    position: absolute;
    bottom: 10%;
    left: 10%;
    background: rgba(0, 0, 0, 0.5);
    padding: 10px 15px;
    border-radius: 10px;
    opacity: 0.3;
    animation: timer-blink 8s infinite ease-in-out;
}

.timer-display {
    color: #ffffff;
    font-weight: bold;
    font-size: 1.2rem;
    text-align: center;
}

.timer-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
    position: relative;
}

.timer-progress::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 30%;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    animation: timer-progress 8s infinite linear;
}

@keyframes timer-blink {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.6;
    }
}

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

    100% {
        width: 100%;
    }
}

.camera {
    position: absolute;
    width: 40px;
    height: 30px;
    background: linear-gradient(45deg, #2c3e50, #34495e);
    border-radius: 5px;
    opacity: 0.3;
    animation: camera-scan 10s infinite ease-in-out;
}

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

.camera-2 {
    top: 25%;
    right: 30%;
    animation-delay: 3s;
}

.camera-3 {
    bottom: 20%;
    left: 35%;
    animation-delay: 6s;
}

.camera-body {
    position: relative;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: inherit;
}

.camera-lens {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #ffffff, #a0aec0);
    border-radius: 50%;
    animation: camera-light-blink 4s infinite ease-in-out;
}

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

@keyframes camera-scan {

    0%,
    100% {
        transform: rotateY(0deg);
        opacity: 0.3;
    }

    50% {
        transform: rotateY(180deg);
        opacity: 0.5;
    }
}

@keyframes camera-light-blink {

    0%,
    100% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
    }
}

.guard-tower {
    position: absolute;
    width: 60px;
    height: 80px;
    opacity: 0.3;
    animation: tower-sway 12s infinite ease-in-out;
}

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

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

.tower-base {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 60%;
    background: linear-gradient(45deg, #8b4513, #a0522d);
    border-radius: 10px 10px 5px 5px;
}

.tower-top {
    position: absolute;
    top: 0;
    width: 100%;
    height: 40%;
    background: linear-gradient(45deg, #2c3e50, #34495e);
    border-radius: 10px 10px 0 0;
}

.guard-spotlight {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 30px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.2));
    border-radius: 10px 10px 0 0;
    animation: spotlight-sweep 8s infinite linear;
}

@keyframes tower-sway {

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

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

    75% {
        transform: rotate(-2deg);
    }
}

@keyframes spotlight-sweep {
    0% {
        transform: translateX(-50%) rotate(-45deg);
    }

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

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

.arena-fence {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.1;
}

.fence-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(45deg, #8b4513, #a0522d);
    border-radius: 10px 10px 0 0;
}

.fence-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(45deg, #8b4513, #a0522d);
    border-radius: 0 0 10px 10px;
}

.fence-left {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 20px;
    background: linear-gradient(45deg, #8b4513, #a0522d);
    border-radius: 10px 0 0 10px;
}

.fence-right {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    width: 20px;
    background: linear-gradient(45deg, #8b4513, #a0522d);
    border-radius: 0 10px 10px 0;
}

.audio-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    pointer-events: auto;
}

.audio-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 193, 7, 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(255, 193, 7, 0.2);
    transform: scale(1.1);
}

.audio-btn.active {
    background: rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

/* Light Mode Adjustments for Squid Game Elements */
html[data-theme="light"] .squid-shape {
    opacity: 0.2;
}

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

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

html[data-theme="light"] .glass-panel {
    opacity: 0.15;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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