:root {
  --majorelle: #2F3DA8;
  --majorelle-deep: #232E7F;
  --night: #191F5C;
  --bg: #F4E9D4;
  --raised: #FCF6E9;
  --line: #E2D2B4;
  --ink: #36251A;
  --soft: #8A7158;
  --terra: #C4552F;
  --saffron: #E8A33C;
  --teal: #177065;
  --on-dark: #F6EDDC;
  --shadow: 0 10px 26px rgba(43,32,18,.14);
  --radius: 14px;
  --arch: 70px 70px 14px 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141126; --raised: #1E1A38; --line: #332C55;
    --ink: #F0E6CF; --soft: #A99878;
    --terra: #E0714A; --saffron: #EFB35C; --teal: #3FA091;
    --majorelle-deep: #1E2766; --night: #12173F;
    --shadow: 0 10px 26px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
body.locked { padding-bottom: 0; overflow: hidden; }
h1, h2, h3, .serif { font-family: "Iowan Old Style", Palatino, Georgia, serif; margin: 0; text-wrap: balance; }
h3 { font-size: 17px; }
button, input, select { font-family: inherit; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--soft); font-size: 11.5px; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 10%, rgba(232,163,60,.24), transparent 26%),
    linear-gradient(160deg, var(--night), var(--majorelle));
}
.gate-card {
  width: min(360px, 100%);
  background: var(--raised);
  color: var(--ink);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 20px;
  padding: 24px 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.gate-card h1 { font-size: 30px; }
.gate-card p { margin: 8px 0 14px; color: var(--soft); }
.gate-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font-size: 20px;
  text-align: center;
  padding: 11px 16px;
  margin: 6px 0 12px;
  letter-spacing: .2em;
}
.gate-card small { display: block; min-height: 18px; color: var(--terra); }

.app-head {
  background: linear-gradient(180deg, var(--night), var(--majorelle));
  color: var(--on-dark);
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.app-head .t { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo {
  width: 34px; height: 38px;
  border-radius: 17px 17px 6px 6px;
  background: var(--saffron);
  display: grid; place-items: center;
  font-size: 18px;
  flex: none;
}
.logo.big { width: 58px; height: 66px; border-radius: 29px 29px 10px 10px; margin: 0 auto 12px; font-size: 30px; }
.app-head h1 { font-size: 17px; }
.app-head small { display: block; font-size: 10.5px; color: rgba(246,237,220,.75); font-family: inherit; }
.day-chip {
  background: rgba(252,246,233,.14);
  border: 1px solid rgba(232,163,60,.5);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.screen { display: none; padding: 16px 16px 24px; max-width: 620px; margin: 0 auto; }
.screen.active { display: block; }
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  background: var(--raised);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1;
  min-height: 54px;
  background: none;
  border: none;
  padding: 8px 2px 7px;
  font-size: 10px;
  color: var(--soft);
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 2px;
}
.tabbar button .ti { font-size: 20px; line-height: 1; }
.tabbar button.on { color: var(--terra); font-weight: 700; }

.card {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 15px;
  margin-bottom: 12px;
}
.sec-h { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; }
.sec-h h2 { font-size: 18px; }
.sec-h::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.star { width: 14px; height: 14px; flex: none; }
.eyebrow { font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--saffron); font-weight: 700; margin: 0 0 6px; }
.chip {
  font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 2.5px 8px; border-radius: 999px; color: #fff;
}
.c-travel { background: var(--majorelle); }
.c-stay { background: var(--teal); }
.c-hi { background: var(--saffron); color: #4A3005; }
.medal {
  width: 46px; height: 52px; flex: none;
  border-radius: 23px 23px 8px 8px;
  display: grid; place-items: center;
  font-size: 21px; color: #fff;
}
.m-travel { background: var(--majorelle); }
.m-stay { background: var(--teal); }
.m-hi { background: var(--saffron); color: #4A3005; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px;
  background: var(--majorelle); color: #fff;
  border: none; border-radius: 999px;
  padding: 8px 14px; font-size: 13px; font-weight: 700;
  text-decoration: none; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--terra); border: 1.5px solid var(--terra); }
.btn.small { min-height: 38px; padding: 6px 12px; font-size: 12px; }

.today-hero {
  background: linear-gradient(160deg, var(--night), var(--majorelle));
  color: var(--on-dark);
  border-radius: 18px;
  padding: 20px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.today-hero h2 { font-size: 24px; }
.today-hero p { font-size: 13.5px; color: rgba(246,237,220,.88); margin: 8px 0 0; }
.today-hero .row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.today-hero .btn.ghost { color: var(--on-dark); border-color: rgba(246,237,220,.62); }

.stn { display: flex; gap: 12px; align-items: flex-start; }
.stn .body { flex: 1; min-width: 0; }
.stn .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stn .date { font-size: 12px; font-weight: 700; }
.stn h3 { font-size: 16px; margin: 3px 0 2px; }
.stn p { font-size: 13px; margin: 0; opacity: .88; }
.stn .meta { font-size: 11px; color: var(--soft); margin-top: 5px; }
.stn .acts { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.station-img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-bottom: 12px;
}
.address-box {
  margin-top: 9px;
  padding: 9px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 78%, var(--raised));
  border: 1px dashed var(--line);
}
.address-box button { margin-top: 7px; }
.address-box small { display: block; color: var(--soft); font-size: 11px; }

details.discover { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
details.discover summary {
  cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--terra);
  list-style: none; display: flex; align-items: center; gap: 6px; min-height: 36px;
}
details.discover summary::-webkit-details-marker { display: none; }
.poi { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dotted var(--line); }
.poi:last-child { border-bottom: none; }
.poi b { font-size: 13px; display: block; }
.poi small { font-size: 11px; color: var(--soft); display: block; }
.poi .lnks { display: flex; gap: 6px; flex: none; }
.poi a {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 50%; border: 1.5px solid var(--line);
  text-decoration: none; font-size: 15px; background: var(--bg);
}

#map { height: 62vh; min-height: 420px; border-radius: 16px; border: 1px solid var(--line); box-shadow: var(--shadow); }
.map-note { font-size: 11.5px; color: var(--soft); margin-top: 8px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--raised); color: var(--ink); }

