* {
    box-sizing: border-box;
}

:root {
    --bg-primary: #f7f0e3;
    --bg-secondary: #f0e8d8;
    --bg-tertiary: #e8dece;
    --bg-deep: #dfd4c2;
    --border-color: #d0c4a8;
    --border-hover: #b8a880;
    --text-primary: #000000;
    --text-secondary: #000000;
    --text-muted: #7a6b50;
    --accent: #6b3a12;
    --accent-light: #8a5020;
    --accent-glow: #c88b40;
    --heart-color: #b5443e;
    --treasure-color: #7a6320;
    --explore-color: #5a6e3a;
    --frontier-color: #7a6320;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width-left: 280px;
    --sidebar-width-right: 320px;
}

body {
    font-family: 'Crimson Text', 'Georgia', 'Times New Roman', serif;
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 18px;
    line-height: 1.6;
}

/* Header */
.header {
    padding: 16px 28px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
}

.logo {
    font-family: 'Press Start 2P', 'Cinzel', 'Georgia', serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--accent);
    line-height: 1.35;
}

.logo span {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 14px;
    margin-left: 10px;
    font-family: 'Crimson Text', serif;
    font-style: italic;
    letter-spacing: 0.02em;
}

.header-stats {
    display: flex;
    gap: 24px;
    align-items: center;
}

.stat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: 'Cinzel', serif;
    font-weight: 600;
}

