
:root {
  --bg: #0b0f14;
  --panel: #121923;
  --panel-2: #17212d;
  --text: #eef2f6;
  --muted: #9ba9b8;
  --line: #2b3949;
  --accent: #e8c66a;
  --danger: #ff9b9b;
  --ok: #9be3b0;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(circle at top, #162231 0, #0b0f14 45%),
    var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  min-height: 100vh;
}
.shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 64px 0 96px;
}
.hero {
  padding: 24px 0 42px;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: .18em;
}
h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 8vw, 90px);
  font-weight: 500;
  margin: 12px 0 8px;
}
.tagline {
  max-width: 700px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}
.card {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 22px;
  padding: 34px 0;
  border-bottom: 1px solid var(--line);
}
.section-number {
  color: var(--accent);
  font-size: 14px;
  padding-top: 6px;
}
h2 {
  margin: 0 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
}
p {
  line-height: 1.7;
}
.ciphertext {
  margin: 22px 0 0;
  padding: 22px;
  background: #070a0e;
  border: 1px solid var(--line);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  max-height: 430px;
  overflow: auto;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 14px;
  align-items: end;
  margin-top: 22px;
}
.form-grid.compact {
  grid-template-columns: 1fr auto;
}
label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #090d12;
  color: var(--text);
  padding: 12px 13px;
  font: inherit;
}
input:focus {
  outline: 1px solid var(--accent);
  border-color: var(--accent);
}
button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #17130a;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
button:hover { filter: brightness(1.06); }
.message {
  min-height: 24px;
  margin-top: 14px;
  color: var(--muted);
}
.message.error { color: var(--danger); }
.message.ok { color: var(--ok); }
.assignment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 18px 0;
}
.assignment > div {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}
.assignment strong,
.assignment code {
  font-size: 21px;
}
.muted { color: var(--muted); }
.hidden { display: none; }

@media (max-width: 720px) {
  .shell { padding-top: 30px; }
  .card { grid-template-columns: 1fr; }
  .section-number { padding-top: 0; }
  .form-grid, .form-grid.compact, .assignment { grid-template-columns: 1fr; }
}


.narrow { width: min(680px, calc(100% - 32px)); }
.admin-shell { width: min(1280px, calc(100% - 32px)); }
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
}
.admin-title {
  font-size: clamp(38px, 5vw, 66px);
}
.card.single { grid-template-columns: 1fr; }
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 26px 0;
}
.stats > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.stats span {
  color: var(--muted);
  font-size: 12px;
  display: block;
  margin-bottom: 8px;
}
.stats strong { font-size: 28px; }
.admin-section {
  padding: 34px 0;
  border-top: 1px solid var(--line);
}
.admin-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}
.table-wrap { overflow-x: auto; margin-top: 20px; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}
.admin-table th,
.admin-table td {
  text-align: left;
  vertical-align: middle;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}
.admin-table th {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.secret-code {
  display: inline-block;
  min-width: 145px;
}
.inline-form,
.upload-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.inline-form input { min-width: 190px; }
.inline-form button,
.copy-button,
.button-secondary,
.button-danger,
.button-link {
  padding: 8px 10px;
  font-size: 12px;
}
.copy-button,
.button-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.button-danger {
  background: transparent;
  color: var(--danger);
  border-color: #704040;
}
.button-link {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
}
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
}
.ok-badge {
  color: var(--ok);
  border: 1px solid #355a42;
}
.draft-badge {
  color: var(--muted);
  border: 1px solid var(--line);
}
.upload-row input[type=file] {
  max-width: 480px;
}
@media (max-width: 800px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .admin-header, .admin-section-head { align-items: flex-start; flex-direction: column; }
}


