:root {
  --paper: #f5f2e9;
  --surface: #ffffff;
  --surface-soft: #fbfaf4;
  --ink: #172027;
  --muted: #657078;
  --line: #ded9c9;
  --green: #178a70;
  --green-soft: #e5f3ee;
  --blue: #3579a8;
  --blue-soft: #e7f1f7;
  --amber: #c67b24;
  --amber-soft: #fff0d9;
  --red: #c45143;
  --red-soft: #fae7e3;
  --purple: #7165ad;
  --purple-soft: #ece9f7;
  --shadow: 0 18px 46px rgba(44, 40, 31, 0.17);
  --dock-height: 76px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--paper);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
}

body {
  overscroll-behavior: none;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(23, 138, 112, 0.36);
  outline-offset: 2px;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--paper);
}

.map-surface {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #dbe7dc;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  font: inherit;
}

.leaflet-control-attribution {
  margin-bottom: calc(var(--dock-height) + env(safe-area-inset-bottom) + 12px) !important;
  border-radius: 6px 0 0 0;
  font-size: 10px;
}

.topbar {
  position: absolute;
  z-index: 10;
  top: calc(12px + env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 60px;
  padding: 10px 10px 10px 12px;
  border: 1px solid rgba(23, 32, 39, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 8px 28px rgba(33, 29, 21, 0.13);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #ffd43b;
  border: 1px solid rgba(18, 18, 18, 0.16);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35);
}

.brand-mark img {
  display: block;
  width: 30px;
  height: 30px;
}

.brand strong,
.brand small {
  display: block;
  white-space: nowrap;
}

.brand strong {
  font-size: 18px;
  line-height: 1.08;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.icon-button,
.nav-button,
.chip,
.text-button,
.sheet-mini-action,
.mini-spot,
.route-step,
.signal-strip button,
.compare-list button,
.drill-options button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.icon-button.is-loading {
  color: #0c6e58;
  background: var(--green-soft);
  border-color: #9bd8c5;
}

.icon-button:active,
.quick-chip:active,
.chip:active,
.text-button:active,
.route-step:active,
.mini-spot:active,
.spot-card:active,
.city-card:active,
.nav-button:active {
  transform: translateY(1px);
}

.icon-button svg,
.nav-button svg,
.search-box svg,
.inline-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.language-button {
  position: relative;
}

.sibling-button {
  color: var(--green);
  background: linear-gradient(180deg, #ffffff 0%, #eefaf5 100%);
  border-color: rgba(28, 168, 113, 0.24);
}

.language-code {
  position: absolute;
  right: 5px;
  bottom: 5px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--green);
  font-size: 8px;
  font-weight: 900;
}

.feedback-button {
  position: relative;
}

.feedback-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--red);
}

.search-panel {
  position: absolute;
  z-index: 11;
  top: calc(84px + env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  padding: 10px;
  border: 1px solid rgba(23, 32, 39, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.search-box svg {
  flex: 0 0 auto;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.search-clear {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  color: #566269;
  background: #edf2f1;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.search-clear[hidden] {
  display: none;
}

.city-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-top: 10px;
  padding-bottom: 2px;
}

.city-strip button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--ink);
  background: #f3f7f4;
  border: 1px solid var(--line);
  font-weight: 800;
}

.status-pill {
  position: absolute;
  z-index: 7;
  top: calc(90px + env(safe-area-inset-top));
  left: 18px;
  max-width: calc(100% - 36px);
  padding: 10px 14px;
  border: 1px solid rgba(23, 32, 39, 0.08);
  border-radius: 999px;
  color: #15302b;
  background: rgba(232, 246, 240, 0.94);
  box-shadow: 0 8px 22px rgba(22, 66, 54, 0.11);
  font-weight: 900;
  backdrop-filter: blur(10px);
}

.quick-rail {
  position: absolute;
  z-index: 6;
  top: calc(144px + env(safe-area-inset-top));
  left: 18px;
  right: 18px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
}

.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.93);
  box-shadow: 0 8px 22px rgba(34, 29, 21, 0.12);
  font-weight: 900;
}

.quick-chip.is-active {
  border-color: rgba(23, 138, 112, 0.4);
  color: #0d5f4e;
  background: rgba(229, 243, 238, 0.97);
}

.quick-chip span {
  font-size: 19px;
}

