/* Under the signed-in shell's fixed bar (--header-block-size, signed-in.css;
   none on a page without it, the unsubscribe page). */
.live-page {
  max-width: 720px;
  margin: 0 auto 2rem;
  padding: calc(var(--header-block-size, 0px) + 2rem) 1rem 0;
}

.live-status:not(:empty) {
  margin: 0.75rem 0 0;
  padding: 0.75rem 1rem;
  border: 1px solid #d7d3cc;
  border-radius: 8px;
  font-weight: 600;
}

.live-lead {
  margin: 0.25rem 0 0;
  color: #5c574e;
  line-height: 1.45;
}

.live-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin-top: 1rem;
}

.live-card-info,
.live-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  width: 100%;
}

.live-lobby {
  display: block;
}

.live-trainer {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.live-trainer-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.live-trainer-text strong {
  font-size: 0.95rem;
}

.live-trainer-text span {
  color: #5c574e;
  font-size: 0.75rem;
}

.live-avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: #efeae2;
  color: #3d3830;
  font-size: 0.8rem;
  font-weight: 700;
  overflow: hidden;
  flex: 0 0 auto;
}

.live-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live-class-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
}

.live-elapsed {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.live-card-live .live-badge {
  font-variant-numeric: tabular-nums;
}

.live-badge {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.live-card-badges {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.live-free-mark {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  background: #00e676;
  color: #053018;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.35;
  white-space: nowrap;
  flex: 0 0 auto;
}

.live-level,
.live-session-meta,
.live-when,
.live-note {
  margin: 0;
}

.live-level {
  font-size: 0.85rem;
  font-weight: 600;
  color: #5c574e;
}

.live-session-meta,
.live-note {
  color: #5c574e;
}

.live-when {
  font-weight: 600;
}

.live-card-live {
  border-color: #1f7a4d;
  border-left: 4px solid #1f7a4d;
  background: #f3faf6;
}

.live-card-live .live-badge {
  color: #1f7a4d;
}

.live-card-scheduled {
  border-color: #3d6fd4;
  border-left: 4px solid #3d6fd4;
  background: #f4f7ff;
}

.live-card-scheduled .live-badge {
  color: #2f5fbf;
}

.live-card.is-free {
  background: #eafff3;
  box-shadow: inset 0 0 0 2px #00e676;
}

.live-join {
  margin-top: 0.65rem;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  background: #1f7a4d;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.live-notice-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.live-notice-actions .live-leave {
  width: 100%;
}

.live-balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.75rem;
}

.live-buy-link {
  font-weight: 700;
  white-space: nowrap;
}

/* The page's own links, under its title (the navbar being the site's). */
.live-page-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
  font-weight: 700;
}

a.live-join {
  display: block;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
}

.live-empty {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid #d7d3cc;
  border-radius: 8px;
  background: #fff;
}

.live-card,
.live-room {
  border: 1px solid #d7d3cc;
  border-radius: 8px;
  padding: 1rem;
  background: #fff;
}

.live-leave-dialog {
  width: min(90vw, 26rem);
}

.live-leave-dialog p {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.live-leave-dialog .dialog-footer button {
  font: inherit;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}

#live-leave-cancel,
#live-confirm-no {
  background: transparent;
  border: 1px solid #c8c4bc;
  color: #5c584f;
}

#live-leave-confirm,
#live-confirm-yes {
  background: #1f1c16;
  border: 1px solid #1f1c16;
  color: #fff;
}

.live-panel-tabs {
  display: flex;
  gap: 0.25rem;
}

.live-panel-tabs button {
  flex: 1;
  min-width: 0;
  border: 1px solid #d7d3cc;
  border-radius: 8px;
  background: #fff;
  padding: 0.35rem 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
}

.live-panel-tabs button.is-active {
  background: #1f1c16;
  color: #fff;
  border-color: #1f1c16;
}

.live-panel[hidden] {
  display: none;
}

.live-dash-score,
.live-dash-revealed,
.live-dash-move {
  margin: 0;
  padding: 0.55rem 0.75rem 0.15rem;
  font-size: 0.75rem;
}

.live-dash-score {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.live-dash-track {
  height: 0.45rem;
  margin: 0.35rem 0.75rem 0.5rem;
  border-radius: 99px;
  background: #eeeae4;
  overflow: hidden;
}

.live-dash-track span {
  display: block;
  height: 100%;
  background: #1f7a4d;
}

.live-dash-row,
.live-dash-back,
.live-dash-reveal {
  display: flex;
  justify-content: space-between;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.live-dash-reveal {
  margin: 0.4rem 0.75rem 0.6rem;
  width: auto;
  justify-content: center;
  border-radius: 8px;
  background: #1f1c16;
  color: #fff;
}

.live-dash-revealed {
  color: #1f7a4d;
  font-weight: 700;
}

.live-results {
  margin: 0.15rem auto 0.35rem;
  max-width: 28rem;
  padding: 0.45rem 0.7rem 0.35rem;
  border: 1px solid #d7d3cc;
  border-radius: 8px;
  background: #fff;
}

.live-results-title,
.live-result-own {
  margin: 0.1rem 0 0.25rem;
  font-size: 0.78rem;
}

.live-results-title {
  font-weight: 700;
}

.live-result-own {
  color: #5c574e;
}

.live-result-row {
  display: grid;
  grid-template-columns: 3.2rem 1fr 2.4rem;
  align-items: center;
  gap: 0.4rem;
  margin: 0.15rem 0;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.live-result-row.is-own .live-result-san {
  font-weight: 700;
}

.live-result-bar {
  height: 0.4rem;
  border-radius: 99px;
  background: #eeeae4;
  overflow: hidden;
}

.live-result-bar span {
  display: block;
  height: 100%;
  background: #1f7a4d;
}

.live-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #d7d3cc;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.live-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem 0.2rem;
}

.live-panel-head h2 {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.live-panel-head span {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.live-presence-summary {
  margin: 0;
  padding: 0 0.75rem 0.45rem;
  color: #5c574e;
  font-size: 0.75rem;
  border-bottom: 1px solid #eeeae4;
}

.live-presence-list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  overflow: auto;
  min-height: 0;
}

.live-person {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.75rem;
  font-size: 0.85rem;
}

.live-person-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: #1f7a4d;
  flex: 0 0 auto;
}

.live-person.is-offline .live-person-dot {
  background: transparent;
  border: 1.5px solid #b7b1a8;
}

.live-person-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-person-time {
  flex: 0 0 auto;
  color: #5c574e;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.live-person.is-offline .live-person-time {
  color: #8a847b;
}

.live-media-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  align-self: flex-start;
}

.live-media-live {
  display: inline-block;
  margin: 0;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: #b42318;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.live-media-mic {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.28rem;
  margin: 0;
  padding: 0.16rem 0.38rem;
  border-radius: 999px;
  background: #146c43;
  color: #fff;
  line-height: 0;
}

.live-media-mic svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: currentColor;
}

