/* ============================================
   HANOI KULELERI - MAIN STYLESHEET
   ============================================ */

/* CSS Variables */
:root {
    /* Color Palette - Royal Temple Theme */
    --color-primary: #1a1a2e;
    --color-secondary: #16213e;
    --color-accent: #e94560;
    --color-accent-light: #ff6b6b;
    --color-gold: #ffd700;
    --color-gold-dark: #daa520;
    --color-bronze: #cd7f32;
    --color-silver: #c0c0c0;
    --color-text: #f5f5f5;
    --color-text-muted: #a0a0a0;
    --color-bg: #0f0f1a;
    --color-surface: #1a1a2e;
    --color-border: #2d2d44;
    
    /* Disk Colors */
    --disk-1: #ff4757;
    --disk-2: #ff6348;
    --disk-3: #ff7f50;
    --disk-4: #ffa502;
    --disk-5: #ffc107;
    --disk-6: #2ed573;
    --disk-7: #1e90ff;
    --disk-8: #3742fa;
    --disk-9: #a55eea;
    --disk-10: #ff6b9d;
    
    /* Typography */
    --font-display: 'Cinzel', serif;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 2rem;
    --space-xl: 4rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-gold: 0 4px 20px rgba(255, 215, 0, 0.3);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-full: 50%;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--color-accent-light);
}

img {
    max-width: 100%;
    height: auto;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* ============================================
   LOADING SCREEN
   ============================================ */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
}

.temple-loader {
    width: 120px;
    height: 120px;
    margin: 0 auto var(--space-lg);
    position: relative;
}

.dome {
    width: 80px;
    height: 50px;
    background: linear-gradient(180deg, var(--color-gold) 0%, var(--color-gold-dark) 100%);
    border-radius: 50% 50% 0 0;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    animation: domeGlow 2s ease-in-out infinite;
}

.base {
    width: 100px;
    height: 15px;
    background: linear-gradient(180deg, var(--color-bronze) 0%, #8b4513 100%);
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-sm);
}

.pillar {
    width: 8px;
    height: 40px;
    background: linear-gradient(90deg, var(--color-silver) 0%, #808080 50%, var(--color-silver) 100%);
    position: absolute;
    bottom: 35px;
    border-radius: 4px;
}

.pillar-1 { left: 25%; }
.pillar-2 { left: 50%; transform: translateX(-50%); }
.pillar-3 { right: 25%; }

@keyframes domeGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 40px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 215, 0, 0.4); }
}

.loading-text {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--color-gold);
    margin-bottom: var(--space-sm);
    letter-spacing: 0.1em;
    animation: textShine 2s ease-in-out infinite;
}

.loading-subtext {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

@keyframes textShine {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* ============================================
   NAVIGATION
   ============================================ */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: rgba(15, 15, 26, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--color-border);
    transition: all var(--transition-base);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--color-gold);
    text-decoration: none;
    transition: all var(--transition-base);
}

.nav-logo:hover {
    color: var(--color-gold);
    transform: scale(1.02);
}

.logo-icon {
    font-size: 1.5rem;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: var(--space-sm);
    background: transparent;
}

.hamburger-line {
    width: 25px;
    height: 2px;
    background: var(--color-text);
    transition: all var(--transition-base);
    border-radius: 2px;
}

.nav-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: var(--space-lg);
}

.nav-link {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    padding: var(--space-sm) 0;
    transition: color var(--transition-base);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--color-gold), var(--color-accent));
    transition: width var(--transition-base);
}

.nav-link:hover,
.nav-link.active {
    color: var(--color-gold);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 100px var(--space-lg) var(--space-xl);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 50%, #0f0f1a 100%);
    overflow: hidden;
}