.stat-value {
    color: var(--accent);
    font-size: 16px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Main Layout */
.main-container {
    display: grid;
    grid-template-columns: var(--sidebar-width-left) 1fr var(--sidebar-width-right);
    flex: 1;
    overflow: hidden;
    transition: grid-template-columns 0.3s ease;
}

.main-container.left-collapsed {
    grid-template-columns: 0px 1fr var(--sidebar-width-right);
}

.main-container.right-collapsed {
    grid-template-columns: var(--sidebar-width-left) 1fr 0px;
}

.main-container.left-collapsed.right-collapsed {
    grid-template-columns: 0px 1fr 0px;
}

/* Sidebar Header (title + collapse button row) */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.sidebar-header .sidebar-title {
    margin-bottom: 0;
}

.sidebar-collapse {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 8px;
    font-family: 'Cinzel', serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    transition: var(--transition);
    line-height: 1;
}

.sidebar-collapse:hover {
    background: var(--bg-deep);
    color: #000;
    border-color: var(--border-hover);
}

/* Header reopen buttons (shown when sidebar is collapsed) */
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-reopen {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 10px;
    font-family: 'Cinzel', serif;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    transition: var(--transition);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.sidebar-reopen:hover {
    background: var(--bg-deep);
    color: #000;
    border-color: var(--border-hover);
}

/* Left Sidebar - Journey Log */
.sidebar-left {
    background: var(--bg-secondary);
    border-right: 2px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: padding 0.3s ease, opacity 0.3s ease;
    min-width: 0;
}

.main-container.left-collapsed .sidebar-left {
    padding: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.sidebar-title {
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.archive-canvas {
    width: 100%;
    height: 160px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.archive-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

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

.archive-stat-label {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.archive-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
    margin-top: 2px;
}

.trajectory-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.trajectory-item {
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.trajectory-item:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
    background: var(--bg-deep);
}

.trajectory-item.active {
    border-color: var(--accent);
    color: var(--text-primary);
    background: var(--bg-deep);
}

.trajectory-item.hearted {
    border-left: 3px solid var(--heart-color);
}

.trajectory-depth {
    color: var(--text-muted);
    font-size: 11px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'Cinzel', serif;
    font-weight: 600;
}

.novelty-badge {
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 10px;
    background: var(--bg-secondary);
    font-family: 'Cinzel', serif;
    font-weight: 600;
}

.novelty-badge.high-novelty {
    background: rgba(122, 99, 32, 0.2);
    color: var(--treasure-color);
}

.novelty-badge.low-novelty {
    background: rgba(138, 122, 90, 0.2);
    color: var(--text-muted);
}

/* Center Content */
.content-center {
    padding: 36px 48px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: auto;
}

.content-wrapper {
    max-width: 700px;
    width: 100%;
}

/* Current Question/Answer Display */
.current-context {
    margin-bottom: 32px;
}

.context-question {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-style: italic;
    font-weight: 600;
}

.context-answer {
    font-size: 19px;
    line-height: 1.8;
    color: var(--text-primary);
    padding: 28px 32px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    position: relative;
    font-weight: 400;
}

.heart-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--text-muted);
    transition: var(--transition);
    font-size: 22px;
}

.heart-btn:hover {
    color: var(--heart-color);
    transform: scale(1.15);
}

.heart-btn.active {
    color: var(--heart-color);
}

.heart-icon {
    display: block;
}

/* Question Options */
.question-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.question-option {
    padding: 18px 22px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-size: 17px;
    font-family: 'Crimson Text', serif;
    font-weight: 600;
    color: var(--text-secondary);
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.question-option:hover {
    border-color: var(--accent);
    background: var(--bg-deep);
    color: var(--text-primary);
    transform: translateX(4px);
}

.question-option::before {
    content: attr(data-index);
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Cinzel', serif;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.question-option:hover::before {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-secondary);
}

.question-text {
    flex: 1;
    padding-right: 12px;
}

/* Custom Question Input */
.custom-question {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.custom-input {
    flex: 1;
    padding: 16px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 17px;
    font-family: 'Crimson Text', serif;
    font-weight: 600;
    outline: none;
    transition: var(--transition);
}

.custom-input:focus {
    border-color: var(--accent);
}

.custom-input::placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

.submit-btn {
    padding: 16px 28px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: var(--bg-primary);
    font-size: 16px;
    font-family: 'Cinzel', serif;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: var(--transition);
}

.submit-btn:hover {
    background: var(--accent-light);
    transform: scale(1.02);
}

/* Start Screen */
.start-screen {
    text-align: center;
    padding: 48px 20px;
}

.start-emblem {
    font-size: 42px;
    color: var(--accent-glow);
    margin-bottom: 8px;
}

.start-title {
    font-family: 'Cinzel', serif;
    font-size: 44px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: 0.06em;
    color: var(--accent);
}

.start-subtitle {
    font-size: 19px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
    font-style: italic;
}

.seed-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 32px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 6px;
}

.seed-option {
    appearance: none;
    width: 100%;
    text-align: left;
    padding: 16px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    line-height: 1.5;
}

.seed-option:hover {
    border-color: var(--accent);
    color: var(--text-primary);
    transform: translateY(-3px);
    background: var(--bg-deep);
}


/* Right Sidebar */
.sidebar-right {
    background: var(--bg-secondary);
    border-left: 2px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: padding 0.3s ease, opacity 0.3s ease;
    min-width: 0;
}

.main-container.right-collapsed .sidebar-right {
    padding: 0;
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.network-canvas {
    width: 100%;
    height: 180px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
}

.network-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

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

.network-stat-label {
    display: block;
    font-family: 'Cinzel', serif;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.network-stat-value {
    display: block;
    font-size: 17px;
    font-weight: 700;
    color: var(--accent);
    margin-top: 2px;
}

.genome-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.genome-dimension {
    margin-bottom: 8px;
}

.genome-dimension-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 5px;
    font-weight: 600;
}

.genome-dimension-bar {
    height: 5px;
    background: var(--bg-deep);
    border-radius: 3px;
    overflow: hidden;
}

.genome-dimension-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.genome-dimension-fill.exploration {
    background: var(--explore-color);
}

/* Settings Panel */
.settings-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
}

.setting-label {
    color: var(--text-muted);
}

.setting-value {
    color: var(--text-primary);
    width: 28px;
    text-align: right;
    font-weight: 700;
}

input[type="range"] {
    width: 80px;
    height: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-deep);
    border-radius: 2px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bg-secondary);
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 36px;
    color: var(--text-muted);
    font-style: italic;
    font-size: 17px;
}

.loading-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 14px;
}

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

.loading-questions {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 16px;
    font-style: italic;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.action-btn {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.03em;
}

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

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

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

/* Connection Status */
.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--heart-color);
}

.status-dot.connected {
    background: var(--explore-color);
}

/* Keyboard hints */
.keyboard-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 18px;
    text-align: center;
}

kbd {
    background: var(--bg-tertiary);
    padding: 3px 7px;
    border-radius: 3px;
    font-family: 'Cinzel', serif;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 240px 1fr 280px;
    }
    .main-container.left-collapsed {
        grid-template-columns: 0px 1fr 280px;
    }
    .main-container.right-collapsed {
        grid-template-columns: 240px 1fr 0px;
    }
    .main-container.left-collapsed.right-collapsed {
        grid-template-columns: 0px 1fr 0px;
    }
}