.live-mic-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 0.72rem;
}

.live-mic-bars span {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 1px;
  background: #fff;
  transform-origin: bottom;
  animation: live-mic-level 0.85s ease-in-out infinite;
}

.live-mic-bars span:nth-child(2) {
  animation-delay: 0.15s;
}

.live-mic-bars span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes live-mic-level {
  0%, 100% { transform: scaleY(0.35); }
  50% { transform: scaleY(1); }
}

.live-media-live[hidden],
.live-media-mic[hidden],
#live-media-listen[hidden],
#live-media-empty[hidden] {
  display: none;
}

body[data-live-role="student"] .student-webcam .live-media-remote {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #1c1a17;
}

body[data-live-role="student"] .student-webcam .live-media-remote video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: none;
  object-fit: contain;
  object-position: center;
  background: #1c1a17;
  border-radius: 0;
}

body[data-live-role="student"] .student-webcam .live-media-badges {
  position: absolute;
  top: 0.65rem;
  left: 0.65rem;
  z-index: 2;
}

body[data-live-role="student"] .student-webcam #live-media-empty,
body[data-live-role="student"] .student-webcam .live-media-status {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0 1rem;
  color: #f4f1ea;
}

body[data-live-role="student"] .student-webcam .live-media-status:not(:empty) {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 2;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  background: rgb(28 26 23 / 0.72);
}

body[data-live-role="student"] .student-webcam:has(#live-media-listen:not([hidden])) .live-media-status:not(:empty) {
  bottom: 3.15rem;
}

body[data-live-role="student"] .student-webcam #live-media-listen {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 0.85rem;
  margin: 0;
  transform: translateX(-50%);
}

.live-media-status,
#live-media-empty {
  margin: 0;
  color: #5c574e;
  font-size: 0.85rem;
  font-weight: 600;
}

.live-board .chessboard-server,
.live-board .board-b72b1 {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.live-board.live-board-locked {
  cursor: default;
}

body[data-live-role="student"] .live-board.live-board-student {
  box-shadow: 0 0 0 8px #2f9e44;
}

body[data-live-role="student"] .live-board.live-board-flash {
  animation: live-board-flash 0.25s linear 6;
}

@keyframes live-board-flash {
  0%,
  66.6% {
    box-shadow: 0 0 0 8px #2f9e44;
  }
  66.7%,
  100% {
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-live-role="student"] .live-board.live-board-flash {
    animation: none;
  }
}

.live-source-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.live-source-tabs button {
  border: 1px solid #d7d3cc;
  border-radius: 8px;
  background: #fff;
  padding: 0.4rem 0.7rem;
  font-weight: 700;
}

.live-source-tabs button.is-active {
  background: #1f1c16;
  color: #fff;
  border-color: #1f1c16;
}

.live-lesson-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
  text-align: left;
  border: 1px solid #d7d3cc;
  border-radius: 8px;
  background: #fff;
  padding: 0.45rem 0.65rem;
}

.live-lesson-choice.is-selected {
  border-color: #1f1c16;
  box-shadow: inset 0 0 0 1px #1f1c16;
}

.live-lesson-choice:disabled {
  opacity: 0.7;
}

.live-lesson-pos {
  font-weight: 700;
}

.live-lesson-meta,
.playlist-empty {
  color: #5c564c;
  font-size: 0.85rem;
}

.live-square {
  display: flex;
  align-items: center;
  justify-content: center;
}

.live-square.light {
  background: #f0d9b5;
}

.live-square.dark {
  background: #b58863;
}

.live-square img {
  width: 82%;
  height: 82%;
}

.history-card h2 {
  margin: 0;
  font-size: 1.15rem;
}

.history-trainer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.history-trainer img {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
}

.history-names {
  margin: 0.25rem 0 1rem;
  padding-left: 1.2rem;
}

.history-window {
  margin-top: 1rem;
}

.history-window .btn {
  margin: 0 0.4rem 0.4rem 0;
}

#history-more {
  margin-top: 1rem;
}

@media (max-width: 700px) {
  .live-page {
    margin-top: 1rem;
  }
}

body[data-live-role="student"] .live-page.schedule-calendar:not(.in-class),
body[data-live-role="student"] .live-page.schedule-list:not(.in-class) {
  box-sizing: border-box;
  max-width: none;
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding: calc(var(--header-block-size) + 0.45rem) 0.75rem 0.6rem;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: auto;
}

body[data-live-role="student"] .live-page.schedule-calendar:not(.in-class) .live-header h1,
body[data-live-role="student"] .live-page.schedule-list:not(.in-class) .live-header h1 {
  margin: 0;
  font-size: 1.35rem;
  color: var(--color-secondary-dark);
}

body[data-live-role="student"] .live-page.schedule-calendar:not(.in-class) .live-lead,
body[data-live-role="student"] .live-page.schedule-list:not(.in-class) .live-lead {
  margin: 0.15rem 0 0;
  font-size: 0.92rem;
}

body[data-live-role="student"] .live-page.schedule-calendar:not(.in-class) .live-status:empty,
body[data-live-role="student"] .live-page.schedule-list:not(.in-class) .live-status:empty {
  display: none;
}

body[data-live-role="student"] .live-page.schedule-calendar:not(.in-class) .live-balance-row,
body[data-live-role="student"] .live-page.schedule-list:not(.in-class) .live-balance-row {
  margin-top: 0.4rem;
}

body[data-live-role="student"] .live-page.schedule-calendar:not(.in-class) .live-lobby,
body[data-live-role="student"] .live-page.schedule-list:not(.in-class) .live-lobby,
body[data-live-role="student"] .live-page.schedule-calendar:not(.in-class) #live-schedule,
body[data-live-role="student"] .live-page.schedule-list:not(.in-class) #live-schedule,
body[data-live-role="student"] .live-page.schedule-calendar:not(.in-class) .live-lobby-view,
body[data-live-role="student"] .live-page.schedule-list:not(.in-class) .live-lobby-view {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body[data-live-role="student"] .live-page.schedule-list:not(.in-class) .live-session-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  margin: 0.35rem 0 0.45rem;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.cal-title {
  margin: 0;
  min-width: 11.5rem;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-secondary-dark);
}

