/* =============================================================
   WORLD AWARE RISK ASSESSMENT — styles.css
   Mobile-first. No frameworks. Includes print stylesheet.
   ============================================================= */

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --orange:      #E8650A;
  --dark-navy:   #1A1A2E;
  --white:       #FFFFFF;
  --gray-text:   #555555;
  --gray-light:  #F4F4F4;
  --gray-border: #DDDDDD;
  --font:        Arial, "Helvetica Neue", system-ui, sans-serif;
  --radius:      8px;
  --shadow:      0 2px 8px rgba(0,0,0,0.10);
  --nav-height:  60px;

  /* Risk level colors */
  --critical-bg:    #FADBD8;
  --critical-color: #C0392B;
  --high-bg:        #FDEBD0;
  --high-color:     #E67E22;
  --medium-bg:      #FEF9E7;
  --medium-color:   #9A7D0A;
  --low-bg:         #D5F5E3;
  --low-color:      #27AE60;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--white);
  color: var(--dark-navy);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Typography ──────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font);
  font-weight: bold;
  line-height: 1.2;
}

a {
  color: var(--orange);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ── Layout & App Shell ──────────────────────────────────── */
#app {
  max-width: 640px;
  margin: 0 auto;
  padding-bottom: calc(var(--nav-height) + 8px);
  min-height: 100vh;
}

/* Screens — hidden/shown via .active class */
.screen {
  display: none;
  padding: 0;
  animation: fadeIn 0.15s ease;
}
.screen.active {
  display: block;
}

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

/* ── Install Banner ──────────────────────────────────────── */
.install-banner {
  background: var(--dark-navy);
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 200;
}
.install-banner.hidden { display: none; }
.btn-install {
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 14px;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
}
.btn-dismiss {
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
  margin-left: auto;
  font-size: 16px;
  padding: 4px 6px;
}

/* ── Brand / Logo ────────────────────────────────────────── */
.logo-text {
  font-weight: bold;
  color: var(--orange);
  letter-spacing: 0.04em;
  font-size: 1.1rem;
}
.logo-text.logo-small { font-size: 0.95rem; }
.logo-text.logo-large { font-size: 2rem; display: block; }
.logo-tagline {
  display: block;
  color: var(--orange);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  margin-top: 2px;
}

/* ── Buttons ─────────────────────────────────────────────── */
button, .btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
  font-family: var(--font);
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  font-weight: bold;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: opacity 0.15s, background 0.15s;
}
button:active, .btn-primary:active, .btn-secondary:active { opacity: 0.85; }

