:root {
  color-scheme: dark;
  --bg: #0a0e17;
  --panel: #11172a;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f2f4f8;
  --muted: #8b93a1;
  --accent: #e53e3e;
  --accent-dim: rgba(229, 62, 62, 0.15);
  --green: #38a169;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}

.wrap { width: 100%; max-width: 720px; position: relative; z-index: 1; }

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 2s ease-in-out;
}
.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(10, 14, 23, 0.82);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 16px;
}

h1 { font-size: 26px; margin: 0 0 8px; }
h2 { font-size: 18px; margin: 0 0 12px; }
p { line-height: 1.6; color: var(--text); }

.muted { color: var(--muted); font-size: 14px; }

.notice {
  background: rgba(229, 62, 62, 0.1);
  border: 1px solid rgba(229, 62, 62, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 14px;
  margin: 16px 0;
}

.rules { padding-left: 20px; }
.rules li { margin-bottom: 10px; line-height: 1.5; }

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }

.timer {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 16px;
  font-variant-numeric: tabular-nums;
}
.timer.warning { border-color: var(--accent); color: var(--accent); }
.timer-value { font-size: 20px; font-weight: 700; }

.progress { font-size: 13px; color: var(--muted); margin-bottom: 10px; }

.question-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.question-header-row .progress { margin-bottom: 0; }

.mark-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
}
.mark-btn.active { background: rgba(229, 62, 62, 0.15); border-color: var(--accent); color: var(--accent); }

.nav-bar-panel { padding: 16px; }
.nav-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.nav-dot {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.nav-dot.answered { border-color: var(--green); color: var(--green); }
.nav-dot.marked { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.nav-dot.current { background: var(--accent); border-color: var(--accent); color: #fff; }

textarea, input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 12px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
}
textarea { min-height: 160px; }

.options { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
}
.option-row input { width: 16px; height: 16px; }

.nav-row {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
}

.hidden { display: none !important; }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 24px; max-width: 420px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }

.status-passed { color: var(--green); }
.status-failed, .status-expired { color: var(--accent); }
