:root {
  color-scheme: light;
  --ink: #30251f;
  --muted: #756f68;
  --paper: #fff7ec;
  --surface: #fffdf8;
  --band: #f4f9ee;
  --line: #eadfce;
  --forest: #1f6f52;
  --sakura: #e94f64;
  --sun: #ffcf56;
  --water: #67b7dc;
  --plum: #7b68ee;
  --mikan: #ff9f43;
  --danger: #c83e36;
  --ok: #1f8f5f;
  --shadow: 0 12px 26px rgba(126, 82, 45, 0.14);
  --radius: 8px;
  --tap: 52px;
  --base-size: 18px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-size: var(--base-size);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255, 159, 67, 0.07) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(90deg, rgba(103, 183, 220, 0.06) 0 1px, transparent 1px 22px),
    linear-gradient(135deg, rgba(233, 79, 100, 0.16), transparent 36%),
    linear-gradient(315deg, rgba(31, 143, 95, 0.13), transparent 36%),
    var(--paper);
  color: var(--ink);
  font-family:
    "M PLUS Rounded 1c", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  transform: translateY(-140%);
  background: var(--sakura);
  color: white;
  padding: 10px 14px;
  border-radius: var(--radius);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  min-height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100vh;
  padding: 18px 12px;
  background:
    linear-gradient(180deg, rgba(48, 37, 31, 0.82), rgba(48, 37, 31, 0.94)),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 2px, transparent 2px 12px),
    var(--sakura);
  color: white;
}

.brand-mark {
  display: grid;
  place-items: center;
  min-height: 68px;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  font-weight: 900;
  writing-mode: vertical-rl;
  letter-spacing: 0.08em;
}

.nav-button {
  min-height: var(--tap);
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-weight: 800;
}

.side-nav .nav-button {
  color: rgba(255, 255, 255, 0.78);
}

.side-nav .nav-button.is-active {
  background: var(--sun);
  color: var(--ink);
  box-shadow: inset 0 -4px 0 rgba(255, 159, 67, 0.55);
}

.content-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px 24px 104px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--sakura);
  font-size: 0.9rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 16px;
  font-size: clamp(1.5rem, 4vw, 2.35rem);
  line-height: 1.08;
}

h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  line-height: 1.18;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-toggle {
  min-height: var(--tap);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  color: var(--forest);
  padding: 0 16px;
  cursor: pointer;
  font-weight: 950;
  box-shadow: 0 6px 12px rgba(126, 82, 45, 0.08);
}

.admin-toggle.is-active {
  border-color: var(--sakura);
  background: var(--sakura);
  color: white;
  box-shadow: 0 6px 0 rgba(151, 48, 62, 0.32);
}

input,
select,
textarea {
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 10px 12px;
}

textarea {
  min-height: 112px;
  resize: vertical;
}

.icon-button,
.primary-button,
.secondary-button,
.danger-button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 900;
  text-decoration: none;
}

.icon-button {
  min-width: var(--tap);
  padding: 0 10px;
  background: var(--sakura);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 7px 0 rgba(166, 50, 63, 0.2);
}

.primary-button {
  background: var(--sakura);
  color: white;
  box-shadow: 0 5px 0 rgba(166, 50, 63, 0.22);
}

.secondary-button {
  background: white;
  color: var(--ink);
  border-color: var(--line);
}

.danger-button {
  background: #fff0ec;
  color: var(--danger);
  border-color: #efb7af;
}

.link-button {
  background: #edf8fb;
  color: #216f91;
  border-color: #b8ddeb;
}

.section-band {
  margin: 0 0 18px;
  padding: 20px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 253, 248, 0.94)),
    var(--surface);
  box-shadow: var(--shadow);
}

.hero-band {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 138px minmax(240px, 0.7fr);
  align-items: end;
  gap: 18px;
  background:
    linear-gradient(120deg, rgba(48, 37, 31, 0.9), rgba(233, 79, 100, 0.42)),
    var(--hero-image);
  background-position: center;
  background-size: cover;
  color: white;
  overflow: hidden;
  min-height: 430px;
}

.hero-band .eyebrow {
  color: var(--sun);
}

.hero-band h2 {
  max-width: 820px;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.22);
}

.hero-band::after {
  content: "たのしい旅";
  position: absolute;
  right: 18px;
  top: 18px;
  padding: 8px 14px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: white;
  font-size: 0.85rem;
  font-weight: 900;
  transform: rotate(3deg);
}

.stamp-card {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 5px double rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: rgba(233, 79, 100, 0.82);
  color: white;
  font-size: 1.7rem;
  font-weight: 900;
  line-height: 1;
  transform: rotate(-9deg);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.24);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
}

.metric strong {
  display: block;
  font-size: 1.45rem;
}

.metric span {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.85rem;
  font-weight: 700;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}

.day-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 8px;
  margin: 0 0 16px;
  scrollbar-width: thin;
}