.cal-nav-btn,
.cal-today {
  border: 1px solid #d7d3cc;
  background: #fff;
  color: var(--color-secondary);
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.cal-nav-btn {
  width: 2.25rem;
  height: 2.25rem;
  font-size: 1.35rem;
  line-height: 1;
}

.cal-today {
  margin-left: 0.35rem;
  padding: 0.4rem 0.85rem;
}

.cal-nav-btn:hover,
.cal-today:hover,
.cal-more:hover {
  background: #f6f1e8;
}

.cal-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
  font-weight: 700;
  color: var(--color-secondary-dark);
  cursor: pointer;
  user-select: none;
}

.cal-view-toggle input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--color-secondary);
}

.cal-period-note {
  margin: 0 0 0.45rem;
  color: #5c574e;
}

.cal-undated {
  margin-bottom: 0.75rem;
}

.cal-undated h3,
.cal-agenda h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.cal {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid #d7d3cc;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.cal-weekdays,
.cal-weeks {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.cal-weekdays {
  background: #f7f4ef;
  border-bottom: 1px solid #e4dfd6;
}

.cal-weekday {
  padding: 0.35rem 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #5c574e;
}

.cal-weeks {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-rows: repeat(var(--cal-weeks, 5), minmax(3.25rem, 1fr));
  border-right: 1px solid #e4dfd6;
  border-bottom: 1px solid #e4dfd6;
}

.cal-day {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 0.15rem 0.25rem 0.2rem;
  border-top: 1px solid #e4dfd6;
  border-left: 1px solid #e4dfd6;
  background: #fff;
}

.cal-day.is-outside {
  background: #f4f1eb;
}

.cal-day-pick {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0.1rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.cal-day-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.55rem;
  height: 1.55rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.cal-day.is-outside .cal-day-num {
  color: #9a948a;
  font-weight: 600;
}

.cal-day.is-today .cal-day-num {
  background: var(--color-secondary);
  color: #fff;
  border-radius: 999px;
}

.cal-count {
  display: none;
}

.cal-day-sessions {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 0;
  overflow: hidden;
}

.cal-session,
.cal-more {
  font: inherit;
}

.cal-session {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0.12rem 0.35rem 0.16rem;
  border: 0;
  border-left: 3px solid #3d6fd4;
  border-radius: 4px;
  background: #f4f7ff;
  color: inherit;
  text-align: left;
  line-height: 1.2;
  cursor: pointer;
}

.cal-session[data-join="upcoming"] {
  border-left-color: #3d6fd4;
  background: #f4f7ff;
}

.cal-session[data-join="joinable"],
.cal-session[data-join="joined"] {
  border-left-color: #1f7a4d;
  background: #f3faf6;
}

.cal-session[data-join="joined"] {
  background: #e7f6ee;
}

.cal-session[data-join="short_of_credits"] {
  border-left-color: #a15c07;
  background: #fff8ee;
}

/* Where the viewer stands with a class is theirs: the page marks each card
   (data-join, data-registration, data-subscribed: live-training.js, from
   #live-lobby-standing), and only what fits it shows. Nothing shows before
   it is marked. */
[data-plan]:not([data-join="upcoming"]) .if-upcoming,
[data-plan]:not([data-join="joinable"]) .if-joinable,
[data-plan]:not([data-join="joined"]) .if-joined,
[data-plan]:not([data-join="short_of_credits"]) .if-short,
[data-plan]:not([data-registration="registered"]) .if-registered,
[data-plan]:not([data-registration="none"]):not([data-registration="muted"]) .if-unregistered,
[data-plan]:not([data-subscribed="true"]) .if-subscribed,
[data-plan]:not([data-subscribed="false"]) .if-unsubscribed {
  display: none;
}

.cal-session-meta {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  min-width: 0;
}

.cal-session-line {
  display: block;
}

.cal-session-line,
.cal-session-trainer,
.cal-session-state {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-session-line {
  font-size: 0.75rem;
  font-weight: 700;
}

.cal-session-trainer {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.68rem;
  color: #5c574e;
}

.cal-session-state {
  flex: 0 0 auto;
  font-size: 0.64rem;
  font-weight: 700;
}

.cal-session[data-join="upcoming"] .cal-session-state {
  color: #2f5fbf;
}

.cal-session[data-join="joinable"] .cal-session-state,
.cal-session[data-join="joined"] .cal-session-state {
  color: #1f7a4d;
}

.cal-session[data-join="short_of_credits"] .cal-session-state {
  color: #8a5a10;
}

.cal-session.is-free,
.cal-session[data-join="upcoming"].is-free,
.cal-session[data-join="joinable"].is-free,
.cal-session[data-join="joined"].is-free,
.cal-session[data-join="short_of_credits"].is-free {
  background: #eafff3;
  box-shadow: inset 0 0 0 2px #00e676;
}

.cal-session[hidden],
.cal-more[hidden] {
  display: none !important;
}

.cal-more {
  align-self: flex-start;
  margin: 0;
  padding: 0.05rem 0.2rem;
  border: 0;
  background: transparent;
  color: var(--color-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.cal-agenda {
  display: none;
}

.cal-nav-btn:focus-visible,
.cal-today:focus-visible,
.cal-day-pick:focus-visible,
.cal-session:focus-visible,
.cal-more:focus-visible,
.cal-view-toggle input:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

#live-session-dialog-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#live-session-dialog-body .live-card {
  margin-top: 0;
}

#live-session-dialog .dialog-header h5 {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-session-list {
  display: flex;
  flex-direction: column;
  margin-top: 0.35rem;
  border: 1px solid #d7d3cc;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.live-session-list .live-card {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0;
  border: 0;
  border-left: 4px solid transparent;
  border-radius: 0;
  border-bottom: 1px solid #e5e1d8;
  padding: 0.6rem 1rem;
}

.live-session-list .live-card:last-child {
  border-bottom: 0;
}

.live-session-list .live-card-live {
  border-left-color: #1f7a4d;
}

.live-session-list .live-card-scheduled {
  border-left-color: #3d6fd4;
}

.live-session-list .live-card-info {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  flex: 1 1 auto;
  min-width: 0;
}

.live-session-list .live-card-info h3 {
  margin: 0;
  font-size: 1rem;
  flex: 1 1 160px;
  min-width: 0;
}

.live-session-list .live-card-badges,
.live-session-list .live-card-info .live-level,
.live-session-list .live-card-info .live-when,
.live-session-list .live-card-info .live-note,
.live-session-list .live-card-info .live-trainer {
  flex: 0 0 auto;
}

.live-session-list .live-card-info .live-trainer {
  margin-top: 0;
}

.live-session-list .live-card-actions {
  flex-direction: row;
  align-items: center;
  flex: 0 0 auto;
  width: auto;
  margin-left: auto;
  gap: 0.5rem;
}

.live-session-list .live-card-actions .live-join {
  width: auto;
  margin-top: 0;
  padding: 0.5rem 0.9rem;
  white-space: nowrap;
}

.live-session-list .live-card-actions .live-note {
  margin: 0;
  text-align: right;
  max-width: 14rem;
}

.live-session-list .live-notice-actions {
  flex-direction: row;
  margin-top: 0;
}

.live-session-list .live-notice-actions .live-leave {
  width: auto;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .live-session-list .live-card {
    flex-direction: column;
    align-items: stretch;
  }

  .live-session-list .live-card-actions {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 1100px) {
  .cal-day {
    padding: 0.1rem 0.15rem 0.15rem;
  }

  .cal-session-line {
    font-size: 0.7rem;
  }

  .live-free-mark {
    font-size: 0.75rem;
    padding: 0.12rem 0.48rem;
  }
}

@media (max-width: 760px) {
  body[data-live-role="student"] .live-page.schedule-calendar:not(.in-class),
  body[data-live-role="student"] .live-page.schedule-list:not(.in-class) {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    padding-inline: 0.55rem;
  }

  .cal-toolbar {
    align-items: stretch;
  }

  .cal-nav {
    width: 100%;
    justify-content: space-between;
  }

  .cal-title {
    flex: 1;
    min-width: 0;
    font-size: 1.05rem;
  }

  .cal-nav-btn,
  .cal-today {
    min-width: 2.75rem;
    min-height: 2.75rem;
  }

  .cal-today {
    margin-left: 0;
    padding-inline: 0.7rem;
  }

  .cal-view-toggle {
    margin-left: 0;
    min-height: 2.75rem;
  }

  .cal {
    flex: none;
    overflow: visible;
  }

  .cal-weeks {
    grid-template-rows: none;
    grid-auto-rows: minmax(3.1rem, auto);
  }

  .cal-day {
    padding: 0;
  }

  .cal-day.is-selected {
    background: #f6f1e8;
    box-shadow: inset 0 0 0 2px var(--color-secondary);
  }

  .cal-day.is-outside.is-selected {
    background: #efeae2;
  }

  .cal-day-pick {
    width: 100%;
    min-height: 3.1rem;
    flex-direction: column;
    justify-content: center;
    gap: 0.1rem;
  }

  .cal-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: #3d6fd4;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
  }

  .cal-day.is-today .cal-count {
    background: var(--color-secondary);
  }

  .cal-day-sessions {
    display: none;
  }

  .cal-agenda {
    display: block;
    margin-top: 0.85rem;
  }
}

body[data-live-role="student"]:has(.recording-play) {
  display: flex;
  flex-direction: column;
}

body[data-live-role="student"]:has(.recording-play) .header-bar {
  display: block;
  flex: 0 0 auto;
}

body[data-live-role="student"] .live-page.recording-play {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

body[data-live-role="student"] .recording-play #recording-comment {
  margin: 0.15rem 0;
  min-height: 0;
  overflow: hidden;
  color: #3d3830;
}

body[data-live-role="student"] .recording-play #recording-status:empty {
  display: none;
  margin: 0;
}

body[data-live-role="student"] .student-webcam #recording-media-label,
body[data-live-role="student"] .student-webcam #recording-media-empty {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0 1rem;
  color: #f4f1ea;
}

/* ── Server-rendered classroom regions ───────────────────────────────────── */

.live-picker:empty {
  display: none;
}

.live-picker-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

details.live-dash-row {
  display: block;
  padding: 0;
}

details.live-dash-row > summary {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  list-style: none;
}

details.live-dash-row > summary::-webkit-details-marker {
  display: none;
}

details.live-dash-row[open] > summary {
  font-weight: 700;
}

.live-balance-line {
  margin: 0 0 0.5rem;
}

.history-report details > summary {
  cursor: pointer;
  padding: 0.25rem 0;
}

.plan-editor .admin-form-row {
  flex-wrap: wrap;
}

/* The plan editor's choices that are lists: radio groups, not <select>s. */
.plan-editor .plan-choices {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 0;
  padding: 0;
  border: 0;
}
.plan-editor .plan-choices legend {
  width: 100%;
  margin-bottom: 0.25rem;
  font-weight: 700;
  font-size: 0.95rem;
}
.plan-editor .plan-choice {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  cursor: pointer;
}

/* ===== The trainer's panel: the schedule, the plan editor and the playlists ===== */

.session-free-choice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  grid-column: 1 / -1;
  margin: 0;
  font-weight: 700;
}
.session-playlist,
.playlist-catalog {
  list-style: none;
  margin: 0.75rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.playlist-catalog li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border: 1px solid #d7d3cc;
  border-radius: 8px;
  background: #fff;
}

.session-playlist-item.is-missing {
  border-style: dashed;
}

.session-playlist-pos {
  font-weight: 700;
  min-width: 1.5rem;
}

.session-playlist-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 8rem;
}

