:root {
  --bg: #000;
  --card: #1c1c1e;
  --card-2: #2c2c2e;
  --line: #38383a;
  --text: #f2f2f7;
  --title: #e8dfc4;
  --muted: #8e8e93;
  --gold: #d8c99b;
  --red: #e5484d;
  --serif: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.4 var(--sans); padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.top { position: sticky; top: 0; z-index: 5; padding: calc(6px + env(safe-area-inset-top)) 12px 0; background: rgba(0,0,0,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.mast-row { display: grid; grid-template-columns: 36px 1fr 36px; align-items: center; max-width: 680px; margin: 0 auto; }
.masthead { margin: 0; text-align: center; font: 800 clamp(26px, calc((100vw - 104px) / 9), 56px)/1.1 "Playfair Display", "Bodoni 72", Didot, Georgia, serif; color: #f4ecd6; letter-spacing: -.005em; white-space: nowrap; text-shadow: 0 1px 0 rgba(0,0,0,.6); transition: font-size .25s ease; }
.masthead a { color: inherit; }
.dateline { max-width: 680px; margin: 6px auto 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 5px 2px 6px; border-top: 3px double var(--gold); border-bottom: 1px solid rgba(216,201,155,.55); color: var(--gold); font: italic 400 11.5px/1.2 var(--serif); letter-spacing: .01em; white-space: nowrap; overflow: hidden; transition: opacity .2s ease, max-height .25s ease, padding .25s ease, margin .25s ease; max-height: 40px; }
.dateline .dl-mid { font-style: normal; font-weight: 700; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #f4ecd6; }
.dateline .orn { color: var(--gold); font-size: 12px; letter-spacing: 0; }
.top.compact .masthead { font-size: 28px; }
.top.compact .dateline { max-height: 0; padding-top: 0; padding-bottom: 0; margin-top: 4px; opacity: 0; border-top-width: 0; }
.top.compact { box-shadow: 0 1px 0 rgba(216,201,155,.35); padding-bottom: 4px; }
@media (max-width: 340px) { #dl-no { display: none; } }
.icon-btn { width: 36px; height: 44px; display: grid; place-items: center; color: var(--gold); }
.icon-btn svg { width: 26px; height: 26px; }
.icon-btn .red { stroke: var(--red); }

.search-wrap { max-width: 680px; margin: 0 auto; padding: 12px 16px 12px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 12px; padding: 0 12px; height: 44px; color: var(--muted); }
.search svg { width: 20px; height: 20px; flex: none; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--text); font-size: 17px; }
.search input::placeholder { color: var(--muted); }

.feed { max-width: 680px; margin: 0 auto; padding: 0 16px; display: grid; gap: 22px; }
.card { background: var(--card); border-radius: 14px; overflow: hidden; position: relative; }
.card .img { display: block; aspect-ratio: 16 / 10; background: var(--card-2); overflow: hidden; }
.card .img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .band { display: flex; align-items: flex-end; aspect-ratio: 16 / 7; padding: 18px 20px; color: rgba(255,255,255,.92); font: 700 26px/1.15 var(--serif); }
.card .body { padding: 14px 20px 16px; }
.card .meta { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.card h2 { margin: 0; color: var(--title); font: 600 21px/1.28 var(--sans); }
.card .excerpt { margin: 8px 0 0; color: #c7c7cc; font-size: 15px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card .foot { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; margin-top: 10px; }
.card.headline .body { padding-top: 16px; }
.bm { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 8px; background: rgba(28,28,30,.82); display: grid; place-items: center; color: var(--text); }
.bm svg { width: 18px; height: 18px; }
.bm.on svg { fill: var(--gold); stroke: var(--gold); }
.card.headline .bm, .card.textonly .bm { background: var(--card-2); }

.related { border-top: 1px solid var(--line); margin: 0; }
.related summary { list-style: none; cursor: pointer; padding: 11px 20px; color: var(--gold); font-size: 14px; }
.related summary::-webkit-details-marker { display: none; }
.related summary::after { content: " ›"; }
.related[open] summary::after { content: " ⌄"; }
.related ul { list-style: none; margin: 0; padding: 0 20px 12px; }
.related li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 15px; }
.related li span { color: var(--muted); }

.snippet { margin: 8px 0 0; color: #c7c7cc; font-size: 15px; }
.snippet mark { background: none; color: var(--gold); font-weight: 600; }

.ad { background: var(--card); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.ad .label { color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding: 12px 20px 0; }
.ad .house { display: block; padding: 10px 20px 18px; }
.ad .house h2 { margin: 4px 0 6px; color: var(--title); font: 700 20px/1.3 var(--serif); }
.ad .house p { margin: 0; color: #c7c7cc; font-size: 15px; }
.ad ins { display: block; min-height: 120px; }

.empty, .status { text-align: center; color: var(--muted); padding: 36px 16px; }
.sentinel { height: 1px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); background: rgba(22,22,24,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid #222; }
.tab { display: grid; justify-items: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.tab svg { width: 28px; height: 28px; }
.tab.active { color: var(--title); }
.tab[data-view="bookmarks"].active svg, .tab[data-view="following"].active svg { fill: var(--title); }
.tab { position: relative; }
.badge { position: absolute; top: -2px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

.follow-btn { flex: none; height: 30px; padding: 0 12px; border-radius: 15px; background: var(--card-2); color: var(--gold); font-size: 14px; font-weight: 600; }
.follow-btn.on { background: var(--gold); color: #1c1c1e; }
.following-head { max-width: 680px; margin: 0 auto; padding: 12px 16px 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 6px 0 14px; border-radius: 17px; background: var(--card); color: var(--title); font-size: 15px; border: 1px solid var(--line); }
.chip.active { background: var(--gold); color: #1c1c1e; border-color: var(--gold); }
.chip .x { width: 24px; height: 24px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); font-size: 16px; }
.chip.active .x { color: #3a3a3c; }
.suggest .chip { padding: 0 14px; color: var(--muted); border-style: dashed; }
.suggest:not(:empty)::before { content: "Suggestions"; width: 100%; color: var(--muted); font-size: 13px; }
.follow-form { display: flex; gap: 8px; margin: 12px 0; }
.follow-form input { flex: 1; min-width: 0; height: 42px; border-radius: 12px; border: 0; background: var(--card); color: var(--text); padding: 0 14px; font-size: 16px; outline: 0; }
.follow-form button { height: 42px; padding: 0 16px; border-radius: 12px; background: var(--gold); color: #1c1c1e; font-weight: 600; }
.tags { display: inline-flex; gap: 6px; margin-left: 6px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; background: rgba(216,201,155,.16); color: var(--gold); font-size: 12px; font-weight: 600; text-transform: capitalize; vertical-align: 1px; }

.sheet { width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: 16px 16px 0 0; background: #1c1c1e; color: var(--text); overflow: hidden; display: flex; flex-direction: column; }
.sheet:not([open]) { display: none; }
.sheet::backdrop { background: rgba(0,0,0,.6); }
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 16px; } }
.sheet-head { flex: none; display: grid; grid-template-columns: 70px 1fr 70px; align-items: center; padding: 16px; background: #1c1c1e; }
.sheet-head h2 { margin: 0; text-align: center; font-size: 17px; }
.done { color: var(--gold); font-weight: 600; font-size: 17px; justify-self: end; }
.sheet-body { padding: 0 16px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet h3 { color: var(--muted); font-size: 13px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; margin: 22px 4px 8px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 4px 0; }
.group { background: var(--card-2); border-radius: 12px; overflow: hidden; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; border-top: 1px solid var(--line); font-size: 16px; }
.row:first-child { border-top: 0; }
.row select { background: none; color: var(--muted); border: 0; font: inherit; max-width: 55%; text-align: right; }
.row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--gold); }
.links .row { color: var(--gold); }

.ts-card { background: var(--card-2); border-radius: 14px; overflow: hidden; margin-top: 4px; }
.ts-digital { text-align: center; padding: clamp(10px, 2dvh, 20px) 0 clamp(8px, 1.6dvh, 16px); border-bottom: 1px solid var(--line); }
#ts-time { font: 700 clamp(34px, min(12vw, 6.5dvh), 52px)/1 var(--sans); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
#ts-date { color: #d1d1d6; margin-top: 6px; font-size: clamp(14px, 2.2dvh, 18px); }
#ts-clock { display: block; width: 100%; max-width: min(340px, calc(92dvh - 445px)); min-width: 120px; margin: 6px auto; }
.ts-home { text-align: center; color: var(--gold); padding: 0 16px 14px; font-size: 15px; }
.ts-sync { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 12px; }
.moon-card { display: grid; grid-template-columns: 1fr 1.4fr 1fr; align-items: center; background: var(--card-2); border-radius: 14px; padding: clamp(10px, 2dvh, 18px) 8px; text-align: center; }
.moon-side { color: var(--muted); font-size: 13px; line-height: 1.35; }
.moon-side svg { width: 26px; height: 26px; display: block; margin: 0 auto 6px; }
.moon-mid svg { width: clamp(48px, 8dvh, 76px); height: clamp(48px, 8dvh, 76px); display: block; margin: 0 auto 8px; }
#moon-name { font-size: 18px; }

#timesetter h3 { margin-top: clamp(12px, 2dvh, 22px); }

.alerts-row { display: flex; justify-content: space-between; align-items: center; background: var(--card); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-size: 15px; }
.alerts-hint { margin: -4px 4px 12px; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: #3a3a3c; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--gold); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:disabled + span { opacity: .4; }