.day-tab {
  flex: 0 0 auto;
  min-height: var(--tap);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-weight: 900;
}

.day-tab.is-active {
  background: var(--forest);
  color: white;
  border-color: var(--forest);
}

.split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.three-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.activity-list {
  display: grid;
  gap: 12px;
}

.activity {
  display: grid;
  grid-template-columns: 112px 128px minmax(0, 1fr);
  gap: 14px;
  border: 2px solid var(--line);
  border-left: 8px solid var(--forest);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 8px 18px rgba(126, 82, 45, 0.08);
}

.activity.no-photo {
  grid-template-columns: 112px minmax(0, 1fr);
}

.activity[data-type="food"] {
  border-left-color: var(--mikan);
}

.activity[data-type="transport"] {
  border-left-color: var(--water);
}

.activity[data-type="hotel"] {
  border-left-color: var(--plum);
}

.activity[data-type="alert"] {
  border-left-color: var(--sun);
}

.activity-time {
  color: var(--sakura);
  font-size: 1.15rem;
  font-weight: 950;
}

.activity-thumb {
  position: relative;
  min-height: 118px;
  margin: 0;
  overflow: hidden;
  border: 8px solid #ffffff;
  border-bottom-width: 18px;
  border-radius: 4px;
  background-color: #f2eadf;
  background-position: center;
  background-size: cover;
  box-shadow: 0 10px 18px rgba(126, 82, 45, 0.18);
  transform: rotate(-1.5deg);
}

.activity-thumb img {
  display: block;
  width: 100%;
  height: 118px;
  object-fit: cover;
  border-radius: 2px;
  color: transparent;
}

.activity:nth-child(even) .activity-thumb {
  transform: rotate(1.5deg);
}

.activity-kind {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff2d1;
  color: var(--forest);
  font-size: 0.78rem;
  font-weight: 900;
}

.activity p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.photo-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
  padding: 14px;
  border: 2px dashed rgba(233, 79, 100, 0.34);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255, 207, 86, 0.18), rgba(103, 183, 220, 0.14)),
    rgba(255, 255, 255, 0.72);
}

.trusted-photo-strip {
  grid-template-columns: repeat(auto-fit, minmax(180px, 260px));
}

.photo-tile {
  position: relative;
  margin: 0;
  padding: 8px 8px 34px;
  border-radius: 4px;
  background: white;
  box-shadow: 0 12px 18px rgba(126, 82, 45, 0.16);
}

.photo-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 3px;
  color: transparent;
}

.photo-tile figcaption {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.rotate-1 {
  transform: rotate(-1.7deg);
}

.rotate-2 {
  transform: rotate(1deg);
}

.rotate-3 {
  transform: rotate(-0.5deg);
}

.activity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.activity-actions .link-button,
.activity-actions .secondary-button,
.activity-actions .danger-button {
  min-height: 44px;
  padding: 0 12px;
  font-size: 0.9rem;
}

.info-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.info-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.info-row:last-child {
  border-bottom: 0;
}

.info-row dt {
  color: var(--muted);
  font-weight: 900;
}

.info-row dd {
  margin: 0;
  font-weight: 800;
}

.subtle {
  color: var(--muted);
}

.warning {
  border-left: 8px solid var(--sun);
  background: #fff8e4;
}

.danger {
  border-left: 8px solid var(--danger);
  background: #fff1ef;
}

.ok {
  border-left: 8px solid var(--ok);
  background: #eef8f1;
}

.weather-card,
.money-card,
.expense-card,
.check-item,
.safety-card {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: white;
  padding: 16px;
}

.weather-card strong,
.money-card strong,
.expense-card strong {
  display: block;
  font-size: 1.7rem;
}

.weather-source a {
  color: #216f91;
  font-weight: 900;
}

.weather-control-row,
.map-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.weather-location,
.map-filter {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  padding: 0 16px;
  cursor: pointer;
  font-weight: 900;
}

.weather-location.is-active,
.map-filter.is-active {
  background: var(--forest);
  color: white;
  border-color: var(--forest);
}

.weather-day-tabs .day-tab {
  min-width: 126px;
  text-align: left;
}

.weather-day-tabs .day-tab span {
  display: block;
  margin-top: 2px;
  font-size: 0.78rem;
  color: inherit;
  opacity: 0.78;
}

.weather-focus {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.weather-stats {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.weather-stats div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffaf1;
  padding: 12px;
}

.weather-stats strong {
  display: block;
  font-size: 1.25rem;
}

.weather-stats span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.hourly-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(136px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding: 6px 2px 12px;
  scrollbar-width: thin;
}

.hour-card {
  min-height: 196px;
  border: 2px solid var(--line);
  border-top: 8px solid var(--water);
  border-radius: var(--radius);
  background: white;
  padding: 12px;
}

.hour-card span {
  display: block;
  color: var(--sakura);
  font-weight: 950;
}

.hour-card strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 1.45rem;
}

.hour-card p {
  margin: 0 0 8px;
  font-weight: 900;
}

.hour-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 800;
}