.sum-marker {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 999px 999px 999px 3px;
  transform: rotate(45deg);
  color: #ffffff;
  background: var(--blue);
  border: 4px solid #ffffff;
  box-shadow: 0 8px 16px rgba(19, 31, 40, 0.23);
}

.sum-marker span {
  transform: rotate(-45deg);
  font-size: 18px;
  line-height: 1;
}

.marker-pickpocket { background: var(--amber); }
.marker-phone { background: var(--red); }
.marker-bag { background: var(--purple); }
.marker-transit { background: var(--blue); }
.marker-scam { background: #b6652e; }
.marker-night { background: #3f5262; }
.marker-selected {
  outline: 4px solid rgba(23, 138, 112, 0.28);
}

.bottom-sheet {
  position: absolute;
  z-index: 8;
  left: 12px;
  right: 12px;
  bottom: calc(var(--dock-height) + env(safe-area-inset-bottom) + 18px);
  max-height: min(58dvh, 570px);
  overflow-y: auto;
  padding: 12px;
  border: 1px solid rgba(23, 32, 39, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  transition: max-height 180ms ease, transform 180ms ease;
  scrollbar-width: thin;
  scrollbar-color: #c6d6d2 transparent;
}

.bottom-sheet::-webkit-scrollbar {
  width: 8px;
}

.bottom-sheet::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #c6d6d2;
}

.bottom-sheet.is-collapsed {
  max-height: min(45dvh, 430px);
}

.bottom-sheet.is-expanded {
  max-height: min(75dvh, 700px);
}

.sheet-grip {
  display: block;
  position: relative;
  width: 112px;
  height: 44px;
  margin: -8px auto 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  appearance: none;
  cursor: grab;
  touch-action: none;
}

.sheet-grip::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 58px;
  height: 5px;
  border-radius: 999px;
  background: #cfd9d8;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 0 0 1px rgba(72, 91, 98, 0.08);
  transform: translate(-50%, -50%);
}

.sheet-grip:active {
  cursor: grabbing;
}

.sheet-grip:focus-visible {
  outline: 3px solid rgba(23, 138, 112, 0.28);
  outline-offset: 2px;
}

.bottom-sheet {
  transform: translateY(var(--sheet-drag-offset, 0));
}

.bottom-sheet.is-dragging {
  transition: none !important;
}

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

.sheet-head h1,
.sheet-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.18;
}

.sheet-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.compact-stat {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 58px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 8px;
  color: #136451;
  background: var(--green-soft);
  border: 1px solid #cce8df;
  font-weight: 900;
}

.sheet-head-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.sheet-mini-action {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid #cce8df;
  border-radius: 8px;
  color: #136451;
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.filter-row,
.risk-rail,
.action-grid,
.detail-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.return-actions {
  overflow: visible;
}

.return-actions .text-button {
  flex: 1 1 0;
}

.chip,
.text-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 13px;
  border-radius: 8px;
  font-weight: 900;
}

.chip {
  flex: 0 0 auto;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.chip.is-active {
  color: #0f6b58;
  background: var(--green-soft);
  border-color: #8bd3be;
  box-shadow: inset 3px 0 0 #45b995;
}

.text-button {
  color: #31434a;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.primary-button {
  width: 100%;
  color: #ffffff;
  background: var(--green);
}

.spot-card,
.guide-card,
.panic-card,
.check-card {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

button.spot-card {
  display: block;
  width: 100%;
  text-align: left;
}

.spot-card.is-selected {
  border-color: rgba(23, 138, 112, 0.3);
  box-shadow: inset 4px 0 0 #4fc5a0;
}

.map-hint-card,
.spot-brief-card {
  display: grid;
  gap: 11px;
}

.map-action-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #eadbc4;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffaf1, #ffffff);
}

.map-action-card strong {
  display: block;
  font-size: 16px;
  line-height: 1.28;
}

.map-action-card p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.map-action-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.map-action-strip .text-button {
  min-width: 0;
  padding-inline: 8px;
  font-size: 12px;
}

.marker-legend {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid #eadbc4;
  border-radius: 8px;
  background: #fffdf7;
}

.marker-legend > span {
  color: #805314;
  font-size: 12px;
  font-weight: 900;
}

.marker-legend > div {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 1px;
  scrollbar-width: none;
}

.marker-legend > div::-webkit-scrollbar {
  display: none;
}

.marker-legend button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #eadbc4;
  border-radius: 999px;
  color: #2d3940;
  background: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.marker-legend button.is-active {
  color: #0f6b58;
  background: var(--green-soft);
  border-color: #8bd3be;
}

.map-hint-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.28;
}

