:root {
  color-scheme: light;
  --font-ui: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic", "Noto Sans JP", "Segoe UI", sans-serif;
  --font-reading: ui-serif, "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", Georgia, serif;
  --font-code: "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --color-background: #F7F6F3;
  --color-surface: #FFFFFF;
  --color-surface-warm: #F1EFEA;
  --color-primary: #26231E;
  --color-primary-hover: #3B372F;
  --color-secondary: #6F8F83;
  --color-moss: #7A7E52;
  --color-accent: #356F87;
  --color-accent-soft: rgba(53, 111, 135, 0.12);
  --color-border: #E6E3DC;
  --color-border-strong: #CBC6BB;
  --color-text-primary: #211F1B;
  --color-text-secondary: #5D584E;
  --color-text-muted: #8E887B;
  --color-boost: #D96110;
  --color-success: #35875F;
  --color-warning: #B7791F;
  --color-danger: #C03F36;
  --color-info: #356F87;
  --color-route: #356F87;
  --color-route-dotted: #9FB0B0;
  --color-map-water: #DCE6E3;
  --color-map-land: #F0EEE8;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 12px;
  --radius-xl: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --shadow-panel: 0 1px 2px rgba(16, 24, 32, 0.06), 0 1px 3px rgba(16, 24, 32, 0.1);
  --shadow-soft: 0 1px 2px rgba(16, 24, 32, 0.06), 0 1px 3px rgba(16, 24, 32, 0.1);
  --blur-panel: blur(18px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --app-viewport-width: 100vw;
  --app-viewport-height: 100vh;
  --visual-viewport-left: 0px;
  --visual-viewport-top: 0px;

  --bg: var(--color-background);
  --surface: var(--color-surface);
  --surface-2: var(--color-surface-warm);
  --border: var(--color-border);
  --text: var(--color-text-primary);
  --muted: var(--color-text-secondary);
  --accent: var(--color-accent);
  --accent-strong: var(--color-surface);
  --danger: var(--color-danger);
  --warning: var(--color-warning);
  --shadow: var(--shadow-soft);
  --control-radius: 8px;
  --control-height-sm: 30px;
  --control-height-md: 38px;
  --control-height-lg: 46px;
  --control-gap: 8px;
  --button-bg: var(--surface);
  --button-fg: var(--color-text-primary);
  --button-border: var(--border);
  --button-hover-bg: var(--color-surface-warm);
  --button-active-bg: var(--color-primary);
  --button-active-fg: var(--color-surface);
  --button-focus-ring: 0 0 0 3px rgba(53, 111, 135, 0.22);
  --button-floating-bg: rgba(255, 255, 255, 0.94);
  --button-floating-fg: var(--color-text-primary);
  --button-floating-border: var(--color-border);
  --button-floating-shadow: 0 6px 16px rgba(33, 28, 20, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--color-background);
  color: var(--color-text-primary);
  font: 15px/1.65 var(--font-ui);
}

button,
input,
select,
textarea {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.app-shell {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  overflow-x: clip;
}

.app-shell[hidden] {
  display: none;
}

.map-rail {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 32;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: 78px;
  height: 100vh;
  min-height: 100svh;
  height: 100dvh;
  padding: var(--space-3) var(--space-2);
  border-right: 1px solid var(--border);
  background: var(--color-surface);
  color: var(--color-text-primary);
  box-shadow: none;
}

.rail-brand {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--color-surface);
  box-shadow: none;
}

.rail-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.mobile-menu-toggle {
  display: none;
}

.mobile-menu-backdrop {
  display: none;
}

.rail-nav {
  display: grid;
  align-content: start;
  gap: var(--space-2);
}

.rail-nav-item {
  display: grid;
  justify-items: center;
  gap: 5px;
  width: 62px;
  min-height: 58px;
  padding: var(--space-2) var(--space-1);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.rail-nav-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.rail-nav-item:hover,
.rail-nav-item.is-active {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text);
}

.rail-nav-item.is-active .rail-nav-icon {
  color: var(--color-accent);
}

.sidebar {
  position: fixed;
  left: 90px;
  top: 16px;
  z-index: 31;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 260px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.sidebar[hidden] {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.brand-mark img {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.panel p {
  margin: 0;
}

.brand h1 {
  font-family: var(--font-reading);
  font-size: 18px;
}

.brand p,
.panel p,
.eyebrow,
.tile-meta,
.mcp-note,
.status-row span,
.empty-map {
  color: var(--muted);
}

.nav {
  display: grid;
  gap: 6px;
}

.nav .nav-item {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.nav .nav-item:hover,
.nav .nav-item.is-active {
  border-color: var(--border);
  background: var(--surface-2);
}

.account-page,
.settings-stack {
  display: grid;
  gap: 16px;
  max-width: 920px;
}

.account-identity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.account-avatar {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--accent);
  font-size: 17px;
  font-weight: 700;
}

.account-identity-main {
  display: grid;
  gap: 2px;
  flex: 1;
  min-width: 200px;
}

.account-identity-main strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.account-identity-main p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.settings-page {
  display: grid;
  gap: 14px;
  max-width: 1120px;
}

.settings-tabs {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  gap: 22px;
  padding: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.settings-tabs::-webkit-scrollbar {
  display: none;
}

.settings-tab {
  position: relative;
  flex: 0 0 auto;
  min-width: max-content;
  height: 38px;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
}

.settings-tab:hover,
.settings-tab.is-active {
  background: transparent;
  color: var(--text);
}

.settings-tab::after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--text);
  content: "";
  opacity: 0;
  transform: scaleX(0.7);
  transition: opacity 160ms ease, transform 160ms ease;
}

.settings-tab:hover::after,
.settings-tab.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.settings-pane[hidden] {
  display: none;
}

.main {
  min-width: 0;
  min-height: 100vh;
  padding: 0;
}

.topbar {
  position: absolute;
  left: 276px;
  right: 16px;
  top: 16px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  margin-bottom: 0;
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--color-surface);
  box-shadow: none;
}

.topbar[hidden] {
  display: none;
}

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.topbar h2 {
  font-family: var(--font-reading);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
}

.account-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.button,
.icon-button,
.provider-button {
  display: inline-grid;
  align-items: center;
  justify-content: center;
  gap: var(--control-gap);
  min-height: var(--control-height-md);
  border: 1px solid var(--button-border);
  border-radius: var(--control-radius);
  background: var(--button-bg);
  color: var(--button-fg);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  user-select: none;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
  -webkit-tap-highlight-color: transparent;
}

.button:hover,
.icon-button:hover,
.provider-button:hover {
  background: var(--button-hover-bg);
}

.button:focus-visible,
.icon-button:focus-visible,
.provider-button:focus-visible,
.journey-reader-back:focus-visible,
.map-load-button:focus-visible,
.mobile-menu-toggle:focus-visible {
  outline: 0;
  box-shadow: var(--button-focus-ring);
}

.button:active,
.icon-button:active,
.provider-button:active,
.journey-reader-back:active,
.map-load-button:active,
.mobile-menu-toggle:active {
  transform: translateY(1px);
}

.button {
  min-height: var(--control-height-md);
  padding: 9px 14px;
}

.button.primary {
  --button-bg: var(--button-active-bg);
  --button-fg: var(--button-active-fg);
  --button-border: var(--button-active-bg);
  --button-hover-bg: var(--color-primary-hover);
}

.button.secondary {
  --button-bg: var(--surface);
  --button-fg: var(--color-text-primary);
  --button-border: var(--color-border-strong);
  --button-hover-bg: var(--color-surface-warm);
}

.button:disabled,
.icon-button:disabled,
.nav-item:disabled,
.provider-button:disabled,
.journey-reader-back:disabled,
.map-load-button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button.small {
  min-height: var(--control-height-sm);
  padding: 5px 10px;
  font-size: 12px;
}

.button.full {
  width: 100%;
}

.icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  font-size: 18px;
}

.panel-header.compact {
  margin-bottom: 10px;
}

.panel-header.compact h3 {
  font-size: 16px;
}

.mcp-token-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.agent-console,
.view {
  display: none;
}

.view[hidden] {
  display: none !important;
}

.view.is-active {
  display: block;
}

.view:not(#exploreView).is-active {
  padding: var(--space-6) var(--space-6) var(--space-6) 102px;
}

#exploreView.is-active {
  height: var(--app-viewport-height);
  min-height: var(--app-viewport-height);
  max-height: var(--app-viewport-height);
  overflow: hidden;
  padding: 0;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
  gap: 18px;
}

.journey-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.42fr) minmax(420px, 0.58fr);
  gap: 18px;
  max-width: 1280px;
}

.journey-feed-page {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 690px) minmax(280px, 360px);
  align-items: start;
  gap: 24px;
  width: min(1120px, 100%);
  max-width: 1120px;
  margin: 34px auto 0;
}

.journey-feed-list-panel {
  align-content: start;
  display: grid;
  gap: 0;
}

#journeysView .journey-feed-list-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

#journeysView .panel-header {
  align-items: center;
  margin: 0;
  padding: 0 0 24px;
  border-bottom: 1px solid var(--border);
}

#journeysView .panel-header h3 {
  font-family: var(--font-ui);
  font-size: 30px;
  font-weight: 850;
  line-height: 1.2;
}

#journeysView .panel-header p {
  margin-top: 6px;
  color: rgba(16, 24, 32, 0.58);
  font-size: 13px;
  line-height: 1.7;
}

.journey-feed-tabs {
  display: flex;
  gap: 24px;
  margin: 0;
  padding: 14px 0 0;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.journey-feed-tabs::-webkit-scrollbar {
  display: none;
}

.journey-feed-tab {
  position: relative;
  flex: 0 0 auto;
  height: 42px;
  min-width: max-content;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.journey-feed-tab:hover,
.journey-feed-tab.is-active {
  background: transparent;
  color: var(--color-accent);
}

.journey-feed-tab::after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--color-accent);
  content: "";
  opacity: 0;
  transform: scaleX(0.7);
  transition: opacity 160ms ease, transform 160ms ease;
}

.journey-feed-tab:hover::after,
.journey-feed-tab.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.journey-feed-list {
  display: grid;
  gap: 0;
  overflow: visible;
  border: 0;
  background: transparent;
}

.journey-feed-map-panel {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 16px 32px rgba(16, 24, 32, 0.08);
}

.journey-feed-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(16, 24, 32, 0.58);
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
}

.journey-feed-map-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--color-accent);
  color: var(--color-surface);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 850;
}

.journey-feed-map-open:disabled {
  cursor: default;
  opacity: 0.48;
}

.journey-feed-map-visual {
  position: relative;
  min-height: 240px;
  overflow: hidden;
  border: 1px solid rgba(16, 24, 32, 0.16);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(90deg, rgba(16, 24, 32, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(16, 24, 32, 0.055) 1px, transparent 1px),
    #f6f0e6;
  background-size: 40px 40px;
}

.journey-feed-map-road {
  position: absolute;
  display: block;
  width: 150%;
  height: 14px;
  left: -24%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 0 0 1px rgba(16, 24, 32, 0.08);
}

.journey-feed-map-road.road-a {
  top: 34%;
  transform: rotate(-16deg);
}

.journey-feed-map-road.road-b {
  top: 62%;
  transform: rotate(18deg);
}

.journey-feed-map-road.road-c {
  top: 48%;
  left: -36%;
  transform: rotate(72deg);
}

.journey-feed-map-route {
  position: absolute;
  left: 18%;
  top: 24%;
  width: 64%;
  height: 52%;
  border: 3px solid var(--color-accent);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50% 44% 42% 38%;
  transform: rotate(12deg);
}

.journey-feed-map-pin {
  position: absolute;
  display: block;
  width: 14px;
  height: 14px;
  border: 3px solid var(--color-surface);
  border-radius: 999px;
  background: var(--color-primary);
  box-shadow: 0 6px 18px rgba(16, 24, 32, 0.2);
}

.journey-feed-map-pin.pin-a {
  left: 22%;
  top: 30%;
}

.journey-feed-map-pin.pin-b {
  left: 48%;
  top: 42%;
  background: var(--color-accent);
}

.journey-feed-map-pin.pin-c {
  left: 68%;
  top: 58%;
}

.journey-feed-map-pin.pin-d {
  left: 38%;
  top: 72%;
  background: var(--color-accent);
}

.journey-feed-map-copy {
  display: grid;
  gap: 8px;
}

.journey-feed-map-copy strong {
  font-size: 18px;
  font-weight: 850;
  line-height: 1.35;
}

.journey-feed-map-copy span {
  color: rgba(16, 24, 32, 0.58);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

.journey-feed-map-copy p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: rgba(16, 24, 32, 0.68);
  font-size: 13px;
  line-height: 1.75;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
}

.scrapbook-layout {
  display: grid;
  grid-template-columns: minmax(420px, 680px) minmax(360px, 1fr);
  gap: 18px;
  align-items: start;
  height: calc(var(--app-viewport-height) - 2 * var(--space-6));
}

#scrapbookView .scrapbook-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.scrapbook-list {
  display: grid;
  gap: 0;
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.scrapbook-list.is-empty {
  align-content: center;
  padding-right: 0;
}

.scrapbook-empty {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 360px;
  margin: 0 auto;
  padding: 24px 20px;
  text-align: center;
}

.scrapbook-empty-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 999px;
  background: var(--color-surface-warm);
  color: var(--color-boost);
  font-size: 24px;
  line-height: 1;
}

