/* playground-v2.css - Enhanced Interactive Retro Studio */

:root {
    --pg-accent-green: #00ff66;
    --pg-accent-amber: #ffb000;
    --pg-accent-red: #ff3344;
    --pg-accent-cyan: #00e5ff;
    --pg-terminal-bg: #0c0d10;
    --pg-terminal-border: #242933;
}

body.dark-mode {
    --pg-terminal-bg: #08090b;
    --pg-terminal-border: #2a2f3a;
}

/* ========================================================
   CLEAN LIGHT AESTHETIC PLAYGROUND DESIGN
   ======================================================== */

body.playground-body {
    background-color: #f7f6f2 !important;
    color: #1a1b1e !important;
    background-image: 
        linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px) !important;
    background-size: 32px 32px !important;
    min-height: 100vh;
    overflow-x: hidden;
    font-family: var(--font-body, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

.playground-container {
    max-width: 1320px;
    margin: 0 auto;
    padding: 1rem 2rem 5rem 2rem;
}

/* Minimal Topbar: Clean Back Button only */
.playground-minimal-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2.5rem;
    background: transparent;
    max-width: 1320px;
    margin: 0 auto;
}

.playground-clean-back {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 1.15rem;
    background: #ffffff;
    color: #1a1b1e;
    border: 1.5px solid #1a1b1e;
    border-radius: 6px;
    text-decoration: none;
    font-family: var(--font-heading, "Space Mono", monospace);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    box-shadow: 2px 2px 0px #1a1b1e;
    transition: all 0.15s ease;
}

.playground-clean-back .back-arrow {
    font-size: 1.05rem;
    transition: transform 0.15s ease;
}

.playground-clean-back .back-kbd {
    font-size: 0.65rem;
    padding: 0.1rem 0.35rem;
    background: #ebe9e1;
    border: 1px solid #d2cec2;
    border-radius: 3px;
    color: #646464;
}

.playground-clean-back:hover {
    background: #1a1b1e;
    color: #ffffff;
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.2);
}

.playground-clean-back:hover .back-arrow {
    transform: translateX(-3px);
}

.playground-clean-back:hover .back-kbd {
    background: #333;
    border-color: #444;
    color: #ccc;
}

.playground-status-pill {
    font-family: var(--font-heading, monospace);
    font-size: 0.75rem;
    padding: 0.25rem 0.65rem;
    background: #e7f7ed;
    color: #0f7638;
    border: 1px solid #b6e4c7;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Minimal Hero */
.playground-hero {
    padding: 2rem 0 2rem 0;
    border-bottom: 2px solid #1a1b1e;
    margin-bottom: 2.5rem;
}

.playground-badge-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.playground-title {
    font-size: clamp(2.2rem, 5.5vw, 3.8rem);
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin-bottom: 0.75rem;
    color: #1a1b1e;
    font-family: var(--font-heading, "Space Mono", monospace);
}

.playground-desc {
    font-size: 1.05rem;
    color: #555963;
    max-width: 800px;
    line-height: 1.6;
}

/* Light Theme overrides for Toys */
body.playground-body .toy-card {
    background-color: #ffffff;
    border: 2px solid #1a1b1e;
    border-radius: 6px;
    box-shadow: 4px 4px 0px #1a1b1e;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

body.playground-body .toy-card:hover {
    transform: translateY(-2px);
    box-shadow: 6px 6px 0px #1a1b1e;
}

body.playground-body .toy-header {
    background-color: #faf9f5;
    border-bottom: 2px solid #1a1b1e;
    color: #1a1b1e;
    padding: 0.75rem 1.1rem;
}

body.playground-body .toy-btn {
    background: #ffffff;
    border: 1.5px solid #1a1b1e;
    color: #1a1b1e;
    border-radius: 4px;
    box-shadow: 1.5px 1.5px 0px #1a1b1e;
    font-family: var(--font-heading, monospace);
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.1s ease;
}

body.playground-body .toy-btn:hover {
    background: #1a1b1e;
    color: #ffffff;
}

body.playground-body .toy-btn.active {
    background: #1a1b1e;
    color: #ffffff;
}

body.playground-body .arcade-score-board {
    background: #faf9f5;
    border-top: 2px solid #1a1b1e;
    color: #1a1b1e;
}

body.playground-body .arcade-controls-hint {
    background: #f1efe8;
    color: #646464;
    border-top: 1px dashed #d5d1c4;
}

body.playground-body .synth-pad {
    background: #faf9f5;
    border: 1.5px solid #1a1b1e;
    box-shadow: 2px 2px 0px #1a1b1e;
    color: #1a1b1e;
}

body.playground-body .synth-pad:hover {
    background: #ffecb3;
}

body.playground-body .synth-pad.active {
    background: #1a1b1e;
    color: #ffffff;
}

body.playground-body .doodle-palette-btn {
    border: 2px solid #1a1b1e;
}

body.playground-body .devtype-code-display {
    background: #faf9f5;
    color: #333333;
    border-bottom: 2px solid #1a1b1e;
}

body.playground-body .devtype-stats-bar {
    background: #faf9f5;
    color: #1a1b1e;
    border-top: 2px solid #1a1b1e;
}

body.playground-body .ascii-canvas-box {
    background: #faf9f5;
    color: #1a1b1e;
    border-bottom: 2px solid #1a1b1e;
}

/* Module Grid */
.playground-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2rem;
    margin-bottom: 4rem;
}

.col-12 { grid-column: span 12; }
.col-8 { grid-column: span 8; }
.col-7 { grid-column: span 7; }
.col-6 { grid-column: span 6; }
.col-5 { grid-column: span 5; }
.col-4 { grid-column: span 4; }

/* Interactive Toy Card Base */
.toy-card {
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.toy-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.9rem 1.25rem;
    border-bottom: 2px solid var(--text-primary);
    background-color: var(--accent-light);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: bold;
    letter-spacing: 0.05em;
}

.toy-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.window-dots {
    display: inline-flex;
    gap: 6px;
}

.window-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid var(--text-primary);
}

