/* Harimu — sage, olive and coral, taken from the badge.
   Light and dark are both first-class; :root[data-theme] is stamped before
   first paint by the script in index.html. */

:root {
  --bg: #fbf9f3;
  --bg-soft: #f2efe3;
  --surface: #ffffff;
  --surface-2: #f7f5ec;
  --line: #e4e0d0;
  --text: #2b2e27;
  --muted: #767c6a;

  --deep: #44523b;        /* badge ring + mountain */
  --olive: #8b9b5b;       /* hills */
  --coral: #e08a73;       /* sun + blossom */
  --coral-soft: #fbe7e0;

  --accent: #4f7a46;      /* primary action, toggles */
  --accent-text: #ffffff;
  --accent-soft: #e6eddf;
  --good: #4f8a55;
  --warn: #b5822a;
  --danger: #be4e38;

  /* Categorical series colours for the spending breakdown. Fixed order, never
     cycled — slot is chosen by category identity, never by rank, so a filter
     that changes the slice count cannot repaint the survivors. Validated with
     the dataviz palette checker against this surface: lightness band, chroma
     floor, CVD separation and normal-vision floor all pass. Do not "tidy" these
     into brand greens — three greens side by side is the worst case for
     red-green colour blindness, which is why the mockup's palette isn't used. */
  --c1: #d5643f;  /* Food */
  --c2: #0086a8;  /* Transport */
  --c3: #8fa13c;  /* Groceries */
  --c4: #7a4e9e;  /* Bills */
  --c5: #1f7a32;  /* Health */
  --c6: #3b6fd4;  /* Shopping */
  --c7: #d9a319;  /* Family */
  --c8: #c63c74;  /* Other named */
  --c-other: #8a8f80;   /* the folded "Others" tail — neutral, not a 9th hue */

  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(43, 46, 39, .05), 0 8px 24px rgba(43, 46, 39, .05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

:root[data-theme="dark"] {
  --bg: #171a14;
  --bg-soft: #1e2219;
  --surface: #232821;
  --surface-2: #1b1f18;
  --line: #353b2f;
  --text: #ecefe4;
  --muted: #9aa28d;

  --deep: #b3c49c;
  --olive: #9dae68;
  --coral: #e8927c;
  --coral-soft: #34241f;

  --accent: #74a86e;
  --accent-text: #12190f;
  --accent-soft: #26301f;
  --good: #6fb073;
  --warn: #d9a950;
  --danger: #e5806b;

  /* Dark mode is SELECTED, not an automatic flip — its own steps from the same
     hues, re-validated against the dark surface (band L 0.48–0.67). */
  --c1: #de7050;
  --c2: #2496af;
  --c3: #7e8f3c;
  --c4: #9269c0;
  --c5: #3d9450;
  --c6: #5e88e0;
  --c7: #b08a1e;
  --c8: #d2557f;
  --c-other: #9aa08f;

  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 26px rgba(0, 0, 0, .3);
}

/* Learned the hard way twice: a `.modal{display:flex}` rule beats the `hidden`
   attribute and leaves an invisible layer swallowing every tap. Keep this. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0; line-height: 1.25; }
button { font: inherit; }

.app { max-width: 1180px; margin: 0 auto; }

/* ---------------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: max(.65rem, env(safe-area-inset-top)) 1rem .65rem;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.brand-logo { width: 36px; height: 36px; flex: none; display: block; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong {
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 500;
  letter-spacing: .01em;
  line-height: 1.1;
}
.brand-text small {
  color: var(--muted);
  font-size: .62rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}

/* The 春日 seal from the lockup. Decorative, so it is hidden from screen
   readers and dropped entirely on narrow screens. */
.stamp {
  display: none;
  flex: none;
  margin-left: .3rem;
  padding: .18rem .3rem;
  border: 1.5px solid var(--coral);
  border-radius: 5px;
  color: var(--coral);
  font-size: .62rem;
  line-height: 1.05;
  text-align: center;
  writing-mode: vertical-rl;
  letter-spacing: .06em;
}

.topbar-actions { margin-left: auto; display: flex; gap: .35rem; }

.icon-btn {
  width: 38px; height: 38px;
  flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
}
.icon-btn:active { transform: scale(.95); }
.icon-btn.is-plain { border-color: transparent; background: none; }

/* -------------------------------------------------------- shell & sidebar */

.shell { display: block; }

.sidebar { display: none; }

.side-link {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .6rem .8rem;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font-size: .93rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.side-link:hover { background: var(--bg-soft); color: var(--text); }
.side-link[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--deep);
  font-weight: 600;
}
.side-link .ico { flex: none; width: 1.2rem; text-align: center; }
.side-link .count {
  margin-left: auto;
  padding: 0 .4rem;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
}
.side-sep { height: 1px; margin: .6rem .3rem; background: var(--line); }

/* A whisper of the badge at the foot of the sidebar, like the lockup's
   landscape. Purely decorative. */
.side-deco {
  margin-top: auto;
  height: 130px;
  background: no-repeat bottom center / 150% auto url("brand/logo-mark.png");
  opacity: .1;
  pointer-events: none;
}

.view { padding: 1rem; }
.view:focus { outline: none; }

@media (min-width: 900px) {
  .shell {
    display: grid;
    grid-template-columns: 226px minmax(0, 1fr);
    gap: 1.4rem;
    align-items: start;
    padding: 1.2rem 1rem;
  }
  .sidebar {
    position: sticky;
    top: 5rem;
    display: flex;
    flex-direction: column;
    gap: .1rem;
    min-height: 70vh;
    padding: .8rem .6rem 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .view { padding: 0; }
  .stamp { display: block; }
  .only-mobile { display: none !important; }
}

/* ------------------------------------------------------------- greeting */

.hello {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.hello-text { flex: 1; min-width: 12rem; }
.hello h1 { font-size: 1.4rem; letter-spacing: -.01em; }
.hello p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }

/* ------------------------------------------------------------- widgets */

.widgets {
  display: grid;
  gap: .9rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 268px), 1fr));
}