.hero-bg-animation {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.floating-disk {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    animation: float 20s infinite ease-in-out;
}

.disk-1 {
    width: 300px;
    height: 300px;
    background: var(--color-gold);
    top: 10%;
    left: -5%;
    animation-delay: 0s;
}

.disk-2 {
    width: 200px;
    height: 200px;
    background: var(--color-accent);
    top: 60%;
    right: -3%;
    animation-delay: -5s;
}

.disk-3 {
    width: 150px;
    height: 150px;
    background: var(--disk-7);
    top: 30%;
    right: 20%;
    animation-delay: -10s;
}

.disk-4 {
    width: 100px;
    height: 100px;
    background: var(--disk-4);
    bottom: 20%;
    left: 15%;
    animation-delay: -15s;
}

.disk-5 {
    width: 80px;
    height: 80px;
    background: var(--disk-9);
    top: 15%;
    right: 40%;
    animation-delay: -7s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-30px) rotate(5deg); }
    50% { transform: translateY(0) rotate(0deg); }
    75% { transform: translateY(30px) rotate(-5deg); }
}

.hero-content {
    text-align: center;
    z-index: 10;
    max-width: 900px;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 8vw, 5rem);
    margin-bottom: var(--space-md);
    line-height: 1.1;
}

.title-line {
    display: block;
}

.title-line.accent {
    background: linear-gradient(135deg, var(--color-gold) 0%, var(--color-accent-light) 50%, var(--color-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: goldShine 3s ease-in-out infinite;
    background-size: 200% 200%;
}

@keyframes goldShine {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.hero-subtitle {
    font-family: var(--font-heading);
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
    font-style: italic;
}

.hero-description {
    font-size: clamp(0.9rem, 2vw, 1.1rem);
    color: var(--color-text);
    margin-bottom: var(--space-xl);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    transition: all var(--transition-base);
    text-decoration: none;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-light) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-gold);
    color: white;
}

.btn-secondary {
    background: transparent;
    color: var(--color-gold);
    border: 2px solid var(--color-gold);
}

.btn-secondary:hover {
    background: var(--color-gold);
    color: var(--color-primary);
    transform: translateY(-3px);
}

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

.hero-scroll-indicator {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.8rem;
    animation: bounce 2s infinite;
}

.mouse {
    width: 25px;
    height: 40px;
    border: 2px solid var(--color-text-muted);
    border-radius: 15px;
    margin: 0 auto var(--space-sm);
    position: relative;
}

.wheel {
    width: 4px;
    height: 8px;
    background: var(--color-text-muted);
    border-radius: 2px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    animation: scrollWheel 2s infinite;
}

@keyframes scrollWheel {
    0% { opacity: 1; top: 8px; }
    100% { opacity: 0; top: 20px; }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
    40% { transform: translateX(-50%) translateY(-10px); }
    60% { transform: translateX(-50%) translateY(-5px); }
}

/* ============================================
   STATISTICS SECTION
   ============================================ */
.stats-section {
    padding: var(--space-xl) 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-lg);
}

.stat-card {
    text-align: center;
    padding: var(--space-lg);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(233, 69, 96, 0.1) 100%);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-gold);
    box-shadow: var(--shadow-gold);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: var(--space-md);
}

.stat-number {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--color-gold);
    margin-bottom: var(--space-sm);
}

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

/* ============================================
   GAME SECTION
   ============================================ */
.game-section {
    padding: var(--space-xl) 0;
    background: var(--color-bg);
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    color: var(--color-gold);
    margin-bottom: var(--space-sm);
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--color-gold), var(--color-accent));
    border-radius: 2px;
}

.section-subtitle {
    color: var(--color-text-muted);
    font-size: 1rem;
    margin-top: var(--space-md);
}

/* Game Controls */
.game-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.control-group {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.control-group label {
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
}

.disk-selector {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.disk-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
    background: var(--color-primary);
    color: var(--color-text);
    font-weight: 600;
    transition: all var(--transition-base);
}

.disk-btn:hover {
    border-color: var(--color-gold);
    color: var(--color-gold);
}

.disk-btn.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
}

.control-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: all var(--transition-base);
}

.btn-reset {
    background: #2d3436;
    color: white;
    border: 1px solid #636e72;
}

.btn-reset:hover {
    background: #636e72;
}

.btn-solve {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    color: white;
}

.btn-solve:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}

.btn-pause {
    background: #fdcb6e;
    color: #2d3436;
}

.btn-pause:hover:not(:disabled) {
    background: #ffeaa7;
}

