/* App screens: Moon, Photos, Settings, placeholders. */

/* ---------- shared HUD buttons (Solar Walk–style round controls) ---------- */
.hudbtn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #dfe9f5;
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.18), rgba(0,0,0,.35) 70%);
  border: 1.5px solid rgba(120,200,230,.65); box-shadow: 0 0 6px rgba(60,170,220,.35), inset 0 1px 0 rgba(255,255,255,.2);
}
.hudbtn svg { width: 18px; height: 18px; fill: currentColor; }
.hudbtn.wide { width: auto; padding: 0 16px; border-radius: 20px; font-size: 13px; font-weight: 700; letter-spacing: .3px; }
.hudbtn:active { background: rgba(60,170,220,.35); }

/* ---------- Moon ---------- */
.moonapp { padding-top: 0; background: #02040a center / cover; background-image: var(--wallpaper-image, url("/assets/wallpapers/night-sky.webp")); }
.moonapp::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0) 30%, rgba(0,0,0,.55)); pointer-events: none; }
.moon-stage { position: absolute; inset: calc(var(--status-h) + var(--bar-h)) 0 132px; display: grid; place-items: center; }
.moon-canvas { width: min(100vw, 80vh, 800px); aspect-ratio: 1; touch-action: none; }
.no-webgl { max-width: 300px; text-align: center; color: #ccd; }

.moon-capsule {
  position: absolute; z-index: 6; top: calc(var(--status-h) + var(--bar-h) + 10px); right: 10px;
  display: flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 18px;
  background: rgba(0,0,0,.55); border: 1.5px solid rgba(120,200,230,.6); box-shadow: 0 0 8px rgba(60,170,220,.3);
  font-size: 17px; color: #cfe7f5; font-variant-numeric: tabular-nums; letter-spacing: .5px;
}
.cap-date { white-space: nowrap; }
.cap-date b { color: #fff; font-weight: 700; }
.cap-now { height: 28px; padding: 0 9px; border-radius: 14px; font-size: 10px; font-weight: 700; color: #8fb8cf; border: 1px solid rgba(120,200,230,.5); }
.cap-now.on { color: #fff; background: radial-gradient(circle, #3fb4ff, #1468b8); box-shadow: 0 0 8px #3fb4ff; }

.moon-hud {
  position: absolute; z-index: 5; left: 12px; top: calc(var(--status-h) + var(--bar-h) + 10px); width: 250px; padding: 10px 12px;
  border-radius: 10px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.18);
  text-shadow: 0 1px 2px #000;
}
.hud-name { margin: 0; font-size: 19px; }
.hud-sub { margin: 2px 0 8px; font-size: 13px; color: #aab8c8; }
.hud-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin: 0; }
.hud-stats dt { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: #7f9ab3; }
.hud-stats dd { margin: 0; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

.moon-controls {
  position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; padding: 8px 0 calc(6px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(70,70,70,.55), rgba(20,20,20,.7) 40%, rgba(0,0,0,.85));
  border-top: 1px solid rgba(255,255,255,.15);
}
.scrub-buttons { display: flex; justify-content: center; gap: 14px; margin-bottom: 8px; }
.ruler { position: relative; height: 50px; cursor: grab; touch-action: none; outline-offset: -2px;
  background: linear-gradient(rgba(255,255,255,.06), rgba(255,255,255,0)); border-top: 1px solid rgba(255,255,255,.08);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.ruler.dragging { cursor: grabbing; }
.ruler canvas { width: 100%; height: 100%; display: block; }
.needle { position: absolute; left: 50%; top: -2px; bottom: 0; width: 2px; margin-left: -1px; background: #3fb4ff; box-shadow: 0 0 6px #3fb4ff; border-radius: 1px; }
.needle::before { content: ""; position: absolute; top: 0; left: -5px; border: 6px solid transparent; border-top-color: #3fb4ff; border-bottom: 0; }

@media (max-width: 767px) {
  .moon-hud { left: 8px; right: 8px; width: auto; top: auto; bottom: 122px; padding: 8px 10px; }
  .hud-stats { grid-template-columns: repeat(4, auto); gap: 4px 8px; }
  .hud-stats dd { font-size: 12px; }
  .hud-name { font-size: 16px; } .hud-sub { margin-bottom: 6px; font-size: 12px; }
  .moon-stage { inset: calc(var(--status-h) + var(--bar-h) + 44px) 0 220px; }
  .moon-canvas { width: min(112vw, 100%); max-height: 100%; }
  .moon-capsule { left: 50%; right: auto; transform: translateX(-50%); font-size: 15px; }
  .scrub-buttons { gap: 10px; }
}
@media (max-width: 767px) and (max-height: 640px) { .hud-stats { display: none; } .moon-stage { bottom: 180px; } .moon-hud { bottom: 120px; } }

/* ---------- iOS 5 popover ---------- */
.popover {
  position: absolute; z-index: 20; top: calc(var(--status-h) + var(--bar-h) + 6px); right: 8px; width: 340px; max-height: calc(100% - 120px);
  display: flex; flex-direction: column; padding: 0 7px 7px; border-radius: 10px;
  background: linear-gradient(#5e6a82, #1a2438 46px, #0f1828); border: 1px solid #0a0f1a;
  box-shadow: 0 10px 30px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.35);
}
.popover-arrow { position: absolute; top: -12px; right: 34px; width: 0; height: 0; border: 12px solid transparent; border-top: 0; border-bottom-color: #5e6a82; }
.popover-head { height: 40px; display: grid; place-items: center; font-size: 17px; font-weight: 700; color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.6); }
.popover-list { margin: 0; overflow-y: auto; border-radius: 4px; border: 0; }
.popover-list .row { gap: 12px; font-size: 15px; padding: 8px 12px; min-height: 52px; }
.popover-list .pp-name { display: flex; flex-direction: column; }
.popover-list small { display: block; font-size: 12px; font-weight: 400; color: #7d7d7d; }
.popover-list .detail { text-align: right; font-size: 14px; }
.popover-list .row:active small, .popover-list .row:hover small { color: inherit; }
.popover-list .row:hover { background: var(--blue-select); color: #fff; }
.popover-list .row:hover .detail { color: #fff; }
@media (max-width: 767px) { .popover { left: 6px; right: 6px; width: auto; } .popover-arrow { right: 26px; } }

.phase-glyph { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 1.5px solid #333; background: #222; position: relative; overflow: hidden; }
.phase-glyph.full { background: #f2e9c4; }
.phase-glyph.first::after, .phase-glyph.last::after { content: ""; position: absolute; top: 0; bottom: 0; width: 50%; background: #f2e9c4; }
.phase-glyph.first::after { right: 0; } .phase-glyph.last::after { left: 0; }

/* ---------- Photos ---------- */
.photosapp .photos-body { flex: 1; display: flex; min-height: 0; }
.albums-panel {
  flex: 0 0 320px; display: flex; flex-direction: column; margin: 10px 0 10px 10px; padding: 0 6px 6px; border-radius: 10px;
  background: linear-gradient(#5e6a82, #1a2438 40px, #0f1828); border: 1px solid #0a0f1a; box-shadow: 0 6px 20px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.3);
  min-height: 0;
}
.albums-head { height: 38px; display: grid; place-items: center; font-weight: 700; font-size: 17px; text-shadow: 0 -1px 0 #000; }
.albums-list { margin: 0; overflow-y: auto; border: 0; border-radius: 4px; }
.albums-list li { padding: 0; }
.album-row { gap: 10px; padding: 6px 10px; min-height: 58px; text-decoration: none; font-size: 16px; }
.album-row img { width: 44px; height: 44px; object-fit: cover; border: 1px solid rgba(0,0,0,.25); flex: none; }
.album-count { color: #8a8a8a; font-weight: 400; }
.album-row[aria-selected="true"] .album-count { color: #dde8ff; }
.grid-wrap { flex: 1; overflow-y: auto; padding: 18px; -webkit-overflow-scrolling: touch; }
.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 22px; }
.thumb { display: block; width: 100%; aspect-ratio: 1; padding: 5px; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.6); transition: transform .15s; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover { transform: scale(1.03); }
.thumb:active { filter: brightness(.7); }
.photos-empty { margin: auto; max-width: 340px; padding: 30px; text-align: center; color: #c9ccd2; text-shadow: 0 1px 2px #000; }
.photos-empty svg { width: 72px; height: 72px; color: #8d929b; }
.photos-empty h2 { margin: 10px 0 6px; color: #fff; }
.photos-empty code { background: rgba(0,0,0,.4); padding: 1px 5px; border-radius: 4px; }

@media (max-width: 767px) {
  .photosapp .photos-body { position: relative; overflow: hidden; }
  .albums-panel, .grid-wrap { position: absolute; inset: 0; transition: transform .35s var(--ease-ios); }
  .albums-panel { margin: 0; padding: 0; border: 0; border-radius: 0; background: #fff; box-shadow: none; }
  .albums-head { display: none; }
  .albums-list { border-radius: 0; }
  .album-row { min-height: 60px; }
  .album-row img { width: 57px; height: 57px; }
  .photosapp.show-grid .albums-panel { transform: translateX(-30%); }
  .grid-wrap { transform: translateX(100%); padding: 4px; background: #fff; }
  .photosapp.show-grid .grid-wrap { transform: none; }
  .photo-grid { grid-template-columns: repeat(4, 1fr); gap: 4px; }
  .thumb { padding: 0; box-shadow: none; }
  .thumb:hover { transform: none; }
}

/* Viewer */
.viewer { position: fixed; inset: 0; z-index: 40; background: #000; opacity: 0; transition: opacity .25s; overflow: hidden; }
.viewer.open { opacity: 1; }
.viewer-track { position: absolute; inset: 0; display: flex; transform: translateX(-100%); touch-action: none; }
.slide { flex: 0 0 100%; height: 100%; margin: 0; display: grid; place-items: center; overflow: hidden; }
.slide img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .2s; user-select: none; -webkit-user-drag: none; }
.viewer { padding-top: var(--status-h); }
.viewer-bar, .viewer-tools { transition: opacity .25s; }
.viewer-tools { position: absolute; left: 0; right: 0; bottom: 0; justify-content: center; gap: 40px; height: 54px; flex-basis: 54px; }
.viewer.chrome-hidden .viewer-bar, .viewer.chrome-hidden .viewer-tools { opacity: 0; pointer-events: none; }
.viewer-count { text-align: center; font-size: 17px; }

/* ---------- Settings ---------- */
.settings-scroll { flex: 1; overflow-y: auto; padding-bottom: 30px; }
.settings-scroll .group li, .settings-scroll .group .row { justify-content: flex-start; }
.settings-scroll .group label { flex: 1; cursor: pointer; }
.wallpaper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; padding: 12px; }
.wp { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: #333; }
.wp img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; border: 3px solid transparent; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.wp[aria-checked="true"] img { border-color: #2d6fe0; }
.wp[aria-checked="true"] span::before { content: "\2713  "; color: #2d6fe0; }
.wp-loading { margin: 0; color: #777; font-size: 14px; }

/* ---------- Placeholder ---------- */
.alert-icon { display: flex; justify-content: center; margin-bottom: 10px; }
.alert-icon .icon { --icon: 57px; }
.popover-list li { padding: 0 !important; border-top: 1px solid #e0e0e0; } .popover-list li:first-child { border-top: 0; } .popover-list .row { border: 0; width: 100%; }
.popover-list .row, .albums-list .row { display: flex; align-items: center; font-weight: 700; color: #000; background: #fff; text-align: left; }
.popover-list .detail { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; line-height: 1.25; }
.popover-list .pp-name { line-height: 1.2; }

/* ---------- Calendar ---------- */
.calendarapp { background: #e9ebee; color: #000; }
.cal-scroll { flex: 1; overflow-y: auto; padding-bottom: 24px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; height: 46px; padding: 0 6px;
  background: linear-gradient(#f7f7f8, #d4d7dc); border-bottom: 1px solid #a3a7ae; }
.cal-month { margin: 0; font-size: 22px; font-weight: 700; color: #3a3e46; text-shadow: 0 1px 0 #fff; }
.cal-arrow { width: 44px; height: 44px; display: grid; place-items: center; }
.cal-arrow svg { width: 22px; height: 22px; fill: none; stroke: #4c5260; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 0 #fff); }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); background: linear-gradient(#dfe1e5, #d2d5da); border-bottom: 1px solid #a3a7ae; }
.cal-weekdays span { text-align: center; font-size: 11px; font-weight: 700; color: #4c5260; padding: 3px 0; text-shadow: 0 1px 0 #fff; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); background: #b8bcc3; gap: 1px; border-bottom: 1px solid #b8bcc3; }
.cal-day { position: relative; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: linear-gradient(#fdfdfd, #eef0f2); color: #2b2f36; padding: 4px 2px; }
.cal-day .cal-num { font-size: 18px; font-weight: 700; line-height: 1; }
.cal-day.out { background: #e4e6e9; color: #9a9ea6; }
.cal-day.out .glyph { opacity: .5; }
.cal-day.today { background: linear-gradient(#6d9be4, #2563d4); color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.4); box-shadow: inset 0 1px 0 rgba(255,255,255,.4); }
.cal-day.principal .glyph { filter: drop-shadow(0 0 3px rgba(255,200,60,.9)); }
.cal-tag { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; color: #8a5a00; }
.cal-day.today .cal-tag { color: #fff; }
.cal-day:hover:not(.today) { background: linear-gradient(#f2f6fd, #dfe8f6); }
.cal-list .row { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.cal-list .row .detail { font-size: 14px; }
@media (min-width: 768px) { .cal-day { min-height: 92px; } .cal-day .cal-num { font-size: 22px; } .cal-tag { font-size: 10px; } }
@media (max-width: 380px) { .cal-list .row .detail { font-size: 12px; } }

/* ---------- Eclipses + Almanac rows ---------- */
.group .ecl-row, .group .alm-row { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 6px 10px; width: 100%; font-weight: 400; text-align: left; }
.group .ecl-row .detail { display: flex; flex-direction: column; align-items: flex-end; font-size: 14px; text-align: right; }
.ecl-text, .alm-text { display: flex; flex-direction: column; min-width: 0; }
.ecl-text b, .alm-text b { font-size: 16px; }
.ecl-text small, .alm-text small, .ecl-row .detail small { font-size: 12px; color: #7a7f88; font-weight: 400; }
.row:hover small, .row:active small { color: inherit; }
.ecl-badge { width: 30px; height: 30px; border-radius: 50%; flex: none; position: relative; overflow: hidden; background: #e8dcc0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); }
.ecl-badge.total { background: radial-gradient(circle at 40% 40%, #c4472c, #6e1608); }
.ecl-badge.partial::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #7a2a17; transform: translate(-40%, -25%); }
.ecl-badge.penumbral { background: linear-gradient(120deg, #9a8e78, #e8dcc0 70%); }
.ecl-badge.sun { background: #ffc93c; box-shadow: 0 0 6px #ffb300; }
.ecl-badge.sun::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: #111; }
.ecl-badge.sun.partial::after { transform: translate(35%, -20%); inset: 0; }
.ecl-badge.sun.annular::after { inset: 4px; }
.ecl-badge.sun.total { background: radial-gradient(circle, #fff 55%, #ffe9a8 62%, rgba(255,200,80,0) 72%), #111; }
.ecl-badge.sun.total::after { inset: 6px; }
.ecl-badge.big { width: 64px; height: 64px; }
.ecl-hero { display: flex; align-items: center; gap: 16px; margin: 18px 10px 0; padding: 14px 16px; border-radius: 10px;
  background: linear-gradient(#2a3550, #0d1426); color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.2); }
.ecl-hero div { display: flex; flex-direction: column; gap: 2px; }
.ecl-hero small { text-transform: uppercase; letter-spacing: .6px; font-size: 11px; color: #9fb3d6; }
.ecl-hero b { font-size: 20px; }
.ecl-hero span { color: #cfd9ec; font-size: 14px; }
@media (min-width: 768px) { .ecl-hero { margin: 20px 44px 0; } }
.alm-year { margin: 18px 0 0; font-family: var(--font-serif); text-align: center; font-size: 30px; color: #4c566c; text-shadow: 0 1px 0 #fff; }
.alm-row.past { opacity: .5; }
.tag { margin-left: auto; padding: 2px 7px; border-radius: 9px; font-size: 11px; font-weight: 700; color: #fff; white-space: nowrap; }
.tag + .tag { margin-left: 4px; }
.tag.super { background: linear-gradient(#f08a3c, #c95a10); }
.tag.blue { background: linear-gradient(#5a95ef, #1f5fcf); }
.tag.next { background: linear-gradient(#5cc45c, #2a8a2a); }
.alm-row.chevron::after { margin-left: 8px; }
.navbar .seg { gap: 0; }
.navbar .seg .barbtn:first-child { border-radius: 5px 0 0 5px; }
.navbar .seg .barbtn:last-child { border-radius: 0 5px 5px 0; border-left: 0; }

/* ---------- Clock ---------- */
.clockapp { background: linear-gradient(#3c3f45, #1c1d20); }
.clock-pane { flex: 1; overflow-y: auto; }
.wc-list { list-style: none; margin: 0; padding: 0; }
.wc-row { display: flex; align-items: center; gap: 14px; height: 86px; padding: 0 16px; border-bottom: 1px solid #111; box-shadow: 0 1px 0 rgba(255,255,255,.08);
  background: linear-gradient(rgba(255,255,255,.06), rgba(255,255,255,0)); }
.wc-face { width: 66px; height: 66px; flex: none; filter: drop-shadow(0 2px 2px rgba(0,0,0,.6)); }
.wc-face .rim { fill: #c9ccd1; } .wc-face .dial { fill: #fff; } .wc-face .tick { stroke: #222; stroke-width: 2.4; }
.wc-face .h, .wc-face .m { stroke: #111; } .wc-face .s { stroke: #e02020; } .wc-face .hub { fill: #e02020; }
.wc-face.night .rim { fill: #555; } .wc-face.night .dial { fill: #111; } .wc-face.night .tick { stroke: #ddd; }
.wc-face.night .h, .wc-face.night .m { stroke: #fff; }
.wc-city { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.wc-city b { font-size: 20px; color: #fff; text-shadow: 0 -1px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-city b small { font-size: 13px; color: #9aa0aa; font-weight: 400; }
.wc-day { font-size: 13px; color: #a7adb7; }
.wc-time { font-family: var(--font-display); font-size: 28px; color: #fff; font-weight: 300; font-variant-numeric: tabular-nums; text-shadow: 0 -1px 0 #000; }
@media (min-width: 768px) { .wc-list { max-width: 700px; margin: 20px auto; border-radius: 10px; overflow: hidden; border: 1px solid #000; } }
.sw-display { font-family: var(--font-display); margin: 30px auto 24px; width: min(90%, 520px); padding: 18px 0; text-align: center; font-size: clamp(56px, 12vw, 96px); font-weight: 700; font-variant-numeric: tabular-nums;
  color: #1a1a1a; border-radius: 10px; background: linear-gradient(#f5f6f8, #c9cdd3); box-shadow: inset 0 2px 4px rgba(0,0,0,.35), 0 1px 0 rgba(255,255,255,.2); text-shadow: 0 1px 0 #fff; }
.sw-buttons { display: flex; justify-content: center; gap: 16px; }
.sw-btn { width: min(44%, 240px); height: 50px; border-radius: 8px; font-size: 20px; font-weight: 700; color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.45);
  border: 1px solid #111; box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 1px 0 rgba(255,255,255,.12); }
.sw-btn.grey { background: linear-gradient(#a3a7ae, #6c7079 50%, #5b5f68 50%, #4f535b); }
.sw-btn.green { background: linear-gradient(#7fd07f, #3caa3c 50%, #2a962a 50%, #228a22); }
.sw-btn.red { background: linear-gradient(#ee7d7d, #d43a3a 50%, #c22626 50%, #b01c1c); }
.sw-btn:disabled { opacity: .5; }
.sw-laps { list-style: none; margin: 20px auto; padding: 0; width: min(90%, 520px); border-radius: 9px; overflow: hidden; }
.sw-laps li { display: flex; justify-content: space-between; padding: 11px 14px; background: #fff; color: #000; font-weight: 700; border-top: 1px solid #ddd; font-variant-numeric: tabular-nums; }
.sw-laps li:first-child { border-top: 0; }
.tabbar { flex: 0 0 49px; display: flex; justify-content: center; gap: 6px; padding: 2px 4px; background: linear-gradient(#3b3b3b, #151515 50%, #000 50%); border-top: 1px solid #000; box-shadow: inset 0 1px 0 rgba(255,255,255,.18); }
.tabbar button { flex: 0 1 110px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 4px; font-size: 10px; font-weight: 700; color: #9a9a9a; }
.tabbar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; }
.tabbar button[aria-selected="true"] { color: #fff; background: rgba(255,255,255,.14); }
.tabbar button[aria-selected="true"] svg { stroke: #3fa9f5; filter: drop-shadow(0 0 3px rgba(63,169,245,.7)); }

/* ---------- Moon Journal (iOS 5 Notes) ---------- */
.journalapp { background: #3b2412; }
.journal-bar { background: linear-gradient(#9b6a3c, #6e4321 50%, #5f3818 50%, #4f2c10); border-top-color: #b98a5a; border-bottom-color: #2a1606; }
.journal-bar .barbtn, .journal-bar .barbtn.back::before { background: linear-gradient(#8a5c30, #5c3412 50%, #4d2a0c 50%, #44240a); }
.journal-bar .barbtn { border-color: #2a1606; }
.journal-bar .barbtn.back { background: #2a1606; }
.journal-body { flex: 1; display: flex; min-height: 0; position: relative; }
.journal-list { flex: 0 0 300px; overflow-y: auto; background: #f7f1d4; border-right: 2px solid #5a3a1c; }
.journal-list ul { list-style: none; margin: 0; padding: 0; }
.jl-row { width: 100%; display: flex; align-items: center; gap: 8px; padding: 12px 12px; border-bottom: 1px solid #d9cf9e; text-align: left; color: #3a2a10;
  font-family: "Marker Felt", "Noteworthy", var(--font-serif); font-size: 17px; }
.jl-row[aria-current="true"] { background: #e9dda3; }
.jl-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jl-date { font-size: 13px; color: #8a7340; }
.journal-paper { flex: 1; display: flex; flex-direction: column; min-width: 0;
  background: #fdf6bf; }
.paper-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding: 10px 16px 6px 46px; color: #6b5318; font-size: 14px; }
.paper-moon { display: flex; align-items: center; gap: 6px; }
/* Ruled lines live on the textarea (scrolling with the text) so every line of handwriting sits on one. */
.journal-paper textarea { flex: 1; resize: none; border: 0; outline: 0; padding: 4px 16px 16px 46px;
  background: repeating-linear-gradient(transparent 0 29px, #d8cf8e 29px 30px) 0 4px / 100% 30px local; color: #2f2410;
  font-family: "Marker Felt", "Noteworthy", var(--font-serif); font-size: 19px; line-height: 30px; border-left: 2px solid rgba(220,130,130,.55); margin-left: 34px; padding-left: 10px; }
.paper-tools { display: flex; justify-content: flex-end; padding: 8px; background: linear-gradient(#9b6a3c, #4f2c10); }
.journal-empty { display: none; position: absolute; inset: 0; place-content: center; text-align: center; gap: 10px; color: #f3e6c0; background: #3b2412 var(--linen-dark) center / 768px; }
.journal-empty .alert-btn { width: auto; padding: 0 20px; color: #fff; }
.journalapp.is-empty .journal-empty { display: grid; }
.journalapp:not(.editing) .journal-paper { visibility: hidden; }
@media (max-width: 767px) {
  .journal-list { flex: 1; border: 0; }
  .journal-paper { position: absolute; inset: 0; transform: translateX(100%); transition: transform .35s var(--ease-ios); visibility: visible !important; }
  .journalapp.editing .journal-paper { transform: none; }
}

/* ---------- Red Light ---------- */
.redlightapp { background: #000; padding-top: 0; }
.red-field { position: absolute; inset: 0; cursor: pointer; }
.redlightapp .navbar, .red-tools, .red-hint { transition: opacity .3s; }
.redlightapp.chrome-hidden .navbar, .redlightapp.chrome-hidden .red-tools, .redlightapp.chrome-hidden .red-hint { opacity: 0; pointer-events: none; }
.redlightapp .navbar.translucent { filter: sepia(1) hue-rotate(-50deg) saturate(3) brightness(.7); }
.red-tools { position: absolute; left: 0; right: 0; bottom: 0; height: 54px; justify-content: center; gap: 12px; color: #ff6a5a; }
.red-tools svg { width: 20px; height: 20px; fill: currentColor; }
.red-hint { position: absolute; left: 0; right: 0; bottom: 64px; margin: 0; text-align: center; font-size: 13px; color: rgba(255,170,160,.7); pointer-events: none; }
/* iOS 5 slider */
.ios-range { --range-on: #3d82e6; --range-off: #161b26; --range-edge: #000; -webkit-appearance: none; appearance: none; width: min(60vw, 420px); height: 24px; background: transparent; margin: 0; }
.ios-range::-webkit-slider-runnable-track { height: 9px; border-radius: 5px; border: 1px solid var(--range-edge);
  background: linear-gradient(90deg, var(--range-on) var(--fill, 50%), var(--range-off) var(--fill, 50%)); box-shadow: inset 0 1px 2px rgba(0,0,0,.6); }
.ios-range::-moz-range-track { height: 9px; border-radius: 5px; border: 1px solid var(--range-edge); background: var(--range-off); }
.ios-range::-moz-range-progress { height: 9px; border-radius: 5px; background: var(--range-on); }
.ios-range::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -8.5px; border-radius: 50%; border: 1px solid #555;
  background: linear-gradient(#fdfdfd, #c9c9c9); box-shadow: 0 1px 3px rgba(0,0,0,.6); }
.ios-range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; border: 1px solid #555; background: linear-gradient(#fdfdfd, #c9c9c9); }
.group > li:has(> .row) { padding: 0; }
.alm-text { flex: 1; }
.journal-empty .alert-btn { height: 44px; line-height: 42px; border-radius: 8px; font-size: 17px; font-weight: 700; text-shadow: 0 -1px 0 rgba(0,0,0,.6);
  background: linear-gradient(#9b6a3c, #6e4321 50%, #5f3818 50%, #4f2c10); border: 1px solid #2a1606; box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 2px 4px rgba(0,0,0,.5); }
.paper-tools .barbtn { background: linear-gradient(#8a5c30, #5c3412 50%, #4d2a0c 50%, #44240a); border-color: #2a1606; }

/* ---------- iOS 5 segmented control (in-content) ---------- */
.ios-seg { display: flex; margin: 14px 10px 0; border-radius: 6px; overflow: hidden; border: 1px solid #7c8794; box-shadow: 0 1px 0 rgba(255,255,255,.7); }
.ios-seg button { flex: 1; height: 30px; font-size: 13px; font-weight: 700; color: #4c566c; text-shadow: 0 1px 0 #fff;
  background: linear-gradient(#fff, #e6e8ec 50%, #d9dce2 50%, #eceef1); border-left: 1px solid #a6aeb8; }
.ios-seg button:first-child { border-left: 0; }
.ios-seg button[aria-selected="true"] { color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.45);
  background: linear-gradient(#7fa4e0, #4677cd 50%, #3266c4 50%, #4b7ed6); box-shadow: inset 0 1px 3px rgba(0,0,0,.35); }
@media (min-width: 768px) { .ios-seg { margin: 18px auto 0; max-width: 520px; } }

/* ---------- Tides ---------- */
.tide-hero { display: flex; align-items: center; gap: 14px; margin: 18px 10px 0; padding: 12px 14px; border-radius: 10px;
  background: linear-gradient(#183455, #071526); color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.18); }
.tide-diagram { width: 46%; max-width: 260px; flex: none; }
.td-lbl { font-size: 9px; fill: #cfe0f2; font-family: var(--font); }
.tide-hero-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tide-hero-text small { text-transform: uppercase; letter-spacing: .6px; font-size: 11px; color: #9fc0e6; }
.tide-hero-text b { font-family: var(--font-display); font-size: 22px; }
.tide-hero-text span { font-size: 13px; color: #cfe0f2; }
.tide-hero-text p { margin: 2px 0 0; font-size: 13px; line-height: 1.35; color: #a9bfd8; }
.tide-meter { display: block; height: 9px; border-radius: 5px; background: #06101d; box-shadow: inset 0 1px 2px #000, 0 1px 0 rgba(255,255,255,.15); overflow: hidden; }
.tide-meter i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(#9ed2ff, #3c8fe0); }
.tide-chart-wrap { padding: 0 !important; overflow: hidden; background: linear-gradient(#0b1a2e, #13304f); }
.tide-chart { display: block; width: 100%; height: auto; }
.td-grid { stroke: rgba(255,255,255,.1); } .td-grid.day { stroke: rgba(255,255,255,.3); }
.td-mean { stroke: rgba(255,255,255,.25); stroke-dasharray: 4 4; }
.td-now { stroke: #ff5a4a; stroke-width: 1.5; } .td-now-l { fill: #ff8a7a; font-size: 11px; font-weight: 700; font-family: var(--font); }
.td-ext circle { fill: #fff; stroke: #0d4a8c; stroke-width: 1.5; }
.td-ext text { fill: #fff; font-size: 11px; font-weight: 600; font-family: var(--font); paint-order: stroke; stroke: rgba(0,20,40,.8); stroke-width: 3px; }
.td-day { fill: rgba(255,255,255,.75); font-size: 11px; font-weight: 700; font-family: var(--font); }
.tide-row { font-weight: 700; }
.tide-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; box-shadow: inset 0 1px 1px rgba(255,255,255,.5), 0 1px 1px rgba(0,0,0,.3); }
.tide-dot.high { background: linear-gradient(#6fb8ff, #1f6fd0); }
.tide-dot.low { background: linear-gradient(#d2d7de, #8d97a4); }
@media (min-width: 768px) { .tide-hero { margin: 20px 44px 0; padding: 16px 22px; } .tide-hero-text p { font-size: 14px; } }
@media (max-width: 380px) { .tide-hero { flex-direction: column; } .tide-diagram { width: 80%; } }

/* ---------- Sky Events ---------- */
.ev-hero svg, .ev-hero .ecl-badge { width: 56px; height: 56px; flex: none; }
.ev-ico { width: 30px; height: 30px; flex: none; }
.ev-ico.meteor > circle:first-child { fill: #1d2846; }
.ev-ico.season > circle:first-child { fill: #f0a23a; }
.ev-ico.planet > circle:first-child { fill: #0f1730; }
.ev-ico.planet .disc { fill: #ccc; }
.ev-ico.mercury .disc { fill: #b8aea2; } .ev-ico.venus .disc { fill: #f4e2b0; } .ev-ico.mars .disc { fill: #d9653b; }
.ev-ico.jupiter .disc { fill: #e3c49a; } .ev-ico.saturn .disc { fill: #e8d49a; }
.group .ev-when { flex: none; display: flex; flex-direction: column; align-items: flex-end; font-size: 14px; text-align: right; }
.ev-when small { font-size: 12px; color: #7a7f88; }
.events-list .alm-text small + small { color: #9aa0aa; font-style: italic; }

/* ---------- Star Chart ---------- */
.starchartapp { background: #02050d; }
.sky-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: radial-gradient(circle at 50% 50%, #0a1020, #000 75%); }
.sky-canvas { display: block; touch-action: none; cursor: grab; }
.sky-canvas:active { cursor: grabbing; }
.sky-callout { position: absolute; z-index: 2; display: flex; flex-direction: column; gap: 1px; max-width: 260px; padding: 6px 12px 7px; border-radius: 8px; pointer-events: none;
  color: #fff; background: linear-gradient(rgba(90,90,90,.92), rgba(30,30,30,.92) 50%, rgba(0,0,0,.92) 50%); border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 3px 10px rgba(0,0,0,.6); }
.sky-callout b { font-size: 15px; } .sky-callout span { font-size: 12px; color: #c9d2e2; }
.sky-where { position: absolute; left: 10px; bottom: 6px; margin: 0; font-size: 11px; color: rgba(200,215,240,.6); pointer-events: none; }
.sky-tools { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.sky-tools .ios-range { flex: 1; min-width: 60px; }
.sky-time-l { min-width: 74px; text-align: center; font-size: 13px; font-weight: 700; color: #fff; text-shadow: 0 -1px 0 #000; font-variant-numeric: tabular-nums; }
.barbtn[aria-pressed="false"] { opacity: .55; }

/* ---------- Observatory ---------- */
.observatoryapp { background: #000 var(--linen-dark); }
.obs-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.obs-moon { display: flex; flex-direction: column; align-items: center; padding: 12px 10px 14px; color: #fff; }
.obs-stage { position: relative; width: min(92vw, 52vh, 560px); aspect-ratio: 1; }
.obs-stage canvas { position: absolute; inset: 0; }
.obs-marks { position: absolute; inset: 0; }
.obs-mark { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; display: grid; place-items: center; }
.obs-mark::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 3px #000; opacity: .7; }
.obs-mark.dark::before { border-color: rgba(150,170,200,.55); opacity: .5; }
.obs-mark.best::before { border-color: #ffd34d; background: rgba(255,211,77,.35); opacity: 1; width: 9px; height: 9px; }
.obs-mark.sel::before { width: 14px; height: 14px; border-color: #5ab0ff; background: rgba(90,176,255,.3); opacity: 1; }
.obs-mark span { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); white-space: nowrap; font-size: 10px; font-weight: 700; color: #fff;
  text-shadow: 0 1px 2px #000, 0 0 3px #000; pointer-events: none; display: none; }
.obs-mark.best span, .obs-mark.sel span { display: block; }
.obs-caption { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 8px; text-align: center; font-size: 15px; text-shadow: 0 -1px 0 #000; }
.obs-caption span { font-size: 12px; color: #b8c2d4; }
.obs-legend { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.obs-legend .obs-dot { margin-left: 6px; }
.obs-detail { width: min(100%, 560px); margin-top: 10px; padding: 10px 14px; border-radius: 10px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); }
.obs-detail b { display: block; font-family: var(--font-display); font-size: 17px; }
.obs-detail small { color: #9fb0c8; font-size: 12px; }
.obs-detail p { margin: 6px 0 0; font-size: 14px; line-height: 1.4; color: #dde3ee; }
.obs-side { padding-bottom: 30px; }
.obs-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: inset 0 1px 1px rgba(255,255,255,.5), 0 1px 1px rgba(0,0,0,.3); }
.obs-dot.best { background: linear-gradient(#ffe27a, #e9a91a); }
.obs-dot.lit { background: linear-gradient(#f4f4f4, #bfc3c9); }
.obs-dot.dark { background: linear-gradient(#5d6676, #262b35); }
.obs-dot.limb { background: linear-gradient(#9aa3b2, #6b7383); }
.obs-row.sel { background: linear-gradient(#058cf5, #015fe6); color: #fff; }
.obs-row.sel small, .obs-row.sel .detail { color: #fff; }
.obs-kind { font-size: 13px; }
.obs-tips li { display: block !important; padding: 10px 12px !important; }
.obs-tips b { font-size: 16px; } .obs-tips p { margin: 3px 0 0; font-size: 14px; font-weight: 400; line-height: 1.4; color: #333; }
@media (min-width: 900px) {
  .obs-body { flex-direction: row; overflow: hidden; }
  .obs-moon { flex: 1.2; overflow-y: auto; justify-content: center; }
  .obs-stage { width: min(56vw, 70vh, 640px); }
  .obs-side { flex: 1; overflow-y: auto; max-width: 480px; border-left: 1px solid #000; }
}

/* ---------- Lunar Lander ---------- */
.landerapp { background: #000; }
.ll-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.ll-canvas { display: block; }
.ll-hud { position: absolute; left: 8px; top: calc(var(--status-h) + var(--bar-h) + 8px); margin: 0; display: grid; grid-template-columns: auto auto; gap: 2px 12px; padding: 8px 12px;
  border-radius: 8px; background: linear-gradient(rgba(60,60,60,.72), rgba(15,15,15,.72) 50%, rgba(0,0,0,.72) 50%); border: 1px solid rgba(255,255,255,.18); pointer-events: none; }
.ll-hud div { display: contents; }
.ll-hud dt { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: #9aa6b8; align-self: center; }
.ll-hud dd { margin: 0; font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: #fff; text-align: right; font-variant-numeric: tabular-nums; }
.ll-hud dd.bad { color: #ff6b5a; }
.ll-fuelbar { display: inline-block; width: 74px; height: 8px; border-radius: 4px; background: #111; box-shadow: inset 0 1px 2px #000, 0 1px 0 rgba(255,255,255,.15); overflow: hidden; vertical-align: middle; }
.ll-fuelbar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(#9cf09c, #2fa02f); }
.ll-fuelbar i.low { background: linear-gradient(#ffb09c, #d0331f); }
.ll-controls { position: absolute; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; justify-content: space-between; align-items: flex-end; padding: 0 14px; pointer-events: none; }
.ll-turn { display: flex; gap: 12px; }
.ll-btn { pointer-events: auto; width: 64px; height: 64px; border-radius: 50%; font-size: 22px; font-weight: 700; color: #fff; text-shadow: 0 -1px 0 #000;
  background: linear-gradient(rgba(120,120,120,.55), rgba(40,40,40,.55) 50%, rgba(10,10,10,.6) 50%, rgba(40,40,40,.55)); border: 1px solid rgba(255,255,255,.3);
  box-shadow: 0 2px 6px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.35); touch-action: none; }
.ll-btn.thrust { width: 108px; height: 72px; border-radius: 14px; font-size: 15px; letter-spacing: 1px; }
.ll-btn.on { background: linear-gradient(#ffb44a, #e07b10 50%, #c76200 50%, #e58a1a); }
@media (hover: hover) and (pointer: fine) { .ll-controls { opacity: .55; } }
.ll-overlay { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.25); }
.ll-overlay[hidden] { display: none; }
.ll-overlay .alert p small { color: #b8c6e0; font-size: 13px; }
.redlightapp .ios-range { --range-on: #c0261a; --range-off: #2a0a0a; --range-edge: #3a0000; }
.obs-caption .obs-cap1 { font-size: 15px; color: #fff; }
