:root {
  color-scheme: dark;
  --bg: #15110e;
  --surface: #211b16;
  --surface-raised: #2a221b;
  --text: #f2eadf;
  --muted: #b4a595;
  --gold: #d9b77a;
  --line: #493a2a;
  --serif: Georgia, "Times New Roman", serif;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button, a { outline-offset: 5px; }
:focus-visible { outline: 2px solid var(--gold); }
button, a, img { -webkit-user-drag: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
.muted { color: var(--muted); }
.eyebrow { color: var(--gold); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; line-height: 1.6; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 1rem; min-height: 54px; padding: .85rem 1.4rem; border-radius: 12px; font-size: 1rem; font-weight: 650; text-decoration: none; border: 1px solid transparent; }
.button-gold { background: var(--gold); color: #20170e; }
.button-gold:hover { background: #e5c890; }
.button-gold:disabled { opacity: .45; }
.button-outline { border-color: var(--line); background: var(--surface); color: var(--text); }
.button-outline:hover { border-color: var(--gold); }
.ornament { display: block; margin-bottom: 1.5rem; color: var(--gold); font-size: 2.5rem; }
.landing { display: grid; place-items: center; padding: max(2rem, env(safe-area-inset-top)) max(1.5rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-left)); background: radial-gradient(ellipse at 50% 10%, #342718 0%, transparent 65%), var(--bg); }
.landing-card { width: min(100%, 420px); text-align: center; }
.landing h1 { font: 400 clamp(2.9rem, 11vw, 4rem)/1.15 var(--serif); margin: 1rem 0 1.4rem; }
.landing .muted { line-height: 1.8; font-size: .95rem; }
.landing-links { display: grid; gap: .85rem; margin: 2.4rem 0; }
.landing-links a { justify-content: space-between; min-height: 64px; }
.fine-print { font-size: .72rem; letter-spacing: .06em; color: var(--muted); }
.control-page { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); }
.control-shell { max-width: 760px; margin: 0 auto; padding: 14px 14px calc(74px + env(safe-area-inset-bottom)); }
.control-header { display: flex; gap: 8px; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.control-header h1 { min-width: 0; font-size: clamp(18px, 4.85vw, 20px); line-height: 1.25; font-weight: 600; }
.connection { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 20px; color: var(--muted); font-size: 11px; line-height: 1.4; white-space: nowrap; }
.connection .status-dot { margin: 0; }
.connection:not(.is-offline) #connection-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.connection.is-offline .display-status { display: none; }
.status-dot { display: inline-block; flex: 0 0 auto; width: 7px; height: 7px; margin-top: .4rem; border-radius: 50%; background: #d28b66; }
.status-dot.online { background: #9bb58a; box-shadow: 0 0 0 4px #9bb58a12; }
.connection strong { color: var(--text); }
.activation { display: grid; margin: 12px 0; }
.activation .button { width: 100%; min-height: 48px; padding: 10px 12px; font-size: 15px; }
.activation .is-active { background: #2b1918; color: #ecc6bc; border-color: #854b45; }
.activation .is-active:hover { background: #3a2220; }
.preview-card { display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: 1fr auto; border: 1px solid var(--line); background: linear-gradient(130deg, #2e251c, var(--surface)); border-radius: 14px; padding: 12px; gap: 8px 12px; touch-action: pan-y; user-select: none; }
.preview-photo { grid-row: 1 / 3; align-self: center; width: 96px; aspect-ratio: 3 / 4; object-fit: contain; border: 1px solid #70573a; border-radius: 6px; background: #14110d; }
.preview-info { align-self: center; min-width: 0; }
.preview-info h2 { font: 400 clamp(21px, 5.5vw, 26px)/1.2 var(--serif); margin-bottom: 5px; overflow-wrap: anywhere; }
.preview-info .muted { font-size: 12px; line-height: 1.5; }
.preview-info .photo-note { margin-top: 4px; font-size: 10px; }
.preview-navigation { grid-column: 2; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.preview-navigation > span { font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.arrow-button { min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 9px; color: var(--gold); background: #19140f; }
.arrow-button:hover { background: #3a2e20; }
.people-section { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.section-heading { font-size: 14px; font-weight: 600; }
.list-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 50px; padding: 10px 12px; border: 0; border-radius: 12px; text-align: left; background: transparent; color: var(--text); font: inherit; }
.list-toggle:hover { background: var(--surface-raised); }
.list-count { padding: 2px 7px; border: 1px solid var(--line); border-radius: 12px; color: var(--gold); font-size: 11px; font-variant-numeric: tabular-nums; }
.list-chevron { margin-left: auto; color: var(--gold); font-size: 20px; line-height: 1; transition: transform 220ms ease; }
.list-toggle[aria-expanded="true"] .list-chevron { transform: rotate(180deg); }
.list-panel { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows 220ms ease, visibility 220ms; }
.list-panel.is-expanded { grid-template-rows: 1fr; visibility: visible; }
.list-panel-inner { min-height: 0; overflow: hidden; }
.people-list { max-height: 50vh; max-height: 50dvh; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-color: #70573a var(--surface); }
.person-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 56px; padding: 3px 11px; border: 1px solid transparent; border-radius: 8px; text-align: left; color: var(--text); background: var(--surface); }
.person-row:hover { background: var(--surface-raised); }
.person-row.selected { border-color: #9c7b49; background: #30261b; }
.person-row img { width: 36px; height: 48px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.person-row > span:nth-child(2) { display: grid; gap: 3px; min-width: 0; }
.person-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 550; }
.person-row .muted { font-size: 11px; }
.selection-mark { margin-left: auto; flex-shrink: 0; color: var(--gold); opacity: 0; }
.selected .selection-mark { opacity: 1; }
.list-tip { font-size: 10px; line-height: 1.5; margin-top: 8px; text-align: center; }
.bottom-tabs { position: fixed; z-index: 5; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: #19140ff5; backdrop-filter: blur(16px); }
.tab { position: relative; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px; padding: 4px 1px; background: transparent; color: var(--muted); border: 0; border-radius: 8px; font-size: 11px; }
.tab.active { color: var(--gold); background: #d9b77a0a; }
.tab:disabled { opacity: .4; }
.tab-symbol { font-size: 18px; line-height: 1; }
.soon { font-size: 8px; line-height: 1.2; }
.display-page { height: 100vh; height: 100dvh; overflow: hidden; background: #100d0a; }
.display-stage { height: 100%; padding: max(1.4rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) max(2.7rem, env(safe-area-inset-bottom)) max(1.25rem, env(safe-area-inset-left)); }
.idle-screen { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.3rem; color: #9c8a72; }
.idle-screen p { font-size: 1.1rem; letter-spacing: .06em; }
.idle-ornament { font-size: 2rem; color: #a68852; animation: breathe 3s ease-in-out infinite; }
.memorial { width: min(100%, 1300px); height: 100%; margin: auto; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: clamp(1rem, 3dvh, 2.5rem); }
.portrait-stack { position: relative; min-width: 0; min-height: 0; isolation: isolate; }
.portrait-layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity 400ms ease-in-out; }
.portrait-layer.visible { opacity: 1; }
.memorial-text { text-align: center; align-self: center; padding: .5rem 0 1rem; }
.memorial-text .eyebrow { font-size: clamp(.65rem, 1.8vw, 1rem); }
.memorial-text h1 { font: 400 clamp(2rem, 8vw, 4.5rem)/1.18 var(--serif); margin: .75rem 0 1rem; color: #f4e7d2; overflow-wrap: anywhere; }
.memorial-rule { width: 54px; height: 1px; background: var(--gold); margin: 0 auto 1rem; opacity: .65; }
#person-date { color: var(--muted); font-size: clamp(.9rem, 2.8vw, 1.5rem); line-height: 1.5; }
.fullscreen-hint { position: fixed; bottom: max(1rem, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); white-space: nowrap; color: #b6a48a; background: #100d0acc; border: 1px solid #493a2a; border-radius: 20px; padding: .5rem .9rem; font-size: .65rem; pointer-events: none; }
.offline-indicator { position: fixed; top: max(.8rem, env(safe-area-inset-top)); right: max(.8rem, env(safe-area-inset-right)); display: flex; align-items: center; gap: .4rem; padding: .45rem .65rem; font-size: .6rem; border-radius: 20px; background: #201810dc; color: #c4ac92; }
.offline-indicator .status-dot { margin: 0; width: 5px; height: 5px; }
@keyframes breathe { 0%, 100% { opacity: .35; transform: scale(.92); } 50% { opacity: .9; transform: scale(1); } }
@media (min-width: 560px) {
  .control-shell { padding-top: 20px; }
  .bottom-tabs { padding-inline: max(.5rem, calc((100vw - 760px) / 2)); }
}
@media (orientation: landscape) and (min-width: 560px) {
  .memorial { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4vw; }
  .memorial-text { padding: 1rem; }
  .memorial-text h1 { font-size: clamp(2rem, 5vw, 5rem); }
  #person-date { font-size: clamp(.9rem, 2vw, 1.6rem); }
}
@media (max-height: 550px) and (orientation: portrait) {
  .memorial-text h1 { font-size: 1.7rem; margin: .4rem 0; }
  .memorial-rule { margin-bottom: .4rem; }
  .memorial { gap: .5rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
