:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f3f7f6;
  color: #16302b;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
}

button,
input,
select,
textarea {
  box-sizing: border-box;
  font: inherit;
}

button {
  min-height: 48px;
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 0.7rem;
  background: #176f5f;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.button-link {
  display: inline-flex;
  min-height: 48px;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  border-radius: 0.7rem;
  background: #176f5f;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

button.secondary {
  border: 1px solid #9bbcb4;
  background: #fff;
  color: #176f5f;
}

button.danger {
  background: #a53e3e;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.small {
  min-height: 36px;
  padding: 0.4rem 0.65rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-weight: 650;
}

.checkbox-label {
  display: flex;
  align-items: center;
  margin-block: 0.65rem;
}

.checkbox-label input {
  width: auto;
  min-height: auto;
}

hr {
  margin-block: 1.25rem;
  border: 0;
  border-top: 1px solid #d8e7e3;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.75rem;
  border: 1px solid #b8cec9;
  border-radius: 0.55rem;
  background: #fff;
  color: #16302b;
}

textarea {
  resize: vertical;
}

.display-code-input,
.display-access-code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.display-access {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.stack {
  display: grid;
  gap: 0.85rem;
}

.shell {
  width: min(38rem, calc(100% - 3rem));
  padding: 2.5rem;
  border: 1px solid #cbded9;
  border-radius: 1.25rem;
  background: #ffffff;
  box-shadow: 0 1rem 3rem rgb(22 48 43 / 10%);
}

.eyebrow {
  margin: 0;
  color: #277868;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin-block: 0.4rem 1rem;
}

dl div {
  display: flex;
  gap: 1rem;
  padding-block: 0.5rem;
}

dt {
  min-width: 6rem;
  font-weight: 700;
}

dd {
  margin: 0;
}

a {
  color: #116b5b;
}

.dashboard-body {
  display: block;
  padding: 1.25rem;
}

.topbar,
.dashboard {
  width: min(78rem, 100%);
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.topbar h1,
.panel h2,
.panel h3 {
  margin-block: 0.25rem 0.8rem;
}

.offline-banner {
  position: sticky;
  z-index: 5;
  top: 0.5rem;
  width: min(78rem, calc(100% - 2rem));
  box-sizing: border-box;
  margin: 0 auto 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid #b45309;
  border-radius: 0.7rem;
  background: #fffbeb;
  color: #78350f;
  font-weight: 700;
}

.dashboard {
  display: grid;
  gap: 1rem;
}

.panel {
  padding: 1.25rem;
  border: 1px solid #cbded9;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 0.4rem 1.4rem rgb(22 48 43 / 6%);
}

.course-content {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.course-context,
.course-context-status {
  color: #176f5f;
  font-weight: 700;
  overflow-wrap: anywhere;
}

#confirm-course,
#toggle-roster-management {
  margin-block: 0.8rem;
}

.form-grid,
.live-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.session-controls {
  display: grid;
  grid-template-columns: minmax(13rem, 2fr) minmax(10rem, 1fr) repeat(3, auto);
  align-items: end;
  gap: 0.65rem;
}

.actions,
.section-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

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

.compact {
  flex-wrap: nowrap;
}

.hint,
.message,
.attendance-row span {
  color: #5a6e69;
}

.result {
  overflow: auto;
  min-height: 2.5rem;
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: #f4f8f7;
}

.maintenance-panel {
  border-color: #a9c7bf;
}

.maintenance-card {
  padding: 1rem;
  border: 1px solid #d8e7e3;
  border-radius: 0.8rem;
  background: #f8fbfa;
}

.maintenance-danger-card {
  border-color: #e4b8b8;
  background: #fffafa;
}

.maintenance-alert {
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid #b45309;
  border-radius: 0.7rem;
  background: #fffbeb;
  color: #78350f;
  font-weight: 700;
}

.maintenance-alert.error {
  border-color: #a53e3e;
  background: #fff1f1;
  color: #7f1d1d;
}

.maintenance-list {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.maintenance-row {
  display: grid;
  grid-template-columns: minmax(12rem, 2fr) repeat(3, minmax(7rem, 1fr));
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem;
  border: 1px solid #d8e7e3;
  border-radius: 0.65rem;
  background: #fff;
}

.maintenance-row strong,
.maintenance-row span {
  overflow-wrap: anywhere;
}

.attendance-list {
  display: grid;
  gap: 0.45rem;
  max-height: 30rem;
  overflow: auto;
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.audit-grid > section {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid #d8e7e3;
  border-radius: 0.75rem;
  background: #f8fbfa;
}

.audit-grid .attendance-list {
  max-height: 24rem;
}

.audit-grid .attendance-row {
  align-items: flex-start;
}

.audit-voided {
  opacity: 0.68;
  background: #f3f4f6;
}

.attendance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem;
  border: 1px solid #d8e7e3;
  border-radius: 0.65rem;
}

.attendance-row.overdue {
  border-color: #c2410c;
  background: #fff7ed;
}

.attendance-row div:first-child {
  display: grid;
}

.draw-button {
  width: 100%;
  min-height: 70px;
  font-size: 1.25rem;
}

.session-secondary-actions {
  margin-top: 0.75rem;
}

.teacher-qr {
  margin-block: 0.75rem;
  padding: 1rem;
  border-radius: 0.8rem;
  background: #fff;
  text-align: center;
}

.teacher-qr svg {
  width: min(20rem, 80vw);
  max-width: 100%;
  height: auto;
}

.draw-result {
  margin-block: 0.8rem;
  padding: 1.2rem;
  border-radius: 0.8rem;
  background: #e5f3ef;
  font-size: 1.25rem;
  font-weight: 750;
  text-align: center;
}

.member-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.45rem 0.25rem 0;
  padding: 0.35rem 0.55rem;
  border-radius: 0.5rem;
  background: #fff;
  font-size: 0.9rem;
  font-weight: 500;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: min(26rem, calc(100% - 2rem));
  padding: 0.8rem 1rem;
  border-radius: 0.7rem;
  background: #16302b;
  color: #fff;
  opacity: 0;
  transform: translateY(1rem);
  transition: 160ms ease;
  pointer-events: none;
  z-index: 30;
}

.toast.error {
  background: #8d3131;
}

.toast.visible {
  opacity: 1;
  transform: none;
}

.live-body {
  display: block;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: #edf4f2;
}

.live-app {
  width: min(100%, 34rem);
  height: 100vh;
  height: 100dvh;
  box-sizing: border-box;
  margin-inline: auto;
  overflow: hidden;
  background: #f8fbfa;
  box-shadow: 0 0 2rem rgb(22 48 43 / 12%);
}

#write-recovery {
  position: fixed;
  z-index: 60;
  top: max(0.5rem, env(safe-area-inset-top));
  right: 0.5rem;
  width: min(26rem, calc(100vw - 1rem));
  max-height: 40vh;
  box-sizing: border-box;
  overflow: auto;
  padding: 0.75rem;
  border: 2px solid #b45309;
  border-radius: 0.75rem;
  background: #fffbeb;
  color: #16302b;
  box-shadow: 0 0.3rem 1rem rgb(22 48 43 / 18%);
}

#write-recovery p { margin: 0 0 0.5rem; }
#write-recovery button { min-height: 44px; }

.live-offline-banner {
  position: fixed;
  z-index: 40;
  top: env(safe-area-inset-top, 0);
  left: 50%;
  width: min(100%, 34rem);
  box-sizing: border-box;
  padding: 0.35rem 0.7rem;
  transform: translateX(-50%);
  background: #92400e;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 750;
  text-align: center;
}

.live-setup,
.live-console,
.live-overlay-screen {
  height: 100%;
  box-sizing: border-box;
  padding-top: max(0.75rem, env(safe-area-inset-top));
  padding-right: max(0.75rem, env(safe-area-inset-right));
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  padding-left: max(0.75rem, env(safe-area-inset-left));
}

.live-setup {
  display: flex;
  flex-direction: column;
  gap: clamp(0.4rem, 1.4vh, 0.8rem);
  overflow: hidden;
}

.live-setup-header,
.live-console-header,
.live-overlay-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
}

.live-setup-header h1 {
  margin: 0.1rem 0 0;
  font-size: clamp(1.45rem, 6vw, 2rem);
}

.live-setup-header .eyebrow {
  font-size: 0.72rem;
}

.live-text-link {
  min-height: 44px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  padding-inline: 0.55rem;
  font-weight: 700;
}

.live-setup-form {
  min-height: 0;
  display: grid;
  flex: 1;
  grid-template-rows: repeat(2, minmax(3.3rem, auto)) minmax(3.3rem, auto) minmax(3.3rem, auto) minmax(1rem, auto) minmax(48px, auto);
  gap: clamp(0.35rem, 1.2vh, 0.7rem);
  padding: clamp(0.7rem, 2vh, 1rem);
  border: 1px solid #cbded9;
  border-radius: 1rem;
  background: #fff;
}

.live-setup-form label {
  min-width: 0;
  gap: 0.2rem;
  font-size: 0.82rem;
}

.live-setup-form input,
.live-setup-form select {
  min-height: 44px;
  padding-block: 0.45rem;
}

.live-setup-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.live-setup-status {
  min-height: 1rem;
  margin: 0;
  overflow: hidden;
  color: #5a6e69;
  font-size: 0.78rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-enter-button {
  width: 100%;
  min-height: 48px;
}

.live-console {
  display: grid;
  grid-template-rows: 48px 24px 48px minmax(0, 1fr);
  gap: 0.35rem;
  overflow: hidden;
}

.live-console-header {
  height: 48px;
}

.live-icon-button {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 2rem;
  line-height: 1;
}

.live-course-title {
  min-width: 0;
  display: grid;
  flex: 1;
  line-height: 1.15;
}

.live-course-title strong,
.live-course-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-course-title strong {
  font-size: 1rem;
}

.live-course-title span {
  color: #5a6e69;
  font-size: 0.76rem;
}

.live-claim-button {
  min-width: 86px;
  min-height: 44px;
  padding: 0.45rem 0.55rem;
  white-space: nowrap;
}

.live-display-button {
  min-width: 54px;
  min-height: 44px;
  padding: 0.4rem;
  white-space: nowrap;
}

.live-claim-button.has-items {
  border-color: #c2410c;
  background: #fff7ed;
  color: #9a3412;
}

.live-badge {
  min-width: 1.3rem;
  display: inline-flex;
  justify-content: center;
  padding: 0.1rem 0.25rem;
  border-radius: 999px;
  background: #176f5f;
  color: #fff;
}

.live-claim-button.has-items .live-badge {
  background: #c2410c;
}

.live-message {
  height: 24px;
  margin: 0;
  overflow: hidden;
  color: #277868;
  font-size: 0.78rem;
  line-height: 24px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-message.error {
  color: #a53e3e;
}

.live-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.live-tab {
  min-height: 48px;
  padding-block: 0.45rem;
}

.live-tab.active {
  box-shadow: inset 0 -3px 0 #0d4f43;
}

.live-panel {
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid #cbded9;
  border-radius: 1rem;
  background: #fff;
}

.live-draw-panel {
  display: grid;
  grid-template-rows: 36px minmax(5.5rem, 1fr) minmax(0, auto) 58px auto;
  gap: 0.45rem;
  padding: 0.65rem;
}

.live-draw-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  color: #5a6e69;
  font-size: 0.8rem;
}

.live-inline-button {
  min-height: 36px;
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
}

.live-draw-result {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 0.5rem;
  border-radius: 0.8rem;
  background: #e5f3ef;
  text-align: center;
}

.live-draw-names {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 0.6rem;
  font-size: clamp(1.8rem, 9vw, 3rem);
  font-weight: 800;
  line-height: 1.12;
}

.live-draw-names .absent {
  color: #8d3131;
  font-size: 0.55em;
  text-decoration: line-through;
}

.live-placeholder {
  margin: auto;
  color: #6b7d78;
  text-align: center;
}

.live-member-choices {
  max-height: 3.2rem;
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  overflow: auto;
}

.live-member-choice {
  min-height: 36px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.25rem;
  padding-inline: 0.5rem;
  border: 1px solid #d8e7e3;
  border-radius: 0.55rem;
  background: #fff;
  font-size: 0.75rem;
  font-weight: 650;
}

.live-member-choice input {
  width: 1rem;
  min-height: auto;
  margin: 0;
}

.live-primary-action {
  width: 100%;
  min-height: 58px;
  font-size: 1.2rem;
}

.live-draw-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.35rem;
}

.live-draw-actions button {
  min-width: 0;
  min-height: 48px;
  padding: 0.4rem 0.2rem;
}

.live-attendance-panel {
  display: grid;
  grid-template-rows: 52px 48px 48px minmax(0, 1fr);
  gap: 0.45rem;
  padding: 0.65rem;
}

.live-attendance-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.live-attendance-summary strong {
  font-size: 1.65rem;
}

.live-attendance-summary small {
  color: #5a6e69;
}

.live-status-pill {
  flex: 0 0 auto;
  padding: 0.3rem 0.5rem;
  border-radius: 999px;
  background: #f1f5f4;
  color: #5a6e69;
  font-size: 0.75rem;
  font-weight: 750;
}

.live-status-pill.open {
  background: #dcfce7;
  color: #166534;
}

.live-checkin-actions {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.9fr;
  gap: 0.35rem;
}

.live-checkin-actions button,
.live-search-form button {
  min-width: 0;
  min-height: 48px;
  padding-inline: 0.35rem;
  font-size: 0.83rem;
}

.live-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 4.2rem;
  gap: 0.35rem;
}

