:root {
  --olive: #3a4d1e;
  --olive-mid: #4f6828;
  --gold: #a89050;
  --gold-lt: #c8b97a;
  --cream: #f5f0e8;
  --cream-dk: #ede6d6;
  --sage: #7a8a5a;
  --ink: #2c2c2c;
  --danger: #a24a3a;

  --display: 'Cinzel', Georgia, serif;
  --body: 'EB Garamond', Georgia, serif;
  --mono: 'IBM Plex Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--olive);
  color: var(--ink);
  font-family: var(--body);
  -webkit-tap-highlight-color: transparent;
}

body { min-height: 100vh; min-height: 100dvh; }

.app {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: 76px;
  background: var(--cream);
  box-shadow: 0 0 80px rgba(0,0,0,0.4);
}

/* Header */
.app-header {
  background: var(--olive);
  padding: 26px 20px 16px;
  border-bottom: 2px solid var(--gold);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  color: var(--gold-lt);
  flex-shrink: 0;
}
.app-header h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: 0.04em;
  margin: 0;
  color: var(--cream);
}
.brand-sub {
  margin: 3px 0 0;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  font-family: var(--display);
}

/* Main / panes */
.app-main { flex: 1; padding: 24px 20px 40px; }

.pane-head { margin-bottom: 18px; }
.pane-head h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  color: var(--olive);
  margin: 0 0 6px;
}
.pane-head h2::after {
  content: '';
  display: block;
  width: 34px;
  height: 2px;
  background: linear-gradient(to right, var(--gold), transparent);
  margin-top: 8px;
}
.pane-head p {
  margin: 0;
  color: var(--sage);
  font-size: 14.5px;
  font-style: italic;
}

/* Forms / rows */
.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.row input[type="text"],
.row select {
  flex: 1 1 160px;
  background: #fff;
  border: 1px solid var(--gold-lt);
  color: var(--ink);
  padding: 11px 14px;
  border-radius: 2px;
  font-family: var(--body);
  font-size: 16px;
  min-width: 0;
}
.row input[type="text"]:focus,
.row select:focus {
  outline: 2px solid var(--olive);
  outline-offset: 1px;
}
.row button {
  background: var(--olive);
  color: var(--cream);
  border: none;
  padding: 11px 18px;
  border-radius: 2px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
}
.row button:active { transform: translateY(1px); }