.btn-primary {
  background: var(--orange);
  color: #fff;
  padding: 12px 20px;
}
.btn-primary:hover { background: #d05808; }

.btn-secondary {
  background: var(--dark-navy);
  color: #fff;
  padding: 12px 20px;
}
.btn-secondary:hover { background: #2a2a4e; }

.btn-ghost {
  background: transparent;
  color: var(--gray-text);
  border: 2px solid var(--gray-border);
  padding: 10px 18px;
}
.btn-ghost:hover { background: var(--gray-light); }

.btn-danger {
  background: #c0392b;
  color: #fff;
  padding: 12px 20px;
}
.btn-danger:hover { background: #a93226; }

.btn-large {
  width: 100%;
  justify-content: center;
  padding: 16px 20px;
  font-size: 1rem;
  border-radius: 10px;
}

.btn-small {
  padding: 6px 14px;
  font-size: 0.82rem;
  border-radius: 6px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--dark-navy);
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 6px;
}
.btn-icon:hover { background: var(--gray-light); }

.btn-contact {
  display: inline-flex;
  text-decoration: none;
  margin-bottom: 16px;
}

/* ── Bottom Navigation ───────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--dark-navy);
  display: flex;
  align-items: stretch;
  z-index: 100;
  border-top: 2px solid var(--orange);
  max-width: 640px;
  margin: 0 auto;
}

.nav-item {
  flex: 1;
  background: none;
  border: none;
  color: #888;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  padding: 8px 4px;
  font-size: 0.65rem;
  font-family: var(--font);
  font-weight: normal;
  border-radius: 0;
  transition: color 0.15s, background 0.15s;
}
.nav-item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}
.nav-item.active {
  color: var(--orange);
  background: rgba(232,101,10,0.12);
}
.nav-item:hover { color: var(--orange); }
.nav-item span { line-height: 1; }

/* ── Screen 1 — Home ─────────────────────────────────────── */
.home-container {
  padding: 40px 20px 20px;
  text-align: center;
}

.home-logo {
  margin-bottom: 20px;
}

.home-logo .logo-text {
  font-size: 2.2rem;
  display: block;
}

.home-title {
  font-size: 1.25rem;
  color: var(--dark-navy);
  margin-bottom: 16px;
  font-weight: bold;
}

.home-intro {
  color: var(--gray-text);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 32px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.home-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.home-program-text {
  font-size: 0.78rem;
  color: #888;
  margin-bottom: 24px;
}

.home-saved {
  text-align: left;
  margin-top: 16px;
  border-top: 1px solid var(--gray-border);
  padding-top: 16px;
}
.home-saved h3 {
  font-size: 0.9rem;
  margin-bottom: 10px;
  color: var(--gray-text);
}
.home-saved.hidden { display: none; }

/* ── Screen 2 — Assessment ───────────────────────────────── */
.assessment-header {
  background: var(--dark-navy);
  color: #fff;
  padding: 10px 14px 14px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.assessment-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.assessment-header-top .btn-icon {
  color: #fff;
}
.assessment-header-top .btn-icon:hover { background: rgba(255,255,255,0.1); }

.assessment-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.assessment-meta-bar h2 {
  font-size: 1rem;
  color: #fff;
}

.progress-badge {
  background: rgba(232,101,10,0.85);
  color: #fff;
  font-size: 0.72rem;
  font-weight: bold;
  padding: 4px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.assessment-info-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.info-row {
  display: flex;
  gap: 6px;
}
.info-input {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  color: #fff;
  padding: 8px 10px;
  font-size: 0.85rem;
  font-family: var(--font);
  width: 100%;
}
.info-input::placeholder { color: rgba(255,255,255,0.5); }
.info-input:focus {
  outline: none;
  border-color: var(--orange);
  background: rgba(255,255,255,0.15);
}
.info-half { flex: 1; }

.neighborhood-names {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.neighborhood-names.hidden { display: none; }

/* ── Hazard List & Categories ────────────────────────────── */
.hazard-list {
  padding: 8px 0 80px;
}

.category-section {
  margin-bottom: 4px;
}

.category-header {
  cursor: pointer;
  user-select: none;
  border-left: 5px solid transparent;
}

.cat-header-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--dark-navy);
  color: #fff;
}

.cat-badge {
  font-size: 0.72rem;
  font-weight: bold;
  color: #fff;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.cat-count {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.6);
  margin-left: auto;
  flex-shrink: 0;
}

.cat-chevron {
  width: 16px;
  height: 16px;
  stroke: rgba(255,255,255,0.6);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.category-rows {
  overflow: hidden;
}
.category-rows.collapsed {
  display: none;
}

/* ── Hazard Row ──────────────────────────────────────────── */
.hazard-row {
  background: #fff;
  border-left: 4px solid var(--gray-border);
  margin: 4px 8px;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 12px 8px;
  box-shadow: var(--shadow);
}

.hazard-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.hazard-name-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.hazard-name {
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--dark-navy);
  line-height: 1.3;
}

.desc-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  padding: 2px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.desc-toggle:hover { color: var(--orange); }
.desc-icon { width: 14px; height: 14px; }

.hazard-desc {
  font-size: 0.8rem;
  color: var(--gray-text);
  line-height: 1.5;
  margin-bottom: 10px;
  padding: 6px 8px;
  background: var(--gray-light);
  border-radius: 4px;
}
.hazard-desc.hidden { display: none; }

/* Score badge (live) */
.score-badge {
  font-size: 0.78rem;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 6px;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
  text-align: center;
  line-height: 1.2;
}
.score-badge small {
  font-size: 0.65rem;
  font-weight: normal;
  letter-spacing: 0.03em;
}
.score-badge.score-empty {
  background: var(--gray-light);
  color: #bbb;
}

/* ── Stepper Controls ────────────────────────────────────── */
.inputs-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.stepper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 100px;
}

.stepper-label {
  font-size: 0.7rem;
  color: var(--gray-text);
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stepper-controls {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--gray-light);
  border: 1px solid var(--gray-border);
  border-radius: 6px;
  overflow: hidden;
  height: 38px;
}

.stepper-btn {
  background: none;
  border: none;
  color: var(--dark-navy);
  width: 36px;
  height: 38px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0;
  transition: background 0.1s;
  flex-shrink: 0;
}
.stepper-btn:hover { background: var(--gray-border); }
.stepper-btn:active { background: #ccc; }

.stepper-value {
  flex: 1;
  text-align: center;
  font-weight: bold;
  font-size: 1rem;
  color: #bbb;
  min-width: 28px;
}
.stepper-value.has-value {
  color: var(--dark-navy);
}

/* Neighborhood sub-scores */
.inputs-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 4px;
}
.input-group-label {
  font-size: 0.72rem;
  font-weight: bold;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 0 0;
}

.sub-score {
  display: flex;
  align-items: flex-end;
  padding-bottom: 4px;
}
.mini-score {
  font-size: 0.78rem;
  font-weight: bold;
  color: var(--dark-navy);
  background: var(--gray-light);
  padding: 4px 7px;
  border-radius: 5px;
}
.mini-score.empty {
  color: #bbb;
}

/* ── Notes Field ─────────────────────────────────────────── */
.notes-row {
  margin-top: 6px;
}
.notes-input {
  width: 100%;
  border: 1px solid var(--gray-border);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.82rem;
  font-family: var(--font);
  color: var(--dark-navy);
  resize: vertical;
  min-height: 40px;
  background: #fff;
}
.notes-input:focus {
  outline: none;
  border-color: var(--orange);
}
.notes-input::placeholder { color: #bbb; }

/* ── Custom Hazard Inputs ────────────────────────────────── */
.custom-hazard-inputs {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
}
.custom-name-input, .custom-desc-input {
  background: #fff;
  border: 1.5px dashed var(--orange);
  color: var(--dark-navy);
}
.custom-name-input::placeholder,
.custom-desc-input::placeholder { color: #bbb; }
.custom-name-input:focus,
.custom-desc-input:focus {
  border-style: solid;
  border-color: var(--orange);
}

/* ── Float Results Button ────────────────────────────────── */
.float-results-btn {
  position: fixed;
  bottom: calc(var(--nav-height) + 12px);
  right: 16px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 30px;
  padding: 12px 20px;
  font-weight: bold;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(232,101,10,0.5);
  display: flex;
  align-items: center;
  gap: 7px;
  z-index: 80;
  transition: opacity 0.2s;
}
.float-results-btn.hidden { display: none; }
.float-results-btn:hover { background: #d05808; }

/* ── Screen 3 — Results ──────────────────────────────────── */
.results-header {
  background: var(--dark-navy);
  color: #fff;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}
.results-header h2 { font-size: 1rem; color: #fff; }
.results-header .btn-icon { color: #fff; }

.results-summary {
  padding: 12px 14px 0;
}

.summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-bottom: 8px;
}

.chip {
  font-size: 0.75rem;
  font-weight: bold;
  padding: 4px 11px;
  border-radius: 20px;
}
.chip-critical { background: var(--critical-bg); color: var(--critical-color); }
.chip-high     { background: var(--high-bg);     color: var(--high-color); }
.chip-medium   { background: var(--medium-bg);   color: var(--medium-color); }
.chip-low      { background: var(--low-bg);       color: var(--low-color); }
.chip-total    { background: var(--gray-light);   color: var(--gray-text); }

.results-list {
  padding: 8px 12px 20px;
}

.result-band {
  margin-bottom: 12px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.band-header {
  padding: 9px 14px;
  font-size: 0.82rem;
  font-weight: bold;
  letter-spacing: 0.02em;
}

.result-card {
  background: #fff;
  padding: 12px 14px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

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

.result-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.result-name {
  font-size: 0.92rem;
  font-weight: bold;
  color: var(--dark-navy);
  line-height: 1.3;
}

.result-cat-badge {
  font-size: 0.65rem;
  font-weight: bold;
  color: #fff;
  padding: 2px 8px;
  border-radius: 20px;
  display: inline-block;
  width: fit-content;
}

.result-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 6px 10px;
  border-radius: 8px;
  text-align: center;
  flex-shrink: 0;
}

.result-score-num {
  font-size: 1.5rem;
  font-weight: bold;
  line-height: 1;
}
.result-score-label {
  font-size: 0.62rem;
  font-weight: bold;
  letter-spacing: 0.05em;
}

.result-notes {
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--gray-text);
  display: flex;
  align-items: flex-start;
  gap: 5px;
  line-height: 1.4;
}
.note-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  margin-top: 1px;
}

.results-actions {
  padding: 0 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.results-actions button {
  width: 100%;
  justify-content: center;
}

/* ── Screen 4 — Reference Guide ──────────────────────────── */
.ref-header {
  background: var(--dark-navy);
  padding: 16px 16px;
  color: #fff;
}
.ref-header h2 { font-size: 1rem; color: #fff; }

.ref-content {
  padding: 16px;
}

.ref-content h3 {
  font-size: 0.95rem;
  color: var(--dark-navy);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--orange);
}
.ref-content h3:first-child { margin-top: 0; }

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 8px;
}
.ref-table th {
  background: var(--dark-navy);
  color: #fff;
  padding: 8px 10px;
  text-align: left;
  font-size: 0.78rem;
}
.ref-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--gray-border);
  vertical-align: top;
  line-height: 1.4;
}
.ref-table tr:nth-child(even) td { background: var(--gray-light); }
.ref-table .score-cell {
  font-weight: bold;
  color: var(--orange);
  text-align: center;
  width: 40px;
}

/* Risk Matrix */
.matrix-container {
  overflow-x: auto;
  margin-bottom: 8px;
}

.risk-matrix {
  border-collapse: collapse;
  font-size: 0.82rem;
  width: 100%;
}
.risk-matrix th {
  background: var(--dark-navy);
  color: #fff;
  padding: 8px;
  text-align: center;
  font-size: 0.78rem;
}
.matrix-corner {
  font-size: 0.65rem !important;
  opacity: 0.7;
}
.matrix-label {
  background: var(--dark-navy) !important;
  color: #fff !important;
  font-weight: bold;
  text-align: center;
}
.matrix-cell {
  text-align: center;
  padding: 10px 6px;
  font-weight: bold;
  font-size: 0.9rem;
  border: 1px solid rgba(255,255,255,0.2);
}

.matrix-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--gray-text);
  margin-top: 4px;
}

.risk-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}
.legend-item {
  font-size: 0.75rem;
  font-weight: bold;
  padding: 5px 12px;
  border-radius: 6px;
}
.legend-item.critical { background: var(--critical-bg); color: var(--critical-color); }
.legend-item.high     { background: var(--high-bg);     color: var(--high-color); }
.legend-item.medium   { background: var(--medium-bg);   color: var(--medium-color); }
.legend-item.low      { background: var(--low-bg);       color: var(--low-color); }

/* ── Screen 5 — About ────────────────────────────────────── */
.about-header {
  background: var(--dark-navy);
  padding: 24px 20px 20px;
  text-align: center;
}
.about-program {
  color: rgba(255,255,255,0.7);
  font-size: 0.88rem;
  margin-top: 6px;
  margin-bottom: 4px;
}
.about-link {
  color: var(--orange);
  font-size: 0.88rem;
}

.about-content {
  padding: 20px 16px 0;
}
.about-description {
  font-size: 0.9rem;
  color: var(--gray-text);
  line-height: 1.6;
  margin-bottom: 20px;
}

.save-export-section {
  padding: 16px;
  border-top: 1px solid var(--gray-border);
  margin-top: 8px;
}
.save-export-section h3 {
  font-size: 1rem;
  color: var(--dark-navy);
  margin-bottom: 14px;
}
.save-export-section h4 {
  font-size: 0.88rem;
  color: var(--gray-text);
  margin: 20px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.save-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.save-actions button {
  width: 100%;
  justify-content: center;
}

.saved-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.saved-item {
  background: var(--gray-light);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.saved-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.saved-item-info strong {
  font-size: 0.88rem;
  color: var(--dark-navy);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.saved-meta {
  font-size: 0.73rem;
  color: var(--gray-text);
}
.saved-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.about-version {
  padding: 16px;
  text-align: center;
  font-size: 0.72rem;
  color: #aaa;
  line-height: 1.6;
}

/* ── Misc / Shared ───────────────────────────────────────── */
.empty-state {
  color: #aaa;
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
  padding: 16px;
}

.hidden { display: none !important; }

/* ── Confirm Dialog ──────────────────────────────────────── */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.dialog-overlay.hidden { display: none; }

.dialog-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px 20px 20px;
  max-width: 340px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.dialog-box p {
  font-size: 0.95rem;
  color: var(--dark-navy);
  margin-bottom: 20px;
  line-height: 1.5;
}
.dialog-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ── Screen 6 — Research My Area ────────────────────────── */

.research-header {
  background: var(--dark-navy);
  padding: 12px 16px 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.research-header-top {
  margin-bottom: 6px;
}
.research-title {
  font-size: 1.1rem;
  color: #fff;
  margin-bottom: 4px;
}
.research-subtitle {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.7);
  line-height: 1.4;
}

.research-privacy {
  background: #EAF4FB;
  border-left: 4px solid #2E86C1;
  padding: 10px 14px;
  font-size: 0.78rem;
  color: #1A5276;
  line-height: 1.5;
}

/* ── Address Input ───────────────────────────────────────── */
.research-input-section {
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.research-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.research-input-label {
  font-size: 0.72rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gray-text);
}
.research-address-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: var(--font);
  border: 2px solid var(--gray-border);
  border-radius: var(--radius);
  color: var(--dark-navy);
  background: #fff;
  transition: border-color 0.15s;
}
.research-address-input:focus {
  outline: none;
  border-color: var(--orange);
}
.research-address-input::placeholder { color: #bbb; }

.research-input-hint {
  font-size: 0.76rem;
  color: #888;
  text-align: center;
}

.research-error-msg {
  background: #FADBD8;
  border: 1px solid #E74C3C;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #C0392B;
  line-height: 1.5;
}
.research-error-msg.hidden { display: none; }

/* ── Loading State ───────────────────────────────────────── */
.research-loading {
  padding: 20px 16px;
}
.research-steps-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.research-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--gray-light);
  border-radius: var(--radius);
  font-size: 0.85rem;
  transition: background 0.2s;
}
.research-step.step-running {
  background: #EBF5FB;
  border-left: 3px solid #2E86C1;
}
.research-step.step-success {
  background: #D5F5E3;
  border-left: 3px solid #27AE60;
}
.research-step.step-error {
  background: #FADBD8;
  border-left: 3px solid #E74C3C;
}
.step-icon {
  font-size: 1rem;
  flex-shrink: 0;
}
.step-label {
  color: var(--dark-navy);
  line-height: 1.3;
}
.research-timing {
  font-size: 0.8rem;
  color: #888;
  text-align: center;
  font-style: italic;
}

/* ── Research Results / Report ──────────────────────────── */
.research-results {
  padding: 0 0 120px;
}

.report-address-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #fff;
  padding: 14px 16px;
  border-bottom: 1px solid var(--gray-border);
}
.report-address-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  padding-top: 2px;
}
.report-address-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.report-address-info strong {
  font-size: 0.92rem;
  color: var(--dark-navy);
  line-height: 1.3;
}
.report-address-info span {
  font-size: 0.75rem;
  color: var(--gray-text);
}

.report-summary-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #EAF2FF;
  border-left: 4px solid var(--orange);
  padding: 14px 16px;
  margin: 0 0 0 0;
}
.report-summary-icon { font-size: 1.3rem; flex-shrink: 0; }
.report-summary-banner strong { font-size: 0.95rem; color: var(--dark-navy); }
.report-summary-sub { font-size: 0.78rem; color: var(--gray-text); }

