/* ==========================================================
   KALKULATOR KECEMASAN — Design Tokens
   Palette: instrument-panel calm — sage / ochre / brick on soft paper
   Type: Fraunces (display) + Inter (body) + IBM Plex Mono (data)
   ========================================================== */

:root {
  --ink:        #16241F;
  --ink-soft:   #48564D;
  --paper:      #EDF0E6;
  --card:       #FAFAF4;
  --line:       #D9DCCE;

  --sage:       #5B7F66;
  --sage-soft:  #DCE7DD;
  --ochre:      #C08A2E;
  --ochre-soft: #F1E3C6;
  --brick:      #B14A32;
  --brick-soft: #F3DAD2;

  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --font-display: "Fraunces", serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 90px;
}

/* ---------- HEADER ---------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-mark {
  color: var(--sage);
  display: flex;
}

.brand-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
}

.step-indicator {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------- MAIN / SCREENS ---------- */
.app-main {
  flex: 1;
  padding: 0 16px;
}

.screen { display: none; }
.screen.active { display: block; animation: fadeUp 0.35s ease; }

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px 20px 28px;
}

/* ---------- TYPOGRAPHY ---------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sage);
  margin: 0 0 10px;
}

.display-lg {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1.2;
  font-weight: 600;
  margin: 0 0 14px;
}

.display-md {
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.25;
  font-weight: 600;
  margin: 0 0 10px;
}

.body-text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.body-text.small { font-size: 13.5px; }

/* ---------- INTRO ---------- */
.notice-box {
  background: var(--sage-soft);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 22px;
}
.notice-box strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 4px;
}
.notice-box p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ---------- BUTTONS ---------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14.5px;
  border: none;
  border-radius: 999px;
  padding: 14px 20px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-full { width: 100%; }

.btn-primary { background: var(--ink); color: var(--card); }
.btn-secondary { background: var(--sage); color: #fff; }
.btn-outline { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-alert { background: var(--brick); color: #fff; }
.btn-small { padding: 9px 14px; font-size: 13px; }

.btn-row { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }

/* ---------- ASSESSMENT ---------- */
.progress-track {
  height: 5px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-fill {
  height: 100%;
  background: var(--sage);
  width: 0%;
  transition: width 0.3s ease;
}

.question-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0 0 6px;
}

.dim-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--sage);
  background: var(--sage-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.question-text {
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.4;
  font-weight: 500;
  margin: 0 0 22px;
}

.likert {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.likert-btn {
  font-family: var(--font-body);
  font-size: 14.5px;
  text-align: left;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s ease;
}
.likert-btn:hover { border-color: var(--sage); background: var(--sage-soft); }
.likert-btn:active { transform: scale(0.98); }

/* ---------- RESULTS / GAUGES ---------- */
.crisis-banner {
  background: var(--brick-soft);
  border: 1px solid var(--brick);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}
.crisis-banner p { margin: 0 0 12px; font-size: 13.5px; line-height: 1.55; color: var(--ink); }
.crisis-actions { display: flex; flex-direction: column; gap: 8px; }

.gauge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 20px 0 8px;
}

.gauge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.gauge-ring {
  position: relative;
  width: 108px;
  height: 108px;
}
.gauge-svg { position: absolute; top: 0; left: 0; }
.gauge-track { fill: none; stroke: var(--line); stroke-width: 10; }
.gauge-fill { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.8s ease, stroke 0.4s ease; }

.gauge-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
}
.gauge-label {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 10px;
  line-height: 1.3;
  max-width: 108px;
}
.gauge-category {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* ---------- SCRIPTS ---------- */
.target-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.chip {
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
}
.chip.active { background: var(--ink); color: var(--card); border-color: var(--ink); }

.script-output {
  background: var(--sage-soft);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 8px;
}
.script-text {
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.5;
  font-style: italic;
  color: var(--ink);
  margin: 0 0 14px;
}

/* ---------- CALCULATOR ---------- */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 15px;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--card);
  color: var(--ink);
}
.field input:focus { outline: 2px solid var(--sage); border-color: var(--sage); }

.calc-result {
  margin-top: 18px;
  padding: 16px;
  background: var(--ochre-soft);
  border-radius: var(--radius-md);
}
.calc-result h4 { margin: 0 0 8px; font-family: var(--font-mono); font-size: 24px; }
.calc-result p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink); }

/* ---------- WEEKLY PLAN ---------- */
.action-list {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.action-list li {
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  gap: 10px;
}
.action-list li::before {
  content: "○";
  color: var(--sage);
  font-weight: 700;
  flex-shrink: 0;
}

.saved-note { color: var(--sage); font-weight: 600; margin-top: 12px; text-align: center; }

.grounding-list {
  margin: 0 0 16px;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
}

/* ---------- PANIC BUTTON & MODAL ---------- */
.panic-btn {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 448px;
  width: calc(100% - 32px);
  background: var(--brick);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14.5px;
  border: none;
  border-radius: 999px;
  padding: 15px;
  box-shadow: 0 8px 24px rgba(177, 74, 50, 0.35);
  cursor: pointer;
  z-index: 50;
}
.panic-btn:active { transform: translateX(-50%) scale(0.97); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(22, 36, 31, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
}
.modal-overlay[hidden] {
  display: none;
}
.modal-card {
  background: var(--card);
  width: 100%;
  max-width: 480px;
  border-radius: 24px 24px 0 0;
  padding: 26px 22px 30px;
  max-height: 88vh;
  overflow-y: auto;
}
.modal-card h3 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 8px;
}
.modal-actions { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }

/* ---------- RESPONSIVE ---------- */
@media (min-width: 400px) {
  .likert { flex-direction: row; flex-wrap: wrap; }
  .likert-btn { flex: 1 1 calc(50% - 5px); text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