.session-playlist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.trainer-tabs {
  margin-bottom: 1rem;
}

.trainer-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.trainer-toolbar .trainer-tabs,
.trainer-toolbar .live-source-tabs {
  margin-bottom: 0;
  flex: 1 1 auto;
}

.live-source-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.live-source-tabs button {
  border: 1px solid #d7d3cc;
  border-radius: 8px;
  background: #fff;
  padding: 0.4rem 0.7rem;
  font-weight: 700;
}

.live-source-tabs button.is-active {
  background: #1f1c16;
  color: #fff;
  border-color: #1f1c16;
}

.playlist-empty {
  color: #5c564c;
}

.playlist-edit-dialog {
  width: min(40rem, calc(100vw - 2rem));
  border: 0;
  border-radius: 12px;
  padding: 1rem;
}

.playlist-edit-dialog::backdrop {
  background: rgba(20, 16, 12, 0.45);
}

/* The student's page, which the squash's bar linked to (the navbar being the site's). */
.trainer-live-link {
  font-weight: 700;
  white-space: nowrap;
}

.trainer-create-button {
  margin-left: auto;
  background: #fff;
  color: #1f1c16;
  border: 2px solid #1f1c16;
  font-weight: 800;
  padding: 0.45rem 0.9rem;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
  white-space: nowrap;
}