.widget {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.widget-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .75rem .9rem .5rem;
}
.widget-head .ico {
  display: grid; place-items: center;
  width: 26px; height: 26px;
  flex: none;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--deep);
  font-size: .9rem;
}
.widget-head h2 { font-size: .96rem; font-weight: 600; }
.widget-head .more {
  margin-left: auto;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0; border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
}
.widget-head .more:hover { background: var(--bg-soft); }

.widget-body { padding: 0 .9rem; }
.widget-foot { margin-top: auto; padding: .5rem .9rem .8rem; }
.widget-link {
  border: 0;
  padding: .25rem 0;
  background: none;
  color: var(--accent);
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
}
.widget-link:hover { text-decoration: underline; }

/* compact rows inside a widget */
.wrow {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  padding: .34rem 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.wrow-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.wrow-right { flex: none; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.wrow.is-done .wrow-title { color: var(--muted); text-decoration: line-through; }
.wrow .dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--coral); }

.tick {
  flex: none;
  width: 19px; height: 19px;
  display: grid; place-items: center;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: transparent;
  font-size: .64rem;
  cursor: pointer;
  padding: 0;
}
.tick.is-square { border-radius: 5px; }
.tick[aria-pressed="true"] { background: var(--good); border-color: var(--good); color: #fff; }

.wdate { display: flex; gap: .5rem; align-items: baseline; padding: .1rem 0 .35rem; }
.wdate b { font-size: .88rem; }
.wdate span { color: var(--muted); font-size: .8rem; }

.note-preview {
  padding: .6rem .7rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.note-preview b { display: block; font-size: .88rem; margin-bottom: .15rem; }
.note-preview p {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --------------------------------------------------------- habit grid */

.habit-grid { display: grid; grid-template-columns: 1fr auto; gap: .1rem .6rem; align-items: center; }
.habit-days { display: flex; gap: .3rem; }
.habit-days span {
  width: 13px;
  color: var(--muted);
  font-size: .6rem;
  text-align: center;
  text-transform: uppercase;
}
.habit-name { font-size: .87rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.habit-dots { display: flex; gap: .3rem; }
.habit-dots i {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: transparent;
}
.habit-dots i.on { background: var(--accent); border-color: var(--accent); }
.habit-dots i.today { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }

/* ------------------------------------------------------------- donut */

.spend-total { padding: .1rem 0 .5rem; }
.spend-total small { display: block; color: var(--muted); font-size: .74rem; }
.spend-total b { font-size: 1.32rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.donut-row { display: flex; align-items: center; gap: .8rem; }
.donut { flex: none; width: 96px; height: 96px; }

/* The legend is also the table view: every slice is named AND carries its
   value, so identity is never colour-alone — which is what discharges the
   contrast warning on the lighter series steps. */
.legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .18rem; }
.legend-row { display: flex; align-items: center; gap: .4rem; font-size: .78rem; }
.legend-row i { flex: none; width: 9px; height: 9px; border-radius: 3px; }
.legend-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.legend-row b { flex: none; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------- cards on module pages */

.page-head { margin-bottom: 1rem; }
.page-head h1 { font-size: 1.35rem; }
.page-head p { margin: .25rem 0 0; color: var(--muted); font-size: .88rem; }

.card {
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card > h2 {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.card > h2 .grow { margin-left: auto; text-transform: none; letter-spacing: 0; }

.row {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  width: 100%;
  padding: .72rem 1rem;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.row:first-of-type, .card > h2 + .row { border-top: 0; }
.row:active { background: var(--bg-soft); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; font-weight: 500; overflow-wrap: anywhere; }
.row-sub { display: block; margin-top: .12rem; color: var(--muted); font-size: .81rem; overflow-wrap: anywhere; }
.row-right { flex: none; color: var(--muted); font-size: .84rem; font-variant-numeric: tabular-nums; text-align: right; }
.row.is-done .row-title { color: var(--muted); text-decoration: line-through; }

.check {
  flex: none;
  width: 21px; height: 21px;
  margin-top: .12rem;
  display: grid; place-items: center;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: transparent;
  font-size: .74rem;
  cursor: pointer;
  padding: 0;
}
.check[aria-pressed="true"] { background: var(--good); border-color: var(--good); color: #fff; }

.pill {
  display: inline-block;
  padding: .1rem .45rem;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: .71rem;
  font-weight: 600;
}
.pill.is-late { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.pill.is-accent { background: var(--coral-soft); color: color-mix(in srgb, var(--coral) 75%, var(--text)); }

/* ----------------------------------------------------------- buttons */

.btn {
  padding: .55rem .9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  cursor: pointer;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-danger { background: none; border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); color: var(--danger); }
.btn-pill { border-radius: 999px; }
.btn-block { display: block; width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }

.add-bar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.add-bar input { flex: 1; min-width: 0; }

/* ------------------------------------------- list chips (shopping lists) */

.chips {
  display: flex;
  gap: .4rem;
  margin-bottom: .8rem;
  padding-bottom: .2rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  padding: .38rem .75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .84rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.chip.is-add { border-style: dashed; color: var(--accent); }

/* ------------------------------------------------------------- photos */

/* Thumbnail on a list row. */
.thumb {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-soft);
}

/* Preview inside the edit sheet. */
.photo-preview {
  display: block;
  width: 100%;
  max-height: 210px;
  margin-bottom: .5rem;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-soft);
}

/* The sync code, shown for copying or reading aloud. */
.code-box {
  display: block;
  padding: .55rem .7rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .84rem;
  letter-spacing: .06em;
  word-break: break-all;
  user-select: all;
}

.sheet-note {
  margin: 0 0 .7rem;
  padding: 0 .9rem;
  color: var(--muted);
  font-size: .84rem;
}

/* ------------------------------------------------------------ forms */

input, select, textarea {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px;
  border-color: var(--accent);
}
textarea { min-height: 5rem; resize: vertical; }

.field { margin-bottom: .8rem; }
.field > label { display: block; margin-bottom: .3rem; color: var(--muted); font-size: .78rem; font-weight: 600; }
.field-pair { display: flex; gap: .5rem; }
.field-pair > .field { flex: 1; }
.check-field { display: flex; align-items: center; gap: .5rem; }
.check-field input { width: auto; }
.check-field label { margin: 0; color: var(--text); font-size: .93rem; font-weight: 400; }

/* ------------------------------------------- Settings → feature cards */

.toggle-grid {
  display: grid;
  gap: .7rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 158px), 1fr));
  padding: .9rem;
}
.tcard {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  padding: .75rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.tcard[data-on="false"] { background: var(--coral-soft); border-color: color-mix(in srgb, var(--coral) 28%, var(--line)); }
.tcard .ico { font-size: 1.1rem; color: var(--deep); }
.tcard-name { font-size: .9rem; font-weight: 600; }
.tcard-blurb { color: var(--muted); font-size: .74rem; }
.tcard-foot { display: flex; align-items: center; margin-top: auto; }
.tcard-foot .switch { margin-left: auto; }

.switch {
  position: relative;
  flex: none;
  width: 44px; height: 26px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 40%, transparent);
  cursor: pointer;
  transition: background .15s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .15s;
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }

/* ------------------------------------------------------ empty states */

.empty { padding: 1.1rem .2rem; color: var(--muted); text-align: center; }
.empty .big { display: block; margin-bottom: .3rem; font-size: 1.4rem; opacity: .65; }
.empty p { margin: 0; font-size: .85rem; }

/* ------------------------------------------------- bottom nav & FAB */

.bottomnav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  padding: .3rem .2rem max(.3rem, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  padding: .35rem .1rem;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: .63rem;
  cursor: pointer;
}
.bnav-item .ico { font-size: 1.05rem; line-height: 1.1; }
.bnav-item[aria-current="page"] { color: var(--accent); font-weight: 700; }

.fab {
  position: fixed;
  right: 1rem;
  bottom: calc(4.4rem + env(safe-area-inset-bottom));
  z-index: 31;
  width: 54px; height: 54px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.6rem;
  line-height: 1;
  box-shadow: 0 4px 16px rgba(43, 46, 39, .26);
  cursor: pointer;
}
.fab:active { transform: scale(.94); }

body { padding-bottom: calc(4.2rem + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
  body { padding-bottom: 2rem; }
  .bottomnav, .fab { display: none; }
}

/* ---------------------------------------------------- sheet & popover */

.sheet {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(20, 24, 18, .45);
}
.sheet-card {
  width: 100%;
  max-width: 460px;
  max-height: 84vh;
  overflow-y: auto;
  padding: .5rem .5rem max(1rem, env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: var(--surface);
}
.sheet-grip { width: 40px; height: 4px; margin: .4rem auto .5rem; border-radius: 999px; background: var(--line); }
.sheet-title { padding: .2rem .7rem .5rem; color: var(--muted); font-size: .76rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.sheet-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  padding: .7rem .8rem;
  border: 0;
  border-radius: 10px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sheet-item:active { background: var(--bg-soft); }
.sheet-item .ico { flex: none; width: 1.4rem; text-align: center; }
@media (min-width: 560px) {
  .sheet { align-items: center; padding: 1rem; }
  .sheet-card { border-radius: 18px; }
  .sheet-grip { display: none; }
}

.menu {
  position: fixed;
  z-index: 75;
  min-width: 170px;
  padding: .3rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.menu button {
  display: block;
  width: 100%;
  padding: .5rem .6rem;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font-size: .88rem;
  text-align: left;
  cursor: pointer;
}
.menu button:hover { background: var(--bg-soft); }

/* -------------------------------------------------------------- modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(20, 24, 18, .45);
}
.modal-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  border-radius: 18px 18px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}
@media (min-width: 560px) {
  .modal { align-items: center; padding: 1rem; }
  .modal-card { border-radius: 18px; }
}
.modal-head { display: flex; align-items: center; gap: .5rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.02rem; }
.modal-head .icon-btn { margin-left: auto; }
.modal-body { padding: 1rem; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; gap: .5rem;
  padding: .8rem 1rem max(.8rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.modal-foot .spacer { flex: 1; }

/* -------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(5.4rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90;
  max-width: calc(100% - 2rem);
  padding: .6rem 1rem;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: .86rem;
  box-shadow: var(--shadow);
}
@media (min-width: 900px) { .toast { bottom: 1.5rem; } }

/* -------------------------------------------------------------- quote */

.quote {
  margin: 1.6rem 0 .5rem;
  color: var(--muted);
  font-size: .82rem;
  text-align: center;
}
.quote .jp { display: block; margin-top: .15rem; font-size: .74rem; opacity: .8; }
.build-tag { margin: .6rem 0 0; color: var(--muted); font-size: .68rem; text-align: center; opacity: .7; }