.btn-pause:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-hint {
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
    color: white;
}

.btn-hint:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

/* Game Info */
.game-info {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.info-item {
    text-align: center;
}

.info-label {
    display: block;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin-bottom: var(--space-xs);
}

.info-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-gold);
}

.optimal-indicator {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
}

.optimality-status {
    font-weight: 600;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
}

.optimality-status.optimal {
    background: rgba(0, 184, 148, 0.2);
    color: #00b894;
}

.optimality-status.suboptimal {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

/* Progress Bar */
.progress-container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding: 0 var(--space-lg);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: var(--progress, 0%);
    background: linear-gradient(90deg, var(--color-gold), var(--color-accent));
    border-radius: 4px;
    transition: width var(--transition-base);
}

.progress-text {
    font-weight: 600;
    color: var(--color-gold);
    min-width: 45px;
    text-align: right;
}

/* Game Board */
.game-board-container {
    position: relative;
    margin-bottom: var(--space-xl);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    min-height: 500px;
    padding: var(--space-lg);
    background: linear-gradient(180deg, var(--color-surface) 0%, rgba(26, 26, 46, 0.8) 100%);
    border-radius: var(--radius-lg);
    border: 2px solid var(--color-border);
    position: relative;
    /* Ensure columns don't overflow */
    overflow: hidden;
}

.peg-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: all var(--transition-base);
    width: 100%;
    height: 100%;
    /* Prevent overflow */
    overflow: hidden;
    min-width: 0;
}

.peg-drop-zone {
    position: relative;
    width: 100%;
    height: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    overflow: visible;
    /* Rod and disk area share the same center axis */
}

.peg-container:hover {
    background: rgba(255, 215, 0, 0.05);
    border-radius: var(--radius-md);
}

.peg-container.selected {
    background: rgba(233, 69, 96, 0.1);
    border-radius: var(--radius-md);
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.3);
}

.peg-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
    font-weight: 500;
}

.peg-base {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    pointer-events: none;
}

.peg-rod {
    width: 12px;
    height: 350px;
    background: linear-gradient(90deg, var(--color-bronze) 0%, #8b4513 50%, var(--color-bronze) 100%);
    border-radius: 6px 6px 0 0;
    position: relative;
    bottom: 0;
    flex-shrink: 0;
}

/* Disk stack — centered on the exact same axis as peg-rod */
.peg-area {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    height: calc(100% - 20px);
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    justify-content: flex-start;
    pointer-events: none;
    /* No overflow clipping — disks can be wider than rod */
    overflow: visible;
}

/* Disks stacked from bottom upward via flex-end */

/* Disks */
.disk {
    height: 30px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    margin: 1px 0;
    user-select: none;
    pointer-events: auto;
    /* No relative positioning — disk centering is handled by peg-area flex */
    flex-shrink: 0;
    z-index: 10;
}

.disk:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.4);
    z-index: 100;
}

/* Stack disks tightly */
.peg-area .disk + .disk {
    margin-top: 0;
}

.disk.selected {
    animation: selectedPulse 1s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5), 0 6px 12px rgba(0, 0, 0, 0.4);
}

/* Drag and Drop Styles */
.disk[draggable="true"] {
    cursor: grab;
}

.disk[draggable="true"]:active {
    cursor: grabbing;
}

.disk.dragging {
    opacity: 0.95;
    transform: scale(1.08) rotate(2deg);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 25px rgba(255, 215, 0, 0.4);
    z-index: 10000 !important;
    cursor: grabbing;
}

.disk.touch-dragging {
    opacity: 0.9;
    transform: scale(1.12);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 40px rgba(255, 215, 0, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.3);
    z-index: 10000 !important;
    transition: none !important;
    pointer-events: none;
}

.peg-container.valid-target {
    background: rgba(0, 184, 148, 0.15);
    box-shadow: inset 0 0 40px rgba(0, 184, 148, 0.3), 0 0 30px rgba(0, 184, 148, 0.4);
    border: 2px solid rgba(0, 184, 148, 0.6);
    border-radius: var(--radius-lg);
}

