:root {
  --bg: #0f1419;
  --card: #1a2330;
  --line: #2a3a4d;
  --text: #e8eef5;
  --muted: #8fa3b8;
  --accent: #3d8bfd;
  --ok: #3dd68c;
  --bad: #ff6b6b;
  --warn: #f5c542;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: "Segoe UI", system-ui, sans-serif; }
a { color: var(--accent); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
h1, h2 { margin: 0 0 8px; font-weight: 650; }
.muted { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input, button, select, textarea {
  font: inherit; border-radius: 10px; border: 1px solid var(--line);
  background: #101820; color: var(--text); padding: 10px 12px;
}
button, .btn {
  background: var(--accent); color: #fff; border: 0; cursor: pointer; text-decoration: none; display: inline-block;
}
button.secondary, .btn.secondary { background: #2a3a4d; }
button.ok { background: #1f7a4d; }
button.ok:hover { background: #25945c; }
button:disabled { opacity: 0.45; cursor: default; }
button.bad { background: #8b2e2e; }
.admin-toolbar { align-items: stretch; flex-wrap: wrap; }
.admin-toolbar form { margin: 0; display: flex; }
.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: filter 0.15s ease, transform 0.1s ease;
}
.btn-icon svg { width: 18px; height: 18px; flex-shrink: 0; }
.btn-icon:hover { filter: brightness(1.08); }
.btn-icon:active { transform: translateY(1px); }
.exam-switch-form { display: flex; align-items: center; }
.exam-switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #141c26;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.exam-switch__label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.exam-switch__state {
  font-size: 13px;
  font-weight: 600;
  min-width: 52px;
  color: var(--muted);
}
.exam-switch--on .exam-switch__state { color: var(--ok); }
.exam-switch__input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.exam-switch__track {
  position: relative;
  width: 48px;
  height: 26px;
  border-radius: 999px;
  background: #3a4555;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.exam-switch--on .exam-switch__track {
  background: linear-gradient(180deg, #3dd68c 0%, #1f7a4d 100%);
}
.exam-switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}
.exam-switch--on .exam-switch__thumb { transform: translateX(22px); }
.exam-switch:hover .exam-switch__track { filter: brightness(1.06); }
.btn-export {
  background: linear-gradient(180deg, #2d4a6a 0%, #1e3348 100%);
  color: #e8eef5;
  border-color: #3d5a7a;
}
.btn-logout {
  background: #141c26;
  color: var(--muted);
  border-color: var(--line);
}
.btn-logout:hover { color: var(--text); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.row-passed { box-shadow: inset 0 0 0 2px var(--ok); }
tr.row-failed { box-shadow: inset 0 0 0 2px var(--bad); }
tr.row-passed td,
tr.row-failed td { background-color: transparent; }
@keyframes row-fill-passed {
  0% { background-color: rgba(61, 214, 140, 0.45); }
  50% { background-color: rgba(61, 214, 140, 0.1); }
  100% { background-color: transparent; }
}
@keyframes row-fill-failed {
  0% { background-color: rgba(255, 107, 107, 0.45); }
  50% { background-color: rgba(255, 107, 107, 0.1); }
  100% { background-color: transparent; }
}
tr.row-passed.row-just-finished td { animation: row-fill-passed 0.9s ease-in-out 4; }
tr.row-failed.row-just-finished td { animation: row-fill-failed 0.9s ease-in-out 4; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.badge.ok { background: #163d2c; color: var(--ok); }
.badge.bad { background: #3d1a1a; color: var(--bad); }
.badge.wait { background: #3d3420; color: var(--warn); }
.badge.off { background: #2a3a4d; color: var(--muted); }
.play-frame { position: fixed; inset: 0; background: #000; }
.play-frame iframe { width: 100%; height: 100%; border: 0; }
.done-overlay {
  position: fixed; inset: 0; z-index: 20; background: rgba(15,20,25,.88);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.done-overlay.hidden, .hidden { display: none; }
.q-card { margin-bottom: 18px; }
.q-card img { max-width: 100%; height: auto; border-radius: 10px; margin: 10px 0; background: #fff; }
.choice { padding: 8px 10px; border-radius: 8px; margin: 6px 0; border: 1px solid var(--line); }
.choice.picked { border-color: var(--bad); }
.choice.correct { border-color: var(--ok); background: #163d2c; }
.choice.picked.correct { border-color: var(--ok); }
.login { max-width: 420px; width: 100%; }
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.login-page .wrap.login {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 10vh 16px 24px;
}
.login-brand {
  margin-top: 1.35rem;
  padding-top: 0.25rem;
  text-align: center;
}
.pdd-expert-wordmark {
  display: inline-block;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
}
.pdd-expert-wordmark:hover { opacity: 0.88; }
.pdd-expert-e { color: #3b9cf5; }
@media (min-width: 768px) {
  .pdd-expert-wordmark { font-size: 1.65rem; }
}
.flash { background: #3d1a1a; color: #ffd0d0; padding: 10px 12px; border-radius: 10px; margin-bottom: 12px; }
.menu { position: relative; flex-shrink: 0; }
.icon-btn {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 6px; line-height: 0; border-radius: 8px;
}
.icon-btn:hover, .menu.open .icon-btn { color: var(--text); background: #2a3a4d; }
a.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  text-decoration: none;
  box-sizing: border-box;
}
.icon-btn--link { margin-left: 6px; }
.org-name-cell a { vertical-align: middle; }
.super-section-title { margin: 1.5rem 0 0.75rem; font-size: 1.15rem; }
.super-settings-section { margin-top: 1rem; }
.super-settings-section + .super-settings-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.super-settings-section h3 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  font-weight: 600;
}
.super-settings-section--danger h3 { color: var(--bad); }
.menu-pop {
  display: none; position: absolute; right: 0; top: calc(100% + 4px);
  min-width: 168px; background: #101820; border: 1px solid var(--line);
  border-radius: 10px; padding: 4px; z-index: 40;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
}
.menu.open .menu-pop { display: flex; flex-direction: column; }
.menu-pop button {
  background: transparent; text-align: left; width: 100%; border: 0;
  border-radius: 8px; padding: 8px 10px; color: var(--text);
}
.menu-pop button:hover { background: #2a3a4d; }
.menu-pop button.danger { color: var(--bad); }
.admin-brand {
  margin: 0 0 20px;
  padding: 0;
  text-align: left;
}
.admin-brand__logo-slot {
  display: flex;
  align-items: flex-end;
  min-height: 52px;
  margin: 0 0 16px;
}
@media (min-width: 768px) {
  .admin-brand__logo-slot { min-height: 64px; }
}
.admin-brand__logo-slot img {
  display: block;
  height: 52px;
  width: auto;
  max-width: 100%;
  margin: 0;
}
@media (min-width: 768px) {
  .admin-brand__logo-slot img { height: 64px; }
}
.admin-brand__org {
  margin: 0 0 8px;
  font-size: 1.85rem;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
@media (min-width: 768px) {
  .admin-brand__org { font-size: 2.15rem; }
}
.org-logo-preview {
  display: block;
  height: 64px;
  width: auto;
  max-width: 100%;
  margin: 0 0 8px;
}
.org-logo-specs {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.92rem;
  line-height: 1.45;
}
.org-logo-specs li { margin: 0.2rem 0; }
.admin-student-link {
  max-width: 20rem;
  margin-left: auto;
  margin-right: 0;
}
.admin-student-link h2 {
  font-size: 1.05rem;
}
.admin-student-link .muted {
  font-size: 0.88rem;
  line-height: 1.35;
}
.admin-student-link .admin-copy-row {
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
}
.admin-copy-input {
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 0.82rem;
  padding: 8px 10px;
}
.admin-student-link button,
.admin-student-link .admin-copy-row > a {
  font-size: 0.88rem;
  padding: 8px 12px;
}
