:root {
  color-scheme: dark;
  --bg: #02040a;
  --panel: rgba(9, 16, 28, .86);
  --panel-2: rgba(14, 25, 43, .92);
  --line: rgba(136, 180, 255, .22);
  --line-strong: rgba(96, 224, 255, .52);
  --text: #f6f9ff;
  --muted: #aab8cf;
  --gold: #ffd76b;
  --red: #ff4964;
  --green: #35f0a0;
  --cyan: #5ee7ff;
  --blue: #6f8dff;
  --violet: #b66dff;
  --hot: #ff2f8d;
  --shadow: 0 34px 120px rgba(0, 0, 0, .62);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 80% 12%, rgba(94, 231, 255, .34), transparent 28%),
    radial-gradient(circle at 15% 18%, rgba(182, 109, 255, .24), transparent 26%),
    radial-gradient(circle at 18% 86%, rgba(255, 47, 141, .22), transparent 30%),
    linear-gradient(135deg, #02040a 0%, #07111f 44%, #16071b 100%);
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    linear-gradient(rgba(94, 231, 255, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(182, 109, 255, .065) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  animation: grid-drift 18s linear infinite;
}

body::after {
  background:
    linear-gradient(180deg, transparent 0%, rgba(94, 231, 255, .08) 49%, transparent 50%),
    radial-gradient(circle at 50% 120%, rgba(255, 215, 107, .12), transparent 45%);
  background-size: 100% 9px;
  mix-blend-mode: screen;
  opacity: .42;
}

@keyframes grid-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(46px, 46px, 0); }
}

@keyframes pulse-line {
  0%, 100% { opacity: .42; transform: translateX(-8%); }
  50% { opacity: 1; transform: translateX(8%); }
}

@keyframes glow-shift {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(94, 231, 255, .35)); }
  50% { filter: drop-shadow(0 0 24px rgba(255, 215, 107, .35)); }
}

@keyframes title-flow {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes panel-breathe {
  0%, 100% { box-shadow: var(--shadow), 0 0 38px rgba(94, 231, 255, .12), inset 0 1px 0 rgba(255, 255, 255, .08); }
  50% { box-shadow: var(--shadow), 0 0 70px rgba(182, 109, 255, .2), inset 0 1px 0 rgba(255, 255, 255, .1); }
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  position: relative;
}

.login-card {
  width: min(100%, 980px);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(94, 231, 255, .34);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .11), transparent 24%),
    linear-gradient(225deg, rgba(94, 231, 255, .09), transparent 34%),
    linear-gradient(180deg, rgba(9, 16, 28, .96), rgba(4, 9, 17, .92));
  box-shadow: var(--shadow), 0 0 38px rgba(94, 231, 255, .12), inset 0 1px 0 rgba(255, 255, 255, .08);
  padding: 32px;
  backdrop-filter: blur(18px);
  animation: panel-breathe 7s ease-in-out infinite;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 24px;
  right: 24px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--blue), var(--violet), var(--hot), var(--gold), transparent);
  animation: pulse-line 2.8s ease-in-out infinite;
}

.login-card::after {
  content: "";
  position: absolute;
  right: -120px;
  top: -120px;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(94, 231, 255, .3);
  background:
    linear-gradient(45deg, transparent 46%, rgba(94, 231, 255, .18) 47%, rgba(94, 231, 255, .18) 53%, transparent 54%),
    radial-gradient(circle, rgba(94, 231, 255, .2), transparent 64%);
  transform: rotate(22deg);
  pointer-events: none;
}

.login-brand {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 28px;
  position: relative;
  z-index: 1;
}

