:root {
  --color-bg:         #0f0e0c;
  --color-surface:    #1c1a17;
  --color-surface-2:  #252219;
  --color-gold:       #b5935a;
  --color-gold-light: #caa87a;
  --color-text:       #f0ece4;
  --color-text-muted: #8a8070;
  --color-border:     #2e2b24;
  --color-success:    #4a9b6f;
  --color-error:      #c0392b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

body {
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

a {
  color: var(--color-gold);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: var(--color-gold-light); }

h1, h2, h3 {
  font-weight: 400;
  letter-spacing: 0.01em;
  margin: 0 0 16px;
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }

p { line-height: 1.6; margin: 0 0 16px; color: var(--color-text); }

.muted { color: var(--color-text-muted); }
.gold  { color: var(--color-gold); }

/* ─── Header ───────────────────────────────────────── */
header.site-header {
  padding: 32px 24px 16px;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}

.logo {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
}

.logo-r {
  color: var(--color-gold);
  font-weight: 700;
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.logo-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.logo-name {
  color: var(--color-text);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.logo-sub {
  color: var(--color-text-muted);
  font-size: 11px;
  letter-spacing: 0.25em;
  margin-top: 4px;
}

.tagline {
  color: var(--color-text-muted);
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.06em;
  margin: 12px 0 0;
}

/* ─── Cards / Layout ───────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 40px 32px;
}

.center { text-align: center; }

.stack > * + * { margin-top: 16px; }

/* ─── Buttons ──────────────────────────────────────── */
.btn-primary,
.btn-secondary {
  display: inline-block;
  border: none;
  padding: 12px 32px;
  font-family: inherit;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-gold);
  color: var(--color-bg);
}
.btn-primary:hover:not(:disabled) { background: var(--color-gold-light); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--color-gold);
  border: 1px solid var(--color-gold);
}
.btn-secondary:hover { background: rgba(181, 147, 90, 0.08); }

/* ─── Inputs ───────────────────────────────────────── */
input[type="email"],
input[type="text"] {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 12px 16px;
  border-radius: 4px;
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.2s;
}
input[type="email"]:focus,
input[type="text"]:focus {
  border-color: var(--color-gold);
  outline: none;
}

label {
  display: block;
  color: var(--color-text-muted);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

/* ─── Alerts ───────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 20px;
  font-size: 14px;
}
.alert-error {
  background: rgba(192, 57, 43, 0.12);
  border: 1px solid rgba(192, 57, 43, 0.35);
  color: #e89489;
}

/* ─── Quiz ─────────────────────────────────────────── */
.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  color: var(--color-text-muted);
  font-size: 13px;
  letter-spacing: 0.05em;
}

.quiz-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 32px;
}

.timer-track {
  width: 100%;
  height: 3px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 24px;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: var(--color-gold);
  border-radius: 2px;
  transition: width 1s linear, background 0.2s;
}
.timer-bar.warning { background: var(--color-error); }

.question-text {
  font-size: 18px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--color-text);
  margin: 0 0 24px;
}

.options {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  margin-bottom: 10px;
  cursor: pointer;
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}
.option:hover  { background: var(--color-surface-2); }
.option.selected {
  border-color: var(--color-gold);
  background: rgba(181, 147, 90, 0.08);
}
.option.correct {
  border-color: var(--color-success);
  background: rgba(74, 155, 111, 0.14);
}
.option.correct .option-label { color: var(--color-success); }
.option.wrong {
  border-color: var(--color-error);
  background: rgba(192, 57, 43, 0.14);
}
.option.wrong .option-label { color: #e89489; }
.option.locked { cursor: default; }
.option.locked:hover { background: transparent; }
.option.locked.correct:hover { background: rgba(74, 155, 111, 0.14); }
.option.locked.wrong:hover   { background: rgba(192, 57, 43, 0.14); }

.option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: var(--color-bg);
  cursor: pointer;
  margin: 1px 0 0;
  flex-shrink: 0;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
}
.option input[type="checkbox"]:checked {
  background: var(--color-gold);
  border-color: var(--color-gold);
}
.option input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--color-bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.option-label {
  flex: 1;
  line-height: 1.5;
  color: var(--color-text);
}

.quiz-actions {
  display: flex;
  justify-content: flex-end;
}

/* ─── Modal ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 40px 32px;
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(192, 57, 43, 0.15);
  color: var(--color-error);
  font-size: 28px;
  font-weight: 600;
  margin: 0 auto 20px;
}

.modal h2 {
  color: var(--color-error);
  margin-bottom: 12px;
}

.modal p {
  color: var(--color-text-muted);
  font-size: 14px;
  margin-bottom: 8px;
}

.modal .countdown {
  color: var(--color-gold);
  font-size: 32px;
  font-weight: 400;
  margin: 20px 0 0;
  letter-spacing: 0.05em;
}

/* ─── Pass/Fail Pages ──────────────────────────────── */
.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  font-size: 42px;
  font-weight: 600;
  margin: 0 auto 24px;
}
.status-icon.success {
  background: rgba(74, 155, 111, 0.15);
  color: var(--color-success);
}
.status-icon.envelope {
  background: rgba(181, 147, 90, 0.12);
  color: var(--color-gold);
  font-size: 36px;
}

/* ─── Footer ───────────────────────────────────────── */
footer.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--color-text-muted);
  font-size: 12px;
  border-top: 1px solid var(--color-border);
  letter-spacing: 0.04em;
}

/* ─── Utilities ────────────────────────────────────── */
.hidden { display: none !important; }

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 520px) {
  main { padding: 24px 16px 48px; }
  .card, .quiz-card { padding: 24px 20px; }
  h1 { font-size: 24px; }
  .question-text { font-size: 16px; }
}
