/* What Makes a Game? - Discovery Experience */
/* Theme: Gaming Green (#10b981) */

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

:root {
    --bg-dark: #0a0f1a;
    --bg-medium: #111827;
    --bg-light: #1f2937;
    --primary: #10b981;
    --primary-dark: #059669;
    --primary-light: #34d399;
    --primary-glow: rgba(16, 185, 129, 0.3);
    --secondary: #6366f1;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border-color: #374151;
    --danger: #ef4444;
    --warning: #f59e0b;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
}

/* Screens */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
}

/* Start Screen */
#start-screen {
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #0f1729 0%, var(--bg-dark) 70%);
}

.start-content {
    text-align: center;
    max-width: 600px;
    padding: 2rem;
}

.discovery-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
}

.start-content h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.start-content .subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.preview-container {
    margin: 2rem auto;
    perspective: 1000px;
}

.preview-game {
    width: 300px;
    height: 180px;
    background: var(--bg-medium);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(16, 185, 129, 0.15);
}

.preview-paddle {
    position: absolute;
    width: 10px;
    height: 50px;
    background: var(--primary);
    border-radius: 4px;
    top: 50%;
    transform: translateY(-50%);
}

.preview-paddle.left {
    left: 20px;
    animation: paddleMove 2s ease-in-out infinite;
}

.preview-paddle.right {
    right: 20px;
    animation: paddleMove 2s ease-in-out infinite 0.5s;
}

.preview-ball {
    position: absolute;
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: ballBounce 3s linear infinite;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

@keyframes paddleMove {
    0%, 100% { transform: translateY(-50%); }
    50% { transform: translateY(-80%); }
}

@keyframes ballBounce {
    0% { left: 15%; top: 30%; }
    25% { left: 85%; top: 70%; }
    50% { left: 15%; top: 60%; }
    75% { left: 85%; top: 40%; }
    100% { left: 15%; top: 30%; }
}

.instruction {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Buttons */
.primary-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px var(--primary-glow);
}

.secondary-btn {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.secondary-btn:hover {
    background: var(--bg-medium);
    border-color: var(--primary);
}

.text-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
    font-family: inherit;
}

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

/* Experience Screen */
#experience-screen {
    background: var(--bg-dark);
}

.experience-layout {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* Game Area */
.game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
    background: radial-gradient(ellipse at center, #0f1729 0%, var(--bg-dark) 70%);
}

.game-header {
    margin-bottom: 1rem;
}

.score-display {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.score-divider {
    color: var(--primary);
}

#game-canvas {
    background: var(--bg-medium);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 0 60px rgba(16, 185, 129, 0.1);
}

.game-controls-hint {
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.game-controls-hint kbd {
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: inherit;
    margin: 0 0.15rem;
}

/* Layer Overlays */
.layer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.layer-overlay.visible {
    opacity: 1;
}

/* Layers Panel */
.layers-panel {
    width: 360px;
    background: var(--bg-medium);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h2 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    color: var(--primary);
}

.panel-header p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.layers-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Layer Items */
.layer-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.layer-item:hover {
    border-color: var(--border-color);
}

.layer-item.active .toggle-switch {
    background: var(--primary);
}

.layer-item.disabled {
    opacity: 0.5;
}

.layer-item.disabled .layer-icon {
    filter: grayscale(1);
}

.layer-toggle {
    flex-shrink: 0;
}

.toggle-switch {
    width: 40px;
    height: 22px;
    background: var(--bg-dark);
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
    border: 1px solid var(--border-color);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
}

.toggle-switch.on::after {
    transform: translateX(18px);
}

.layer-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.layer-icon {
    font-size: 1.25rem;
    width: 32px;
    text-align: center;
}

.layer-text h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
}

.layer-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.layer-expand {
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.layer-item.expanded .layer-expand {
    transform: rotate(180deg);
}

/* Layer Details */
.layer-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--bg-dark);
    border-radius: 0 0 8px 8px;
    margin-top: -0.25rem;
    margin-bottom: 0.5rem;
}

.layer-details.open {
    max-height: 400px;
}

.detail-content {
    padding: 1rem;
}

.detail-content > p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.fun-fact {
    font-size: 0.8rem;
    color: var(--primary-light);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 1rem;
    border-left: 3px solid var(--primary);
}

/* Controls Section */
.controls-section {
    background: var(--bg-medium);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.subsection-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0.75rem 0 0.5rem 0;
    padding-left: 0.25rem;
}

.control-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.control-row:last-child {
    border-bottom: none;
}

.control-row label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    justify-content: flex-end;
}

.slider-row input[type="range"] {
    width: 100px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-dark);
    border-radius: 3px;
    cursor: pointer;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}

.slider-row input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.slider-value {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    min-width: 45px;
    text-align: right;
    font-family: 'Courier New', monospace;
}

