/* ─── Reset & Base ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #faf8f5;
  --bg2: #ffffff;
  --bg3: #f0ede8;
  --card: #ffffff;
  --card2: #f5f2ee;
  --border: #e8e2da;
  --text: #1a1510;
  --text2: #6b5e52;
  --text3: #9b8e82;
  --accent: #f97316;
  --accent2: #ea580c;
  --gold: #d97706;
  --green: #059669;
  --red: #dc2626;
  --pink: #db2777;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
}

html, body {
  height: 100%;
  min-height: 100dvh;
  background: var(--bg2);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ─── Screens ───────────────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.screen.active { display: flex !important; }

/* ─── Splash Screen ─────────────────────────────────── */
/* ─── Splash Screen ────────────────────────────────── */
#splash {
  background: radial-gradient(ellipse at 50% 40%, #2a1060 0%, #0d0820 50%, #060410 100%);
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
  position: relative;
}

/* Falling particles */
#splash-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.splash-particle {
  position: absolute;
  top: -40px;
  animation: particle-fall linear infinite;
  user-select: none;
}
@keyframes particle-fall {
  0%   { transform: translateY(-40px) rotate(0deg); opacity: 0; }
  8%   { opacity: 1; }
  85%  { opacity: 0.6; }
  100% { transform: translateY(110vh) rotate(540deg); opacity: 0; }
}

/* Top brand bar */
.splash-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  padding-top: calc(18px + env(safe-area-inset-top, 0));
  position: relative;
  z-index: 2;
}
.splash-brand {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 4px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
}
.splash-year {
  font-size: 11px;
  font-weight: 700;
  color: rgba(245,158,11,0.7);
  letter-spacing: 2px;
}

/* Hero illustration area */
.splash-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0 20px 10px;
  min-height: 0;
  z-index: 2;
}

/* Glow orb behind sumo */
.splash-hero::before {
  content: '';
  position: absolute;
  width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245,158,11,0.18) 0%, rgba(139,92,246,0.08) 50%, transparent 70%);
  animation: glow-pulse 3s ease-in-out infinite;
  pointer-events: none;
}
@keyframes glow-pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50%       { transform: scale(1.15); opacity: 1; }
}

/* Sumo SVG */
.sumo-svg {
  width: 100%;
  max-width: 320px;
  height: auto;
  max-height: 300px;
  filter: drop-shadow(0 24px 48px rgba(245,158,11,0.45)) drop-shadow(0 0 80px rgba(139,92,246,0.2));
  opacity: 0;
  transform: translateY(100px) scale(0.5);
  cursor: default;
  position: relative;
  z-index: 3;
}
.sumo-svg.enter {
  animation: sumo-entrance 0.7s cubic-bezier(0.34,1.5,0.64,1) forwards;
}
.sumo-svg.idle {
  animation: sumo-bounce 2.6s ease-in-out infinite;
}
.sumo-svg.nom {
  animation: sumo-nom 0.55s ease-in-out both;
}
.sumo-svg.nom #sumo-head {
  animation: head-dip 0.55s ease-in-out both;
  transform-origin: 160px 145px;
}
.sumo-svg.nom #sumo-mouth {
  animation: mouth-chomp 0.55s ease-in-out both;
  transform-origin: 160px 125px;
}
@keyframes sumo-entrance {
  0%   { opacity: 0; transform: translateY(100px) scale(0.5) rotate(-8deg); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}
@keyframes sumo-bounce {
  0%, 100% { transform: translateY(0) rotate(-1.5deg) scale(1); }
  50%       { transform: translateY(-14px) rotate(2deg) scale(1.02); }
}
@keyframes sumo-nom {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.04) translateY(-4px); }
  100% { transform: scale(1); }
}
@keyframes head-dip {
  0%   { transform: translateY(0) rotate(0deg); }
  30%  { transform: translateY(22px) rotate(8deg); }
  55%  { transform: translateY(14px) rotate(4deg); }
  80%  { transform: translateY(20px) rotate(7deg); }
  100% { transform: translateY(0) rotate(0deg); }
}
@keyframes mouth-chomp {
  0%   { transform: scaleY(1); }
  15%  { transform: scaleY(0.1); }
  35%  { transform: scaleY(1.8); }
  55%  { transform: scaleY(0.15); }
  75%  { transform: scaleY(1.5); }
  100% { transform: scaleY(1); }
}

