/* Light of the Day: a lamp in a dark room. Uses the site's fonts; the room stays dark in both themes. */
.light-app { --warm: #f5b942; --cream: #f5ead4; --ink: #3a2413; --ink-2: #6b4a1f; --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif; background: #06070b; }
.light-app .site-footer { display: none; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* A little room kept free at the bottom in iPhone browsers, whose toolbars can sit over the page. */
.lamp-page { --kb: 0px; }
.ios-browser .lamp-page { --kb: 16px; }
.lamp-page { position: relative; height: calc(100vh - 57px); height: calc(100dvh - 57px); height: var(--lamp-h, calc(100dvh - 57px)); min-height: 480px; overflow: hidden; background: #06070b; color: var(--cream); }
@media (display-mode: standalone) {
  .light-app .site-header { display: none; }
  .lamp-page { height: 100vh; height: 100dvh; }
}
#lamp-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
#lamp-canvas.hover { cursor: grab; }
#lamp-canvas.drag { cursor: grabbing; }

/* ---- top bar ---- */
.lamp-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)); z-index: 6; }
.lamp-top .spacer { flex: 1; }
.lamp-date { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; letter-spacing: .04em; color: rgba(245, 234, 212, .55); transition: color .6s; }
.lamp-page.lit .lamp-date { color: rgba(58, 36, 19, .75); }
.lbtn { white-space: nowrap; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(245, 185, 66, .28); background: rgba(0, 0, 0, .45); color: var(--cream); font: inherit; font-size: .85rem; cursor: pointer; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background .2s, border-color .2s; }
.lbtn:hover { border-color: var(--warm); background: rgba(0, 0, 0, .6); }
.lbtn:focus-visible, .qbtn:focus-visible, .switch:focus-visible, .sbtn:focus-visible, .topic-opt:focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; }
.lbtn.icon { width: 36px; padding: 0; }
.lbtn svg, .qbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#sound-btn .off, #sound-btn[aria-pressed="false"] .on { display: none; }
#sound-btn[aria-pressed="false"] .off { display: block; }
#favs-btn.has svg { fill: var(--warm); stroke: var(--warm); }

/* ---- quote ---- */
.quote-wrap { position: absolute; left: 50%; top: 47%; bottom: calc(128px + var(--kb)); transform: translateX(-50%); width: min(680px, 90vw); display: flex; flex-direction: column; text-align: center; opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility 0s .6s; z-index: 5; overflow: hidden; pointer-events: none; --qs: 1; overscroll-behavior: contain; }
.quote-wrap > :first-child { margin-top: auto; }
.quote-wrap > :last-child { margin-bottom: auto; }
/* Long quotes scroll inside their area; the fade shows there is more. */
.quote-wrap.scroll { overflow-y: auto; pointer-events: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 28px; -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 40px), transparent 100%); mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 40px), transparent 100%); }
.quote-wrap.scroll.at-end { -webkit-mask-image: none; mask-image: none; }
.quote-wrap.scroll::-webkit-scrollbar { display: none; }
.lamp-page.lit .quote-wrap { bottom: calc(132px + env(safe-area-inset-bottom) + var(--kb)); }
.lamp-page.lit .name-row { display: none; }
.quote-wrap.show { opacity: 1; visibility: visible; transition: opacity .6s ease, visibility 0s; }
/* Collapsed rather than hidden, so it stays the first child that centres the quote. */
.quote-greeting.gone { height: 0; margin-bottom: 0; overflow: hidden; visibility: hidden; }
.quote-greeting { margin: 0 0 14px; font-size: .85rem; letter-spacing: .03em; color: var(--ink-2); }
.quote-ar { margin: 0 0 12px; font-family: "Noto Naskh Arabic", "Geeza Pro", "Traditional Arabic", "Arabic Typesetting", "Segoe UI", serif; font-size: calc(clamp(1.25rem, 3vw, 1.7rem) * var(--qs)); line-height: 1.9; color: var(--ink); }
.quote-ar.sa { font-family: "Noto Serif Devanagari", "Kohinoor Devanagari", "Devanagari Sangam MN", "Nirmala UI", Mangal, serif; line-height: 1.7; }
.quote-text { margin: 0; font-family: var(--serif); font-size: calc(clamp(1.15rem, 2.6vw, 1.7rem) * var(--qs)); line-height: 1.45; font-weight: 500; color: var(--ink); text-shadow: 0 1px 0 rgba(255, 240, 200, .3); }
.quote-text::before { content: "“"; }
.quote-text::after { content: "”"; }
.quote-source { margin: 14px 0 0; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.quote-actions { display: flex; flex-wrap: nowrap; justify-content: center; gap: 8px; }
.quote-actions[hidden] { display: none; }
.qbtn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; white-space: nowrap; border-radius: 999px; border: 1px solid rgba(58, 36, 19, .25); background: rgba(255, 244, 220, .35); color: var(--ink); font: inherit; font-size: .85rem; cursor: pointer; transition: background .2s; }
.qbtn:hover { background: rgba(255, 244, 220, .6); }
#fav-btn[aria-pressed="true"] svg { fill: #b5402a; stroke: #b5402a; }