.vault-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}
.vault-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
}
.vault-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}
.vault-card h3 {
  margin: 5px 0 0;
  font-size: 20px;
}
.vault-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 15px 0;
}
.secret-row {
  display: flex;
  align-items: center;
  gap: 7px;
}
.vault-checks {
  display: grid;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 13px;
}
.check-on { color: var(--ok); }
.check-off { color: var(--muted); }
.file-line {
  background: #0b1118;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}
.file-line a { color: var(--accent); }
.stack-form {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}
.stack-form button { width: fit-content; }
.action-row {
  display: flex;
  gap: 8px;
}
.publish-row {
  padding-top: 12px;
}
.full-button { width: 100%; }
button:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.ready-badge {
  color: var(--accent);
  border: 1px solid #6a5a2c;
}
@media (max-width: 1100px) {
  .vault-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .vault-grid { grid-template-columns: 1fr; }
}


.vault-textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #090d12;
  color: var(--text);
  padding: 12px 13px;
  font: inherit;
  line-height: 1.5;
}
.optional-block {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
}
.optional-block summary { cursor: pointer; color: var(--text); font-size: 13px; }
.no-top-border { border-top: 0 !important; padding-top: 8px !important; }
.cipher-panel { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--line); }
.cipher-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; }
.cipher-head h3 { margin: 4px 0 0; font-size: 22px; }
.cipher-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Lightweight story interludes: no video or image assets required. */
.interlude {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 35%, rgba(42,57,75,.78), rgba(5,8,12,.96) 55%), #05080c;
  overflow: auto;
}
.interlude.hidden { display: none; }
.interlude-card {
  width: min(760px, 100%);
  min-height: 620px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 28px;
  position: relative;
  overflow: hidden;
  padding: 54px 48px;
  border: 1px solid rgba(232,198,106,.3);
  border-radius: 18px;
  background: rgba(11,15,20,.86);
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
}
.interlude-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .45;
  background-image:
    radial-gradient(circle at 12% 18%, rgba(232,198,106,.8) 0 1px, transparent 2px),
    radial-gradient(circle at 81% 25%, rgba(255,255,255,.65) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 79%, rgba(232,198,106,.6) 0 1px, transparent 2px),
    radial-gradient(circle at 26% 73%, rgba(255,255,255,.45) 0 1px, transparent 2px);
  animation: starPulse 3.8s ease-in-out infinite alternate;
}
.interlude-visual { width: 230px; height: 230px; position: relative; display: grid; place-items: center; }
.orbit { position: absolute; inset: 12px; border: 1px solid rgba(232,198,106,.35); border-radius: 50%; }
.orbit-a { animation: orbitSpin 8s linear infinite; border-top-color: rgba(232,198,106,.95); border-bottom-color: transparent; }
.orbit-b { inset: 34px; animation: orbitSpinReverse 5s linear infinite; border-right-color: rgba(255,255,255,.75); border-left-color: transparent; }
.story-seal {
  width: 118px;
  height: 118px;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid rgba(232,198,106,.7);
  border-radius: 50%;
  box-shadow: 0 0 0 13px rgba(232,198,106,.04), 0 0 55px rgba(232,198,106,.12);
  animation: sealOpen 1.6s cubic-bezier(.2,.8,.2,1) both;
}
.seal-glyph { color: var(--accent); font-size: 48px; line-height: 1; animation: glyphPulse 2.2s ease-in-out infinite alternate; }
.seal-line { position: absolute; width: 74px; height: 1px; background: rgba(232,198,106,.75); }
.seal-line-a { transform: rotate(45deg); }
.seal-line-b { transform: rotate(-45deg); }
.interlude-copy { max-width: 600px; text-align: center; position: relative; z-index: 2; }
.interlude-copy h2 { font-size: clamp(34px,6vw,58px); margin: 10px 0 16px; }
.interlude-copy p { color: var(--muted); font-size: 16px; line-height: 1.8; }
.interlude-countdown { min-height: 27px; font-size: 13px !important; }
.interlude-copy button { margin-top: 10px; min-width: 190px; }
.interlude-card[data-theme="keys"] .story-seal { border-radius: 24px; transform: rotate(45deg); }
.interlude-card[data-theme="keys"] .seal-glyph { transform: rotate(-45deg); }
.interlude-card[data-theme="finale"] {
  border-color: rgba(232,198,106,.7);
  background: radial-gradient(circle at 50% 26%, rgba(232,198,106,.12), transparent 38%), rgba(11,15,20,.91);
}
.interlude-card[data-theme="finale"] .story-seal {
  box-shadow: 0 0 0 18px rgba(232,198,106,.05), 0 0 90px rgba(232,198,106,.28);
}
.interlude-card[data-theme="finale"] .seal-glyph { font-size: 58px; }

@keyframes orbitSpin {
  from { transform: rotate(0deg) scale(.98); }
  50% { transform: rotate(180deg) scale(1.03); }
  to { transform: rotate(360deg) scale(.98); }
}
@keyframes orbitSpinReverse { from { transform: rotate(360deg); } to { transform: rotate(0deg); } }
@keyframes sealOpen {
  0% { opacity: 0; transform: scale(.38) rotate(-18deg); }
  70% { opacity: 1; transform: scale(1.08) rotate(3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
@keyframes glyphPulse {
  from { opacity: .55; filter: drop-shadow(0 0 0 rgba(232,198,106,0)); }
  to { opacity: 1; filter: drop-shadow(0 0 16px rgba(232,198,106,.6)); }
}
@keyframes starPulse { from { opacity: .22; } to { opacity: .58; } }

@media (prefers-reduced-motion: reduce) {
  .orbit, .story-seal, .seal-glyph, .interlude-stars { animation: none !important; }
}
@media (max-width: 680px) {
  .interlude-card { min-height: 560px; padding: 38px 24px; }
  .interlude-visual { width: 180px; height: 180px; }
  .cipher-head { align-items: flex-start; flex-direction: column; }
}


.notification-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
  margin: 18px 0;
}
.notification-grid > div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}
.tiny { font-size: 11px; }
.workbench-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -8px 0 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(11,15,20,.94);
  backdrop-filter: blur(10px);
}
.workbench-actions { display:flex; gap:9px; align-items:center; flex-wrap:wrap; }
.file-button { cursor:pointer; }
.vault-card.is-dirty { box-shadow: inset 0 0 0 1px rgba(232,198,106,.45); }
.vault-card.is-dirty::before {
  content:'UNSAVED';
  display:block;
  color:var(--accent);
  font-size:10px;
  letter-spacing:.12em;
  margin-bottom:8px;
}
.save-indicator { color:var(--ok); font-size:12px; align-self:center; }
@media (max-width: 800px) {
  .notification-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .workbench-bar { position:static; align-items:flex-start; flex-direction:column; }
}


/* v6 student ID maintenance */
.student-maintenance-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.3fr);
  gap: 18px;
  align-items: end;
  margin: 18px 0 8px;
}
.inline-student-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
}
.inline-student-form label { display: grid; gap: 7px; }
.compact-upload { margin: 0; }
.roster-list-block { margin-top: 18px; }
.roster-list-block summary { cursor: pointer; font-weight: 700; margin-bottom: 12px; }
.small-button { padding: 7px 10px; font-size: 12px; min-width: 0; }
.student-actions-cell { display: flex; gap: 7px; flex-wrap: wrap; }
.subtle-danger { opacity: .78; }
@media (max-width: 800px) {
  .student-maintenance-grid { grid-template-columns: 1fr; }
  .inline-student-form { grid-template-columns: 1fr; }
}
