
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #020617;
  --bg-alt: #020617;
  --accent: #6366f1;
  --accent-soft: rgba(99,102,241,0.22);
  --accent-strong: #4f46e5;
  --accent-muted: rgba(59,130,246,0.35);
  --text-main: #e5e7eb;
  --text-soft: #9ca3af;
  --danger: #f97373;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(56,189,248,0.18), transparent 55%),
    radial-gradient(circle at 100% 0%, rgba(129,140,248,0.16), transparent 55%),
    radial-gradient(circle at 0% 100%, rgba(52,211,153,0.12), transparent 55%),
    linear-gradient(145deg, #020617 0%, #020617 50%, #020617 100%);
  color: var(--text-main);
  min-height: 100vh;
}

body.bg {
  background: #f3f4f6;
  color: #0f172a;
}

main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card-large {
  background: linear-gradient(135deg, rgba(15,23,42,0.92), rgba(15,23,42,0.78));
  backdrop-filter: blur(26px);
  -webkit-backdrop-filter: blur(26px);
  border-radius: 26px;
  padding: 32px 30px 26px;
  box-shadow: 0 28px 80px rgba(15,23,42,0.85);
  max-width: 540px;
  width: 100%;
  border: 1px solid rgba(148,163,184,0.32);
  position: relative;
  overflow: hidden;
}

.card-large::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at -10% -10%, rgba(34,197,94,0.12), transparent 55%),
    radial-gradient(circle at 110% 120%, rgba(59,130,246,0.13), transparent 55%);
  opacity: 0.9;
  pointer-events: none;
}

.card-inner {
  position: relative;
  z-index: 1;
}

.card-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.card-subtitle {
  font-size: 0.9rem;
  color: var(--text-soft);
  margin-bottom: 18px;
}

.code-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.code-input {
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(148,163,184,0.55);
  color: var(--text-main);
  padding: 10px 14px;
  font-size: 0.96rem;
  outline: none;
  width: 100%;
}

.code-input::placeholder {
  color: #6b7280;
}

.btn-primary {
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #f9fafb;
  padding: 11px 22px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 14px 34px rgba(79,70,229,0.6);
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 40px rgba(79,70,229,0.75);
  filter: brightness(1.05);
}

.btn-primary span.icon {
  font-size: 1rem;
}

.status-text {
  font-size: 0.8rem;
  margin-top: 8px;
  color: var(--text-soft);
}

.status-text.error {
  color: #f97373;
}

.fade-out {
  animation: fadeOut 0.4s ease forwards;
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateY(-4px); }
}

.shake {
  animation: shake 0.3s ease;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  50% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
  100% { transform: translateX(0); }
}

/* Exam layout */

.page-shell {
  max-width: 1100px;
  margin: 22px auto 26px;
  padding: 0 16px 16px;
}

.exam-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.exam-title-block h1 {
  font-size: 1.1rem;
  margin: 0 0 2px;
}

.exam-title-block p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-outline {
  border: 1px solid rgba(148,163,184,0.6);
  color: var(--text-soft);
}

.badge-time {
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(148,163,184,0.4);
  color: var(--text-main);
}

.badge-time.time-up {
  background: rgba(239,68,68,0.2);
  border-color: #ef4444;
  color: #fecaca;
}

.timer-label {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 10px;
}

.summary-row strong {
  color: var(--text-main);
}

.questions-meta {
  font-size: 0.8rem;
  color: var(--text-soft);
}

.questions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.task-card {
  background: radial-gradient(circle at top left, rgba(15,23,42,0.92), rgba(15,23,42,0.88));
  border-radius: 18px;
  padding: 12px 12px 10px;
  border: 1px solid rgba(75,85,99,0.9);
  box-shadow: 0 16px 40px rgba(15,23,42,0.85);
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transform: translateY(6px);
  animation: cardIn 0.32s ease forwards;
}

@keyframes cardIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.task-title {
  font-size: 0.86rem;
  font-weight: 600;
}

.task-image {
  background: radial-gradient(circle at top, rgba(15,23,42,0.9), #020617);
  border-radius: 10px;
  padding: 4px;
  border: 1px solid rgba(31,41,55,0.9);
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-image svg {
  border-radius: 8px;
}

.task-stars {
  font-size: 0.7rem;
  color: #334155;
}

.star {
  opacity: 0.4;
}

.star.filled {
  opacity: 1;
  color: #fbbf24;
}

.task-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.task-number {
  font-size: 0.78rem;
  color: var(--text-soft);
}

.task-open-btn {
  border-radius: 999px;
  border: 1px solid rgba(148,163,184,0.7);
  background: rgba(15,23,42,0.9);
  color: var(--text-main);
  font-size: 0.78rem;
  padding: 4px 10px;
  cursor: pointer;
}

.task-open-btn:hover {
  background: rgba(30,64,175,0.55);
}

.submit-row {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}

.btn-submit {
  border-radius: 999px;
  background: linear-gradient(135deg, #38bdf8, #2563eb);
  border: none;
  color: #eff6ff;
  padding: 8px 18px;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 12px 26px rgba(37,99,235,0.45);
}

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 32px rgba(37,99,235,0.55);
}

.hidden {
  display: none !important;
}

/* Results box */

.results-box {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15,23,42,0.92);
  border: 1px solid rgba(148,163,184,0.65);
  font-size: 0.85rem;
  display: none;
}

.results-box.visible {
  display: block;
}

.results-box strong {
  font-size: 0.9rem;
}

.badge.good {
  background: rgba(22,163,74,0.2);
  color: #bbf7d0;
  border: 1px solid #22c55e;
}

.badge.ok {
  background: rgba(234,179,8,0.15);
  color: #facc15;
  border: 1px solid #eab308;
}

.badge.bad {
  background: rgba(248,113,113,0.14);
  color: #fecaca;
  border: 1px solid #f87171;
}

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.modal {
  background: #020617;
  border-radius: 18px;
  border: 1px solid rgba(148,163,184,0.7);
  max-width: 720px;
  width: calc(100% - 24px);
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 26px 60px rgba(15,23,42,0.9);
}

.modal-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  gap: 10px;
  border-bottom: 1px solid rgba(51,65,85,0.9);
}

.modal-title {
  font-size: 0.93rem;
  font-weight: 600;
}

.modal-close {
  border-radius: 999px;
  border: none;
  background: rgba(15,23,42,0.9);
  color: #e5e7eb;
  font-size: 1.1rem;
  width: 26px;
  height: 26px;
  cursor: pointer;
}

.modal-body {
  padding: 10px 14px 12px;
  overflow: auto;
}

.question-text {
  font-size: 0.88rem;
  color: var(--text-soft);
  margin-bottom: 8px;
}

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  border: 1px solid rgba(55,65,81,0.9);
  font-size: 0.82rem;
  cursor: pointer;
}

.option input {
  accent-color: #22c55e;
}
