:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #0e0d14;
  color: #f4f1fb;
  --muted: #b1a9c3;
  --line: #2a2439;
  --purple: #c2a2ff;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #050d1b url("/background-doj.png") center / cover no-repeat;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid #d6c0ff; outline-offset: 4px; }
svg { width: 22px; height: 22px; flex: none; }
.layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 38px;
  margin: 14px 0 14px 14px;
  padding: 24px 14px 16px;
  border: 1px solid rgb(223 213 255 / 24%);
  border-radius: 20px;
  background: linear-gradient(155deg, rgb(29 34 62 / 83%), rgb(7 13 29 / 82%));
  box-shadow: 0 12px 36px rgb(2 6 17 / 38%), inset 0 1px 0 rgb(255 255 255 / 9%);
}
@supports (backdrop-filter: blur(16px)) {
  .sidebar {
    background: linear-gradient(155deg, rgb(38 45 77 / 58%), rgb(9 15 33 / 68%));
    backdrop-filter: blur(16px) saturate(135%);
  }
}
.brand { display: flex; width: fit-content; align-items: center; gap: 8px; margin-left: 8px; font-size: 38px; line-height: 1.1; font-weight: 800; letter-spacing: .07em; }
.brand strong { color: #ffe8a4; }
@supports (background-clip: text) {
  .brand strong {
    background: linear-gradient(105deg, #f0ce78 20%, #ffedb3 38%, #fff9df 48%, #f0ce78 66%) 100% / 230% 100%;
    background-clip: text;
    color: transparent;
    animation: gold-shimmer 5s linear infinite;
  }
}
@keyframes gold-shimmer {
  0%, 20% { background-position: 100% 50%; }
  65%, 100% { background-position: 0% 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .brand strong { animation: none; background-position: 50% 50%; }
}
.user-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; }
.logo { display: block; flex: none; object-fit: contain; }
.sidebar-navigation { display: flex; flex: 1; flex-direction: column; gap: 20px; }
.sidebar-footer { display: grid; gap: 8px; margin-top: auto; }
nav { display: grid; gap: 5px; }
nav a, .settings-link { display: flex; align-items: center; gap: 12px; min-height: 45px; padding: 8px 12px; color: var(--muted); border: 1px solid transparent; border-radius: 10px; font-size: 14px; font-weight: 600; }
nav a:hover, nav a[aria-current], .settings-link:hover, .settings-link[aria-current] { background: rgb(135 92 209 / 27%); color: #f1e5ff; border-color: rgb(212 182 255 / 35%); }
.user-card { display: grid; gap: 10px; padding: 12px; background: rgb(8 13 29 / 36%); border: 1px solid rgb(223 213 255 / 20%); border-radius: 12px; font-size: 14px; }
.user-avatar { color: #ffe8a4; background: rgb(231 193 99 / 17%); font-weight: 900; }
.menu-toggle { display: none; }
main { width: 100%; max-width: 1432px; margin-inline: auto; padding: 24px clamp(18px, 4vw, 62px) 40px; }
h1 { margin: 13px 0 6px; font-size: clamp(34px, 5.4vw, 66px); line-height: 1.06; letter-spacing: -.052em; }
.intro { width: fit-content; margin-bottom: 24px; padding: 12px 18px; border-radius: 15px; background: rgb(8 13 29 / 87%); }
@media (max-width: 720px) {
  body::before {
    --mobile-art-height: min(58vh, 130vw);
    background-size: auto var(--mobile-art-height);
    background-position: center 53%;
    mask: linear-gradient(transparent, #000 14% 86%, transparent) center 53% / 100% var(--mobile-art-height) no-repeat;
  }
  .layout { display: flow-root; }
  .sidebar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; margin: 10px 10px 0; padding: 12px 14px; border-radius: 16px; }
  .brand { margin-left: 0; }
  .menu-toggle { display: inline-block; min-height: 44px; padding: 6px 12px; font: inherit; color: var(--purple); background: #231832; border: 1px solid #4c3863; border-radius: 9px; }
  .sidebar-navigation { grid-column: 1 / -1; }
  .menu-toggle[aria-expanded="false"] + .sidebar-navigation { display: none; }
}

@media (max-width: 340px) {
  .sidebar { grid-template-columns: 1fr; }
  .menu-toggle { justify-self: start; }
}
.test-code-panel {
  display: grid;
  justify-items: start;
  gap: 16px;
  width: fit-content;
  padding: 18px;
  border: 1px solid rgb(223 213 255 / 24%);
  border-radius: 15px;
  background: rgb(8 13 29 / 87%);
}
.generate-test-code {
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid #f4d888;
  border-radius: 10px;
  background: #f4d888;
  color: #181126;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.generate-test-code:hover { background: #ffebaf; }
.test-code {
  color: #ffe8a4;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  letter-spacing: .1em;
}
.test-code:empty { height: 0; margin-top: -16px; }

.results-table-wrap {
  overflow-x: auto;
  border: 1px solid rgb(223 213 255 / 24%);
  border-radius: 15px;
  background: rgb(8 13 29 / 91%);
}
.results-table-wrap:focus-visible {
  outline: 2px solid #d6c0ff;
  outline-offset: 4px;
}
.results-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}
.results-table th, .results-table td {
  padding: 14px 16px;
}
.results-table th {
  background: rgb(135 92 209 / 18%);
  border-bottom: 1px solid rgb(223 213 255 / 24%);
  white-space: nowrap;
}
.results-empty { color: var(--muted); }

.result-actions { text-align: right; white-space: nowrap; }
.result-action {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid rgb(223 213 255 / 24%);
  border-radius: 9px;
  background: #211b35;
  color: #eadcff;
  font: inherit;
  cursor: pointer;
}
.result-action:hover { background: #392653; }
.result-delete { color: #ffc2c9; }
.result-delete:hover { background: #4b2334; }
.result-details {
  width: min(440px, calc(100% - 32px));
  padding: 22px;
  border: 1px solid rgb(223 213 255 / 24%);
  border-radius: 15px;
  background: #14192d;
  color: inherit;
}
.result-details::backdrop { background: rgb(0 0 0 / 65%); }
.result-details h2 { margin: 0; }
.result-details dt { color: var(--muted); }
.result-details dd { margin: 3px 0 12px; overflow-wrap: anywhere; }

.question-builder { max-width: 780px; }
.question-list { display: grid; gap: 16px; margin-top: 16px; }
.question-editor {
  padding: clamp(14px, 3vw, 24px);
  border: 1px solid rgb(223 213 255 / 24%);
  border-radius: 15px;
  background: rgb(8 13 29 / 93%);
}
.question-editor h2 { margin: 0 0 16px; font-size: 20px; }
.question-field { display: grid; gap: 6px; font-weight: 600; }
.question-field textarea, .question-field input {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgb(223 213 255 / 30%);
  border-radius: 8px;
  background: #131a30;
  color: inherit;
  font: inherit;
  font-weight: 400;
}
.question-field textarea { resize: vertical; }
.question-field :focus-visible {
  outline: 2px solid #d6c0ff;
  outline-offset: 2px;
}
.question-editor fieldset {
  min-width: 0;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}
.question-editor legend { margin-bottom: 10px; padding: 0; font-weight: 700; }
.question-answers { display: grid; gap: 10px; }
.add-answer, .remove-question-image, .attach-discord-image {
  min-height: 44px;
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid rgb(223 213 255 / 35%);
  border-radius: 8px;
  background: #211b35;
  color: #eadcff;
  font: inherit;
  cursor: pointer;
}
.add-answer:hover, .remove-question-image:hover, .attach-discord-image:hover { background: #392653; }

.welcome {
  padding: 10px 14px;
  border: 1px solid rgb(255 232 164 / 26%);
  background: rgb(8 16 35 / 82%);
}
.welcome h1 {
  margin: 0;
  color: #ffe8a4;
  font-size: clamp(17px, 2.7vw, 33px);
  line-height: 1.2;
  letter-spacing: -.02em;
}

.answer-row { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; }
.answer-row .question-field { flex: 1 1 180px; }
.correct-answer-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid rgb(223 213 255 / 30%);
  border-radius: 8px;
  cursor: pointer;
}
.correct-answer-option:has(input:checked) {
  border-color: #f4d888;
  color: #ffe8a4;
}
.correct-answer-option input { accent-color: #f4d888; }
.question-feedback { color: #ffc2c9; }
.question-feedback:empty { display: none; }
.question-editor-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas:
    "answer answer answer"
    ". save discard";
  align-items: center;
  gap: 20px 8px;
  margin-top: 16px;
}
.question-editor-actions .add-answer {
  grid-area: answer;
  justify-self: start;
  margin-top: 0;
}
.question-editor-actions [type="submit"] { grid-area: save; }
.question-editor-actions .discard-question {
  grid-area: discard;
  justify-self: end;
}
.add-question:disabled {
  opacity: .55;
  cursor: default;
}
.question-builder > h2, .question-status {
  width: fit-content;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgb(8 13 29 / 90%);
}
.question-status:empty { display: none; }
.saved-questions h3 { margin: 0; }
.saved-questions h3, .saved-questions li { overflow-wrap: anywhere; white-space: pre-wrap; }
.saved-questions ol { margin-bottom: 0; }
.saved-questions li + li { margin-top: 8px; }
.saved-correct-answer {
  padding: 6px 10px;
  border-radius: 7px;
  background: rgb(74 222 128 / 16%);
  color: #b9f6ca;
}
.correct-answer-badge { color: #86efac; }

.question-image-field { margin-top: 16px; }
.question-image-field small { display: block; margin-top: 6px; color: var(--muted); }
.question-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 320px;
  margin-top: 12px;
  border: 1px solid rgb(223 213 255 / 24%);
  border-radius: 8px;
  object-fit: contain;
}
.question-image[hidden], .remove-question-image[hidden] { display: none; }
.question-editor button[type="submit"]:disabled { opacity: .55; cursor: default; }

.question-image-link {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px 12px;
  margin: 12px 0 0;
}
.question-image-link .question-field { flex: 1 1 220px; }
.question-image-link .attach-discord-image { margin-top: 0; }

.saved-question-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}
.delete-saved-question:disabled { opacity: .55; cursor: default; }

.user-identity { display: flex; align-items: center; gap: 11px; }
.user-avatar { flex: none; }

.player-link { padding: 6px 0; }
.player-main {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: 24px 18px;
}
.player-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: min(100%, 533px);
  text-align: center;
  min-height: clamp(278px, 31vw, 333px);
  padding: clamp(24px, 5vw, 47px);
  border: 1px solid rgb(225 239 255 / 52%);
  border-top-color: rgb(255 248 225 / 82%);
  border-radius: 28px;
  background: #112039;
  box-shadow:
    0 18px 54px rgb(0 6 18 / 43%),
    inset 0 1px 0 rgb(255 255 255 / 48%),
    inset 0 -1px 0 rgb(223 239 255 / 28%);
}
@supports (backdrop-filter: blur(8px)) {
  .player-panel {
    background:
      linear-gradient(130deg, rgb(242 248 255 / 12%) 0%, rgb(235 244 255 / 6%) 35%, transparent 57%),
      radial-gradient(ellipse at 96% 100%, rgb(157 195 255 / 10%), transparent 48%),
      linear-gradient(145deg, rgb(9 19 42 / 53%), rgb(5 13 30 / 67%));
    backdrop-filter: blur(8px) saturate(155%);
  }
}
.player-panel .brand {
  margin: 0;
  font-size: clamp(38px, 15vw, 76px);
  translate: 0 -8px;
}
.player-panel .brand .logo {
  width: clamp(46px, 12vw, 64px);
  height: auto;
  aspect-ratio: 1;
}
@media (max-width: 340px) {
  .player-panel .brand { font-size: clamp(32px, 12vw, 40px); }
}
.player-panel h1 {
  margin: 26px 0 22px;
  font-size: clamp(28px, 6vw, 44px);
  line-height: 1.12;
  text-shadow: 0 2px 5px rgb(0 6 20 / 95%), 0 0 18px rgb(0 6 20 / 72%);
}
.player-panel .question-field input {
  background: rgb(7 15 34 / 58%);
  border-color: rgb(221 234 255 / 38%);
  box-shadow: inset 0 1px 4px rgb(0 5 15 / 28%);
}
.player-exam { width: min(100%, 300px); }
.player-exam summary { display: inline-grid; place-items: center; }
.player-exam summary::-webkit-details-marker { display: none; }
.player-exam summary:focus-visible { outline: 2px solid #d6c0ff; outline-offset: 3px; }
.player-exam .question-field { margin-top: 16px; }
.test-code-countdown { color: var(--muted); font-variant-numeric: tabular-nums; }
.test-code-countdown:empty, .test-code-feedback:empty { display: none; }
.test-code-feedback { margin: 0; }
.exam-code-form { display: grid; justify-items: center; gap: 12px; }
.exam-code-form .question-field { width: 100%; }

.test-code-panel .question-field { width: 100%; }

.player-identity dl { display: grid; gap: 6px; margin: 0 0 18px; }
.player-identity dt { color: var(--muted); }
.player-identity dd { margin: 0 0 8px; overflow-wrap: anywhere; }
.player-identity-feedback { margin: 14px 0 0; }
.player-identity-feedback:empty { display: none; }

.player-dashboard-card {
  width: min(100%, 420px);
  min-width: 0;
  padding: 20px;
  border: 1px solid rgb(223 213 255 / 26%);
  border-radius: 16px;
  background: rgb(8 16 35 / 85%);
  backdrop-filter: blur(12px);
}
.player-dashboard-card h2 { margin: 0 0 14px; font-size: 20px; }
.player-dashboard-card dl { margin: 0; }
.player-dashboard-card dt, .player-dashboard-card p { color: var(--muted); }
.player-dashboard-card dd { margin: 4px 0 12px; overflow-wrap: anywhere; }
.player-dashboard-card dd:last-child { margin-bottom: 0; }
.player-dashboard-card p { margin: 12px 0 0; }
.player-dashboard-card button:disabled { opacity: .7; cursor: default; }

.citizen-exam-access { white-space: nowrap; }
.citizen-exam-access span { display: block; color: var(--muted); margin-top: 5px; }
.citizen-exam-access span:empty { display: none; }
.citizen-exam-access button:disabled { opacity: .6; cursor: default; }