@media (max-width: 900px) {
    .main-container {
        grid-template-columns: 1fr;
    }

    .sidebar-left,
    .sidebar-right {
        display: none;
    }

    .sidebar-reopen {
        display: none !important;
    }

    .seed-options {
        grid-template-columns: 1fr;
        max-height: none;
    }

    .content-center {
        padding: 24px 20px;
    }
}

/* =========================================================
   Restored Archive-First Experience
========================================================= */

:root {
    --header-height: 74px;
    --font-display: 'Fraunces', 'Iowan Old Style', 'Times New Roman', serif;
    --font-body: 'Nunito Sans', 'Avenir Next', 'Segoe UI', sans-serif;
    --bg-primary: #f5f2eb;
    --bg-secondary: #fcfaf5;
    --bg-tertiary: #f1ebdf;
    --bg-deep: #e7dcc7;
    --border-color: #dacdb8;
    --border-hover: #bfa584;
    --text-primary: #251c16;
    --text-secondary: #3a2b21;
    --text-muted: #7b6651;
    --accent: #8f4028;
    --accent-light: #a75536;
    --accent-glow: #de8a52;
    --heart-color: #bb4e45;
    --explore-color: #3f7f66;
}

html,
body {
    height: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    line-height: 1.5;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 14% 18%, rgba(222, 138, 82, 0.09) 0 18%, transparent 45%),
        radial-gradient(circle at 84% 14%, rgba(143, 64, 40, 0.08) 0 16%, transparent 42%);
    z-index: -1;
}

.header {
    height: var(--header-height);
    padding: 10px 28px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(252, 250, 245, 0.95);
}

.logo {
    font-family: var(--font-display);
    font-size: clamp(18px, 2vw, 24px);
    font-variation-settings: 'SOFT' 38;
    letter-spacing: 0.01em;
}

.logo span {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
}

.header-stats {
    gap: 18px;
}

.stat-label {
    font-size: 11px;
    font-family: var(--font-body);
    letter-spacing: 0.08em;
}

.stat-value {
    font-size: 15px;
    font-family: var(--font-body);
}

.connection-status {
    font-size: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
}

.main-container {
    display: flex;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

.sidebar-left,
.sidebar-right,
.sidebar-reopen,
.sidebar-collapse {
    display: none !important;
}

.content-center {
    width: 100%;
    height: 100%;
    justify-content: center;
    padding: 16px 24px 18px;
    align-items: center;
    overflow: visible;
}

.content-wrapper {
    max-width: 1040px;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: visible;
}

.content-wrapper.exploring {
    justify-content: flex-start;
}

.start-screen {
    display: flex;
    flex-direction: column;
    max-height: 100%;
    min-height: 0;
    text-align: left;
    padding: 20px 22px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    box-shadow: 0 14px 40px rgba(76, 50, 26, 0.06);
    overflow: visible;
}

.start-title {
    font-family: var(--font-display);
    font-variation-settings: 'SOFT' 52;
    position: relative;
    display: inline-block;
    margin: 0 0 8px;
    padding: 0.08em 0.1em 0.12em;
    margin-inline: -0.1em;
    font-size: clamp(1.9rem, 3.6vw, 2.5rem);
    line-height: 1.16;
    letter-spacing: 0.015em;
    color: var(--accent);
    overflow: visible;
}

.start-title.magic-intro {
    color: transparent;
    background-image: linear-gradient(
        110deg,
        #8f4028 8%,
        #e4a06e 27%,
        #f6dfb9 42%,
        #a65fbe 58%,
        #7e86d8 74%,
        #8f4028 92%
    );
    background-size: 250% 100%;
    background-position: 0% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    animation:
        title-iridescence 1150ms cubic-bezier(0.23, 1, 0.32, 1) forwards,
        title-glow-pulse 1500ms ease-out;
}

.start-title.magic-intro::before,
.start-title.magic-intro::after {
    content: '✦';
    position: absolute;
    display: block;
    line-height: 1;
    font-size: 0.68em;
    color: rgba(224, 155, 107, 0.9);
    opacity: 0;
    pointer-events: none;
    filter: drop-shadow(0 0 8px rgba(224, 155, 107, 0.55));
}

.start-title.magic-intro::before {
    top: 0;
    left: 0;
    --sparkle-shift-x: -0.62em;
    --sparkle-shift-y: -0.42em;
    animation: sparkle-twinkle 820ms ease-out 210ms;
}

.start-title.magic-intro::after {
    right: 0.08em;
    bottom: 0;
    --sparkle-shift-x: 0.18em;
    --sparkle-shift-y: 0.08em;
    animation: sparkle-twinkle 900ms ease-out 480ms;
}

.start-subtitle {
    margin: 0 0 14px;
    max-width: 900px;
    color: var(--text-muted);
    font-style: normal;
    font-size: 1.02rem;
}

.seed-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    max-height: none;
    overflow: visible;
    padding-right: 6px;
    margin-bottom: 18px;
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
    transition:
        opacity 380ms ease,
        transform 380ms cubic-bezier(0.23, 1, 0.32, 1),
        filter 380ms ease;
}