.live-search-form input {
  min-width: 0;
  min-height: 48px;
}

.live-search-results {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 0.4rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.live-student-card {
  display: grid;
  grid-template-columns: minmax(5.5rem, 1fr) repeat(2, auto);
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem;
  border: 1px solid #d8e7e3;
  border-radius: 0.65rem;
}

.live-student-identity {
  min-width: 0;
  display: grid;
}

.live-student-identity strong,
.live-student-identity span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-student-identity span {
  color: #5a6e69;
  font-size: 0.7rem;
}

.live-student-actions {
  display: grid;
  grid-template-columns: repeat(3, 36px);
  gap: 0.2rem;
}

.live-student-actions button {
  width: 36px;
  min-height: 44px;
  padding: 0;
}

.live-overlay-screen {
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr) auto auto auto;
  gap: 0.65rem;
  overflow: hidden;
  background: #f8fbfa;
}

.live-overlay-header h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 1.2rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-overlay-header > span {
  min-width: 44px;
  color: #5a6e69;
  font-size: 0.78rem;
  text-align: right;
}

.live-overlay-card {
  min-height: 0;
  display: grid;
  align-content: center;
  gap: 0.65rem;
  overflow: auto;
  padding: 1rem;
  border: 1px solid #cbded9;
  border-radius: 1rem;
  background: #fff;
  text-align: center;
}