.peg-container.invalid-target {
    background: rgba(231, 76, 60, 0.15);
    box-shadow: inset 0 0 40px rgba(231, 76, 60, 0.3), 0 0 30px rgba(231, 76, 60, 0.4);
    border: 2px solid rgba(231, 76, 60, 0.6);
    border-radius: var(--radius-lg);
}

.peg-container.potential-target {
    background: rgba(255, 215, 0, 0.1);
    border: 2px dashed rgba(255, 215, 0, 0.6);
    border-radius: var(--radius-lg);
    animation: pulse-border 1.5s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% { border-color: rgba(255, 215, 0, 0.4); }
    50% { border-color: rgba(255, 215, 0, 0.8); }
}

.peg-container.valid-target .peg-rod {
    box-shadow: 0 0 20px rgba(0, 184, 148, 0.8);
    background: linear-gradient(90deg, #00b894 0%, #00d9a3 50%, #00b894 100%);
}

.peg-container.invalid-target .peg-rod {
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.8);
    background: linear-gradient(90deg, #e74c3c 0%, #ff6b5b 50%, #e74c3c 100%);
}

.peg-container.potential-target .peg-rod {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

@keyframes selectedPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

.disk-1 { width: min(50px, 18%); background: linear-gradient(180deg, var(--disk-1) 0%, #c0392b 100%); }
.disk-2 { width: min(75px, 27%); background: linear-gradient(180deg, var(--disk-2) 0%, #e17055 100%); }
.disk-3 { width: min(100px, 36%); background: linear-gradient(180deg, var(--disk-3) 0%, #fdcb6e 100%); }
.disk-4 { width: min(125px, 45%); background: linear-gradient(180deg, var(--disk-4) 0%, #f39c12 100%); }
.disk-5 { width: min(150px, 54%); background: linear-gradient(180deg, var(--disk-5) 0%, #f1c40f 100%); }
.disk-6 { width: min(175px, 63%); background: linear-gradient(180deg, var(--disk-6) 0%, #27ae60 100%); }
.disk-7 { width: min(200px, 72%); background: linear-gradient(180deg, var(--disk-7) 0%, #2980b9 100%); }
.disk-8 { width: min(225px, 81%); background: linear-gradient(180deg, var(--disk-8) 0%, #8e44ad 100%); }
.disk-9 { width: min(250px, 90%); background: linear-gradient(180deg, var(--disk-9) 0%, #9b59b6 100%); }
.disk-10 { width: min(275px, 98%); background: linear-gradient(180deg, var(--disk-10) 0%, #e84393 100%); }

.disk::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 15%;
    right: 15%;
    height: 8px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4) 0%, transparent 100%);
    border-radius: 4px;
}

/* Selected Indicator */
.selected-indicator {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.selected-indicator.visible {
    opacity: 1;
}

.indicator-content {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: rgba(233, 69, 96, 0.9);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
}

/* Speed Control */
.speed-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.speed-control label {
    font-weight: 600;
    color: var(--color-text);
}

.speed-control input[type="range"] {
    width: 200px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--color-border);
    border-radius: 3px;
    outline: none;
}

.speed-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--color-gold);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.speed-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--color-gold);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-sm);
}

#speedValue {
    font-weight: 600;
    color: var(--color-gold);
    min-width: 60px;
}

/* Move History */
.move-history-container {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    border: 1px solid var(--color-border);
}

.history-title {
    font-family: var(--font-heading);
    color: var(--color-gold);
    margin-bottom: var(--space-md);
    font-size: 1.2rem;
}

.move-history {
    max-height: 200px;
    overflow-y: auto;
    padding: var(--space-md);
    background: var(--color-bg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.history-empty {
    color: var(--color-text-muted);
    text-align: center;
    font-style: italic;
}

.move-entry {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
    font-size: 0.9rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.move-number {
    font-weight: 600;
    color: var(--color-gold);
    min-width: 40px;
}

.move-arrow {
    color: var(--color-accent);
}

.move-pegs {
    color: var(--color-text);
}

/* ============================================
   RULES SECTION
   ============================================ */
.rules-section {
    padding: var(--space-xl) 0;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
}

.rule-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    position: relative;
    transition: all var(--transition-base);
    overflow: hidden;
}

.rule-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--color-gold), var(--color-accent));
    transform: scaleX(0);
    transition: transform var(--transition-base);
}

.rule-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-gold);
    box-shadow: var(--shadow-md);
}

.rule-card:hover::before {
    transform: scaleX(1);
}

.rule-number {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--color-text-muted);
    opacity: 0.5;
}

.rule-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.rule-title {
    font-family: var(--font-heading);
    color: var(--color-gold);
    margin-bottom: var(--space-sm);
    font-size: 1.3rem;
}

.rule-description {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ============================================
   FEATURES SECTION
   ============================================ */
.features-section {
    padding: var(--space-xl) 0;
    background: var(--color-bg);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
}

.feature-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
}

.feature-card:hover {
    transform: translateY(-8px);
    border-color: var(--color-gold);
    box-shadow: var(--shadow-gold);
    color: inherit;
}

.feature-icon-wrapper {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(233, 69, 96, 0.2) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-md);
    transition: all var(--transition-base);
}

.feature-card:hover .feature-icon-wrapper {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.4) 0%, rgba(233, 69, 96, 0.4) 100%);
}

.feature-icon {
    font-size: 2rem;
}

.feature-title {
    font-family: var(--font-heading);
    color: var(--color-gold);
    margin-bottom: var(--space-sm);
    font-size: 1.2rem;
}

.feature-description {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    flex: 1;
}

.feature-link {
    color: var(--color-accent);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: var(--space-md);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    transition: gap var(--transition-base);
}

.feature-card:hover .feature-link {
    gap: var(--space-sm);
}

/* ============================================
   QUICK MATH SECTION
   ============================================ */
.quick-math-section {
    padding: var(--space-xl) 0;
    background: linear-gradient(135deg, var(--color-secondary) 0%, var(--color-primary) 100%);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

.math-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.math-title {
    font-family: var(--font-display);
    color: var(--color-gold);
    font-size: 1.8rem;
    margin-bottom: var(--space-sm);
}

.math-description {
    color: var(--color-text-muted);
    margin-bottom: var(--space-xl);
}

.calculator {
    background: var(--color-bg);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.calc-input-group {
    margin-bottom: var(--space-lg);
}

.calc-input-group label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 600;
    color: var(--color-text);
}

.calc-input {
    width: 100%;
    max-width: 200px;
    padding: var(--space-md);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 1.2rem;
    text-align: center;
    transition: border-color var(--transition-base);
}

.calc-input:focus {
    outline: none;
    border-color: var(--color-gold);
}

.calc-result {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding: var(--space-lg);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(233, 69, 96, 0.1) 100%);
    border-radius: var(--radius-md);
}

.calc-label {
    font-weight: 600;
    color: var(--color-text-muted);
}

.calc-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-gold);
}

.calc-extra {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    flex-wrap: wrap;
}

.calc-detail {
    text-align: center;
}

.detail-label {
    display: block;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.detail-value {
    font-weight: 600;
    color: var(--color-accent-light);
}

/* ============================================
   FOOTER
   ============================================ */
.main-footer {
    background: var(--color-primary);
    padding: var(--space-xl) 0 var(--space-lg);
    border-top: 1px solid var(--color-border);
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.footer-brand {
    text-align: center;
}

.footer-logo {
    font-size: 3rem;
    display: block;
    margin-bottom: var(--space-sm);
}

.footer-brand h3 {
    font-family: var(--font-display);
    color: var(--color-gold);
    font-size: 1.3rem;
    margin-bottom: var(--space-xs);
}

.footer-brand p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-lg);
}

.footer-column h4 {
    color: var(--color-gold);
    font-size: 1rem;
    margin-bottom: var(--space-md);
    font-weight: 600;
}

.footer-column ul {
    list-style: none;
}

.footer-column li {
    margin-bottom: var(--space-sm);
}

.footer-column a {
    color: var(--color-text-muted);
    transition: color var(--transition-base);
}

.footer-column a:hover {
    color: var(--color-gold);
}

.footer-bottom {
    text-align: center;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--color-border);
}

.footer-bottom p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-xs);
}

.footer-credit {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    opacity: 0.8;
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    background: var(--color-surface);
    border-left: 4px solid var(--color-gold);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    animation: toastSlideIn 0.3s ease;
    max-width: 350px;
}

.toast.error {
    border-left-color: #e74c3c;
}

.toast.success {
    border-left-color: #2ecc71;
}

.toast.info {
    border-left-color: #3498db;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-icon {
    font-size: 1.3rem;
}

.toast-message {
    color: var(--color-text);
    font-size: 0.95rem;
}

.toast-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: var(--color-text);
}

/* ============================================
   MODALS
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 500px;
    width: 90%;
    position: relative;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    animation: modalPop 0.3s ease;
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.close-modal {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    font-size: 1.5rem;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: color var(--transition-base);
}

.close-modal:hover {
    color: var(--color-text);
}

/* Victory Modal */
.victory-content {
    text-align: center;
    padding: var(--space-xl);
}

.victory-animation {
    position: relative;
    margin-bottom: var(--space-lg);
}

.trophy {
    font-size: 5rem;
    animation: trophyBounce 1s ease infinite;
}

@keyframes trophyBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(200px) rotate(720deg);
    }
}

