:root {
  --bg: #f6f5f2; --fg: #1d1d1b; --muted: #6b6a66; --card: #fff; --line: #e3e1db;
  --accent: #2f5d50; --ok: #2e7d4f; --bad: #b3382c; --warn: #9a6a00;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161615; --fg: #ecebe7; --muted: #9a9892; --card: #20201e; --line: #34332f; --accent: #7fb8a4; --ok: #6cc28d; --bad: #e57b6f; --warn: #e0b45c; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.wrap { max-width: 640px; margin: 0 auto; padding: 32px 16px 64px; }
.wrap.wide { max-width: 1200px; }
h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.muted { color: var(--muted); } .small { font-size: .875rem; }
.ok { color: var(--ok); } .bad { color: var(--bad); }
.mono { font-family: ui-monospace, Menlo, monospace; word-break: break-all; }

/* ---------- upload page */
.memorial { text-align: center; margin-bottom: 8px; }
.memorial h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 2rem; line-height: 1.2; }
.portrait { display: block; width: 168px; height: 168px; object-fit: cover; border-radius: 50%; margin: 0 auto 16px;
  border: 4px solid var(--card); box-shadow: 0 2px 12px rgb(0 0 0 / .12); }
.eyebrow { margin: 0; color: var(--muted); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; }
.dates { margin: 0; color: var(--muted); }
.message { margin: 16px auto 0; max-width: 34em; }

.field { display: grid; gap: 4px; margin-bottom: 14px; font-weight: 600; font-size: .95rem; }
.field .muted { font-weight: 400; }
.field input, .field textarea { width: 100%; font-weight: 400; font-size: 16px; /* 16px stops iPhones zooming in */ }
textarea { resize: vertical; }

.drop { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 6px 0 0; padding: 32px 16px;
  border: 2px dashed var(--accent); border-radius: 14px; background: var(--bg); cursor: pointer; text-align: center; }
.drop strong { font-size: 1.2rem; color: var(--accent); }
.drop.hover, .drop:focus { background: var(--card); border-style: solid; outline: none; }

.summary p { margin: 0 0 8px; font-weight: 600; }
.summary.finished { border-color: var(--ok); }
.summary.finished p { color: var(--ok); }
.files { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; }
.files li { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.files .name { font-weight: 600; overflow-wrap: anywhere; }
.foot { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.bar { height: 6px; background: var(--line); border-radius: 3px; margin: 8px 0 6px; overflow: hidden; }
.bar.big { height: 10px; border-radius: 5px; margin: 0; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.state { font-size: .875rem; }
.tips { color: var(--muted); }
.tips p { margin: 0 0 8px; }

/* ---------- shared controls */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin: 18px 0; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row input { flex: 1 1 200px; }
.stack { display: grid; gap: 4px; }
input, select, textarea, button, .btn { font: inherit; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
button, .btn { cursor: pointer; background: var(--accent); color: #fff; border-color: transparent; text-decoration: none;
  font-size: .875rem; white-space: nowrap; display: inline-block; }
button.ok { background: var(--ok); } button.danger { background: var(--bad); }
button.quiet, .btn.quiet { background: transparent; color: var(--fg); border-color: var(--line); }
button:disabled { opacity: .45; cursor: default; }
.small-btn { padding: 4px 12px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }

/* ---------- admin */
details.more { flex-basis: 100%; }
details.more summary { cursor: pointer; margin-bottom: 8px; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { margin: 0; }
details.card[open] > summary h2 { margin-bottom: 12px; }
.settings { display: grid; grid-template-columns: 1fr 220px; gap: 24px; align-items: start; }
.portrait-box { text-align: center; }
.portrait-box .actions { justify-content: center; }
@media (max-width: 700px) { .settings { grid-template-columns: 1fr; } }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .push { margin-left: auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tile { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); display: flex; flex-direction: column; }
.tile.selected { outline: 3px solid var(--accent); outline-offset: -1px; }
.media { position: relative; aspect-ratio: 1; background: var(--line); display: grid; place-items: center; }
.media a, .media img, .media video { display: block; width: 100%; height: 100%; }
.media img { object-fit: cover; }
.media video { object-fit: contain; background: #000; }
.placeholder { padding: 12px; text-align: center; color: var(--muted); font-size: .875rem; }
.check { position: absolute; top: 6px; left: 6px; background: var(--card); border-radius: 6px; padding: 4px 6px; line-height: 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; cursor: pointer; }
.info { padding: 10px 12px 12px; display: grid; gap: 4px; }
.who { font-weight: 600; overflow-wrap: anywhere; }
.note { font-style: italic; overflow-wrap: anywhere; }
.meta { overflow-wrap: anywhere; }
.badges { display: flex; gap: 4px; flex-wrap: wrap; }
.badge { font-size: .75rem; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); }
.badge.warn { color: var(--warn); border-color: currentColor; }
.info .actions { margin-top: 4px; }
.info .actions button, .info .actions .btn { padding: 4px 10px; font-size: .8rem; }

/* ---------- printable QR card */
.print-card { text-align: center; }
.print-card h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 2rem; margin-top: 8px; }
.print-card .qr { display: block; width: 300px; max-width: 100%; margin: 24px auto 12px; background: #fff; }
.print-card .scan { font-size: 1.1rem; }
@media print {
  :root { --bg: #fff; --fg: #000; --muted: #444; }
  .no-print { display: none; }
  .print-card { padding-top: 0; }
}

/* Landing page: just her photo, name and dates */
.landing { min-height: 100vh; min-height: 100dvh; box-sizing: border-box; display: grid; place-items: center; }
.landing h1 { font-size: 2.4rem; margin-top: 4px; }
.landing .dates { font-size: 1.1rem; }
.hero { display: block; width: 100%; max-width: 440px; max-height: 70vh; object-fit: contain; margin: 0 auto 28px;
  border-radius: 10px; box-shadow: 0 4px 24px rgb(0 0 0 / .16); }
.tribute { margin: 28px auto 0; max-width: 36em; font-family: Georgia, "Times New Roman", serif; font-size: 1.1rem; line-height: 1.7; }
.tribute:empty { display: none; }
.tribute p { margin: 0 0 1em; }