.live-overlay-name {
  font-size: clamp(2rem, 10vw, 3.2rem);
  line-height: 1.1;
}

.live-claim-score-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.live-claim-score-actions button,
.live-confirm-claim,
.live-later-button {
  min-height: 56px;
  font-size: 1.05rem;
}

.live-claim-score-actions button.selected {
  outline: 3px solid #f59e0b;
  outline-offset: 1px;
}

.live-deferred-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.live-deferred-actions button {
  min-height: 52px;
}

.live-qr-screen {
  grid-template-rows: 48px minmax(0, 1fr) auto 52px;
}

.live-qr-code {
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 0.5rem;
  border-radius: 1rem;
  background: #fff;
}

.live-qr-code svg {
  width: min(100%, 65vh);
  aspect-ratio: 1;
  height: auto;
  max-height: 100%;
}

.live-qr-expiry {
  margin: 0;
  color: #5a6e69;
  font-size: 0.78rem;
  text-align: center;
}

.live-display-screen {
  grid-template-rows: 48px minmax(0, 1fr) 52px;
}

.live-display-card {
  align-content: center;
}

.live-display-entry-url {
  overflow-wrap: anywhere;
  font-size: clamp(1rem, 5vw, 1.4rem);
  font-weight: 750;
}

.live-display-code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: clamp(2rem, 12vw, 3.8rem);
  font-weight: 850;
  letter-spacing: 0.1em;
  line-height: 1.1;
}

