/* ============ RESET / BASE ============ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f4f5f7;
  color: #1f2330;
  -webkit-user-select: none;
  user-select: none;
}
input, textarea { user-select: text; -webkit-user-select: text; }

h1, h2, h3 { color: #1f2330; }

/* ============ SCREEN SWITCHING ============ */
.screen { display: none; }
.screen.active { display: block; }

#screen-test.active { display: flex; flex-direction: column; height: 100vh; }
#screen-welcome.active, #screen-end.active {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
}

/* ============ WELCOME ============ */
.welcome-card, .end-card {
  background: white; max-width: 720px; width: 100%;
  padding: 36px 40px; border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.08);
}
.welcome-card h1 { margin: 0 0 4px; font-size: 32px; }
.welcome-card h2 { margin: 0 0 24px; font-weight: 400; color: #5b6478; font-size: 18px; }
.lead { font-size: 17px; }
.rules {
  background: #fff8e6; border: 1px solid #f1d77a;
  border-radius: 10px; padding: 16px 20px; margin: 20px 0;
}
.rules h3 { margin-top: 0; }
.rules ul { margin: 0; padding-left: 20px; }
.rules li { margin: 6px 0; }

.field { display: block; margin: 20px 0 12px; font-weight: 500; }
.field input {
  display: block; width: 100%; margin-top: 6px;
  padding: 12px 14px; font-size: 16px;
  border: 1px solid #c8ccd6; border-radius: 8px;
}
.consent { font-size: 13px; color: #5b6478; margin: 16px 0 20px; }

.primary {
  background: #2b6cff; color: white; border: 0;
  padding: 12px 24px; font-size: 16px; font-weight: 600;
  border-radius: 8px; cursor: pointer;
}
.primary:hover { background: #1f56d8; }
.primary:disabled { background: #9aa5b8; cursor: not-allowed; }

.secondary {
  background: #eef0f5; color: #1f2330; border: 0;
  padding: 12px 24px; font-size: 16px; font-weight: 600;
  border-radius: 8px; cursor: pointer;
}
.secondary:hover { background: #dde1ea; }

.error { color: #c0392b; margin-top: 12px; }

/* ============ TOP BAR (test screen) ============ */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 18px; background: #1f2330; color: white;
  border-bottom: 2px solid #0e1018;
  flex-shrink: 0;
}
.topbar-left { display: flex; gap: 18px; align-items: baseline; }
.topbar-left span { color: #c8ccd6; font-size: 14px; }
.topbar-right { display: flex; gap: 14px; align-items: center; }

.timer {
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 22px; font-weight: 700;
  background: #0e1018; padding: 6px 14px; border-radius: 6px;
  letter-spacing: 1px;
}
.timer.warning { background: #c44; }
.timer.critical { background: #c0392b; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.rec-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: #e63946; box-shadow: 0 0 0 0 rgba(230,57,70,.7);
  animation: rec-pulse 1.6s infinite;
}
@keyframes rec-pulse {
  0% { box-shadow: 0 0 0 0 rgba(230,57,70,.7); }
  70% { box-shadow: 0 0 0 12px rgba(230,57,70,0); }
  100% { box-shadow: 0 0 0 0 rgba(230,57,70,0); }
}

/* ============ LAYOUT (article + questions) ============ */
.layout {
  flex: 1; display: grid; grid-template-columns: 1fr 1fr;
  gap: 0; overflow: hidden;
}
.article, .questions {
  overflow-y: auto; padding: 24px 32px; height: 100%;
}
.article {
  background: #fafbfc; border-right: 1px solid #d8dce3;
  font-size: 18px; line-height: 1.7;
}
.article h2 { margin-top: 0; font-size: 24px; }
.article .byline { color: #5b6478; margin-top: -8px; font-size: 16px; }
.article p { margin: 14px 0; }

.questions { background: white; padding: 28px 36px; }
.questions h2 {
  margin-top: 0; margin-bottom: 20px;
  font-size: 24px;
}
.questions fieldset {
  border: 1px solid #e1e4eb; border-radius: 10px;
  padding: 18px 22px; margin: 0 0 20px;
}
.questions legend {
  padding: 0 10px; font-weight: 600; font-size: 17px;
  color: #1f2330; line-height: 1.4;
}
.questions textarea, .questions input[type="text"] {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 1px solid #c8ccd6; border-radius: 8px;
  font-family: inherit; resize: vertical;
  line-height: 1.5;
}
.questions textarea:focus, .questions input:focus {
  outline: 2px solid #2b6cff; outline-offset: -1px; border-color: #2b6cff;
}
.questions label {
  display: block; margin: 12px 0; font-size: 16px;
}
.questions label input { margin-top: 6px; }

.exercise-title {
  margin-top: 40px; padding-top: 24px;
  border-top: 2px solid #1f2330;
  font-size: 24px;
}
.exercise-instruction {
  font-style: italic; color: #1f2330;
  margin: 0 0 18px; font-size: 16px;
}
.reported .quote {
  margin: 0 0 12px; padding: 12px 16px;
  background: #f4f5f7; border-left: 4px solid #2b6cff;
  font-style: italic; font-size: 16px; line-height: 1.5;
}

/* ============ INCIDENT OVERLAY ============ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(15, 17, 25, .93);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
}
.overlay[hidden] { display: none; }
.overlay-card {
  background: white; max-width: 520px; padding: 32px 36px;
  border-radius: 14px; text-align: center;
}
.overlay-card h2 { color: #c0392b; margin-top: 0; }
#confirm-overlay .overlay-card h2 { color: #1f2330; }

.overlay-actions {
  display: flex; gap: 12px; justify-content: center;
  margin-top: 20px;
}

.end-card.locked h1 { color: #c98a00; }

/* ============ END SCREEN ============ */
.end-card { text-align: center; }
.end-card h1 { font-size: 32px; color: #1c8a4a; }
.end-card.error h1 { color: #c0392b; }
.muted { color: #5b6478; font-size: 14px; }
