/* Family Travel
   One type family, one spacing scale, one colour system, light and dark.
   Big type and big tap targets: readable for a child and a parent on an iPhone. */

:root {
  color-scheme: light dark;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #e8ecf0;
  --text: #16202a;
  --muted: #5a6573;
  --line: #d5dbe2;
  --accent: #c8102e;
  --accent-ink: #ffffff;
  --accent-soft: #fbe7ea;
  --danger: #b3261e;
  --radius: 16px;
  --gap: 16px;
  --tap: 56px;
  --tabbar: 68px;
  --max-width: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1319;
    --surface: #161e27;
    --surface-2: #202a35;
    --text: #f1f3f5;
    --muted: #a6b0bc;
    --line: #2b3643;
    --accent: #ff5a6e;
    --accent-ink: #1a0508;
    --accent-soft: #3a1820;
    --danger: #ff8a80;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang HK", "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.45;
}

main {
  width: min(var(--max-width), 100%);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(var(--tabbar) + env(safe-area-inset-bottom) + 24px);
}

h1 { font-size: 1.75rem; margin: 8px 0 4px; }
h2 { font-size: 1.25rem; margin: 24px 0 8px; }
p { margin: 0 0 8px; }
.lead { font-size: 1.2rem; }
.muted { color: var(--muted); }
.stack > * + * { margin-top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[lang="zh-HK"] { font-family: "PingFang HK", "Noto Sans HK", "Heiti TC", sans-serif; }

button, a.primary, a.secondary { font: inherit; }
button { color: inherit; }

.primary, .secondary {
  display: flex; align-items: center; justify-content: center;
  min-height: var(--tap); width: 100%;
  border-radius: var(--radius); border: 0; padding: 12px 20px;
  font-weight: 650; text-decoration: none; cursor: pointer;
}
.primary { background: var(--accent); color: var(--accent-ink); }
.secondary { background: var(--surface-2); color: var(--text); margin-top: 12px; }
.primary:disabled { opacity: 0.5; }
.link-button { background: none; border: 0; color: var(--accent); min-height: 44px; padding: 0 8px; cursor: pointer; }
:focus-visible { outline: 3px solid #1466da; outline-offset: 2px; }

.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 48px; }
.who { font-weight: 650; }
.pill { font-size: 0.8rem; background: var(--surface-2); border-radius: 999px; padding: 2px 10px; margin-left: 6px; }

.search, .big-input, .pin-field, .name-field {
  width: 100%; min-height: var(--tap); font: inherit; font-size: 1.15rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text); padding: 10px 16px; margin: 8px 0;
}
.big-input { font-size: 1.6rem; font-weight: 650; }
.pin-field { font-size: 1.8rem; letter-spacing: 0.4em; text-align: center; }
.field-label { display: block; font-weight: 600; margin-top: 12px; }
.form-error { color: var(--danger); font-weight: 600; }

.chips, .list, .results, .days, .plain { list-style: none; margin: 0; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.name-chip, .chip {
  min-height: 48px; padding: 8px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); font-weight: 600;
}
.name-chip { min-height: var(--tap); font-size: 1.15rem; }
.name-chip[aria-pressed="true"], .chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.chip-row .chip { flex: none; }

