:root {
  color-scheme: dark;

  --bg: #0a0c12;
  --bg-texture: rgba(255, 255, 255, 0.025);
  --surface: #12151d;
  --surface-raised: #181c26;
  --text: #f4efe3;
  --muted: #918d84;
  --accent: #f0a63c;
  --accent-contrast: #16110a;
  --accent-soft: rgba(240, 166, 60, 0.16);
  --secondary: #e0644a;
  --danger: #e0644a;
  --border: #262a34;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 14px 30px -18px rgba(0, 0, 0, 0.7);

  --font-display: ui-serif, Georgia, 'Iowan Old Style', serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --font-body: -apple-system, ui-sans-serif, system-ui, sans-serif;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f6f1e3;
    --bg-texture: rgba(50, 35, 10, 0.03);
    --surface: #fffcf5;
    --surface-raised: #ffffff;
    --text: #201a12;
    --muted: #7a7160;
    --accent: #c07615;
    --accent-contrast: #fffaf0;
    --accent-soft: rgba(192, 118, 21, 0.13);
    --secondary: #b23a2a;
    --danger: #b23a2a;
    --border: #e7ddc4;
    --shadow: 0 1px 2px rgba(60, 40, 10, 0.08), 0 14px 30px -18px rgba(60, 40, 10, 0.2);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  background-image: repeating-linear-gradient(
    135deg,
    var(--bg-texture) 0px,
    var(--bg-texture) 1px,
    transparent 1px,
    transparent 14px
  );
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; }

a { color: var(--accent); }

#view-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
}

/* ---------- bottom tab bar ---------- */

#tab-nav {
  display: flex;
  background: var(--surface-raised);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab-button {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.85rem 0.2rem 0.7rem;
  min-height: 48px;
  position: relative;
  transition: color 0.2s ease;
}

.tab-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent);
  transform: translateX(-50%);
  transition: width 0.25s ease;
}

.tab-button[aria-current="page"] {
  color: var(--accent);
  font-weight: 600;
}

.tab-button[aria-current="page"]::before { width: 26px; }

/* ---------- chip nav (day picker, info tabs) ---------- */

.chip-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.chip {
  min-height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  padding: 0.45rem 1rem;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.chip[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
}

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.3rem 1.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 0.45rem;
  font-size: 1.35rem;
  line-height: 1.25;
}

.card p { line-height: 1.55; margin: 0.5rem 0; }
.card strong { font-family: var(--font-display); font-size: 1.05rem; }

.card a {
  display: inline-block;
  max-width: 100%;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.87rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  margin: 0.3rem 0.4rem 0.3rem 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.card a:hover, .card a:active { border-color: var(--accent); background: var(--accent-soft); }
.card a::after { content: '\2197'; font-family: var(--font-mono); font-size: 0.8em; }
.card a[href^="tel:"]::after { content: '\260E'; }

/* ---------- Now screen: the day heading + hero ticket card ---------- */

.day-heading {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.2rem 0 0.9rem;
}

.day-heading strong {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: normal;
  text-transform: none;
  color: var(--accent);
}

.ticket-top { display: flex; align-items: flex-start; gap: 0.85rem; }

.icon-badge {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.ticket-top-text { flex: 1; min-width: 0; }

.step-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.15rem 0 0;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.4rem;
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.78); }
}

.step-time {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.08rem;
  letter-spacing: 0.01em;
  color: var(--accent);
  margin: 0.4rem 0 0.6rem;
}

.ticket-divider {
  position: relative;
  height: 1px;
  margin: 1.1rem -1.35rem 1.1rem;
  background-image: repeating-linear-gradient(
    to right,
    var(--border) 0,
    var(--border) 6px,
    transparent 6px,
    transparent 13px
  );
}

.ticket-divider::before,
.ticket-divider::after {
  content: '';
  position: absolute;
  top: -10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg);
}

.ticket-divider::before { left: -10px; }
.ticket-divider::after { right: -10px; }

.ticket-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }

.geo-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin: 0.1rem 0 0;
}

.advice-card {
  position: relative;
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-soft), var(--surface) 60%);
}

.advice-card .ticket-top { align-items: center; }

.advice-dismiss {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  margin-left: auto;
}

.advice-card ul {
  margin-top: 0.6rem;
}

.advice-card li {
  position: relative;
  padding: 0.4rem 0 0.4rem 1.1rem;
  line-height: 1.5;
  border-bottom: 1px dashed var(--border);
}

.advice-card li:last-child { border-bottom: none; }

.advice-card li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.85rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.advice-card li.advice-ai::before { background: var(--secondary); }

.advice-card li.advice-ai::after {
  content: 'AI';
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: var(--secondary);
  border: 1px solid var(--secondary);
  border-radius: 999px;
  padding: 0.05rem 0.4rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.flight-status-note {
  display: inline-block;
  max-width: 100%;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.3rem 0.4rem 0.3rem 0;
}

.countdown {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.7rem;
}

.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin-top: 1rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--secondary));
  border-radius: 999px;
}

