:root {
  /* ---- Brand placeholders: swap these for your org's colors ---- */
  --brand-primary: #0f172a;
  --brand-secondary: #2563eb;
  --brand-accent: #38bdf8;

  --success: #16a34a;
  --danger: #dc2626;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--brand-primary);
  color: #fff;
}

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

.logo {
  height: 32px;
  width: auto;
}

.brand-title {
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.timer-pill {
  font-variant-numeric: tabular-nums;
  font-size: 1.3rem;
  font-weight: 700;
  padding: 6px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.timer-pill.warning {
  background: var(--danger);
  border-color: var(--danger);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.stage {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px;
  min-height: calc(100vh - 62px);
}

.screen {
  display: none;
  width: 100%;
  max-width: 640px;
}

.screen.active {
  display: block;
}

#screen-room.active {
  max-width: 980px;
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

h1 { margin-top: 0; }
h1.success { color: var(--success); }
h1.fail { color: var(--danger); }

.door-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-secondary);
  margin-bottom: 8px;
}

.scenario {
  background: #f8fafc;
  border-left: 4px solid var(--brand-secondary);
  padding: 14px 16px;
  border-radius: 6px;
  margin: 16px 0;
  font-size: 0.95rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}

.choice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.choice:hover {
  border-color: var(--brand-secondary);
  background: #f8fafc;
}

.choice input {
  accent-color: var(--brand-secondary);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.field input {
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
}

.btn {
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn.primary {
  background: var(--brand-secondary);
  color: #fff;
}

.btn.primary:hover { opacity: 0.92; }

.btn.ghost {
  background: transparent;
  color: var(--brand-secondary);
  border: 1px solid var(--brand-secondary);
}

.submit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.feedback {
  min-height: 24px;
  font-weight: 600;
  margin-top: 4px;
}

.feedback.correct { color: var(--success); }
.feedback.incorrect { color: var(--danger); }

.summary {
  background: #f8fafc;
  border-radius: 10px;
  padding: 16px;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 8px;
}

.sync-status {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ================= ROOM SCENE ================= */

.objective {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.strikes-display {
  text-align: center;
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 12px;
}

.room-alert {
  display: none;
  background: var(--danger);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 14px;
}

.room-alert.visible {
  display: block;
}

.room-scene {
  position: relative;
  width: 100%;
  /* Locks the box to the office.jpg aspect ratio (960x617) so the
     percentage-based zone coordinates below always line up. */
  padding-top: 64.27%;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  background: #0f172a;
}

.room-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.zone {
  position: absolute;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.zone:hover {
  background: rgba(56, 189, 248, 0.22);
  border-color: var(--brand-accent);
}

.zone.solved {
  border-color: var(--success);
  background: rgba(22, 163, 74, 0.12);
}

.zone.info-zone:hover {
  background: rgba(245, 158, 11, 0.22);
  border-color: #f59e0b;
}

.zone-label {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

.zone:hover .zone-label {
  opacity: 1;
}

.zone-check {
  display: none;
  position: absolute;
  top: -10px;
  right: -10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 0.75rem;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.zone.solved .zone-check {
  display: flex;
}

.room-door {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--brand-primary), #1e293b);
  color: #fff;
  cursor: pointer;
  transition: filter 0.15s;
}

.room-door:hover {
  filter: brightness(1.15);
}

.door-icon {
  font-size: 2.4rem;
}

.door-text {
  flex: 1;
}

.door-label {
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  margin-bottom: 2px;
}

.door-hint {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.75);
}

.door-code {
  display: flex;
  gap: 5px;
}

.door-code .digit {
  width: 26px;
  height: 32px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1rem;
}

.door-code .digit.filled {
  background: var(--brand-accent);
  color: #0f172a;
  border-color: var(--brand-accent);
}

/* ================= MODALS ================= */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  position: relative;
  background: var(--card-bg);
  border-radius: 16px;
  padding: 32px;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
}

@media (max-width: 560px) {
  .room-door {
    flex-wrap: wrap;
  }

  .zone-label {
    font-size: 0.68rem;
    padding: 2px 7px;
  }
}