/* Steam */
.steam { animation: steam-rise 2s ease-in-out infinite; transform-origin: bottom center; }
.s1 { animation-delay: 0s; }
.s2 { animation-delay: 0.6s; }
.s3 { animation-delay: 1.2s; }
@keyframes steam-rise {
  0%   { opacity: 0; transform: translateY(4px) scaleX(0.8); }
  40%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px) scaleX(1.3); }
}

/* Speech bubble */
.speech-bubble {
  background: #fff;
  color: #1a1a2e;
  border-radius: 20px 20px 20px 4px;
  padding: 11px 18px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  position: absolute;
  bottom: 0px;
  right: 10px;
  white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  opacity: 0;
  transform: scale(0.6) translateY(10px);
  transition: opacity 0.35s, transform 0.35s cubic-bezier(0.34,1.56,0.64,1);
  z-index: 4;
}
.speech-bubble.visible { opacity: 1; transform: scale(1) translateY(0); }
.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -9px; left: 16px;
  border: 9px solid transparent;
  border-top-color: #fff;
  border-bottom: 0;
}

/* Tap hint hidden */
.tap-hint { display: none !important; }

/* Bottom card */
.splash-card {
  background: linear-gradient(180deg, rgba(15,10,30,0.7) 0%, rgba(10,8,20,0.95) 100%);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(245,158,11,0.2);
  padding: 22px 28px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0));
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  z-index: 2;
}
.splash-card-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: rgba(245,158,11,0.8);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.splash-card-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.1;
  background: linear-gradient(135deg, #f59e0b 0%, #ec4899 55%, #818cf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.splash-card-dates {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  margin-top: 2px;
}

.splash-card-meta {
  font-size: 13px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 6px;
}

.splash-btn {
  margin-top: 10px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white;
  border: none;
  border-radius: 14px;
  padding: 16px;
  font-size: 17px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.3px;
  box-shadow: 0 8px 30px rgba(245,158,11,0.4);
  transition: transform 0.1s, box-shadow 0.1s;
  width: 100%;
}
.splash-btn:active { transform: scale(0.97); box-shadow: 0 4px 15px rgba(245,158,11,0.3); }

/* Bowl counter */
.bowl-counter {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(245,158,11,0.2);
  border: 1px solid rgba(245,158,11,0.4);
  color: #f59e0b;
  border-radius: 100px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 800;
  align-items: center;
  gap: 4px;
  animation: counter-pop 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes counter-pop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Tap hint */
.tap-hint {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  animation: hint-pulse 2s ease-in-out infinite;
  white-space: nowrap;
}
@keyframes hint-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.7; }
}

#splash-fact {
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  text-align: center;
  margin-top: 12px;
  min-height: 32px;
  line-height: 1.4;
  transition: opacity 0.3s;
  font-style: italic;
}

/* ─── Nav Bar ───────────────────────────────────────── */
.nav-bar {
  display: flex;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
  flex-shrink: 0;
  position: relative;
}
/* Extend nav background below safe area on iOS PWA */
.nav-bar::after {
  content: '';
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: env(safe-area-inset-bottom, 0);
  background: var(--bg2);
  z-index: 1;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 4px;
  border: none;
  background: transparent;
  color: var(--text3);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-btn .nav-icon { font-size: 22px; }
.nav-btn.active { color: var(--accent2); }

/* ─── Screen Header ─────────────────────────────────── */
.screen-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px 12px;
  padding-top: calc(16px + env(safe-area-inset-top, 0));
  flex-shrink: 0;
}
.screen-header h1 {
  font-size: 22px;
  font-weight: 800;
}
.screen-header p {
  font-size: 13px;
  color: var(--text2);
  margin-top: 2px;
}

