/* Future Self - Day in Your Future Life */

:root {
    --primary: #3498db;
    --primary-glow: rgba(52, 152, 219, 0.4);
    --bg: #0f0f23;
    --surface: rgba(255, 255, 255, 0.06);
    --text: #ecf0f1;
    --text-dim: rgba(255, 255, 255, 0.6);
    --border: rgba(255, 255, 255, 0.1);
    --card: rgba(15, 15, 35, 0.75);
    --radius: 16px;
}

[data-theme="light"] {
    --bg: #f0f4f8;
    --surface: rgba(0, 0, 0, 0.04);
    --text: #1a1a2e;
    --text-dim: rgba(0, 0, 0, 0.55);
    --border: rgba(0, 0, 0, 0.1);
    --card: rgba(255, 255, 255, 0.8);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- Accessibility ---- */
.skip-link {
    position: absolute; top: -60px; left: 8px;
    background: var(--primary); color: #fff;
    padding: 8px 16px; border-radius: 0 0 8px 8px;
    z-index: 9999; text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 0; }
button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---- Loader ---- */
.app-loader {
    position: fixed; inset: 0;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    z-index: 10000; transition: opacity 0.3s;
}
.app-loader.hidden { opacity: 0; pointer-events: none; }
.loader-content { text-align: center; }
.loader-emoji { font-size: 3.5rem; margin-bottom: 1rem; animation: loaderPulse 1.2s ease infinite; }
.loader-spinner {
    width: 44px; height: 44px; margin: 0 auto 0.75rem;
    border: 3px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.7s linear infinite;
}
.loader-text { color: var(--text-dim); font-size: 0.85rem; }

@keyframes loaderPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Theme Toggle ---- */
.theme-toggle {
    position: fixed; top: 1rem; right: 1rem; z-index: 200;
    width: 44px; height: 44px; border-radius: 50%; border: none;
    background: rgba(255,255,255,0.1); backdrop-filter: blur(8px);
    color: var(--text); font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s;
}
.theme-toggle:hover { background: rgba(255,255,255,0.2); transform: scale(1.1); }

/* ---- Language Selector ---- */
.language-selector { position: fixed; top: 1rem; right: 4rem; z-index: 200; }
.lang-btn {
    width: 44px; height: 44px; border-radius: 50%; border: none;
    background: rgba(255,255,255,0.1); backdrop-filter: blur(8px);
    color: var(--text); font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s;
}
.lang-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.1); }
.lang-menu {
    position: absolute; top: 52px; right: 0; min-width: 180px;
    background: var(--card); backdrop-filter: blur(16px);
    border: 1px solid var(--border); border-radius: 12px;
    padding: 0.4rem; z-index: 201;
    max-height: 60vh; overflow-y: auto;
    transition: opacity 0.2s, visibility 0.2s;
}
.lang-menu.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.lang-option {
    display: block; width: 100%; padding: 0.6rem 0.8rem;
    background: transparent; border: none; border-radius: 8px;
    color: var(--text); text-align: left; font-size: 0.9rem;
    cursor: pointer; transition: all 0.2s;
}
.lang-option:hover { background: rgba(52,152,219,0.15); color: var(--primary); }
.lang-option.active { background: rgba(52,152,219,0.2); color: var(--primary); font-weight: 600; }

/* ---- Screens ---- */
main { min-height: 100vh; }
.screen {
    display: none; flex-direction: column; align-items: center;
    padding: 3rem 1.25rem 2rem; min-height: 100vh;
    animation: fadeIn 0.5s ease;
}
.screen.active { display: flex; }

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