@media (max-height: 640px) {
  .live-setup,
  .live-console,
  .live-overlay-screen {
    padding-top: max(0.4rem, env(safe-area-inset-top));
    padding-bottom: max(0.4rem, env(safe-area-inset-bottom));
  }

  .live-setup-form {
    gap: 0.25rem;
    padding: 0.55rem;
  }

  .live-setup-header h1 {
    font-size: 1.3rem;
  }

  .live-draw-panel {
    grid-template-rows: 36px minmax(4rem, 1fr) minmax(0, auto) 52px auto;
    gap: 0.3rem;
  }

  .live-primary-action {
    min-height: 52px;
  }
}

@media (max-width: 350px) {
  .live-console-header {
    gap: 0.3rem;
  }

  .live-display-button {
    min-width: 48px;
    padding-inline: 0.25rem;
    font-size: 0.76rem;
  }

  .live-claim-button {
    min-width: 78px;
    padding-inline: 0.35rem;
    font-size: 0.78rem;
  }

  .live-draw-actions {
    gap: 0.2rem;
  }

  .live-draw-actions button {
    font-size: 0.78rem;
  }

  .live-student-card {
    grid-template-columns: 1fr;
  }

  .live-student-actions {
    grid-template-columns: repeat(3, 1fr);
  }

  .live-student-actions button {
    width: auto;
  }
}

