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

:root {
    --bg: #1a1a2e;
    --street: #2a2a3e;
    --sky-top: #0f0f23;
    --sky-bottom: #1a1a2e;
    --text: #c8c8d4;
    --text-dim: #6a6a7a;
    --accent: #6e8efb;
    --spark: #f7b267;
    --border: rgba(255, 255, 255, 0.06);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    overflow: hidden;
    height: 100vh;
}

.hidden {
    display: none !important;
}

/* ---- Intro overlay (the one entry screen) ---- */
#intro-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

#intro-card {
    text-align: center;
    padding: 24px 36px;
    background: rgba(10, 15, 30, 0.65);
    backdrop-filter: blur(3px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.intro-title {
    font-family: 'Courier New', monospace;
    font-size: 32px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.15em;
    margin-bottom: 4px;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.4);
    white-space: nowrap;
}

.intro-pitch {
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255,255,255,0.85);
    margin-bottom: 10px;
}

.intro-flow {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 14px;
    letter-spacing: 0.02em;
}

.intro-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.intro-form label {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #fff;
    font-weight: 700;
    text-align: left;
}

.sample-btn {
    width: 100%;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: #fff;
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid rgba(255, 215, 0, 0.5);
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.sample-btn:hover {
    background: rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.7);
}

.sample-hint {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: rgba(255,255,255,0.4);
    text-align: center;
    margin-top: 4px;
}

.intro-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
}

.intro-divider::before,
.intro-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.15);
}

.intro-divider span {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.3);
    padding: 14px 12px;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    margin-bottom: 4px;
}

.drop-zone.drag-over {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.08);
}

.drop-icon {
    font-size: 28px;
    margin-bottom: 8px;
}

.drop-text {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.drop-hint {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    margin-bottom: 8px;
}

.file-picker-btn {
    display: inline-block;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.7);
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 8px 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.file-picker-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

.apikey-hint {
    font-family: 'Courier New', monospace;
    font-size: 10px;
    color: rgba(255,255,255,0.35);
    text-align: left;
    margin-top: -4px;
}

.intro-form input[type="text"],
.intro-form input[type="password"] {
    background: rgba(0, 0, 0, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.15);
    padding: 14px 16px;
    font-size: 14px;
    color: #fff;
    font-family: 'Courier New', monospace;
    outline: none;
    transition: border-color 0.2s;
}

.intro-form input:focus {
    border-color: rgba(255, 255, 255, 0.4);
}

.folder-row {
    display: flex;
    gap: 8px;
}

.folder-row input {
    flex: 1;
}

.browse-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 12px 16px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.browse-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

#btn-start {
    margin-top: 6px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px 20px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    cursor: pointer;
    transition: all 0.2s;
}

#btn-start:hover {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.5);
}
#btn-start:disabled { opacity: 0.4; cursor: not-allowed; }

.setup-status {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-top: 8px;
    min-height: 18px;
}

.setup-status.error { color: #FF6B6B; }

/* ---- Credit ---- */
.credit {
    position: fixed;
    bottom: 12px;
    right: 20px;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    z-index: 200;
    letter-spacing: 0.04em;
}

.credit a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.credit a:hover {
    color: #fff;
}

/* ---- Main app ---- */
#app {
    position: relative;
    width: 100vw;
    height: 100vh;
}

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

/* ---- Spark overlay ---- */
#spark-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

#spark-overlay.spark-hidden {
    opacity: 0;
}

#spark-overlay.spark-visible {
    opacity: 1;
}

#spark-card {
    background: rgba(255, 255, 255, 0.93);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 28px 36px;
    max-width: 520px;
    min-width: 320px;
    text-align: center;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.spark-people {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.spark-name-a {
    font-size: 14px;
    font-weight: 600;
    color: #2563eb;
}

.spark-met {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #999;
}

.spark-name-b {
    font-size: 14px;
    font-weight: 600;
    color: #dc2626;
}

.spark-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.spark-idea {
    font-size: 16px;
    line-height: 1.5;
    color: #555;
    font-weight: 400;
}

.spark-loading {
    font-size: 13px;
    color: #999;
    font-style: italic;
}

/* ---- Controls ---- */
#controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(10, 10, 15, 0.7);
    backdrop-filter: blur(8px);
}

#controls button {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

#controls button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

#speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

#speed-control label {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#speed {
    width: 80px;
    accent-color: var(--accent);
}

.change-folder-btn {
    display: none;
}

.scene-btn {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(255, 255, 255, 0.12) !important;
    border: 2px solid rgba(255, 255, 255, 0.25) !important;
    color: #fff !important;
    padding: 10px 20px !important;
    border-radius: 0 !important;
}

.scene-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.22) !important;
    border-color: rgba(255, 255, 255, 0.45) !important;
}

.scene-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* Coffee result overlay */
#coffee-result {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

#coffee-card {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(0, 0, 0, 0.08);
    padding: 40px 48px;
    max-width: 560px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.coffee-label {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #999;
    margin-bottom: 12px;
}

#coffee-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 12px;
}

#coffee-idea {
    font-size: 16px;
    line-height: 1.6;
    color: #444;
    margin-bottom: 24px;
}

.coffee-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.coffee-actions button {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 10px 20px;
    cursor: pointer;
    border: 1px solid #ddd;
    background: #fff;
    color: #555;
    transition: all 0.2s;
}

.coffee-actions button:hover {
    border-color: #999;
    color: #1a1a2e;
}
