:root {
  color-scheme: light;
  --bg: #efe3d0;
  --bg-deep: #dec9ad;
  --ink: #111c33;
  --muted: #756c61;
  --line: #d9c5a8;
  --paper: #fffaf1;
  --paper-soft: #f8eddc;
  --navy: #111c33;
  --navy-soft: #223251;
  --green: #2f6f62;
  --green-soft: #dbece2;
  --blue: #213f75;
  --blue-soft: #e1e8f5;
  --rose: #9d4655;
  --rose-soft: #f3dde1;
  --gold: #8b6224;
  --gold-soft: #f0dfbd;
  --shadow: 0 18px 46px rgba(17, 28, 51, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.82), rgba(239, 227, 208, 0) 260px),
    linear-gradient(135deg, #efe3d0 0%, #f8efdf 52%, #e6d2b7 100%),
    var(--bg);
  color: var(--ink);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Noto Sans TC",
    sans-serif;
}

a,
button,
input {
  font: inherit;
}

button {
  border: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 12px 72px;
}

.hero {
  position: relative;
  min-height: auto;
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 18px 16px;
  color: var(--navy);
  background:
    linear-gradient(135deg, rgba(255, 250, 241, 0.96), rgba(235, 217, 190, 0.9)),
    var(--paper);
  border: 1px solid rgba(17, 28, 51, 0.1);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.hero::after {
  content: none;
}

.hero__topline,
.section-heading,
.timeline-item__top,
.timeline-item__meta,
.tools-row,
.eat-card__actions {
  display: flex;
  align-items: center;
}

.hero__topline {
  position: relative;
  z-index: 1;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.eyebrow,
.date-range,
.section-kicker,
.live-pill,
.small-note,
.status {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.eyebrow {
  color: var(--navy);
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  position: relative;
  z-index: 1;
  max-width: 100%;
  font-size: clamp(2rem, 8.5vw, 2.55rem);
  line-height: 1.04;
  word-break: keep-all;
}

.hero__meta {
  position: relative;
  z-index: 1;
  width: 100%;
  margin-top: 10px;
  color: #3d465a;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.45;
}

.itinerary,
.eat-list,
.tools-row {
  margin-top: 18px;
}

.section-heading {
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 2px 10px;
}

.section-heading h2 {
  font-size: 1.04rem;
}

.section-heading--sticky {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 10px 0;
  background: rgba(239, 227, 208, 0.9);
  backdrop-filter: blur(12px);
}

.live-pill,
.date-range {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.72);
  white-space: nowrap;
}

.day-card,
.eat-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 12px 30px rgba(17, 28, 51, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.tag {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
}

.tag--transit {
  background: var(--blue-soft);
  color: var(--blue);
}

.tag--food {
  background: var(--rose-soft);
  color: var(--rose);
}

.tag--event {
  background: var(--gold-soft);
  color: var(--gold);
}

.tag--rest {
  background: var(--green-soft);
  color: var(--green);
}

.tag--open {
  background: #ece8de;
  color: #5f665e;
}

.map-link {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--navy);
  color: white;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.day-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  overflow: visible;
  padding: 2px 0 12px;
}

.day-pill {
  display: grid;
  min-width: 0;
  min-height: 54px;
  place-items: center;
  gap: 2px;
  border-radius: var(--radius);
  background: rgba(255, 250, 241, 0.76);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
}

.day-pill span {
  min-width: 0;
  font-size: 1.1rem;
  font-weight: 950;
  line-height: 1.05;
}

.day-pill small {
  min-width: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.15;
}

.day-pill.is-active {
  background: var(--navy);
  color: white;
  box-shadow: none;
}

.day-pill.is-active small {
  color: rgba(255, 255, 255, 0.72);
}

.day-pill--eat {
  background: var(--navy-soft);
  color: white;
  box-shadow: inset 0 0 0 1px rgba(255, 250, 241, 0.16);
}

.day-pill--eat small {
  color: rgba(255, 255, 255, 0.74);
}

.day-pill--eat.is-active {
  background: #0d1528;
}

.day-sections {
  display: grid;
  gap: 14px;
}

.day-card {
  scroll-margin-top: 74px;
  overflow: hidden;
}

.day-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 250, 241, 0.9), rgba(248, 237, 220, 0.72));
}

.day-card__weekday {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
}

.day-card h3 {
  margin-top: 2px;
  font-size: 1.12rem;
}