.list { display: grid; gap: 10px; }
.phrase, .dish {
  display: grid; gap: 2px; width: 100%; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; min-height: var(--tap);
}
.phrase .zh { font-size: 1.6rem; font-weight: 600; }
.phrase .jp { color: var(--accent); font-size: 0.95rem; }
.phrase .en { font-size: 1.05rem; }
.dish-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 650; }
.dish .zh { font-size: 1.3rem; }
.dish .what { color: var(--muted); font-size: 0.98rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag { font-size: 0.8rem; background: var(--accent-soft); border-radius: 999px; padding: 2px 10px; }

.results { display: grid; gap: 8px; margin: 8px 0; }
.result { font-size: 1.6rem; font-weight: 700; background: var(--surface); border-radius: var(--radius); padding: 12px 16px; }
.stepper { display: flex; align-items: center; gap: 16px; margin: 12px 0; font-size: 1.2rem; font-weight: 600; }
.step { width: var(--tap); height: var(--tap); border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 1.6rem; cursor: pointer; }

.now-card { display: grid; gap: 4px; background: var(--surface); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.now-temp { font-size: 3rem; font-weight: 700; line-height: 1; }
.now-word { font-size: 1.3rem; font-weight: 600; }
.days { display: grid; gap: 8px; }
.day { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; background: var(--surface); border-radius: var(--radius); padding: 12px 16px; }
.day-name { font-weight: 650; }
.day-temp { font-weight: 650; text-align: right; }
.day-word, .day-rain { color: var(--muted); }
.day-rain { text-align: right; }

.call-999 {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 96px; margin: 12px 0; border-radius: var(--radius);
  background: var(--danger); color: #fff; font-size: 2rem; font-weight: 800; text-decoration: none;
}
.call-999 span { font-size: 1rem; font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.card h2 { margin-top: 0; }
.card a { color: var(--accent); font-weight: 650; }
.hotel-name { font-size: 1.2rem; font-weight: 700; }
.card .zh { font-size: 1.4rem; font-weight: 600; }
.plain li { padding: 6px 0; }
.big-link { margin-top: 12px; }
.tip { background: var(--accent-soft); border-radius: var(--radius); padding: 12px 16px; margin-top: 16px; }

.big {
  position: fixed; inset: 0; z-index: 20; background: var(--bg);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 24px) 20px calc(env(safe-area-inset-bottom) + 20px);
}
.big-body { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 16px; }
.big-zh { font-size: clamp(2.6rem, 14vw, 5rem); font-weight: 700; line-height: 1.2; margin: 0; overflow-wrap: anywhere; }
.big-addr { display: block; font-size: 0.44em; line-height: 1.35; margin-top: 12px; word-break: keep-all; }
.big-jp { font-size: 1.3rem; color: var(--accent); }
.big-en { font-size: 1.2rem; }
.big-actions { display: grid; gap: 12px; }
.big-actions .secondary { margin-top: 0; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar[hidden] { display: none; }
.tab {
  min-height: var(--tabbar); border: 0; background: none; cursor: pointer;
  font-size: 0.78rem; font-weight: 650; color: var(--muted); padding: 4px 0;
}
.tab[aria-selected="true"] { color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + 12px);
  transform: translateX(-50%); z-index: 30; max-width: calc(100% - 32px);
  background: var(--text); color: var(--bg); border-radius: 12px; padding: 10px 16px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.toast.show { opacity: 1; }

/* Top bar links */
.topbar-links { display: flex; gap: 4px; }

/* Organiser: sync line, days, notes, packing, knowledge */
.sync-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.95rem; }
.day-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.day-head h2 { margin: 0; }
.plan-items { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.plan-item, .note {
  display: grid; width: 100%; text-align: left; cursor: pointer; gap: 2px 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; min-height: var(--tap); color: var(--text);
}
.plan-item { grid-template-columns: 3.4rem 1fr; }
.note { background: var(--surface); }
.item-time { font-weight: 700; font-variant-numeric: tabular-nums; }
.item-main { display: grid; gap: 2px; }
.item-title, .note-title { font-weight: 650; }
.item-place, .item-who, .item-notes { color: var(--muted); font-size: 0.95rem; }
.note-text { white-space: pre-wrap; }
.changed { color: var(--muted); font-size: 0.85rem; margin: 8px 0 0; }
.pack-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; }
.pack-item label { display: flex; align-items: center; gap: 12px; flex: 1; min-height: 48px; cursor: pointer; }
.pack-item input[type="checkbox"] { width: 28px; height: 28px; accent-color: var(--accent); flex: none; }
.pack-item.done span:not(.tick) { color: var(--muted); text-decoration: line-through; }
.pack-readonly .pack-item { justify-content: flex-start; min-height: 36px; }
.tick { width: 1.4rem; display: inline-block; color: var(--accent); font-weight: 700; }
.pack-list h3 { margin: 0; display: flex; justify-content: space-between; gap: 8px; }
.add-row { display: flex; gap: 8px; align-items: center; }
.add-row .secondary { width: auto; margin-top: 0; }

/* Sheets: the editor and What's new */
.sheet {
  position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-panel {
  width: min(var(--max-width), 100%); max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: var(--radius) var(--radius) 0 0;
  padding: 20px 16px calc(env(safe-area-inset-bottom) + 20px);
}
.sheet-panel h2 { margin-top: 0; }
.sheet-panel input, .sheet-panel textarea {
  width: 100%; min-height: 48px; font: inherit; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--text); padding: 10px 14px;
}
.sheet-panel .secondary { margin-top: 0; }
.danger {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: var(--tap);
  border-radius: var(--radius); border: 1px solid var(--danger); background: none; color: var(--danger);
  font-weight: 650; cursor: pointer;
}
.release h3 { margin-bottom: 0; }
.release h4 { margin: 12px 0 4px; }
.release ul { margin: 0; padding-left: 20px; }