.dot-red { background-color: var(--pg-accent-red); }
.dot-yellow { background-color: var(--pg-accent-amber); }
.dot-green { background-color: var(--pg-accent-green); }

.toy-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toy-btn {
    background: transparent;
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: bold;
    padding: 3px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toy-btn:hover, .toy-btn.active {
    background: var(--text-primary);
    color: var(--bg-color);
}

/* =========================================
   1. RETRO TERMINAL & AI AVATAR
   ========================================= */
.terminal-screen {
    background-color: var(--pg-terminal-bg);
    color: #4af626;
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 1.25rem;
    height: 380px;
    display: flex;
    flex-direction: column;
}

.terminal-logs {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding-right: 6px;
}

.terminal-logs::-webkit-scrollbar {
    width: 6px;
}
.terminal-logs::-webkit-scrollbar-thumb {
    background: #2a3b2b;
}

.term-line {
    word-break: break-word;
    line-height: 1.5;
}

.term-prompt-prefix {
    color: #00ff66;
    font-weight: bold;
}

.term-cmd {
    color: #ffffff;
}

.term-res-system {
    color: #79a6d2;
}

.term-res-ai {
    color: #e2e8f0;
    background: rgba(0, 255, 102, 0.04);
    padding: 6px 12px;
    border-left: 2px solid #00ff66;
    border-radius: 0 4px 4px 0;
    line-height: 1.6;
}

.term-res-ai b {
    color: #ffd166;
}

.term-res-error {
    color: #ff5555;
}

/* Matrix Digital Rain Canvas Overlay */
.matrix-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    z-index: 8;
    background: #000000;
}

.matrix-canvas.active {
    opacity: 1;
    pointer-events: auto;
}

.exit-matrix-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #000000;
    color: #00ff66;
    border: 1px solid #00ff66;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    padding: 4px 10px;
    cursor: pointer;
    z-index: 12;
    display: none;
    box-shadow: 0 0 10px rgba(0, 255, 102, 0.4);
    transition: all 0.2s;
}

.exit-matrix-btn:hover {
    background: #00ff66;
    color: #000000;
}

.term-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px dashed #243527;
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

.term-input-field {
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: var(--font-body);
    font-size: 0.95rem;
    flex: 1;
    outline: none;
    caret-color: #00ff66;
}

.term-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--text-primary);
    background-color: var(--bg-color);
}

.chip-btn {
    font-family: var(--font-body);
    font-size: 0.72rem;
    background: var(--bg-color);
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
    padding: 2px 7px;
    cursor: pointer;
    transition: all 0.15s;
}

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

/* =========================================
   2. RETRO ARCADE: CYBER SNAKE GAME
   ========================================= */
.arcade-viewport {
    position: relative;
    background: #08090a;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 340px;
}

#snake-canvas {
    background: #0d0f12;
    border: 1px solid #1f2530;
    box-shadow: inset 0 0 20px rgba(0, 255, 102, 0.05);
    display: block;
}

.arcade-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8, 9, 10, 0.88);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 1.5rem;
    backdrop-filter: blur(2px);
    z-index: 10;
}

.arcade-overlay.hidden {
    display: none;
}

.arcade-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: #00ff66;
    margin-bottom: 0.5rem;
}

.arcade-score-board {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: var(--accent-light);
    border-top: 1px solid var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-heading);
}

.arcade-controls-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-top: 1px dashed var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-dpad {
    display: none;
    grid-template-columns: repeat(3, 40px);
    grid-template-rows: repeat(2, 40px);
    gap: 5px;
    margin: 0.5rem auto;
}

