/* Luma — app styles. Semantic tokens only (token law): colors come from
   design/theme.css, scales from design/tokens.css. The lantaarn world:
   quiet, warm, one thing at a time. */

html { height: 100%; }
body {
  min-height: 100%;
  line-height: 1.5;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}

.wrap { max-width: 640px; margin: 0 auto; padding: 0 18px; }

/* ---- top bar ---- */
header.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
header.top .wrap { display: flex; align-items: center; gap: 10px; height: 58px; }
.brand {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 800; letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 9px;
}
.brand .lamp {
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--amber-soft), var(--amber) 70%);
  box-shadow: 0 0 12px rgba(201, 138, 58, 0.55);
}
.brand .tag { font-family: var(--font-body); font-size: 12px; font-weight: 400; color: var(--muted); }

/* ---- views ---- */
.view { display: none; }
.view.active { display: block; }
.view-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 4px; }
.view-head h1 { font-family: var(--font-display); font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.view-head .sub { color: var(--muted); font-size: 13.5px; }
.back {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-soft); font-size: 14px; padding: 6px 0; min-height: var(--tap-min);
}
.back:hover { color: var(--ink); }

h2.sec {
  font-family: var(--font-display);
  font-size: 16.5px; font-weight: 700; margin: 22px 0 10px;
}
h2.sec .mut { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: 6px; }

/* ---- cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  padding: 16px;
  margin-bottom: 12px;
}
.card.pressable { cursor: pointer; transition: transform 0.16s var(--ease-pop), box-shadow 0.16s ease; text-align: left; width: 100%; }
.card.pressable:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.card h3 { font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.card .mut { color: var(--muted); font-size: 13px; }
.card .soft { color: var(--ink-soft); font-size: 14.5px; }

/* ---- capture bar ---- */
.capture { margin: 16px 0 6px; }
.capture .row { display: flex; gap: 8px; }
.capture input[type="text"] {
  flex: 1; min-height: var(--tap-min);
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 10px 14px;
}
.capture input[type="text"]:focus { outline: none; border-color: var(--accent); }
.capture input[type="text"]::placeholder { color: var(--muted); }
.chips { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 9px; align-items: center; }
.chip {
  font-size: 13px; color: var(--ink-soft);
  background: var(--surface);
  border: 1.5px solid var(--line-2);
  border-radius: 999px;
  padding: 6px 13px; min-height: 32px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); font-weight: 600; }
.chip.first-chip.on { background: var(--amber-soft); border-color: var(--amber); color: var(--ink); }
.chip.small { font-size: 12px; padding: 4px 10px; min-height: 28px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-md);
  padding: 11px 16px; min-height: var(--tap-min);
  font-size: 15px; font-weight: 600;
  transition: background 0.14s, border-color 0.14s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--surface); }
.btn.primary:hover { background: var(--accent-deep); }
.btn.ghost { background: var(--surface); border: 1.5px solid var(--line-2); color: var(--ink); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-deep); }
.btn.danger { background: var(--surface); border: 1.5px solid var(--line-2); color: var(--ink-soft); }
.btn.small { padding: 7px 12px; min-height: 34px; font-size: 13.5px; }

/* ---- today ---- */
.next-card { display: flex; flex-direction: column; gap: 6px; }
.next-card .who { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-deep); font-weight: 700; }
.dinner { border-left: 3px solid var(--amber); padding-left: 12px; margin-top: 10px; }
.dinner .w { font-weight: 600; }
.rhythm { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.rhythm .app-name { width: 92px; font-size: 14px; color: var(--ink-soft); }
.rhythm .dots { display: flex; gap: 7px; }
.rhythm .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); }
.rhythm .dot.played { background: var(--accent); border-color: var(--accent); }
.rhythm .quiet-note { font-size: 12.5px; color: var(--muted); }
.reflect-link { display: inline-flex; align-items: center; gap: 8px; color: var(--accent-deep); font-size: 14.5px; font-weight: 600; padding: 8px 0; }
.reflect-link .rdot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }

