#classroom {
  max-width: 780px;
  margin-inline: auto;
  min-width: 0;
}

.classroom-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 14px;
  padding: clamp(13px, 3.5vw, 24px) clamp(14px, 5vw, 28px);
  border: 1px solid #ddc9ee;
  border-radius: 21px;
  background: linear-gradient(120deg, #ebddf9, #f7ecfc);
}

.classroom-header p { margin-top: 6px; }

.classroom-header h1 {
  font-size: clamp(23px, 5vw, 40px);
  font-weight: 850;
  line-height: 1.16;
  letter-spacing: -.05em;
  word-break: keep-all;
}

.classroom-header p, .classroom-pane > p, .classroom-help {
  color: #604771;
  font-size: 14px;
  line-height: 1.5;
  word-break: keep-all;
}

.classroom-entry {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.classroom-pane {
  display: grid;
  min-width: 0;
  justify-items: start;
  gap: 11px;
  padding: clamp(13px, 3.5vw, 22px);
}

.classroom-pane fieldset { width: 100%; margin: 0; }
.classroom-pane .classroom-settings {
  padding: 6px 9px;
  border-radius: 8px;
  background: #f1e6fa;
  font-size: 12px;
  font-weight: 750;
}

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

.classroom-modes label {
  display: flex;
  align-items: start;
  gap: 5px;
  padding: 8px 5px;
  border: 1px solid #decaed;
  border-radius: 10px;
  background: #fcf7ff;
  cursor: pointer;
}

.classroom-modes label:has(input:checked) { border-color: #925fb4; background: #f3e3fb; }
.classroom-modes label:focus-within { outline: 2px solid #7841aa; outline-offset: 2px; }
.classroom-modes input { flex: none; margin: 3px 2px; accent-color: #75429b; }
.classroom-modes strong, .classroom-modes small { display: block; line-height: 1.3; word-break: keep-all; }
.classroom-modes strong { font-size: 14px; }
.classroom-modes small { margin-top: 3px; color: #604771; font-size: 11px; }
.classroom-input-label { color: #604771; font-size: 13px; font-weight: 780; }

.classroom-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

#classroom-code {
  width: 110px;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid #af91c3;
  border-radius: 10px;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-family: ui-monospace, monospace;
  font-weight: 850;
}

.classroom-room { display: grid; gap: 12px; padding: clamp(13px, 3.5vw, 22px); }
.classroom-room-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.classroom-identity, .classroom-code-card {
  display: grid;
  justify-items: start;
  align-content: center;
  min-width: 105px;
  min-height: 78px;
  gap: 4px;
  padding: 8px 11px;
  border: 1px solid #dac5ec;
  border-radius: 13px;
  color: #553574;
  background: #f1e6fa;
}

.classroom-identity { border-color: #e4c878; color: #553844; background: #fff2b6; }
.classroom-identity span, .classroom-code-card span { font-size: 12px; font-weight: 720; }
.classroom-identity strong, .classroom-code-card strong { font-size: clamp(19px, 5vw, 29px); font-weight: 900; line-height: 1.12; }
.classroom-code-card strong { letter-spacing: .08em; font-family: ui-monospace, monospace; }
.classroom-identity .classroom-team { padding: 3px 6px; border-radius: 6px; background: #fff9dd; }
.classroom-mode { color: #563980; font-size: 13px; font-weight: 800; }
.classroom-count { margin-top: 3px; font-size: 20px; font-weight: 850; }
.classroom-help { margin-top: 5px; }
.classroom-leave { background: #fffafc; }

.classroom-notice { color: #5f4471; font-size: 14px; font-weight: 700; }
.classroom-notice:not(:empty) { margin-block: 11px 6px; padding: 7px 9px; border-radius: 8px; background: #eee2fa; }
.classroom-notice[data-failed='true']:not(:empty) { color: #7f214c; background: #fde4ef; }

.classroom-standings { margin-top: 14px; padding: clamp(10px, 3.2vw, 20px); }
.classroom-score-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 5px 12px; margin-bottom: 11px; }
.classroom-score-head h2, .classroom-standings h3 { margin: 0; font-size: clamp(17px, 4vw, 24px); letter-spacing: -.04em; }
.classroom-score-head p, .classroom-empty { color: #604771; font-size: 13px; font-weight: 720; }
.classroom-empty { padding: 13px 5px; }
.classroom-member-standings { margin-top: 19px; }
.classroom-member-standings h3 { margin-bottom: 9px; }

.classroom-standings table {
  width: 100%;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.classroom-standings th, .classroom-standings td { padding: 8px clamp(5px, 2vw, 12px); text-align: left; }
.classroom-standings thead th { border-bottom: 1px solid #d8c1e8; background: #f2e7f9; color: #5c426d; font-size: 12px; font-weight: 750; }
.classroom-standings thead th:first-child { width: 66px; border-top-left-radius: 9px; }
.classroom-standings thead th:last-child { width: 90px; border-top-right-radius: 9px; text-align: right; }
.classroom-standings tbody > tr:nth-child(even) { background: #fbf4ff; }
.classroom-standings tbody th { font-size: 15px; overflow-wrap: anywhere; }
.classroom-standings tbody small { display: block; margin-top: 1px; color: #674f74; font-size: 11px; font-weight: 680; }
.classroom-rank { color: #654779; font-size: 13px; white-space: nowrap; }
.classroom-standings .classroom-score { color: #4e2c71; font-size: 17px; font-weight: 900; text-align: right; white-space: nowrap; }
.classroom-standings tr[data-rank='1'] { background: #fff3be; }
.classroom-standings tr[data-rank='1'] td { color: #614316; }

.classroom-display-tools, .classroom-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 8px;
}

.classroom-connection {
  padding: 6px 8px;
  border-radius: 8px;
  color: #644828;
  background: #fff0c1;
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
}

.classroom-connection:empty { padding: 0; }
.classroom-connection[data-connection='live'] { color: #284e31; background: #dff2d9; }
.classroom-connection[data-connection='error'] { color: #792649; background: #ffe2ed; }
.classroom-pager button[data-part='previousPage'], .classroom-pager button[data-part='nextPage'] {
  min-width: 44px;
  padding-inline: 6px;
  font-size: 21px;
  line-height: 1;
}
.classroom-pager span { padding-inline: 2px; color: #725985; font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 780; white-space: nowrap; }

[data-classroom-tv='true'] > :not(#classroom) { visibility: hidden; }

#classroom[data-tv='true'] {
  position: fixed;
  inset: 0;
  z-index: 20;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(9px, 2.2vh, 26px) clamp(8px, 3.5vw, 60px);
  color: #fff7ff;
  background: #251835;
}

#classroom[data-tv='true'] :focus-visible { outline-color: #ffefa6; }
#classroom[data-tv='true'] .classroom-header,
#classroom[data-tv='true'] .classroom-standings { border-color: #66537a; background: #332344; }
#classroom[data-tv='true'] .classroom-header {
  margin-bottom: clamp(5px, 1.1vh, 13px);
  padding: clamp(7px, 1.4vh, 17px) clamp(9px, 2.2vw, 30px);
}
#classroom[data-tv='true'] .classroom-header h1 { font-size: clamp(22px, min(4.4vw, 6.2vh), 58px); }
#classroom[data-tv='true'] .classroom-display-tools .button,
#classroom[data-tv='true'] .classroom-pager .button { color: #332040; }
#classroom[data-tv='true'] .classroom-connection { font-size: clamp(13px, 1.7vw, 22px); }
#classroom[data-tv='true'] .classroom-standings {
  margin-top: 0;
  padding: clamp(8px, 1.7vh, 21px) clamp(9px, 2.2vw, 30px);
}
#classroom[data-tv='true'] .classroom-score-head { align-items: center; margin-bottom: clamp(5px, 1.1vh, 12px); }
#classroom[data-tv='true'] .classroom-score-head h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
#classroom[data-tv='true'] .classroom-score-head p,
#classroom[data-tv='true'] .classroom-standings h3,
#classroom[data-tv='true'] .classroom-empty { color: #f3e8ff; font-size: clamp(15px, min(2.5vw, 3.4vh), 29px); }
#classroom[data-tv='true'] .classroom-pager span { color: #fff0d4; font-size: clamp(13px, 1.7vw, 22px); }
#classroom[data-tv='true'] .classroom-member-standings { margin-top: clamp(10px, 2vh, 22px); }
#classroom[data-tv='true'] .classroom-member-standings h3 { margin-bottom: 5px; }
#classroom[data-tv='true'] .classroom-standings th,
#classroom[data-tv='true'] .classroom-standings td { padding-block: clamp(4px, .73vh, 10px); line-height: 1.12; }
#classroom[data-tv='true'] .classroom-standings thead th {
  border-color: #8c76a4;
  color: #f2e5ff;
  background: #4b3760;
  font-size: clamp(13px, min(1.9vw, 2.7vh), 25px);
}
#classroom[data-tv='true'] .classroom-standings thead th:first-child { width: clamp(42px, 13vw, 190px); }
#classroom[data-tv='true'] .classroom-standings thead th:last-child { width: clamp(65px, 21vw, 360px); white-space: nowrap; }
#classroom[data-tv='true'] .classroom-standings tbody th,
#classroom[data-tv='true'] .classroom-rank { color: #f7edff; font-size: clamp(16px, min(3.1vw, 4vh), 44px); }
#classroom[data-tv='true'] .classroom-standings tbody small {
  display: inline-block;
  margin-left: .6em;
  color: #d9c8ec;
  font-size: clamp(11px, min(1.8vw, 2.4vh), 25px);
}
#classroom[data-tv='true'] .classroom-standings .classroom-score { color: #ffeaa1; font-size: clamp(17px, min(3.35vw, 4.3vh), 49px); }
#classroom[data-tv='true'] .classroom-standings tbody > tr:nth-child(even) { background: #3d2b51; }
#classroom[data-tv='true'] .classroom-standings tbody > tr[data-rank='1'] { background: #fff0aa; }
#classroom[data-tv='true'] .classroom-standings tr[data-rank='1'] :is(th, td, small, .classroom-score) { color: #503619; }

@media (max-width: 530px) {
  .classroom-entry { grid-template-columns: 1fr; }
  .classroom-standings thead th:first-child { width: 40px; }
  .classroom-standings thead th:last-child { width: 65px; }
}
