/* ============================================
   AI PLAYGROUND - RETRO TERMINAL THEME
   Softer, more readable version
   ============================================ */

:root {
    /* Softer dark backgrounds */
    --bg-dark: #0d1117;
    --bg-medium: #161b22;
    --bg-light: #21262d;
    
    /* Softer greens - easier on eyes */
    --green-bright: #7ee787;
    --green-medium: #56d364;
    --green-dim: #238636;
    --green-glow: rgba(126, 231, 135, 0.15);
    
    /* Warm amber - primary accent */
    --amber: #f0883e;
    --amber-bright: #ffa657;
    --amber-dim: #d29922;
    
    /* Cyan accent */
    --cyan: #58a6ff;
    --cyan-dim: #388bfd;
    
    /* Purple accent */
    --purple: #a371f7;
    
    /* Red for errors */
    --red: #f85149;
    
    /* Text - softer greens */
    --text-primary: #c9d1d9;
    --text-bright: #e6edf3;
    --text-green: #7ee787;
    --text-dim: #8b949e;
    
    /* Fonts */
    --font-main: 'VT323', 'Courier New', monospace;
    --font-mono: 'Share Tech Mono', 'Courier New', monospace;
}

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

html {
    font-size: 18px;
}

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

/* Subtle scanlines - much softer */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.03),
        rgba(0, 0, 0, 0.03) 1px,
        transparent 1px,
        transparent 3px
    );
    opacity: 0.5;
}

/* CRT container - NO flicker for readability */
.crt-effect {
    position: relative;
    min-height: 100vh;
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Subtle vignette */
.crt-effect::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        rgba(0, 0, 0, 0.2) 100%
    );
    z-index: 999;
}

/* ============================================
   HEADER
   ============================================ */

.terminal-header {
    text-align: center;
    padding: 1.5rem 0 2rem;
    border-bottom: 2px solid var(--green-dim);
    margin-bottom: 2rem;
    background: linear-gradient(180deg, var(--bg-medium) 0%, transparent 100%);
    border-radius: 8px 8px 0 0;
}

.ascii-logo {
    font-family: var(--font-mono);
    font-size: 0.55rem;
    color: var(--green-bright);
    text-shadow: 0 0 20px var(--green-glow);
    line-height: 1.15;
    overflow-x: auto;
    white-space: pre;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .ascii-logo {
        font-size: 0.32rem;
    }
}

.subtitle {
    font-size: 1.3rem;
    color: var(--amber-bright);
    margin-top: 0.75rem;
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(240, 136, 62, 0.3);
}

.status-bar {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-top: 1.25rem;
    font-size: 1rem;
    flex-wrap: wrap;
}

.status-item {
    color: var(--text-dim);
}

.status-item span {
    color: var(--cyan);
    font-weight: bold;
}

/* ============================================
   NAVIGATION
   ============================================ */

.terminal-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 1.25rem;
    background: var(--bg-medium);
    border: 1px solid var(--bg-light);
    border-radius: 8px;
}

.nav-title {
    width: 100%;
    font-size: 1rem;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
    letter-spacing: 2px;
}

.nav-btn {
    background: var(--bg-light);
    border: 2px solid transparent;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1.15rem;
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 6px;
}

.nav-btn:hover {
    background: var(--green-dim);
    color: var(--text-bright);
    border-color: var(--green-medium);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: linear-gradient(135deg, var(--green-dim), var(--green-medium));
    color: var(--bg-dark);
    border-color: var(--green-bright);
    box-shadow: 0 4px 15px var(--green-glow);
    font-weight: bold;
}

.nav-btn .key {
    color: var(--amber);
    margin-right: 0.25rem;
}

.nav-btn.active .key {
    color: var(--bg-dark);
}

/* ============================================
   MODULES (Content Areas)
   ============================================ */

.module-container {
    background: var(--bg-medium);
    border: 2px solid var(--bg-light);
    border-radius: 8px;
    min-height: 500px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.module {
    display: none;
    padding: 2rem;
    animation: fadeIn 0.25s ease;
}

.module.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.module-header {
    border-bottom: 1px solid var(--bg-light);
    padding-bottom: 1.25rem;
    margin-bottom: 1.75rem;
}

.module-title {
    font-size: 1.6rem;
    color: var(--amber-bright);
    text-shadow: 0 0 10px rgba(255, 166, 87, 0.2);
}

.module-desc {
    display: block;
    font-size: 1.1rem;
    color: var(--text-dim);
    margin-top: 0.5rem;
}

/* ============================================
   CHAT MODULE
   ============================================ */

.chat-window {
    background: var(--bg-dark);
    border: 1px solid var(--bg-light);
    border-radius: 6px;
    height: 380px;
    overflow-y: auto;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    font-size: 1.15rem;
}

.chat-message {
    margin-bottom: 1.25rem;
    line-height: 1.6;
    padding: 0.75rem;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.2);
}

