:root {
  color-scheme: dark;
  font: 100%/1.5 system-ui, sans-serif;
  color: #f5edf3;
  background: #141018;
  --muted: #c0b3c4;
  --gold: #efd39f;
  --line: #514257;
  --panel: #231a2a;
  --field: #1a141f;
  --display: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 40% 12rem, #2a1c2e, transparent 58rem);
}
.container { width: min(100% - 3rem, 74rem); margin-inline: auto; }

.masthead {
  border-bottom: 1px solid #705b55;
  background: linear-gradient(90deg, #17101bed 0%, #211527a8 49%, #2217291f 100%),
    linear-gradient(0deg, #1b1423 0%, transparent 32%),
    #271a2f url("./oto-archives.jpg") right 46% / cover no-repeat;
}
.masthead-inner { min-height: 13.5rem; display: flex; align-items: center; gap: 1.35rem; }
.seal {
  display: grid;
  flex: none;
  place-items: center;
  width: 4.25rem;
  aspect-ratio: 1;
  border: 1px solid #a9885f;
  border-radius: 50%;
  box-shadow: inset 0 0 0 5px #211827, inset 0 0 0 6px #725964;
  background: #211827;
  color: var(--gold);
  font: 1.95rem var(--display);
}
.academy {
  color: var(--gold);
  margin: 0 0 .42rem;
  font-size: .875rem;
  font-weight: 650;
  letter-spacing: .13em;
  text-transform: uppercase;
}
h1, h2 { font: 600 2rem/1.15 var(--display); margin: 0; }
h1 { font-size: clamp(2.15rem, 5.25vw, 3.85rem); letter-spacing: -.035em; }
.muted { color: var(--muted); margin: .35rem 0 0; }

.workspace {
  display: grid;
  grid-template-columns: 12.75rem minmax(0, 1fr);
  align-items: start;
  gap: 1.35rem;
  padding-block: 1.5rem 2.5rem;
}
.class-sidebar, .register {
  border: 1px solid var(--line);
  border-radius: .85rem;
  background: var(--panel);
  box-shadow: 0 12px 32px #100c1480;
}
.class-sidebar { padding: .9rem; }
.class-sidebar h2 { margin: .25rem .3rem .75rem; font-size: 1.25rem; color: var(--gold); }
.classes { display: grid; gap: .4rem; }
.classes button {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-align: left;
  padding: .48rem;
  background: transparent;
  border-color: transparent;
}
.classes button:hover { background: #33253b; }
.classes button[aria-pressed="true"] { border-color: #ae8d65; background: #3b2a3c; }
.class-letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.45rem;
  aspect-ratio: 1;
  border: 1px solid #604d69;
  border-radius: .4rem;
  background: #2d2235;
  color: var(--gold);
  font: 1.2rem var(--display);
}
.classes button[aria-pressed="true"] .class-letter { background: var(--gold); color: #211427; border-color: var(--gold); }
.classes strong, .classes small { display: block; }
.classes small, .students small { color: var(--muted); font-size: .875rem; }

.register { padding: clamp(1rem, 2.5vw, 1.6rem); }
.register-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; }
.register-header h2 { font-size: clamp(1.8rem, 3.3vw, 2.45rem); }
.global-search {
  grid-column: 1 / -1;
  display: flex;
  align-items: end;
  gap: .65rem;
  padding: .8rem 1rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  background: var(--panel);
}
.global-search label { flex: 1; min-width: 0; color: var(--gold); font-weight: 600; }
.global-search input { width: 100%; min-width: 0; font-weight: 400; }
.points {
  margin: 1.15rem 0;
  padding: .4rem .85rem;
  border: 1px solid #775e75;
  border-radius: .6rem;
  background: linear-gradient(100deg, #34243b, #291f31);
}
.points summary { cursor: pointer; font-weight: 650; padding: .45rem 0; }
.points summary::marker { color: var(--gold); }
.points summary strong { color: var(--gold); margin-inline-start: .55rem; }
.points[open] { padding-bottom: .8rem; }
.points-form { display: flex; flex-wrap: wrap; align-items: end; gap: .65rem; }
.points-form { margin-top: .5rem; }
.points-form label:nth-child(2) input { width: 6rem; }
.points-form label:nth-child(3) { flex: 1 1 14rem; }
.points-form input { min-width: 0; }
#points-history { list-style: none; margin: .55rem 0 0; padding: 0; }
#points-history li {
  display: grid;
  grid-template-columns: minmax(4rem, auto) 1fr auto;
  gap: .3rem .75rem;
  padding: .55rem 0;
  border-top: 1px solid var(--line);
}
#points-history span { overflow-wrap: anywhere; }
#points-history time { color: var(--muted); font-size: .875rem; }
#points-history .credit { color: #a4e6bd; }
#points-history .debit { color: #ffc3c2; }
.points-transfer { margin-top: .75rem; }
.points-transfer input { max-width: 100%; }
.auth-layout { width: min(calc(100% - 2rem), 40rem); padding-block: 1.5rem; }
.login-form { display: grid; gap: 1rem; }
.teacher-form, .account { display: flex; align-items: end; gap: .75rem; flex-wrap: wrap; }
.teacher-form { margin-block: 1rem; }
.teacher-form label { flex: 1 1 12rem; }
.auth-link { color: var(--gold); text-underline-offset: .2em; }
.account { grid-column: 1 / -1; align-items: center; justify-content: end; color: var(--muted); }
.account form { margin: 0; }
.code-result { border: 1px solid #ae8d65; padding: .8rem; border-radius: .5rem; }
.code-result code { display: block; padding-block: .4rem; overflow-wrap: anywhere; color: var(--gold); }
.teachers-title { font-size: 1.35rem; }
.teacher-list { list-style: none; margin: .5rem 0 0; padding: 0; }
.teacher-list li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; border-top: 1px solid var(--line); padding: .4rem 0; }

button, input, select {
  color: inherit;
  font: inherit;
  border: 1px solid #66526d;
  border-radius: .5rem;
  background: var(--field);
  min-height: 2.75rem;
  padding: .48rem .72rem;
}
button { cursor: pointer; font-size: .9rem; }
button:hover:not(:disabled) { border-color: var(--gold); }
button:disabled { cursor: default; opacity: .6; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
label { display: grid; gap: .25rem; color: var(--muted); font-size: .875rem; }
select {
  appearance: none;
  padding-right: 2rem;
  background: linear-gradient(45deg, transparent 54%, #dfcde2 55%) right 1rem center / 5px 5px no-repeat,
    linear-gradient(-45deg, transparent 54%, #dfcde2 55%) right .7rem center / 5px 5px no-repeat, var(--field);
}
input::placeholder { color: #aa9cae; }
.primary { color: #211427; border-color: var(--gold); background: var(--gold); font-weight: 700; }
.primary:hover { background: #f8e5bf; }
#add::before { content: "+ "; }

.students {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}
.students li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  padding: .45rem .55rem .45rem .75rem;
  background: #2a2032;
  border: 1px solid #47394f;
  border-radius: .5rem;
}
.students li strong { font-weight: 600; overflow-wrap: anywhere; }
.students small { display: block; }
.students .manage { flex: none; padding-inline: .6rem; color: var(--gold); background: #211827; }
.status { border-top: 1px solid var(--line); padding-top: .75rem; margin: 1.1rem 0 0; font-size: .875rem; }
.empty { margin: 1rem 0 0; }

dialog {
  color: inherit;
  background: var(--panel);
  border: 1px solid #8f718b;
  border-radius: .85rem;
  width: min(calc(100% - 2rem), 28rem);
  padding: 1.3rem;
  box-shadow: 0 16px 70px #100b14bf;
}
dialog::backdrop { background: rgb(10 6 12 / .78); }
dialog form { display: grid; gap: 1rem; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: .5rem; }
.form-error, .danger { color: #ffc3c2; }
.form-error { margin: 0; }
.danger { border-color: #b77381; }
#remove-confirm { border-top: 1px solid var(--line); }
#remove-confirm button { margin: .25rem 0; }

@media (max-width: 58rem) {
  .students { grid-template-columns: 1fr; }
}
@media (max-width: 46rem) {
  .container { width: calc(100% - 1.5rem); }
  .masthead-inner { min-height: 10.5rem; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: .75rem; padding-top: .85rem; }
  .classes { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .3rem; }
  .classes button { flex-direction: column; gap: .25rem; text-align: center; padding: .35rem .1rem; }
  .class-letter { width: 2rem; }
  .classes strong { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
@media (max-width: 34rem) {
  .seal { width: 3rem; font-size: 1.45rem; }
  .masthead-inner { gap: .7rem; }
  #points-history li { grid-template-columns: minmax(4rem, auto) 1fr; }
  #points-history time { grid-column: 2; }
}