.seed-options.is-staged {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(2px);
    pointer-events: none;
}

.seed-options.is-visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.seed-option {
    font-family: var(--font-body);
    min-height: 96px;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    font-size: 1.06rem;
    line-height: 1.42;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-transform: none;
}

.seed-option:hover {
    border-color: var(--accent);
    background: #fffefb;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(76, 50, 26, 0.08);
}

.seed-option:focus-visible {
    outline: 2px solid rgba(143, 64, 40, 0.35);
    outline-offset: 2px;
}

.custom-question {
    margin-top: 4px;
    gap: 10px;
}

.custom-input {
    font-family: var(--font-body);
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: #fffefb;
    font-size: 1rem;
}

.custom-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(143, 64, 40, 0.12);
}

.submit-btn {
    font-family: var(--font-body);
    font-weight: 800;
    min-width: 132px;
    padding: 13px 22px;
    border-radius: 12px;
    background: var(--accent);
    color: #fff9f0;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.submit-btn:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
}

#exploration-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: visible;
    padding-right: 4px;
    animation: reveal-view 0.35s ease;
}

@keyframes reveal-view {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.current-context {
    margin-bottom: 22px;
    overflow: visible;
}

.context-question {
    font-family: var(--font-display);
    font-variation-settings: 'SOFT' 54;
    position: relative;
    display: inline-block;
    margin-bottom: 10px;
    padding: 0.08em 0.1em 0.12em;
    margin-left: -0.1em;
    margin-right: -0.1em;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.14;
    font-style: normal;
    font-weight: 600;
    color: var(--accent);
    text-transform: none;
    overflow: visible;
    white-space: nowrap;
}

.context-question.magic-intro {
    color: transparent;
    background-image: linear-gradient(
        108deg,
        #8f4028 10%,
        #e4a06e 33%,
        #f4e2c4 47%,
        #a65fbe 63%,
        #7e86d8 78%,
        #8f4028 94%
    );
    background-size: 220% 100%;
    background-position: 0% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    animation:
        title-iridescence 1750ms linear infinite alternate,
        title-glow-pulse 1600ms ease-in-out infinite;
}

.context-question.magic-intro::before,
.context-question.magic-intro::after {
    content: '✦';
    position: absolute;
    display: block;
    line-height: 1;
    font-size: 0.58em;
    color: rgba(224, 155, 107, 0.82);
    opacity: 0;
    pointer-events: none;
    filter: drop-shadow(0 0 7px rgba(224, 155, 107, 0.45));
}

.context-question.magic-intro::before {
    top: 0;
    left: 0;
    --sparkle-shift-x: -0.58em;
    --sparkle-shift-y: -0.36em;
    animation: sparkle-twinkle 760ms ease-in-out 140ms infinite;
}

.context-question.magic-intro::after {
    right: 0;
    bottom: 0;
    --sparkle-shift-x: 0.56em;
    --sparkle-shift-y: 0.1em;
    animation: sparkle-twinkle 800ms ease-in-out 320ms infinite;
}

.context-answer {
    font-family: var(--font-body);
    padding: 22px 86px 22px 26px;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    box-shadow: 0 14px 32px rgba(76, 50, 26, 0.06);
    font-size: clamp(1.12rem, 1.45vw, 1.34rem);
    line-height: 1.62;
    max-height: 34vh;
    overflow: auto;
}

.context-answer.answer-enter {
    animation: answer-card-enter 620ms cubic-bezier(0.2, 0.7, 0.15, 1);
}

.context-answer.answer-hidden {
    display: none;
}

.context-answer.answer-loading #answer-text {
    opacity: 0;
    transform: translateY(6px);
}

#answer-text {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

#answer-text.answer-reveal {
    animation: answer-fade-in 620ms ease-out;
}

.heart-btn {
    top: 14px;
    right: 16px;
    width: auto;
    height: auto;
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(143, 64, 40, 0.48);
    line-height: 1;
}

