:root {
  --bg: #160406;
  --bg-deep: #0f0203;
  --glass: rgba(33, 6, 9, 0.8);
  --glass-strong: rgba(23, 3, 5, 0.9);
  --glass-soft: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 112, 120, 0.16);
  --line-strong: rgba(255, 112, 120, 0.3);
  --text: #fff4f4;
  --muted: #ddb0b3;
  --muted-strong: #ffd7da;
  --accent: #ff4c59;
  --accent-strong: #ff203f;
  --accent-soft: #471116;
  --warm: #ffae75;
  --danger: #ff8b8b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
  --fab-shadow: 0 18px 40px rgba(85, 0, 9, 0.44);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.map-app {
  position: relative;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(255, 76, 89, 0.16), transparent 30%),
    linear-gradient(180deg, #200507 0%, #120304 60%, #080102 100%);
}

.map-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.overlay-stack {
  position: relative;
  z-index: 300;
  min-height: 100vh;
  padding: 14px;
  pointer-events: none;
}

.overlay-stack > * {
  pointer-events: auto;
}

.floating-column,
.route-sheet,
.voice-dock {
  position: absolute;
}

.floating-column {
  top: 14px;
  left: 14px;
  right: 14px;
  display: grid;
  gap: 12px;
}

.panel-glass {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    var(--glass);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.search-card,
.status-card,
.route-sheet {
  border-radius: 28px;
}

.search-card {
  padding: 12px;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.search-input-shell {
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-radius: 20px;
  background: rgba(255, 248, 248, 0.95);
  color: #261719;
}

.search-icon {
  width: 14px;
  height: 14px;
  border: 2px solid #897176;
  border-radius: 999px;
  position: relative;
  flex: 0 0 auto;
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  border-radius: 999px;
  background: #897176;
  right: -5px;
  bottom: -2px;
  transform: rotate(45deg);
}

.search-input-shell input {
  width: 100%;
  min-width: 0;
  min-height: 60px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #261719;
  font-size: 1rem;
}

.search-input-shell input::placeholder {
  color: #806d71;
}

.search-submit,
.action-chip,
.preset-chip {
  min-height: 48px;
  border-radius: 18px;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, opacity 140ms ease;
}

.search-submit:hover,
.action-chip:hover,
.preset-chip:hover,
.rok-fab:hover {
  transform: translateY(-1px);
}

.search-submit {
  min-width: 92px;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--accent) 0%, #ff7a63 100%);
  color: #250405;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(255, 76, 89, 0.26);
}

.quick-actions,
.preset-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-top: 10px;
  scrollbar-width: none;
}

.quick-actions::-webkit-scrollbar,
.preset-row::-webkit-scrollbar,
.steps-list::-webkit-scrollbar {
  display: none;
}