.chat-message .prompt {
    font-weight: bold;
    margin-right: 0.5rem;
}

.chat-message.user {
    background: rgba(88, 166, 255, 0.1);
    border-left: 3px solid var(--cyan);
}

.chat-message.user .prompt {
    color: var(--cyan);
}

.chat-message.ai {
    background: rgba(126, 231, 135, 0.1);
    border-left: 3px solid var(--green-medium);
}

.chat-message.ai .prompt {
    color: var(--green-bright);
}

.chat-message.system {
    background: rgba(240, 136, 62, 0.1);
    border-left: 3px solid var(--amber);
}

.chat-message.system .prompt {
    color: var(--amber);
}

.chat-message.error {
    background: rgba(248, 81, 73, 0.1);
    border-left: 3px solid var(--red);
}

.chat-message.error .prompt {
    color: var(--red);
}

.input-area {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.input-prompt {
    color: var(--cyan);
    font-size: 1.3rem;
    font-weight: bold;
    white-space: nowrap;
}

.terminal-input {
    flex: 1;
    background: var(--bg-dark);
    border: 2px solid var(--bg-light);
    color: var(--text-bright);
    font-family: var(--font-main);
    font-size: 1.2rem;
    padding: 0.9rem 1.25rem;
    outline: none;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.terminal-input:focus {
    border-color: var(--green-medium);
    box-shadow: 0 0 15px var(--green-glow);
}

.terminal-input::placeholder {
    color: var(--text-dim);
}

.send-btn, .action-btn {
    background: linear-gradient(135deg, var(--green-dim), var(--green-medium));
    border: none;
    color: var(--bg-dark);
    font-family: var(--font-main);
    font-size: 1.15rem;
    font-weight: bold;
    padding: 0.9rem 1.75rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 6px;
}

.send-btn:hover, .action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--green-glow);
}

.send-btn:active, .action-btn:active {
    transform: translateY(0);
}

/* ============================================
   CREATIVE WRITER MODULE
   ============================================ */

.creative-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-bottom: 1.75rem;
    align-items: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.control-group.wide {
    flex: 1;
    min-width: 200px;
}

.control-group label {
    font-size: 1rem;
    color: var(--text-dim);
    letter-spacing: 1px;
}

.terminal-select {
    background: var(--bg-dark);
    border: 2px solid var(--bg-light);
    color: var(--text-bright);
    font-family: var(--font-main);
    font-size: 1.15rem;
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.terminal-select:hover {
    border-color: var(--green-dim);
}

.terminal-select:focus {
    border-color: var(--green-medium);
    outline: none;
}

.output-window {
    background: var(--bg-dark);
    border: 1px solid var(--bg-light);
    border-radius: 6px;
    min-height: 280px;
    padding: 1.75rem;
    font-size: 1.25rem;
    line-height: 1.7;
    white-space: pre-wrap;
    color: var(--text-bright);
}

.output-placeholder {
    color: var(--text-dim);
    text-align: center;
}

.output-placeholder pre {
    font-size: 1rem;
}

/* ============================================
   REWORD ENGINE MODULE
   ============================================ */

.reword-controls {
    margin-bottom: 1.75rem;
}

.control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.style-btn {
    background: var(--bg-light);
    border: 2px solid transparent;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1.05rem;
    padding: 0.6rem 1.1rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 6px;
}

.style-btn:hover {
    background: var(--cyan-dim);
    color: var(--text-bright);
}

.style-btn.active {
    background: var(--cyan);
    color: var(--bg-dark);
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(88, 166, 255, 0.3);
}

.reword-panels {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.25rem;
    align-items: stretch;
}

@media (max-width: 768px) {
    .reword-panels {
        grid-template-columns: 1fr;
    }
    .panel-divider {
        transform: rotate(90deg);
        padding: 0.5rem 0;
    }
}

.panel {
    display: flex;
    flex-direction: column;
}

.panel-header {
    font-size: 1rem;
    color: var(--amber);
    margin-bottom: 0.6rem;
    letter-spacing: 1px;
}

.panel-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--green-medium);
    font-size: 1.75rem;
}

.terminal-textarea {
    background: var(--bg-dark);
    border: 2px solid var(--bg-light);
    color: var(--text-bright);
    font-family: var(--font-main);
    font-size: 1.15rem;
    padding: 1.25rem;
    resize: vertical;
    min-height: 220px;
    flex: 1;
    border-radius: 6px;
    transition: border-color 0.15s ease;
}

.terminal-textarea.short {
    min-height: 100px;
}

.terminal-textarea:focus {
    border-color: var(--green-medium);
    outline: none;
}

.terminal-output {
    background: var(--bg-dark);
    border: 2px solid var(--bg-light);
    color: var(--text-bright);
    font-size: 1.15rem;
    padding: 1.25rem;
    min-height: 220px;
    flex: 1;
    overflow-y: auto;
    border-radius: 6px;
    line-height: 1.6;
}