.map-hint-card p {
  margin: 0;
}

.spot-brief-card .spot-title-row,
.spot-brief-card .tag-row {
  margin: 0;
}

.compact-tags {
  gap: 6px;
}

.brief-line {
  padding: 11px;
  border: 1px solid #d5ece4;
  border-radius: 8px;
  background: #f6fbf8;
}

.brief-line.is-action {
  border-color: #eadbc4;
  background: #fffaf1;
}

.brief-line span,
.brief-stats span {
  display: block;
  color: #126653;
  font-size: 12px;
  font-weight: 900;
}

.brief-line strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.45;
}

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

.brief-stats div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.brief-stats strong {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brief-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: visible;
  padding-bottom: 0;
}

.brief-actions .text-button,
.brief-actions .primary-button {
  width: auto;
  min-width: 0;
  padding-inline: 9px;
}

.incident-actions {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  overflow: visible;
  padding-bottom: 0;
}

.incident-actions .primary-button,
.incident-actions .text-button {
  width: auto;
  min-width: 0;
  padding-inline: 8px;
}

.compact-filter-row {
  margin-top: 0;
}

.danger-action {
  color: #8b3128;
  background: var(--red-soft);
  border-color: #edbbb3;
}

.report-form {
  display: grid;
  gap: 10px;
}

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

.report-chip {
  justify-content: flex-start;
  gap: 8px;
  min-height: 48px;
}

.report-chip.is-selected {
  color: #0e6d58;
  background: var(--green-soft);
  border-color: #82d3bd;
  box-shadow: inset 0 0 0 1px #82d3bd;
}

.report-emoji {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #ffffff;
}

.recency-chip {
  position: relative;
}

.recency-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.recency-chip:has(input:checked) {
  color: #0e6d58;
  background: var(--green-soft);
  border-color: #82d3bd;
}

.live-feed {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.feed-head strong {
  color: var(--ink);
  font-size: 14px;
}

.feed-item {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.feed-item p {
  margin: 0;
  font-weight: 900;
}

.feed-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.feed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.feed-actions button {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #244249;
  background: var(--surface);
  font-size: 12px;
  font-weight: 900;
}

.spot-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.spot-title-row h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  text-align: left;
  overflow-wrap: anywhere;
}

.spot-title-row p,
.spot-card p,
.guide-card p,
.panic-card p,
.check-card p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.52;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: #145342;
  background: var(--green-soft);
  border: 1px solid #cce8df;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.badge.warn {
  color: #7b4b12;
  background: var(--amber-soft);
  border-color: #f1ce9a;
}

.badge.danger {
  color: #8b3128;
  background: var(--red-soft);
  border-color: #edbbb3;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 11px;
}

.street-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #f0d9b5;
  border-radius: 8px;
  background: linear-gradient(180deg, #fffaf1, #ffffff);
}

.street-panel > div:first-child strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  line-height: 1.34;
}

.street-grid {
  display: grid;
  gap: 8px;
  margin-top: 11px;
}

.street-grid div {
  padding: 10px;
  border: 1px solid #eadbc4;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
}

.street-grid p {
  font-weight: 750;
}

.decision-card {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f2f8f5;
  border: 1px solid #d5ece4;
}

.routine-card,
.loop-card,
.progress-card,
.brief-card,
.compare-card,
.incident-card,
.playbook-card,
.drill-card {
  margin-top: 10px;
  padding: 13px;
  border: 1px solid #d5ece4;
  border-radius: 8px;
  background: linear-gradient(180deg, #f6fbf8, #ffffff);
}

.routine-copy span,
.loop-card span,
.progress-card span,
.brief-card span,
.compare-card span,
.incident-card span,
.playbook-card span,
.drill-card span,
.mini-spot span,
.street-panel span,
.section-label,
.related-block > strong {
  color: #126653;
  font-size: 12px;
  font-weight: 900;
}

.routine-copy strong,
.loop-card .brief-head strong,
.progress-card strong,
.brief-head strong,
.playbook-card > strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
}