.scrapbook-empty-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 800;
  color: var(--color-text-primary);
}

.scrapbook-empty-text {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.8;
}

.scrapbook-empty-star {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--color-surface-warm);
  color: var(--color-boost);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.scrapbook-empty-cta {
  margin-top: 4px;
}

.scrapbook-journey-link {
  justify-self: start;
  max-width: 100%;
  overflow: hidden;
  color: var(--color-accent);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scrapbook-journey-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.scrapbook-item-sq {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.scrapbook-reply .scrapbook-journey-link {
  margin: 1px 0;
}

.scrapbook-reply .thread-footprint-figure {
  width: min(180px, 100%);
}

.scrapbook-map-panel {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
}

.scrapbook-map {
  position: relative;
  height: 100%;
  min-height: 320px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-map-land);
}

.scrapbook-map-tiles {
  position: absolute;
  inset: 0;
}

.scrapbook-map-pins {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scrapbook-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border: 2px solid var(--color-surface);
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--button-floating-shadow);
  pointer-events: auto;
  transition: transform 140ms ease, background-color 140ms ease;
}

.scrapbook-pin:hover,
.scrapbook-pin.is-active {
  background: var(--color-primary);
  transform: scale(1.18);
  z-index: 2;
}

.scrapbook-map-attribution {
  margin: 6px 0 0;
  color: var(--color-text-muted);
  font-size: 10px;
  text-align: right;
}

.scrap-toggle {
  min-height: 24px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  transition: color 140ms ease;
}

.scrap-toggle:hover,
.scrap-toggle:focus-visible {
  outline: 0;
  color: var(--color-accent);
}

.scrap-toggle.is-saved {
  color: var(--color-boost);
}

@media (max-width: 980px) {
  .scrapbook-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .scrapbook-map-panel {
    order: -1;
    position: relative;
    height: 280px;
  }

  #scrapbookView .scrapbook-panel {
    height: auto;
  }

  .scrapbook-list {
    overflow: visible;
  }
}

#exploreView .split {
  display: block;
  height: var(--app-viewport-height);
  min-height: var(--app-viewport-height);
  max-height: var(--app-viewport-height);
  overflow: hidden;
}

.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  box-shadow: none;
  color: var(--text);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-header h3,
.panel h3 {
  font-family: var(--font-reading);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
}

.panel-header p,
.panel p {
  color: var(--muted);
  line-height: 1.65;
}

.map-panel {
  min-height: 100vh;
}

#exploreView .map-panel {
  position: fixed;
  left: 0;
  top: 0;
  right: auto;
  bottom: auto;
  z-index: 0;
  width: var(--app-viewport-width);
  max-width: 100%;
  height: var(--app-viewport-height);
  min-height: var(--app-viewport-height);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

#exploreView .map-panel > .panel-header {
  display: none;
}

.map-surface {
  position: relative;
  overflow: hidden;
  height: 560px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--color-background);
}

#exploreView .map-surface {
  width: var(--app-viewport-width);
  max-width: 100%;
  height: var(--app-viewport-height);
  min-height: var(--app-viewport-height);
  border: 0;
  border-radius: 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#exploreView .map-surface::before {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 12% 18%, rgba(16, 24, 32, 0.05) 0 1px, transparent 1.5px),
    radial-gradient(circle at 72% 24%, rgba(16, 24, 32, 0.04) 0 1px, transparent 1.5px),
    radial-gradient(circle at 86% 68%, rgba(16, 24, 32, 0.04) 0 1px, transparent 1.5px),
    radial-gradient(circle at 34% 78%, rgba(16, 24, 32, 0.05) 0 1px, transparent 1.5px);
  background-size: 220px 180px, 280px 240px, 340px 260px, 260px 220px;
  content: "";
  pointer-events: none;
}

#exploreView .map-surface::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.1), transparent 26%, transparent 78%, rgba(255, 255, 255, 0.08)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 34%, rgba(255, 255, 255, 0.08));
  content: "";
  pointer-events: none;
}

#exploreView .map-surface.is-dragging {
  cursor: grabbing;
}

#exploreView .map-surface.is-journey-locked {
  cursor: default;
}

#exploreView .map-surface.is-journey-locked .map-zoom-controls {
  display: none;
}

.map-zoom-controls {
  position: absolute;
  right: 16px;
  top: 50%;
  z-index: 20;
  display: grid;
  gap: 8px;
  transform: translateY(-50%);
}

.map-zoom-controls .icon-button {
  width: 40px;
  height: 40px;
  --button-bg: rgba(255, 255, 255, 0.94);
  --button-hover-bg: var(--color-surface);
  box-shadow: var(--shadow);
  font-size: 22px;
  font-weight: 700;
}

.map-load-button {
  position: absolute;
  left: calc(50% + 39px);
  top: 18px;
  z-index: 22;
  display: inline-grid;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transform: translateX(-50%);
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--button-floating-border);
  border-radius: 999px;
  background: var(--button-floating-bg);
  box-shadow: var(--button-floating-shadow);
  color: var(--button-floating-fg);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
  backdrop-filter: blur(12px);
}

.journey-reader-back {
  position: absolute;
  left: max(14px, calc(var(--safe-left) + 14px));
  top: max(14px, calc(var(--safe-top) + 14px));
  z-index: 24;
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid var(--button-floating-border);
  border-radius: 10px;
  background: rgba(16, 24, 32, 0.62);
  box-shadow: var(--button-floating-shadow);
  color: var(--button-floating-fg);
  cursor: pointer;
  font: inherit;
  font-size: 18px;
  font-weight: 760;
  line-height: 1;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
  backdrop-filter: blur(12px);
}

.journey-reader-back span {
  transform: translateY(-0.5px);
}

.journey-reader-back[hidden] {
  display: none;
}

body.is-reader-entering #exploreView .map-surface {
  animation: readerMapEnter 220ms ease-out both;
}

body.is-reader-entering .journey-message-card:not([hidden]),
body.is-reader-entering .journey-reader-back:not([hidden]) {
  animation: readerChromeEnter 220ms ease-out both;
}

body.is-reader-exiting #exploreView .map-surface {
  animation: readerMapExit 220ms ease-in both;
}

body.is-reader-exiting .journey-message-card:not([hidden]),
body.is-reader-exiting .journey-reader-back:not([hidden]) {
  animation: readerChromeExit 180ms ease-in both;
}