.hourly-empty,
.map-fallback,
.map-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  padding: 18px;
  text-align: center;
  font-weight: 900;
}

.map-toolbar {
  align-items: flex-start;
  justify-content: space-between;
}

.trip-map {
  position: relative;
  width: 100%;
  min-height: 520px;
  overflow: hidden;
  border: 3px solid white;
  border-radius: var(--radius);
  background: #e8f2e9;
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow);
}

.trip-map .leaflet-control-attribution {
  font-size: 0.66rem;
}

.map-marker {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid white;
  border-radius: 50%;
  color: white;
  font-size: 0.78rem;
  font-weight: 950;
  box-shadow: 0 8px 14px rgba(48, 37, 31, 0.26);
}

.map-marker-sight {
  background: var(--sakura);
}

.map-marker-food {
  background: var(--mikan);
}

.map-marker-shopping {
  background: var(--forest);
}

.map-marker-hotel {
  background: var(--plum);
}

.map-marker-transport {
  background: var(--water);
}

.map-popup {
  min-width: 220px;
  color: var(--ink);
  font-family: "M PLUS Rounded 1c", "Noto Sans TC", sans-serif;
}

.map-popup strong {
  display: block;
  font-size: 1rem;
}

.map-popup p {
  margin: 6px 0;
}

.map-popup a {
  color: #216f91;
  font-weight: 900;
}

.map-source {
  margin-bottom: 0;
}

.map-day-card {
  overflow: hidden;
  padding-top: 10px;
}

.map-day-photo {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: -6px 0 14px;
  border-radius: var(--radius);
  background-color: #f9ead9;
  background-position: center;
  background-size: cover;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid label,
.stack-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.full-span {
  grid-column: 1 / -1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 32, 29, 0.52);
}

.modal {
  width: min(720px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  border-radius: var(--radius);
  background: var(--paper);
  padding: 20px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.28);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin: 0 0 16px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.expense-row,
.audit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.expense-row:last-child,
.audit-row:last-child {
  border-bottom: 0;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-weight: 900;
}

.check-item input {
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
}

.checklist-groups {
  display: grid;
  gap: 16px;
}

.check-group {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(255, 207, 86, 0.16), rgba(255, 255, 255, 0)),
    white;
  padding: 14px;
}

.check-group h3 {
  margin-bottom: 12px;
}

.check-row-list {
  display: grid;
  gap: 10px;
}

.check-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.92);
  padding: 10px;
}

.check-row label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
  font-weight: 900;
}

.check-row input {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  accent-color: var(--forest);
}

.check-row input:checked + span {
  color: var(--muted);
  text-decoration: line-through;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 92px;
  z-index: 50;
  max-width: min(420px, calc(100vw - 36px));
  transform: translateY(130%);
  border-radius: var(--radius);
  background: var(--forest);
  color: white;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.22s ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: none;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 2px;
  padding: 8px max(8px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right));
  border-top: 1px solid var(--line);
  background: rgba(255, 247, 236, 0.96);
  backdrop-filter: blur(16px);
}

.bottom-nav .nav-button {
  min-height: 48px;
  padding: 4px 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.bottom-nav .nav-button.is-active {
  background: var(--sakura);
  color: white;
  box-shadow: inset 0 -4px 0 rgba(255, 207, 86, 0.65);
}

@media (max-width: 880px) {
  .app-shell {
    display: block;
  }

  .side-nav {
    display: none;
  }

  .bottom-nav {
    display: grid;
  }

  .content-shell {
    padding: 16px 12px 104px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: space-between;
  }

  .hero-band,
  .split-grid,
  .three-grid,
  .weather-focus {
    grid-template-columns: 1fr;
  }

  .hero-band {
    min-height: 560px;
    align-items: end;
  }

  .stamp-card {
    width: 112px;
    justify-self: end;
  }

  .activity {
    grid-template-columns: 1fr;
  }

  .activity-thumb {
    min-height: 176px;
    order: -1;
  }

  .activity-time {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .info-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .trip-map {
    min-height: 440px;
  }

  .map-toolbar {
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .photo-strip {
    grid-template-columns: 1fr;
  }

  .photo-tile {
    transform: none;
  }

  .activity-actions .link-button,
  .activity-actions .secondary-button,
  .activity-actions .danger-button {
    width: 100%;
  }

  .weather-location,
  .map-filter {
    flex: 1 1 calc(50% - 8px);
    padding: 0 10px;
  }

  .hourly-strip {
    grid-auto-columns: minmax(126px, 72vw);
  }

  .check-row {
    grid-template-columns: 1fr;
  }

  .check-row .danger-button {
    width: 100%;
  }
}
