:root {
  --blue: #0954b8;
  --blue-2: #0b8ceb;
  --orange: #ff8a00;
  --orange-2: #ffbd4a;
  --ink: #183153;
  --muted: #63708a;
  --white: #ffffff;
  --bg: #f6fbff;
  --good: #0f9d58;
  --danger: #d93025;
  --shadow: 0 24px 60px rgba(9, 84, 184, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 138, 0, .17), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(11, 140, 235, .19), transparent 36rem),
    linear-gradient(135deg, #f8fcff 0%, #eef7ff 100%);
}

.bg-bubbles::before,
.bg-bubbles::after {
  content: '';
  position: fixed;
  border-radius: 999px;
  z-index: 0;
  pointer-events: none;
}

.bg-bubbles::before {
  width: 320px;
  height: 320px;
  right: 5vw;
  top: 7vh;
  background: rgba(255, 138, 0, .12);
}

.bg-bubbles::after {
  width: 260px;
  height: 260px;
  left: 4vw;
  bottom: 8vh;
  background: rgba(9, 84, 184, .11);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.screen {
  width: 100%;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(9, 84, 184, .12);
  border-radius: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hidden { display: none !important; }

.start-card,
.result-card {
  max-width: 880px;
  padding: clamp(24px, 4vw, 48px);
}

.brand-row {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 24px;
  align-items: center;
}

.school-logo {
  width: 108px;
  height: 108px;
  object-fit: contain;
  border-radius: 28px;
  padding: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(9, 84, 184, .12);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  font-size: .86rem;
}

h1, h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2rem, 5vw, 4rem);
  color: var(--ink);
}

h2 {
  font-size: clamp(1.7rem, 3.2vw, 3rem);
}

.subtext,
.hint {
  color: var(--muted);
  line-height: 1.6;
}

.student-form {
  margin-top: 34px;
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(9,84,184,.08), rgba(255,138,0,.1));
}

.student-form label {
  display: block;
  margin-bottom: 10px;
  font-weight: 800;
  font-size: 1.1rem;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  border: 2px solid rgba(9, 84, 184, .18);
  border-radius: 18px;
  padding: 16px 18px;
  font-size: 1.2rem;
  outline: none;
  transition: .2s;
}

input:focus {
  border-color: var(--blue-2);
  box-shadow: 0 0 0 5px rgba(11, 140, 235, .13);
}

.primary-btn,
.soft-btn {
  border: 0;
  border-radius: 18px;
  padding: 14px 24px;
  font-size: 1.06rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-btn {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  box-shadow: 0 12px 24px rgba(9, 84, 184, .24);
}

.soft-btn {
  color: var(--blue);
  background: #eaf5ff;
  border: 1px solid rgba(9, 84, 184, .12);
}

.primary-btn:hover,
.soft-btn:hover,
.option-card:hover {
  transform: translateY(-2px);
}

.primary-btn:disabled {
  opacity: .65;
  cursor: not-allowed;
  transform: none;
}

.teacher-link { margin-top: 22px; }
.teacher-link a { color: var(--blue); font-weight: 800; }

.quiz-card {
  min-height: calc(100vh - 64px);
  padding: clamp(18px, 3vw, 34px);
  display: flex;
  flex-direction: column;
}

.quiz-header {
  display: grid;
  grid-template-columns: 1fr minmax(190px, 280px);
  gap: 18px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px dashed rgba(9, 84, 184, .2);
}

.progress-box {
  padding: 14px;
  border-radius: 18px;
  background: #f1f8ff;
  color: var(--blue);
  font-weight: 900;
}

.progress-bar {
  width: 100%;
  height: 12px;
  margin-top: 10px;
  background: rgba(9, 84, 184, .12);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--blue-2));
  border-radius: 999px;
  transition: width .25s ease;
}

.question-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-top: 18px;
}