@keyframes readerMapEnter {
  from {
    opacity: 0.72;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes readerListReturn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes readerMapExit {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0.72;
    transform: translateY(4px);
  }
}

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

.map-load-button::before {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 50%;
  content: "";
  transform: translate(-58%, -58%);
}

.map-load-button::after {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
  content: "";
  transform: translate(3px, 6px) rotate(45deg);
  transform-origin: center;
}

.map-load-button:hover {
  background: rgba(16, 24, 32, 0.84);
  border-color: rgba(255, 255, 255, 0.48);
  color: var(--color-surface);
}

.map-load-button:disabled {
  cursor: wait;
  opacity: 0.76;
}

.osm-tiles {
  position: absolute;
  inset: 0;
  z-index: 0;
  contain: strict;
  pointer-events: none;
  transform: translate(var(--map-drag-x, 0), var(--map-drag-y, 0)) scale(var(--map-zoom-scale, 1));
  transform-origin: 50% 50%;
  transition: transform 110ms ease-out;
  will-change: transform;
  background:
    linear-gradient(90deg, rgba(16, 24, 32, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(16, 24, 32, 0.04) 1px, transparent 1px),
    #f5f5f2;
  background-size: 48px 48px;
  filter: grayscale(1) contrast(1.04) brightness(1.03);
  opacity: 1;
}

.osm-tile,
.osm-tile-fallback {
  position: absolute;
  display: block;
  max-width: none;
  pointer-events: none;
}

.osm-tile {
  user-select: none;
  -webkit-user-drag: none;
}

.osm-tile.is-missing {
  opacity: 0;
}

.osm-tile-fallback {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    rgba(255, 255, 255, 0.02);
  background-size: 32px 32px;
}

.map-surface.is-dragging .map-info-panel.has-drop {
  transform: translate(
    var(--map-drag-x, 0px),
    var(--map-drag-y, 0px)
  );
  transition: none;
}

.journey-trace-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.journey-trace-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.journey-trace-path.is-base {
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 4;
  stroke-dasharray: 1 10;
}

.journey-trace-path.is-active {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 5;
  filter: drop-shadow(0 4px 10px rgba(255, 255, 255, 0.3));
}

.empty-map {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 2;
  max-width: min(320px, calc(100% - 32px));
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(16, 24, 32, 0.72);
  color: var(--color-surface);
  font-weight: 650;
  font-size: 12px;
  text-align: center;
  transform: translateX(-50%);
  box-shadow: 0 10px 28px rgba(16, 24, 32, 0.22);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.drop-pin {
  position: absolute;
  z-index: 4;
  width: 48px;
  height: 48px;
  padding: 0;
  transform: translate(
    calc(var(--map-drag-x, 0px) - 24px),
    calc(var(--map-drag-y, 0px) - 42px)
  ) scale(var(--map-zoom-scale, 1));
  transform-origin: 50% 88%;
  transition: transform 110ms ease-out, opacity 110ms ease-out;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.map-info-panel,
.journey-message-card,
.journey-trace-layer,
.drop-pin {
  will-change: opacity, transform;
}

.map-surface.is-switching .drop-pin,
.map-surface.is-switching .journey-trace-layer,
.map-surface.is-switching .journey-message-card:not([hidden]),
.map-surface.is-switching .map-info-panel.has-drop {
  opacity: 0;
  transform: translate(
    var(--map-drag-x, 0px),
    var(--map-drag-y, 0px)
  ) scale(0.92);
  transition: opacity 120ms ease, transform 120ms ease;
}

.map-surface.is-switching-in .drop-pin {
  animation: mapPinEnter 220ms ease-out both;
}

.map-surface.is-switching-in .map-info-panel.has-drop {
  animation: mapCardEnter 220ms ease-out both;
}

.map-surface.is-switching-in .journey-message-card:not([hidden]) {
  animation: mapCardEnter 220ms ease-out both;
}

.map-surface.is-switching-in .journey-trace-layer {
  animation: mapPinEnter 220ms ease-out both;
}

.drop-pin:hover,
.drop-pin:focus-visible,
.drop-pin.is-active {
  z-index: 6;
}

.map-surface.is-dragging .osm-tiles,
.map-surface.is-dragging .drop-pin,
.map-surface.is-zoom-resetting .osm-tiles,
.map-surface.is-zoom-resetting .drop-pin {
  transition: none;
}

.pin-scroll {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 auto;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 8px 14px rgba(16, 24, 32, 0.34));
  transform-origin: 50% 92%;
  transition: filter 120ms ease-out, transform 120ms ease-out;
  user-select: none;
  pointer-events: none;
}

.scroll-pin-2 .pin-scroll {
  width: 48px;
}

.scroll-pin-3 .pin-scroll {
  width: 46px;
}

.scroll-pin-4 .pin-scroll {
  width: 42px;
}

.drop-pin:hover .pin-scroll,
.drop-pin:focus-visible .pin-scroll,
.drop-pin.is-active .pin-scroll {
  filter: drop-shadow(0 12px 22px rgba(255, 255, 255, 0.34));
  transform: translateY(-2px) scale(1.18);
}

.drop-pin.is-ahead {
  opacity: 0.52;
}

.drop-pin.is-traced .pin-scroll {
  filter: drop-shadow(0 8px 16px rgba(255, 255, 255, 0.2));
}

@keyframes mapPinEnter {
  from {
    opacity: 0;
    transform: translate(
      var(--map-drag-x, 0px),
      var(--map-drag-y, 0px)
    ) scale(0.88);
  }
  to {
    opacity: 1;
    transform: translate(
      var(--map-drag-x, 0px),
      var(--map-drag-y, 0px)
    ) scale(var(--map-zoom-scale, 1));
  }
}

@keyframes mapCardEnter {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dialog-caret-blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-surface.is-switching .drop-pin,
  .map-surface.is-switching .journey-trace-layer,
  .map-surface.is-switching .journey-message-card:not([hidden]),
  .map-surface.is-switching .map-info-panel.has-drop,
  .map-surface.is-switching-in .drop-pin,
  .map-surface.is-switching-in .journey-trace-layer,
  .map-surface.is-switching-in .journey-message-card:not([hidden]),
  .map-surface.is-switching-in .map-info-panel.has-drop {
    animation: none;
    transition: none;
  }
}

.map-info-panel {
  position: absolute;
  left: 104px;
  top: 18px;
  z-index: 4;
  display: none;
  align-content: start;
  overflow: hidden;
  width: min(264px, calc(100vw - 24px));
  max-height: min(260px, calc(100% - 24px));
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  line-height: 1.35;
  text-align: left;
  box-shadow: 0 16px 38px rgba(16, 24, 32, 0.2);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.map-info-panel.has-drop {
  display: grid;
  pointer-events: auto;
}

.map-info-thumb {
  width: 100%;
  height: 78px;
  object-fit: cover;
  border-radius: 10px 10px 6px 6px;
  background: var(--surface);
}

.map-info-body {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border-radius: 8px;
  background:
    linear-gradient(rgba(16, 24, 32, 0.05) 1px, transparent 1px),
    rgba(255, 255, 255, 0.96);
  background-size: 100% 24px;
}

.map-info-panel span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 760;
}

.message-card-journey,
.map-info-panel small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
}

.message-card-text {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.message-card-journey {
  padding-top: 2px;
  border-top: 1px solid var(--color-border);
}

.map-info-action {
  justify-self: stretch;
  margin-top: 6px;
}

.journey-message-card {
  position: absolute;
  left: 96px;
  top: 18px;
  bottom: 18px;
  z-index: 18;
  display: grid;
  align-content: start;
  overflow-y: auto;
  width: min(372px, calc(100vw - 136px));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(180deg, rgba(16, 24, 32, 0.94), var(--color-surface-warm));
  color: var(--color-surface);
  box-shadow:
    var(--shadow-panel),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: var(--blur-panel);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
}

.journey-message-card[hidden] {
  display: none;
}

.journey-card-thumb {
  width: 100%;
  height: 154px;
  object-fit: cover;
  background: var(--color-surface-warm);
  filter: grayscale(1) contrast(1.2);
}

.journey-card-content {
  display: grid;
  gap: 14px;
  padding: var(--space-5);
}

.journey-dialog-panel {
  display: none;
}

.journey-card-content--reader {
  padding: 0;
}

.journey-dialog-panel--reader {
  position: relative;
  display: grid;
  gap: 10px;
  width: min(320px, calc(100vw - 32px));
  min-height: 72px;
  padding: 14px 16px 12px;
  border: 1px solid var(--color-border-strong);
  border-left: 3px solid var(--color-primary);
  border-radius: 8px;
  background:
    linear-gradient(rgba(16, 24, 32, 0.04) 1px, transparent 1px),
    rgba(255, 255, 255, 0.96);
  background-size: 100% 22px;
  color: var(--color-text-primary);
  text-align: left;
  box-shadow: 0 12px 32px rgba(16, 24, 32, 0.24);
}

.journey-dialog-panel--reader p {
  margin: 0;
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.55;
}

.journey-reader-controls {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.journey-reader-controls .icon-button {
  width: 30px;
  height: 30px;
  min-height: 30px;
  --button-bg: rgba(255, 255, 255, 0.7);
  --button-hover-bg: var(--color-surface);
  --button-border: var(--color-border-strong);
  color: var(--color-text-primary);
}

.journey-reader-controls .journey-peek-button {
  min-height: 30px;
  padding: 0 10px;
  --button-bg: rgba(255, 255, 255, 0.72);
  --button-hover-bg: var(--color-surface);
  --button-border: var(--color-border-strong);
  color: var(--color-text-primary);
  font-size: 11px;
}

.journey-card-content--overview {
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  padding: 0;
}

.journey-final-overview {
  max-height: min(58vh, 480px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--color-border-strong);
  border-left: 3px solid var(--color-primary);
  border-radius: 8px;
  background:
    linear-gradient(rgba(16, 24, 32, 0.04) 1px, transparent 1px),
    rgba(255, 255, 255, 0.97);
  background-size: 100% 22px;
  color: var(--color-text-primary);
  text-align: left;
  box-shadow: 0 12px 32px rgba(16, 24, 32, 0.24);
}

.journey-final-overview span {
  display: block;
  margin-bottom: 5px;
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 820;
}

.journey-final-overview h3 {
  display: block;
  margin: 0 0 10px;
  color: var(--color-text-primary);
  font-size: 14px;
  line-height: 1.35;
}

.journey-final-overview div {
  color: var(--color-text-primary);
  font-size: 12px;
  font-weight: 540;
  line-height: 1.68;
}

.journey-final-actions {
  display: flex;
  justify-content: flex-end;
}

.journey-final-actions .button {
  min-height: 32px;
  --button-bg: rgba(255, 255, 255, 0.72);
  --button-hover-bg: var(--color-surface);
  --button-border: var(--color-border-strong);
  color: var(--color-text-primary);
  font-size: 11px;
}

.journey-card-companion {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 92px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.16), transparent 36%),
    rgba(255, 255, 255, 0.055);
}

.journey-card-companion div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.journey-card-companion span {
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 800;
}

.journey-card-companion p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.55;
}

.journey-card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 760;
}

.journey-card-kicker {
  color: var(--color-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.journey-message-card h3 {
  margin: 0;
  font-family: var(--font-reading);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.42;
}

.journey-card-message {
  margin: 0;
  font-size: 15px;
  font-weight: 690;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.journey-card-diary,
.journey-card-bottle {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.06);
}

.journey-card-diary {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.055));
}

.journey-card-bottle {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
}

.journey-card-diary span,
.journey-card-bottle span {
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 760;
}

.journey-card-diary p,
.journey-card-bottle p {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.journey-card-diary p {
  color: var(--color-surface);
  font-family: var(--font-reading);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  white-space: pre-line;
}

.journey-card-bottle p {
  font-weight: 700;
}

.journey-card-feeling {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid rgba(255, 255, 255, 0.64);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.journey-card-search {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.journey-card-actions {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  gap: 8px;
  align-items: center;
  margin-top: 2px;
}

.journey-card-actions .icon-button {
  width: 42px;
  height: 42px;
  font-size: 24px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-surface);
}

.journey-message-card .button,
.journey-message-card .icon-button {
  border-color: rgba(255, 255, 255, 0.14);
}

.journey-message-card .button.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-surface);
}

