:root{
  --bg:#07121a;
  --bg-soft:#0f1f2b;
  --panel:#112534;
  --panel-2:#173142;
  --line:rgba(255,255,255,.08);
  --line-strong:rgba(229,187,106,.32);
  --text:#f5efe3;
  --muted:#aebbc7;
  --gold:#e5bb6a;
  --teal:#49bea9;
  --ok:#77daa4;
  --warn:#f0c768;
  --danger:#ee9999;
  --radius:28px;
  --shadow:0 26px 80px rgba(0,0,0,.34);
}

*{box-sizing:border-box}
html,body{margin:0;min-height:100%}
body{
  font-family:"Cairo",sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 12% 14%, rgba(229,187,106,.15), transparent 24%),
    radial-gradient(circle at 84% 16%, rgba(73,190,169,.12), transparent 24%),
    linear-gradient(180deg, #051018 0%, #0a1822 55%, #07121a 100%);
}

body::before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  opacity:.22;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size:56px 56px;
  mask-image:radial-gradient(circle at center, black 42%, transparent 88%);
}

button,input,select{
  font:inherit;
}

button{
  cursor:pointer;
}

.screen{
  min-height:100vh;
  padding:28px 18px;
}

.shell{
  max-width:1120px;
  margin:0 auto;
}

.panel{
  background:linear-gradient(180deg, rgba(17,37,52,.95), rgba(10,22,31,.97));
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:28px;
}

.student-shell{
  display:grid;
  grid-template-columns:minmax(0,1.1fr) minmax(320px,.9fr);
  gap:18px;
  align-items:center;
}

.teacher-login-shell,
.summary-shell{
  display:grid;
  place-items:center;
}

.intro-panel{
  display:grid;
  gap:18px;
  background:
    radial-gradient(circle at top right, rgba(73,190,169,.12), transparent 26%),
    radial-gradient(circle at bottom left, rgba(229,187,106,.12), transparent 26%),
    linear-gradient(180deg, rgba(17,37,52,.97), rgba(11,24,34,.98));
}

.intro-panel h1,
.summary-panel h1,
.teacher-topbar h1,
.top-strip h1,
.exam-ident h1{
  margin:0;
  font-family:"Changa",sans-serif;
  font-size:clamp(2rem,4vw,3rem);
  line-height:1.15;
}

.intro-panel p,
.summary-panel p,
.teacher-topbar p,
.top-strip p,
.exam-ident p,
.muted{
  margin:0;
  color:var(--muted);
  line-height:1.9;
}

.kicker{
  display:inline-flex;
  width:max-content;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid var(--line);
  color:var(--muted);
  letter-spacing:.12em;
  text-transform:uppercase;
  font-size:.84rem;
}

.clean-rules{
  display:grid;
  gap:12px;
}

.rule-item{
  padding:14px 16px;
  border-radius:18px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.07);
  line-height:1.8;
}

.auth-panel{
  display:grid;
  gap:16px;
}

.auth-panel.compact{
  width:min(520px,100%);
}

.auth-panel h2,
.video-head h2,
.section-head h2{
  margin:0;
  font-size:1.35rem;
}

.field{
  display:grid;
  gap:8px;
}

.field label{
  color:var(--muted);
  font-size:.95rem;
}

input,select{
  width:100%;
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  color:var(--text);
  border-radius:16px;
  padding:14px 15px;
  outline:none;
}

input:focus,select:focus{
  border-color:var(--line-strong);
  box-shadow:0 0 0 4px rgba(229,187,106,.10);
}

.actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.button{
  border:0;
  border-radius:16px;
  padding:13px 18px;
  font-weight:800;
  color:#fff;
  background:linear-gradient(135deg, var(--gold), var(--teal));
  box-shadow:0 16px 34px rgba(0,0,0,.24);
  transition:transform .16s ease, filter .16s ease, opacity .16s ease;
}

.button:hover{transform:translateY(-1px);filter:brightness(1.03)}
.button:disabled{opacity:.45;cursor:not-allowed;transform:none;filter:none}

.button.secondary{
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.11);
  box-shadow:none;
}

.small-btn{
  padding:9px 12px;
  font-size:.9rem;
}

.note{
  padding:13px 15px;
  border-radius:18px;
  line-height:1.8;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
}

.note.info{border-color:rgba(73,190,169,.24)}
.note.error{border-color:rgba(238,153,153,.26)}

.top-strip,
.teacher-topbar,
.exam-topbar{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:flex-start;
  flex-wrap:wrap;
  margin-bottom:18px;
}

.stage-shell,
.teacher-shell,
.exam-shell{
  display:grid;
  gap:18px;
}

.video-panel,
.question-panel,
.teacher-section,
.summary-panel{
  display:grid;
  gap:18px;
}

.video-head,
.section-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}

.video-frame{
  overflow:hidden;
  border-radius:24px;
  border:1px solid rgba(255,255,255,.08);
  background:#000;
}

.video-frame video{
  display:block;
  width:100%;
  aspect-ratio:16/9;
  background:#000;
}

.progress-box,
.question-progress{
  display:grid;
  gap:10px;
}

.progress-copy,
.question-progress-copy{
  display:flex;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
  align-items:center;
}

.progress-line{
  height:10px;
  overflow:hidden;
  border-radius:999px;
  background:rgba(255,255,255,.07);
  border:1px solid rgba(255,255,255,.06);
}

.progress-line span{
  display:block;
  height:100%;
  background:linear-gradient(90deg, var(--gold), var(--teal));
}