.badge {
  display: inline-flex;
  padding: 10px 14px;
  border-radius: 999px;
  color: #8a4b00;
  background: #fff3df;
  border: 1px solid rgba(255, 138, 0, .18);
  font-weight: 800;
}

.prompt-text {
  margin: 24px 0 16px;
  font-size: clamp(1.35rem, 2.4vw, 2.2rem);
  font-weight: 900;
  line-height: 1.35;
}

.media-wrap,
.memory-box {
  display: grid;
  place-items: center;
  margin: 4px 0 18px;
}

.question-image,
.video-player,
.audio-player {
  max-width: min(100%, 760px);
  max-height: 40vh;
  object-fit: contain;
  border-radius: 22px;
}

.video-player {
  width: min(100%, 760px);
  background: #000;
}

.audio-player {
  width: min(100%, 520px);
  margin-bottom: 12px;
}

.memory-image {
  border: 5px solid #d8ebff;
  padding: 12px;
  background: #fff;
}

.countdown-card {
  text-align: center;
  margin-bottom: 14px;
  color: var(--blue);
  font-weight: 900;
}

.countdown-number {
  width: 86px;
  height: 86px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--blue-2));
  font-size: 3rem;
  box-shadow: 0 14px 30px rgba(255, 138, 0, .22);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  width: 100%;
  margin-top: 4px;
}

.option-card {
  min-height: 170px;
  border: 3px solid rgba(9, 84, 184, .12);
  background: #fff;
  border-radius: 26px;
  padding: 14px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(24, 49, 83, .08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: .16s ease;
}

.option-card img {
  width: 100%;
  height: 112px;
  object-fit: contain;
}

.option-label,
.number-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  min-height: 42px;
  padding: 8px 14px;
  color: var(--ink);
  background: #f4f9ff;
  border-radius: 999px;
  font-weight: 900;
  font-size: 1.35rem;
}

.number-label {
  width: 82px;
  height: 82px;
  font-size: 3rem;
  color: var(--blue);
}

.option-card.selected {
  border-color: var(--orange);
  background: linear-gradient(180deg, #fff, #fff7ec);
  box-shadow: 0 16px 34px rgba(255, 138, 0, .22);
}

.option-card.selected .option-label,
.option-card.selected .number-label {
  color: #fff;
  background: linear-gradient(135deg, var(--orange), var(--orange-2));
}

.error-text {
  color: var(--danger);
  font-weight: 800;
  font-size: 1.05rem;
}

.quiz-footer {
  margin-top: auto;
  display: flex;
  justify-content: flex-end;
  padding-top: 22px;
}

.result-card {
  text-align: center;
}

.celebrate {
  font-size: 4rem;
}

.result-summary {
  font-size: 1.25rem;
  line-height: 1.8;
  color: var(--muted);
}

.result-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.link-btn { color: var(--blue) !important; }

/* Admin */
.admin-shell {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0;
}

.admin-card {
  background: rgba(255,255,255,.94);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 26px;
  border: 1px solid rgba(9,84,184,.12);
}

.admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.admin-filter {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  margin: 20px 0;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
}

th, td {
  padding: 14px 12px;
  border-bottom: 1px solid #e8eef7;
  text-align: left;
  vertical-align: top;
}

th {
  background: #edf7ff;
  color: var(--blue);
  font-weight: 900;
}

.score-pill {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: #fff3df;
  color: #8a4b00;
  font-weight: 900;
}

.detail-list {
  margin: 10px 0 0;
  padding-left: 18px;
  line-height: 1.65;
}

.ok { color: var(--good); font-weight: 900; }
.bad { color: var(--danger); font-weight: 900; }

@media (max-width: 760px) {
  .brand-row,
  .quiz-header,
  .input-row,
  .admin-filter {
    grid-template-columns: 1fr;
  }

  .school-logo { width: 86px; height: 86px; }
  .quiz-card { min-height: auto; }
  .question-image { max-height: 32vh; }
  .options-grid { grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); }
  .option-card { min-height: 140px; }
  .option-card img { height: 90px; }
}