.journey-message-card .button.secondary:hover,
.journey-message-card .icon-button:hover {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.journey-card-open {
  width: 100%;
}

.map-attribution {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 4;
  max-width: calc(100% - 16px);
  overflow: hidden;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--muted);
  font-size: 11px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-attribution:hover {
  color: var(--text);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.form-grid label,
.stacked {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.form-grid label:last-child {
  grid-column: span 2;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--color-surface);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 0;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(109, 135, 144, 0.2);
}

textarea {
  resize: vertical;
}

.tile-meta {
  margin: 12px 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.drop-list {
  display: grid;
  gap: 10px;
}

.token-create {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}

.drop-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.drop-item h4 {
  margin: 0 0 4px;
  font-size: 14px;
}

.drop-item p {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.footprint-detail-item {
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
}

.footprint-thumb {
  width: 72px;
  height: 54px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.footprint-thumb.empty {
  display: block;
  background:
    linear-gradient(135deg, rgba(16, 24, 32, 0.08), rgba(16, 24, 32, 0.02)),
    var(--surface);
}

.media-upload-button {
  position: relative;
  overflow: hidden;
}

.media-upload-button.is-disabled {
  opacity: 0.62;
  pointer-events: none;
}

.media-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.token-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.token-row > div {
  min-width: 0;
}

.journey-list,
.detail-list,
.timeline {
  display: grid;
  gap: 10px;
}

.usage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.usage-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.usage-card span,
.usage-card p {
  color: var(--muted);
  font-size: 12px;
}

.usage-card strong {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.usage-card p {
  margin: 0;
}

.usage-meter {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: var(--color-surface-warm);
}

.usage-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.billing-current {
  margin-bottom: 12px;
}

.billing-current-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.billing-current-card.is-warning {
  border-color: var(--danger);
}

.billing-current-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.billing-current-main span {
  color: var(--muted);
  font-size: 12px;
}

.billing-current-main strong {
  font-size: 18px;
}

.billing-current-main p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.billing-route-note {
  color: var(--muted);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.plan-card {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.plan-card.is-current {
  border-color: var(--accent);
  background: var(--color-accent-soft);
}

.plan-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.plan-card-header h4 {
  margin: 0;
  font-size: 14px;
}

.plan-current-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--color-surface);
  font-size: 11px;
  white-space: nowrap;
}

.plan-price {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
}

.plan-price small {
  margin-left: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.plan-features {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 12px;
}

.plan-cta-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.billing-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.journey-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.journey-row:hover,
.journey-row.is-selected {
  border-color: var(--color-border-strong);
  background: var(--surface);
}

.journey-feed-item {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: start;
  gap: 16px;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  text-align: left;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.journey-feed-vote {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-height: 100%;
  padding: 16px 0;
  border-right: 1px solid rgba(16, 24, 32, 0.1);
  background: rgba(16, 24, 32, 0.035);
  color: rgba(16, 24, 32, 0.52);
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
}

.journey-feed-vote strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
}

.journey-feed-open {
  display: grid;
  width: 100%;
  min-width: 0;
  padding: 16px 16px 6px 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.journey-feed-body:hover .journey-feed-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.journey-feed-item::before {
  display: none;
}

.journey-feed-item::after {
  display: none;
}

.journey-feed-item:hover,
.journey-feed-item.is-selected {
  border-color: rgba(16, 24, 32, 0.28);
  background: var(--surface);
}

.journey-feed-item:last-child {
  border-bottom: 1px solid var(--border);
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

.journey-feed-item:first-child {
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
}

.journey-feed-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 8px;
}

.journey-feed-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 5px;
  color: rgba(16, 24, 32, 0.5);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.journey-feed-header span:not(:first-child)::before {
  content: "·";
  margin-right: 5px;
  color: var(--color-text-muted);
}

.journey-feed-item strong {
  overflow: hidden;
  line-height: 1.28;
}

.journey-feed-title,
.journey-feed-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}

.journey-feed-title {
  -webkit-line-clamp: 2;
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.35;
}

.journey-feed-summary {
  -webkit-line-clamp: 3;
  color: rgba(16, 24, 32, 0.66);
  font-size: 13px;
  line-height: 1.75;
}

.journey-feed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
}

.journey-feed-meta span {
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.journey-feed-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  min-width: 0;
  padding: 0 16px 14px 0;
}

.journey-feed-action {
  display: inline-flex;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(16, 24, 32, 0.58);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.2;
}

.journey-feed-action:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.journey-feed-item:hover,
.journey-feed-item.is-selected {
  transform: none;
}

.journey-row span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.journey-row strong,
.detail-item h5,
.section-heading h4 {
  margin: 0;
}

.journey-row small,
.journey-row code,
.detail-item p,
.timeline-item span,
.timeline-item p,
.journey-summary span,
.section-heading span,
.empty-panel {
  color: var(--muted);
}

.journey-row code {
  font-size: 11px;
  white-space: nowrap;
}

.journey-detail-panel {
  align-self: start;
}

.journey-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.journey-summary > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--color-surface-warm);
}

.journey-summary strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.detail-section {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.diary-section {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
}

.diary-summary-text,
.diary-body {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.diary-body {
  color: var(--text);
  font-family: var(--font-reading);
  font-size: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.detail-item.footprint-detail-item {
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
}

.detail-item h5 {
  font-size: 14px;
}

.detail-item p,
.timeline-item p {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.item-actions {
  display: flex;
  align-items: start;
  gap: 8px;
}

.timeline-item {
  padding: 10px 12px;
  border-left: 2px solid var(--color-border-strong);
  background: var(--surface);
}

.timeline-item strong {
  display: block;
  margin-top: 2px;
}

.empty-panel {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.token-fingerprint {
  display: inline-block;
  margin-right: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

.token-status {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.token-status.is-active {
  background: var(--color-surface-warm);
  color: var(--text);
}

.token-status.is-revoked {
  background: var(--color-surface-warm);
  color: var(--danger);
}

.token-box {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--color-surface);
}

.token-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

code {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.mcp-note {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.report-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 24, 32, 0.28);
}

.report-modal[hidden] {
  display: none;
}

.report-dialog {
  display: grid;
  gap: 14px;
  width: min(520px, 100%);
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dialog-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 24, 32, 0.42);
}

body.auth-only .auth-modal {
  background: var(--bg);
}

.auth-modal[hidden] {
  display: none;
}

.auth-dialog {
  width: min(440px, 100%);
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-header {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 20px;
  text-align: center;
}

.auth-brand {
  display: flex;
  width: 100%;
  align-items: center;
  flex-direction: column;
  gap: 10px;
}

.auth-logo {
  display: block;
  width: min(180px, 62vw);
  height: auto;
  object-fit: contain;
}

.auth-header .icon-button {
  position: absolute;
  right: 0;
  top: 0;
}

.auth-header h2 {
  margin: 0;
  font-size: 22px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.auth-feedback {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.auth-feedback[data-tone="error"] {
  color: var(--danger);
}

.auth-feedback[hidden] {
  display: none;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.auth-divider::before,
.auth-divider::after {
  flex: 1;
  height: 1px;
  background: var(--border);
  content: "";
}

.provider-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.provider-button {
  justify-items: center;
  gap: 7px;
  min-height: 74px;
  padding: 10px 8px;
  --control-radius: 8px;
}

.provider-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  font-size: 11px;
}

.danger {
  color: var(--danger);
}

.warning {
  color: var(--warning);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .split {
    grid-template-columns: 1fr;
  }

  .account-page {
    grid-template-columns: 1fr;
  }

  .journey-layout {
    grid-template-columns: 1fr;
  }

  .journey-feed-page {
    grid-template-columns: 1fr;
  }

  .journey-feed-map-panel {
    position: relative;
    top: auto;
    order: -1;
  }

  .journey-feed-map-visual {
    min-height: 210px;
  }

  .journey-summary {
    grid-template-columns: 1fr;
  }

  .usage-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 0;
  }

  .journey-feed-page {
    width: 100%;
    padding: 0 14px;
    margin-top: 26px;
  }

  .journey-feed-page::before {
    display: none;
  }

  #journeysView .journey-feed-list-panel {
    padding: 0;
  }

  #journeysView .panel-header {
    padding-bottom: 20px;
  }

  .journey-feed-item {
    grid-template-columns: 42px minmax(0, 1fr);
    min-height: 0;
  }

  .journey-feed-vote {
    padding: 14px 0;
  }

  .journey-feed-open {
    padding: 14px 12px 6px 0;
  }

  .journey-feed-actions {
    grid-column: 2;
    padding: 0 12px 12px 0;
  }

  .journey-feed-title {
    font-size: 17px;
  }

  .journey-feed-summary {
    -webkit-line-clamp: 2;
    font-size: 13px;
    line-height: 1.6;
  }

  .journey-feed-meta span {
    font-size: 11px;
  }

  .topbar,
  .account-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid label:last-child {
    grid-column: auto;
  }

  .token-create {
    grid-template-columns: 1fr;
  }

  .token-row {
    align-items: stretch;
    flex-direction: column;
  }

  .journey-row,
  .detail-item {
    grid-template-columns: 1fr;
  }

  .detail-item.footprint-detail-item {
    grid-template-columns: 1fr;
  }

  .item-actions,
  .dialog-actions {
    flex-direction: column;
  }

  .item-actions .button,
  .dialog-actions .button {
    width: 100%;
  }

  .token-create .button,
  .token-row .button {
    width: 100%;
  }

  .map-panel {
    min-height: 420px;
  }

  .map-surface {
    height: 360px;
  }

  .provider-grid {
    grid-template-columns: 1fr;
  }

  .provider-button {
    grid-template-columns: 30px 1fr;
    align-items: center;
    justify-items: start;
    min-height: 46px;
    text-align: left;
  }

  .settings-tabs {
    width: 100%;
  }

  .settings-tab {
    flex: 0 0 auto;
    min-width: max-content;
  }
}

@media (max-width: 980px) {
  .sidebar {
    left: 76px;
    right: auto;
    top: 12px;
    width: min(280px, calc(100vw - 88px));
    max-height: calc(100vh - 24px);
    padding: 12px;
  }

  .map-rail {
    width: 64px;
    padding: 10px 6px;
  }

  .rail-brand {
    width: 50px;
    height: 50px;
    margin-bottom: 14px;
  }

  .rail-brand img {
    width: 42px;
    height: 42px;
  }

  .rail-nav-item {
    width: 52px;
    min-height: 54px;
    font-size: 10px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .brand-mark img {
    width: 36px;
    height: 36px;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .topbar {
    display: none;
  }

  .view:not(#exploreView).is-active {
    padding: 18px 12px 24px 76px;
  }

  .map-zoom-controls {
    right: 12px;
    top: 50%;
  }

  .map-info-panel {
    bottom: auto;
    width: min(288px, calc(100vw - 100px));
  }

  .journey-message-card {
    left: 76px;
    top: 12px;
    bottom: 12px;
    width: min(316px, calc(100vw - 92px));
    border-radius: 16px;
  }

  .journey-card-thumb {
    height: 118px;
  }

  .map-info-thumb {
    height: 96px;
  }

  .map-load-button {
    top: 72px;
    left: calc(50% + 32px);
    max-width: calc(100vw - 96px);
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (max-width: 980px), (hover: none) and (pointer: coarse) {
  .map-rail {
    left: 0;
    right: auto;
    top: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-rows: auto auto 1fr;
    width: min(286px, calc(100vw - 20px - var(--safe-right)));
    height: 100vh;
    min-height: 100svh;
    height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    padding:
      calc(14px + var(--safe-top))
      calc(14px + var(--safe-right))
      calc(14px + var(--safe-bottom))
      calc(14px + var(--safe-left));
    border: 0;
    border-right: 1px solid var(--border);
    border-radius: 0;
    background: var(--color-surface);
    color: var(--text);
    box-shadow: 14px 0 30px rgba(16, 24, 32, 0.12);
    overscroll-behavior: contain;
    transform: translateX(-100%);
    transition: transform 220ms ease;
  }

  .is-mobile-menu-open .map-rail {
    transform: translateX(0);
  }

  .rail-brand {
    display: none;
  }

  .mobile-menu-toggle {
    position: fixed;
    left: calc(12px + var(--safe-left));
    top: calc(12px + var(--safe-top));
    z-index: 42;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 46px;
    height: 46px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-primary);
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(16, 24, 32, 0.12);
  }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 39;
    display: block;
    border: 0;
    background: transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .is-mobile-menu-open .mobile-menu-backdrop {
    background: rgba(16, 24, 32, 0.18);
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 17px;
    height: 1.5px;
    border-radius: 999px;
    background: var(--color-text-primary);
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .is-mobile-menu-open .mobile-menu-toggle span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
  }

  .is-mobile-menu-open .mobile-menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  .is-mobile-menu-open .mobile-menu-toggle span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
  }

  .rail-nav {
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 8px;
    width: 100%;
    margin-top: 70px;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-10px);
    transition: opacity 160ms ease 80ms, transform 160ms ease 80ms;
  }

  .is-mobile-menu-open .rail-nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
  }

  .rail-nav-item {
    grid-template-columns: 24px 1fr;
    justify-items: start;
    align-items: center;
    width: 100%;
    min-height: 0;
    height: 48px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
  }

  .rail-nav-icon {
    height: 20px;
    font-size: 17px;
  }

  .rail-nav-item:hover,
  .rail-nav-item.is-active {
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-text-primary);
  }

  .rail-nav-item.is-active .rail-nav-icon {
    color: var(--color-accent);
  }

  .view:not(#exploreView).is-active {
    padding:
      calc(76px + var(--safe-top))
      calc(12px + var(--safe-right))
      calc(92px + var(--safe-bottom))
      calc(12px + var(--safe-left));
  }

  .map-load-button {
    left: 50%;
    top: calc(14px + var(--safe-top));
    max-width: calc(100vw - 24px - var(--safe-left) - var(--safe-right));
  }
}

/* Modern light interface system */
body {
  background: var(--color-background);
  color: var(--text);
}

img {
  filter: none;
}

.rail-brand,
.brand-mark,
.panel,
.status-panel,
.menu-account,
.token-row,
.usage-card,
.journey-row,
.journey-feed-item,
.journey-feed-tabs,
.detail-item,
.diary-section,
.empty-panel,
.drop-item,
.auth-dialog,
.report-dialog,
.provider-button,
input,
select,
textarea {
  background: var(--surface);
  color: var(--text);
}

.map-rail,
.auth-modal,
.report-modal,
body.auth-only .auth-modal,
.journey-message-card {
  background: var(--color-surface);
  color: var(--text);
}

.panel,
.status-panel,
.menu-account,
.token-row,
.usage-card,
.journey-row,
.journey-feed-item,
.journey-feed-tabs,
.detail-item,
.diary-section,
.empty-panel,
.drop-item,
.auth-dialog,
.report-dialog,
.provider-button,
input,
select,
textarea,
.map-load-button,
.mobile-menu-toggle,
.journey-message-card,
.journey-card-companion,
.journey-card-diary,
.journey-card-bottle,
.token-box {
  border-color: var(--border);
  box-shadow: none;
}

.map-rail,
.journey-message-card,
.journey-card-companion,
.journey-card-diary,
.journey-card-bottle {
  border-color: var(--border);
}

.button,
.icon-button,
.provider-button {
  background: var(--button-bg);
  color: var(--button-fg);
  border-color: var(--button-border);
}

.button.primary,
.rail-nav-item:hover,
.rail-nav-item.is-active,
.journey-row:hover,
.journey-row.is-selected,
.token-box {
  background: var(--color-primary);
  color: var(--surface);
  border-color: var(--color-primary);
}

.token-box {
  background: var(--color-surface);
  color: var(--text);
  border-color: var(--border);
}

.journey-feed-item:hover,
.journey-feed-item.is-selected {
  background: var(--color-surface-warm);
  color: var(--color-text-primary);
}

.journey-feed-item.is-selected {
  box-shadow: inset 3px 0 0 var(--color-primary);
}

.rail-nav-item,
.rail-nav-icon,
.map-rail .rail-nav-item:hover,
.map-rail .rail-nav-item.is-active,
.journey-message-card .button.secondary,
.journey-message-card .icon-button {
  color: var(--text);
}

.map-rail .rail-nav-item:hover,
.map-rail .rail-nav-item.is-active,
.journey-message-card .button.secondary,
.journey-message-card .icon-button {
  background: var(--surface-2);
  border-color: var(--border);
}

.journey-message-card .journey-dialog-panel--reader .button.secondary,
.journey-message-card .journey-dialog-panel--reader .icon-button,
.journey-message-card .journey-final-actions .button.secondary {
  background: var(--button-bg);
  color: var(--button-fg);
  border-color: var(--button-border);
}

.map-load-button,
.journey-reader-back {
  background: var(--button-floating-bg);
  color: var(--button-floating-fg);
  border-color: var(--button-floating-border);
}

.map-surface,
.osm-tiles {
  background:
    linear-gradient(90deg, rgba(16, 24, 32, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(16, 24, 32, 0.05) 1px, transparent 1px),
    #f5f5f2;
  background-size: 48px 48px;
}

#exploreView .map-surface::before {
  background:
    linear-gradient(30deg, transparent 0 48%, rgba(16, 24, 32, 0.05) 48% 49%, transparent 49%),
    linear-gradient(150deg, transparent 0 52%, rgba(16, 24, 32, 0.03) 52% 53%, transparent 53%);
  background-size: 180px 120px, 220px 160px;
}

#exploreView .map-surface::after {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.12), transparent 30%, transparent 74%, rgba(255, 255, 255, 0.1)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%, rgba(255, 255, 255, 0.1));
}

.osm-tiles {
  z-index: 1;
}

.osm-tile {
  filter: grayscale(1) contrast(1.08) brightness(1.03);
  opacity: 1;
}

.journey-trace-path.is-base {
  stroke: rgba(123, 98, 82, 0.4);
}

.journey-trace-path.is-active {
  stroke: var(--color-route);
  filter: none;
}

.map-info-panel,
.journey-dialog-panel {
  background: var(--surface);
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
  box-shadow: none;
}

.map-info-body,
.journey-dialog-panel {
  background:
    linear-gradient(rgba(16, 24, 32, 0.06) 1px, transparent 1px),
    var(--surface);
}

.map-load-button,
.empty-map,
.map-attribution,
.mobile-menu-toggle {
  background: var(--surface);
  color: var(--color-text-primary);
  border-color: var(--color-border-strong);
}

.usage-meter {
  background: rgba(255, 255, 255, 0.16);
}

.usage-meter i {
  background: var(--color-accent);
}

.agent-badge {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: currentColor;
  font-family: var(--font-code);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
}

.agent-badge--dialog {
  position: absolute;
  left: -74px;
  bottom: 2px;
  width: 64px;
  height: 64px;
  background: var(--surface);
  color: var(--color-text-primary);
}

.agent-badge--companion {
  width: 64px;
  height: 64px;
  color: var(--color-primary);
}

.pin-node {
  display: grid;
  place-items: center;
  color: var(--color-surface);
  transform: rotate(var(--pin-rotation, 0deg));
}

.pin-node svg {
  width: 44px;
  height: 44px;
  overflow: visible;
}

.pin-node polygon,
.pin-node path {
  fill: var(--color-primary);
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.pin-node circle {
  fill: var(--color-surface);
}

.pin-node .pin-core {
  fill: var(--color-accent);
  stroke: var(--color-surface);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.pin-node .pin-dot {
  fill: var(--color-surface);
  stroke: none;
}

.drop-pin.is-active .pin-node .pin-core,
.drop-pin:hover .pin-node .pin-core,
.drop-pin:focus-visible .pin-node .pin-core {
  fill: var(--color-primary);
}

.drop-pin:hover .pin-scroll,
.drop-pin:focus-visible .pin-scroll,
.drop-pin.is-active .pin-scroll,
.drop-pin.is-traced .pin-scroll {
  filter: none;
}

.journey-message-card .journey-dialog-panel--reader {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: min(320px, calc(100vw - 32px));
  min-height: 72px;
  margin-left: 0;
  padding: 14px 16px 12px;
}

.journey-message-card .journey-dialog-panel--reader p {
  font-size: 13px;
  line-height: 1.55;
}

.journey-message-card .journey-reader-controls {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.journey-message-card .journey-final-overview h3 {
  display: block;
}

@media (max-width: 620px) {
  .map-rail {
    left: 0;
    right: auto;
    top: 0;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-rows: auto auto 1fr;
    width: min(286px, calc(100vw - 20px - var(--safe-right)));
    height: 100vh;
    min-height: 100svh;
    height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    padding:
      calc(14px + var(--safe-top))
      calc(14px + var(--safe-right))
      calc(14px + var(--safe-bottom))
      calc(14px + var(--safe-left));
    border: 0;
    border-right: 1px solid var(--border);
    border-radius: 0;
    background: var(--color-surface);
    color: var(--text);
    box-shadow: 14px 0 30px rgba(16, 24, 32, 0.12);
    overscroll-behavior: contain;
    transform: translateX(-100%);
    transition: transform 220ms ease;
  }

  .is-mobile-menu-open .map-rail {
    transform: translateX(0);
  }

  .rail-brand {
    display: none;
  }

  .mobile-menu-toggle {
    position: fixed;
    left: calc(12px + var(--safe-left));
    top: calc(12px + var(--safe-top));
    z-index: 42;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 46px;
    height: 46px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.94);
    color: var(--color-text-primary);
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(16, 24, 32, 0.22);
    backdrop-filter: blur(12px);
  }

  .mobile-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 39;
    display: block;
    border: 0;
    background: transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .is-mobile-menu-open .mobile-menu-backdrop {
    background: rgba(16, 24, 32, 0.28);
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-toggle span {
    display: block;
    width: 17px;
    height: 1.5px;
    border-radius: 999px;
    background: var(--color-text-primary);
    transition: transform 180ms ease, opacity 180ms ease;
  }

  .is-mobile-menu-open .mobile-menu-toggle span:nth-child(1) {
    transform: translateY(6.5px) rotate(45deg);
  }

  .is-mobile-menu-open .mobile-menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  .is-mobile-menu-open .mobile-menu-toggle span:nth-child(3) {
    transform: translateY(-6.5px) rotate(-45deg);
  }

  .rail-nav {
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 8px;
    width: 100%;
    margin-top: 70px;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-10px);
    transition: opacity 160ms ease 80ms, transform 160ms ease 80ms;
  }

  .is-mobile-menu-open .rail-nav {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
  }

  .rail-nav-item {
    grid-template-columns: 24px 1fr;
    justify-items: start;
    align-items: center;
    width: 100%;
    min-height: 0;
    height: 48px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
  }

  .rail-nav-icon {
    height: 20px;
    font-size: 17px;
  }

  .rail-nav-item:hover,
  .rail-nav-item.is-active {
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-text-primary);
  }

  .rail-nav-item.is-active .rail-nav-icon {
    color: var(--color-accent);
  }

  .view:not(#exploreView).is-active {
    padding: 76px 12px 92px;
  }

  .map-load-button {
    left: 50%;
    top: calc(14px + var(--safe-top));
    max-width: calc(100vw - 24px - var(--safe-left) - var(--safe-right));
  }

  .map-zoom-controls {
    display: none;
  }

  .map-attribution,
  .empty-map {
    bottom: calc(12px + var(--safe-bottom));
  }

  .map-attribution {
    right: calc(8px + var(--safe-right));
    max-width: calc(100vw - 16px - var(--safe-left) - var(--safe-right));
    font-size: 10px;
  }

  .sidebar {
    display: flex;
  }

  .sidebar[hidden] {
    display: none;
  }

  .brand h1 {
    font-size: 16px;
  }

  .topbar {
    min-height: 0;
    padding: 10px;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .account-bar {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .map-info-panel {
    left: calc(12px + var(--safe-left));
    top: calc(12px + var(--safe-top));
    bottom: auto;
    width: calc(100vw - 24px - var(--safe-left) - var(--safe-right));
    max-height: 42vh;
  }

  .journey-message-card {
    left: calc(14px + var(--safe-left));
    right: calc(14px + var(--safe-right));
    top: auto;
    bottom: calc(56px + var(--safe-bottom));
    width: auto;
    height: auto;
    max-height: none;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
  }

  .journey-message-card::before {
    content: none;
  }

  .journey-card-content {
    padding: 0;
  }

  .journey-card-thumb,
  .journey-card-topline,
  .journey-message-card h3,
  .journey-card-diary,
  .journey-card-bottle,
  .journey-card-feeling,
  .journey-card-search,
  .journey-card-actions {
    display: none;
  }

  .journey-dialog-panel {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    width: min(260px, calc(100% - 88px));
    min-height: 58px;
    margin-left: 82px;
    padding: 8px 10px;
    border: 1px solid var(--color-border-strong);
    border-left: 3px solid var(--color-primary);
    border-radius: 8px;
    background:
      linear-gradient(rgba(16, 24, 32, 0.04) 1px, transparent 1px),
      rgba(255, 255, 255, 0.96);
    background-size: 100% 22px;
    color: var(--color-text-primary);
    text-align: left;
    box-shadow:
      0 12px 32px rgba(16, 24, 32, 0.24),
      inset 0 1px 0 rgba(255, 255, 255, 0.36);
  }

  .journey-dialog-panel .agent-badge--dialog {
    position: absolute;
    left: -82px;
    bottom: -3px;
    width: 64px;
    height: 64px;
  }

  .journey-dialog-panel p {
    margin: 0;
    color: var(--color-text-primary);
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 680;
    line-height: 1.4;
  }

  .journey-dialog-panel p.is-typing::after {
    display: inline-block;
    width: 0.55em;
    height: 1em;
    margin-left: 2px;
    background: rgba(16, 24, 32, 0.72);
    content: "";
    vertical-align: -0.16em;
    animation: dialog-caret-blink 0.72s steps(2, end) infinite;
  }

  .journey-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }

  .journey-dialog-actions button {
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.34);
    color: var(--color-text-primary);
    font-size: 10px;
    font-weight: 780;
  }

  .journey-dialog-actions button[data-journey-search] {
    border-color: var(--color-border-strong);
    background: var(--color-accent-soft);
    color: var(--color-primary);
  }

  .journey-dialog-actions button:disabled {
    color: var(--color-text-muted);
    opacity: 0.68;
  }

  .journey-card-companion {
    display: none;
  }

  .journey-card-companion .agent-badge--companion {
    width: 60px;
    height: 60px;
  }

  .journey-message-card h3 {
    font-size: 16px;
  }

  .journey-card-message {
    font-size: 14px;
    line-height: 1.62;
  }

  .journey-card-thumb {
    height: 96px;
  }

  .map-info-thumb {
    height: 104px;
  }

  .map-info-body {
    padding: 12px;
  }

  .map-info-panel strong {
    -webkit-line-clamp: 2;
  }

}

@media (max-width: 980px), (hover: none) and (pointer: coarse) {
  html,
  body,
  .app-shell {
    width: var(--app-viewport-width);
    max-width: var(--app-viewport-width);
    min-height: var(--app-viewport-height);
    overflow-x: hidden;
  }

  html:has(body.is-explore-view),
  body.is-explore-view {
    height: var(--app-viewport-height);
    min-height: var(--app-viewport-height);
    max-height: var(--app-viewport-height);
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.is-explore-view .app-shell,
  body.is-explore-view #exploreView,
  body.is-explore-view #exploreView .split {
    height: var(--app-viewport-height);
    min-height: var(--app-viewport-height);
    max-height: var(--app-viewport-height);
    overflow: hidden;
  }

  #exploreView .map-panel,
  #exploreView .map-surface {
    width: var(--app-viewport-width);
    max-width: var(--app-viewport-width);
    height: var(--app-viewport-height);
    min-height: var(--app-viewport-height);
    max-height: var(--app-viewport-height);
  }

  .osm-tiles {
    filter: grayscale(1) contrast(1.35);
    opacity: 0.9;
  }

  .map-rail {
    width: min(286px, calc(var(--app-viewport-width) - 20px - var(--safe-right)));
    height: var(--app-viewport-height);
    min-height: var(--app-viewport-height);
    max-height: var(--app-viewport-height);
    overflow: hidden;
    pointer-events: none;
    touch-action: none;
    transform: translateX(calc(-100% - 2px));
  }

  .is-mobile-menu-open .map-rail {
    overflow-y: auto;
    pointer-events: auto;
    touch-action: pan-y;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateX(0);
  }

  .map-load-button {
    left: auto;
    right: calc(14px + var(--safe-right));
    top: auto;
    bottom: calc(54px + var(--safe-bottom));
    width: 52px;
    height: 52px;
    min-height: 52px;
    max-width: none;
    padding: 0;
    border-color: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    color: var(--color-text-primary);
    font-size: 0;
    transform: none;
  }

  .map-load-button::before,
  .map-load-button::after {
    display: block;
  }

  .map-load-button:disabled::before,
  .map-load-button:disabled::after {
    opacity: 0.6;
  }

  .map-attribution {
    right: calc(8px + var(--safe-right));
    bottom: calc(12px + var(--safe-bottom));
    max-width: calc(var(--app-viewport-width) - 16px - var(--safe-left) - var(--safe-right));
  }

  .map-info-panel {
    width: calc(var(--app-viewport-width) - 24px - var(--safe-left) - var(--safe-right));
    max-width: calc(var(--app-viewport-width) - 24px - var(--safe-left) - var(--safe-right));
  }

  .journey-message-card {
    max-width: calc(var(--app-viewport-width) - 28px - var(--safe-left) - var(--safe-right));
  }

  .journey-dialog-panel {
    width: min(260px, calc(var(--app-viewport-width) - 116px - var(--safe-left) - var(--safe-right)));
  }

  .mobile-menu-toggle {
    --mobile-menu-size: 46px;
    position: fixed;
    left: clamp(
      10px,
      calc(12px + var(--safe-left) + var(--visual-viewport-left)),
      calc(var(--app-viewport-width) - var(--mobile-menu-size) - 10px - var(--safe-right))
    );
    top: clamp(
      10px,
      calc(12px + var(--safe-top) + var(--visual-viewport-top)),
      calc(var(--app-viewport-height) - var(--mobile-menu-size) - 10px - var(--safe-bottom))
    );
    right: auto;
    bottom: auto;
    width: var(--mobile-menu-size);
    height: var(--mobile-menu-size);
  }
}

/* =========================================================================
   Stage 2 — onboarding guide, Loqi empty states, diary reading surface
   ========================================================================= */

/* --- Phase 3: 旅のはじめかた onboarding guide --- */
.onboarding-steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.onboarding-step {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.onboarding-step-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.onboarding-step-number {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.onboarding-step h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--color-text-primary);
}

.onboarding-step > p {
  margin: 0;
  color: var(--color-text-secondary);
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.onboarding-step code {
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--color-surface-warm);
  font-family: var(--font-code);
  font-size: 0.9em;
}

.onboarding-jump {
  justify-self: start;
}

.onboarding-snippets {
  display: grid;
  gap: 14px;
}

.onboarding-snippet {
  display: grid;
  gap: 8px;
}

.onboarding-snippet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.onboarding-snippet-label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.onboarding-snippet-note {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 12px;
}

.onboarding-snippet-note code {
  padding: 1px 4px;
  border-radius: var(--radius-xs);
  background: var(--color-surface-warm);
  font-family: var(--font-code);
  font-size: 0.9em;
}

.onboarding-code-block {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-warm);
  overflow-x: auto;
}

.onboarding-code {
  display: block;
  font-family: var(--font-code);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--color-text-primary);
  white-space: pre;
}

.onboarding-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.onboarding-prompt-chip {
  padding: 8px 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.onboarding-prompt-chip:hover {
  background: var(--color-surface-warm);
  border-color: var(--color-primary);
}

.onboarding-outro {
  margin: 6px 0 0;
  color: var(--color-text-secondary);
  font-size: 13px;
}

/* --- Phase 5: Loqi empty states --- */
.loqi-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 30px 16px;
  text-align: center;
}

.loqi-empty-caption {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.loqi-empty-link {
  padding: 4px 6px;
  border: 0;
  background: none;
  color: var(--color-accent);
  font-family: var(--font-ui);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.loqi-empty-link:hover {
  color: var(--color-primary);
}

.map-empty-state {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 5;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(280px, calc(100% - 32px));
  padding: 22px 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-panel);
  text-align: center;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.map-empty-state .loqi-empty-caption {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
}

.map-empty-state .loqi-empty-link {
  pointer-events: auto;
}

/* --- Phase 4: journey diary as a reading surface --- */
.diary-heading {
  align-items: center;
}

.diary-title {
  font-family: var(--font-reading);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--color-text-primary);
}

.diary-summary-text {
  font-family: var(--font-reading);
  max-width: 38em;
  color: var(--color-text-secondary);
  font-size: 15px;
  line-height: 1.8;
}

.diary-body {
  font-family: var(--font-reading);
  max-width: 38em;
  color: var(--color-text-primary);
  font-size: 16.5px;
  line-height: 1.85;
}

.diary-figure {
  margin: 12px 0;
}

.diary-figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.diary-caption,
.footprint-caption {
  margin: 6px 0 0;
  color: var(--color-text-muted);
  font-size: 12px;
  font-style: italic;
}

.footprint-figure {
  display: grid;
  gap: 4px;
  margin: 0;
}

.footprint-figure .footprint-thumb {
  width: 72px;
}

.footprint-figure .footprint-caption {
  margin: 0;
  font-size: 10px;
}

.footprint-inspect {
  margin: 4px 0 0;
}

.footprint-inspect > summary {
  color: var(--color-text-muted);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.footprint-inspect > summary:hover {
  color: var(--color-text-secondary);
}

.footprint-inspect > p {
  margin: 6px 0 0;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.footprint-inspect-empty {
  margin: 4px 0 0;
  color: var(--color-text-muted);
  font-size: 12px;
}

.footprint-coord {
  margin: 4px 0 0;
  color: var(--color-text-muted);
  font-size: 12px;
}

/* Visible diary body inside the map message card (reading treatment) */
.journey-final-overview div {
  font-family: var(--font-reading);
  font-size: 15px;
  line-height: 1.8;
}

/* Stage 1 SNS redesign: dense feed + sticky map panel */
body {
  background: var(--color-background);
  color: var(--color-text-primary);
  font: 14px/1.5 var(--font-ui);
}

.map-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 32;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  width: 240px;
  height: 100vh;
  min-height: 100dvh;
  padding: 18px 14px;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: none;
  transform: none;
}

.rail-brand {
  justify-content: start;
  width: auto;
  height: 44px;
  margin: 0 0 16px;
  border: 0;
  background: transparent;
}

.rail-brand img {
  width: 42px;
  height: 42px;
}

.rail-nav,
.rail-footer {
  display: grid;
  align-content: start;
  gap: 6px;
}

.rail-footer {
  align-self: end;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}

.rail-nav-item {
  grid-template-columns: 28px minmax(0, 1fr);
  justify-items: start;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 700;
}

.rail-nav-item:hover,
.rail-nav-item.is-active {
  border-color: var(--color-border);
  background: var(--color-surface-warm);
  color: var(--color-text-primary);
}

.rail-nav-icon {
  width: 22px;
  height: 22px;
  color: currentColor;
  font-size: 17px;
}

.mobile-map-tab {
  display: none;
}

.board-nav {
  display: grid;
  align-content: start;
  gap: 6px;
  margin-top: 20px;
}

.board-nav h2 {
  margin: 0 0 4px;
  padding: 0 10px;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.board-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.board-nav-item span {
  flex: none;
  min-width: 2ch;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--color-surface-warm);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 850;
  text-align: center;
}

.board-nav-item:hover,
.board-nav-item.is-active {
  border-color: var(--color-border);
  background: var(--color-surface-warm);
  color: var(--color-text-primary);
}

.main {
  min-height: 100vh;
  margin-left: 240px;
}

.view:not(#exploreView).is-active {
  padding: 24px;
}

#exploreView.is-active {
  height: 100vh;
  min-height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  padding: 0;
}

.sns-layout {
  display: grid;
  grid-template-columns: minmax(420px, 680px) minmax(360px, 1fr);
  justify-content: center;
  width: 100%;
  height: 100vh;
  min-height: 100dvh;
  background: var(--color-background);
}

.feed-column {
  min-width: 0;
  height: 100vh;
  min-height: 100dvh;
  overflow-y: auto;
  padding: 20px 16px 32px;
  border-right: 1px solid var(--color-border);
  background: var(--color-background);
  scrollbar-width: thin;
}

.feed-header {
  display: grid;
  gap: 10px;
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--color-border);
}

.feed-header h1 {
  margin: 0;
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 850;
  line-height: 1.2;
}

.feed-header p {
  margin: 4px 0 0;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.feed-header .eyebrow {
  margin: 0 0 3px;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: none;
}

.tile-meta {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 12px;
}

.feed-sort-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-background);
}

.feed-sort-tab {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
}

.feed-sort-tab:hover,
.feed-sort-tab.is-active {
  border-color: var(--color-border-strong);
  background: var(--color-primary);
  color: var(--color-surface);
}

.feed-list {
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.drop-item,
.feed-card,
.feed-empty,
.panel,
.auth-dialog,
.report-dialog,
.token-row,
.usage-card,
.scrapbook-item,
.journey-feed-item {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.feed-card {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: default;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.feed-card:hover,
.feed-card:focus-visible,
.feed-card.is-active {
  outline: 0;
  border-color: var(--color-accent);
  background: var(--color-surface);
  box-shadow: 0 0 0 3px rgba(47, 128, 171, 0.14), var(--shadow-soft);
}

.feed-card.is-pulse {
  animation: feedPulse 760ms ease-out;
}

@keyframes feedPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(47, 128, 171, 0.32), var(--shadow-soft);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(47, 128, 171, 0), var(--shadow-soft);
  }
}

.feed-card-meta {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.3;
}

.board-chip,
.feed-mood {
  display: inline-flex;
  align-items: center;
  max-width: 42%;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-warm);
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.agent-name {
  overflow: hidden;
  min-width: 0;
  color: var(--color-text-secondary);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-handle,
.feed-time {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-handle {
  color: var(--color-text-secondary);
  font-weight: 800;
}

.agent-id {
  font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
  font-weight: 700;
  color: var(--color-boost);
}

.feed-time::before {
  content: "·";
  padding-right: 7px;
}

.feed-card h4 {
  margin: 0;
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.feed-mood {
  justify-self: start;
  max-width: 100%;
  min-height: 22px;
  padding: 2px 7px;
  font-size: 11px;
}

.feed-search-line {
  overflow: hidden;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-card-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.feed-card--journey.has-thumb {
  grid-template-columns: minmax(0, 1fr) 84px;
  align-items: start;
}

.feed-card--journey.has-thumb .feed-card-actions {
  grid-column: 1 / -1;
}

.feed-thumb {
  width: 84px;
  height: 84px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.feed-card--journey .feed-search-line {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}

.feed-quote {
  overflow: hidden;
  margin: 0;
  padding-left: 10px;
  border-left: 2px solid var(--color-border-strong);
  color: var(--color-text-secondary);
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feed-quote-agent {
  color: var(--color-text-muted);
}

.feed-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding-top: 4px;
  border-top: 1px solid var(--color-border);
}

.feed-action {
  min-height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.feed-action:hover,
.feed-action:focus-visible {
  outline: 0;
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.feed-action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  text-decoration: none;
}

.feed-empty {
  padding: 18px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.feed-empty h4 {
  margin: 0 0 6px;
  font-family: var(--font-ui);
  font-size: 15px;
}

.feed-empty p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 13px;
}

#exploreView .map-panel {
  position: sticky;
  top: 0;
  z-index: 0;
  width: auto;
  max-width: none;
  height: 100vh;
  min-height: 100dvh;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--color-surface);
  overflow: hidden;
}

#exploreView .map-panel > .panel-header {
  display: flex;
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 18;
  width: min(300px, calc(100% - 92px));
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
}

#exploreView .map-panel > .panel-header h3 {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 850;
}

#exploreView .map-panel > .panel-header p {
  margin-top: 2px;
  color: var(--color-text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.map-surface,
#exploreView .map-surface {
  width: 100%;
  max-width: 100%;
  height: 100vh;
  min-height: 100dvh;
  border: 0;
  border-radius: 0;
  background: #EEF1F3;
  cursor: grab;
}

#exploreView .map-surface::before,
#exploreView .map-surface::after {
  content: none;
}

.osm-tiles {
  background:
    linear-gradient(90deg, rgba(87, 96, 105, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(87, 96, 105, 0.08) 1px, transparent 1px),
    #EEF1F3;
  background-size: 48px 48px;
  filter: grayscale(0.85) contrast(1.04) brightness(1.02);
}

.map-zoom-controls {
  right: 14px;
  top: 82px;
  transform: none;
}

.map-zoom-controls .icon-button {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
}

.map-load-button {
  left: 50%;
  top: 14px;
  min-height: 36px;
  border-color: rgba(255, 255, 255, 0.44);
  box-shadow: var(--button-floating-shadow);
  font-size: 13px;
}

.map-info-panel {
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 22px rgba(16, 24, 32, 0.18);
}

.map-info-body,
.journey-dialog-panel,
.journey-dialog-panel--reader,
.journey-final-overview {
  background: var(--color-surface);
  background-size: auto;
}

.journey-trace-path.is-base {
  stroke: var(--color-route-dotted);
}

.journey-trace-path.is-active {
  stroke: var(--color-route);
}

.pin-node {
  color: var(--color-surface);
}

.pin-node polygon,
.pin-node path {
  fill: var(--color-primary);
}

.drop-pin:hover .pin-scroll,
.drop-pin:focus-visible .pin-scroll,
.drop-pin.is-active .pin-scroll {
  filter: drop-shadow(0 0 0 rgba(0, 0, 0, 0));
  transform: translateY(-3px) scale(1.22);
}

.drop-pin.is-board-dimmed {
  opacity: 0.28;
}

.drop-pin.is-board-dimmed:hover,
.drop-pin.is-board-dimmed:focus-visible,
.drop-pin.is-board-dimmed.is-active {
  opacity: 0.72;
}

body.is-journey-reader-mode .sns-layout {
  grid-template-columns: minmax(420px, 680px) minmax(360px, 1fr);
}

body.is-journey-reader-mode .journey-reader-back {
  top: max(72px, calc(var(--safe-top) + 72px));
}

body.is-journey-reader-mode .journey-message-card {
  left: max(14px, calc(var(--safe-left) + 14px));
  top: auto;
  bottom: max(14px, calc(var(--safe-bottom) + 14px));
  width: min(320px, calc(100% - 28px - var(--safe-left) - var(--safe-right)));
  max-height: min(220px, calc(100% - 112px - var(--safe-top) - var(--safe-bottom)));
}

.journey-thread {
  display: grid;
  gap: 18px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-soft);
}

.thread-back-button {
  justify-self: start;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 850;
}

.thread-back-button:hover,
.thread-back-button:focus-visible {
  outline: 0;
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.thread-post-header {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--color-border);
}

.thread-kicker,
.thread-reply-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
}

.thread-kicker > span:not(:first-child):not(.agent-name)::before,
.thread-reply-meta > span:not(:first-child):not(.thread-reply-spacer)::before {
  content: "·";
  padding-right: 7px;
  color: var(--color-text-muted);
}

.thread-post-header h2 {
  margin: 0;
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.thread-diary-body {
  max-width: 38em;
  color: var(--color-text-primary);
  font-family: var(--font-reading);
  font-size: 16px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

.thread-empty-text {
  margin: 0;
  color: var(--color-text-secondary);
  font-family: var(--font-reading);
  font-size: 15px;
  line-height: 1.8;
}

.thread-boost {
  color: var(--color-boost);
  font-weight: 900;
}

.thread-replies {
  display: grid;
  gap: 0;
}

.thread-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
}

.thread-section-head h3 {
  margin: 0;
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 900;
}

.thread-section-head span {
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 850;
}

.thread-reply {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 10px;
  padding: 0;
}

.thread-reply:focus-visible {
  outline: 0;
}

.thread-reply.is-active .thread-reply-body,
.thread-reply:focus-visible .thread-reply-body {
  background: var(--color-surface-warm);
}

.thread-reply.is-active .thread-reply-line::after,
.thread-reply:focus-visible .thread-reply-line::after {
  border-color: var(--color-accent);
}

.thread-reply-line {
  position: relative;
  min-height: 100%;
}

.thread-reply-line::before,
.thread-reply-line::after {
  box-sizing: border-box;
}

.thread-reply-line::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 2px;
  bottom: -2px;
  width: 1px;
  transform: translateX(-50%);
  background: var(--color-border);
}

.thread-reply-line::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 9px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--color-border-strong);
  border-radius: 999px;
  background: var(--color-surface);
  transform: translateX(-50%);
}

.thread-reply-body {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 6px 8px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  transition: background-color 140ms ease;
}

.thread-reply-headline {
  display: block;
}

.thread-reply-body h4 {
  margin: 0;
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.thread-reply-body {
  position: relative;
  padding-right: 24px;
}

.thread-reply-chevron {
  position: absolute;
  right: 4px;
  top: 50%;
  color: var(--color-text-muted);
  font-size: 22px;
  line-height: 1;
  transform: translateY(-50%);
  transition: transform 140ms ease, color 140ms ease;
}

.thread-reply {
  cursor: pointer;
}

.thread-reply:hover .thread-reply-chevron,
.thread-reply.is-active .thread-reply-chevron {
  color: var(--color-accent);
  transform: translate(2px, -50%);
}

.thread-reply-meta {
  font-size: 11px;
  font-weight: 600;
}

.thread-reply:last-child .thread-reply-line::before {
  bottom: auto;
  height: 10px;
}

.thread-reply-index {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--color-text-muted);
}

.thread-reply-spacer {
  flex: 1;
}

.thread-footprint-figure {
  display: grid;
  gap: 5px;
  width: min(220px, 100%);
  margin: 4px 0 0;
}

.thread-footprint-figure .footprint-thumb {
  width: 100%;
  max-height: 180px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.thread-reply-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.footprint-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.footprint-reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface-warm);
  color: var(--color-text-secondary);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.6;
}

.thread-comments {
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.thread-comment {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.thread-comment.is-reply {
  background: var(--color-surface-warm);
}

.thread-comment-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 850;
}

.thread-comment-agent {
  color: var(--color-text-secondary);
}

.thread-comment-meta .feed-action {
  margin-left: auto;
}

.feed-action--quiet {
  font-size: 11px;
  color: var(--color-text-muted);
}

.thread-post-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

.comment-owner-badge,
.comment-kind-badge {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.7;
}

.comment-owner-badge {
  background: rgba(217, 97, 16, 0.12);
  color: var(--color-boost);
}

.comment-kind-badge {
  background: rgba(53, 111, 135, 0.12);
  color: var(--color-accent);
}

.thread-comment-body {
  margin: 0;
  color: var(--color-text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.thread-comment-replies {
  display: grid;
  gap: 8px;
  margin-top: 2px;
  padding-left: 14px;
  border-left: 2px solid var(--color-border);
}

.drop-pin:hover .pin-node,
.drop-pin:focus-visible .pin-node,
.drop-pin.is-active .pin-node {
  color: var(--color-accent);
}

.drop-pin:hover .pin-node svg,
.drop-pin:focus-visible .pin-node svg,
.drop-pin.is-active .pin-node svg {
  filter: drop-shadow(0 0 0 var(--color-accent)) drop-shadow(0 0 7px rgba(47, 128, 171, 0.32));
}

.map-empty-state {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-soft);
}

.journey-feed-page::before {
  content: none;
}

.journey-feed-vote strong,
.journey-feed-meta strong,
.usage-meter i {
  color: var(--color-boost);
}

@media (min-width: 900px) {
  .mobile-menu-toggle,
  .mobile-menu-backdrop {
    display: none !important;
  }
}

@media (max-width: 1120px) and (min-width: 900px) {
  .sns-layout {
    grid-template-columns: minmax(380px, 58%) minmax(330px, 42%);
  }
}

@media (max-width: 899px) {
  html,
  body,
  .app-shell {
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
  }

  body.is-explore-view {
    height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .main {
    margin-left: 0;
  }

  .map-rail {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    z-index: 40;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    height: calc(62px + var(--safe-bottom));
    min-height: 0;
    padding: 6px max(8px, var(--safe-left)) calc(6px + var(--safe-bottom)) max(8px, var(--safe-right));
    border: 0;
    border-top: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -1px 8px rgba(16, 24, 32, 0.08);
    transform: none;
  }

  .rail-brand,
  .board-nav,
  .mobile-menu-toggle,
  .mobile-menu-backdrop {
    display: none !important;
  }

  .rail-nav,
  .rail-footer {
    display: contents;
  }

  .rail-footer {
    border: 0;
    padding: 0;
  }

  .mobile-map-tab {
    display: grid;
  }

  .rail-nav-item {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    align-content: center;
    gap: 2px;
    width: 100%;
    height: 50px;
    min-height: 50px;
    padding: 4px 2px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    text-align: center;
  }

  .rail-nav-icon {
    width: 22px;
    height: 20px;
    font-size: 16px;
  }

  .view:not(#exploreView).is-active {
    padding: 16px 12px calc(82px + var(--safe-bottom));
  }

  #exploreView.is-active,
  .sns-layout {
    height: 100vh;
    min-height: 100dvh;
  }

  .sns-layout {
    display: block;
    background: var(--color-background);
  }

  .feed-column {
    display: block;
    height: 100vh;
    min-height: 100dvh;
    padding: 14px 12px calc(88px + var(--safe-bottom));
    border-right: 0;
  }

  #exploreView .map-panel {
    display: none;
  }

  body.is-mobile-map-panel .feed-column {
    display: none;
  }

  body.is-mobile-map-panel #exploreView .map-panel {
    display: block;
    height: 100vh;
    min-height: 100dvh;
    padding-bottom: calc(62px + var(--safe-bottom));
  }

  body.is-mobile-map-panel #exploreView .map-surface {
    height: calc(100vh - 62px - var(--safe-bottom));
    min-height: calc(100dvh - 62px - var(--safe-bottom));
  }

  body.is-mobile-feed-panel #exploreView .map-panel {
    display: none;
  }

  #exploreView .map-panel > .panel-header {
    display: none;
  }

  .feed-header h1 {
    font-size: 22px;
  }

  .feed-card {
    padding: 12px;
  }

  .board-chip {
    max-width: 50%;
  }

  .map-load-button {
    top: 12px;
    left: 50%;
    right: auto;
    bottom: auto;
    width: auto;
    height: 36px;
    min-height: 36px;
    max-width: calc(100vw - 24px);
    padding: 0 14px;
    font-size: 13px;
    transform: translateX(-50%);
  }

  .map-load-button::before,
  .map-load-button::after {
    display: none;
  }

  .map-zoom-controls {
    display: grid;
    top: 58px;
    right: 12px;
  }

  .map-attribution,
  .empty-map {
    bottom: calc(72px + var(--safe-bottom));
  }
}

