/* Unlocked — after-dark design language.
   Deep ink & plum surfaces, ember accent, serif display voice.
   System fonts only: no third-party requests, ever. */

:root {
  --bg: #120d1a;
  --bg-raised: #1a1326;
  --bg-elevated: #221a31;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --ink: #f2ecf7;
  --ink-dim: #b6a9c9;
  --ink-faint: #7d7090;
  --ember: #ff4d6d;
  --ember-deep: #c9184a;
  --ember-soft: rgba(255, 77, 109, 0.14);
  --gold: #ffb454;
  --gold-soft: rgba(255, 180, 84, 0.14);
  --calm: #7bd88f;
  --calm-soft: rgba(123, 216, 143, 0.13);
  --steam: #b487f0;
  --radius: 18px;
  --radius-sm: 12px;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --nav-h: calc(64px + env(safe-area-inset-bottom, 0px));
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
body::before { /* faint ember glow up top; pure CSS, no image assets */
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(60% 30% at 50% -5%, rgba(201, 24, 74, 0.18), transparent 70%),
    radial-gradient(40% 25% at 90% 110%, rgba(180, 135, 240, 0.08), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
#app { position: relative; z-index: 1; min-height: 100%; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--ink);
  background: var(--bg-elevated);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  width: 100%;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--ember); }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
label { display: block; font-size: 13px; color: var(--ink-dim); margin: 14px 0 6px; }
a { color: var(--ember); text-decoration: none; }

/* ── boot splash ── */
.boot-splash { min-height: 100vh; display: grid; place-items: center; }
.boot-mark {
  width: 74px; height: 74px; border-radius: 22px;
  background: linear-gradient(140deg, var(--ember-deep), var(--ember));
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 40px; font-weight: 700;
  box-shadow: 0 8px 40px rgba(201, 24, 74, 0.4);
}

/* ── layout ── */
.screen { max-width: 560px; margin: 0 auto; padding: 20px 18px calc(var(--nav-h) + 28px); }
.screen.no-nav { padding-bottom: 40px; }
.page-title { font-family: var(--font-display); font-size: 28px; font-weight: 700; letter-spacing: 0.2px; }
.page-sub { color: var(--ink-dim); font-size: 14px; margin-top: 4px; }
.section-label {
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint); margin: 26px 0 10px; font-weight: 600;
}

/* ── bottom nav ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  height: var(--nav-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(18, 13, 26, 0.92);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr);
  max-width: 100%;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--ink-faint); font-size: 10.5px; font-weight: 600;
}
.nav-item .nav-ico { font-size: 21px; line-height: 1; filter: grayscale(1) opacity(0.75); }
.nav-item.active { color: var(--ink); }
.nav-item.active .nav-ico { filter: none; }
.nav-item.nav-send { position: relative; top: -14px; }
.nav-item.nav-send .nav-ico {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(140deg, var(--ember-deep), var(--ember));
  display: grid; place-items: center; font-size: 24px; filter: none;
  box-shadow: 0 6px 24px rgba(201, 24, 74, 0.5);
}

/* ── cards & lists ── */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card.tappable:active { transform: scale(0.985); }
.card-row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-dim); font-size: 13.5px; }
.faint { color: var(--ink-faint); font-size: 12.5px; }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em;
  padding: 3px 9px; border-radius: 999px;
  background: var(--bg-elevated); color: var(--ink-dim);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.chip.playful { color: var(--calm); background: var(--calm-soft); border-color: transparent; }
.chip.steamy { color: var(--steam); background: rgba(180, 135, 240, 0.14); border-color: transparent; }
.chip.wild { color: var(--ember); background: var(--ember-soft); border-color: transparent; }
.chip.gold { color: var(--gold); background: var(--gold-soft); border-color: transparent; }
.chip.blocked { color: var(--ink-faint); text-decoration: line-through; }
.chip.status-sent { color: var(--ink-dim); }
.chip.status-revealed { color: var(--steam); }
.chip.status-accepted { color: var(--gold); }
.chip.status-completed { color: var(--calm); }
.chip.status-passed { color: var(--ink-faint); }

/* ── buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 14px; padding: 13px 20px;
  font-weight: 700; font-size: 15px;
  background: var(--bg-elevated); border: 1px solid var(--line-strong);
  transition: transform 0.06s ease;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(140deg, var(--ember-deep), var(--ember));
  border: none; box-shadow: 0 4px 18px rgba(201, 24, 74, 0.35);
}
.btn.subtle { background: transparent; border-color: var(--line); color: var(--ink-dim); }
.btn.danger { color: var(--ember); border-color: rgba(255, 77, 109, 0.35); background: transparent; }
.btn.block { width: 100%; }
.btn.small { padding: 8px 14px; font-size: 13.5px; border-radius: 11px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }

/* segmented control + option chips */
.seg { display: flex; background: var(--bg-elevated); border: 1px solid var(--line); border-radius: 13px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 9px 6px; border-radius: 10px; font-weight: 700; font-size: 13.5px; color: var(--ink-faint); }
.seg button.active { background: var(--bg-raised); color: var(--ink); border: 1px solid var(--line-strong); }
.opt-row { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  padding: 9px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--line-strong); color: var(--ink-dim); background: var(--bg-elevated);
}
.opt.active { border-color: var(--ember); color: var(--ink); background: var(--ember-soft); }

/* ── hero (home greeting) ── */
.hero { margin: 6px 0 20px; }
.hero .hello { font-family: var(--font-display); font-size: 30px; font-weight: 700; }
.hero-chips { display: flex; gap: 8px; margin-top: 10px; }