.student-shell {
  max-width: 32rem;
}

.identity-card {
  display: grid;
  gap: 0.2rem;
  margin-block: 1rem;
  padding: 1.1rem;
  border-radius: 0.8rem;
  background: #e5f3ef;
  font-size: 1.25rem;
  text-align: center;
}

.metrics {
  display: grid;
  gap: 0.25rem;
}

.metrics div {
  justify-content: space-between;
  border-bottom: 1px solid #d8e7e3;
}

.display-body {
  --display-edge: clamp(0.75rem, 2vh, 2rem);
  box-sizing: border-box;
  display: block;
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--display-edge);
  background: #edf4f2;
}

.display-shell {
  width: min(90rem, 100%);
  min-height: calc(100vh - 2 * var(--display-edge));
  min-height: calc(100svh - 2 * var(--display-edge));
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(12rem, 0.8fr) minmax(0, 1.25fr);
  gap: clamp(0.75rem, 2vw, 2rem);
  align-items: center;
}

.display-shell section {
  min-width: 0;
}

.display-shell.checkin-closed {
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
}

.display-shell h1 {
  font-size: clamp(2rem, 4vw, 4.5rem);
}

.display-subtitle {
  font-size: clamp(1.2rem, 2vw, 2rem);
}

.count-card {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: clamp(2rem, 6vw, 6rem);
}

.count-card small {
  font-size: 1rem;
}

.presentation-tools {
  display: grid;
  justify-items: start;
  gap: 0.2rem;
  margin-top: 0.8rem;
}

.presentation-tools button {
  white-space: nowrap;
}

.presentation-tools .message {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.82rem;
}

.qr-panel,
.draw-stage {
  padding: 1.5rem;
  border-radius: 1.2rem;
  background: #fff;
  text-align: center;
}

.qr-panel svg {
  width: min(42vh, 22vw, 20rem);
  max-width: 100%;
  aspect-ratio: 1;
  max-height: 42vh;
  height: auto;
}

.draw-stage {
  display: grid;
  min-height: min(55vh, 28rem);
  align-content: center;
}

.display-shell.checkin-closed .draw-stage {
  min-height: min(70vh, 36rem);
}

#display-draw,
.display-pip-draw {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  min-height: 0;
  font-size: clamp(2rem, 4.2vw, 5rem);
  font-weight: 800;
  line-height: 1.2;
}

#display-draw .draw-name:not(:last-child)::after,
.display-pip-draw .draw-name:not(:last-child)::after {
  content: "、";
}

.display-shell.checkin-closed #display-draw {
  font-size: clamp(3rem, 6vw, 7rem);
}

.draw-shuffle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25em;
}

.draw-shuffle-card {
  display: grid;
  width: 1.1em;
  aspect-ratio: 0.78;
  place-items: center;
  border-radius: 0.14em;
  background: #176f5f;
  color: #fff;
  box-shadow: 0 0.08em 0.2em rgb(17 67 57 / 24%);
  animation: draw-card-shuffle 140ms ease-in-out infinite alternate;
}

.draw-shuffle-card:nth-child(2) {
  animation-delay: 55ms;
}

.draw-shuffle-card:nth-child(3) {
  animation-delay: 110ms;
}

.draw-reveal .draw-name {
  animation: draw-name-reveal 220ms ease-out both;
}