/* ---- bottom: name + switch ---- */
.lamp-bottom { position: absolute; left: 50%; bottom: calc(max(18px, env(safe-area-inset-bottom)) + var(--kb)); transform: translateX(-50%); width: min(420px, 94vw); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 6; }
.name-row { width: min(320px, 100%); }
.name-row[hidden] { display: none; }
#lamp-name { width: 100%; padding: 10px 18px; background: rgba(0, 0, 0, .55); border: 1px solid rgba(245, 185, 66, .3); border-radius: 999px; color: var(--cream); font: inherit; font-size: 15px; text-align: center; }
#lamp-name::placeholder { color: rgba(245, 234, 212, .45); }
#lamp-name:focus { outline: none; border-color: var(--warm); box-shadow: 0 0 0 3px rgba(245, 185, 66, .18); }
.switch { height: 40px; padding: 0 20px; border-radius: 999px; border: 1px solid rgba(245, 185, 66, .45); background: rgba(245, 185, 66, .14); color: var(--cream); font: inherit; font-size: .9rem; cursor: pointer; transition: background .2s, color .2s; }
.switch:hover { background: rgba(245, 185, 66, .25); }
.lamp-page.lit .switch { background: rgba(20, 12, 6, .55); border-color: rgba(245, 185, 66, .35); color: var(--cream); }
.lamp-page.lit #lamp-name { background: rgba(255, 244, 220, .35); color: var(--ink); border-color: rgba(58, 36, 19, .25); }
.lamp-page.lit #lamp-name::placeholder { color: rgba(58, 36, 19, .5); }
.lamp-hint { margin: 0; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: rgba(245, 234, 212, .45); transition: opacity .5s; }
.lamp-page.lit .lamp-hint { display: none; }
@media (max-height: 640px) { .quote-wrap { top: 40%; bottom: calc(112px + var(--kb)); } .name-row { display: none; } }

/* ---- sheets ---- */
.sheet { width: min(460px, calc(100vw - 24px)); max-height: min(86vh, 720px); padding: 0; border: 1px solid rgba(245, 185, 66, .25); border-radius: 16px; background: #15110d; color: var(--cream); box-shadow: 0 20px 60px rgba(0, 0, 0, .6); }
.sheet::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); }
.sheet-in { padding: 18px 20px 22px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.sheet h2 { margin: 0; font-size: 1.15rem; color: var(--cream); }
.sheet h3 { margin: 22px 0 4px; font-size: .95rem; color: var(--warm); }
.sheet-sub, .sheet .note { margin: 4px 0 12px; font-size: .85rem; color: rgba(245, 234, 212, .65); line-height: 1.5; }
.sheet .note:empty { display: none; }
.sheet .close { font-size: .9rem; }
.topic-list { display: grid; gap: 8px; }
.topic-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(245, 234, 212, .12); background: rgba(255, 255, 255, .03); color: var(--cream); font: inherit; text-align: left; cursor: pointer; }
.topic-opt:hover { border-color: rgba(245, 185, 66, .4); }
.topic-opt[aria-checked="true"] { border-color: var(--warm); background: rgba(245, 185, 66, .12); }
.topic-opt small { color: rgba(245, 234, 212, .55); }
.fav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.fav-list li { padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(245, 234, 212, .12); background: rgba(255, 255, 255, .03); }
.fav-list q { display: block; font-family: var(--serif); font-size: 1rem; line-height: 1.45; }
.fav-list .src { display: block; margin-top: 6px; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: rgba(245, 234, 212, .55); }
.fav-list .row { margin-top: 8px; }
.share-preview { display: block; width: 100%; max-width: 300px; aspect-ratio: 4 / 5; margin: 6px auto 14px; border-radius: 10px; background: #2a1a0e; object-fit: cover; }
.sheet-actions, .sheet .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sbtn { height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid rgba(245, 234, 212, .2); background: rgba(255, 255, 255, .06); color: var(--cream); font: inherit; font-size: .88rem; cursor: pointer; }
.sbtn:hover { border-color: rgba(245, 185, 66, .5); }
.sbtn.primary { background: var(--warm); border-color: var(--warm); color: #241608; font-weight: 600; }
.sbtn[hidden] { display: none; }
.sbtn.small { height: 30px; font-size: .8rem; padding: 0 10px; }
.field label { display: block; font-size: .85rem; margin: 12px 0 6px; }
.sheet input[type="text"], .sheet input[type="time"] { width: 100%; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(245, 234, 212, .2); background: rgba(0, 0, 0, .35); color: var(--cream); font: inherit; color-scheme: dark; }
.sheet input[type="time"] { width: auto; }
.sheet input:focus { outline: none; border-color: var(--warm); }
.check { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--warm); }

.ltoast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); padding: 10px 16px; border-radius: 999px; background: #241a10; color: var(--cream); border: 1px solid rgba(245, 185, 66, .3); font-size: .88rem; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 1000; max-width: calc(100vw - 32px); text-align: center; }
.ltoast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) { .quote-wrap, .ltoast { transition: none; } }

@media (max-width: 360px) { .qbtn { padding: 0 10px; font-size: .8rem; } .qbtn svg { width: 16px; height: 16px; } }