.trainer-create-button:hover,
.trainer-create-button[aria-expanded="true"] {
  background: #1f1c16;
  color: #fff;
}

#schedule-form > .btn {
  margin: 0 0.5rem 0.5rem 0;
}

.session-page-summary {
  margin: 0 0 0.75rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.session-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
}

.session-page-numbers {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.session-pager button:disabled {
  opacity: 0.45;
  cursor: default;
}

.session-pager button[aria-current="page"] {
  background: #1f1c16;
  border-color: #1f1c16;
  color: #fff;
}

.session-page-gap {
  padding: 0 0.15rem;
  color: var(--color-text-muted);
}

.session-table th,
.session-table td {
  padding: 0.45rem 0.5rem;
  vertical-align: middle;
}

.session-table th:last-child,
.session-table tr.session-row td:last-child {
  width: 1%;
  white-space: nowrap;
}

.session-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.3rem;
  align-items: center;
  width: max-content;
}

.session-actions .btn {
  white-space: nowrap;
  padding: 0.2rem 0.5rem;
  font-size: 0.8125rem;
  line-height: 1.3;
}

.session-actions .session-start {
  background: #2f6fed;
  border-color: #2f6fed;
  color: #fff;
}

.session-actions .session-start:hover {
  background: #2458c4;
  border-color: #2458c4;
  color: #fff;
}

.session-actions .btn.is-active {
  outline: 2px solid #1f1c16;
  outline-offset: 1px;
}

.session-actions a {
  white-space: nowrap;
}

.session-row.is-open td {
  background: #f6f3ee;
}

.session-panel-row td {
  background: #f6f3ee;
  border-left: 4px solid #1f1c16;
  padding: 0.85rem 0.75rem 1rem;
  scroll-margin-top: calc(var(--header-block-size) + 12px);
}

.session-table-wrap {
  container-type: inline-size;
}

.session-panel-slot #schedule-editor,
.session-panel-slot #playlist-card {
  position: sticky;
  left: 0;
  width: 100cqw;
  max-width: 52rem;
  box-sizing: border-box;
}

.session-panel-slot .admin-card {
  margin: 0;
  padding: 0.25rem 0 0;
  background: transparent;
  box-shadow: none;
}

.session-empty {
  color: var(--color-text-muted);
  text-align: center;
}

.session-playlist-head,
.session-playlist-item {
  display: grid;
  grid-template-columns: 2.25rem minmax(0, 1fr);
  column-gap: 0.75rem;
  row-gap: 0.45rem;
  align-items: center;
}

.session-playlist-item {
  padding: 0.6rem 0.75rem;
  border: 1px solid #d7d3cc;
  border-radius: 8px;
  background: #fff;
}

.session-playlist-item.is-missing {
  border-style: dashed;
}

.session-playlist-head {
  padding: 0.2rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5c564c;
}

.session-playlist-actions {
  grid-column: 1 / -1;
}

#history-list .history-trainer img {
  width: 1.5rem;
  height: 1.5rem;
}

#trainer-history .session-table td {
  white-space: nowrap;
}

#trainer-history .session-table td:first-child {
  white-space: normal;
  min-width: 8rem;
  max-width: 16rem;
}

.history-report h1 {
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  color: var(--color-accent);
}

.history-report h2 {
  margin: 0.9rem 0 0.3rem;
  font-size: 1.05rem;
}

.report-meta,
.report-window-stats {
  margin: 0.15rem 0 0.35rem;
  color: #5c564c;
}

.report-lesson-row {
  margin: 0;
  font-size: 1rem;
}

.history-report .history-window {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px solid #e4e0d8;
}

.history-report .history-window .btn {
  margin: 0 0.35rem 0.35rem 0;
  padding: 0.2rem 0.5rem;
  font-size: 0.8125rem;
}

.history-report .history-names,
.history-report ul {
  margin: 0.2rem 0 0.35rem;
}

.history-report > ul {
  padding-left: 1.2rem;
}

@media (min-width: 720px) {
  .session-playlist-head,
  .session-playlist-item {
    grid-template-columns: 2.25rem minmax(0, 1fr) auto;
  }

  .session-playlist-actions {
    grid-column: auto;
    justify-content: flex-end;
  }
}