/* ---- Intro Screen ---- */
.intro-icon { font-size: 4rem; margin-bottom: 1rem; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

.intro-title {
    font-size: 2.2rem; font-weight: 800; margin-bottom: 0.3rem;
    background: linear-gradient(135deg, var(--primary), #2ecc71);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.intro-subtitle { color: var(--text-dim); font-size: 1.1rem; margin-bottom: 1.2rem; }
.hero-badge {
    display: inline-block; padding: 0.35rem 1rem; border-radius: 20px;
    background: rgba(52,152,219,0.15); border: 1px solid rgba(52,152,219,0.3);
    color: var(--primary); font-size: 0.8rem; font-weight: 600;
    margin-bottom: 1rem;
}
.hero-desc {
    max-width: 520px; color: var(--text-dim); line-height: 1.7;
    font-size: 0.95rem; margin-bottom: 1.5rem; text-align: center;
}
.intro-meta {
    display: flex; gap: 1rem; margin-bottom: 1.5rem;
    font-size: 0.85rem; color: var(--text-dim);
}
.intro-meta span {
    padding: 0.4rem 0.8rem; border-radius: 8px;
    background: var(--surface); border: 1px solid var(--border);
}
.type-preview {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
    justify-content: center; max-width: 480px; margin-bottom: 2rem;
}
.type-chip {
    padding: 0.3rem 0.7rem; border-radius: 16px;
    background: var(--surface); border: 1px solid var(--border);
    font-size: 0.75rem; font-weight: 500; color: var(--text-dim);
}
.btn-start {
    padding: 1rem 2.5rem; border: none; border-radius: 14px;
    background: linear-gradient(135deg, var(--primary), #2ecc71);
    color: #fff; font-size: 1.1rem; font-weight: 700;
    cursor: pointer; transition: all 0.3s;
    box-shadow: 0 4px 20px var(--primary-glow);
}
.btn-start:hover { transform: translateY(-2px); box-shadow: 0 8px 30px var(--primary-glow); }
.btn-pulse { animation: ctaPulse 2.5s ease-in-out infinite; }
@keyframes ctaPulse {
    0%,100% { transform: scale(1); box-shadow: 0 4px 20px var(--primary-glow); }
    50% { transform: scale(1.03); box-shadow: 0 8px 30px rgba(52,152,219,0.5); }
}
@media (prefers-reduced-motion: reduce) { .btn-pulse { animation: none; } .intro-icon { animation: none; } }
.disclaimer { color: var(--text-dim); font-size: 0.75rem; margin-top: 1rem; opacity: 0.7; }

/* ---- Story Screen ---- */
#screen-story { position: relative; padding-top: 1.5rem; justify-content: flex-start; }

.sky-bg {
    position: fixed; inset: 0; z-index: -1;
    transition: background 1.2s ease;
}
.sky-dawn      { background: linear-gradient(180deg, #2d1b4e 0%, #8b3a62 30%, #e8956e 70%, #ffecd2 100%); }
.sky-morning   { background: linear-gradient(180deg, #1e3a5f 0%, #5b8cb5 40%, #a1c4fd 70%, #ffecd2 100%); }
.sky-midmorning{ background: linear-gradient(180deg, #2980b9 0%, #6db3f2 40%, #a1c4fd 80%, #e0f0ff 100%); }
.sky-noon      { background: linear-gradient(180deg, #1565c0 0%, #42a5f5 40%, #90caf9 70%, #fff9c4 100%); }
.sky-afternoon { background: linear-gradient(180deg, #e65100 0%, #ff9800 30%, #ffc107 60%, #fff3e0 100%); }
.sky-evening   { background: linear-gradient(180deg, #4a148c 0%, #7b1fa2 25%, #e91e63 55%, #ff6f00 85%, #ffecd2 100%); }
.sky-night     { background: linear-gradient(180deg, #0d1b2a 0%, #1b2838 30%, #2c3e50 60%, #4a569d 100%); }
.sky-latenight { background: linear-gradient(180deg, #050510 0%, #0a0a1a 30%, #1a1a3e 60%, #2d2d5e 100%); }

[data-theme="light"] .sky-dawn      { background: linear-gradient(180deg, #ffecd2 0%, #fcb69f 50%, #ffeaa7 100%); }
[data-theme="light"] .sky-morning   { background: linear-gradient(180deg, #dfe9f3 0%, #a1c4fd 50%, #ffecd2 100%); }
[data-theme="light"] .sky-midmorning{ background: linear-gradient(180deg, #e0f7fa 0%, #b2ebf2 50%, #e0f0ff 100%); }
[data-theme="light"] .sky-noon      { background: linear-gradient(180deg, #bbdefb 0%, #90caf9 40%, #fff9c4 100%); }
[data-theme="light"] .sky-afternoon { background: linear-gradient(180deg, #fff3e0 0%, #ffe0b2 40%, #ffcc80 100%); }
[data-theme="light"] .sky-evening   { background: linear-gradient(180deg, #f3e5f5 0%, #ce93d8 40%, #ffab91 80%, #ffe0b2 100%); }
[data-theme="light"] .sky-night     { background: linear-gradient(180deg, #e8eaf6 0%, #c5cae9 40%, #9fa8da 80%, #7986cb 100%); }
[data-theme="light"] .sky-latenight { background: linear-gradient(180deg, #e8eaf6 0%, #c5cae9 50%, #9fa8da 100%); }

/* Story Header */
.story-header {
    display: flex; justify-content: space-between; align-items: center;
    width: 100%; max-width: 520px; margin-bottom: 0.75rem;
}
.time-display { display: flex; flex-direction: column; }
.time-clock {
    font-size: 1.8rem; font-weight: 800; color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.4);
    line-height: 1.1;
}
.time-period {
    font-size: 0.85rem; font-weight: 500;
    color: rgba(255,255,255,0.7); text-shadow: 0 1px 6px rgba(0,0,0,0.3);
}
.moment-counter {
    font-size: 0.85rem; font-weight: 600;
    color: rgba(255,255,255,0.7); text-shadow: 0 1px 6px rgba(0,0,0,0.3);
}

/* Timeline */
.timeline { width: 100%; max-width: 520px; margin-bottom: 1.25rem; }
.timeline-bar {
    height: 4px; background: rgba(255,255,255,0.15);
    border-radius: 2px; overflow: hidden; margin-bottom: 0.6rem;
}
.timeline-fill {
    height: 100%; width: 12.5%;
    background: linear-gradient(90deg, var(--primary), #2ecc71);
    border-radius: 2px; transition: width 0.6s ease;
}
.timeline-dots { display: flex; justify-content: space-between; }
.tdot {
    width: 10px; height: 10px; border-radius: 50%;
    background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.3);
    transition: all 0.4s;
}
.tdot.active { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 8px var(--primary-glow); }
.tdot.current { transform: scale(1.3); box-shadow: 0 0 12px var(--primary-glow); }

/* Story Card */
.story-card {
    width: 100%; max-width: 520px;
    background: var(--card); backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius); padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.scene-text {
    font-size: 1rem; line-height: 1.75; color: rgba(255,255,255,0.9);
    margin-bottom: 1rem;
}
.prompt-text {
    font-size: 1.1rem; font-weight: 700; color: #fff;
}
[data-theme="light"] .scene-text { color: var(--text); }
[data-theme="light"] .prompt-text { color: var(--text); }
[data-theme="light"] .time-clock { color: var(--text); text-shadow: 0 1px 4px rgba(0,0,0,0.1); }
[data-theme="light"] .time-period { color: var(--text-dim); text-shadow: none; }
[data-theme="light"] .moment-counter { color: var(--text-dim); text-shadow: none; }

.card-enter {
    animation: cardSlideIn 0.45s ease;
}
@keyframes cardSlideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Choice Buttons */
.choices { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 0.75rem; }
.choice-btn {
    width: 100%; padding: 1rem 1.25rem;
    background: var(--card); backdrop-filter: blur(16px);
    border: 2px solid rgba(255,255,255,0.12);
    border-radius: 12px; color: rgba(255,255,255,0.9);
    font-size: 0.95rem; font-weight: 500; text-align: left;
    cursor: pointer; transition: all 0.3s;
    min-height: 52px; line-height: 1.5;
}
.choice-btn:hover {
    border-color: var(--primary);
    background: rgba(52,152,219,0.15);
    transform: translateX(4px);
}
.choice-btn:active { transform: scale(0.98); }
.choice-btn.pressed {
    border-color: var(--primary);
    background: rgba(52,152,219,0.25);
}
[data-theme="light"] .choice-btn { color: var(--text); }

/* ---- Result Screen ---- */
.result-header {
    font-size: 1.2rem; font-weight: 600; color: var(--text-dim);
    margin-bottom: 1rem; text-align: center;
}
.result-gauge-area { margin-bottom: 0.75rem; text-align: center; }
.result-emoji { font-size: 5rem; animation: resultPop 0.6s ease; }
@keyframes resultPop {
    0% { opacity: 0; transform: scale(0.3) rotate(-15deg); }
    60% { transform: scale(1.15) rotate(5deg); }
    100% { opacity: 1; transform: scale(1) rotate(0); }
}

.result-name {
    font-size: 1.8rem; font-weight: 800; text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary), #2ecc71);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.result-desc {
    max-width: 520px; text-align: center;
    color: var(--text-dim); line-height: 1.7; font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.detail-section {
    width: 100%; max-width: 520px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1.25rem;
    margin-bottom: 1rem;
}
.detail-section h3 {
    font-size: 0.9rem; font-weight: 600; color: var(--primary);
    margin-bottom: 0.75rem;
}
.detail-section ul {
    list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.detail-section ul li {
    padding: 0.35rem 0.75rem; border-radius: 20px;
    background: rgba(52,152,219,0.1); border: 1px solid rgba(52,152,219,0.2);
    font-size: 0.85rem; color: var(--primary); font-weight: 500;
}
.detail-section p {
    color: var(--text-dim); line-height: 1.7; font-size: 0.9rem;
}
.quote-section blockquote {
    font-style: italic; color: var(--text-dim);
    border-left: 3px solid var(--primary); padding-left: 1rem;
    line-height: 1.7; font-size: 0.9rem;
}
.compat-section p {
    font-weight: 600; color: var(--primary); font-size: 1rem;
}

/* Share Buttons */
.share-buttons {
    display: flex; gap: 0.75rem; margin: 1rem 0;
    width: 100%; max-width: 520px;
}
.share-btn {
    flex: 1; padding: 0.75rem 1rem; border-radius: 12px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font-size: 0.9rem; font-weight: 600;
    cursor: pointer; transition: all 0.3s;
}
.share-btn:hover { border-color: var(--primary); color: var(--primary); }

.btn-retake {
    padding: 0.9rem 2rem; border: none; border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #2ecc71);
    color: #fff; font-size: 1rem; font-weight: 700;
    cursor: pointer; transition: all 0.3s;
    margin-bottom: 1.5rem;
}
.btn-retake:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--primary-glow); }

/* Footer */
.game-footer { text-align: center; padding: 1rem 0; }
.back-link {
    display: inline-flex; align-items: center; gap: 0.4rem;
    color: var(--text-dim); text-decoration: none; font-size: 0.85rem;
    transition: color 0.2s;
}
.back-link:hover { color: var(--primary); }

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .intro-title { font-size: 1.8rem; }
    .intro-subtitle { font-size: 1rem; }
    .hero-desc { font-size: 0.88rem; }
    .time-clock { font-size: 1.5rem; }
    .story-card { padding: 1.2rem; }
    .scene-text { font-size: 0.92rem; }
    .prompt-text { font-size: 1rem; }
    .choice-btn { padding: 0.85rem 1rem; font-size: 0.9rem; }
    .result-name { font-size: 1.5rem; }
    .result-emoji { font-size: 4rem; }
    .language-selector { right: 3.5rem; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
::selection { background: var(--primary); color: #fff; }

/* ---- Print ---- */
@media print {
    .theme-toggle, .language-selector, .share-buttons, .btn-retake, .game-footer, .app-loader { display: none; }
    body { background: #fff; color: #000; }
}