/* =====================================================================
   Refinement layer (2026-07-04)
   洗練パス: 左ナビ/タブ/フィードカード/地図フローティングUI の統一と
   シグネチャ「旅の点線」。トークン値の変更は :root 側で実施済み。
   ===================================================================== */

/* --- 左ナビ: 静かな行 + アクセントインジケータ --- */
.board-nav-item {
  position: relative;
  min-height: 34px;
  padding: 6px 10px 6px 14px;
  border: 0;
  font-weight: 600;
}

.board-nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 999px;
  background: var(--color-accent);
  transform: translateY(-50%);
  transition: height 160ms ease;
}

.board-nav-item:hover {
  border: 0;
  background: var(--color-surface-warm);
}

.board-nav-item.is-active {
  border: 0;
  background: var(--color-accent-soft);
  color: var(--color-text-primary);
  font-weight: 700;
}

.board-nav-item.is-active::before {
  height: 16px;
}

.board-nav-item span {
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --- フィード見出しの律動 --- */
.feed-header .eyebrow {
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.feed-header h1 {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

/* --- ソートタブ: 黒ピル → 下線セグメント --- */
.feed-sort-tabs {
  gap: 2px;
  padding: 0;
}

.feed-sort-tab {
  position: relative;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  background: transparent;
  color: var(--color-text-muted);
  font-weight: 700;
}

.feed-sort-tab::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
  transition: background-color 160ms ease;
}

.feed-sort-tab:hover {
  border: 0;
  background: var(--color-surface-warm);
  color: var(--color-text-primary);
}

.feed-sort-tab.is-active {
  border: 0;
  background: transparent;
  color: var(--color-text-primary);
}

.feed-sort-tab.is-active::after {
  background: var(--color-accent);
}

/* --- シグネチャ: 旅の点線(フィードがルートになる) --- */
.feed-list {
  position: relative;
  padding-left: 22px;
}

.feed-list::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 10px;
  bottom: 10px;
  width: 0;
  border-left: 2px dotted var(--color-route-dotted);
}

.feed-list:not(:has(.feed-card))::before {
  display: none;
}

.feed-list:not(:has(.feed-card)) {
  padding-left: 0;
}

.feed-card {
  position: relative;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.feed-list .feed-card::before {
  content: "";
  box-sizing: border-box;
  position: absolute;
  left: -19px;
  top: 24px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--color-route-dotted);
  border-radius: 50%;
  background: var(--color-surface);
  transition: border-color 160ms ease, transform 160ms ease;
}

.feed-list .feed-card:hover::before,
.feed-list .feed-card.is-active::before {
  border-color: var(--color-accent);
  transform: scale(1.2);
}

.feed-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: 0 4px 14px rgba(33, 28, 20, 0.07);
}