.dpad-btn {
    background: var(--bg-color);
    border: 2px solid var(--text-primary);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* =========================================
   3. TECH STACK GRAVITY PHYSICS TOY
   ========================================= */
.physics-area {
    position: relative;
    height: 380px;
    background: var(--bg-color);
    overflow: hidden;
    cursor: grab;
    user-select: none;
}

.physics-area:active {
    cursor: grabbing;
}

.physics-item {
    position: absolute;
    padding: 8px 16px;
    background: var(--bg-color);
    border: 2px solid var(--text-primary);
    box-shadow: 4px 4px 0px 0px var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: bold;
    cursor: grab;
    transition: box-shadow 0.1s;
    touch-action: none;
    will-change: transform, left, top;
}

.physics-item:active {
    cursor: grabbing;
    box-shadow: 2px 2px 0px 0px var(--text-primary);
}

.physics-item.highlight-node {
    background: var(--text-primary);
    color: var(--bg-color);
}

/* =========================================
   4. AMBIENT LOFI & BEAT SYNTHESIZER
   ========================================= */
.lofi-container {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.lofi-now-playing {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 2px solid var(--text-primary);
    padding: 1rem;
    background: var(--accent-light);
}

.track-meta-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: bold;
}

.track-meta-artist {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Visualizer Bars */
.eq-visualizer {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 36px;
}

.eq-bar {
    width: 6px;
    height: 15%;
    background: var(--text-primary);
    transition: height 0.1s ease;
}

.lofi-controls-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.soundboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.sound-pad {
    padding: 0.9rem 0.5rem;
    border: 2px solid var(--text-primary);
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    box-shadow: 3px 3px 0px 0px var(--text-primary);
    transition: transform 0.1s, box-shadow 0.1s;
}

.sound-pad:hover {
    transform: translate(1px, 1px);
    box-shadow: 2px 2px 0px 0px var(--text-primary);
}

.sound-pad:active, .sound-pad.playing {
    background: var(--text-primary);
    color: var(--bg-color);
    transform: translate(3px, 3px);
    box-shadow: 0px 0px 0px 0px var(--text-primary);
}

/* =========================================
   5. DOODLE LAB 2.0
   ========================================= */
.doodle-canvas-box {
    position: relative;
    width: 100%;
    height: 380px;
    background: #ffffff;
    cursor: crosshair;
    touch-action: none;
}

body.dark-mode .doodle-canvas-box {
    background: #18191c;
}

#doodle-canvas-v2 {
    width: 100%;
    height: 100%;
    display: block;
}

.doodle-palette-v2 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-dot-v2 {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--text-primary);
    cursor: pointer;
    transition: transform 0.15s;
}

.color-dot-v2:hover {
    transform: scale(1.2);
}

.color-dot-v2.active {
    transform: scale(1.3);
    outline: 2px solid var(--pg-accent-green);
}

/* =========================================
   6. DEVTYPE SPEED TEST
   ========================================= */
.devtype-container {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--pg-terminal-bg);
}

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

.devtype-stat-pill {
    background: var(--bg-color);
    border: 1px solid var(--text-primary);
    padding: 4px 10px;
    font-family: var(--font-heading);
    font-size: 0.78rem;
}

.devtype-code-display {
    background: #08090b;
    border: 1px solid #202632;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    line-height: 1.8;
    color: #64748b;
    min-height: 120px;
    border-radius: 4px;
    letter-spacing: 0.05em;
    user-select: none;
}

.char-correct {
    color: #00ff66;
    text-shadow: 0 0 8px rgba(0, 255, 102, 0.4);
}

.char-wrong {
    color: #ff3344;
    background: rgba(255, 51, 68, 0.2);
    border-radius: 2px;
}

.char-current {
    border-left: 2px solid #00e5ff;
    animation: cursorBlink 0.8s infinite;
}

@keyframes cursorBlink {
    0%, 100% { border-color: #00e5ff; }
    50% { border-color: transparent; }
}

.devtype-input-field {
    background: var(--bg-color);
    border: 2px solid var(--text-primary);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    padding: 10px 14px;
    outline: none;
    width: 100%;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.devtype-input-field:focus {
    border-color: #00ff66;
}

/* =========================================
   7. CYBER PONG VS KAZI AI
   ========================================= */
.pong-viewport {
    background: #090a0d;
    overflow: hidden;
}

#pong-canvas {
    background: #090a0d;
    display: block;
    width: 100%;
    height: 280px;
}

.pong-kazi-bubble {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(12, 13, 16, 0.85);
    border: 1px solid #00ff66;
    color: #00ff66;
    font-family: var(--font-heading);
    font-size: 0.72rem;
    padding: 4px 12px;
    border-radius: 20px;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(0, 255, 102, 0.2);
    transition: all 0.3s ease;
}

/* =========================================
   8. NEURAL NETWORK VISUALIZER
   ========================================= */
.neural-viewport {
    width: 100%;
    overflow: hidden;
}

#neural-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* =========================================
   9. ASCII ART GENERATOR
   ========================================= */
.ascii-container {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    background: var(--pg-terminal-bg);
}

.ascii-input-bar {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ascii-output-box {
    background: #060709;
    border: 1px solid #1a2230;
    color: #00ff66;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    line-height: 1.1;
    padding: 1rem;
    overflow-x: auto;
    min-height: 160px;
    border-radius: 4px;
    text-shadow: 0 0 6px rgba(0, 255, 102, 0.3);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .col-8, .col-7, .col-6, .col-5, .col-4 {
        grid-column: span 12;
    }
    .mobile-dpad {
        display: grid;
    }
}

@media (max-width: 600px) {
    .soundboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
