/* Travelog base styles: soft illustrated travel look, custard and caramel palette. */

:root {
  color-scheme: light;

  /* Palette */
  --bg: #FBF3E0;          /* custard */
  --bg-deep: #F4E4C1;
  --card: #FFFFFF;
  --ink: #3B2A1A;         /* dark cocoa */
  --ink-soft: #7A6650;
  --line: #EBDDBF;
  --accent: #E8833A;      /* warm orange */
  --accent-dark: #C9672A;
  --caramel: #C68A4E;
  --ok: #5E9E6E;
  --warn: #D9A33A;
  --err: #C8553D;

  /* Category colours (map pins, list badges) */
  --cat-food: #E8833A;
  --cat-spot: #5F97C2;
  --cat-stay: #9A82C6;
  --cat-transport: #5E9E6E;
  --cat-flight: #7A8CA8;
  --cat-note: #B39B70;

  /* Type */
  --font-head: "Fraunces", Georgia, "Noto Serif TC", "PMingLiU", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;

  /* Shape */
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(59, 42, 26, 0.06), 0 6px 20px rgba(59, 42, 26, 0.07);

  --header-h: 56px;
  --tab-h: 64px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.4em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.25rem; }

p { margin: 0 0 0.75em; }
.muted { color: var(--ink-soft); }

img { max-width: 100%; }
[hidden] { display: none !important; }

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 16px 0;
  background: var(--bg);
}
.wordmark {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.header-actions { display: flex; gap: 8px; align-items: center; }

/* Layout */
main {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 16px calc(var(--tab-h) + 24px + env(safe-area-inset-bottom, 0px));
}
.screen { display: flex; flex-direction: column; gap: 16px; }

.hero { text-align: center; padding: 12px 0 4px; }
.mascot { display: block; margin: 0 auto 8px; }

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card > :last-child { margin-bottom: 0; }

.empty {
  text-align: center;
  padding: 48px 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  font: 600 1rem var(--font-body);
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:active { background: var(--accent-dark); }
.btn:disabled { opacity: 0.45; cursor: default; }

.chip {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: 500 0.875rem var(--font-body);
  cursor: pointer;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

/* Connection status */
.status-card { display: flex; gap: 14px; align-items: flex-start; }
.status-title { font-weight: 600; margin: 0; }
.status-detail { margin: 2px 0 0; font-size: 0.875rem; word-break: break-word; }
.status-detail:empty { display: none; }
.status-dot {
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--warn);
}
.status-card[data-state="checking"] .status-dot { animation: pulse 1.2s ease-in-out infinite; }
.status-card[data-state="connected"] .status-dot { background: var(--ok); }
.status-card[data-state="error"] .status-dot { background: var(--err); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* Bottom tab bar, sized for thumbs */
.tab-bar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  display: flex;
  justify-content: space-around;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--card);
  border-top: 1px solid var(--line);
}
.tab-bar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
}
.tab-bar svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tab-bar a[aria-current="page"] { color: var(--accent); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