.mark {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 1px solid rgba(94, 231, 255, .75);
  background:
    linear-gradient(145deg, rgba(94, 231, 255, .28), transparent 42%),
    linear-gradient(315deg, rgba(255, 47, 141, .24), rgba(255, 215, 107, .18)),
    #07101c;
  color: var(--gold);
  font-weight: 1000;
  font-size: 22px;
  box-shadow: 0 0 0 6px rgba(94, 231, 255, .04), 0 0 34px rgba(94, 231, 255, .24);
  animation: glow-shift 5s ease-in-out infinite;
}

h1, h2, h3, p { margin: 0; }
h1 {
  font-size: clamp(36px, 5vw, 62px);
  line-height: .95;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0;
  color: transparent;
  background: linear-gradient(90deg, #ffffff, var(--cyan), var(--gold), var(--hot), #ffffff);
  background-size: 260% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: 0 0 34px rgba(94, 231, 255, .16);
  animation: title-flow 5s ease-in-out infinite;
}
h2 { font-size: 25px; margin: 10px 0 8px; }
h3 { font-size: 17px; }

.eyebrow,
.tag {
  width: fit-content;
  color: var(--gold);
  border: 1px solid rgba(255, 215, 107, .36);
  background: rgba(255, 215, 107, .07);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-copy {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.brand-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.brand-chips span {
  border: 1px solid rgba(94, 231, 255, .34);
  background: linear-gradient(180deg, rgba(94, 231, 255, .12), rgba(255, 255, 255, .03));
  color: #dff9ff;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.wl-form,
.admin-panel,
.admin-view,
.exam-form,
.exam-list,
.manual-box {
  display: grid;
  gap: 14px;
}

.tabs,
.admin-tabs {
  display: grid;
  gap: 8px;
}

.tabs {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  line-height: 1.4;
}

input, select, textarea, button {
  width: 100%;
  min-height: 44px;
  font: inherit;
}

input, select, textarea {
  color: var(--text);
  background: rgba(3, 8, 15, .82);
  border: 1px solid var(--line);
  padding: 12px 13px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(94, 231, 255, .12);
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

button {
  border: 1px solid var(--line);
  color: var(--text);
  background: linear-gradient(180deg, rgba(24, 38, 62, .95), rgba(10, 17, 29, .94));
  padding: 0 16px;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 10px 28px rgba(94, 231, 255, .12);
}

button.primary,
.admin-tab.active {
  border-color: rgba(255, 215, 107, .9);
  color: #080b10;
  background: linear-gradient(90deg, #ff2f8d, #ffd76b 48%, #5ee7ff);
  background-size: 180% 100%;
  font-weight: 1000;
  box-shadow: 0 0 24px rgba(255, 215, 107, .2);
  animation: title-flow 5s ease-in-out infinite;
}

.tab {
  min-height: 40px;
  color: var(--muted);
  background: rgba(3, 8, 15, .72);
}

.tab.active {
  color: var(--text);
  border-color: var(--cyan);
  background: linear-gradient(180deg, rgba(94, 231, 255, .15), rgba(14, 25, 43, .92));
}

.session-panel,
.admin-stats div,
.manual-box,
.admin-user,
.empty,
.character-card,
.question {
  border: 1px solid rgba(136, 180, 255, .28);
  background:
    linear-gradient(135deg, rgba(94, 231, 255, .09), transparent 32%),
    linear-gradient(225deg, rgba(182, 109, 255, .06), transparent 38%),
    rgba(5, 11, 20, .74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.session-panel {
  display: grid;
  gap: 12px;
  border-color: rgba(53, 240, 160, .38);
  background:
    linear-gradient(135deg, rgba(53, 240, 160, .12), transparent 40%),
    rgba(5, 11, 20, .74);
  padding: 18px;
}

.session-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 215, 107, .55);
  background:
    linear-gradient(145deg, rgba(255, 215, 107, .17), transparent),
    #08111d;
  background-size: cover;
  background-position: center;
  color: var(--gold);
  font-weight: 1000;
}

.avatar.small {
  width: 48px;
  height: 48px;
}

.avatar.has-image {
  color: transparent;
}

.admin-panel {
  margin-top: 18px;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.admin-head p,
.manual-box p,
.session-panel p,
.message {
  color: var(--muted);
  line-height: 1.5;
}

.admin-head button {
  max-width: 170px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.admin-stats div,
.manual-box,
.character-card,
.admin-user,
.question,
.empty {
  padding: 16px;
}

.admin-stats strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  color: var(--gold);
}

.admin-stats span,
.user-meta,
.character-grid span {
  color: var(--muted);
  font-size: 13px;
}

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

.character-grid div {
  border: 1px solid rgba(94, 231, 255, .18);
  background: rgba(14, 25, 43, .78);
  padding: 14px;
}

.character-grid span {
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.character-grid strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.admin-tools,
.form-grid,
.profile-grid {
  display: grid;
  gap: 12px;
}

.admin-tools {
  grid-template-columns: 1fr 220px;
}

.form-grid,
.profile-grid {
  grid-template-columns: 1.4fr 1fr 1fr 120px;
}

.wide {
  grid-column: 1 / -1;
}

.admin-tabs {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-top: 18px;
}

.admin-tab {
  color: var(--muted);
  background: rgba(3, 8, 15, .72);
}

.question legend {
  color: var(--text);
  font-weight: 900;
  line-height: 1.45;
  padding-right: 8px;
}

.answer {
  grid-template-columns: 20px 1fr;
  align-items: start;
  margin-top: 10px;
  color: var(--text);
}

.answer input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--cyan);
}

.admin-section-title,
.user-title,
.admin-user {
  display: flex;
  align-items: center;
}

.admin-section-title {
  justify-content: space-between;
}

#admin-count {
  color: var(--gold);
  font-weight: 900;
}

.admin-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.admin-user {
  justify-content: space-between;
  gap: 14px;
}

.admin-user-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.user-title {
  gap: 10px;
  flex-wrap: wrap;
}

.user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

code {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #dbe7ff;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
  padding: 8px;
}

.pill {
  border: 1px solid var(--line);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.pill.ok {
  color: var(--green);
  border-color: rgba(53, 240, 160, .38);
  background: rgba(53, 240, 160, .08);
}

.pill.warn {
  color: var(--gold);
  border-color: rgba(255, 215, 107, .38);
  background: rgba(255, 215, 107, .08);
}

.pill.bad {
  color: var(--red);
  border-color: rgba(255, 73, 100, .38);
  background: rgba(255, 73, 100, .08);
}

.pill.idle {
  color: var(--muted);
}

.admin-actions {
  width: 240px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.admin-actions.single {
  grid-template-columns: 1fr;
  width: 128px;
}

.role-control {
  width: 150px;
}

button.danger {
  border-color: rgba(255, 73, 100, .5);
  color: #ffd7dc;
  background: rgba(255, 73, 100, .13);
}

button:disabled {
  opacity: .42;
  cursor: not-allowed;
}

.message {
  min-height: 24px;
  margin-top: 16px;
  color: var(--gold);
  font-weight: 800;
}

.site-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.copyright-symbol {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(94, 231, 255, .45);
  color: var(--cyan);
  background: rgba(94, 231, 255, .08);
  font-size: 17px;
  line-height: 1;
}

.hidden { display: none !important; }

@media (max-width: 760px) {
  .login-shell { padding: 14px; }
  .login-card { padding: 22px; }
  .login-brand { align-items: flex-start; }
  .mark { width: 56px; height: 56px; }
  h1 { font-size: 36px; }
  .admin-head,
  .admin-user {
    align-items: stretch;
    flex-direction: column;
  }
  .admin-head button,
  .admin-actions,
  .role-control {
    max-width: none;
    width: 100%;
  }
  .admin-stats,
  .form-grid,
  .profile-grid,
  .admin-tools,
  .admin-tabs,
  .character-grid {
    grid-template-columns: 1fr;
  }
}