/* ─── Scrollable Content ────────────────────────────── */
.scroll-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}
.scroll-content::-webkit-scrollbar { display: none; }

/* ─── Calendar Screen ───────────────────────────────── */
.trip-hero {
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.trip-hero-emoji { font-size: 40px; }
.trip-hero-info h2 { font-size: 18px; font-weight: 800; }
.trip-hero-info p { font-size: 13px; color: var(--text2); margin-top: 2px; }

.day-cards { display: flex; flex-direction: column; gap: 10px; }

.day-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  flex-direction: column;
}
.day-card:active { transform: scale(0.985); }

/* Colored header bar */
.day-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
}
.day-card-header-left { display: flex; flex-direction: column; }
.day-card-num { font-size: 11px; font-weight: 800; color: rgba(255,255,255,0.7); text-transform: uppercase; letter-spacing: 1px; }
.day-card-date { font-size: 13px; font-weight: 700; color: #fff; margin-top: 1px; }
.day-card-emoji-big { font-size: 30px; line-height: 1; }

/* Card body */
.day-card-body { padding: 12px 14px 14px; }
.day-card-title { font-size: 16px; font-weight: 800; color: #1a1510; margin-bottom: 2px; }
.day-card-area { font-size: 12px; color: #6b5e52; }
.day-card-transit { font-size: 11px; color: #9b8e82; margin-top: 4px; }

/* Highlights */
.card-highlights { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.card-highlight {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12px;
}
.card-hl-time { color: var(--text3); font-weight: 600; min-width: 60px; flex-shrink: 0; font-size: 11px; padding-top: 1px; }
.card-hl-label { color: var(--text2); flex: 1; }
.card-hl-check { color: var(--green); font-weight: 800; }

/* Footer */
.day-card-footer { margin-top: 12px; display: flex; align-items: center; justify-content: space-between; }

/* keep old refs working */
.day-card-info { flex: 1; min-width: 0; }
.day-card-label { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.day-card-vibe { font-size: 12px; color: var(--text3); margin-top: 4px; font-style: italic; }

.status-badge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-booked { background: rgba(16,185,129,0.15); color: var(--green); border: 1px solid rgba(16,185,129,0.3); }
.status-todo { background: rgba(245,158,11,0.15); color: var(--gold); border: 1px solid rgba(245,158,11,0.3); }
.status-flexible { background: rgba(148,163,184,0.1); color: var(--text2); border: 1px solid var(--border); }

/* ─── Day Detail Screen ─────────────────────────────── */
#day-detail { position: absolute; inset: 0; z-index: 10; background: var(--bg); transform: translateX(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
#day-detail.open { transform: translateX(0); }
#day-detail .screen-header { padding-top: calc(16px + env(safe-area-inset-top, 0)); }

.detail-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.back-btn {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px 6px 8px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.detail-title-block { flex: 1; min-width: 0; }
.detail-day-label { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; }
.detail-title { font-size: 20px; font-weight: 800; }
.detail-area { font-size: 13px; color: var(--text2); }
.detail-emoji { font-size: 32px; flex-shrink: 0; }

.detail-vibe {
  font-size: 13px;
  color: var(--text2);
  font-style: italic;
  padding: 10px 14px;
  background: var(--card);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--day-accent, var(--accent));
  margin: 4px 0 0;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
  margin: 20px 0 10px;
}

/* Section title with expand button */
.section-title-row {
  display: flex; align-items: center; justify-content: space-between;
  margin: 20px 0 10px;
}
.map-expand-btn {
  background: rgba(255,255,255,0.07); border: 1px solid var(--border);
  color: var(--text2); font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 100px; cursor: pointer;
  letter-spacing: 0.3px;
}
.map-expand-btn:active { opacity: 0.7; }

/* Day detail mini-map */
.day-mini-map {
  width: 100%;
  height: 240px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

/* Map route button */
.map-route-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #1a73e8, #0d5bba);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-decoration: none;
  color: white;
  border: none;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.1s;
}
.map-route-btn:active { transform: scale(0.98); opacity: 0.9; }
.map-route-icon { font-size: 28px; flex-shrink: 0; }
.map-route-label { font-size: 15px; font-weight: 800; }
.map-route-sub { font-size: 12px; opacity: 0.75; margin-top: 2px; }
.map-route-arrow { font-size: 20px; margin-left: auto; opacity: 0.7; }

/* Quick stop buttons */
.map-quick-stops {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.map-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.1s;
}
.map-quick-btn:active { background: var(--card2); }

/* Stops timeline */
.stops-list { display: flex; flex-direction: column; gap: 0; }
.stop-item {
  display: flex;
  gap: 12px;
  position: relative;
  padding-bottom: 16px;
}
.stop-item:last-child { padding-bottom: 0; }
.stop-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 36px;
}
.stop-dot {
  width: 36px; height: 36px;
  background: var(--card2);
  border: 2px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.stop-line {
  width: 2px;
  flex: 1;
  background: var(--border);
  margin-top: 4px;
  min-height: 16px;
}
.stop-item:last-child .stop-line { display: none; }
.stop-right { flex: 1; padding-top: 4px; }
.stop-time { font-size: 11px; color: var(--text3); font-weight: 600; }
.stop-name { font-size: 15px; font-weight: 700; margin-top: 2px; }
.stop-note { font-size: 13px; color: var(--text2); margin-top: 3px; }
.stop-maps-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 12px;
  color: #4285f4;
  background: rgba(66,133,244,0.1);
  border: 1px solid rgba(66,133,244,0.25);
  border-radius: 100px;
  padding: 4px 10px;
  text-decoration: none;
  font-weight: 600;
}

/* Food list */
.food-list { display: flex; flex-direction: column; gap: 8px; }
.food-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  display: flex;
  gap: 10px;
}
.food-emoji { font-size: 22px; flex-shrink: 0; }
.food-name { font-size: 14px; font-weight: 700; }
.food-note { font-size: 12px; color: var(--text2); margin-top: 2px; }
.food-maps-link {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px; font-size: 12px; font-weight: 600;
  color: #4285f4; text-decoration: none;
  background: rgba(66,133,244,0.1); border: 1px solid rgba(66,133,244,0.2);
  border-radius: 100px; padding: 3px 10px;
}

/* Shuttle booking card */
.shuttle-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 8px;
}
.shuttle-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: linear-gradient(135deg, #003580, #0071c2);
}
.shuttle-direction { font-size: 13px; font-weight: 700; color: #fff; }
.shuttle-manage-btn {
  font-size: 11px; font-weight: 700; color: #fff;
  background: rgba(255,255,255,0.2); border-radius: 100px;
  padding: 3px 10px; text-decoration: none;
}
.shuttle-rows { padding: 10px 14px; display: flex; flex-direction: column; gap: 7px; }
.shuttle-row {
  display: flex; gap: 8px; font-size: 12px; line-height: 1.4;
  padding-bottom: 7px; border-bottom: 1px solid var(--border);
}
.shuttle-row:last-child { border-bottom: none; padding-bottom: 0; }
.shuttle-lbl { color: var(--text3); font-weight: 600; min-width: 62px; flex-shrink: 0; }
.shuttle-row-highlight { background: rgba(0,113,194,0.08); margin: 0 -14px; padding: 7px 14px; border-radius: 0; }
.shuttle-booking-btn {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  padding: 12px 14px; background: #003580; text-decoration: none;
  color: #fff; font-size: 13px; font-weight: 600;
}
.shuttle-bcom-logo {
  background: #fff; color: #003580; font-size: 10px; font-weight: 900;
  padding: 2px 7px; border-radius: 3px; letter-spacing: -0.3px;
}

/* Klook voucher button */
.klook-btn {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #ff5533, #ff3366);
  border-radius: var(--radius-sm); padding: 14px 16px;
  text-decoration: none; color: #fff; margin-bottom: 8px;
  gap: 12px;
}
.klook-btn:active { opacity: 0.9; transform: scale(0.99); }
.klook-left { display: flex; align-items: center; gap: 12px; }
.klook-logo {
  background: #fff; color: #ff5533; font-size: 10px; font-weight: 900;
  padding: 3px 6px; border-radius: 4px; letter-spacing: 0.5px; flex-shrink: 0;
}
.klook-title { font-size: 13px; font-weight: 700; }
.klook-meta { font-size: 11px; opacity: 0.85; margin-top: 2px; }
.klook-arrow { font-size: 18px; opacity: 0.8; flex-shrink: 0; }

/* Todos */
.todo-list { display: flex; flex-direction: column; gap: 6px; }
.todo-item {
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--gold);
  display: flex; gap: 8px; align-items: flex-start;
}

/* Booked list */
.booked-list { display: flex; flex-direction: column; gap: 6px; }
.booked-item {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--green);
  display: flex; gap: 8px; align-items: center;
}

/* ─── Family Tracker Screen ─────────────────────────── */
.family-map-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
#leaflet-map {
  width: 100%; height: 100%;
}
.leaflet-tile { filter: saturate(1.1); }
.leaflet-container { background: var(--bg3); }

.map-pin {
  width: 36px; height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,0.8);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.map-pin span {
  transform: rotate(45deg);
  color: white; font-weight: 800; font-size: 14px;
}

.identity-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 8px; margin-bottom: 12px;
}
.identity-btn {
  background: var(--card); border: 2px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 10px 6px; font-size: 13px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 6px;
}
.identity-btn:active { background: var(--card2); }
.identity-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.member-chip.me { background: var(--card2); border-color: var(--accent); }