@keyframes draw-card-shuffle {
  from {
    translate: 0 -0.08em;
    rotate: -3deg;
  }
  to {
    translate: 0 0.08em;
    rotate: 3deg;
  }
}

@keyframes draw-name-reveal {
  from {
    opacity: 0;
    scale: 0.86;
  }
  to {
    opacity: 1;
    scale: 1;
  }
}

.display-pip-body {
  box-sizing: border-box;
  min-height: 100vh;
  margin: 0;
  padding: 0.8rem;
  overflow: hidden;
  background: #edf4f2;
  color: #12352f;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.display-pip-shell {
  box-sizing: border-box;
  display: grid;
  min-height: calc(100vh - 1.6rem);
  grid-template-rows: auto auto auto 1fr;
  align-content: center;
  padding: 0.9rem 1.1rem;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 0.4rem 1.2rem rgb(17 67 57 / 12%);
  text-align: center;
}

.display-pip-label,
.display-pip-session {
  margin: 0;
  color: #5a6e69;
}

.display-pip-label {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.display-pip-course {
  margin: 0.25rem 0 0;
  overflow: hidden;
  font-size: clamp(1rem, 6vw, 1.6rem);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.display-pip-session {
  margin-top: 0.2rem;
  font-size: clamp(0.75rem, 4vw, 1rem);
}

.display-pip-draw {
  align-content: center;
  align-items: center;
  min-height: 0;
  font-size: clamp(2rem, 13vw, 4rem);
  font-weight: 800;
  line-height: 1.1;
}

@media (prefers-reduced-motion: reduce) {
  .draw-shuffle-card,
  .draw-reveal .draw-name {
    animation: none;
  }
}

@media (max-width: 760px) {
  .dashboard-body {
    padding: 0.7rem;
  }

  .form-grid,
  .live-grid,
  .audit-grid,
  .session-controls,
  .maintenance-row,
  .display-shell {
    grid-template-columns: 1fr;
  }

  .draw-stage {
    grid-column: auto;
    min-height: auto;
  }

  .display-shell {
    min-height: auto;
  }

  .display-shell.checkin-closed {
    grid-template-columns: 1fr;
  }

  .display-shell.checkin-closed .draw-stage {
    min-height: auto;
  }

  .qr-panel svg {
    width: min(18rem, 70vw);
    max-height: none;
  }

  .attendance-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
:root .roster-students { display: grid; gap: .65rem; margin: 1rem 0; max-height: 30rem; overflow-y: auto; }
:root .roster-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; border: 1px solid #cbded7; border-radius: .65rem; padding: .75rem; overflow-wrap: anywhere; }
:root .roster-card details { grid-column: 1; }
:root .roster-card button { grid-column: 2; }
:root .roster-change { padding: .65rem; border-bottom: 1px solid #dbe6e1; overflow-wrap: anywhere; }
:root #school-roster-details { max-height: 30rem; overflow-y: auto; }
:root #school-roster-details summary { cursor: pointer; padding: .6rem 0; }
:root #school-roster-result { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  :root .roster-card { grid-template-columns: minmax(0, 1fr); }
  :root .roster-card button, :root .roster-card details { grid-column: 1; }
  :root #school-roster-mapping { grid-template-columns: minmax(0, 1fr); }
}
/* Task navigation and activity worksheets share existing classroom styling. */
.task-nav { display:flex; flex-wrap:wrap; gap:.5rem; grid-column:1 / -1; position:sticky; top:0; z-index:2; background:var(--background,#f5f7f6); padding:.75rem; }
.task-nav button { flex:1 1 130px; }
.task-nav [aria-pressed="true"] { outline:3px solid #8ec9b9; }
.course-picker { grid-column:1 / -1; }
[data-new-ui="true"] .panel[data-task="activities"] { grid-column:1 / -1; }
.table-scroll { overflow:auto; max-height:420px; margin:1rem 0; }
.table-scroll table { border-collapse:collapse; min-width:100%; }
.table-scroll th,.table-scroll td { padding:.5rem; border:1px solid #d6e2df; white-space:nowrap; }
#display-activity-qr svg { width:min(40vw,260px); height:auto; }
#activity-score-workspace { border-top:1px solid #d6e2df; padding-top:1rem; }
