:root {
  --bg: #0e1012; --surface: #161a1e; --surface-2: #1f2429; --line: #2b3138; --edge: #6b747c;
  --text: #e8ebee; --muted: #b3bcc4; --accent: #d9b56c; --accent-ink: #1b1508; --danger: #e57373;
  --login: #6fa8dc; --card: #d9b56c; --id: #8fc9a3; --note: #b49ad6;
  --r: 14px; --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
@supports (font: -apple-system-body) { body { font: -apple-system-body; } }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
.sprite { position: absolute; width: 0; height: 0; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* the app fills the visible screen; --vvh shrinks it above the keyboard */
#app { position: fixed; left: 0; right: 0; top: 0; height: var(--vvh, 100dvh); max-width: 560px; margin: 0 auto; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.body { flex: 1; overflow-y: auto; padding: 4px max(16px, env(safe-area-inset-left)) 28px max(16px, env(safe-area-inset-right)); -webkit-overflow-scrolling: touch; }
.body.withfab { padding-bottom: 120px; }
.foot { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 52px; padding: 0 10px; flex: none; }
.bar-title { margin: 0; font-size: 1.75rem; letter-spacing: -0.01em; padding-left: 6px; }
.bar-title.small { font-size: 1.06rem; font-weight: 600; text-align: center; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0; }
.bar-actions { display: flex; gap: 2px; }
.bar-spacer { width: 72px; flex: none; }
.grow1 { flex: 1; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; color: var(--muted); border-radius: 10px; }
.text-btn { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; gap: 2px; padding: 0 8px; color: var(--accent); font-size: 1.06rem; }
.text-btn.strong { font-weight: 700; }
.text-btn.muted { color: var(--muted); font-size: .94rem; }
.text-btn.inline { min-height: 44px; padding: 0 2px; font-size: inherit; font-weight: 600; }
.text-btn svg { margin-left: -6px; }
.center-row { display: flex; justify-content: center; }
.mt8 { margin-top: 8px; } .mt10 { margin-top: 10px; } .mt12 { margin-top: 12px; } .mt14 { margin-top: 14px; } .pad4 { margin: 8px 4px 0; }

.intro { text-align: center; padding: 18px 0; }
.intro h1 { margin: 10px 0 6px; font-size: 1.62rem; letter-spacing: -0.01em; }
svg.mark { width: 44px; height: 44px; color: var(--accent); fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.lede { margin: 0 auto; color: var(--muted); max-width: 32ch; }
.step-title { font-size: 1.62rem; margin: 6px 0 8px; letter-spacing: -0.01em; }
.lead2 { margin: 0 0 18px; color: var(--muted); }
.q-label { margin: 6px 0 0; font-weight: 600; }
.first-links { margin-top: 18px; text-align: center; }
.first-links .hint { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: .94rem; color: var(--muted); }
.inwrap { position: relative; }
.inp { width: 100%; min-height: 48px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--edge); border-radius: 12px; color: var(--text); font-size: 16px; outline: none; }
textarea.inp { min-height: 120px; resize: none; line-height: 1.45; }
.inp:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.inp.mono { font-family: var(--mono); }
.inp.has-btn { padding-right: 76px; }
.inp::placeholder { color: var(--muted); opacity: .8; }
.inbtn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-height: 44px; min-width: 60px; color: var(--accent); font-weight: 600; font-size: .94rem; text-align: center; }
.hint { margin: 0; font-size: .94rem; color: var(--muted); }
.err { margin: 0; color: var(--danger); font-size: .94rem; }
.callout { margin: 0 0 14px; padding: 10px 12px 10px 14px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 9%, transparent); border-radius: 12px; font-size: .94rem; display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.callout p { margin: 0; }
.callout.err { border-color: color-mix(in srgb, var(--danger) 60%, transparent); background: color-mix(in srgb, var(--danger) 12%, transparent); color: #f2b8b8; }

.btn { min-height: 48px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; display: flex; align-items: center; justify-content: center; font-size: 1rem; color: var(--text); text-align: center; width: 100%; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.red { background: var(--danger); border-color: var(--danger); color: var(--accent-ink); }
.btn.small { min-height: 44px; padding: 0 14px; width: auto; flex: none; }
.btn.danger-ghost { background: transparent; border-color: transparent; color: var(--danger); margin-top: 20px; }
.btn[disabled] { opacity: .55; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.words { font: 500 1.375rem/1.4 var(--mono); padding: 18px 16px; background: var(--surface); border-radius: var(--r); word-spacing: .2em; min-height: 92px; overflow-wrap: anywhere; }
.write-list { background: var(--surface); border-radius: var(--r); }
.write-list > div { padding: 12px 14px; display: grid; grid-template-columns: 22px 1fr; gap: 8px; }
.write-list > div + div { border-top: 1px solid var(--line); }
.write-list b.n { font: 600 .94rem var(--mono); color: var(--accent); }
.write-list .v { display: block; font: 500 1rem/1.4 var(--mono); color: var(--text); margin-top: 2px; overflow-wrap: anywhere; }
.write-list small { display: block; color: var(--muted); font-size: .94rem; margin-top: 2px; }

.search { margin-bottom: 10px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; }
.seg.two { grid-template-columns: 1fr 1fr; background: var(--surface); }
.seg button { min-height: 44px; border-radius: 9px; color: var(--muted); font-size: .94rem; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.seg button[aria-pressed=true] { background: var(--surface-2); color: var(--text); font-weight: 600; }
.seg.filter { grid-template-columns: repeat(5, 1fr); background: var(--surface); margin-bottom: 12px; }
.seg.filter button { min-height: 48px; font-size: .94rem; line-height: 1.2; }
.seg.filter small { font-size: .94rem; color: var(--muted); font-weight: 400; margin-top: 2px; }
.seg.filter button[aria-pressed=true] small { color: var(--text); }
.seg.filter.dim small { opacity: .35; }

.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r); overflow: hidden; }
.list li + li .row { border-top: 1px solid var(--line); }
.row { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 14px; text-align: left; }
.row:active { background: var(--surface-2); }
.mono-badge { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; font-weight: 700; background: color-mix(in srgb, var(--tc) 18%, transparent); color: var(--tc); }
.t-login { --tc: var(--login); } .t-card { --tc: var(--card); } .t-id { --tc: var(--id); } .t-note { --tc: var(--note); }
.row-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: .94rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub b { font-weight: 400; color: var(--text); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; margin: 0; }
.fab { position: absolute; right: 20px; bottom: calc(24px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 30px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.45); z-index: 3; }
.fab svg.i { width: 28px; height: 28px; stroke-width: 2.2; }

.detail-head { padding: 8px 0 16px; }
.detail-head h2 { margin: 6px 0 0; font-size: 1.62rem; line-height: 1.2; overflow-wrap: anywhere; }
.badge { font-size: .94rem; font-weight: 600; color: var(--tc); text-transform: uppercase; letter-spacing: .06em; }
.card { background: var(--surface); border-radius: var(--r); }
.frow { padding: 12px 14px; }
.frow + .frow { border-top: 1px solid var(--line); }
.flabel { font-size: .94rem; color: var(--muted); }
.fval { margin: 2px 0 8px; overflow-wrap: anywhere; white-space: pre-wrap; }
.fval.secret { font-family: var(--mono); letter-spacing: .02em; }
.factions { display: flex; gap: 8px; flex-wrap: wrap; }
.factions.tight { margin-top: -4px; }
.fbtn { min-height: 44px; padding: 0 14px; font-size: .94rem; display: inline-flex; align-items: center; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; color: var(--text); text-decoration: none; }
.meta { color: var(--muted); font-size: .94rem; text-align: center; margin: 16px 0 0; }
.cfield-head { display: flex; justify-content: space-between; align-items: center; }
.cfield-head .text-btn { color: var(--danger); font-size: .94rem; }

.grp { background: var(--surface); border-radius: var(--r); }
.grow { min-height: 52px; padding: 4px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; }
.grow + .grow { border-top: 1px solid var(--line); }
.grow.act { color: var(--accent); font-weight: 600; }
.grow.act .hint { font-weight: 400; }
.grow.info { color: var(--muted); font-size: .94rem; }
.grow.col { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; padding: 8px 16px; }
.section { margin: 20px 4px 8px; font-size: 1rem; color: var(--muted); font-weight: 600; }
.privacy { font-size: .94rem; color: var(--muted); margin: 14px 4px 0; line-height: 1.45; }

.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { width: 100%; max-width: 560px; background: var(--surface); border-radius: 20px 20px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; max-height: 92%; overflow-y: auto; }
.sheet h2 { margin: 0 0 2px; font-size: 1.25rem; outline: none; }
.sheet p { margin: 0; }
.pick { text-align: left; padding: 12px 14px; min-height: 64px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 2px; }
.pick b { color: var(--tc, var(--text)); }
.pick.danger b { color: var(--danger); }
.pick span { font-size: .94rem; color: var(--muted); font-weight: 400; }
.infocard { background: var(--bg); border-radius: 12px; padding: 12px 14px; font-size: .94rem; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(100px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: .94rem; font-weight: 600; z-index: 30; width: max-content; max-width: calc(100vw - 32px); text-align: center; pointer-events: none; }
.undo { position: absolute; left: 16px; right: 92px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 8; background: var(--surface-2); border: 1px solid var(--edge); border-radius: 12px; padding: 4px 4px 4px 16px; display: flex; align-items: center; justify-content: space-between; overflow: hidden; font-size: .94rem; }
.undo .text-btn { font-weight: 700; }
.undo i, .warnbar i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); animation: shrink 10s linear forwards; }
.warnbar { position: fixed; left: 16px; right: 16px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 25; margin: 0; overflow: hidden; background: #241f15; color: var(--text); text-align: left; padding: 12px 14px; max-width: 528px; margin-inline: auto; }
@keyframes shrink { from { width: 100%; } to { width: 0; } }

.cover { display: none; position: fixed; inset: 0; background: var(--bg); z-index: 40; place-items: center; }
body.covered .cover { display: grid; }
@media (prefers-reduced-motion: reduce) { .undo i, .warnbar i { animation: none; width: 50%; } }

/* photos */
.prow { justify-content: flex-start; gap: 12px; padding-top: 8px; padding-bottom: 8px; }
.plate { width: 56px; height: 36px; flex: none; border-radius: 6px; border: 1.5px dashed var(--edge); display: grid; place-items: center; color: var(--accent); }
.plate svg.i { width: 18px; height: 18px; }
.plate.pulse { border-style: solid; background: var(--surface-2); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .plate.pulse { animation: none; } }
.thumb { width: 56px; height: 36px; flex: none; border-radius: 6px; object-fit: cover; }
.thumb, .vimg { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
.grow.prow[disabled] { opacity: .5; }
.text-btn.red { color: var(--danger); }
.viewer { background: #000; }
.vwrap { flex: 1; overflow: hidden; touch-action: none; position: relative; }
.vimg { display: block; width: 100%; height: 100%; object-fit: contain; }
.vwait { text-align: center; margin-top: 40%; }
.viewer .foot { background: #000; flex-direction: row; }