.family-panel {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0));
  flex-shrink: 0;
}
.family-panel-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text3);
  margin-bottom: 10px;
}
.family-members-row {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.member-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 100px; padding: 6px 12px 6px 8px;
  font-size: 13px;
}
.member-dot {
  width: 10px; height: 10px; border-radius: 50%;
  flex-shrink: 0;
}
.member-status { font-size: 11px; color: var(--text3); }

.share-location-btn {
  width: 100%;
  margin-top: 12px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.share-location-btn.sharing {
  background: linear-gradient(135deg, #10b981, #059669);
}

/* ─── Install Screen ────────────────────────────────── */
.install-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.install-hero {
  background: linear-gradient(135deg, #fff7ed, #fef3c7);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.install-hero .big-icon { font-size: 56px; margin-bottom: 8px; }
.install-hero h2 { font-size: 20px; font-weight: 800; }
.install-hero p { color: var(--text2); font-size: 14px; margin-top: 6px; }

.install-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.install-section h3 {
  font-size: 15px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.os-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  padding: 3px 8px; border-radius: 100px;
}
.ios-badge { background: rgba(0,122,255,0.15); color: #4a9eff; border: 1px solid rgba(0,122,255,0.3); }
.android-badge { background: rgba(52,199,89,0.15); color: #4cd964; border: 1px solid rgba(52,199,89,0.3); }

.install-steps { display: flex; flex-direction: column; gap: 12px; }
.install-step {
  display: flex; gap: 12px; align-items: flex-start;
}
.step-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: white;
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step-text { font-size: 14px; color: var(--text); padding-top: 3px; }
.step-text strong { color: var(--accent2); }

.share-url-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  font-family: monospace;
  color: var(--accent2);
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; cursor: pointer;
  margin-top: 10px;
}
.copy-btn {
  background: var(--accent);
  color: white; border: none;
  border-radius: 6px; padding: 4px 10px;
  font-size: 12px; font-weight: 700; cursor: pointer;
  flex-shrink: 0;
}

/* ─── Animations ────────────────────────────────────── */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: slideUp 0.4s ease forwards; }

/* ─── Utilities ─────────────────────────────────────── */
.mt-4 { margin-top: 4px; }
.mb-16 { margin-bottom: 16px; }

/* ════════════════════════════════════════════════════
   NEW FEATURE STYLES
   ════════════════════════════════════════════════════ */

/* ─── Nav (4 buttons) ───────────────────────────────── */
.nav-bar { grid-template-columns: repeat(4, 1fr); }
.nav-btn { font-size: 10px; }
.nav-icon { font-size: 18px; }

/* ─── Subscreen header ──────────────────────────────── */
.tool-subscreen .subscreen-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px calc(14px + env(safe-area-inset-top, 0));
  padding-top: calc(14px + env(safe-area-inset-top, 0));
  background: var(--bg2); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tool-subscreen .subscreen-header h2 { margin: 0; font-size: 18px; }

/* ─── Tools Hub Grid ────────────────────────────────── */
.tools-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; padding: 16px;
}
.tool-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 14px;
  text-align: center; cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.tool-card:active { transform: scale(0.97); background: var(--bg3); }
.tool-card-icon { font-size: 32px; margin-bottom: 8px; }
.tool-card-label { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.tool-card-sub { font-size: 11px; color: var(--text3); }

/* ─── Currency ──────────────────────────────────────── */
.currency-wrap { padding: 16px; }
.currency-rate-note {
  text-align: center; font-size: 12px; color: var(--text3);
  margin-bottom: 16px; line-height: 1.6;
}
.currency-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.currency-labels {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.currency-flag { font-size: 14px; font-weight: 700; color: var(--text2); }
.currency-swap-btn {
  background: var(--accent); color: white; border: none;
  border-radius: 20px; padding: 6px 16px; font-size: 13px;
  font-weight: 700; cursor: pointer;
}
.currency-display {
  font-size: 42px; font-weight: 800; color: var(--text);
  text-align: center; letter-spacing: -1px; margin-bottom: 4px;
}
.currency-result {
  font-size: 22px; font-weight: 600; color: var(--accent2);
  text-align: center;
}
.currency-keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin-bottom: 12px;
}
.key-btn {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; font-size: 18px;
  font-weight: 600; color: var(--text); cursor: pointer;
  transition: background 0.1s;
}
.key-btn:active { background: var(--accent); color: white; }
.currency-presets {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.preset-btn {
  background: rgba(99,102,241,0.1); border: 1px solid rgba(99,102,241,0.3);
  border-radius: 8px; padding: 8px 4px; font-size: 12px;
  font-weight: 600; color: var(--accent); cursor: pointer;
}
.preset-btn:active { background: var(--accent); color: white; }

/* ─── Phrases ───────────────────────────────────────── */
.phrases-tabs {
  display: flex; gap: 8px; padding: 12px 16px;
  overflow-x: auto; flex-shrink: 0; border-bottom: 1px solid var(--border);
}
.phrase-tab-btn {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px; font-size: 13px;
  font-weight: 600; color: var(--text2); cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
}
.phrase-tab-btn.active {
  background: var(--accent); border-color: var(--accent); color: white;
}
.phrases-list { padding: 8px 16px; }
.phrase-item {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px; margin-bottom: 8px;
  cursor: pointer; transition: background 0.15s;
}
.phrase-item:active { background: var(--bg3); }
.phrase-en { font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 4px; }
.phrase-jp { font-size: 20px; color: var(--text); margin-bottom: 4px; line-height: 1.4; }
.phrase-romaji { font-size: 12px; color: var(--text3); font-style: italic; margin-bottom: 6px; }
.phrase-copy-hint { font-size: 11px; color: var(--accent); font-weight: 600; }

/* ─── Packing ───────────────────────────────────────── */
.packing-summary {
  text-align: center; font-size: 15px; font-weight: 700;
  color: var(--accent2); padding: 16px; background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.packing-reset-btn {
  display: block; margin: 8px 16px; background: none;
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text3); font-size: 12px; padding: 6px; cursor: pointer; width: calc(100% - 32px);
}
.packing-cat {
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  color: var(--text3); letter-spacing: 0.5px;
  padding: 14px 16px 6px;
}
.packing-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; font-size: 14px; color: var(--text);
}
.packing-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.packing-item.done span { text-decoration: line-through; color: var(--text3); }

/* ─── Emergency ─────────────────────────────────────── */
.emergency-section {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin: 12px 16px;
}
.emergency-title {
  font-size: 13px; font-weight: 800; text-transform: uppercase;
  color: var(--text3); letter-spacing: 0.5px; margin-bottom: 10px;
}
.emergency-jp-address {
  font-size: 20px; color: var(--text); line-height: 1.6;
  margin-bottom: 8px; font-weight: 600;
}
.emergency-en-address {
  font-size: 13px; color: var(--text2); margin-bottom: 12px; line-height: 1.5;
}
.emergency-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px;
}
.emergency-row:last-of-type { border-bottom: none; }
.emergency-num {
  color: var(--accent2); font-weight: 700; font-size: 16px;
  text-decoration: none; font-family: monospace;
}
.emergency-copy-btn {
  display: block; width: 100%; padding: 10px; margin: 10px 0 8px;
  background: var(--accent); color: white; border: none;
  border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.emergency-maps-btn {
  display: block; padding: 10px; text-align: center; margin-top: 8px;
  background: rgba(66,133,244,0.1); color: #4285f4;
  border: 1px solid rgba(66,133,244,0.3); border-radius: 8px;
  font-size: 13px; font-weight: 600; text-decoration: none;
}
.emergency-note {
  font-size: 13px; color: var(--text2); padding: 6px 0; line-height: 1.5;
}

/* ─── QR Vault ──────────────────────────────────────── */
.qr-intro {
  font-size: 13px; color: var(--text3); text-align: center;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.qr-group-title {
  font-size: 12px; font-weight: 800; text-transform: uppercase;
  color: var(--text3); letter-spacing: 0.5px;
  padding: 16px 16px 6px; border-left: 3px solid;
  margin-left: 16px;
}
.qr-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin: 8px 16px;
}
.qr-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; gap: 8px; }
.qr-card-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.qr-card-date { font-size: 12px; color: var(--text3); }
.qr-card-note { font-size: 11px; color: #f59e0b; margin-top: 4px; font-weight: 600; }
.qr-card-paid { font-size: 13px; font-weight: 700; color: var(--accent2); white-space: nowrap; }
.qr-code-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px; margin-bottom: 10px;
}
.qr-code { font-family: monospace; font-size: 14px; font-weight: 700; color: var(--accent2); }
.qr-copy-btn {
  background: var(--accent); color: white; border: none;
  border-radius: 6px; padding: 4px 10px; font-size: 12px;
  font-weight: 700; cursor: pointer;
}
.qr-open-btn {
  display: block; text-align: center; padding: 10px;
  border: 1.5px solid; border-radius: 8px;
  font-size: 13px; font-weight: 700; text-decoration: none;
}

/* ─── Chat ──────────────────────────────────────────── */
#chat { flex-direction: column; }
.chat-setup-banner {
  background: rgba(245,158,11,0.15); border-bottom: 1px solid rgba(245,158,11,0.3);
  color: #f59e0b; font-size: 12px; font-weight: 600;
  padding: 8px 16px; text-align: center; flex-shrink: 0;
}
.chat-messages-wrap {
  flex: 1; overflow-y: auto; padding: 12px 16px;
}
.chat-input-bar {
  border-top: 1px solid var(--border); background: var(--bg2);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0));
  flex-shrink: 0;
}
.chat-identity-row { padding-bottom: 8px; }
.chat-id-label { font-size: 11px; color: var(--text3); font-weight: 600; margin-bottom: 6px; }
.chat-identity-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-id-btn {
  background: var(--bg); border: 1.5px solid; border-radius: 20px;
  padding: 5px 12px; font-size: 12px; font-weight: 600; color: var(--text);
  cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.chat-id-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.chat-input-row { display: flex; gap: 8px; }
.chat-input {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 10px 16px; font-size: 16px;
  color: var(--text); outline: none;
}
.chat-input:focus { border-color: var(--accent); }
.chat-send-btn {
  background: var(--accent); color: white; border: none;
  border-radius: 20px; padding: 10px 18px; font-size: 14px;
  font-weight: 700; cursor: pointer; flex-shrink: 0;
}
.chat-msg { display: flex; flex-direction: column; margin-bottom: 12px; max-width: 80%; }
.chat-msg.me { align-self: flex-end; align-items: flex-end; margin-left: auto; }
.chat-msg.them { align-self: flex-start; align-items: flex-start; }
.chat-msg-author { font-size: 11px; font-weight: 700; margin-bottom: 3px; }
.chat-bubble {
  background: var(--accent); border-radius: 16px; padding: 10px 14px;
  font-size: 14px; color: white; line-height: 1.45; word-break: break-word;
}
.chat-msg.them .chat-bubble { background: var(--bg3); color: var(--text); }
.chat-time { font-size: 10px; color: var(--text3); margin-top: 3px; }
#chat-messages { display: flex; flex-direction: column; }

/* ─── Etix Booking Cards ────────────────────────────── */
.etix-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
  border-left: 3px solid #f59e0b;
}
.etix-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 10px; gap: 8px;
}
.etix-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.etix-time { font-size: 12px; color: var(--text3); }
.etix-paid { font-size: 13px; font-weight: 700; color: var(--accent2); white-space: nowrap; }
.etix-code-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 8px;
}
.etix-code-label { font-size: 11px; color: var(--text3); font-weight: 600; }
.etix-code { font-family: monospace; font-size: 15px; font-weight: 700; color: #f59e0b; }
.etix-note { font-size: 12px; color: var(--text2); margin-bottom: 10px; line-height: 1.5; }
.etix-btn {
  display: block; text-align: center; padding: 9px;
  background: rgba(245,158,11,0.1); color: #f59e0b;
  border: 1px solid rgba(245,158,11,0.3); border-radius: 8px;
  font-size: 13px; font-weight: 700; text-decoration: none;
}

/* ─── Photo Spots ───────────────────────────────────── */
.photo-spots-list { display: flex; flex-direction: column; gap: 8px; }
.photo-spot-item {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  border-left: 3px solid #ec4899;
}
.photo-spot-name { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.photo-spot-note { font-size: 13px; color: var(--text2); margin-bottom: 6px; line-height: 1.45; }
.photo-spot-time { font-size: 11px; color: #ec4899; font-weight: 600; }

/* ─── Light Mode Polish ─────────────────────────────── */
.day-card { box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.tool-card { box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.nav-bar { background: #ffffff; border-top: 1px solid #ede8e2; box-shadow: 0 -2px 12px rgba(0,0,0,0.05); }
.nav-btn { color: #b0a090; }
.nav-btn.active { color: var(--accent); }
.screen-header { background: #ffffff; border-bottom: 1px solid var(--border); }
.subscreen-header { background: #ffffff !important; border-bottom: 1px solid var(--border) !important; }
.family-panel { background: #ffffff; border-top: 1px solid var(--border); }
.chat-input-bar { background: #ffffff; border-top: 1px solid var(--border); }
.chat-input { background: var(--bg3); border-color: var(--border); color: var(--text); }
.packing-summary { background: #fff7ed; border-bottom: 1px solid var(--border); color: var(--accent); }
.key-btn { background: #ffffff; }
.currency-card { background: #ffffff; box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.emergency-section { background: #ffffff; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.qr-card { background: #ffffff; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.qr-code-row { background: var(--bg3); }
.etix-card { background: #ffffff; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.etix-code-row { background: #fff7ed; }
.share-url-box { background: var(--bg3); }
.food-item { box-shadow: 0 1px 6px rgba(0,0,0,0.04); }
.status-booked { background: rgba(5,150,105,0.1); color: var(--green); border-color: rgba(5,150,105,0.25); }
.status-todo { background: rgba(217,119,6,0.1); color: var(--gold); border-color: rgba(217,119,6,0.25); }
.status-flexible { background: rgba(0,0,0,0.04); color: var(--text3); border-color: var(--border); }
.detail-vibe { background: #fff7ed; color: var(--text2); }
.map-quick-btn { background: #ffffff; }
.stop-dot { background: #fff7ed; border-color: var(--border); }
.stop-line { background: var(--border); }
.identity-btn { background: #ffffff; }

/* ─── Instructions Screen ───────────────────────────── */