.sync-text{
  color:var(--muted);
  font-size:.92rem;
}

.exam-meta{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  align-items:flex-start;
}

.timer-pill{
  min-width:210px;
  padding:13px 16px;
  border-radius:18px;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.08);
  display:grid;
  gap:6px;
}

.timer-pill span{
  color:var(--muted);
  font-size:.9rem;
}

.timer-pill strong{
  font-size:1.75rem;
}

.timer-pill.warn{
  border-color:rgba(240,199,104,.32);
  color:#fde68a;
}

.timer-pill.danger{
  border-color:rgba(238,153,153,.32);
  color:#fecaca;
}

.question-tag{
  width:max-content;
  padding:8px 12px;
  border-radius:999px;
  background:rgba(73,190,169,.12);
  border:1px solid rgba(73,190,169,.22);
  color:#d9fff7;
  font-size:.92rem;
}

.question-body{
  font-size:1.15rem;
  line-height:2.25;
}

.cloze-select{
  display:inline-block;
  width:auto;
  min-width:220px;
  margin:0 8px;
  vertical-align:middle;
}

.question-note{
  color:var(--muted);
  line-height:1.8;
}

.question-actions{
  display:flex;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
  align-items:center;
}

.summary-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
}

.teacher-summary-grid{
  grid-template-columns:repeat(4, minmax(0, 1fr));
}

.summary-card{
  padding:16px 18px;
  border-radius:20px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
}

.summary-card span{
  display:block;
  color:var(--muted);
  font-size:.9rem;
}

.summary-card strong{
  display:block;
  margin-top:8px;
  font-size:1.45rem;
}

.teacher-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,.95fr);
  gap:18px;
}

.settings-grid,
.detail-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0,1fr));
  gap:14px;
}

.action-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0,1fr));
  gap:16px;
}

.action-card{
  display:grid;
  gap:14px;
  padding:20px;
  border-radius:22px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
}

.action-card h3{
  margin:0;
  font-size:1.1rem;
}

.stack-actions{
  display:grid;
  width:100%;
}

.row-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.danger-btn{
  background:linear-gradient(135deg, #c84e4e, #a33333);
  box-shadow:none;
}

.danger-card{
  background:linear-gradient(180deg, rgba(88,22,22,.35), rgba(32,14,14,.4));
}

.toggle-grid{
  display:grid;
  gap:10px;
}

.toggle-item{
  display:flex;
  gap:10px;
  align-items:center;
  padding:12px 14px;
  border-radius:16px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
}

.toggle-item input{
  width:auto;
}

.filters{
  display:grid;
  grid-template-columns:1fr 220px 220px;
  gap:12px;
}

.table-wrap{
  overflow:auto;
  border-radius:22px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
}

table{
  width:100%;
  border-collapse:collapse;
  min-width:980px;
}

th,td{
  padding:13px 14px;
  text-align:right;
  border-bottom:1px solid rgba(255,255,255,.06);
  vertical-align:top;
}

th{
  background:rgba(255,255,255,.04);
  position:sticky;
  top:0;
  z-index:1;
}

tr:hover td{
  background:rgba(255,255,255,.025);
}

.table-sub{
  color:var(--muted);
  font-size:.88rem;
  margin-top:4px;
}

.status-chip{
  display:inline-flex;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid transparent;
  font-size:.88rem;
  font-weight:700;
}

.phase-not_started{
  background:rgba(148,163,184,.14);
  color:#e2e8f0;
  border-color:rgba(148,163,184,.24);
}

.phase-in_video{
  background:rgba(59,130,246,.14);
  color:#dbeafe;
  border-color:rgba(59,130,246,.24);
}

.phase-in_exam{
  background:rgba(240,199,104,.14);
  color:#fde68a;
  border-color:rgba(240,199,104,.28);
}

.phase-submitted{
  background:rgba(34,197,94,.14);
  color:#dcfce7;
  border-color:rgba(34,197,94,.28);
}

.report-list{
  display:grid;
  gap:14px;
}

.timeline-list{
  display:grid;
  gap:12px;
}

.timeline-item{
  display:grid;
  gap:6px;
  padding:16px 18px;
  border-radius:20px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
}

.timeline-item strong{
  font-size:1rem;
}

.timeline-item span,
.timeline-item p{
  margin:0;
  color:var(--muted);
  line-height:1.8;
}

.report-item{
  padding:18px;
  border-radius:20px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.08);
}

.report-item h3{
  margin:0 0 10px;
}

.report-item p{
  margin:8px 0 0;
  line-height:1.8;
}

@media (max-width: 980px){
  .student-shell,
  .teacher-grid{
    grid-template-columns:1fr;
  }

  .filters{
    grid-template-columns:1fr;
  }

  .summary-grid,
  .teacher-summary-grid,
  .settings-grid,
  .detail-grid,
  .action-grid{
    grid-template-columns:1fr;
  }
}

@media (max-width: 720px){
  .screen{
    padding:18px 12px;
  }

  .panel{
    padding:20px;
    border-radius:24px;
  }

  .intro-panel h1,
  .summary-panel h1,
  .teacher-topbar h1,
  .top-strip h1,
  .exam-ident h1{
    font-size:2rem;
  }

  .question-body{
    font-size:1.02rem;
  }

  .cloze-select{
    min-width:100%;
    margin:10px 0;
  }

  .question-actions,
  .top-strip,
  .teacher-topbar,
  .exam-topbar{
    align-items:stretch;
  }

  .exam-meta{
    width:100%;
  }

  .timer-pill{
    width:100%;
  }
}