.color-picker-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-picker-row input[type="color"] {
    width: 32px;
    height: 32px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-picker-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker-row input[type="color"]::-webkit-color-swatch {
    border-radius: 4px;
    border: none;
}

.color-value {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.checkbox-row span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.select-row select {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}

.select-row select:focus {
    outline: none;
    border-color: var(--primary);
}

.select-row select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* Collision Counter */
.collision-counter {
    background: var(--bg-medium);
    padding: 0.5rem;
    border-radius: 6px;
    text-align: center;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.collision-counter span:first-child {
    color: var(--text-muted);
    margin-right: 0.5rem;
}

#collision-count {
    color: var(--primary);
    font-weight: 600;
}

/* Sprite Showcase */
.sprite-showcase {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

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

.sprite-preview {
    width: 48px;
    height: 48px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    margin: 0 auto 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.paddle-sprite {
    background: var(--bg-medium);
}

.paddle-sprite::after {
    content: '';
    width: 8px;
    height: 32px;
    background: var(--primary);
    border-radius: 2px;
}

.ball-sprite {
    background: var(--bg-medium);
}

.ball-sprite::after {
    content: '';
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
}

.bg-sprite {
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-medium) 100%);
}

.sprite-item span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Sound Showcase */
.sound-showcase {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.sound-demo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.sound-demo:hover {
    border-color: var(--primary);
    background: var(--bg-light);
}

.sound-demo:active {
    transform: scale(0.95);
}

.sound-demo.playing {
    border-color: var(--primary);
    box-shadow: 0 0 10px var(--primary-glow);
}

.sound-demo.playing .sound-wave {
    animation: wave 0.3s ease infinite;
}

@keyframes wave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.3); }
}

/* Physics Display */
.physics-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.physics-stat {
    background: var(--bg-medium);
    padding: 0.5rem;
    border-radius: 6px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    font-family: 'Courier New', monospace;
}

/* Collision Display */
.collision-display {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.collision-box {
    text-align: center;
}

.hitbox {
    border: 2px dashed var(--warning);
    margin: 0 auto 0.5rem;
    background: rgba(245, 158, 11, 0.1);
}

.hitbox-paddle {
    width: 16px;
    height: 48px;
    border-radius: 4px;
}

.hitbox-ball {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.collision-box span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.collision-status {
    background: var(--bg-medium);
    padding: 0.5rem;
    border-radius: 6px;
    text-align: center;
    font-size: 0.85rem;
}

.collision-status span:first-child {
    color: var(--text-muted);
    margin-right: 0.5rem;
}

#last-collision {
    color: var(--primary);
    font-weight: 500;
}

/* Input Display */
.input-display {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.key-status {
    text-align: center;
}

.key-indicator {
    display: block;
    background: var(--bg-medium);
    border: 2px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    transition: all 0.1s;
}

.key-indicator.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
}

.key-status span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.input-log {
    background: var(--bg-medium);
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
}

.input-log > span {
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.25rem;
}

#input-history {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    min-height: 20px;
}

#input-history span {
    background: var(--bg-light);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.7rem;
    color: var(--primary);
}

/* Rules Display */
.rules-display {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-medium);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

.rule-icon {
    font-size: 1rem;
}

/* Panel Footer */
.panel-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.75rem;
}

.panel-footer .secondary-btn {
    flex: 1;
}

.panel-footer .primary-btn {
    flex: 1;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

/* End Screen */
#end-screen {
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #0f1729 0%, var(--bg-dark) 70%);
    overflow-y: auto;
    padding: 2rem;
}

.end-content {
    max-width: 800px;
    text-align: center;
}

.celebration {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 1s ease infinite;
}

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

.end-content h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--bg-medium);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    transition: all 0.3s;
}

.summary-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.summary-card h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--primary);
}

.summary-card p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Insight Box */
.insight-box {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.insight-box h2 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.insight-box p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Stats Display */
.stats-display {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 2.5rem;
}

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

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

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

/* CTA Section */
.cta-section {
    margin-bottom: 2rem;
}

.cta-section h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.cta-section > p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 2rem;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 1.1rem;
    font-weight: 600;
}

.cta-btn span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.cta-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px var(--primary-glow);
}

.cta-btn.secondary {
    background: var(--bg-medium);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.cta-btn.secondary:hover {
    border-color: var(--primary);
    background: var(--bg-light);
}

/* Responsive */
@media (max-width: 900px) {
    .experience-layout {
        flex-direction: column;
    }

    .layers-panel {
        width: 100%;
        height: 50vh;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .game-area {
        height: 50vh;
    }

    #game-canvas {
        max-width: 100%;
        height: auto;
    }
}

@media (max-width: 600px) {
    .start-content h1 {
        font-size: 2rem;
    }

    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cta-buttons {
        flex-direction: column;
    }

    .stats-display {
        gap: 1.5rem;
    }

    .stat-number {
        font-size: 2rem;
    }
}