.todo-item { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px dotted var(--line); }
.todo-item:last-child { border-bottom: none; }
.todo-item input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--teal); flex: none; }
.todo-item label { font-size: 14px; flex: 1; }
.todo-item.done label { text-decoration: line-through; color: var(--soft); }
.addrow { display: flex; gap: 8px; margin-top: 10px; }
.addrow input, select {
  min-width: 0;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 14px; font-size: 14px; background: var(--bg); color: var(--ink);
}
.addrow input { flex: 1; }
.budget-add { display: grid; grid-template-columns: 1fr 1.2fr auto; }
.progress { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 8px 0 2px; }
.progress i { display: block; height: 100%; background: var(--teal); border-radius: 99px; transition: width .3s; }
.kids-grid { display: grid; gap: 12px; }
.list-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.list-title h3 { font-size: 16px; }

.field-label { display: block; color: var(--soft); font-size: 12px; font-weight: 700; margin-bottom: 6px; }
#budget-date { width: 100%; min-height: 44px; margin-bottom: 14px; }
.bud-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.bud-head b { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 22px; white-space: nowrap; }
.bud-ok { color: var(--teal); } .bud-warn { color: var(--terra); }
.exp { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 8px 0; border-bottom: 1px dotted var(--line); }
.exp:last-child { border-bottom: none; }
.exp small { color: var(--soft); }
.hist { display: grid; grid-template-columns: 86px 1fr auto; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dotted var(--line); font-size: 12.5px; }
.hist:last-child { border-bottom: none; }
.hist i { display: block; height: 7px; border-radius: 999px; background: var(--teal); }
.hist.over i { background: var(--terra); }
.foot-note { text-align: center; font-size: 11px; color: var(--soft); margin-top: 22px; }

@media (max-width: 380px) {
  .app-head { padding-left: 12px; padding-right: 12px; }
  .screen { padding-left: 12px; padding-right: 12px; }
  .budget-add { grid-template-columns: 1fr; }
  .budget-add .btn { width: 100%; }
  .bud-head { align-items: flex-start; flex-direction: column; gap: 2px; }
}