.action-chip,
.preset-chip {
  flex: 0 0 auto;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.action-chip[disabled],
.preset-chip[disabled],
.search-submit[disabled] {
  cursor: default;
  opacity: 0.52;
  transform: none;
}

.action-chip.is-active {
  background: rgba(255, 76, 89, 0.18);
  border-color: var(--line-strong);
}

.status-card {
  padding: 16px 18px;
}

.status-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 76, 89, 0.15);
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-badge-soft {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.assistant-copy {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.04rem;
  line-height: 1.28;
}

.transcript-copy,
.status-hint,
.sheet-copy,
.summary-card span,
.step-meta,
.empty-step,
.sheet-kicker {
  color: var(--muted);
}

.transcript-copy {
  margin: 10px 0 0;
  line-height: 1.45;
}

.status-hint {
  margin: 12px 0 0;
  font-size: 0.87rem;
}

.status-meta {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.82rem;
  color: #efc2c6;
}

.route-sheet {
  left: 14px;
  right: 14px;
  bottom: 124px;
  display: flex;
  flex-direction: column;
  max-height: min(40vh, 360px);
  padding: 12px 14px 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    var(--glass-strong);
}

.sheet-handle {
  width: 52px;
  height: 5px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.sheet-kicker {
  margin: 0 0 6px;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sheet-head h1 {
  margin: 0;
  font-size: 1.24rem;
  font-family: "Space Grotesk", sans-serif;
}

.sheet-copy {
  margin: 2px 0 0;
  max-width: 180px;
  text-align: right;
  font-size: 0.84rem;
  line-height: 1.35;
}

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

.summary-card,
.step-item,
.empty-step {
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.04);
}

.summary-card {
  border-radius: 20px;
  padding: 12px;
}

.summary-card strong {
  display: block;
  margin-top: 6px;
  font-size: 1rem;
}

.steps-list {
  margin: 12px 0 0;
  padding: 0 4px 0 0;
  list-style: none;
  display: grid;
  gap: 10px;
  overflow: auto;
}

.step-item,
.empty-step {
  border-radius: 18px;
  padding: 14px;
}

.step-item strong {
  display: block;
  line-height: 1.42;
}

.step-meta {
  margin-top: 7px;
  font-size: 0.88rem;
}

.voice-dock {
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(calc(100vw - 28px), 360px);
}

.listener-pill {
  width: 100%;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(17, 3, 5, 0.74);
  backdrop-filter: blur(18px);
  text-align: center;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.26);
  transition: border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.listener-pill strong {
  display: block;
  font-size: 0.98rem;
  font-family: "Space Grotesk", sans-serif;
}

.listener-pill p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.rok-fab {
  width: 84px;
  height: 84px;
  border-radius: 999px;
  position: relative;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 28%),
    linear-gradient(180deg, #471116 0%, #2a070b 100%);
  border: 1px solid rgba(255, 122, 132, 0.28);
  color: var(--text);
  box-shadow: var(--fab-shadow);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.rok-fab::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: inherit;
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 36%),
    linear-gradient(180deg, #672029 0%, #3f1116 100%);
}

.rok-fab-core {
  position: relative;
  z-index: 1;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.rok-fab.is-live {
  border-color: rgba(255, 146, 156, 0.46);
}

.listener-pill[data-state="starting"],
.listener-pill[data-state="recovering"] {
  border-color: rgba(255, 174, 117, 0.34);
  background: rgba(35, 10, 5, 0.82);
}

.listener-pill[data-state="listening"],
.listener-pill[data-state="hearing"] {
  border-color: rgba(255, 116, 132, 0.34);
  background: rgba(40, 6, 10, 0.82);
}

.listener-pill[data-state="awaiting"] {
  border-color: rgba(255, 174, 117, 0.34);
  background: rgba(45, 16, 8, 0.84);
}

.listener-pill[data-state="blocked"],
.listener-pill[data-state="unsupported"] {
  border-color: rgba(255, 139, 139, 0.32);
  background: rgba(42, 8, 10, 0.88);
}

.rok-fab[data-state="starting"],
.rok-fab[data-state="recovering"] {
  border-color: rgba(255, 174, 117, 0.5);
  box-shadow:
    0 0 0 0 rgba(255, 174, 117, 0.28),
    var(--fab-shadow);
  animation: fab-pulse-warm 1.35s ease-in-out infinite;
}

.rok-fab[data-state="listening"],
.rok-fab[data-state="hearing"] {
  border-color: rgba(255, 143, 154, 0.56);
  box-shadow:
    0 0 0 0 rgba(255, 76, 89, 0.28),
    0 22px 46px rgba(102, 0, 17, 0.5);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 28%),
    linear-gradient(180deg, #67141f 0%, #33070c 100%);
  animation: fab-pulse-live 1.2s ease-in-out infinite;
}

.rok-fab[data-state="awaiting"] {
  border-color: rgba(255, 174, 117, 0.52);
  box-shadow:
    0 0 0 0 rgba(255, 174, 117, 0.26),
    0 22px 46px rgba(102, 25, 0, 0.38);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 28%),
    linear-gradient(180deg, #76421a 0%, #3d1908 100%);
  animation: fab-pulse-warm 1.1s ease-in-out infinite;
}

.rok-fab[data-state="hearing"] {
  transform: scale(1.06);
}

.rok-fab[data-state="blocked"],
.rok-fab[data-state="unsupported"] {
  border-color: rgba(255, 139, 139, 0.52);
  background:
    radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 28%),
    linear-gradient(180deg, #592026 0%, #2c090d 100%);
}

.chat-messages,
.chat-form {
  display: none;
}

@keyframes fab-pulse-live {
  0% {
    box-shadow:
      0 0 0 0 rgba(255, 76, 89, 0.32),
      0 22px 46px rgba(102, 0, 17, 0.5);
  }
  70% {
    box-shadow:
      0 0 0 24px rgba(255, 76, 89, 0),
      0 22px 46px rgba(102, 0, 17, 0.5);
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(255, 76, 89, 0),
      0 22px 46px rgba(102, 0, 17, 0.5);
  }
}

@keyframes fab-pulse-warm {
  0% {
    box-shadow:
      0 0 0 0 rgba(255, 174, 117, 0.32),
      var(--fab-shadow);
  }
  70% {
    box-shadow:
      0 0 0 22px rgba(255, 174, 117, 0),
      var(--fab-shadow);
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(255, 174, 117, 0),
      var(--fab-shadow);
  }
}

.leaflet-container {
  font-family: "IBM Plex Sans", sans-serif;
  background: #180507;
}

.leaflet-control-container .leaflet-top,
.leaflet-control-container .leaflet-bottom {
  z-index: 200;
}

.leaflet-bar a {
  background: rgba(28, 7, 9, 0.92);
  color: var(--text);
  border-bottom-color: var(--line);
}

.leaflet-bar a:hover {
  background: rgba(52, 12, 17, 0.96);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip,
.leaflet-control-attribution {
  background: rgba(26, 6, 8, 0.9);
  color: var(--text);
}

.leaflet-control-attribution a {
  color: #ffb8bf;
}

@media (min-width: 768px) {
  .overlay-stack {
    padding: 18px;
  }

  .floating-column {
    top: 18px;
    left: 18px;
    right: auto;
    width: min(400px, calc(100vw - 36px));
  }

  .route-sheet {
    left: 18px;
    right: auto;
    width: min(400px, calc(100vw - 36px));
    bottom: 132px;
    max-height: min(42vh, 420px);
  }

  .voice-dock {
    bottom: 26px;
    width: 360px;
  }
}

@media (max-width: 560px) {
  .overlay-stack {
    padding: 12px;
  }

  .floating-column {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .route-sheet {
    left: 12px;
    right: 12px;
    bottom: 120px;
    max-height: min(38vh, 340px);
  }

  .sheet-head {
    flex-direction: column;
  }

  .sheet-copy {
    max-width: none;
    text-align: left;
  }

  .voice-dock {
    width: min(calc(100vw - 24px), 360px);
    bottom: 18px;
  }

  .rok-fab {
    width: 78px;
    height: 78px;
  }

  .rok-fab-core {
    font-size: 1.62rem;
  }
}