.btn-primary {
  background: var(--olive);
  color: var(--cream);
  border: none;
  padding: 11px 18px;
  border-radius: 2px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-primary:disabled { background: var(--cream-dk); color: var(--sage); cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--olive);
  border: 1px solid var(--gold);
  padding: 11px 16px;
  border-radius: 2px;
  font-family: var(--display);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-ghost:disabled { color: var(--sage); border-color: var(--cream-dk); cursor: not-allowed; }

.route-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.hint {
  font-size: 13px;
  color: var(--sage);
  margin-top: 10px;
  line-height: 1.6;
  font-style: italic;
}

/* Weather */
.weather-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.weather-card {
  border-radius: 4px;
  padding: 18px 14px;
  color: var(--cream);
  background: linear-gradient(165deg, var(--olive-mid), var(--olive));
  border: 1px solid var(--gold);
  position: relative;
  overflow: hidden;
}
.weather-card::before {
  content: '';
  position: absolute; top: 0; left: 10px; right: 10px;
  height: 2px; background: var(--gold);
}
.weather-card.dest {
  background: linear-gradient(165deg, #8a6a3c, #5c4726);
}
.weather-card h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(12px, 3.4vw, 14px);
  letter-spacing: 0.05em;
  margin: 6px 0 10px;
  color: var(--gold-lt);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.weather-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.weather-icon { font-size: clamp(26px, 7.5vw, 34px); line-height: 1; }
.weather-now {
  font-size: clamp(26px, 7.5vw, 36px);
  font-family: var(--display);
  font-weight: 700;
  line-height: 1;
}
.weather-desc { font-size: 12px; opacity: 0.85; margin-bottom: 14px; font-style: italic; }
.weather-days { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin: 0 -4px; scrollbar-width: none; }
.weather-days::-webkit-scrollbar { display: none; }
.weather-day {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(245,240,232,0.12);
  border-radius: 3px;
  padding: 8px 9px;
  min-width: 48px;
}
.weather-day .wd-label { font-size: 10px; opacity: 0.85; font-family: var(--display); letter-spacing: 0.04em; }
.weather-day .wd-icon { font-size: 15px; }
.weather-day .wd-temp { font-size: 11.5px; font-family: var(--mono); white-space: nowrap; }
.weather-day .wd-temp b { opacity: 1; }
.weather-day .wd-temp span { opacity: 0.65; }
@media (max-width: 380px) {
  .weather-grid { gap: 6px; }
  .weather-card { padding: 14px 10px; }
}
@media (max-width: 600px) {
  .weather-days { flex-direction: column; overflow-x: visible; margin: 0; }
  .weather-day { flex-direction: row; justify-content: space-between; width: 100%; padding: 7px 10px; }
  .weather-day .wd-label { width: 34px; text-align: left; }
  .weather-day .wd-icon { font-size: 14px; }
}

/* Place lists */
.place-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.place-item {
  background: #fff;
  border: 1px solid var(--cream-dk);
  border-left: 3px solid var(--gold);
  border-radius: 2px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.place-item .p-name { font-weight: 600; font-size: 15.5px; color: var(--olive); font-family: var(--body); }
.place-item .p-meta { font-size: 11.5px; color: var(--sage); font-family: var(--display); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 3px; }
.place-item button {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--olive);
  border-radius: 2px;
  padding: 8px 10px;
  font-family: var(--display);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  flex-shrink: 0;
}

/* Route list */
.route-list { list-style: none; margin: 0 0 4px; padding: 0; counter-reset: stop; }
.route-list li {
  counter-increment: stop;
  background: #fff;
  border: 1px solid var(--cream-dk);
  border-radius: 2px;
  padding: 10px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.route-list li::before {
  content: counter(stop);
  font-family: var(--display);
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.route-list li span { flex: 1; font-size: 15px; }
.route-list li button {
  background: transparent;
  border: none;
  color: var(--sage);
  cursor: pointer;
  font-size: 12.5px;
  font-family: var(--display);
  letter-spacing: 0.03em;
}

/* Itinerary */
.day-card {
  background: #fff;
  border: 1px solid var(--cream-dk);
  border-top: 2px solid var(--gold);
  border-radius: 2px;
  padding: 16px;
  margin-bottom: 14px;
}
.day-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.day-card-head h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.03em;
  color: var(--olive);
  margin: 0;
}
.day-card-head button {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 12px;
  font-family: var(--display);
  letter-spacing: 0.03em;
  cursor: pointer;
}
.day-card textarea {
  width: 100%;
  min-height: 140px;
  background: var(--cream);
  border: 1px solid var(--cream-dk);
  color: var(--ink);
  border-radius: 2px;
  padding: 10px 12px;
  font-family: var(--body);
  font-size: 15.5px;
  line-height: 1.55;
  resize: vertical;
  overflow: hidden;
}
.empty-state {
  text-align: center;
  color: var(--sage);
  border: 1px dashed var(--gold-lt);
  border-radius: 2px;
  padding: 30px 16px;
  font-size: 14px;
  font-style: italic;
}

/* Tab bar */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 720px;
  margin: 0 auto;
  background: var(--olive);
  border-top: 2px solid var(--gold);
  display: flex;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 10;
  box-shadow: 0 0 40px rgba(0,0,0,0.35);
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: rgba(245,240,232,0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 2px;
  font-family: var(--display);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
}
.tab-btn .tab-ico { display: block; }
.tab-btn.active { color: var(--gold-lt); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Wider screens: give the app more breathing room, and let the itinerary
   use two columns instead of one long narrow strip. */
@media (min-width: 900px) {
  .app { max-width: 960px; }
  .tabbar { max-width: 960px; }
  #plan-days {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    align-items: start;
  }
  #plan-days .day-card { margin-bottom: 0; }
  #plan-days .empty-state { grid-column: 1 / -1; }
}
