:root {
  --paper: #fffdf9;
  --sand: #f4efe7;
  --ink: #2f3033;
  --muted: #706a63;
  --terracotta: #a94f35;
  --terracotta-dark: #793620;
  --terracotta-soft: #f6e7df;
  --gold: #c59a3d;
  --gold-soft: #fbf3dd;
  --sea: #2f6f73;
  --sea-soft: #e5f0ef;
  --line: #dfd6ca;
  --shadow: 0 12px 34px rgba(71, 48, 30, 0.13);
  --radius: 18px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  background: var(--sand);
  color: var(--ink);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--sand);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; padding-bottom: 90px; }

.app-header {
  position: relative;
  overflow: hidden;
  padding: max(22px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 30px max(20px, env(safe-area-inset-left));
  color: #fff;
  background:
    radial-gradient(circle at 85% 15%, rgba(197,154,61,.34), transparent 28%),
    linear-gradient(135deg, #71331f 0%, #a94f35 52%, #c56a48 100%);
}

.app-header::after {
  position: absolute;
  right: -50px;
  bottom: -110px;
  width: 270px;
  height: 270px;
  content: "";
  border: 42px solid rgba(255,255,255,.07);
  border-radius: 50%;
}

.header-topline, .trip-meta, .day-cards { position: relative; z-index: 1; }

.header-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  max-width: 980px;
  margin: 0 auto;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .78;
}

.app-header h1 {
  margin: 0;
  color: #fff;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: clamp(30px, 8vw, 48px);
  line-height: 1.05;
  letter-spacing: -.04em;
}

.app-header h1 span { color: #f5d791; font-weight: 500; }

.install-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  padding: 9px 13px;
  color: #fff;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 999px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.install-button:active { transform: scale(.97); }

.trip-meta {
  display: flex;
  max-width: 980px;
  margin: 18px auto 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  opacity: .9;
}

.trip-meta span:not(:last-child)::after { margin-left: 14px; content: "·"; opacity: .5; }
.trip-meta .status { padding: 2px 8px; background: rgba(217,246,225,.18); border-radius: 999px; }
.trip-meta .status::before { display: inline-block; width: 7px; height: 7px; margin-right: 5px; content: ""; background: #a9e5b8; border-radius: 50%; }
.trip-meta .status.offline::before { background: #f5d791; }

.day-cards {
  display: grid;
  max-width: 980px;
  margin: 24px auto 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.day-card {
  min-height: 118px;
  padding: 14px;
  color: #fff;
  text-align: left;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 15px;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}

.day-card:hover { transform: translateY(-2px); background: rgba(255,255,255,.16); }
.day-card.active { color: var(--terracotta-dark); background: #fff9ef; border-color: #fff9ef; box-shadow: 0 9px 24px rgba(49,24,13,.2); }
.day-card-date { display: block; font-family: "Segoe UI", Arial, sans-serif; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; opacity: .72; }
.day-card strong { display: block; margin-top: 7px; font-family: "Segoe UI", Arial, sans-serif; font-size: 14px; line-height: 1.25; }
.day-card small { display: block; margin-top: 7px; font-family: "Segoe UI", Arial, sans-serif; font-size: 11px; line-height: 1.35; opacity: .7; }

.content-wrap {
  width: min(100% - 28px, 880px);
  margin: -1px auto 40px;
}

.current-day-banner {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 22px 0 14px;
  padding: 13px 16px;
  background: var(--sea-soft);
  border: 1px solid rgba(47,111,115,.15);
  border-radius: 14px;
}

.day-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  color: #fff;
  background: var(--sea);
  border-radius: 12px;
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 20px;
}

.current-day-banner span:not(.day-icon) { color: var(--sea); font-family: "Segoe UI", Arial, sans-serif; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.current-day-banner h2 { margin: 1px 0 0; color: #264f52; font-family: "Segoe UI", Arial, sans-serif; font-size: 17px; line-height: 1.2; }

.travel-content {
  padding: clamp(22px, 5vw, 54px);
  overflow: hidden;
  background: var(--paper);
  border: 1px solid rgba(169,79,53,.09);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.travel-content > h1:first-child { display: none; }
.travel-content h1, .travel-content h2, .travel-content h3, .travel-content h4 { font-family: "Segoe UI", Arial, sans-serif; line-height: 1.25; }
.travel-content h1 { position: relative; margin: 44px 0 20px; padding-bottom: 10px; color: var(--terracotta-dark); font-size: clamp(27px, 6vw, 34px); border-bottom: 1px solid var(--line); }
.travel-content h1::after { position: absolute; bottom: -2px; left: 0; width: 82px; height: 4px; content: ""; background: linear-gradient(90deg,var(--terracotta),var(--gold)); border-radius: 10px; }
.travel-content h2 { margin: 36px 0 14px; color: var(--terracotta); font-size: clamp(22px, 5vw, 26px); }
.travel-content h3 { margin: 29px 0 10px; color: var(--sea); font-size: 19px; }
.travel-content h4 { margin: 23px 0 8px; color: #514b45; font-size: 16px; }
.travel-content p { margin: 10px 0 16px; }
.travel-content strong { color: #28292b; }
.travel-content em { color: #625d56; }
.travel-content a { color: var(--sea); text-decoration-color: rgba(47,111,115,.35); text-decoration-thickness: 2px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.travel-content a:focus-visible, button:focus-visible { outline: 3px solid #f2c45d; outline-offset: 3px; }
.travel-content hr { height: 1px; margin: 34px auto; background: linear-gradient(90deg,transparent,var(--line) 15%,var(--line) 85%,transparent); border: 0; }

.travel-content blockquote { margin: 22px 0; padding: 16px 18px; color: #4c4945; background: linear-gradient(135deg,var(--gold-soft),#fffaf0); border-left: 5px solid var(--gold); border-radius: 0 12px 12px 0; }
.travel-content blockquote p:first-child { margin-top: 0; }
.travel-content blockquote p:last-child { margin-bottom: 0; }

.travel-content img { display: block; width: min(100%, 620px) !important; height: auto; max-height: 68vh; margin: 23px auto 8px; object-fit: contain; border-radius: 12px; box-shadow: 0 7px 22px rgba(53,43,34,.14); }
.travel-content p[align="center"] { max-width: 680px; margin-right: auto; margin-left: auto; }
.travel-content p[align="center"] em { display: block; margin-bottom: 22px; color: var(--muted); font-family: "Segoe UI", Arial, sans-serif; font-size: 13px; line-height: 1.45; }

.travel-content table { display: table; width: 100%; margin: 18px 0 26px; overflow: hidden; border: 1px solid var(--line); border-collapse: separate; border-spacing: 0; border-radius: 10px; font-family: "Segoe UI", Arial, sans-serif; font-size: 14px; line-height: 1.45; }
.travel-content th { padding: 11px 12px; color: var(--terracotta-dark); text-align: left; background: #eee3d5; border-right: 1px solid var(--line); border-bottom: 1px solid #cfc1b1; }
.travel-content td { padding: 10px 12px; vertical-align: top; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.travel-content th:last-child, .travel-content td:last-child { border-right: 0; }
.travel-content tr:last-child td { border-bottom: 0; }
.travel-content tbody tr:nth-child(even) { background: #fbf8f3; }

.travel-content ul, .travel-content ol { margin: 10px 0 18px; padding-left: 25px; }
.travel-content li { margin: 7px 0; padding-left: 2px; }
.travel-content li::marker { color: var(--terracotta); }
.travel-content input[type="checkbox"] { width: 21px; height: 21px; margin: 0 9px 0 -1px; vertical-align: -4px; accent-color: var(--sea); cursor: pointer; }

.travel-content pre { max-width: 100%; margin: 18px 0 24px; padding: 16px; overflow-x: auto; color: #e9efee; background: #263b3d; border-radius: 10px; font-family: Consolas, monospace; font-size: 13px; line-height: 1.55; -webkit-overflow-scrolling: touch; }
.travel-content code { padding: 2px 5px; color: var(--terracotta-dark); background: #f4efe9; border-radius: 4px; font-family: Consolas, monospace; font-size: .9em; }
.travel-content pre code { padding: 0; color: inherit; background: transparent; }

.loading { min-height: 45vh; padding: 50px 20px; color: var(--muted); text-align: center; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); font-family: "Segoe UI", Arial, sans-serif; }

.bottom-nav { display: none; }

.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; padding: 20px; place-items: end center; background: rgba(27,24,21,.52); backdrop-filter: blur(5px); }
.install-modal { position: relative; width: min(100%, 480px); max-height: 88vh; padding: 26px; overflow-y: auto; background: var(--paper); border-radius: 24px 24px 16px 16px; box-shadow: 0 25px 80px rgba(0,0,0,.3); }
.modal-close { position: absolute; top: 12px; right: 14px; display: grid; width: 42px; height: 42px; place-items: center; color: #5e5851; background: #f0ebe4; border: 0; border-radius: 50%; font-size: 27px; cursor: pointer; }
.app-icon { display: grid; width: 74px; height: 74px; place-items: center; color: #fff; background: var(--terracotta); border: 8px solid var(--gold); border-radius: 22px; font-family: "Segoe UI", Arial, sans-serif; font-size: 19px; font-weight: 900; line-height: .85; }
.app-icon small { display: block; font-size: 9px; }
.install-modal h2 { margin: 18px 0 15px; color: var(--terracotta-dark); font-family: "Segoe UI", Arial, sans-serif; font-size: 26px; }
.install-modal h3 { margin: 18px 0 7px; color: var(--sea); font-family: "Segoe UI", Arial, sans-serif; font-size: 17px; }
.install-modal ol { margin: 7px 0; padding-left: 22px; }
.install-modal li { margin: 7px 0; }
.modal-note { margin: 18px -4px -4px; padding: 13px; color: #4c5e5f; background: var(--sea-soft); border-radius: 11px; font-family: "Segoe UI", Arial, sans-serif; font-size: 13px; }
.modal-dismiss { display: block; width: 100%; min-height: 46px; margin-top: 16px; color: #fff; background: var(--terracotta); border: 0; border-radius: 12px; font-family: "Segoe UI", Arial, sans-serif; font-weight: 700; cursor: pointer; }

@media (max-width: 760px) {
  html { background: var(--paper); }
  body { background: var(--paper); font-size: 17px; overflow-wrap: anywhere; }
  .app-shell { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .app-header { padding-right: 15px; padding-bottom: 22px; padding-left: 15px; }
  .install-button { padding: 8px 11px; }
  .install-button span { font-size: 18px; }
  .trip-meta { margin-top: 15px; }
  .trip-meta span:nth-child(2) { display: none; }
  .day-cards { display: flex; margin-right: -15px; padding-right: 15px; overflow-x: auto; gap: 9px; scroll-snap-type: x mandatory; scrollbar-width: none; }
  .day-cards::-webkit-scrollbar { display: none; }
  .day-card { min-width: 168px; min-height: 112px; scroll-snap-align: start; }
  .content-wrap { width: 100%; margin: 0; }
  .current-day-banner { margin: 12px 12px 10px; }
  .travel-content { padding: 25px 16px 38px; border: 0; border-radius: 0; box-shadow: none; }
  .travel-content h1 { margin-top: 38px; font-size: 28px; }
  .travel-content h2 { margin-top: 32px; font-size: 23px; }
  .travel-content h3 { font-size: 19px; }
  .travel-content img { width: 100% !important; max-height: 62vh; border-radius: 9px; }
  .travel-content p[align="center"] { max-width: 100%; }
  .travel-content blockquote { padding: 14px 14px 14px 15px; }
  .travel-content table { display: block; width: max-content; min-width: 100%; max-width: none; overflow-x: auto; white-space: normal; -webkit-overflow-scrolling: touch; }
  .travel-content th, .travel-content td { min-width: 138px; padding: 10px; }
  .travel-content th:first-child, .travel-content td:first-child { min-width: 115px; }
  .bottom-nav { position: fixed; z-index: 50; right: 0; bottom: 0; left: 0; display: grid; height: calc(68px + env(safe-area-inset-bottom)); padding: 6px 7px max(6px, env(safe-area-inset-bottom)); grid-template-columns: repeat(4, 1fr); background: rgba(255,253,249,.96); border-top: 1px solid var(--line); box-shadow: 0 -8px 25px rgba(45,35,27,.1); backdrop-filter: blur(14px); }
  .bottom-nav button { display: flex; min-width: 0; align-items: center; justify-content: center; flex-direction: column; gap: 1px; color: #777169; background: transparent; border: 0; border-radius: 12px; cursor: pointer; }
  .bottom-nav button span { font-family: "Segoe UI Symbol", sans-serif; font-size: 19px; line-height: 1; }
  .bottom-nav button small { font-family: "Segoe UI", Arial, sans-serif; font-size: 10px; font-weight: 700; }
  .bottom-nav button.active { color: var(--terracotta-dark); background: var(--terracotta-soft); }
  .modal-backdrop { padding: 0; }
  .install-modal { width: 100%; max-height: 91vh; padding: 24px 20px max(24px, env(safe-area-inset-bottom)); border-radius: 25px 25px 0 0; }
}

@media (max-width: 380px) {
  body { font-size: 16px; }
  .app-header h1 { font-size: 29px; }
  .install-button { font-size: 12px; }
  .day-card { min-width: 156px; }
  .travel-content { padding-right: 14px; padding-left: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