.routine-copy p,
.loop-card p,
.progress-card p,
.compare-card p,
.incident-card p,
.playbook-card p,
.drill-card p,
.street-panel p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.48;
}

.routine-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 11px;
}

.routine-metrics div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.routine-metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.routine-metrics strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.progress-track {
  height: 9px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ebe9;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #178a70, #52c29e);
}

.loop-meter {
  height: 8px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4ebe9;
}

.loop-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #178a70, #d08a2c);
}

.route-steps {
  display: grid;
  gap: 8px;
  margin-top: 11px;
}

.route-step {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 74px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}

.route-step.is-active {
  border-color: #9bd8c5;
  background: #f2fbf7;
  box-shadow: inset 4px 0 0 #45b995;
}

.route-step strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-step em {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loop-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

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

.brief-grid,
.playbook-grid {
  display: grid;
  gap: 8px;
  margin-top: 11px;
}

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

.brief-grid div,
.playbook-grid div {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.brief-grid strong {
  display: block;
  margin-top: 5px;
  line-height: 1.35;
}

.signal-strip,
.brief-actions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin-top: 10px;
  padding-bottom: 3px;
  scrollbar-width: none;
}

.signal-strip::-webkit-scrollbar,
.brief-actions::-webkit-scrollbar,
.compare-list::-webkit-scrollbar {
  display: none;
}

.signal-strip button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #244249;
  background: var(--surface);
  font-size: 12px;
  font-weight: 900;
}

.spot-brief-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: visible;
}

.spot-brief-actions .text-button,
.spot-brief-actions .primary-button {
  width: 100%;
}

.spot-brief-actions .primary-button {
  grid-column: 1 / -1;
}

.compare-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(174px, 62%);
  gap: 8px;
  overflow-x: auto;
  margin-top: 10px;
  padding-bottom: 3px;
  scrollbar-width: none;
}

.compare-list button {
  display: grid;
  gap: 5px;
  min-height: 86px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  text-align: left;
}

.compare-list button strong,
.compare-list button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.incident-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 11px;
}

.incident-grid label {
  display: grid;
  gap: 5px;
}

.incident-grid label.is-wide {
  grid-column: 1 / -1;
}

.incident-grid input,
.incident-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: var(--surface);
}

.incident-grid input {
  min-height: 42px;
  padding: 0 11px;
}

.incident-grid textarea {
  min-height: 76px;
  padding: 10px 11px;
  resize: vertical;
}

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

.drill-list {
  display: grid;
  gap: 9px;
  margin-top: 11px;
}

.drill-item {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.drill-item > strong {
  line-height: 1.42;
}

.drill-options {
  display: grid;
  gap: 7px;
}

.drill-options button {
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-soft);
  text-align: left;
  font-weight: 850;
  line-height: 1.42;
}

.drill-options button.is-correct {
  border-color: #9bd8c5;
  background: var(--green-soft);
}

.drill-options button.is-wrong {
  border-color: #edbbb3;
  background: var(--red-soft);
}

.drill-result {
  width: fit-content;
  min-height: 27px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.drill-result.is-correct {
  color: #126653;
  border-color: #9bd8c5;
  background: var(--green-soft);
}

.drill-result.is-wrong {
  color: #8b3128;
  border-color: #edbbb3;
  background: var(--red-soft);
}

.related-block {
  margin-top: 13px;
}

.related-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(160px, 58%);
  gap: 8px;
  overflow-x: auto;
  margin-top: 8px;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.related-rail::-webkit-scrollbar {
  display: none;
}

.mini-spot {
  display: grid;
  gap: 5px;
  min-height: 108px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-soft);
  text-align: left;
}

.mini-spot strong {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.35;
}

