/* style.css — look and feel for the START Triage Trainer. */

:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #616e7c;
  --line: #e4e7eb;
  --accent: #1d4ed8;
  --accent-dark: #1e40af;

  --green: #15803d;
  --yellow: #facc15;
  --red: #dc2626;
  --black: #111827;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}

.app {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px;
}

h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 1.35rem; margin: 0 0 8px; }

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 24px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.facts {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.facts li {
  background: var(--bg);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.9rem;
}

button { font: inherit; cursor: pointer; }

.btn-primary {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
}
.btn-primary:hover { background: var(--accent-dark); }

button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

.btn-again { margin-bottom: 8px; }
.review-title { margin-top: 28px; }
.again-hint { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }

/* Gentle fade when a screen or card appears */
.screen:not([hidden]) { animation: fade-in 0.25s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.patient.enter { animation: fade-in 0.2s ease-out; }
@media (prefers-reduced-motion: reduce) { .screen:not([hidden]), .patient.enter { animation: none; } }

/* Drill screen */
.drill-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.counter { font-weight: 700; color: var(--muted); font-size: 1.1rem; }
.timer {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 1.75rem;
  padding: 2px 10px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
}
.timer.warning { background: #fee2e2; color: var(--red); }

.patient { min-height: 180px; }
.narrative { font-size: 1.25rem; margin: 0; }

.triage-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.triage {
  min-height: 72px;
  border: 0;
  border-radius: var(--radius);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
}
.triage:active { transform: scale(0.97); }
.triage:hover { filter: brightness(1.08); }
.triage { transition: transform 0.08s, filter 0.15s; -webkit-tap-highlight-color: transparent; }
.triage.GREEN { background: var(--green); }
.triage.YELLOW { background: var(--yellow); color: var(--text); }
.triage.RED { background: var(--red); }
.triage.BLACK { background: var(--black); }

/* Results screen */
.score-card { text-align: center; }
.score { display: flex; justify-content: center; align-items: baseline; gap: 8px; }
.score-big { font-size: 3.5rem; font-weight: 800; line-height: 1; }
.score-of { font-size: 1.2rem; color: var(--muted); }
.time-used { margin: 8px 0 0; color: var(--muted); }
.time-used strong { color: var(--text); font-variant-numeric: tabular-nums; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat[hidden] { display: none; }
.stat-num { font-size: 2rem; font-weight: 800; line-height: 1.1; }
.stat-label { font-weight: 700; }
.stat-hint { font-size: 0.85rem; color: var(--muted); }

/* Mistakes review */
.review-intro { color: var(--muted); margin: 0 0 16px; }
.review-item { border-left: 6px solid var(--line); }
.review-item.under { border-left-color: var(--red); }
.review-item.over { border-left-color: #f59e0b; }
.review-item.untriaged { border-left-color: var(--muted); }

.review-head { margin-bottom: 8px; }
.outcome-tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg);
}
.outcome-tag.under { background: #fee2e2; color: #991b1b; }
.outcome-tag.over { background: #fef3c7; color: #92400e; }

.review-narrative { margin: 0 0 12px; font-size: 1.05rem; }

.review-answers {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  align-items: center;
  margin: 0 0 12px;
}
.review-answers dt { color: var(--muted); font-size: 0.9rem; }
.review-answers dd { margin: 0; font-weight: 600; }

.badge {
  display: inline-block;
  min-width: 72px;
  text-align: center;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #fff;
}
.badge.GREEN { background: var(--green); }
.badge.YELLOW { background: var(--yellow); color: var(--text); }
.badge.RED { background: var(--red); }
.badge.BLACK { background: var(--black); }
.badge.NONE { background: var(--line); color: var(--muted); }

.review-explanation {
  margin: 0;
  padding: 12px 14px;
  background: #eff6ff;
  border-radius: 8px;
  font-weight: 600;
}
.review-note { margin: 12px 0 0; font-size: 0.95rem; color: var(--muted); }
.review-note strong { color: var(--text); }

/* Wider screens: buttons in one row, a bit more room */
@media (min-width: 720px) {
  .app { padding: 48px 24px; }
  h1 { font-size: 2.4rem; }
  .triage-buttons { grid-template-columns: repeat(4, 1fr); }
  .triage { min-height: 88px; }
  .patient { min-height: 220px; padding: 28px; }
  .narrative { font-size: 1.4rem; }
}

.footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  padding: 16px;
  border-top: 1px solid var(--line);
}