.victory-title {
    font-family: var(--font-display);
    color: var(--color-gold);
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.victory-message {
    color: var(--color-text-muted);
    margin-bottom: var(--space-lg);
}

.victory-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: var(--color-bg);
    border-radius: var(--radius-md);
}

.victory-stat {
    text-align: center;
}

.victory-stat .stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-xs);
}

.victory-stat .stat-value {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-gold);
}

.victory-buttons {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .rules-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .footer-links {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        width: 100%;
        background: rgba(15, 15, 26, 0.98);
        flex-direction: column;
        padding: var(--space-lg);
        gap: var(--space-md);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-link {
        padding: var(--space-md);
        text-align: center;
        border-bottom: 1px solid var(--color-border);
    }
    
    .hero-section {
        padding: 100px var(--space-md) var(--space-lg);
    }
    
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .rules-grid {
        grid-template-columns: 1fr;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .game-board {
        min-height: 380px;
        padding: var(--space-sm);
        gap: var(--space-xs);
    }
    
    .peg-rod {
        height: 260px;
    }
    
    .peg-drop-zone {
        height: 300px;
    }
    
    .disk {
        height: 26px;
        font-size: 0.75rem;
    }
    
    .game-info {
        gap: var(--space-md);
    }
    
    .game-controls {
        padding: var(--space-md);
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .disk-selector {
        justify-content: center;
    }
    
    .victory-stats {
        grid-template-columns: 1fr;
    }
    
    .calc-extra {
        flex-direction: column;
        gap: var(--space-md);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--space-md);
    }
    
    .nav-container {
        padding: 0 var(--space-md);
    }
    
    .logo-text {
        display: none;
    }
    
    .stat-card {
        padding: var(--space-md);
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .rule-card {
        padding: var(--space-lg);
    }
    
    .feature-card {
        padding: var(--space-lg);
    }
    
    .disk-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .control-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .game-board {
        min-height: 320px;
        padding: 8px 4px;
        gap: 4px;
    }
    
    .peg-rod {
        height: 220px;
        width: 10px;
    }
    
    .peg-drop-zone {
        height: 260px;
    }
    
    .disk {
        height: 22px;
        font-size: 0.7rem;
    }
}

/* ============================================
   ANIMATIONS & EFFECTS
   ============================================ */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s ease;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px var(--color-gold); }
    50% { box-shadow: 0 0 20px var(--color-gold), 0 0 40px var(--color-gold); }
}

.glow {
    animation: glow 2s ease-in-out infinite;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* Selection */
::selection {
    background: var(--color-accent);
    color: white;
}

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .main-nav,
    .hero-scroll-indicator,
    .game-controls,
    .control-btn,
    .main-footer {
        display: none;
    }
    
    .hero-section {
        min-height: auto;
        padding: var(--space-lg);
    }
    
    .game-board {
        page-break-inside: avoid;
    }
}