@media (max-width: 720px) {
  .trainer-toolbar {
    align-items: stretch;
  }

  .trainer-create-button {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 575.98px) {
  .session-pager {
    align-items: stretch;
  }
}

/* ===== The classroom: the window's height, never scrolled =====
   One grid under the site's bar (live-training.html, trainer-live-training.html):
   the class's bar (#live-room-header), the board as large as the window
   lets it be (--board, from the window's height and width, as the Quick
   Game's), and the rest in columns beside it, each scrolling within itself
   should it not fit. The trainer's board has their notes at its left (the
   board region's own grid, live_classroom_board.html), the video and the
   class at its right, and their dock under it (#live-room-controls); the
   lesson picker opens over the notes and the board. A student's board has
   the trainer's video at its right, over their round (#live-room-panel),
   and no dock: their way out is in the bar. On a phone held upright one
   column: a student's video over the board and the round under it, the
   trainer's notes, class and video as tabs under the board (body.drawer-*,
   live-training.js). body.live-in-class is set while in a class,
   body.live-video-on while the video is on air (live-media.js). */

body.live-in-class {
  overflow: hidden;
}

.live-page.in-class {
  box-sizing: border-box;
  max-width: none;
  width: 100%;
  height: 100dvh;
  margin: 0;
  padding: calc(var(--header-block-size, 0px) + 10px) 16px 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.live-page.in-class > .live-header {
  display: none;
}

.live-page.in-class .live-room {
  --gap: 12px;
  --bar: 52px;
  --line: var(--hp-border, #e2e8f0);
  --surface: var(--hp-surface, #fff);
  --ink: var(--hp-text, #1e293b);
  --muted: var(--hp-muted, #64748b);
  --accent: var(--hp-blue, #2563eb);
  --radius: var(--hp-radius-item, 12px);
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  gap: var(--gap);
  justify-content: center;
  align-content: start;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
}

.live-page.in-class #live-room-header {
  grid-column: 1 / -1;
  grid-row: 1;
  min-width: 0;
}

.live-page.in-class .live-class-side {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.live-page.in-class .live-drawer-tabs {
  display: none;
}

/* The trainer: notes, board, the video and the class; the dock under them. */
body[data-live-role="trainer"] .live-page.in-class .live-room {
  --dock: 52px;
  --notes: clamp(190px, 17vw, 280px);
  --col: clamp(250px, 21vw, 330px);
  --board: max(
    160px,
    min(
      100dvh - var(--header-block-size, 0px) - 22px - var(--bar) - var(--dock) - 2 * var(--gap),
      100vw - 32px - var(--notes) - var(--col) - 2 * var(--gap)
    )
  );
  grid-template-columns: var(--notes) var(--board) var(--col);
  grid-template-rows: var(--bar) var(--board) var(--dock);
}

body[data-live-role="trainer"] .live-page.in-class #live-room-board {
  grid-column: 1 / 3;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
}

body[data-live-role="trainer"] .live-page.in-class .live-board-region {
  display: grid;
  grid-template-columns: var(--notes) var(--board);
  grid-template-rows: var(--board);
  column-gap: var(--gap);
}

body[data-live-role="trainer"] .live-page.in-class .live-board-fit {
  grid-column: 2;
  grid-row: 1;
}

body[data-live-role="trainer"] .live-page.in-class .live-class-side {
  grid-column: 3;
  grid-row: 2;
}

body[data-live-role="trainer"] .live-page.in-class #live-room-controls {
  grid-column: 1 / -1;
  grid-row: 3;
  min-width: 0;
}

/* A student: the board, and the video over their round. */
body[data-live-role="student"] .live-page.in-class .live-room {
  --col: clamp(280px, 30vw, 440px);
  --board: max(
    160px,
    min(
      100dvh - var(--header-block-size, 0px) - 22px - var(--bar) - var(--gap),
      100vw - 32px - var(--col) - var(--gap)
    )
  );
  grid-template-columns: var(--board) var(--col);
  grid-template-rows: var(--bar) var(--board);
}

body[data-live-role="student"] .live-page.in-class #live-room-board {
  grid-column: 1;
  grid-row: 2;
}

body[data-live-role="student"] .live-page.in-class .live-class-side {
  grid-column: 2;
  grid-row: 2;
}

body[data-live-role="student"] .live-page.in-class #live-room-controls {
  display: none;
}

/* ── The board ── */

.live-page.in-class .live-board-fit {
  width: var(--board);
  height: var(--board);
}

.live-page.in-class .live-board.chessboard-container {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
}

/* ── The bar ── */

.live-room-bar {
  box-sizing: border-box;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 0 8px 0 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  white-space: nowrap;
}

.live-bar-back {
  flex: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
}

.live-bar-back:hover {
  color: var(--accent);
}

.live-room-bar .live-trainer {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  gap: 10px;
}

.live-room-bar .live-avatar {
  width: 2rem;
  height: 2rem;
  font-size: 0.72rem;
}

.live-trainer-name,
.live-lesson-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-lesson-title {
  flex: 0 1 auto;
  font-size: 1.05rem;
  font-weight: 800;
}

.live-playlist {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.live-bar-end {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.live-round-chip {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--hp-selected, #eff6ff);
  color: var(--hp-blue-hover, #1d4ed8);
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.live-room-bar .live-elapsed {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 4px;
  font-size: 0.95rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* The one thing that moves by itself: the dot is red, and breathes, while
   the video is on air; there is none otherwise (a grey one read as the
   trainer's connection lost). */
.live-on-air {
  display: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

body.live-video-on .live-on-air {
  display: block;
  background: #dc2626;
  animation: live-on-air 1.8s ease-out infinite;
}

@keyframes live-on-air {
  0% {
    box-shadow: 0 0 0 0 rgb(220 38 38 / 0.5);
  }
  70%,
  100% {
    box-shadow: 0 0 0 8px rgb(220 38 38 / 0);
  }
}

/* ── Buttons ── */

.live-btn {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: var(--hp-radius-btn, 10px);
  background: var(--surface, #fff);
  color: var(--ink, #1e293b);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--hp-ease, 160ms ease), border-color var(--hp-ease, 160ms ease);
}

.live-btn:hover:not(:disabled) {
  border-color: #cbd5e1;
  background: var(--hp-subtle, #f8fafc);
}

.live-btn:focus-visible,
.live-panel-tabs button:focus-visible,
.live-drawer-tabs button:focus-visible,
.live-lesson-choice:focus-visible {
  outline: 2px solid var(--accent, #2563eb);
  outline-offset: 2px;
}

.live-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.live-btn.is-primary {
  border-color: var(--accent, #2563eb);
  background: var(--accent, #2563eb);
  color: #fff;
}

.live-btn.is-primary:hover:not(:disabled) {
  border-color: var(--hp-blue-hover, #1d4ed8);
  background: var(--hp-blue-hover, #1d4ed8);
}

.live-btn.is-danger,
.live-btn.live-end-btn {
  border-color: #fecaca;
  color: #b91c1c;
}

.live-btn.is-danger:hover:not(:disabled),
.live-btn.live-end-btn:hover:not(:disabled) {
  border-color: #fca5a5;
  background: #fef2f2;
}

.live-btn[aria-pressed="true"],
.live-btn.is-mainline {
  border-color: var(--hp-blue-line, #bfdbfe);
  background: var(--hp-selected, #eff6ff);
  color: var(--hp-blue-hover, #1d4ed8);
}

/* ── The trainer's notes ── */

.live-notes {
  grid-column: 1;
  grid-row: 1;
  box-sizing: border-box;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.live-notes-text {
  flex: 1 0 auto;
}

.live-comment {
  margin: 0;
  font-size: 1rem;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.live-notes-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.live-notes-part h3,
.live-round-moves h3 {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.live-page.in-class .live-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 7px;
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* The move the board shows last. */
.live-page.in-class .live-moves span:last-child {
  color: var(--accent);
  font-weight: 800;
}

.live-next-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ── The trainer's dock ── */

.live-page.in-class .live-controls {
  box-sizing: border-box;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  scrollbar-width: thin;
}

.live-dock-group {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.live-dock-group:empty {
  display: none;
}

.live-dock-group + .live-dock-group {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.live-dock-end {
  margin-left: auto;
}

.live-mode-chip {
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--hp-subtle, #f8fafc);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  font-weight: 700;
}

.live-locked {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

/* ── The lesson picker, over the notes and the board ── */

.live-page.in-class #live-picker {
  grid-column: 1 / 3;
  grid-row: 2;
  z-index: 5;
  box-sizing: border-box;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgb(15 23 42 / 0.18);
  animation: live-picker-in 160ms ease-out;
}

.live-page.in-class #live-picker:empty {
  display: none;
}

@keyframes live-picker-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.live-page.in-class .live-picker-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.live-picker-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-picker-head .live-source-tabs {
  flex: 1 1 auto;
  min-width: 0;
}

.live-page.in-class .live-source-tabs button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.live-page.in-class .live-source-tabs button.is-active {
  border-color: var(--hp-blue-line, #bfdbfe);
  background: var(--hp-selected, #eff6ff);
  color: var(--hp-blue-hover, #1d4ed8);
}

.live-page.in-class .live-lesson-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.live-page.in-class .live-lesson-choice {
  flex: none;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.live-page.in-class .live-lesson-choice:hover:not(:disabled) {
  background: var(--hp-subtle, #f8fafc);
}

.live-page.in-class .live-lesson-choice.is-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* ── The trainer's video and class ── */

.live-page.in-class .live-media {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.live-media-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #1e293b;
}

/* The camera off: a strip, the class's list gets the room. */
.live-media:has(#live-media-camera[aria-pressed="false"]) .live-media-frame {
  aspect-ratio: auto;
  height: 2.25rem;
}

.live-media:has(#live-media-camera[aria-pressed="false"]) .live-media-frame::before {
  content: "Camera e oprită";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 600;
}

.live-media-frame .live-media-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* The trainer sees themselves as in a mirror; the class sees them as they are. */
  transform: scaleX(-1);
}

.live-media-frame .live-media-badges {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 1;
}

.live-page.in-class .live-media-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.live-page.in-class #live-media-start,
.live-page.in-class #live-media-stop {
  grid-column: 1 / -1;
}

/* One button for the broadcast: Pornește, or Oprește while it is on. */
.live-page.in-class #live-media-stop:disabled,
.live-media-controls:has(#live-media-stop:enabled) #live-media-start {
  display: none;
}

.live-page.in-class .live-media-status:empty {
  display: none;
}

.live-page.in-class .live-sidebar {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.live-page.in-class .live-panel-tabs {
  flex: none;
  display: flex;
  gap: 0;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
}

.live-page.in-class .live-panel-tabs button,
.live-page.in-class .live-drawer-tabs button {
  flex: 1 1 0;
  min-width: 0;
  margin-bottom: -1px;
  padding: 11px 6px 9px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.live-page.in-class .live-panel-tabs button.is-active,
.live-page.in-class .live-drawer-tabs button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  background: none;
  color: var(--ink);
}

#live-presence-total {
  margin-left: 2px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--hp-subtle, #f1f5f9);
  font-variant-numeric: tabular-nums;
}

body[data-live-role="trainer"] .live-page.in-class #live-room-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.live-page.in-class .live-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
}

.live-page.in-class .live-panel-head h2 {
  font-size: 0.85rem;
  letter-spacing: 0;
}

.live-page.in-class .live-presence-list {
  overflow: visible;
}

.live-dash-rows {
  padding-bottom: 4px;
}

.live-page.in-class .live-dash-reveal {
  display: flex;
  width: calc(100% - 24px);
  margin: 6px 12px 12px;
}

/* ── A student's video and round ── */

body[data-live-role="student"] .student-webcam {
  position: relative;
  isolation: isolate;
  box-sizing: border-box;
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 12px;
  min-height: 2.75rem;
  padding: 8px 14px;
  overflow: hidden;
  border-radius: var(--radius, 12px);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}

/* Nothing on air: one line, the round gets the room. */
body[data-live-role="student"]:not(.live-video-on) .student-webcam :is(.live-media-status, #live-media-listen) {
  position: static;
  transform: none;
  padding: 0;
  background: none;
}

body.live-video-on[data-live-role="student"] .student-webcam {
  aspect-ratio: 16 / 9;
  padding: 0;
}

body[data-live-role="student"] .student-webcam .live-media-remote,
body[data-live-role="student"] .student-webcam .live-media-remote video {
  background: #1e293b;
}

body[data-live-role="student"] .student-webcam #live-media-empty {
  padding: 0;
  color: #cbd5e1;
}

body[data-live-role="student"] .live-page.in-class #live-room-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.live-round,
.live-round-moves {
  flex: none;
  box-sizing: border-box;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.live-round {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* The student's turn: the card says so as the board's green ring does. */
.live-round.is-turn {
  border-color: #86efac;
  background: #f0fdf4;
  box-shadow: inset 4px 0 0 var(--hp-green, #16a34a);
}

.live-round-state {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 1.05rem;
  font-weight: 800;
}

.live-round-state .live-think {
  color: #15803d;
  font-variant-numeric: tabular-nums;
}

.live-round-notice {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.live-page.in-class .live-results {
  max-width: none;
  margin: 4px 0 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
}

/* ── A recording (recording-player.html) ──
   A student's classroom grid: the bar over everything, the board at the
   left, and at its right the video and what moves through it (the page's
   own, .recording-side) over the round (the frame's .recording-panel). The
   frame (recording_frame.html) is swapped in whole, so its wrappers are no
   boxes: its bar, board and panel are the grid's. The room is the bar's and
   the board's height, the round scrolling within what the video leaves. */

body[data-live-role="student"] .live-page.in-class .live-room.recording-room {
  grid-template-columns: var(--board) var(--col);
  grid-template-rows: var(--bar) auto minmax(0, 1fr);
  height: calc(var(--bar) + var(--gap) + var(--board));
}

.recording-frame-host,
.recording-frame {
  display: contents;
}

.recording-room .recording-bar {
  grid-column: 1 / -1;
  grid-row: 1;
}

.recording-room .recording-board {
  grid-column: 1;
  grid-row: 2 / 4;
}

.recording-room .recording-side {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.recording-room .recording-panel {
  grid-column: 2;
  grid-row: 3;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.recording-clock {
  gap: 5px;
}

.recording-clock-total {
  color: var(--muted);
  font-weight: 700;
}

.recording-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recording-tools[hidden],
.recording-tools > [hidden],
#recording-media-empty[hidden] {
  display: none;
}

/* Over the video's dark ground, as the class's "nothing on air" line is. */
#recording-media-empty {
  position: relative;
  z-index: 1;
  margin: 0;
  color: #cbd5e1;
}

.recording-tools .live-status {
  margin: 0;
}

.recording-tools input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.recording-notes h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.recording-notes .live-comment {
  margin: 0;
}

.recording-notice {
  padding: 10px 14px;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  background: #fef2f2;
  color: #b91c1c;
}

/* ── A phone held upright: one column ── */

@media (max-width: 899px) and (min-height: 561px) {
  .live-page.in-class {
    padding: calc(var(--header-block-size, 0px) + 6px) 10px 8px;
  }

  .live-page.in-class .live-room {
    --gap: 8px;
    --bar: 46px;
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }

  .live-page.in-class .live-board-fit {
    justify-self: center;
  }

  .live-room-bar {
    gap: 10px;
    padding: 0 6px 0 12px;
  }

  .live-room-bar .live-btn {
    height: 34px;
    padding: 0 10px;
    font-size: 0.85rem;
  }

  .live-bar-back {
    font-size: 0;
  }

  .live-bar-back::before {
    content: "←";
    font-size: 1.15rem;
  }

  .live-playlist {
    padding-left: 0;
    border-left: 0;
  }

  .live-playlist-pos {
    display: none;
  }

  /* A student: the video, the board, their round. */
  body[data-live-role="student"] .live-page.in-class .live-room {
    --video: 2.75rem;
    --board: max(
      160px,
      min(
        100vw - 20px,
        100dvh - var(--header-block-size, 0px) - 14px - var(--bar) - var(--video) - 6.5rem - 3 * var(--gap)
      )
    );
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--bar) auto var(--board) minmax(0, 1fr);
    height: 100%;
  }

  body.live-video-on[data-live-role="student"] .live-page.in-class .live-room {
    --video: min((100vw - 20px) * 9 / 16, 30dvh);
  }

  body[data-live-role="student"] .live-page.in-class .live-class-side {
    display: contents;
  }

  body[data-live-role="student"] .live-page.in-class #live-media {
    grid-column: 1;
    grid-row: 2;
  }

  body.live-video-on[data-live-role="student"] .student-webcam {
    aspect-ratio: auto;
    height: var(--video);
  }

  body[data-live-role="student"] .live-page.in-class #live-room-board {
    grid-column: 1;
    grid-row: 3;
    justify-self: center;
  }

  body[data-live-role="student"] .live-page.in-class #live-room-panel {
    grid-column: 1;
    grid-row: 4;
  }

  /* The trainer: the board, a tab of what is under it, the dock. The
     board's region spans the board's row, the tabs' and the drawer's, so
     its notes are the drawer's first tab. */
  body[data-live-role="trainer"] .live-page.in-class .live-room {
    --dock: 50px;
    --tabs: 42px;
    --board: max(
      160px,
      min(
        100vw - 20px,
        100dvh - var(--header-block-size, 0px) - 14px - var(--bar) - var(--tabs) - var(--dock) - 9rem - 4 * var(--gap)
      )
    );
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--bar) var(--board) var(--tabs) minmax(0, 1fr) var(--dock);
    height: 100%;
  }

  body[data-live-role="trainer"] .live-page.in-class #live-room-board {
    grid-column: 1;
    grid-row: 2 / 5;
    display: grid;
    grid-template-rows: subgrid;
  }

  body[data-live-role="trainer"] .live-page.in-class .live-board-region {
    grid-row: 1 / -1;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: subgrid;
  }

  body[data-live-role="trainer"] .live-page.in-class .live-board-fit {
    grid-column: 1;
    grid-row: 1;
  }

  body[data-live-role="trainer"] .live-page.in-class .live-notes {
    grid-column: 1;
    grid-row: 3;
  }

  body[data-live-role="trainer"] .live-page.in-class .live-drawer-tabs {
    grid-column: 1;
    grid-row: 3;
    display: flex;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0 8px;
  }

  body[data-live-role="trainer"] .live-page.in-class .live-class-side {
    display: contents;
  }

  body[data-live-role="trainer"] .live-page.in-class :is(#live-media, #live-sidebar) {
    grid-column: 1;
    grid-row: 4;
    min-height: 0;
  }

  body[data-live-role="trainer"] .live-page.in-class #live-media {
    overflow: auto;
  }

  body[data-live-role="trainer"] .live-page.in-class #live-picker {
    grid-column: 1;
    grid-row: 2 / 5;
  }

  body[data-live-role="trainer"] .live-page.in-class #live-room-controls {
    grid-row: 5;
  }

  body[data-live-role="trainer"]:not(.drawer-notes) .live-page.in-class .live-notes,
  body[data-live-role="trainer"]:not(.drawer-class) .live-page.in-class #live-sidebar,
  body[data-live-role="trainer"]:not(.drawer-video) .live-page.in-class #live-media {
    display: none;
  }

  .live-page.in-class .live-controls {
    gap: 8px;
    padding: 0 6px;
  }

  .live-dock-group + .live-dock-group {
    padding-left: 8px;
  }

  .live-dock-end {
    margin-left: 0;
  }

  /* What the buttons say already: the free board (Revino la lecție), the
     lesson locked during a round (no button to change it). */
  .live-mode-chip,
  .live-locked {
    display: none;
  }

  .live-dock-group:has(> .live-locked:only-child) {
    display: none;
  }

  .live-page.in-class .live-controls .live-btn {
    height: 34px;
    padding: 0 10px;
    font-size: 0.85rem;
  }

  /* The round's thinking time is its clock alone, read out whole. */
  .live-round-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .live-round-chip {
    padding: 5px 9px;
  }

  /* A recording: the video and what moves through it, the board, the
     round. */
  body[data-live-role="student"] .live-page.in-class .live-room.recording-room {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: var(--bar) auto var(--board) minmax(0, 1fr);
    height: 100%;
  }

  .recording-room .recording-side {
    grid-column: 1;
    grid-row: 2;
  }

  .recording-room .recording-board {
    grid-column: 1;
    grid-row: 3;
    justify-self: center;
  }

  .recording-room .recording-panel {
    grid-column: 1;
    grid-row: 4;
  }

  .recording-clock-total {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.live-video-on .live-on-air,
  .live-page.in-class #live-picker {
    animation: none;
  }
}