.report-aq-note {
  background: #FEF9E7;
  border-left: 3px solid #F39C12;
  padding: 10px 16px;
  font-size: 0.8rem;
  color: #7D6608;
  line-height: 1.5;
}

.report-section-heading {
  font-size: 0.88rem;
  font-weight: bold;
  color: var(--dark-navy);
  padding: 14px 16px 8px;
  border-top: 1px solid var(--gray-border);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Category group in report */
.report-category-group {
  margin-bottom: 4px;
}
.report-cat-label {
  font-size: 0.7rem;
  font-weight: bold;
  color: #fff;
  padding: 4px 14px;
  letter-spacing: 0.03em;
}

/* Individual finding card */
.finding-card {
  background: #fff;
  border-left: 4px solid var(--orange);
  margin: 4px 8px;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 12px 10px;
  box-shadow: var(--shadow);
}

.finding-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.finding-left {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.finding-name {
  font-size: 0.9rem;
  font-weight: bold;
  color: var(--dark-navy);
  line-height: 1.3;
}

.finding-cat-badge {
  font-size: 0.63rem;
  font-weight: bold;
  color: #fff;
  padding: 2px 7px;
  border-radius: 20px;
  display: inline-block;
  width: fit-content;
}

/* 🔍 AUTO-SCORED badge */
.auto-scored-badge {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  font-size: 0.62rem;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  width: fit-content;
}

/* 🔍 badge on assessment hazard rows */
.auto-score-badge {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  font-size: 0.6rem;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: 20px;
  margin-left: 4px;
  vertical-align: middle;
  white-space: nowrap;
}

.override-badge {
  display: inline-block;
  background: #9B59B6;
  color: #fff;
  font-size: 0.62rem;
  font-weight: bold;
  padding: 2px 8px;
  border-radius: 20px;
  width: fit-content;
}

/* Score box on finding cards */
.finding-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 6px 8px;
  border-radius: 8px;
  text-align: center;
  flex-shrink: 0;
}
.finding-score-num {
  font-size: 1.4rem;
  font-weight: bold;
  line-height: 1;
}
.finding-score-label {
  font-size: 0.58rem;
  font-weight: bold;
  letter-spacing: 0.05em;
  line-height: 1.2;
}

/* Detail rows */
.finding-details {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--gray-light);
  border-radius: 6px;
  font-size: 0.78rem;
}
.finding-detail-row {
  display: flex;
  gap: 6px;
  line-height: 1.4;
  flex-wrap: wrap;
}
.finding-detail-key {
  font-weight: bold;
  color: var(--dark-navy);
  flex-shrink: 0;
  min-width: 68px;
}
.confidence-high   { color: #27AE60; font-weight: bold; }
.confidence-medium { color: #E67E22; font-weight: bold; }
.confidence-low    { color: #E74C3C; font-weight: bold; }
.confidence-n\/a   { color: #aaa; }

.finding-error {
  display: block;
  font-size: 0.8rem;
  color: #C0392B;
  padding: 6px 0;
}

.finding-override-btn {
  font-size: 0.75rem;
  padding: 5px 12px;
}

/* Override UI (inline) */
.override-ui {
  margin-top: 10px;
  padding: 10px;
  background: #f9f0ff;
  border: 1px solid #d7bde2;
  border-radius: 6px;
}
.override-label {
  font-size: 0.78rem;
  font-weight: bold;
  color: var(--dark-navy);
  margin-bottom: 8px;
}
.override-choices {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.override-score-btn {
  background: var(--gray-light);
  border: 2px solid var(--gray-border);
  border-radius: 6px;
  width: 38px;
  height: 38px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  color: var(--dark-navy);
  transition: background 0.1s, border-color 0.1s;
}
.override-score-btn.selected {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}
.override-score-btn:hover { border-color: var(--orange); }
.override-revert-btn {
  background: none;
  border: none;
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: bold;
  cursor: pointer;
  padding: 4px 8px;
  text-decoration: underline;
}

/* ── Unavailable / Failed APIs ───────────────────────────── */
.report-unavailable {
  margin: 8px 16px;
  padding: 12px 14px;
  background: #FEF9E7;
  border: 1px solid #F9E79F;
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: #7D6608;
}
.report-unavailable ul {
  margin: 6px 0 0 16px;
  line-height: 1.8;
}

/* ── Manual Hazards Section ──────────────────────────────── */
.report-manual-intro {
  font-size: 0.8rem;
  color: var(--gray-text);
  padding: 0 16px 8px;
}
.report-manual-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 8px;
}
.report-manual-item {
  background: var(--gray-light);
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.report-manual-item strong {
  font-size: 0.84rem;
  color: var(--dark-navy);
}
.report-manual-item span {
  font-size: 0.75rem;
  color: var(--gray-text);
  line-height: 1.4;
}

/* ── Report Action Buttons ───────────────────────────────── */
.report-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 16px 24px;
  border-top: 1px solid var(--gray-border);
  margin-top: 16px;
}
.report-actions button {
  width: 100%;
  justify-content: center;
}

/* ── Research Report Link (assessment screen) ────────────── */
.research-report-link {
  background: #EAF4FB;
  border-bottom: 1px solid #AED6F1;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--gray-text);
  flex-wrap: wrap;
}

/* ── Auto-score Banner (assessment screen) ───────────────── */
.auto-score-banner {
  background: #EAF2FF;
  border-bottom: 2px solid var(--orange);
  padding: 0;
}
.auto-score-banner-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--dark-navy);
  flex-wrap: wrap;
}
.auto-score-banner-inner strong { color: var(--orange); }
.auto-score-banner-close {
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
  margin-left: auto;
  font-size: 14px;
  padding: 4px 6px;
  flex-shrink: 0;
}

/* ── Auto-scored tag on Results screen ───────────────────── */
.result-source-tag {
  font-size: 0.62rem;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: 10px;
  white-space: nowrap;
  display: inline-block;
}
.result-source-tag.auto {
  background: var(--orange);
  color: #fff;
}
.result-source-tag.manual {
  background: var(--gray-light);
  color: var(--gray-text);
  border: 1px solid var(--gray-border);
}

/* ── Scrollbar (webkit) ──────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* ============================================================
   RESPONSIVE — wider screens
============================================================ */

@media (min-width: 480px) {
  .home-buttons {
    flex-direction: row;
    justify-content: center;
  }
  .btn-large {
    width: auto;
    flex: 1;
    max-width: 240px;
  }
  .inputs-row {
    flex-wrap: nowrap;
  }
}

@media (min-width: 640px) {
  /* Center the app on larger screens */
  body { background: #F0F0F0; }
  #app {
    border-left: 1px solid var(--gray-border);
    border-right: 1px solid var(--gray-border);
    box-shadow: 0 0 24px rgba(0,0,0,0.08);
    background: #fff;
  }
  .bottom-nav {
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 640px;
  }
}

/* ============================================================
   PRINT STYLESHEET — for PDF export of results
============================================================ */

@media print {
  /* Hide everything except results */
  .install-banner,
  .bottom-nav,
  .assessment-header,
  .float-results-btn,
  .results-header .btn-icon,
  .results-actions,
  #screen-home,
  #screen-assessment,
  #screen-reference,
  #screen-about,
  #screen-research,
  #confirm-dialog,
  .auto-score-banner,
  .research-report-link {
    display: none !important;
  }

  body {
    background: #fff;
    font-size: 11pt;
    color: #000;
    margin: 0;
    padding: 0;
  }

  #app {
    max-width: 100%;
    padding: 0;
    margin: 0;
    box-shadow: none;
    border: none;
  }

  /* Force results screen visible */
  #screen-results {
    display: block !important;
  }

  /* Print header */
  .results-header {
    background: #fff;
    color: #000;
    border-bottom: 2px solid #E8650A;
    padding: 8px 0 6px;
    position: static;
    page-break-after: avoid;
  }
  .results-header h2 {
    color: #000;
    font-size: 14pt;
  }

  .results-summary {
    padding: 8px 0 4px;
  }

  .results-list {
    padding: 0;
  }

  .result-band {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
    margin-bottom: 10px;
  }

  .result-card {
    page-break-inside: avoid;
  }

  .result-cat-badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .band-header,
  .result-score,
  .chip {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Print footer */
  .results-list::after {
    content: "World Aware Risk Assessment · beworldaware.com";
    display: block;
    text-align: center;
    font-size: 9pt;
    color: #888;
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
  }

  @page {
    margin: 1.5cm;
  }
}

/* =============================================================
   MANUAL LOOKUP CARDS (Research My Area)
   ============================================================= */

.manual-lookup-card {
  background: #1e1e38;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
}

.manual-lookup-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.manual-lookup-title {
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
  margin: 0;
}

.manual-lookup-badge {
  display: inline-block;
  background: #f59e0b;
  color: #1a1a2e;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  white-space: nowrap;
}

.manual-lookup-message {
  font-size: 0.85rem;
  color: #94a3b8;
  margin: 0 0 12px;
  line-height: 1.5;
}

.manual-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f59e0b;
  color: #1a1a2e;
  font-weight: 700;
  font-size: 0.875rem;
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  margin-bottom: 6px;
  transition: background 0.15s;
}

.manual-action-btn:hover {
  background: #fbbf24;
  color: #1a1a2e;
}

.manual-action-note {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 12px;
}

.manual-instructions {
  font-size: 0.82rem;
  color: #94a3b8;
  padding-left: 18px;
  margin: 0 0 14px;
  line-height: 1.7;
}

.manual-instructions li {
  margin-bottom: 4px;
}

.manual-score-entry {
  border-top: 1px solid #2d2d52;
  padding-top: 12px;
}

.manual-score-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.manual-score-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.manual-score-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid #3d3d6e;
  background: #16213e;
  color: #cbd5e1;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.manual-score-btn:hover {
  border-color: #f59e0b;
  color: #f59e0b;
}

.manual-score-btn.selected {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #1a1a2e;
}

.manual-score-confirm {
  font-size: 0.8rem;
  color: #4ade80;
  font-weight: 600;
}

.manual-score-confirm.hidden {
  display: none;
}