/* ---- children / child view ---- */
.child-cards { display: grid; grid-template-columns: 1fr; gap: 12px; }
.child-card { display: flex; align-items: center; gap: 14px; }
.avatar {
  flex: none; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-deep);
  font-family: var(--font-display); font-weight: 800; font-size: 19px;
}
.alive {
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-md);
  padding: 13px 15px;
  color: var(--ink);
  font-size: 14.5px;
  margin: 12px 0;
}
.alive .lbl { font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent-deep); font-weight: 700; display: block; margin-bottom: 4px; }
.domain-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.domain-card { padding: 13px 14px; }
.domain-card h4 { font-family: var(--font-display); font-size: 14.5px; font-weight: 700; }
.domain-card .en { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 6px; }
.domain-card .last { font-size: 12.5px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.firsts { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 10px; -webkit-overflow-scrolling: touch; }
.first-card {
  flex: none; width: 190px;
  background: var(--surface);
  border: 1px solid var(--amber-soft);
  border-top: 3px solid var(--amber);
  border-radius: var(--r-md);
  box-shadow: var(--sh-1);
  padding: 11px 13px; font-size: 13.5px;
}
.first-card .d { color: var(--muted); font-size: 11.5px; margin-top: 5px; }

/* ---- moments ---- */
.moment { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.moment:last-child { border-bottom: none; }
.moment .mark { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; background: var(--accent); }
.moment.is-first .mark { background: var(--amber); box-shadow: 0 0 8px rgba(201, 138, 58, 0.5); }
.moment .body { flex: 1; min-width: 0; }
.moment .text { font-size: 15px; }
.moment .meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.moment .tools { display: flex; gap: 4px; opacity: 0.75; }
.moment .tools button { color: var(--muted); font-size: 12.5px; padding: 4px 7px; min-height: 30px; }
.moment .tools button:hover { color: var(--ink); }

/* ---- watch-fors ---- */
.wf { padding: 12px 0; border-bottom: 1px solid var(--line); }
.wf:last-child { border-bottom: none; }
.wf .row { display: flex; align-items: flex-start; gap: 10px; }
.wf .txt { flex: 1; font-size: 14.5px; }
.wf .note { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.wf .src { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: none; }
.wf.show-src .src { display: block; }
.wf .after { font-size: 13px; color: var(--ink-soft); font-style: italic; margin-top: 4px; }
.dont-wait { font-size: 13px; color: var(--ink-soft); background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; margin-top: 10px; }

/* ---- vocab ---- */
.vocab { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 4px; }
.vocab .stat { background: var(--surface-2); border-radius: var(--r-md); padding: 10px 14px; }
.vocab .stat b { font-family: var(--font-display); font-size: 19px; display: block; }
.vocab .stat.bridge { background: var(--amber-soft); }
.vocab .stat span { font-size: 12px; color: var(--ink-soft); }
.evidence { font-size: 11.5px; color: var(--muted); }
details.context { margin-top: 10px; }
details.context summary { font-size: 13.5px; color: var(--accent-deep); cursor: pointer; min-height: var(--tap-min); display: flex; align-items: center; }
details.context .inner { font-size: 13.5px; color: var(--ink-soft); padding: 6px 0; }

/* ---- reflection ---- */
.reflect-sentence { font-family: var(--font-display); font-size: 18px; font-weight: 700; line-height: 1.35; }
textarea.note {
  width: 100%; min-height: 74px;
  font: inherit; font-size: 14.5px; color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 10px 13px;
  resize: vertical;
}
textarea.note:focus { outline: none; border-color: var(--accent); }

/* ---- import / settings ---- */
textarea.paste {
  width: 100%; min-height: 110px;
  font: 12.5px ui-monospace, Menlo, monospace;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-md);
  padding: 10px 13px;
}
textarea.paste:focus { outline: none; border-color: var(--accent); }
.msg { font-size: 13.5px; padding: 10px 13px; border-radius: var(--r-sm); margin: 10px 0; display: none; }
.msg.show { display: block; }
.msg.ok { background: var(--good-soft); color: var(--ink); }
.msg.err { background: var(--surface-2); color: var(--ink-soft); }
.staleness { font-size: 13px; color: var(--ink-soft); }
.field { margin: 12px 0; }
.field label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 5px; }
.field input[type="text"], .field input[type="date"], .field select {
  width: 100%; min-height: var(--tap-min);
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 9px 13px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: none; }

/* ---- empty states ---- */
.empty { text-align: center; color: var(--muted); font-size: 14px; padding: 26px 18px; }
.empty .big { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--ink-soft); display: block; margin-bottom: 5px; }

/* ---- bottom nav ---- */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
nav.tabs .wrap { display: flex; max-width: 640px; margin: 0 auto; }
nav.tabs button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 7px; min-height: 56px;
  color: var(--muted); font-size: 11px;
}
nav.tabs button svg { width: 22px; height: 22px; }
nav.tabs button.on { color: var(--accent-deep); }

@media (min-width: 700px) {
  .domain-grid { grid-template-columns: 1fr 1fr 1fr; }
  .child-cards { grid-template-columns: 1fr 1fr; }
}