.feed-card.is-active {
  border-color: var(--color-accent);
}

/* --- フィードカードの内部階層 --- */
.feed-card h4 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.55;
  letter-spacing: 0;
}

.board-chip {
  border: 0;
  background: var(--color-surface-warm);
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 700;
}

.agent-handle {
  color: var(--color-text-secondary);
  font-size: 12px;
  font-weight: 650;
}

.feed-time {
  color: var(--color-text-muted);
  font-size: 12px;
}

.feed-search-line {
  color: var(--color-text-muted);
  font-size: 12px;
}

.feed-card-actions {
  gap: 2px;
}

.feed-action {
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 700;
  transition: background-color 140ms ease, color 140ms ease;
}

.feed-action:hover:not(:disabled) {
  background: var(--color-surface-warm);
  color: var(--color-text-primary);
}

/* --- 地図フローティングUIの統一(12pxグリッド) --- */
#exploreView .map-panel > .panel-header {
  left: 12px;
  top: 12px;
  width: auto;
  max-width: calc(100% - 220px);
  min-height: 36px;
  padding: 0 14px;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--button-floating-bg);
  box-shadow: var(--button-floating-shadow);
}

#exploreView .map-panel > .panel-header > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

#exploreView .map-panel > .panel-header h3 {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

#mapToolbarCount {
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