.mini-spot em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.decision-card strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.info-grid div {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.info-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.info-grid strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.note-list,
.step-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.note-list li,
.step-list li {
  position: relative;
  padding: 10px 10px 10px 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  line-height: 1.5;
}

.note-list li + li,
.step-list li + li {
  margin-top: 8px;
}

.note-list li::before,
.step-list li::before {
  position: absolute;
  left: 11px;
  top: 12px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  content: "";
}

.spot-list {
  margin-top: 10px;
}

.spot-list .spot-card {
  width: 100%;
  text-align: left;
}

.city-card {
  display: grid;
  gap: 4px;
  width: 100%;
  margin-top: 9px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  background: var(--surface);
}

.city-card strong {
  font-size: 17px;
}

.city-card span {
  color: var(--muted);
}

.city-risk-mix {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.city-risk-mix em {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  color: #244249;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.section-label {
  margin: 14px 0 2px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  background: var(--surface);
}

.check-row.is-done {
  border-color: #a8dcca;
  background: var(--green-soft);
}

.check-box {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: transparent;
  border: 2px solid #9ba8ad;
  font-weight: 900;
}

.check-row.is-done .check-box {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.bottom-nav {
  position: absolute;
  z-index: 9;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  min-height: var(--dock-height);
  padding: 9px;
  border: 1px solid rgba(23, 32, 39, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.nav-button {
  display: grid;
  place-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 56px;
  border-radius: 8px;
  color: #617077;
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.nav-button.is-active {
  color: #0c6e58;
  background: var(--green-soft);
  border: 1px solid #cce8df;
}

.nav-panic {
  color: #ffffff;
  background: var(--red);
}

.nav-panic.is-active {
  color: #ffffff;
  background: #b94336;
  border-color: #b94336;
}

.toast {
  position: absolute;
  z-index: 20;
  left: 22px;
  right: 22px;
  bottom: calc(var(--dock-height) + env(safe-area-inset-bottom) + 28px);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  padding: 13px 16px;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(18, 29, 34, 0.93);
  text-align: center;
  font-weight: 800;
  line-height: 1.45;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.static-shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 28px;
  line-height: 1.7;
}

@media (min-width: 780px) {
  .topbar,
  .search-panel,
  .quick-rail,
  .bottom-sheet,
  .bottom-nav {
    width: 430px;
  }

  .topbar,
  .search-panel,
  .quick-rail,
  .bottom-sheet,
  .bottom-nav {
    left: 18px;
    right: auto;
  }

  .bottom-sheet {
    max-height: min(66dvh, 680px);
  }
}

@media (max-width: 779px) {
  .bottom-sheet {
    transition: max-height 180ms ease, padding 180ms ease, transform 180ms ease;
  }

  .bottom-sheet.is-collapsed {
    max-height: 56px;
    overflow: hidden;
    padding: 6px 12px;
  }

  .bottom-sheet.is-collapsed .sheet-grip {
    margin-bottom: 0;
  }

  .bottom-sheet.is-collapsed .sheet-head {
    align-items: center;
    margin-bottom: 0;
  }

  .bottom-sheet.is-collapsed .sheet-head h1,
  .bottom-sheet.is-collapsed .sheet-head h2 {
    font-size: 18px;
    line-height: 1.18;
  }

  .bottom-sheet.is-collapsed .sheet-head,
  .bottom-sheet.is-collapsed .sheet-head p,
  .bottom-sheet.is-collapsed .sheet-mini-action,
  .bottom-sheet.is-collapsed .filter-row,
  .bottom-sheet.is-collapsed .decision-card,
  .bottom-sheet.is-collapsed .routine-card,
  .bottom-sheet.is-collapsed .loop-card,
  .bottom-sheet.is-collapsed .brief-card,
  .bottom-sheet.is-collapsed .compare-card,
  .bottom-sheet.is-collapsed .incident-card,
  .bottom-sheet.is-collapsed .playbook-card,
  .bottom-sheet.is-collapsed .drill-card,
  .bottom-sheet.is-collapsed .progress-card,
  .bottom-sheet.is-collapsed .spot-card,
  .bottom-sheet.is-collapsed .spot-list,
  .bottom-sheet.is-collapsed .guide-card,
  .bottom-sheet.is-collapsed .panic-card,
  .bottom-sheet.is-collapsed .check-card,
  .bottom-sheet.is-collapsed .city-card,
  .bottom-sheet.is-collapsed .section-label {
    display: none !important;
  }

  .bottom-sheet.is-expanded {
    max-height: min(50dvh, 430px);
  }

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

@media (max-width: 390px) {
  .topbar,
  .bottom-sheet,
  .bottom-nav {
    left: 7px;
    right: 7px;
  }

  .topbar {
    min-height: 56px;
    padding: 8px;
  }

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

  .brand strong {
    font-size: 17px;
  }

  .brand small {
    display: none;
  }

  .top-actions {
    gap: 5px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .status-pill {
    top: calc(76px + env(safe-area-inset-top));
    left: 8px;
  }

  .quick-rail {
    top: calc(126px + env(safe-area-inset-top));
    left: 8px;
    right: 8px;
  }

  .quick-chip {
    min-height: 40px;
    padding: 0 12px;
  }

  .bottom-sheet {
    bottom: calc(var(--dock-height) + env(safe-area-inset-bottom) + 16px);
    padding: 11px;
  }

  .bottom-sheet.is-collapsed {
    max-height: 56px;
  }

  .bottom-sheet.is-expanded {
    max-height: min(49dvh, 420px);
  }

  .sheet-head h1,
  .sheet-head h2 {
    font-size: 20px;
  }

  .brief-grid,
  .loop-actions,
  .incident-grid {
    grid-template-columns: 1fr;
  }
}

.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  padding: calc(16px + env(safe-area-inset-top)) 14px calc(var(--dock-height) + env(safe-area-inset-bottom) + 18px);
  background: rgba(18, 23, 24, 0.18);
  backdrop-filter: blur(5px);
}

.feedback-card {
  width: min(100%, 430px);
  max-height: min(78dvh, 620px);
  overflow: auto;
  border: 1px solid rgba(23, 32, 39, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.sibling-card {
  max-height: min(74dvh, 520px);
}

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

.feedback-kicker {
  display: inline-flex;
  margin-bottom: 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.feedback-head h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
}

.feedback-head p,
.feedback-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.feedback-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  font-size: 22px;
  line-height: 1;
}

.feedback-form {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.sibling-body {
  display: grid;
  gap: 12px;
  padding: 0 18px 18px;
}

.sibling-badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid rgba(28, 168, 113, 0.18);
  border-radius: 999px;
  color: #0c6d51;
  background: #f0faf5;
  font-size: 12px;
  font-weight: 900;
}

.sibling-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.sibling-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 14px 15px;
  border: 1px solid rgba(28, 168, 113, 0.28);
  border-radius: 8px;
  color: #ffffff;
  background: var(--green);
  box-shadow: 0 10px 24px rgba(28, 168, 113, 0.22);
  font-size: 15px;
  font-weight: 900;
}

.sibling-link span:last-child {
  font-size: 20px;
  line-height: 1;
}

.feedback-kind-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.feedback-kind-row button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-soft);
  font-weight: 900;
}

.feedback-kind-row button.is-selected {
  color: #0d694f;
  border-color: rgba(23, 138, 112, 0.38);
  background: var(--green-soft);
}

.feedback-field {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.feedback-field textarea,
.feedback-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: var(--surface-soft);
  outline: 0;
  resize: vertical;
}

.feedback-field textarea:focus,
.feedback-field input:focus {
  border-color: rgba(23, 138, 112, 0.5);
  box-shadow: 0 0 0 3px rgba(23, 138, 112, 0.14);
}

.feedback-actions {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 8px;
}

.feedback-actions .primary-button,
.feedback-actions .text-button {
  min-height: 44px;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 340px) {
  :root {
    --dock-height: 66px;
  }

  .brand {
    gap: 7px;
  }

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

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

  .brand strong {
    font-size: 15px;
  }

  .icon-button {
    width: 34px;
    height: 34px;
  }

  .bottom-nav {
    gap: 4px;
    padding: 7px;
  }

  .nav-button {
    min-height: 50px;
    font-size: 11px;
  }

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

/* Performance pass */
.map-surface,
.bottom-sheet,
.bottom-nav,
.topbar,
.search-panel,
.quick-rail {
  contain: layout paint style;
}

.spot-card,
.city-card,
.guide-card,
.panic-card,
.check-card,
.decision-card,
.routine-card,
.loop-card,
.brief-card,
.compare-card,
.incident-card,
.playbook-card,
.drill-card,
.progress-card,
.feedback-card,
.feed-item {
  contain: layout paint;
}

.spot-list,
.live-feed,
.report-form {
  contain: layout style;
  content-visibility: auto;
  contain-intrinsic-size: 360px;
}

.topbar,
.search-panel,
.bottom-sheet,
.bottom-nav {
  backdrop-filter: blur(10px);
}

.sum-marker {
  will-change: transform;
}