/* ============================================
   GAMES MODULE
   ============================================ */

.games-menu {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.game-btn {
    background: var(--bg-dark);
    border: 2px solid var(--bg-light);
    padding: 1.25rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
    border-radius: 8px;
}

.game-btn:hover {
    border-color: var(--purple);
    background: rgba(163, 113, 247, 0.1);
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(163, 113, 247, 0.2);
}

.game-icon {
    font-size: 2.25rem;
    display: block;
    margin-bottom: 0.6rem;
}

.game-name {
    display: block;
    font-family: var(--font-main);
    font-size: 1.3rem;
    color: var(--amber-bright);
    margin-bottom: 0.4rem;
}

.game-desc {
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--text-dim);
}

.game-area {
    background: var(--bg-dark);
    border: 1px solid var(--bg-light);
    border-radius: 6px;
    min-height: 320px;
    padding: 1.75rem;
}

.game-placeholder {
    color: var(--text-dim);
    text-align: center;
}

.game-active .game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--bg-light);
}

.game-active .game-title {
    color: var(--purple);
    font-size: 1.3rem;
}

.game-active .game-chat {
    height: 250px;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
}

.game-active .game-input-area {
    display: flex;
    gap: 0.75rem;
}

/* ============================================
   IMAGE GENERATION MODULE
   ============================================ */

.image-controls {
    margin-bottom: 1.75rem;
}

.image-output {
    background: var(--bg-dark);
    border: 1px solid var(--bg-light);
    border-radius: 6px;
    min-height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.image-placeholder {
    color: var(--text-dim);
    text-align: center;
}

.image-output img {
    max-width: 100%;
    max-height: 520px;
    border: 3px solid var(--green-medium);
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

/* ============================================
   ABOUT MODULE
   ============================================ */

.about-content {
    max-width: 850px;
}

.about-section {
    margin-bottom: 2.25rem;
}

.about-section h3 {
    color: var(--amber-bright);
    font-size: 1.35rem;
    margin-bottom: 0.9rem;
}

.about-section p {
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--text-primary);
}

.about-section strong {
    color: var(--cyan);
}

.model-info {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.model-card {
    background: var(--bg-dark);
    border: 1px solid var(--bg-light);
    border-radius: 8px;
    padding: 1.25rem;
}

.model-name {
    display: block;
    color: var(--green-bright);
    font-size: 1.25rem;
    margin-bottom: 0.4rem;
}

.model-detail {
    display: block;
    color: var(--text-dim);
    font-size: 1rem;
}

.model-use {
    display: block;
    color: var(--amber);
    font-size: 1rem;
    margin-top: 0.4rem;
}

.code-block {
    background: var(--bg-dark);
    border: 1px solid var(--bg-light);
    border-radius: 6px;
    padding: 1.25rem;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    color: var(--text-dim);
    overflow-x: auto;
    white-space: pre-wrap;
    line-height: 1.5;
}

.tech-list {
    list-style: none;
    font-size: 1.15rem;
}

.tech-list li {
    padding: 0.4rem 0;
    color: var(--text-primary);
}

/* ============================================
   FOOTER
   ============================================ */

.terminal-footer {
    display: flex;
    justify-content: space-between;
    padding: 1.25rem;
    margin-top: 2rem;
    border-top: 1px solid var(--bg-light);
    font-size: 1rem;
    color: var(--text-dim);
}

.footer-right {
    display: flex;
    gap: 2.5rem;
}

.footer-right span {
    color: var(--green-medium);
}

/* ============================================
   LOADING OVERLAY
   ============================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 17, 23, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    text-align: center;
    background: var(--bg-medium);
    padding: 2.5rem 3.5rem;
    border-radius: 12px;
    border: 2px solid var(--green-dim);
}

.loading-spinner {
    width: 55px;
    height: 55px;
    border: 4px solid var(--bg-light);
    border-top-color: var(--green-bright);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.25rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.5rem;
    color: var(--green-bright);
    text-shadow: 0 0 15px var(--green-glow);
}

.loading-dots span {
    animation: blink 1.4s infinite both;
    font-size: 2rem;
    color: var(--green-bright);
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

/* ============================================
   TYPING EFFECT
   ============================================ */

.typing::after {
    content: '█';
    animation: cursor-blink 0.8s step-end infinite;
    color: var(--green-bright);
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-light);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--green-dim);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
    html {
        font-size: 16px;
    }
    
    .terminal-nav {
        justify-content: center;
    }
    
    .nav-btn {
        font-size: 1rem;
        padding: 0.5rem 0.9rem;
    }
    
    .footer-right {
        flex-direction: column;
        gap: 0.5rem;
        text-align: right;
    }
    
    .module {
        padding: 1.25rem;
    }
}