/* inbox teaser item */
.teaser-item { position: relative; overflow: hidden; }
.teaser-item.unread::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--ember-deep), var(--ember));
}
.teaser-text { font-family: var(--font-display); font-size: 18px; line-height: 1.35; }
.locked-note { color: var(--gold); font-size: 13px; font-weight: 600; margin-top: 6px; }

/* ── sheets / modals ── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(8, 5, 12, 0.72);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fade-in 0.18s ease;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong); border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 14px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  animation: sheet-up 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 0 auto 14px; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── the reveal moment ── */
.reveal-stage { text-align: center; padding: 26px 6px 10px; }
.reveal-teaser { font-family: var(--font-display); font-size: 24px; line-height: 1.35; }
.reveal-from { color: var(--ink-dim); font-size: 14px; margin-top: 10px; }
.reveal-card {
  margin-top: 20px; text-align: left;
  background: linear-gradient(160deg, #241631, #1a1023);
  border: 1px solid rgba(255, 77, 109, 0.25);
  border-radius: 20px; padding: 22px;
  box-shadow: 0 12px 48px rgba(201, 24, 74, 0.18);
  animation: card-in 0.4s cubic-bezier(0.2, 0.9, 0.3, 1);
}
@keyframes card-in { from { transform: translateY(16px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.reveal-card h3 { font-family: var(--font-display); font-size: 22px; margin-bottom: 10px; }
.reveal-card .body { font-size: 16.5px; line-height: 1.55; white-space: pre-wrap; }
.reveal-meta { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.points-pop {
  text-align: center; font-family: var(--font-display);
  font-size: 20px; color: var(--gold); margin: 14px 0 4px;
  animation: card-in 0.35s ease;
}
.reaction-row { display: flex; gap: 10px; margin-top: 14px; }
.reaction-row .btn { flex: 1; flex-direction: column; gap: 2px; padding: 12px 6px; font-size: 12.5px; }
.reaction-row .emo { font-size: 22px; }

/* ── arc slots ── */
.arc-slot { display: flex; gap: 14px; align-items: flex-start; }
.arc-ico { font-size: 24px; width: 40px; height: 40px; border-radius: 12px; background: var(--bg-elevated); display: grid; place-items: center; flex-shrink: 0; }
.arc-empty { border-style: dashed; border-color: var(--line-strong); color: var(--ink-faint); }

/* ── progress ── */
.streak-hero {
  text-align: center; padding: 26px 16px;
  background: radial-gradient(80% 100% at 50% 0%, rgba(255, 180, 84, 0.12), transparent 75%), var(--bg-raised);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.streak-num { font-family: var(--font-display); font-size: 56px; font-weight: 700; line-height: 1; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat-cell { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; text-align: center; }
.stat-cell .n { font-family: var(--font-display); font-size: 26px; font-weight: 700; }
.ach-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ach { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; }
.ach.locked { opacity: 0.42; filter: grayscale(0.8); }
.ach .emo { font-size: 26px; }
.ach .name { font-weight: 700; font-size: 14px; margin-top: 6px; }

/* ── PIN lock ── */
.lock-screen {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; padding: 30px;
}
.pin-dots { display: flex; gap: 14px; height: 16px; }
.pin-dot { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--ink-faint); }
.pin-dot.filled { background: var(--ember); border-color: var(--ember); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px; }
.pin-key {
  width: 72px; height: 72px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid var(--line);
  font-size: 26px; font-weight: 600;
}
.pin-key:active { background: var(--ember-soft); }
.pin-shake { animation: shake 0.35s ease; }
@keyframes shake { 20% { transform: translateX(-8px); } 45% { transform: translateX(7px); } 70% { transform: translateX(-5px); } 90% { transform: translateX(3px); } }

/* ── toast ── */
#toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + 12px); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: var(--bg-elevated); border: 1px solid var(--line-strong);
  color: var(--ink); font-size: 14px; font-weight: 600;
  border-radius: 999px; padding: 11px 20px; max-width: 88%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  animation: card-in 0.25s ease;
}
.toast.error { border-color: rgba(255, 77, 109, 0.5); color: #ff8fa3; }

/* ── auth ── */
.auth-hero { text-align: center; padding: 50px 0 26px; }
.auth-hero .boot-mark { margin: 0 auto 18px; }
.auth-hero h1 { font-family: var(--font-display); font-size: 36px; }
.auth-hero p { color: var(--ink-dim); margin-top: 6px; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-pick .opt { text-align: center; padding: 14px; border-radius: var(--radius-sm); font-size: 15px; }

/* ── misc ── */
.empty-state { text-align: center; color: var(--ink-faint); padding: 44px 20px; }
.empty-state .emo { font-size: 40px; display: block; margin-bottom: 12px; }
.notice {
  background: var(--gold-soft); border: 1px solid rgba(255, 180, 84, 0.3);
  color: var(--gold); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 13.5px; margin: 12px 0;
}
.on-device {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--calm); font-size: 12.5px; font-weight: 700;
}
.switch { position: relative; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; z-index: 2; cursor: pointer; margin: 0; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--bg-elevated); border: 1px solid var(--line-strong); transition: background 0.15s; }
.switch .thumb { position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink-faint); transition: all 0.15s; }
.switch input:checked ~ .track { background: var(--ember-deep); border-color: transparent; }
.switch input:checked ~ .thumb { left: 24px; background: #fff; }
.spin { display: inline-block; width: 18px; height: 18px; border: 2.5px solid var(--line-strong); border-top-color: var(--ember); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; min-height: 130px; }
.list-divider { height: 1px; background: var(--line); margin: 14px 0; }