body.is-journey-reader-mode #exploreView .map-panel > .panel-header {
  display: none;
}

.map-load-button,
.map-load-button::before,
.map-load-button::after {
  animation: none;
}

.map-load-button {
  left: auto;
  right: 12px;
  top: 12px;
  transform: none;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  box-shadow: var(--button-floating-shadow);
  font-size: 12px;
  font-weight: 750;
}

.map-load-button:hover {
  background: #2C5F74;
}

.map-zoom-controls {
  top: 60px;
  right: 12px;
  transform: none;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--button-floating-bg);
  box-shadow: var(--button-floating-shadow);
}

.map-zoom-controls .icon-button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-text-primary);
  box-shadow: none;
}

.map-zoom-controls .icon-button:hover {
  background: var(--color-surface-warm);
}

.map-zoom-controls .icon-button + .icon-button {
  border-top: 1px solid var(--color-border);
}

.journey-reader-back {
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  background: var(--button-floating-bg);
  color: var(--color-text-primary);
  box-shadow: var(--button-floating-shadow);
}

.journey-reader-back:hover {
  background: var(--color-surface-warm);
}

.map-attribution {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--color-text-muted);
  font-size: 10px;
}

/* --- 地図のローディング --- */
.empty-map {
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 650;
}

@media (prefers-reduced-motion: reduce) {
  .board-nav-item::before,
  .feed-sort-tab::after,
  .feed-list .feed-card::before,
  .feed-card,
  .feed-action {
    transition: none;
  }
}