.badge {
  display: inline-block;
  background: var(--secondary);
  color: #fff8f0;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ---------- buttons ---------- */

button { font-family: inherit; }

.big-button {
  min-height: 48px;
  min-width: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.3rem;
  margin: 0.25rem 0.5rem 0.25rem 0;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.big-button:active { transform: scale(0.97); filter: brightness(0.92); }

/* ---------- checklist ---------- */

ul.plain { list-style: none; margin: 0; padding: 0; }

.checklist-count {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 400;
  margin-left: 0.5rem;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 52px;
  padding: 0.6rem 0;
  border-bottom: 1px dashed var(--border);
}

.checklist-item:last-child { border-bottom: none; }

.checklist-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--surface-raised);
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.checklist-item input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.checklist-item input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 8px;
  top: 3px;
  width: 6px;
  height: 12px;
  border: solid var(--accent-contrast);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checklist-item label { flex: 1; line-height: 1.4; color: var(--text); }

.checklist-item:has(input:checked) label {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--border);
}

/* ---------- transit cards: person tiles, balance-flow, stat grid ---------- */

.person-compare {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.person-tile {
  flex: 1;
  min-width: 96px;
  text-align: center;
  padding: 0.9rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

.person-tile .icon-badge { margin: 0 auto 0.55rem; }

.person-name {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.person-card {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 0.3rem 0 0;
}

.person-note {
  font-size: 0.74rem;
  color: var(--muted);
  margin: 0.3rem 0 0;
  line-height: 1.4;
}

.balance-flow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.balance-box {
  flex: 1;
  text-align: center;
  padding: 1rem 0.5rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface-raised);
}

.balance-icon { font-size: 1.6rem; }

.balance-label {
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin: 0.35rem 0 0.15rem;
}

.balance-use {
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0;
}

.balance-arrow {
  flex-shrink: 0;
  width: 64px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.03em;
  color: var(--secondary);
  text-align: center;
  text-transform: uppercase;
}

.stat-grid {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.stat-tile {
  flex: 1;
  min-width: 130px;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--accent-soft);
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin: 0;
}

.stat-label {
  font-size: 0.76rem;
  color: var(--muted);
  margin: 0.25rem 0 0;
}

/* ---------- flow (tap-to-expand step chains, e.g. WOWPASS guide) ---------- */

ol.flow {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}

.flow-step { margin-bottom: 0.45rem; }

.flow-summary {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.92rem;
  text-align: left;
}

.flow-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flow-label { flex: 1; }

.flow-chevron {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.flow-open .flow-chevron { transform: rotate(180deg); }

.flow-detail {
  margin: 0.4rem 0 0 2.25rem;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ---------- collapsible step detail (timeline) ---------- */

.step-detail-text.collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.detail-toggle {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  padding: 0.3rem 0;
  min-height: 32px;
}

/* ---------- timeline ---------- */

ul.timeline {
  position: relative;
  padding-left: 30px;
}

ul.timeline::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 0.6rem;
  bottom: 0.6rem;
  width: 2px;
  background: var(--border);
}

ul.timeline > li { position: relative; }

ul.timeline > li::before {
  content: '';
  position: absolute;
  left: -23px;
  top: 1.35rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 2px solid var(--muted);
}

ul.timeline > li.step-current::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

ul.timeline > li.step-past::before {
  border-color: var(--border);
  background: var(--border);
}

.step-past { opacity: 0.5; }

.step-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}

/* ---------- settings ---------- */

.switch-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.98rem;
  margin-bottom: 1.2rem;
}

.switch-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--border);
  position: relative;
  transition: background 0.2s ease;
}

.switch-label input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-raised);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}

.switch-label input[type="checkbox"]:checked { background: var(--accent); }
.switch-label input[type="checkbox"]:checked::after { transform: translateX(20px); }

input[type="datetime-local"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text);
  font-family: var(--font-mono);
  margin: 0.5rem 0 1rem;
}

.meta-line {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 1rem;
}

/* ---------- dialog ---------- */

dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  background: var(--surface-raised);
  color: var(--text);
  max-width: 90vw;
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(0, 0, 0, 0.65); }

dialog h2 { margin-top: 0; }
dialog li { margin-bottom: 0.5rem; list-style: none; }
dialog .big-button { display: block; width: 100%; text-align: left; margin: 0; }

.alarm-dialog {
  text-align: center;
  border: 2px solid var(--secondary);
  box-shadow: 0 0 0 1px var(--secondary), var(--shadow);
  animation: alarm-pulse 1.1s ease-in-out infinite;
}

.alarm-icon { font-size: 2.6rem; }

.alarm-message {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.4;
  margin: 0.75rem 0 1.25rem;
}

.alarm-dialog .big-button {
  background: var(--secondary);
  text-align: center;
  font-weight: 700;
}

@keyframes alarm-pulse {
  0%, 100% { box-shadow: 0 0 0 1px var(--secondary), var(--shadow); }
  50% { box-shadow: 0 0 0 6px var(--accent-soft), var(--shadow); }
}

@media (prefers-reduced-motion: reduce) {
  .alarm-dialog { animation: none; }
}

/* ---------- entrance animation (tab/day/section switches only) ---------- */

@keyframes rise-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.enter { animation: rise-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }

@media (prefers-reduced-motion: reduce) {
  .enter { animation: none; }
  .live-dot { animation: none; }
}
