:root {
  color-scheme: light;
  --bg: #eef3f1;
  --surface: #ffffff;
  --surface-muted: #f4f7f5;
  --ink: #17211d;
  --muted: #63706b;
  --line: #d8e0dc;
  --brand: #0f766e;
  --brand-dark: #0c5f59;
  --danger: #b42318;
  --danger-soft: #fff1ef;
  --amber: #b7791f;
  --amber-soft: #fff7e6;
  --shadow: 0 18px 48px rgba(22, 42, 36, 0.14);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: linear-gradient(180deg, #dbe8e4 0%, var(--bg) 42%, #f7f8f6 100%);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic",
    "Noto Sans JP", "Segoe UI", sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.phone-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 18px 16px 22px;
}

.app-header,
.section-heading,
.subheading,
.location-card,
.qa-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-header {
  padding: 6px 0 14px;
}

.app-header > div,
.section-heading > div,
.status-card > div,
.priority-card > div,
.location-card > div {
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 1.55rem;
  line-height: 1.15;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.2;
}

h3 {
  font-size: 1rem;
  line-height: 1.25;
}

.kicker {
  color: var(--brand);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panic-button,
.primary-action,
.secondary-action,
.result-action,
.mode-tab,
.qa-option,
.text-button {
  border: 0;
}

.panic-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 13px;
  border-radius: 8px;
  background: var(--danger);
  color: #fff;
  font-weight: 800;
}

.icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-weight: 900;
}

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

.section-heading,
.status-card,
.subheading {
  flex-wrap: wrap;
}

.status-card strong,
.status-card span {
  display: block;
}

.status-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.status-pill,
.mock-badge,
.count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 0.74rem;
  font-weight: 800;
}

.status-pill {
  background: #e7f5f1;
  color: var(--brand-dark);
}

.intro-card {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: 900px;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0);
  transition:
    max-height 320ms ease,
    opacity 220ms ease,
    transform 220ms ease,
    margin 320ms ease;
}

.intro-image {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.image-cta-grid {
  display: grid;
  gap: 9px;
}

.image-cta {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.image-cta:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 3px;
}

.image-cta img {
  display: block;
  width: 100%;
  border-radius: 8px;
}

.phone-shell.is-started .intro-card {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

.mock-badge {
  background: var(--amber-soft);
  color: var(--amber);
}

.count-pill {
  background: #e9edf2;
  color: #3d4852;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0;
}

.phone-shell:not(.is-started) .mode-tabs,
.phone-shell:not(.is-started) .mode-panel {
  display: none;
}

.mode-tab {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
}

.mode-tab.active {
  border-color: var(--brand);
  background: #e6f4f1;
  color: var(--brand-dark);
}

.tab-icon,
.button-icon {
  display: inline-flex;
  flex: 0 0 auto;
}

.tab-icon {
  width: 20px;
  height: 20px;
}

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

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
  animation: panel-rise 260ms ease-out;
}

@keyframes panel-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.prep-form,
.card-stack,
.action-panel,
.movement-panel,
.transport-panel,
.guidance-panel {
  display: grid;
  gap: 12px;
}

.prep-form {
  margin-top: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input {
  min-height: 46px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 92px;
  padding: 10px 12px;
}

input:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.search-status {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.search-status[data-tone="loading"] {
  border-color: #9bd3cb;
  background: #e7f5f1;
  color: var(--brand-dark);
}

.search-status[data-tone="success"] {
  border-color: #9bd3cb;
  background: #e7f5f1;
  color: var(--brand-dark);
}

.search-status[data-tone="warning"] {
  border-color: #f2c773;
  background: var(--amber-soft);
  color: var(--amber);
}

.primary-action,
.secondary-action,
.result-action,
.qa-option {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
}

.primary-action {
  background: var(--brand);
  color: #fff;
}

.secondary-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary-action.compact {
  min-height: 38px;
  padding: 0 12px;
}

.map-visual {
  position: relative;
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  align-items: center;
  margin: 16px 0;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6faf8;
}

.google-map-panel {
  display: grid;
  gap: 10px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
}

.google-map-panel.emergency-map {
  margin-top: 12px;
}

.google-map-frame {
  width: 100%;
  height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2f7;
}

.text-link {
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.map-visual img {
  display: block;
  width: 112px;
  height: 86px;
  border-radius: 7px;
  object-fit: cover;
}

.map-visual strong,
.map-visual span {
  display: block;
}

.map-visual span {
  color: var(--muted);
  font-size: 0.85rem;
}

.subheading {
  margin-top: 2px;
}

.result-list,
.saved-list {
  display: grid;
  gap: 10px;
}

.place-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.place-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.place-meta,
.place-warning {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.82rem;
}

.place-warning {
  color: var(--amber);
  font-weight: 700;
}

.place-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #3d4852;
  font-size: 0.72rem;
  font-weight: 800;
}

.tag.urgent {
  background: var(--danger-soft);
  color: var(--danger);
}

.place-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.result-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 0.82rem;
}

.result-action.call {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.result-action.site {
  border-color: #2f5d9f;
  background: #edf4ff;
  color: #234a83;
}

.result-action.save.saved {
  border-color: var(--brand);
  background: #e6f4f1;
  color: var(--brand-dark);
}

.result-action.disabled {
  cursor: default;
  border-color: #e0e5e2;
  background: #f6f8f7;
  color: var(--muted);
}

.emergency-banner {
  padding: 15px;
  border-radius: 8px;
  background: var(--danger-soft);
  color: #47110c;
}

.emergency-banner h2 {
  margin: 3px 0 5px;
}

.emergency-banner .kicker {
  color: var(--danger);
}

.priority-card,
.qa-card,
.location-card,
.movement-panel,
.action-panel,
.transport-panel,
.guidance-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.priority-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 11px;
  background: #fffaf0;
}

.transport-panel {
  border-color: #bddbd5;
  background: #f7fbfa;
}

.guidance-panel {
  border-color: #f2c773;
  background: #fffaf0;
}

.priority-card p,
.qa-card p,
.location-card p {
  color: var(--muted);
  font-size: 0.86rem;
}

.priority-number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 900;
}

.qa-progress {
  flex-wrap: wrap;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.text-button {
  background: transparent;
  color: var(--brand);
  font-weight: 800;
}

.qa-card h3 {
  margin-bottom: 6px;
  font-size: 1.1rem;
}

.qa-options {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.qa-option {
  justify-content: flex-start;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.qa-option.primary {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.movement-list {
  display: grid;
  gap: 9px;
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.compact-check-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.84rem;
}

.app-footer {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  background: #f8faf9;
  color: var(--muted);
  font-size: 0.78rem;
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 360px) {
  .phone-shell {
    padding: 14px 12px 18px;
  }

  .place-actions {
    grid-template-columns: 1fr;
  }

  .map-visual {
    grid-template-columns: 1fr;
  }

  .map-visual img {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .phone-shell {
    width: 390px;
    max-width: 100%;
    margin: 0;
    box-shadow: none;
  }

  h1 {
    font-size: 1.38rem;
  }

  .panic-button {
    width: 42px;
    min-width: 42px;
    padding: 0;
    font-size: 0;
  }

  .panic-button .icon {
    font-size: 1rem;
  }

  .status-card {
    align-items: flex-start;
  }
}
