/* Once Upon a Line: a candlelit library at night. Ink-blue walls, parchment pages, gold leaf. */
:root {
  --bg: #0f1630; --bg2: #16204a; --card: rgba(26, 36, 80, 0.9); --card2: #263372; --line: #3f4d9a;
  --text: #f7efd9; --muted: #b8b6d4; --accent: #f2c46d; --yellow: #f2c46d; --red: #ff7a7a; --green: #9be3a5;
  --grad: linear-gradient(135deg, #f7dc9a, #e0a83f);
  --font-head: 'IM Fell English SC', Georgia, serif; --font-body: 'Lora', Georgia, serif; --head-weight: 400;
  --radius: 14px;
}
body { background: radial-gradient(700px 500px at 50% 100%, #f2c46d22, transparent 70%), radial-gradient(900px 700px at 50% 0%, #2a3a8a, transparent 70%), #0f1630 fixed; }
.btn { color: #3a2408; font-weight: 700; box-shadow: 0 5px 0 #8a5e1a, 0 10px 26px rgba(242, 196, 109, 0.25); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #8a5e1a; }
.btn.ghost { box-shadow: 0 4px 0 #080c1c; }
.hero { color: #f2c46d; text-shadow: 0 0 30px rgba(242, 196, 109, 0.5); }
.big-code { background: none; color: #f2c46d; -webkit-text-fill-color: #f2c46d; }
.pop { animation: unfurl 0.8s cubic-bezier(.3, 1.3, .5, 1) both; }
@keyframes unfurl { 0% { transform: scaleY(0.1) translateY(-30px); opacity: 0; } 100% { transform: none; opacity: 1; } }

.os-tv { display: flex; flex-direction: column; gap: 1em; flex: 1; }
.os-book { background: linear-gradient(180deg, #f8edd2, #efdfb8); color: #3b2a14; border-radius: 10px 10px 18px 18px; padding: 1.2em 1.8em; box-shadow: 0 0 0 6px #6b3f1c, 0 0 0 9px #f2c46d66, 0 30px 60px rgba(0, 0, 0, 0.5); max-height: 52vh; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.os-book::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 20% 10%, transparent 60%, #c9a86a33); pointer-events: none; }
.os-book.small { max-height: 32vh; font-size: 0.8em; }
.os-genre { font-family: var(--font-head); font-size: 1.4em; color: #8a5e1a; text-align: center; margin-bottom: 0.4em; }
.os-story { font-family: var(--font-body); font-size: 1.75em; line-height: 1.55; }
.os-drop { float: left; font-family: var(--font-head); font-size: 3.2em; line-height: 0.85; margin: 0.05em 0.1em 0 0; color: #8a2d1a; }
.os-line.new { background: linear-gradient(transparent 60%, #f2c46d88 60%); animation: ink 1.6s ease both; }
@keyframes ink { from { opacity: 0; filter: blur(4px); } to { opacity: 1; filter: none; } }
.os-by { display: inline-flex; width: 1.2em; height: 1.2em; border-radius: 50%; color: #fff; font-size: 0.5em; align-items: center; justify-content: center; margin-left: 0.15em; font-family: var(--font-body); vertical-align: super; }
.os-cursor { color: #8a2d1a; animation: blinkc 1s steps(2) infinite; }
@keyframes blinkc { 50% { opacity: 0; } }
.os-end { font-family: var(--font-head); color: #8a2d1a; }
.os-opts { display: flex; flex-direction: column; gap: 0.6em; font-size: 1.45em; }
.os-opts.small { font-size: 1.15em; }
.os-opt { background: var(--card); border: 2px solid var(--line); border-radius: 14px; padding: 0.5em 0.9em; display: flex; justify-content: space-between; gap: 1em; align-items: center; font-style: italic; }
.os-opt b { font-family: var(--font-head); color: var(--accent); font-style: normal; margin-right: 0.4em; }
.os-opt.win { border-color: #f2c46d; box-shadow: 0 0 30px #f2c46d55; background: #2f3a7a; }
.os-meta { display: flex; gap: 0.3em; align-items: center; font-style: normal; font-size: 0.8em; flex-shrink: 0; }
.os-prev { background: #f3e6c4; color: #3b2a14; border-radius: 10px; padding: 10px 14px; font-style: italic; }
.os-word { background: var(--card2); border: 2px dashed var(--accent); border-radius: 12px; padding: 10px 14px; text-align: center; }
.os-word small { color: var(--muted); }
textarea.text-in { font-family: var(--font-body); resize: none; }

/* Background: drifting letters and candle flicker. */
.scene .letter { position: absolute; font-family: 'IM Fell English SC', serif; color: #f2c46d; opacity: 0.18; animation: floatl linear infinite; }
@keyframes floatl { from { transform: translateY(10vh) rotate(-10deg); opacity: 0; } 15% { opacity: 0.2; } 85% { opacity: 0.2; } to { transform: translateY(-90vh) rotate(20deg); opacity: 0; } }
.scene .candle { position: absolute; bottom: 0; left: 50%; width: 70vw; height: 40vh; margin-left: -35vw; background: radial-gradient(ellipse at 50% 100%, #f2c46d33, transparent 65%); animation: flicker 3s ease-in-out infinite; }
@keyframes flicker { 0%, 100% { opacity: 0.8; } 30% { opacity: 1; } 50% { opacity: 0.7; } 70% { opacity: 0.95; } }
.scene.small .letter { opacity: 0.1; }
@media (prefers-reduced-motion: reduce) { .scene * { animation: none !important; } }
.os-book.final { max-height: 62vh; justify-content: flex-start; } .os-book.long .os-story { font-size: 1.35em; }