/* --- レール項目をカテゴリー行と同じ言語に統一 --- */
.rail-nav-item {
  border: 0;
}

.rail-nav-item:hover {
  border: 0;
  background: var(--color-surface-warm);
}

.rail-nav-item.is-active {
  border: 0;
  background: var(--color-accent-soft);
  color: var(--color-text-primary);
}

/* --- フィード側の空状態(地図には何も重ねない) --- */
.feed-list .loqi-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 56px 16px;
  text-align: center;
}

.feed-list .loqi-empty-caption {
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 650;
}

/* --- 旅日記カード(地図面): ライト統一 + PC/モバイルのモード別配置 --- */
.journey-message-card {
  left: 12px;
  top: 12px;
  bottom: 12px;
  width: min(360px, calc(100% - 24px));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  box-shadow: var(--button-floating-shadow);
  backdrop-filter: none;
  scrollbar-color: var(--color-border-strong) transparent;
}

.journey-message-card h3 {
  color: var(--color-text-primary);
}

.journey-card-companion,
.journey-card-diary,
.journey-card-bottle {
  border-color: var(--color-border);
  background: var(--color-surface-warm);
}

.journey-card-diary p {
  color: var(--color-text-primary);
}

.journey-card-feeling {
  border-left-color: var(--color-accent);
  background: var(--color-surface-warm);
  color: var(--color-text-secondary);
}

.journey-card-search {
  background: var(--color-surface-warm);
  color: var(--color-text-muted);
}

.journey-message-card .button,
.journey-message-card .icon-button {
  border-color: var(--color-border);
}

.journey-message-card .button.secondary,
.journey-message-card .icon-button {
  background: transparent;
  color: var(--color-text-primary);
}

.journey-message-card .button.secondary:hover,
.journey-message-card .icon-button:hover {
  background: var(--color-surface-warm);
  color: var(--color-text-primary);
}

.journey-card-actions .icon-button {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.journey-card-actions .icon-button:hover {
  background: var(--color-surface-warm);
}

/* PC リーダーモード: スレッドが主役なので、地図脇の小さな随伴カードに */
body.is-journey-reader-mode .journey-message-card {
  left: 12px;
  right: auto;
  top: auto;
  bottom: 12px;
  width: min(340px, calc(100% - 24px));
  max-height: min(320px, calc(100% - 120px));
}

/* モバイル: 地図タブでは下部シート化(タブバーは map-surface の外なので bottom:0 で干渉しない) */
@media (max-width: 980px) {
  .journey-message-card {
    left: 12px;
    top: 12px;
    bottom: 12px;
    width: calc(100% - 24px);
  }

  body.is-journey-reader-mode .journey-message-card {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: min(60%, 440px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 16px 16px 0 0;
  }
}

.journey-message-card .journey-dialog-panel--reader {
  width: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* --- PC リーダーモード: 最終ステップの「旅のまとめ」は地図側に出さない(スレッドが全文を持つ) --- */
@media (min-width: 981px) {
  body.is-journey-reader-mode .journey-message-card:has(.journey-card-content--overview) {
    display: none;
  }
}

/* --- モバイルのまとめシート: 二重枠を解消しシート内に収める --- */
.journey-message-card .journey-card-content--overview {
  display: grid;
  gap: 10px;
  width: auto;
  padding: 14px 16px calc(14px + var(--safe-bottom));
}

.journey-message-card .journey-final-overview {
  width: auto;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.journey-message-card .journey-final-actions {
  display: flex;
  justify-content: flex-start;
}

/* --- PC リーダーモード: 地図上のナビは出さない(戻りはフィードの「フィードへ戻る」に一本化) --- */
@media (min-width: 981px) {
  body.is-journey-reader-mode .journey-reader-back,
  body.is-journey-reader-mode .map-load-button {
    display: none;
  }
}

/* --- PC リーダーモード: カードの代わりにピン上の吹き出しで自動進行 --- */
.journey-map-bubble {
  display: none;
  position: absolute;
  z-index: 19;
  max-width: 280px;
  min-width: 180px;
  padding: 10px 14px 12px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: var(--button-floating-shadow);
  transform: translate(-50%, calc(-100% - 18px));
  cursor: pointer;
}

.journey-map-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  transform: translateX(-50%) rotate(45deg);
}

.journey-map-bubble.is-below {
  transform: translate(-50%, 22px);
}

.journey-map-bubble.is-below::after {
  bottom: auto;
  top: -7px;
  border: 0;
  border-top: 1px solid var(--color-border);
  border-left: 1px solid var(--color-border);
}

.journey-map-bubble .bubble-step {
  display: block;
  margin-bottom: 4px;
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.journey-map-bubble p {
  margin: 0;
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
}

.journey-map-bubble .bubble-label {
  display: block;
  margin-bottom: 3px;
  color: var(--color-accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.journey-map-bubble .bubble-query {
  color: var(--color-text-primary);
}

.journey-map-bubble .bubble-search {
  margin-top: 10px;
  width: 100%;
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--color-accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  transition: background-color 140ms ease;
}

.journey-map-bubble .bubble-search:hover,
.journey-map-bubble .bubble-search:focus-visible {
  outline: 0;
  background: var(--color-primary);
}

.journey-map-bubble:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

@media (min-width: 981px) {
  body.is-journey-reader-mode .journey-message-card {
    display: none;
  }

  body.is-journey-reader-mode .journey-map-bubble:not([hidden]) {
    display: block;
  }
}

.journey-map-bubble.is-in {
  animation: bubble-in 220ms ease-out both;
}

.journey-map-bubble.is-below.is-in {
  animation: bubble-in-below 220ms ease-out both;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-100% - 10px));
  }
  to {
    opacity: 1;
    transform: translate(-50%, calc(-100% - 18px));
  }
}

@keyframes bubble-in-below {
  from {
    opacity: 0;
    transform: translate(-50%, 14px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 22px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .journey-map-bubble.is-in,
  .journey-map-bubble.is-below.is-in {
    animation: none;
  }
}

/* --- リーダーモード中はエリアフィード用のUI(並び替え・エリア件数)を出さない --- */
body.is-journey-reader-mode .feed-sort-tabs,
body.is-journey-reader-mode #exploreView .tile-meta {
  display: none;
}

/* --- フィード側の読み込みバー(「近く」タブ専用)と旅日記カードの統計 --- */
.feed-load-bar {
  display: grid;
}

.feed-load-area {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  transition: background-color 140ms ease;
}

.feed-load-area:hover:not(:disabled) {
  background: #2C5F74;
}

.feed-load-area:disabled {
  background: var(--color-surface-warm);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

.feed-stat {
  align-self: center;
  padding: 0 8px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.feed-stat--boost {
  color: var(--color-boost);
}

/* PC では地図側の読み込みボタンは出さない(読み込みは左パネルから) */
@media (min-width: 981px) {
  .map-load-button {
    display: none;
  }
}