.day-card__header > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 900;
}

.timeline {
  display: grid;
}

.timeline-item {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 12px;
  padding: 14px;
}

.timeline-item + .timeline-item {
  border-top: 1px solid var(--line);
}

.timeline-item__time {
  min-height: 32px;
  color: var(--navy);
  font-weight: 950;
}

.timeline-item__body {
  min-width: 0;
}

.timeline-item__top,
.timeline-item__meta {
  flex-wrap: wrap;
  gap: 8px;
}

.timeline-item h4 {
  margin-top: 8px;
  font-size: 1rem;
  line-height: 1.36;
}

.timeline-item p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.timeline-item__meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.eat-list {
  padding: 14px;
}

.eat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}

.eat-form input {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  background: #fffaf1;
  color: var(--ink);
  font-weight: 750;
}

.eat-form input:focus {
  outline: 2px solid rgba(47, 128, 108, 0.24);
  border-color: var(--green);
}

.eat-form button,
.text-button {
  min-height: 44px;
  border-radius: var(--radius);
  padding: 0 14px;
  background: var(--navy);
  color: white;
  font-weight: 900;
  cursor: pointer;
}

.eat-grid {
  display: grid;
  gap: 10px;
}

.eat-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 12px;
  align-items: start;
  border-radius: var(--radius);
  padding: 12px;
  background: var(--paper-soft);
  box-shadow: inset 0 0 0 1px rgba(217, 197, 168, 0.82);
}

.eat-card.is-planned {
  background: #eef3e7;
}

.eat-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  cursor: pointer;
}

.eat-check input {
  width: 19px;
  height: 19px;
  accent-color: var(--green);
}

.eat-check span {
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 950;
  white-space: nowrap;
}

.eat-card__body {
  min-width: 0;
}

.eat-card h3 {
  font-size: 1rem;
  line-height: 1.35;
}

.eat-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
}

.eat-card__actions {
  grid-column: 2;
  flex-wrap: wrap;
  gap: 8px;
}

.text-button {
  min-height: 32px;
  background: transparent;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
}

.tools-row {
  gap: 10px;
}

.tool-button {
  display: inline-flex;
  flex: 1;
  min-width: 0;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  background: #fffaf1;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer;
}

.tool-button__icon {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 0.64rem;
  font-weight: 950;
}

.back-to-top {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 8;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  box-shadow: 0 12px 30px rgba(24, 34, 46, 0.26);
  font-size: 1.25rem;
  font-weight: 950;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  cursor: pointer;
}

.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 10;
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translate(-50%, 18px);
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--ink);
  color: white;
  font-weight: 850;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 720px) {
  .app-shell {
    padding-top: 28px;
    padding-inline: 16px;
  }

  .hero {
    min-height: 230px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 22px;
  }

  .hero::after {
    content: "SEOUL 2026";
    position: absolute;
    inset: auto 18px 18px auto;
    display: inline-grid;
    min-width: 104px;
    height: 34px;
    place-items: center;
    border: 1px solid rgba(17, 28, 51, 0.16);
    border-radius: 999px;
    background: rgba(255, 250, 241, 0.7);
    color: rgba(17, 28, 51, 0.58);
    font-size: 0.68rem;
    font-weight: 950;
    letter-spacing: 0;
  }

  h1 {
    max-width: 9em;
    font-size: clamp(2rem, 10vw, 3.5rem);
    line-height: 0.98;
  }

  .hero__meta {
    width: min(100%, 360px);
    margin-top: 12px;
    font-size: 1rem;
    line-height: 1.55;
  }

  .itinerary,
  .eat-list,
  .tools-row {
    margin-top: 22px;
  }

  .day-sections {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .day-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(82px, 1fr);
    grid-template-columns: none;
    overflow-x: auto;
    padding: 2px 2px 12px;
    scrollbar-width: none;
  }

  .day-nav::-webkit-scrollbar {
    display: none;
  }

  .day-card:nth-child(1),
  .day-card:nth-child(2),
  .day-card:nth-child(6) {
    grid-column: 1 / -1;
  }

  .eat-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 390px) {
  .app-shell {
    padding-inline: 12px;
  }

  .hero {
    padding: 18px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
  }

  .eat-form {
    grid-template-columns: 1fr;
  }

  .eat-card {
    grid-template-columns: 1fr;
  }

  .eat-card__actions {
    grid-column: 1;
  }
}
