:root {
  --bg: #eef1f5;
  --card: #ffffff;
  --card-border: #dfe5ec;
  --text: #16202a;
  --muted: #6b7785;
  --primary: #2f80ed;
  --primary-dark: #1f6fda;
  --soft-blue: #edf4ff;
  --low-bg: #e8f7ee;
  --low-text: #1f7a45;
  --moderate-bg: #f7e3a2;
  --moderate-text: #8b5a00;
  --high-bg: #ffd8b5;
  --high-text: #9a3f00;
  --very-high-bg: #ffd7d7;
  --very-high-text: #b42318;
  --danger-bg: #fff2f2;
  --danger-border: #f2c6c6;
  --danger-text: #b42318;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

.app-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 18px 40px;
}

.app-card {
  background: var(--card);
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero {
  padding: 34px 22px 20px;
  text-align: center;
}

.hero-icon {
  font-size: 42px;
  margin-bottom: 10px;
}

.app-title {
  margin: 0;
  font-size: 2.35rem;
  line-height: 1.1;
  font-weight: 800;
  color: #0f172a;
}

.app-subtitle {
  margin: 10px 0 0;
  font-size: 1.05rem;
  color: var(--muted);
}

.how-it-works {
  margin: 22px auto 0;
  padding: 16px 18px;
  border-radius: 16px;
  background: #f4f5f8;
  color: #202938;
  text-align: left;
  max-width: 620px;
  line-height: 1.45;
  border: 1px solid #ebeef3;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 0 22px 18px;
}

.action-btn {
  min-height: 56px;
  border-radius: 18px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.action-btn:hover {
  opacity: 0.96;
  transform: translateY(-1px);
}

.action-btn-primary {
  border: none;
  background: linear-gradient(180deg, #4293ff 0%, #2f80ed 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(47, 128, 237, 0.25);
}

.action-btn-secondary {
  background: #fff;
  color: var(--primary-dark);
  border: 2px solid #70a8f4;
}

.btn-icon {
  font-size: 1.05rem;
}

.status-text {
  min-height: 28px;
  padding: 0 22px 16px;
  font-size: 1rem;
  font-weight: 700;
  color: #273444;
}

.result-area {
  padding: 0 22px 24px;
}

.empty-state,
.loading-state,
.error-card,
.result-stack {
  border-radius: 22px;
}

.empty-state {
  background: #f8fafc;
  border: 1px solid var(--card-border);
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 28px 22px;
}

.empty-icon {
  font-size: 42px;
  margin-bottom: 12px;
  opacity: 0.85;
}

.empty-state h2 {
  margin: 0 0 10px;
  font-size: 1.9rem;
}

.empty-state p {
  max-width: 470px;
  margin: 0 0 10px;
  line-height: 1.6;
  color: #314154;
}

.empty-state small {
  color: var(--muted);
  font-size: 1rem;
}

.loading-state {
  background: #f8fbff;
  border: 1px solid #dce9fb;
  padding: 22px 18px;
}

.loading-chip {
  display: inline-block;
  margin-bottom: 14px;
  background: #e8f1ff;
  color: #2359b8;
  border: 1px solid #c9dcff;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.94rem;
}

.loading-state p {
  margin: 8px 0;
  color: #24364d;
  line-height: 1.5;
}

.error-card {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  padding: 20px 18px;
}

.error-card h3 {
  margin: 0 0 10px;
  color: var(--danger-text);
  font-size: 1.2rem;
}

.error-card p {
  margin: 0;
  line-height: 1.5;
  color: #7a1d1d;
}

.result-stack {
  display: grid;
  gap: 16px;
}

.result-card {
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.04);
}

.result-card h3 {
  margin: 0 0 14px;
  font-size: 1.55rem;
}

.location-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: #101828;
  font-size: 1.1rem;
  font-weight: 700;
}

.risk-badge {
  display: inline-block;
  padding: 14px 18px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 1.35rem;
  margin-bottom: 14px;
}

.risk-badge.low {
  background: var(--low-bg);
  color: var(--low-text);
}

.risk-badge.moderate {
  background: var(--moderate-bg);
  color: var(--moderate-text);
}

.risk-badge.high {
  background: var(--high-bg);
  color: var(--high-text);
}

.risk-badge.very-high {
  background: var(--very-high-bg);
  color: var(--very-high-text);
}

.meta-line {
  margin: 0 0 12px;
  font-size: 1.08rem;
}

.summary-text {
  margin: 0;
  line-height: 1.6;
  color: #1f2937;
  font-size: 1.05rem;
}

.signal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.signal-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #edf1f5;
}

.signal-item:last-child {
  border-bottom: none;
}

.signal-icon {
  width: 34px;
  min-width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #f2f6fb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.signal-content strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
}

.signal-content span {
  color: #314154;
  line-height: 1.45;
}

.factors-list {
  margin: 0;
  padding-left: 22px;
  color: #1f2937;
}

.factors-list li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.technical-wrap {
  border: 1px solid var(--card-border);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.technical-toggle {
  width: 100%;
  background: #f8fafc;
  color: #111827;
  border: none;
  padding: 16px 18px;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  border-top: 1px solid transparent;
}

.technical-toggle:hover {
  background: #f1f5f9;
}

.technical-content {
  display: none;
  border-top: 1px solid var(--card-border);
  background: #0f172a;
  color: #7CFC98;
  padding: 14px;
  max-height: 420px;
  overflow: auto;
}

.technical-content.open {
  display: block;
}

.technical-content pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.88rem;
  line-height: 1.45;
}

.permission-note {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.98rem;
}

@media (min-width: 700px) {
  .signal-grid.columns-2 {
    grid-template-columns: 1fr 1fr;
    column-gap: 18px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px 12px 28px;
  }

  .hero {
    padding: 26px 16px 18px;
  }

  .actions,
  .status-text,
  .result-area {
    padding-left: 16px;
    padding-right: 16px;
  }

  .actions {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .app-title {
    font-size: 2rem;
  }

  .risk-badge {
    width: 100%;
    text-align: center;
    font-size: 1.18rem;
  }

  .empty-state {
    min-height: 240px;
  }

  .result-card {
    padding: 16px 14px;
  }
}