.heart-btn:hover {
    color: rgba(187, 78, 69, 0.8);
    transform: translateY(-1px) scale(1.04);
}

.heart-btn.active {
    color: var(--heart-color);
}

.heart-icon {
    display: block;
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.question-chamber {
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 18px 18px 18px;
    box-shadow: 0 14px 32px rgba(76, 50, 26, 0.06);
    height: auto;
    min-height: 0;
    transition: opacity 260ms ease, transform 260ms ease;
}

.question-chamber.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.question-chamber.is-loading .question-options {
    pointer-events: none;
}

.question-chamber-header {
    margin-bottom: 10px;
}

.question-chamber-title {
    margin: 0;
    font-family: var(--font-display);
    font-variation-settings: 'SOFT' 50;
    color: var(--accent);
    font-size: clamp(1.28rem, 2.2vw, 1.78rem);
    line-height: 1.03;
    letter-spacing: 0.015em;
    text-transform: none;
}

.question-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 0;
    min-height: 0;
    overflow: visible;
    align-content: start;
    padding-right: 0;
}

.question-option {
    font-family: var(--font-body);
    min-height: 98px;
    padding: 18px 20px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    font-size: 1.12rem;
    line-height: 1.4;
    font-weight: 700;
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
    text-align: center;
    text-transform: none;
}

.question-option:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    background: #fffefb;
}

@keyframes card-reveal {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.985);
        filter: blur(2px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.reveal-card {
    opacity: 0;
    animation: card-reveal 460ms cubic-bezier(0.23, 1, 0.32, 1) forwards;
    animation-delay: var(--reveal-delay, 0ms);
}

@keyframes title-iridescence {
    0% {
        background-position: 0% 50%;
        filter: saturate(0.85);
    }
    100% {
        background-position: 100% 50%;
        filter: saturate(1.08);
    }
}

@keyframes title-glow-pulse {
    0% {
        text-shadow: 0 0 0 rgba(228, 160, 110, 0);
    }
    45% {
        text-shadow: 0 0 16px rgba(228, 160, 110, 0.4);
    }
    100% {
        text-shadow: 0 0 0 rgba(228, 160, 110, 0);
    }
}

@keyframes sparkle-twinkle {
    0% {
        opacity: 0;
        transform: translate(var(--sparkle-shift-x, 0), var(--sparkle-shift-y, 0)) scale(0.5) rotate(0deg);
    }
    35% {
        opacity: 1;
        transform: translate(var(--sparkle-shift-x, 0), var(--sparkle-shift-y, 0)) scale(1) rotate(22deg);
    }
    100% {
        opacity: 0;
        transform: translate(var(--sparkle-shift-x, 0), var(--sparkle-shift-y, 0)) scale(0.7) rotate(38deg);
    }
}

@keyframes answer-fade-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes answer-card-enter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.question-option::before {
    content: none !important;
    display: none !important;
}

.question-text {
    display: block;
    width: 100%;
    text-align: center;
    padding-right: 0;
}

#exploration-view .custom-question {
    margin-top: 6px;
    flex-shrink: 0;
    transition: opacity 220ms ease;
}

#exploration-view .custom-question.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-questions {
    grid-column: 1 / -1;
    padding: 16px 10px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 1rem;
}

.keyboard-hint {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

kbd {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

@media (max-width: 980px) {
    body {
        overflow: auto;
    }

    .header {
        height: auto;
        min-height: var(--header-height);
        padding: 12px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

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

    .content-center {
        height: auto;
        padding: 16px 12px 24px;
        overflow: visible;
    }

    .content-wrapper {
        height: auto;
    }

    .start-screen {
        padding: 18px;
        border-radius: 16px;
        max-height: none;
    }

    .seed-options,
    .question-options {
        grid-template-columns: 1fr;
    }

    .seed-options {
        max-height: min(58vh, 520px);
    }

    .question-chamber {
        padding: 18px;
        border-radius: 16px;
    }

    .context-answer {
        max-height: none;
        padding: 22px 58px 22px 20px;
        font-size: 1.16rem;
    }

    .custom-question {
        flex-direction: column;
    }

    .submit-btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reveal-card,
    .start-title.magic-intro,
    .context-question.magic-intro,
    .start-title.magic-intro::before,
    .start-title.magic-intro::after,
    .context-question.magic-intro::before,
    .context-question.magic-intro::after,
    #answer-text.answer-reveal {
        animation: none !important;
    }

    .seed-options {
        transition: none !important;
    }
}
