:root {
  color-scheme: dark;

  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  --ink: #f8f7ff;
  --muted: #b9b4d0;
  --soft-muted: #918aa8;

  --purple: #7657ff;
  --purple-bright: #947cff;
  --purple-dark: #3a247e;

  --orange: #ff9d32;
  --orange-light: #ffc56f;
  --orange-dark: #9f4917;

  --green: #80ff87;
  --red: #ff7777;

  --panel: rgba(24, 18, 47, 0.93);
  --panel-deep: rgba(11, 8, 24, 0.88);
  --line: rgba(255, 255, 255, 0.16);
  --soft-line: rgba(255, 255, 255, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;

  background:
    radial-gradient(
      circle at 15% 15%,
      rgba(118, 87, 255, 0.25),
      transparent 32rem
    ),
    radial-gradient(
      circle at 85% 80%,
      rgba(255, 157, 50, 0.20),
      transparent 30rem
    ),
    #090713;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);

  background:
    linear-gradient(
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px
    ),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px
    );

  background-size: 34px 34px;
}

button,
input,
select {
  font: inherit;
}

button {
  touch-action: manipulation;
}

button,
label,
select {
  -webkit-tap-highlight-color: transparent;
}

input,
select {
  width: 100%;
}

.hidden {
  display: none !important;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 52px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.home-link,
.account-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(12, 9, 25, 0.80);
  color: var(--ink);
  text-decoration: none;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 850;
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.home-link:hover {
  border-color: rgba(255, 157, 50, 0.75);
}

.home-icon {
  font-size: 1.2rem;
}

.account-chip {
  color: var(--muted);
  text-align: right;
}

.account-chip.verified {
  color: #caffbd;
  border-color: rgba(129, 255, 112, 0.48);
}

.hero {
  max-width: 1000px;
  margin: 68px auto 42px;
  overflow: hidden;
  text-align: center;
}

.eyebrow,
.card-label,
.workspace-kicker,
.section-kicker,
.review-label,
.chat-example-label {
  font-size: 0.78rem;
  font-weight: 1000;
  letter-spacing: 0.18em;
}

.eyebrow {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--orange);
}

.brand-title {
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: baseline;
  flex-wrap: nowrap;
  margin: 14px auto 10px;
  font-size: clamp(3.2rem, 9.5vw, 7.4rem);
  line-height: 0.92;
  letter-spacing: -0.072em;
  text-transform: uppercase;
  text-shadow: 0 10px 34px rgba(0, 0, 0, 0.50);
}

.zoodle {
  color: #ffffff;
}

.tourney {
  color: var(--orange);
}

.hero-copy {
  max-width: 700px;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.24rem);
  line-height: 1.55;
}

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

.action-card {
  position: relative;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 30px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
}

.action-card::after {
  content: "";
  position: absolute;
  width: 250px;
  height: 250px;
  right: -120px;
  bottom: -120px;
  border-radius: 50%;
  pointer-events: none;
}

.create-card::after {
  background: rgba(118, 87, 255, 0.20);
}

.join-card::after {
  background: rgba(255, 157, 50, 0.18);
}

.card-number {
  color: rgba(255, 255, 255, 0.14);
  font-size: 4rem;
  font-weight: 1000;
  line-height: 1;
}

.card-label {
  margin: 0 0 8px;
  color: var(--orange);
}

.action-card h2 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.65rem);
  line-height: 1.05;
}

.action-card p:not(.card-label) {
  color: var(--muted);
  line-height: 1.55;
}

.primary-button,
.secondary-button,
.secondary-outline-button {
  min-height: 54px;
  border-radius: 15px;
  padding: 12px 20px;
  font-weight: 1000;
  cursor: pointer;
}

.primary-button {
  border: 0;
  color: white;
  background:
    linear-gradient(
      135deg,
      var(--purple),
      var(--purple-dark)
    );
  box-shadow: 0 12px 30px rgba(118, 87, 255, 0.28);
}

.secondary-button {
  border: 0;
  color: #241107;
  background:
    linear-gradient(
      135deg,
      #ffc36a,
      var(--orange)
    );
}

.secondary-outline-button {
  border: 1px solid rgba(255, 157, 50, 0.48);
  color: var(--orange-light);
  background: rgba(255, 157, 50, 0.08);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
  box-shadow: none;
}

.requirement {
  color: #9991b7;
  font-size: 0.82rem;
}

.join-preview {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: auto;
}

.join-preview input {
  min-width: 0;
  height: 54px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 0 16px;
  color: white;
  background: rgba(5, 4, 12, 0.65);
  font-weight: 900;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}

.join-preview input:disabled {
  opacity: 0.48;
}

.foundation-panel {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  background: var(--panel-deep);
}

.notice {
  min-height: 48px;
  margin-top: 18px;
  border-radius: 14px;
  padding: 14px 16px;
  color: #d9d4ec;
  background: rgba(118, 87, 255, 0.10);
  line-height: 1.40;
}

.notice.error {
  color: #ffc8c8;
  background: rgba(255, 72, 72, 0.12);
}

.workspace-header {
  display: grid;
  grid-template-columns: 130px 1fr 130px;
  gap: 18px;
  align-items: start;
  margin: 58px 0 28px;
}

.workspace-title {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.workspace-kicker {
  margin: 0 0 8px;
  color: var(--orange);
}

.workspace-title h2 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 1;
}

.workspace-title p:not(.workspace-kicker) {
  color: var(--muted);
  line-height: 1.55;
}

.text-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--ink);
  background: rgba(12, 9, 25, 0.72);
  font-weight: 850;
  cursor: pointer;
}

.form-section {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}

.section-number {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 17px;
  color: white;
  background:
    linear-gradient(
      135deg,
      var(--purple),
      var(--purple-dark)
    );
  font-size: 1.25rem;
  font-weight: 1000;
}

.section-content {
  min-width: 0;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 20px;
}

.section-kicker {
  margin: 0 0 6px;
  color: var(--orange);
}

.section-heading h3 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.info-badge,
.educator-only-badge {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 0.72rem;
  font-weight: 900;
}

.info-badge {
  color: #d9d2ff;
  background: rgba(118, 87, 255, 0.14);
}

.educator-only-badge {
  color: #ffd69f;
  background: rgba(255, 157, 50, 0.12);
}

.field-grid {
  display: grid;
  gap: 14px;
}

.field-grid.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-width {
  grid-column: 1 / -1;
}

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

.field > span {
  color: #ded9ef;
  font-size: 0.86rem;
  font-weight: 850;
}

.field input,
.field select,
.number-with-unit {
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: white;
  background: rgba(4, 3, 11, 0.58);
}

.field input,
.field select {
  padding: 0 14px;
}

.field input:focus,
.field select:focus {
  outline: 3px solid rgba(118, 87, 255, 0.24);
  border-color: var(--purple-bright);
}

.field select option {
  color: #111;
}

.field-help {
  margin: 14px 0 0;
  color: var(--soft-muted);
  font-size: 0.84rem;
  line-height: 1.50;
}

.compact-help {
  margin-top: 10px;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choice-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 10px 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 900;
  cursor: pointer;
}

.choice-button.selected {
  border-color: rgba(255, 157, 50, 0.70);
  color: #241107;
  background:
    linear-gradient(
      135deg,
      var(--orange-light),
      var(--orange)
    );
}

.team-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.team-name-row {
  position: relative;
}

.team-color-dot {
  position: absolute;
  z-index: 2;
  left: 14px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translateY(-50%);
}

.team-name-row input {
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px 0 38px;
  color: white;
  background: rgba(4, 3, 11, 0.58);
  font-weight: 850;
}

.team-name-row input:focus {
  outline: 3px solid rgba(118, 87, 255, 0.24);
  border-color: var(--purple-bright);
}

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

.game-select-card {
  border: 1px solid var(--soft-line);
  border-radius: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.035);
}

.game-select-card.enabled {
  border-color: rgba(255, 157, 50, 0.50);
  background: rgba(255, 157, 50, 0.055);
}

.game-check-heading {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.game-check-heading input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
}

.game-check-box {
  position: relative;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.25);
}

.game-check-heading input:checked + .game-check-box {
  border-color: var(--orange);
  background: var(--orange);
}

.game-check-heading input:checked + .game-check-box::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #2a1305;
  font-weight: 1000;
}

.game-check-heading strong,
.game-check-heading small {
  display: block;
}

.game-check-heading strong {
  font-size: 1.10rem;
}

.game-check-heading small {
  margin-top: 3px;
  color: var(--soft-muted);
}

.game-settings {
  margin-top: 18px;
  border-top: 1px solid var(--soft-line);
  padding-top: 16px;
}

.hidden-settings {
  display: none;
}

.number-with-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.number-with-unit input {
  min-width: 0;
  border: 0;
  background: transparent;
}

.number-with-unit input:focus {
  outline: none;
}

.number-with-unit span {
  padding-right: 14px;
  color: var(--soft-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.toggle-row {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 16px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

.toggle-row input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  opacity: 0;
  pointer-events: none;
}

.toggle-control {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  transition: 160ms ease;
}

.toggle-control::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: 160ms ease;
}

.toggle-row input:checked + .toggle-control {
  background: var(--purple);
}

.toggle-row input:checked + .toggle-control::after {
  transform: translateX(20px);
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row small {
  margin-top: 4px;
  color: var(--soft-muted);
  line-height: 1.40;
}

.toggle-row.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.chat-example {
  margin-top: 18px;
  border-radius: 17px;
  padding: 16px;
  background:
    linear-gradient(
      135deg,
      rgba(118, 87, 255, 0.14),
      rgba(255, 157, 50, 0.09)
    );
}

.chat-example-label {
  color: var(--orange);
}

.chat-bubble {
  max-width: 720px;
  margin-top: 10px;
  border-radius: 16px 16px 16px 4px;
  padding: 14px 16px;
  color: white;
  background: rgba(8, 6, 17, 0.70);
  font-weight: 800;
  line-height: 1.45;
}

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

.invitation-preview-card {
  min-height: 145px;
  border: 1px solid var(--soft-line);
  border-radius: 17px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.invitation-preview-card span,
.invitation-preview-card strong,
.invitation-preview-card small {
  display: block;
}

.invitation-preview-card span {
  color: var(--orange);
  font-size: 0.74rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.invitation-preview-card strong {
  margin-top: 8px;
  font-size: 1.05rem;
}

.invitation-preview-card small {
  margin-top: 8px;
  color: var(--soft-muted);
  line-height: 1.45;
}

.form-error {
  margin: 18px 0;
  border: 1px solid rgba(255, 119, 119, 0.32);
  border-radius: 15px;
  padding: 14px 16px;
  color: #ffd0d0;
  background: rgba(255, 80, 80, 0.10);
  line-height: 1.45;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
}

.form-primary-button {
  min-width: 250px;
}

.review-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 28px;
  background: var(--panel);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
}

.review-hero {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 18px;
  border-bottom: 1px solid var(--soft-line);
  padding-bottom: 22px;
}

.review-label {
  margin: 0 0 8px;
  color: var(--orange);
}

.review-hero h3 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 3.3rem);
  line-height: 1.05;
}

.review-hero p:not(.review-label) {
  color: var(--muted);
}

.review-status {
  flex-shrink: 0;
  border-radius: 999px;
  padding: 9px 12px;
  color: #dcd5ff;
  background: rgba(118, 87, 255, 0.16);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.review-section-card {
  min-height: 180px;
  border: 1px solid var(--soft-line);
  border-radius: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.035);
}

.review-team-list,
.review-game-list {
  display: grid;
  gap: 9px;
}

.review-team-item,
.review-game-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.18);
  font-weight: 850;
}

.review-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.review-copy {
  color: var(--muted);
  line-height: 1.55;
}

.review-save-panel {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 22px;
  margin-top: 22px;
  border-radius: 18px;
  padding: 20px;
  background:
    linear-gradient(
      135deg,
      rgba(118, 87, 255, 0.13),
      rgba(255, 157, 50, 0.09)
    );
}

@media (max-width: 900px) {
  .workspace-header {
    grid-template-columns: 110px 1fr;
  }

  .workspace-title {
    text-align: left;
  }

  .game-selector-grid,
  .invitation-preview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 22px, 620px);
    padding-top: 12px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .account-chip {
    text-align: left;
  }

  .hero {
    margin: 46px auto 30px;
  }

  .brand-title {
    display: block;
    font-size: clamp(2.95rem, 15vw, 4.7rem);
    line-height: 0.88;
    letter-spacing: -0.055em;
  }

  .brand-title span {
    display: block;
  }

  .action-grid {
    grid-template-columns: 1fr;
  }

  .action-card {
    min-height: 380px;
    padding: 24px;
  }

  .workspace-header {
    display: block;
    margin-top: 34px;
  }

  .workspace-title {
    margin-top: 18px;
  }

  .form-section {
    display: block;
    padding: 19px;
  }

  .section-number {
    width: 44px;
    height: 44px;
    margin-bottom: 16px;
    border-radius: 13px;
  }

  .section-heading {
    display: block;
  }

  .info-badge,
  .educator-only-badge {
    display: inline-block;
    margin-top: 12px;
  }

  .field-grid.two-column,
  .team-inputs,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .choice-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .choice-button {
    padding: 9px 8px;
    font-size: 0.82rem;
  }

  .form-actions,
  .review-save-panel,
  .review-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions {
    display: flex;
  }

  .form-actions button,
  .form-primary-button,
  .review-save-panel button {
    width: 100%;
  }

  .review-card {
    padding: 19px;
  }

  .review-status {
    align-self: flex-start;
  }
}

@media (max-width: 380px) {
  .brand-title {
    font-size: 2.72rem;
  }

  .home-link,
  .account-chip {
    font-size: 0.80rem;
  }
}


/* =========================================================
   OFFICIAL ZOODLEBUG TOURNAMENT BRANDING
   ========================================================= */

.official-brand-block {
  width: 100%;
  max-width: 1020px;
  margin: 14px auto 0;
  text-align: center;
}

.teacher-tool-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  margin-bottom: 10px;
  border: 1px solid rgba(255, 157, 50, 0.42);
  border-radius: 999px;
  padding: 6px 13px;
  color: #ffd18f;
  background: rgba(255, 157, 50, 0.08);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.16em;
}

.official-tournament-logo {
  display: block;
  width: min(100%, 920px);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  filter:
    drop-shadow(0 18px 28px rgba(0, 0, 0, 0.40));
}

.workspace-branding {
  width: 100%;
  margin: 0 auto 14px;
  text-align: center;
}

.compact-label {
  min-height: 25px;
  margin-bottom: 6px;
  padding: 4px 10px;
  font-size: 0.62rem;
}

.workspace-tournament-logo {
  display: block;
  width: min(100%, 470px);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
  filter:
    drop-shadow(0 12px 20px rgba(0, 0, 0, 0.34));
}

.hero {
  max-width: 1080px;
}

.hero-copy {
  margin-top: 10px;
}

.workspace-header {
  grid-template-columns: 130px minmax(0, 1fr) 130px;
}

.workspace-title {
  max-width: 820px;
}

@media (max-width: 900px) {
  .workspace-header {
    grid-template-columns: 105px minmax(0, 1fr);
  }

  .workspace-tournament-logo {
    width: min(100%, 410px);
  }
}

@media (max-width: 760px) {
  .official-brand-block {
    margin-top: 8px;
  }

  .teacher-tool-label {
    max-width: calc(100% - 20px);
    font-size: 0.62rem;
    letter-spacing: 0.12em;
  }

  .official-tournament-logo {
    width: 100%;
    max-width: 560px;
    filter:
      drop-shadow(0 12px 20px rgba(0, 0, 0, 0.34));
  }

  .workspace-branding {
    margin-bottom: 10px;
  }

  .workspace-tournament-logo {
    width: 100%;
    max-width: 430px;
  }

  .hero {
    overflow: visible;
  }
}

@media (max-width: 390px) {
  .official-tournament-logo {
    width: 100%;
  }

  .workspace-tournament-logo {
    width: 100%;
  }

  .teacher-tool-label {
    font-size: 0.56rem;
  }
}


/* =========================================================
   TEAM ASSIGNMENT MODE
   ========================================================= */

.assignment-mode-block {
  margin-top: 18px;
  border: 1px solid var(--soft-line);
  border-radius: 18px;
  padding: 17px;
  background: rgba(255, 255, 255, 0.025);
}

.assignment-heading {
  margin: 0 0 12px;
  color: #e8e4f2;
  font-size: 0.90rem;
  font-weight: 900;
}

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

.assignment-choice {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-height: 126px;
  border: 1px solid var(--soft-line);
  border-radius: 16px;
  padding: 16px;
  background: rgba(7, 5, 17, 0.42);
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background 150ms ease;
}

.assignment-choice:hover {
  border-color: rgba(255, 157, 50, 0.44);
}

.assignment-choice.selected {
  border-color: rgba(255, 157, 50, 0.75);
  background:
    linear-gradient(
      135deg,
      rgba(118, 87, 255, 0.13),
      rgba(255, 157, 50, 0.08)
    );
}

.assignment-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.assignment-radio {
  position: relative;
  width: 27px;
  height: 27px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.30);
}

.assignment-choice input:checked + .assignment-radio {
  border-color: var(--orange);
}

.assignment-choice input:checked + .assignment-radio::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--orange);
}

.assignment-copy strong,
.assignment-copy small {
  display: block;
}

.assignment-copy strong {
  color: white;
  font-size: 1rem;
}

.assignment-copy small {
  margin-top: 7px;
  color: var(--soft-muted);
  line-height: 1.45;
}

.assignment-mode-notice {
  margin-top: 12px;
  border-radius: 13px;
  padding: 12px 14px;
  color: #ddd7f1;
  background: rgba(118, 87, 255, 0.10);
  font-size: 0.84rem;
  line-height: 1.45;
}

.review-assignment {
  margin-top: 12px;
  border-radius: 12px;
  padding: 11px 12px;
  color: #ddd7ef;
  background: rgba(118, 87, 255, 0.10);
  font-size: 0.84rem;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .assignment-choice-grid {
    grid-template-columns: 1fr;
  }

  .assignment-choice {
    min-height: 0;
  }
}

/* =========================================================
   FIREBASE EDUCATOR TOURNAMENT DASHBOARD
   ========================================================= */

.educator-dashboard {
  width: min(1180px, 100%);
  margin: 24px auto 34px;
}

.dashboard-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  border: 1px solid var(--soft-line);
  border-radius: 22px;
  padding: 22px;
  background:
    linear-gradient(
      135deg,
      rgba(118, 87, 255, 0.12),
      rgba(255, 157, 50, 0.06)
    );
}

.dashboard-toolbar h2,
.list-heading h3 {
  margin: 4px 0 6px;
}

.dashboard-toolbar p {
  margin: 0;
  color: var(--soft-muted);
}

.tournament-list-section {
  margin-top: 22px;
  border: 1px solid var(--soft-line);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(10, 7, 24, 0.72);
}

.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--soft-line);
  background: rgba(255, 255, 255, 0.025);
}

.list-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 30px;
  border-radius: 999px;
  padding: 4px 11px;
  color: white;
  background: rgba(118, 87, 255, 0.24);
  font-weight: 900;
}

.warning-count {
  background: rgba(255, 157, 50, 0.22);
  color: #ffd18f;
}

.tournament-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.tournament-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.tournament-table th,
.tournament-table td {
  padding: 15px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  text-align: left;
  vertical-align: middle;
}

.tournament-table th {
  color: #bdb5d4;
  background: rgba(0, 0, 0, 0.20);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tournament-table tr:last-child td {
  border-bottom: 0;
}

.tournament-name-cell strong {
  display: block;
  color: white;
}

.tournament-name-cell small {
  display: block;
  margin-top: 4px;
  color: var(--soft-muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.70rem;
  font-weight: 1000;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-draft {
  color: #ffe29c;
  background: rgba(255, 183, 61, 0.17);
  border: 1px solid rgba(255, 183, 61, 0.42);
}

.status-ready {
  color: #bfffe9;
  background: rgba(47, 208, 160, 0.14);
  border: 1px solid rgba(47, 208, 160, 0.34);
}

.status-past-due {
  color: #ffd2a6;
  background: rgba(255, 112, 54, 0.15);
  border: 1px solid rgba(255, 112, 54, 0.38);
}

.status-live {
  color: white;
  background: rgba(255, 95, 131, 0.22);
  border: 1px solid rgba(255, 95, 131, 0.48);
}

.status-completed,
.status-ended-early,
.status-canceled {
  color: #d7d1e6;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.row-action-button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 7px 9px;
  color: #eee9f8;
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
}

.row-action-button:hover {
  border-color: rgba(255, 157, 50, 0.48);
  color: white;
}

.row-action-button.delete-action:hover {
  border-color: rgba(255, 95, 131, 0.60);
  color: #ffb4c5;
}

.dashboard-empty {
  padding: 28px 20px;
  color: var(--soft-muted);
  text-align: center;
}

.review-save-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.no-date-label {
  color: #d5cee8;
  font-style: italic;
}

@media (max-width: 820px) {
  .dashboard-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-toolbar .primary-button {
    width: 100%;
  }

  .tournament-table,
  .tournament-table tbody,
  .tournament-table tr,
  .tournament-table td {
    display: block;
    width: 100%;
  }

  .tournament-table thead {
    display: none;
  }

  .tournament-table tr {
    padding: 15px;
    border-bottom: 1px solid var(--soft-line);
  }

  .tournament-table tr:last-child {
    border-bottom: 0;
  }

  .tournament-table td {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 10px;
    border: 0;
    padding: 7px 0;
  }

  .tournament-table td::before {
    content: attr(data-label);
    color: #9f97b7;
    font-size: 0.70rem;
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .row-actions {
    align-items: stretch;
  }

  .row-action-button {
    flex: 1 1 auto;
  }
}

@media (max-width: 480px) {
  .tournament-table td {
    grid-template-columns: 1fr;
  }

  .tournament-table td::before {
    margin-bottom: 1px;
  }

  .review-save-actions {
    width: 100%;
  }

  .review-save-actions button {
    width: 100%;
  }
}

/* =========================================================
   COMPACT TOURNAMENT LAYOUT — AUGUST 2026
   Keeps all type and control sizes while removing empty space.
   ========================================================= */

.page-shell {
  padding-bottom: 28px;
}

.topbar {
  min-height: 70px;
  padding-top: 14px;
  padding-bottom: 8px;
}

.hero {
  padding-top: 12px;
  padding-bottom: 10px;
}

.hero .eyebrow {
  margin-bottom: 7px;
}

.official-brand-block {
  margin-top: 3px;
}

.teacher-tool-label {
  margin-bottom: 3px;
}

.official-tournament-logo {
  width: min(100%, 790px);
}

.hero-copy {
  margin-top: 0;
  margin-bottom: 10px;
}

.educator-dashboard {
  margin-top: 8px;
  margin-bottom: 22px;
}

.dashboard-toolbar {
  padding: 16px 20px;
}

.tournament-list-section {
  margin-top: 14px;
}

.list-heading {
  padding: 13px 16px;
}

.tournament-table th,
.tournament-table td {
  padding-top: 11px;
  padding-bottom: 11px;
}

.foundation-panel {
  margin-top: 18px;
  padding: 18px 20px;
}

.foundation-panel .notice {
  margin-top: 0;
}

.workspace-header {
  padding-top: 8px;
  padding-bottom: 10px;
  align-items: start;
}

.workspace-title {
  margin-top: 0;
}

.workspace-branding {
  margin-bottom: 4px;
}

.workspace-tournament-logo {
  width: min(100%, 390px);
}

.workspace-kicker {
  margin-top: 3px;
  margin-bottom: 6px;
}

.workspace-title h2 {
  margin-top: 0;
  margin-bottom: 7px;
}

.workspace-title > p:last-child {
  margin-top: 0;
  margin-bottom: 0;
}

.workspace-nav-buttons {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.dashboard-back-button {
  border-color: rgba(255, 157, 50, 0.48);
  color: #ffd18f;
}

#tournamentForm {
  margin-top: 12px;
}

.form-section {
  margin-top: 14px;
  padding: 20px 24px;
}

.form-section:first-child {
  margin-top: 0;
}

.section-heading {
  margin-bottom: 14px;
}

.section-heading h3 {
  margin-top: 2px;
  margin-bottom: 0;
}

.section-number {
  margin-top: 3px;
}

.field {
  margin-top: 10px;
}

.field-help {
  margin-top: 10px;
  margin-bottom: 0;
}

.assignment-mode-block {
  margin-top: 12px;
  padding: 14px;
}

.assignment-choice {
  min-height: 102px;
  padding: 13px;
}

.assignment-mode-notice {
  margin-top: 9px;
  padding: 10px 13px;
}

.team-inputs {
  margin-top: 12px;
}

.game-selector-grid {
  gap: 12px;
}

.game-select-card {
  padding: 16px 18px;
}

.game-settings {
  margin-top: 12px;
  padding-top: 12px;
}

.toggle-row {
  margin-top: 10px;
  padding: 13px 15px;
}

.chat-example {
  margin-top: 12px;
  padding: 12px 14px;
}

.invitation-preview-grid {
  gap: 10px;
}

.invitation-preview-card {
  min-height: 0;
  padding: 14px 15px;
}

.form-actions {
  margin-top: 14px;
  margin-bottom: 12px;
}

#reviewView .workspace-header {
  padding-bottom: 4px;
}

#reviewView .workspace-branding {
  margin-bottom: 1px;
}

#reviewView .workspace-tournament-logo {
  width: min(100%, 350px);
}

.review-card {
  margin-top: 12px;
  padding: 20px 24px;
}

.review-hero {
  padding-bottom: 16px;
}

.review-grid {
  margin-top: 16px;
  gap: 12px;
}

.review-section-card {
  min-height: 0;
  padding: 16px 18px;
}

.review-team-list,
.review-game-list {
  margin-top: 9px;
}

.review-assignment {
  margin-top: 0;
  margin-bottom: 8px;
}

.review-save-panel {
  margin-top: 14px;
  padding: 15px 17px;
}

.notice {
  margin-top: 10px;
}

@media (max-width: 900px) {
  .workspace-header {
    padding-top: 6px;
  }

  .workspace-nav-buttons {
    grid-column: 1;
    grid-row: 1;
  }

  .workspace-title {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 62px;
    padding-top: 10px;
  }

  .hero {
    padding-top: 6px;
  }

  .official-tournament-logo {
    max-width: 520px;
  }

  .dashboard-toolbar {
    padding: 15px;
  }

  .form-section {
    padding: 17px 16px;
  }

  .workspace-header {
    padding-bottom: 6px;
  }

  .workspace-nav-buttons {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .workspace-nav-buttons .text-button {
    flex: 1 1 auto;
  }

  .workspace-tournament-logo {
    max-width: 335px;
  }

  .review-card {
    padding: 17px 16px;
  }

  .review-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   MOBILE-SAFE, HIGH-VISIBILITY FORM FIELDS
   ========================================================= */

.field,
.field-grid,
.section-content,
.team-inputs,
.team-name-row,
.game-settings {
  min-width: 0;
}

input,
select,
.number-with-unit,
.team-name-input {
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

.field input,
.field select,
.number-with-unit,
.team-name-input {
  border-color: rgba(213, 202, 240, 0.48);
  color: #ffffff;
  background: rgba(58, 49, 82, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 0 0 1px rgba(0, 0, 0, 0.10);
}

.field input::placeholder,
.team-name-input::placeholder {
  color: rgba(241, 236, 255, 0.62);
  opacity: 1;
}

.field input:hover,
.field select:hover,
.number-with-unit:hover,
.team-name-input:hover {
  border-color: rgba(255, 157, 50, 0.64);
}

.field input:focus,
.field select:focus,
.team-name-input:focus,
.number-with-unit:focus-within {
  outline: 3px solid rgba(255, 157, 50, 0.20);
  border-color: #ff9d32;
  background: rgba(68, 57, 96, 0.94);
}

.number-with-unit input {
  width: 100%;
  max-width: 100%;
  color: #ffffff;
}

input[type="date"],
input[type="time"] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  color-scheme: dark;
}

@media (max-width: 760px) {
  .field,
  .field input,
  .field select,
  .number-with-unit,
  .team-name-input,
  input[type="date"],
  input[type="time"] {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  input[type="date"],
  input[type="time"] {
    padding-left: 12px;
    padding-right: 12px;
  }

  .field-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* =========================================================
   FINAL MOBILE CREATE PAGE AND FORM FIELD REPAIR
   ========================================================= */

#setupView,
#reviewView,
#tournamentForm {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#setupView {
  margin-right: auto;
  margin-left: auto;
}

#tournamentForm {
  margin-right: auto;
  margin-left: auto;
}

#setupView .workspace-header,
#setupView .workspace-title,
#setupView .workspace-branding,
#setupView .form-section,
#setupView .section-content,
#setupView .field-grid,
#setupView .field,
#setupView .team-inputs,
#setupView .team-name-row,
#setupView .game-selector-grid,
#setupView .game-select-card,
#setupView .game-settings {
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Native date and time fields use the wrapper for visible styling. */

.native-date-time-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 52px;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid rgba(255, 210, 145, 0.78);
  border-radius: 14px;
  background: #5b4c70;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    0 0 0 1px rgba(0, 0, 0, 0.16);
}

.native-date-time-wrap:focus-within {
  border-color: #ff9d32;
  background: #67557c;
  box-shadow:
    0 0 0 3px rgba(255, 157, 50, 0.23),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.native-date-time-wrap input[type="date"],
.native-date-time-wrap input[type="time"] {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 52px;
  min-height: 52px;
  margin: 0;
  border: 0 !important;
  border-radius: 0;
  padding: 0 13px;
  box-sizing: border-box;
  color: #ffffff !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  -webkit-appearance: none;
  appearance: none;
  color-scheme: dark;
}

.native-date-time-wrap input[type="date"]::-webkit-date-and-time-value,
.native-date-time-wrap input[type="time"]::-webkit-date-and-time-value {
  min-width: 0;
  text-align: left;
}

.native-date-time-wrap input[type="date"]::-webkit-calendar-picker-indicator,
.native-date-time-wrap input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0.95;
  filter: invert(1);
}

/* Final visible surface for all other setup controls. */

#setupView .field input:not([type="date"]):not([type="time"]),
#setupView .field select,
#setupView .team-name-input,
#setupView .number-with-unit {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border-color: rgba(255, 210, 145, 0.74) !important;
  color: #ffffff !important;
  background: #5b4c70 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.15) !important;
}

#setupView .field input:not([type="date"]):not([type="time"]):focus,
#setupView .field select:focus,
#setupView .team-name-input:focus,
#setupView .number-with-unit:focus-within {
  border-color: #ff9d32 !important;
  background: #67557c !important;
  outline: 3px solid rgba(255, 157, 50, 0.23) !important;
}

#setupView .number-with-unit input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: 0 !important;
  color: #ffffff !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

#setupView input::placeholder,
#setupView .team-name-input::placeholder {
  color: rgba(255, 255, 255, 0.76) !important;
  opacity: 1;
}

@media (max-width: 760px) {
  /*
    Remove the desktop navigation column and center the whole
    Create page like the educator dashboard.
  */

  #setupView {
    width: 100%;
    margin: 0 auto;
  }

  #setupView .workspace-header {
    display: flex;
    width: 100%;
    max-width: 100%;
    margin: 10px auto 12px;
    padding: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  #setupView #backToLandingButton {
    align-self: flex-start;
    margin: 0 0 4px;
  }

  #setupView .workspace-title {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    text-align: center;
  }

  #setupView .workspace-branding {
    width: 100%;
    margin-right: auto;
    margin-left: auto;
  }

  #setupView .workspace-tournament-logo {
    display: block;
    width: min(100%, 335px);
    max-width: 100%;
    height: auto;
    margin-right: auto;
    margin-left: auto;
  }

  #tournamentForm {
    width: 100%;
    max-width: 100%;
    margin: 8px auto 0;
  }

  #setupView .form-section {
    width: 100%;
    max-width: 100%;
    margin-right: auto;
    margin-left: auto;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 10px;
    padding: 16px 14px;
  }

  #setupView .section-number {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  #setupView .field-grid,
  #setupView .field-grid.two-column,
  #setupView .team-inputs,
  #setupView .game-selector-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  #setupView .field,
  #setupView .native-date-time-wrap,
  #setupView .native-date-time-wrap input[type="date"],
  #setupView .native-date-time-wrap input[type="time"],
  #setupView .field input,
  #setupView .field select,
  #setupView .team-name-input,
  #setupView .number-with-unit {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}

/* =========================================================
   CUSTOM IOS DATE/TIME SHELLS AND FORCED FIELD SURFACES
   ========================================================= */

#setupView .native-date-time-wrap {
  position: relative !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 52px !important;
  min-height: 52px !important;
  margin: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  border: 2px solid #d8b56c !important;
  border-radius: 14px !important;
  padding: 0 13px !important;
  background: none !important;
  background-color: #e9e1f2 !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 1px 3px rgba(0, 0, 0, 0.24) !important;
  isolation: isolate !important;
  contain: paint !important;
}

#setupView .native-date-time-wrap:focus-within {
  border-color: #ff9d32 !important;
  box-shadow:
    0 0 0 3px rgba(255, 157, 50, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.72) !important;
}

#setupView .native-date-time-display {
  position: relative !important;
  z-index: 2 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  color: #21162f !important;
  -webkit-text-fill-color: #21162f !important;
  font-weight: 750 !important;
  line-height: 1.2 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  pointer-events: none !important;
}

#setupView .native-date-time-display.placeholder-value {
  color: #6d6178 !important;
  -webkit-text-fill-color: #6d6178 !important;
  font-weight: 650 !important;
}

#setupView .native-date-time-icon {
  position: relative !important;
  z-index: 2 !important;
  color: #4a385e !important;
  font-size: 1.15rem !important;
  line-height: 1 !important;
  pointer-events: none !important;
}

#setupView .native-date-time-wrap input[type="date"],
#setupView .native-date-time-wrap input[type="time"] {
  position: absolute !important;
  z-index: 3 !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 14px !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  opacity: 0 !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  cursor: pointer !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}

/*
  These rules remain as a CSS fallback. JavaScript also applies
  these colors inline with !important after the page loads.
*/

#setupView .field input:not([type="date"]):not([type="time"]),
#setupView .field select,
#setupView .team-name-input,
#setupView .number-with-unit {
  border: 2px solid #d8b56c !important;
  background: none !important;
  background-color: #e9e1f2 !important;
  color: #21162f !important;
  -webkit-text-fill-color: #21162f !important;
  opacity: 1 !important;
}

#setupView .field input:not([type="date"]):not([type="time"])::placeholder,
#setupView .team-name-input::placeholder {
  color: #70627d !important;
  -webkit-text-fill-color: #70627d !important;
  opacity: 1 !important;
}

#setupView .number-with-unit input {
  border: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  color: #21162f !important;
  -webkit-text-fill-color: #21162f !important;
  box-shadow: none !important;
}

#setupView .number-with-unit span {
  color: #554862 !important;
}

@media (max-width: 760px) {
  #setupView .native-date-time-wrap,
  #setupView .native-date-time-wrap input[type="date"],
  #setupView .native-date-time-wrap input[type="time"] {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}

/* =========================================================
   ZOODLEBUG TOURNAMENT INFO PAGE
   ========================================================= */

.tournament-info-view {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  border-radius: 26px;
  padding: 24px;
  box-sizing: border-box;
  color: #21182c;
  background: #ffffff;
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.24);
}

.tournament-info-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.info-back-button,
.info-primary-button,
.info-secondary-button {
  min-height: 44px;
  border-radius: 12px;
  padding: 9px 15px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.info-back-button,
.info-secondary-button {
  border: 1px solid #78658d;
  color: #3b294c;
  background: #f3eef8;
}

.info-primary-button {
  border: 1px solid #6d43ca;
  color: #ffffff;
  background: #6d43ca;
}

.info-status-badge {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 13px;
  color: #176649;
  background: #daf5e9;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.tournament-info-header {
  max-width: 800px;
  margin: 2px auto 24px;
  text-align: center;
}

.tournament-info-logo {
  display: block;
  width: min(100%, 470px);
  height: auto;
  margin: 0 auto 4px;
}

.tournament-info-header p {
  margin: 0 0 5px;
  color: #6d43ca;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.13em;
}

.tournament-info-header h2 {
  margin: 0;
  color: #21182c;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1;
}

.info-page-notice {
  margin: 0 0 14px;
  border-radius: 12px;
  padding: 11px 14px;
  color: #284337;
  background: #e5f8ef;
  font-weight: 800;
}

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

.tournament-info-card {
  min-width: 0;
  border: 1px solid #ddd5e5;
  border-radius: 19px;
  padding: 19px;
  background: #fbf9fd;
}

.tournament-info-card h3 {
  margin: 0 0 14px;
  color: #21182c;
  font-size: 1.35rem;
}

.info-detail-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.info-detail-list > div {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  border-bottom: 1px solid #e8e2ed;
  padding-bottom: 10px;
}

.info-detail-list > div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.info-detail-list dt {
  color: #726779;
  font-size: 0.82rem;
  font-weight: 850;
}

.info-detail-list dd {
  margin: 0;
  color: #21182c;
  font-weight: 850;
}

.info-team-list,
.info-game-list {
  display: grid;
  gap: 9px;
}

.info-team-item,
.info-game-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border: 1px solid #e1dae7;
  border-radius: 13px;
  padding: 8px 12px;
  color: #21182c;
  background: #ffffff;
  font-weight: 850;
}

.info-team-dot {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.host-info-card {
  grid-column: 1 / -1;
}

.host-info-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.host-info-heading span {
  border-radius: 999px;
  padding: 5px 10px;
  color: #7a4c00;
  background: #fff0d7;
  font-size: 0.73rem;
  font-weight: 900;
}

.info-button-row,
.info-copy-row {
  display: flex;
  gap: 10px;
}

.info-button-row {
  margin-bottom: 17px;
}

.classroom-link-field,
.invitation-email-label {
  display: block;
  margin: 13px 0 7px;
  color: #5f5268;
  font-size: 0.82rem;
  font-weight: 900;
}

#infoClassroomLink,
#infoInvitationEmail {
  box-sizing: border-box;
  border: 1px solid #cfc3d9;
  border-radius: 12px;
  color: #21182c;
  background: #ffffff;
  font: inherit;
}

#infoClassroomLink {
  width: 100%;
  min-width: 0;
  padding: 0 12px;
}

#infoInvitationEmail {
  display: block;
  width: 100%;
  min-height: 225px;
  resize: vertical;
  padding: 13px;
  line-height: 1.45;
}

#copyInfoEmailButton {
  margin-top: 10px;
}

@media (max-width: 760px) {
  .tournament-info-view {
    padding: 16px 13px;
    border-radius: 20px;
  }

  .tournament-info-topbar,
  .host-info-heading,
  .info-button-row,
  .info-copy-row {
    align-items: stretch;
    flex-direction: column;
  }

  .info-status-badge {
    align-self: center;
  }

  .tournament-info-grid {
    grid-template-columns: 1fr;
  }

  .host-info-card {
    grid-column: auto;
  }

  .info-detail-list > div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .info-button-row button,
  .info-copy-row button,
  #copyInfoEmailButton {
    width: 100%;
  }

  #infoClassroomLink {
    min-height: 46px;
  }
}

/* =========================================================
   PARTICIPATING EDUCATOR TOURNAMENT ACCESS
   ========================================================= */

.tournament-info-role-label {
  margin: 7px 0 0;
  color: #65566f;
  font-size: 0.9rem;
  font-weight: 850;
}

.participant-info-mode #hostInfoControls {
  display: none !important;
}

.participant-info-mode #classroomAccessCard {
  grid-column: 1 / -1;
}

.invitation-access-message {
  max-width: 760px;
  margin: 16px auto;
  border: 1px solid #d8cee1;
  border-radius: 16px;
  padding: 16px;
  color: #30233a;
  background: #f7f2fb;
  text-align: center;
}

.invitation-access-message strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1.08rem;
}

@media (max-width: 760px) {
  .participant-info-mode #classroomAccessCard {
    grid-column: auto;
  }
}

/* =========================================================
   SHORT TOURNAMENT CODE JOIN FLOW
   ========================================================= */

#joinCode {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 950;
}

#joinCode::placeholder {
  letter-spacing: 0.03em;
}

.dashboard-create-locked {
  opacity: 0.62;
  cursor: not-allowed;
}

.info-educator-list {
  display: grid;
  gap: 9px;
}

.info-educator-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  border: 1px solid #e1dae7;
  border-radius: 13px;
  padding: 8px 12px;
  color: #21182c;
  background: #ffffff;
  font-weight: 850;
}

.info-educator-item small {
  color: #75677f;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.join-success {
  border-color: #9ddbbf !important;
  color: #185b40 !important;
  background: #e4f8ef !important;
}

/* =========================================================
   PRE-TOURNAMENT CLASSROOM DISPLAY
   ========================================================= */

.classroom-display-view {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  box-sizing: border-box;
  border-radius: 22px;
  padding: 22px;
  color: #17121d;
  background: #ffffff;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.22);
}

.classroom-display-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 3px solid #21182c;
  padding-bottom: 14px;
}

.classroom-brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.classroom-logo {
  width: min(34vw, 330px);
  height: auto;
}

.classroom-kicker,
.classroom-panel-label {
  margin: 0;
  color: #6d43ca;
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.12em;
}

.classroom-display-header h2 {
  margin: 3px 0 0;
  font-size: clamp(1.65rem, 4vw, 3.2rem);
  line-height: 1;
}

.classroom-back-button,
.classroom-secondary-button,
.classroom-start-button {
  min-height: 48px;
  border-radius: 13px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 950;
  cursor: pointer;
}

.classroom-back-button,
.classroom-secondary-button {
  border: 2px solid #6d43ca;
  color: #4b2d83;
  background: #f3eefc;
}

.classroom-start-button {
  border: 2px solid #176649;
  color: #ffffff;
  background: #19875d;
}

.classroom-notice {
  margin: 14px 0 0;
  border-radius: 13px;
  padding: 12px 15px;
  color: #244a39;
  background: #e5f8ef;
  font-weight: 850;
}

.classroom-notice.error {
  color: #7e2020;
  background: #ffe6e6;
}

.classroom-display-grid {
  display: grid;
  grid-template-columns: minmax(330px, 0.85fr) minmax(0, 1.4fr);
  gap: 18px;
  margin-top: 18px;
}

.classroom-join-panel,
.classroom-participants-panel,
.classroom-host-controls {
  border: 2px solid #d9d0df;
  border-radius: 20px;
  padding: 20px;
  background: #fbf9fd;
}

.student-join-url {
  margin: 7px 0 20px;
  font-size: clamp(2rem, 5vw, 4.7rem);
  font-weight: 1000;
  line-height: 1;
  letter-spacing: -0.04em;
}

.classroom-student-code {
  margin: 7px 0 17px;
  border: 4px solid #21182c;
  border-radius: 17px;
  padding: 12px;
  text-align: center;
  font-size: clamp(3rem, 8vw, 7.5rem);
  font-weight: 1000;
  line-height: 1;
  letter-spacing: 0.12em;
}

.classroom-qr-code {
  display: flex;
  min-height: 210px;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.classroom-qr-code img,
.classroom-qr-code canvas {
  max-width: 230px;
  width: 100% !important;
  height: auto !important;
}

.classroom-qr-help {
  margin: 10px 0 0;
  color: #5f5366;
  text-align: center;
  font-weight: 750;
}

.classroom-panel-heading,
.classroom-host-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.classroom-panel-heading h3,
.classroom-host-heading h3 {
  margin: 4px 0 0;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
}

.classroom-participant-count {
  display: inline-flex;
  min-width: 54px;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  background: #6d43ca;
  font-size: 1.4rem;
  font-weight: 1000;
}

.classroom-participants {
  display: grid;
  gap: 10px;
  max-height: 65vh;
  margin-top: 15px;
  overflow-y: auto;
}

.classroom-waiting-empty {
  border: 2px dashed #cfc4d8;
  border-radius: 15px;
  padding: 30px 18px;
  color: #6c6173;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
}

.classroom-team-group {
  border: 2px solid #dcd4e3;
  border-radius: 16px;
  padding: 13px;
  background: #ffffff;
}

.classroom-team-group h4 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 10px;
  font-size: 1.3rem;
}

.classroom-team-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
}

.classroom-student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #e6e0eb;
  padding: 9px 2px;
  font-size: 1.1rem;
  font-weight: 850;
}

.classroom-student-row:first-of-type {
  border-top: 0;
}

.classroom-student-actions {
  display: flex;
  gap: 6px;
}

.classroom-student-actions button {
  min-height: 34px;
  border: 1px solid #9b8aaa;
  border-radius: 9px;
  padding: 5px 9px;
  color: #382744;
  background: #f4eff7;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  cursor: pointer;
}

.classroom-host-controls {
  grid-column: 1 / -1;
}

.classroom-host-heading > span {
  border-radius: 999px;
  padding: 6px 11px;
  color: #7b4d00;
  background: #ffefd3;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.06em;
}

.classroom-control-row {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-top: 15px;
}

.classroom-duration-field {
  display: grid;
  gap: 7px;
  margin-right: auto;
  color: #55475d;
  font-size: 0.85rem;
  font-weight: 900;
}

.classroom-duration-field > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.classroom-duration-field input {
  width: 90px;
  min-height: 48px;
  box-sizing: border-box;
  border: 2px solid #9b8aaa;
  border-radius: 12px;
  padding: 8px;
  color: #21182c;
  background: #ffffff;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 900;
  text-align: center;
}

.participant-classroom-mode #classroomHostControls {
  display: none !important;
}

@media (max-width: 900px) {
  .classroom-display-header,
  .classroom-brand-block,
  .classroom-control-row {
    align-items: stretch;
    flex-direction: column;
  }

  .classroom-logo {
    width: min(100%, 390px);
  }

  .classroom-display-grid {
    grid-template-columns: 1fr;
  }

  .classroom-host-controls {
    grid-column: auto;
  }

  .classroom-back-button,
  .classroom-secondary-button,
  .classroom-start-button {
    width: 100%;
  }
}

/* =========================================================
   CLASSROOM DISPLAY LAYOUT REFINEMENT
   ========================================================= */

.classroom-display-view {
  padding: 20px;
}

.classroom-display-grid {
  grid-template-columns:
    minmax(300px, 0.72fr)
    minmax(0, 1.28fr);
  align-items: start;
  gap: 16px;
}

.classroom-join-panel {
  padding: 18px;
  overflow: hidden;
}

.student-join-url {
  margin: 6px 0 18px;
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(1.75rem, 3.3vw, 3.15rem);
  line-height: 1;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.classroom-student-code {
  margin: 6px 0 14px;
  border-width: 3px;
  border-radius: 15px;
  padding: 12px 8px;
  font-size: clamp(3rem, 6vw, 5.5rem);
  line-height: 1;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.classroom-qr-code {
  min-height: 0;
  margin: 4px auto 0;
}

.classroom-qr-code img,
.classroom-qr-code canvas {
  width: 180px !important;
  max-width: 180px;
  height: 180px !important;
}

.classroom-participants-panel {
  min-height: 430px;
  padding: 18px;
}

.classroom-participants {
  max-height: 350px;
}

.classroom-host-controls {
  padding: 18px;
}

.classroom-control-row {
  margin-top: 12px;
}

.classroom-qr-help {
  display: none !important;
}

@media (min-width: 1100px) {
  .classroom-display-view {
    max-width: 1180px;
  }

  .classroom-logo {
    width: 250px;
  }

  .classroom-display-header {
    gap: 20px;
    padding-bottom: 12px;
  }

  .classroom-display-header h2 {
    font-size: 2.65rem;
  }
}

@media (max-width: 900px) {
  .student-join-url {
    font-size: clamp(1.7rem, 8vw, 3rem);
  }

  .classroom-student-code {
    font-size: clamp(2.8rem, 15vw, 5rem);
  }

  .classroom-qr-code img,
  .classroom-qr-code canvas {
    width: 170px !important;
    max-width: 170px;
    height: 170px !important;
  }

  .classroom-participants-panel {
    min-height: 300px;
  }
}

/* =========================================================
   CLASSROOM DISPLAY NAVIGATION
   ========================================================= */

.classroom-navigation-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .classroom-navigation-buttons {
    width: 100%;
  }

  .classroom-navigation-buttons
  .classroom-back-button {
    flex: 1 1 180px;
  }
}

/* =========================================================
   FULL-SCREEN CLASSROOM CONTROL BOARD
   ========================================================= */

body.classroom-active {
  overflow: hidden;
}

body.classroom-active .page-shell {
  width: 100vw;
  max-width: none;
  height: 100vh;
  margin: 0;
  padding: 5px 10px 8px;
  overflow: hidden;
}

body.classroom-active .topbar {
  min-height: 30px;
  margin: 0 4px 4px;
}

body.classroom-active .home-link {
  min-height: 28px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.72rem;
}

body.classroom-active .home-icon {
  font-size: 0.8rem;
}

body.classroom-active .account-chip {
  min-height: 28px;
  padding: 3px 10px;
  font-size: 0.7rem;
}

.classroom-display-view {
  position: relative;
  display: flex;
  width: calc(100vw - 20px);
  max-width: none;
  height: calc(100vh - 46px);
  margin: 0;
  flex-direction: column;
  border-radius: 14px;
  padding: 8px 12px 10px;
  overflow: hidden;
}

.classroom-display-header {
  min-height: 92px;
  flex: 0 0 92px;
  gap: 14px;
  border-bottom-width: 2px;
  padding: 2px 6px 7px;
}

.classroom-brand-block {
  gap: 12px;
}

.classroom-logo {
  width: 150px;
  max-height: 86px;
  object-fit: contain;
}

.classroom-kicker {
  font-size: 0.62rem;
}

.classroom-display-header h2 {
  margin-top: 1px;
  font-size: clamp(1.75rem, 2.7vw, 2.7rem);
}

.classroom-navigation-buttons {
  gap: 9px;
}

.classroom-navigation-buttons
.classroom-back-button {
  width: auto;
  min-height: auto;
  border: 0;
  border-radius: 0;
  padding: 3px 2px;
  color: #5f427c;
  background: transparent;
  font-size: 0.72rem;
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.classroom-notice {
  position: absolute;
  z-index: 20;
  top: 98px;
  right: 18px;
  max-width: 420px;
  margin: 0;
  padding: 7px 10px;
  font-size: 0.76rem;
  box-shadow: 0 5px 18px rgba(31, 20, 41, 0.18);
}

.classroom-display-grid {
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  grid-template-columns:
    minmax(280px, 320px)
    minmax(0, 1fr);
  grid-template-rows:
    minmax(0, 1fr)
    132px
    50px;
  gap: 7px;
  margin-top: 7px;
}

.classroom-join-panel,
.classroom-participants-panel,
.classroom-chat-panel,
.classroom-host-controls {
  min-width: 0;
  min-height: 0;
  border-width: 1px;
  border-radius: 11px;
  padding: 9px;
}

.classroom-join-panel {
  grid-column: 1;
  grid-row: 1 / 3;
  min-height: 0;
}

.classroom-panel-label {
  font-size: 0.61rem;
}

.student-join-url {
  width: 100%;
  margin: 3px 0 8px;
  overflow: hidden;
  font-size: clamp(1.65rem, 2.2vw, 2.3rem);
  line-height: 1;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.classroom-student-code {
  width: 100%;
  min-height: 75px;
  margin: 3px 0 8px;
  border-width: 2px;
  border-radius: 10px;
  padding: 5px;
  overflow: hidden;
  font-size: clamp(2.65rem, 4vw, 4.15rem);
  letter-spacing: 0.015em;
}

.classroom-qr-code {
  min-height: 0;
  margin: 0 auto;
}

.classroom-qr-code img,
.classroom-qr-code canvas {
  width: 170px !important;
  max-width: 170px !important;
  height: 170px !important;
}

.classroom-participants-panel {
  display: flex;
  grid-column: 2;
  grid-row: 1;
  flex-direction: column;
  overflow: hidden;
}

.classroom-panel-heading {
  min-height: 42px;
  flex: 0 0 auto;
}

.classroom-panel-heading h3 {
  margin: 0;
  font-size: clamp(1.8rem, 2.5vw, 2.6rem);
}

.classroom-participant-count {
  min-width: 44px;
  min-height: 44px;
  font-size: 1.15rem;
}

.classroom-participants {
  display: grid;
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  grid-template-columns:
    repeat(
      auto-fill,
      minmax(160px, 1fr)
    );
  grid-auto-rows: min-content;
  align-content: start;
  gap: 5px;
  margin-top: 6px;
  padding: 2px 4px 4px 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.classroom-waiting-empty {
  grid-column: 1 / -1;
  margin: 0;
  border-width: 1px;
  border-radius: 9px;
  padding: 18px 10px;
  font-size: 1rem;
}

.classroom-student-row {
  display: grid;
  min-width: 0;
  min-height: 34px;
  grid-template-columns:
    minmax(0, 1fr)
    auto
    24px;
  align-items: center;
  gap: 4px;
  border: 1px solid #e1dae7;
  border-radius: 8px;
  padding: 4px 4px 4px 8px;
  background: #ffffff;
  font-size: 0.9rem;
  line-height: 1.05;
}

.classroom-student-row > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classroom-player-team {
  display: inline-flex;
  min-width: 0;
  max-width: 72px;
  align-items: center;
  gap: 3px;
}

.classroom-player-team > span {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.classroom-player-team small {
  overflow: hidden;
  color: #776b7e;
  font-size: 0.58rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classroom-student-actions {
  display: block;
}

.classroom-student-actions button {
  width: 24px;
  min-height: 24px;
  border: 0;
  border-radius: 6px;
  padding: 0;
  font-size: 0.64rem;
}

.classroom-chat-panel {
  display: grid;
  grid-column: 2;
  grid-row: 2;
  grid-template-columns:
    minmax(0, 1fr)
    minmax(240px, 36%);
  grid-template-rows: 20px minmax(0, 1fr);
  gap: 4px 8px;
  overflow: hidden;
  background: #f8f5fa;
}

.classroom-chat-heading {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: space-between;
  color: #6d43ca;
  font-size: 0.61rem;
  font-weight: 950;
  letter-spacing: 0.11em;
}

.classroom-chat-count {
  display: inline-flex;
  min-width: 22px;
  min-height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #ffffff;
  background: #6d43ca;
  font-size: 0.58rem;
}

.classroom-chat-feed {
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
}

.classroom-chat-message {
  display: flex;
  gap: 5px;
  border-bottom: 1px solid #e5dfe9;
  padding: 3px 2px;
  font-size: 0.72rem;
  line-height: 1.15;
}

.classroom-chat-message strong {
  flex: 0 0 auto;
  color: #533476;
}

.classroom-chat-message span {
  overflow-wrap: anywhere;
}

.classroom-chat-empty {
  color: #766c7c;
  font-size: 0.72rem;
  font-weight: 750;
}

.classroom-chat-form {
  display: flex;
  min-width: 0;
  align-items: stretch;
  gap: 5px;
}

.classroom-chat-form input {
  min-width: 0;
  flex: 1 1 auto;
  border: 1px solid #a997b6;
  border-radius: 7px;
  padding: 5px 7px;
  font: inherit;
  font-size: 0.72rem;
}

.classroom-chat-form button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 7px;
  padding: 4px 10px;
  color: #ffffff;
  background: #6d43ca;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 900;
  cursor: pointer;
}

.classroom-host-controls {
  display: flex;
  grid-column: 1 / -1;
  grid-row: 3;
  align-items: center;
  gap: 10px;
  padding: 5px 8px;
}

.classroom-host-label {
  flex: 0 0 auto;
  margin: 0;
  color: #6d43ca;
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.1em;
}

.classroom-control-row {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  margin: 0;
}

.classroom-duration-field {
  display: flex;
  margin: 0 auto 0 0;
  align-items: center;
  gap: 6px;
  font-size: 0.63rem;
}

.classroom-duration-field > div {
  gap: 4px;
}

.classroom-duration-field input {
  width: 56px;
  min-height: 30px;
  border-width: 1px;
  border-radius: 7px;
  padding: 3px 5px;
  font-size: 0.88rem;
}

.classroom-secondary-button,
.classroom-start-button {
  width: auto;
  min-height: 32px;
  border-width: 1px;
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 0.72rem;
}

.classroom-display-view.chat-disabled
.classroom-participants-panel {
  grid-row: 1 / 3;
}

.classroom-display-view.chat-disabled
.classroom-chat-panel {
  display: none !important;
}

.participant-classroom-mode
.classroom-display-grid {
  grid-template-rows:
    minmax(0, 1fr)
    132px;
}

.participant-classroom-mode
.classroom-join-panel {
  grid-row: 1 / 3;
}

.participant-classroom-mode
.classroom-host-controls {
  display: none !important;
}

.participant-classroom-mode.chat-disabled
.classroom-participants-panel {
  grid-row: 1 / 3;
}

@media (min-width: 1500px) {
  .classroom-display-grid {
    grid-template-columns:
      330px
      minmax(0, 1fr);
  }

  .classroom-participants {
    grid-template-columns:
      repeat(
        auto-fill,
        minmax(175px, 1fr)
      );
  }
}

@media (max-width: 900px) {
  body.classroom-active {
    overflow: auto;
  }

  body.classroom-active .page-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .classroom-display-view {
    width: 100%;
    height: auto;
    min-height: calc(100vh - 46px);
    overflow: visible;
  }

  .classroom-display-grid {
    display: flex;
    flex-direction: column;
  }

  .classroom-join-panel,
  .classroom-participants-panel,
  .classroom-chat-panel,
  .classroom-host-controls {
    width: 100%;
  }

  .classroom-participants {
    max-height: 420px;
  }

  .classroom-chat-panel {
    min-height: 150px;
    grid-template-columns: 1fr;
    grid-template-rows:
      20px
      minmax(70px, 1fr)
      auto;
  }

  .classroom-chat-form {
    grid-column: 1;
  }

  .classroom-host-controls,
  .classroom-control-row {
    flex-wrap: wrap;
  }

  /*
   * Let the header grow on phones so the navigation
   * buttons are not hidden behind the panels below.
   */
  .classroom-display-header {
    flex: 0 0 auto;
    min-height: 0;
  }
}

/* =========================================================
   NARROW CLASSROOM DISPLAY TUNING
   ========================================================= */

@media (min-width: 901px) {
  /*
   * Left side:
   * join information above educator chat.
   *
   * Right side:
   * Players uses the full available height.
   *
   * Bottom:
   * compact host controls remain unchanged.
   */
  .classroom-display-grid {
    grid-template-columns:
      minmax(350px, 390px)
      minmax(0, 1fr);
    grid-template-rows:
      minmax(0, 1fr)
      175px
      50px;
  }

  .classroom-join-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .classroom-participants-panel {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .classroom-chat-panel {
    grid-column: 1;
    grid-row: 2;
  }

  /*
   * The projector URL should be readable but not heavy.
   * Keep it on one line and fit it inside the left panel.
   */
  .student-join-url {
    width: 100%;
    margin: 4px 0 9px;
    overflow: hidden;
    font-family:
      Arial,
      Helvetica,
      sans-serif;
    font-size: clamp(1.75rem, 2.2vw, 2.35rem);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -0.035em;
    text-overflow: clip;
    white-space: nowrap;
  }

  /*
   * Educator chat is projected for students to read.
   * Increase feed text without enlarging the teacher input.
   */
  .classroom-chat-panel {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows:
      22px
      minmax(0, 1fr)
      34px;
    gap: 5px;
    padding: 9px 11px;
  }

  .classroom-chat-heading {
    grid-column: 1;
  }

  .classroom-chat-feed {
    grid-column: 1;
    font-size: 1.35rem;
    line-height: 1.2;
  }

  .classroom-chat-message {
    gap: 8px;
    padding: 5px 2px;
    font-size: 1.35rem;
    line-height: 1.2;
  }

  .classroom-chat-empty {
    font-size: 1.15rem;
  }

  .classroom-chat-form {
    grid-column: 1;
    min-height: 34px;
  }

  .classroom-chat-form input {
    font-size: 0.8rem;
  }

  .classroom-chat-form button {
    font-size: 0.76rem;
  }

  /*
   * When chat is disabled, the join panel may use both upper rows.
   */
  .classroom-display-view.chat-disabled
  .classroom-join-panel {
    grid-row: 1 / 3;
  }

  .classroom-display-view.chat-disabled
  .classroom-participants-panel {
    grid-row: 1 / 3;
  }
}

/* =========================================================
   CLASSROOM CHAT SCROLL AND COMPARTMENT REPAIR
   ========================================================= */

@media (min-width: 901px) {
  /*
   * Row 1 ends naturally after the join panel.
   * Row 2 gives all remaining height to educator chat.
   * The Players panel spans both rows.
   */
  .classroom-display-grid {
    grid-template-columns:
      minmax(350px, 390px)
      minmax(0, 1fr);

    grid-template-rows:
      auto
      minmax(0, 1fr)
      50px;

    gap: 9px;
  }

  .classroom-join-panel {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
  }

  .classroom-chat-panel {
    display: grid;
    min-height: 0;
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows:
      24px
      minmax(0, 1fr)
      38px;
    align-self: stretch;
    gap: 6px;
    overflow: hidden;
  }

  .classroom-participants-panel {
    min-height: 0;
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .classroom-host-controls {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  /*
   * The feed owns the scrolling.
   * The heading and message-entry form remain fixed.
   */
  .classroom-chat-heading {
    min-height: 0;
    grid-column: 1;
    grid-row: 1;
  }

  .classroom-chat-feed {
    min-width: 0;
    min-height: 0;
    grid-column: 1;
    grid-row: 2;
    padding-right: 5px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .classroom-chat-form {
    display: flex;
    min-width: 0;
    min-height: 38px;
    grid-column: 1;
    grid-row: 3;
    align-items: stretch;
    gap: 6px;
    overflow: visible;
  }

  .classroom-chat-form input {
    min-width: 0;
    min-height: 38px;
    flex: 1 1 auto;
    box-sizing: border-box;
  }

  .classroom-chat-form button {
    min-height: 38px;
    flex: 0 0 auto;
  }

  .classroom-chat-message {
    align-items: flex-start;
  }

  .classroom-chat-message strong {
    flex: 0 0 auto;
  }

  .classroom-chat-message span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  /*
   * Stronger room divisions with very light fills.
   */
  .classroom-join-panel,
  .classroom-participants-panel,
  .classroom-chat-panel,
  .classroom-host-controls {
    border: 2px solid #2d2533;
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.85) inset,
      0 2px 7px rgba(31, 24, 38, 0.06);
  }

  .classroom-join-panel {
    background: #faf7ff;
  }

  .classroom-participants-panel {
    background: #f8fbff;
  }

  .classroom-chat-panel {
    background: #fff9f3;
  }

  .classroom-host-controls {
    background: #f7fcf8;
  }

  .classroom-waiting-empty {
    border: 2px dashed #b8aebe;
    background: rgba(255, 255, 255, 0.72);
  }

  .classroom-student-row {
    border: 1px solid #bfb6c5;
  }

  .classroom-chat-message {
    border-bottom: 1px solid #cfc4d3;
  }

  .classroom-chat-form input {
    border: 2px solid #5d5265;
    background: #ffffff;
  }

  /*
   * Without chat, the join panel may use the left side normally
   * while Players continues using the full right side.
   */
  .classroom-display-view.chat-disabled
  .classroom-join-panel {
    grid-row: 1 / 3;
  }

  .classroom-display-view.chat-disabled
  .classroom-participants-panel {
    grid-row: 1 / 3;
  }
}

/* =========================================================
   CLASSROOM CHAT INPUT AND MENU READABILITY
   ========================================================= */

.classroom-chat-form input {
  color: #21182c !important;
  background: #ffffff !important;
  caret-color: #21182c;
  -webkit-text-fill-color: #21182c;
  opacity: 1;
}

.classroom-chat-form input::placeholder {
  color: #786d7f;
  opacity: 1;
}

@media (min-width: 901px) {
  .classroom-navigation-buttons
  .classroom-back-button {
    font-size: 0.95rem;
    font-weight: 900;
    padding: 5px 4px;
  }

  .classroom-navigation-buttons {
    gap: 18px;
  }
}

/* =========================================================
   CLASSROOM HEADER LOGO AND COLOR TUNING
   ========================================================= */

.classroom-home-link {
  color: #5f427c;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (min-width: 901px) {
  /*
   * The classroom menu now owns the ZoodleBug home link.
   * Hide the separate top-left copy only on this screen.
   */
  body.classroom-active .topbar .home-link {
    visibility: hidden;
    pointer-events: none;
  }

  .classroom-navigation-buttons {
    position: relative;
    z-index: 5;
    align-items: center;
    gap: 18px;
  }

  .classroom-home-link,
  .classroom-navigation-buttons
  .classroom-back-button {
    font-size: 0.95rem;
    line-height: 1;
  }

  /*
   * Enlarge the tournament logo and let it overlap
   * the lower header boundary slightly.
   */
  .classroom-display-header {
    position: relative;
    overflow: visible;
  }

  .classroom-brand-block {
    position: relative;
    overflow: visible;
  }

  .classroom-logo {
    position: relative;
    z-index: 4;
    width: 205px;
    max-height: 128px;
    margin-top: -8px;
    margin-bottom: -24px;
    object-fit: contain;
    filter:
      drop-shadow(
        0 5px 5px rgba(28, 22, 32, 0.16)
      );
  }

  .classroom-display-header h2 {
    position: relative;
    z-index: 5;
  }

  /*
   * Keep Players white and give the other rooms
   * clearer but still very light tints.
   */
  .classroom-join-panel {
    background: #f3edff;
  }

  .classroom-participants-panel {
    background: #ffffff;
  }

  .classroom-chat-panel {
    background: #fff3e8;
  }

  .classroom-host-controls {
    background: #edf9f1;
  }

  .classroom-join-panel,
  .classroom-chat-panel,
  .classroom-host-controls {
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.9) inset,
      0 3px 9px rgba(31, 24, 38, 0.08);
  }
}

/* =========================================================
   FINAL CLASSROOM COLOR AND LOGO ADJUSTMENT
   ========================================================= */

@media (min-width: 901px) {
  /*
   * Allow the logo to extend into the open space above
   * the classroom header without changing the grid below.
   */
  body.classroom-active
  .classroom-display-view {
    overflow: visible;
  }

  body.classroom-active
  .classroom-display-header {
    position: relative;
    overflow: visible;
  }

  body.classroom-active
  .classroom-brand-block {
    position: relative;
    overflow: visible;
  }

  body.classroom-active
  .classroom-logo {
    position: relative;
    z-index: 10;
    width: 235px;
    max-height: 145px;
    margin-top: -28px;
    margin-bottom: -30px;
    transform: translateY(-3px);
  }

  body.classroom-active
  .classroom-display-header h2 {
    position: relative;
    z-index: 11;
  }

  body.classroom-active
  .classroom-navigation-buttons {
    position: relative;
    z-index: 11;
  }

  /*
   * Use clearly visible but still light compartment colors.
   * Players intentionally remains white.
   */
  body.classroom-active
  .classroom-display-grid
  .classroom-join-panel {
    background-color: #eee5ff !important;
  }

  body.classroom-active
  .classroom-display-grid
  .classroom-participants-panel {
    background-color: #ffffff !important;
  }

  body.classroom-active
  .classroom-display-grid
  .classroom-chat-panel {
    background-color: #ffedda !important;
  }

  body.classroom-active
  .classroom-display-grid
  .classroom-host-controls {
    background-color: #e5f6eb !important;
  }

  body.classroom-active
  .classroom-join-panel,
  body.classroom-active
  .classroom-participants-panel,
  body.classroom-active
  .classroom-chat-panel,
  body.classroom-active
  .classroom-host-controls {
    border-color: #241d29 !important;
  }
}

/* ============================================================
   ZOODLEBUG TOURNAMENT — LIVE CLASSROOM STANDINGS
   ============================================================ */

.classroom-live-panel {
  border: 3px solid #d9ddea;
  border-radius: 22px;
  background: #ffffff;
  padding: 18px;
  min-width: 0;
}

.classroom-live-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.classroom-live-heading h3 {
  margin: 2px 0 0;
  font-size: clamp(22px, 2.2vw, 34px);
  line-height: 1;
}

.classroom-live-counts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.classroom-live-counts span {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f1f3f8;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.classroom-live-counts strong {
  font-size: 18px;
}

.classroom-standings {
  display: grid;
  gap: 8px;
}

.classroom-standing-row {
  display: grid;
  grid-template-columns:
    38px minmax(120px, 1.2fr)
    minmax(220px, 2fr) 86px;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 10px;
  border-radius: 14px;
  background: #f7f8fc;
}

.classroom-standing-rank {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #202632;
  color: #ffffff;
  font-size: 17px;
  font-weight: 1000;
}

.classroom-standing-team {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.classroom-standing-team > span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.classroom-standing-team strong {
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classroom-standing-record {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 800;
}

.classroom-standing-record span {
  white-space: nowrap;
}

.classroom-standing-record b {
  font-size: 18px;
}

.classroom-standing-percentage {
  text-align: right;
  font-size: 24px;
  font-weight: 1000;
}

.classroom-standings-empty {
  display: grid;
  place-items: center;
  min-height: 90px;
  color: #687083;
  font-weight: 800;
  text-align: center;
}

.classroom-player-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1;
  font-weight: 1000;
  letter-spacing: .04em;
}

.classroom-player-status.status-playing {
  background: #ddf8e9;
  color: #116337;
}

.classroom-player-status.status-waiting {
  background: #fff1c9;
  color: #744c00;
}

.classroom-player-status.status-ready {
  background: #e9ecf3;
  color: #4d5566;
}

.classroom-display-grid {
  grid-template-areas:
    "join participants"
    "live live"
    "chat chat"
    "controls controls";
}

.classroom-join-panel {
  grid-area: join;
}

.classroom-participants-panel {
  grid-area: participants;
}

.classroom-live-panel {
  grid-area: live;
}

.classroom-chat-panel {
  grid-area: chat;
}

.classroom-host-controls {
  grid-area: controls;
}

@media (max-width: 850px) {
  .classroom-display-grid {
    grid-template-areas:
      "join"
      "participants"
      "live"
      "chat"
      "controls";
  }

  .classroom-standing-row {
    grid-template-columns:
      34px minmax(100px, 1fr) 74px;
  }

  .classroom-standing-record {
    grid-column: 2 / 4;
    padding-left: 0;
  }

  .classroom-live-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .classroom-live-counts {
    justify-content: flex-start;
  }
}

/* ============================================================
   ZOODLEBUG TOURNAMENT — CLOCK + FINAL RESULTS
   ============================================================ */

.classroom-time-left strong {
  font-variant-numeric: tabular-nums;
  min-width: 54px;
  text-align: center;
}

.classroom-champion-banner {
  margin: 0 0 14px;
  padding: 14px 18px;
  border-radius: 16px;
  background: #fff3b8;
  border: 3px solid #e7b62c;
  color: #3e3100;
  text-align: center;
  font-size: clamp(20px, 2.3vw, 34px);
  line-height: 1.15;
  font-weight: 1000;
}

.classroom-end-button {
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  background: #c83d49;
  color: #ffffff;
  font-size: 15px;
  font-weight: 1000;
  cursor: pointer;
}

.classroom-end-button:hover {
  filter: brightness(.94);
}

.classroom-end-button:disabled {
  cursor: wait;
  opacity: .7;
}

.classroom-duration-field input:disabled {
  opacity: .65;
  cursor: not-allowed;
}

/* =========================================================
   PRE-START VS LIVE TOURNAMENT DISPLAY
   ========================================================= */

.classroom-display-view:not(.live-tournament-mode)
.classroom-live-panel {
  display: none;
}

.classroom-display-view.live-tournament-mode
.classroom-display-grid {
  grid-template-columns: 1fr;
}

.classroom-display-view.live-tournament-mode
.classroom-join-panel,
.classroom-display-view.live-tournament-mode
.classroom-participants-panel {
  display: none;
}

.classroom-display-view.live-tournament-mode
.classroom-live-panel {
  display: block;
  grid-column: 1 / -1;
}

.classroom-display-view.live-tournament-mode
.classroom-chat-panel {
  grid-column: 1 / -1;
}

.classroom-display-view.live-tournament-mode
.classroom-host-controls {
  grid-column: 1 / -1;
}

.classroom-display-view.live-tournament-mode
.classroom-duration-field,
.classroom-display-view.live-tournament-mode
#classroomMakeTeamsButton,
.classroom-display-view.live-tournament-mode
#classroomStartButton {
  display: none !important;
}

.classroom-results-panel {
  margin-top: 18px;
  border-top: 2px solid rgba(39, 29, 54, 0.12);
  padding-top: 14px;
}

.classroom-results-heading {
  margin-bottom: 9px;
  color: #6b46d9;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.classroom-results-feed {
  display: grid;
  gap: 7px;
  max-height: 170px;
  overflow-y: auto;
}

.classroom-result-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(118, 87, 255, 0.07);
}

.classroom-result-row strong {
  min-width: 105px;
}

.classroom-result-row span {
  font-weight: 750;
}

.classroom-results-empty {
  padding: 12px;
  text-align: center;
  font-weight: 700;
  opacity: 0.6;
}


/* =========================================================
   PRE-START CLASSROOM LAYOUT — RESTORED
   Join top-left
   Educator chat below join at same width
   Roster fills right side
   Host controls across bottom
   ========================================================= */

@media (min-width: 901px) {
  .classroom-display-view:not(.live-tournament-mode)
  .classroom-display-grid {
    grid-template-columns:
      minmax(280px, 390px)
      minmax(0, 1fr);

    grid-template-rows:
      auto
      minmax(0, 1fr)
      50px;

    align-items: stretch;
  }

  .classroom-display-view:not(.live-tournament-mode)
  .classroom-join-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .classroom-display-view:not(.live-tournament-mode)
  .classroom-chat-panel {
    display: grid;
    grid-column: 1;
    grid-row: 2;

    width: 100%;
    min-height: 0;

    grid-template-columns: 1fr;
    grid-template-rows:
      20px
      minmax(0, 1fr)
      auto;

    gap: 4px;
  }

  .classroom-display-view:not(.live-tournament-mode)
  .classroom-chat-heading {
    grid-column: 1;
  }

  .classroom-display-view:not(.live-tournament-mode)
  .classroom-chat-feed {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
  }

  .classroom-display-view:not(.live-tournament-mode)
  .classroom-chat-form {
    grid-column: 1;
    grid-row: 3;
  }

  .classroom-display-view:not(.live-tournament-mode)
  .classroom-participants-panel {
    grid-column: 2;
    grid-row: 1 / 3;
    height: 100%;
  }

  .classroom-display-view:not(.live-tournament-mode)
  .classroom-host-controls {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .classroom-display-view:not(.live-tournament-mode).chat-disabled
  .classroom-participants-panel {
    grid-row: 1 / 3;
  }
}


/* =========================================================
   CLASSROOM PLAYER NAME MENU
   ========================================================= */

.classroom-student-row {
  position: relative;
  grid-template-columns:
    minmax(0, 1fr)
    auto
    auto;
  min-height: 46px;
  padding: 5px 7px;
}

.classroom-player-name {
  min-width: 0;
  border: 0;
  padding: 3px 5px;
  overflow: hidden;
  background: transparent;
  color: #21182c;
  font: inherit;
  font-size: 1.65rem;
  font-weight: 950;
  line-height: 1.05;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.classroom-player-name:hover,
.classroom-player-name:focus-visible {
  border-radius: 7px;
  background: #f1eafa;
  color: #57319a;
  outline: none;
}

.classroom-student-actions {
  position: static;
  width: 0;
  height: 0;
}

.classroom-player-popup {
  position: absolute;
  z-index: 100;
  top: calc(100% - 2px);
  left: 8px;
  display: grid;
  width: min(220px, calc(100% - 16px));
  gap: 6px;
  box-sizing: border-box;
  border: 1px solid #cfc3d7;
  border-radius: 12px;
  padding: 10px;
  background: #ffffff;
  box-shadow:
    0 12px 30px rgba(37, 24, 45, 0.22);
}

.classroom-player-popup.hidden {
  display: none;
}

.classroom-player-popup-title {
  padding: 2px 4px 5px;
  color: #5b4766;
  font-size: 0.8rem;
  font-weight: 950;
}

.classroom-student-actions
.classroom-player-popup button {
  width: 100%;
  min-height: 38px;
  border: 1px solid #b9a8c5;
  border-radius: 8px;
  padding: 7px 10px;
  background: #f6f1f8;
  color: #35263e;
  font-size: 0.86rem;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.classroom-student-actions
.classroom-player-popup button:hover:not(:disabled) {
  background: #eee5f5;
}

.classroom-student-actions
.classroom-player-popup button.danger {
  border-color: #d8aaaa;
  background: #fff1f1;
  color: #922f2f;
}

.classroom-student-actions
.classroom-player-popup button.quiet {
  background: #ffffff;
  color: #6a5c72;
}

.classroom-student-actions
.classroom-player-popup button:disabled {
  opacity: 0.55;
  cursor: default;
}


/* =========================================================
   LIVE TOURNAMENT EDUCATOR CHAT — USABLE HEIGHT
   ========================================================= */

.classroom-display-view.live-tournament-mode
.classroom-display-grid {
  grid-template-areas:
    "live"
    "chat"
    "controls";

  grid-template-rows:
    auto
    minmax(180px, 230px)
    auto;

  align-items: stretch;
}

.classroom-display-view.live-tournament-mode
.classroom-chat-panel {
  display: grid;
  grid-area: chat;
  min-height: 180px;
  max-height: 230px;
  overflow: hidden;

  grid-template-columns:
    minmax(0, 1fr)
    minmax(260px, 34%);

  grid-template-rows:
    22px
    minmax(0, 1fr);

  gap: 6px 10px;
}

.classroom-display-view.live-tournament-mode
.classroom-chat-heading {
  grid-column: 1 / -1;
  grid-row: 1;
}

.classroom-display-view.live-tournament-mode
.classroom-chat-feed {
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
  overflow-y: auto;
}

.classroom-display-view.live-tournament-mode
.classroom-chat-form {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
}

@media (max-width: 850px) {
  .classroom-display-view.live-tournament-mode
  .classroom-chat-panel {
    max-height: none;
    grid-template-columns: 1fr;
    grid-template-rows:
      22px
      minmax(110px, 1fr)
      auto;
  }

  .classroom-display-view.live-tournament-mode
  .classroom-chat-heading {
    grid-column: 1;
    grid-row: 1;
  }

  .classroom-display-view.live-tournament-mode
  .classroom-chat-feed {
    grid-column: 1;
    grid-row: 2;
  }

  .classroom-display-view.live-tournament-mode
  .classroom-chat-form {
    grid-column: 1;
    grid-row: 3;
  }
}



/* =========================================================
   TYPEABLE TOURNAMENT DATE + CALENDAR PICKER
   ========================================================= */

#setupView .typed-date-wrap {
  position: relative;
  width: 100%;
}

#setupView .typed-date-wrap #meetingDate {
  width: 100%;
  padding-right: 3.5rem;
}

#setupView .typed-date-picker-button {
  position: absolute;
  top: 50%;
  right: 0.55rem;
  z-index: 6;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 2.35rem;
  height: 2.35rem;

  padding: 0;
  margin: 0;

  transform: translateY(-50%);

  border: 0;
  border-radius: 0.55rem;

  background: transparent;
  color: #4d3a5f;

  cursor: pointer;
}

#setupView .typed-date-picker-button:hover {
  background: rgba(77, 58, 95, 0.10);
}

#setupView .typed-date-picker-button:focus-visible {
  outline: 2px solid #6d4d85;
  outline-offset: 1px;
}

#setupView .typed-date-picker-button svg {
  display: block;

  width: 1.45rem;
  height: 1.45rem;

  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;

  pointer-events: none;
}

#setupView .typed-date-calendar {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  z-index: 50;

  width: 19rem;
  max-width: calc(100vw - 2rem);

  padding: 0.85rem;

  border: 2px solid #d8b56c;
  border-radius: 0.9rem;

  background: #fffdf8;
  color: #21162f;

  box-shadow:
    0 12px 30px
    rgba(33, 22, 47, 0.20);
}

#setupView .typed-date-calendar.hidden {
  display: none;
}

#setupView .typed-date-calendar-header {
  display: grid;
  grid-template-columns: 2.25rem 1fr 2.25rem;
  align-items: center;
  gap: 0.4rem;

  margin-bottom: 0.7rem;
}

#setupView .typed-date-calendar-title {
  text-align: center;
  font-weight: 800;
  font-size: 1rem;
}

#setupView .typed-date-calendar-nav {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 2.25rem;
  height: 2.25rem;

  padding: 0;

  border: 0;
  border-radius: 0.55rem;

  background: #eee7f5;
  color: #39254d;

  font-size: 1.6rem;
  line-height: 1;

  cursor: pointer;
}

#setupView .typed-date-calendar-nav:hover {
  background: #dfd3ea;
}

#setupView .typed-date-calendar-weekdays,
#setupView .typed-date-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
}

#setupView .typed-date-calendar-weekdays {
  margin-bottom: 0.3rem;
}

#setupView .typed-date-calendar-weekdays span {
  text-align: center;

  font-size: 0.72rem;
  font-weight: 800;

  color: #70627d;
}

#setupView .typed-date-calendar-blank {
  min-height: 2rem;
}

#setupView .typed-date-calendar-day {
  display: flex;
  align-items: center;
  justify-content: center;

  min-width: 0;
  height: 2rem;

  padding: 0;

  border: 0;
  border-radius: 0.5rem;

  background: transparent;
  color: #21162f;

  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;

  cursor: pointer;
}

#setupView .typed-date-calendar-day:hover {
  background: #eee7f5;
}

#setupView .typed-date-calendar-day.today {
  box-shadow:
    inset 0 0 0 2px #d8b56c;
}

#setupView .typed-date-calendar-day.selected {
  background: #5c3d73;
  color: white;
}

@media (max-width: 600px) {
  #setupView .typed-date-calendar {
    left: 0;
    right: auto;

    width: min(
      19rem,
      calc(100vw - 2rem)
    );
  }
}


/* =========================================================
   ACTIVE TOURNAMENT CONTROL-FIRST LAYOUT — AUTHORITATIVE
   ========================================================= */

/*
 * This block intentionally owns ONLY live/final Tournament mode.
 * The approved pre-start classroom arrangement remains unchanged.
 */

.classroom-display-view.live-tournament-mode
.classroom-display-grid {
  display: grid;
  min-height: 0;
  grid-template-areas:
    "live"
    "chat";
  grid-template-columns:
    minmax(0, 1fr);
  grid-template-rows:
    minmax(0, 1fr)
    minmax(155px, 190px);
  gap: 10px;
  overflow: hidden;
}

.classroom-display-view.live-tournament-mode
.classroom-host-controls {
  display: none !important;
}

.classroom-display-view.live-tournament-mode
.classroom-live-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-area: live;
  grid-template-rows:
    auto
    minmax(0, 1fr);
  gap: 10px;
  border: 2px solid #2d2533;
  border-radius: 14px;
  padding: 12px;
  overflow: hidden;
  background: #ffffff;
}

.classroom-display-view.live-tournament-mode
.classroom-live-heading {
  display: grid;
  min-width: 0;
  grid-template-columns:
    minmax(180px, 0.7fr)
    minmax(0, 1.3fr);
  align-items: center;
  gap: 14px;
  border-bottom:
    2px solid rgba(39, 29, 54, 0.12);
  padding: 0 0 10px;
}

.classroom-live-title {
  min-width: 0;
}

.classroom-live-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.classroom-live-counts {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.classroom-live-counts span {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 12px;
  padding: 7px 11px;
}

.classroom-live-counts
.classroom-time-left-primary {
  display: grid;
  min-width: 150px;
  min-height: 72px;
  place-items: center;
  align-content: center;
  gap: 0;
  border: 3px solid #2d2533;
  border-radius: 14px;
  padding: 5px 15px;
  background: #fff4bf;
}

.classroom-time-left-primary small {
  color: #5c4a00;
  font-size: 0.64rem;
  font-weight: 1000;
  letter-spacing: 0.11em;
}

.classroom-live-counts
.classroom-time-left-primary strong {
  min-width: 0;
  color: #2d2533;
  font-size:
    clamp(2.6rem, 4.7vw, 4.6rem);
  font-weight: 1000;
  line-height: 0.95;
  font-variant-numeric:
    tabular-nums;
}

.classroom-live-actions {
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.classroom-scores-toggle-button {
  min-height: 54px;
  border:
    2px solid #6846b8;
  border-radius: 12px;
  padding: 9px 16px;
  background: #f3efff;
  color: #52328f;
  font-size: 0.9rem;
  font-weight: 1000;
  cursor: pointer;
}

.classroom-scores-toggle-button:hover {
  background: #e9e1ff;
}

.classroom-display-view.live-tournament-mode
.classroom-end-button {
  min-height: 54px;
  border: 3px solid #8d1724;
  border-radius: 12px;
  padding: 9px 20px;
  background: #c62f3e;
  color: #ffffff;
  box-shadow:
    0 3px 0 #831f2a;
  font-size: 1rem;
  font-weight: 1000;
  letter-spacing: 0.02em;
}

.classroom-live-body {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns:
    minmax(0, 1.65fr)
    minmax(270px, 0.72fr);
  gap: 12px;
  overflow: hidden;
}

.classroom-standings-column {
  min-width: 0;
  min-height: 0;
  padding-right: 4px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.classroom-display-view.live-tournament-mode
.classroom-results-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  margin: 0;
  border-top: 0;
  border-left:
    2px solid rgba(39, 29, 54, 0.12);
  padding: 2px 0 0 12px;
  overflow: hidden;
}

.classroom-display-view.live-tournament-mode
.classroom-results-heading {
  flex: 0 0 auto;
  margin: 0 0 9px;
  font-size: 0.82rem;
}

.classroom-display-view.live-tournament-mode
.classroom-results-feed {
  display: grid;
  min-height: 0;
  max-height: none;
  flex: 1 1 auto;
  align-content: start;
  gap: 7px;
  padding-right: 5px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.classroom-top-performer-row {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #d9cbee;
  border-radius: 10px;
  padding: 8px 11px;
  background: #f8f4ff;
}

.classroom-top-performer-row strong {
  min-width: 0;
  overflow: hidden;
  font-size: 1.05rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classroom-top-performer-row span {
  flex: 0 0 auto;
  color: #5f3cab;
  font-weight: 1000;
  white-space: nowrap;
}

.classroom-top-performer-tie {
  border: 2px dashed #9b7dcc;
  border-radius: 10px;
  padding: 13px 11px;
  background: #f5efff;
  color: #543485;
  font-size: 1rem;
  font-weight: 1000;
  line-height: 1.3;
  text-align: center;
}

.classroom-display-view.live-tournament-mode
.classroom-chat-panel {
  min-height: 0;
  max-height: none;
  grid-area: chat;
}

/*
 * Each educator controls this only on their own classroom screen.
 * Team names remain visible, while competitive statistics and the
 * Live Results / Top Performers column disappear.
 */
.classroom-display-view.scores-hidden
.classroom-standing-rank,
.classroom-display-view.scores-hidden
.classroom-standing-record,
.classroom-display-view.scores-hidden
.classroom-standing-percentage,
.classroom-display-view.scores-hidden
.classroom-results-panel {
  display: none !important;
}

.classroom-display-view.scores-hidden
.classroom-live-body {
  grid-template-columns:
    minmax(0, 1fr);
}

.classroom-display-view.scores-hidden
.classroom-standing-row {
  grid-template-columns:
    minmax(0, 1fr);
}

.classroom-display-view.scores-hidden
.classroom-standing-team strong {
  font-size: 1.3rem;
}

/*
 * Smaller classroom displays may scroll naturally.
 * Desktop/projector layouts remain compartmentalized so the
 * timer and End Tournament control cannot be pushed away.
 */
@media (max-width: 900px) {
  .classroom-display-view.live-tournament-mode
  .classroom-display-grid {
    grid-template-rows:
      auto
      auto;
    overflow: visible;
  }

  .classroom-display-view.live-tournament-mode
  .classroom-live-panel {
    overflow: visible;
  }

  .classroom-display-view.live-tournament-mode
  .classroom-live-heading {
    grid-template-columns:
      minmax(0, 1fr);
  }

  .classroom-live-toolbar,
  .classroom-live-counts,
  .classroom-live-actions {
    justify-content: flex-start;
  }

  .classroom-live-body {
    grid-template-columns:
      minmax(0, 1fr);
    overflow: visible;
  }

  .classroom-standings-column {
    overflow: visible;
  }

  .classroom-display-view.live-tournament-mode
  .classroom-results-panel {
    border-top:
      2px solid rgba(39, 29, 54, 0.12);
    border-left: 0;
    padding:
      12px 0 0;
  }

  .classroom-display-view.live-tournament-mode
  .classroom-results-feed {
    max-height: 260px;
  }

  .classroom-display-view.live-tournament-mode
  .classroom-chat-panel {
    max-height: none;
  }
}


/* =========================================================
   SEPARATE TOURNAMENT OVER CLASSROOM SCREEN
   ========================================================= */

.classroom-final-view {
  position: relative;
  min-width: 0;
  min-height: 0;
  grid-area: final;
  border: 3px solid #2c2036;
  border-radius: 22px;
  padding: 18px;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(
      circle at 50% 0,
      rgba(255, 226, 88, .42),
      transparent 32%
    ),
    radial-gradient(
      circle at 8% 80%,
      rgba(87, 220, 255, .24),
      transparent 28%
    ),
    linear-gradient(
      145deg,
      #271343,
      #4d2580 48%,
      #25123d
    );
  color: #ffffff;
  box-shadow:
    inset 0 0 0 2px
      rgba(255,255,255,.12),
    0 10px 35px
      rgba(28,16,39,.24);
}

.classroom-display-view.final-tournament-mode
.classroom-display-grid {
  display: grid;
  grid-template-areas:
    "final";
  grid-template-columns:
    minmax(0, 1fr);
  grid-template-rows:
    minmax(0, 1fr);
}

.classroom-display-view.final-tournament-mode
.classroom-live-panel,
.classroom-display-view.final-tournament-mode
.classroom-chat-panel,
.classroom-display-view.final-tournament-mode
.classroom-host-controls,
.classroom-display-view.final-tournament-mode
.classroom-join-panel,
.classroom-display-view.final-tournament-mode
.classroom-participants-panel {
  display: none !important;
}

.classroom-final-celebration {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}

.classroom-final-burst {
  margin-bottom: 2px;
  font-size:
    clamp(2.1rem, 4.5vw, 4.4rem);
  line-height: 1;
  filter:
    drop-shadow(
      0 4px 3px rgba(0,0,0,.35)
    );
}

.classroom-final-kicker {
  margin: 5px 0 2px;
  color: #ffe660;
  font-size:
    clamp(.72rem, 1.15vw, 1rem);
  font-weight: 1000;
  letter-spacing: .18em;
}

.classroom-final-celebration h2 {
  margin: 0;
  color: #ffffff;
  font-family:
    Impact,
    "Arial Narrow Bold",
    sans-serif;
  font-size:
    clamp(3.2rem, 7vw, 7rem);
  line-height: .88;
  letter-spacing: .03em;
  text-shadow:
    5px 6px 0 #12091e,
    0 0 28px
      rgba(255,230,96,.28);
}

.classroom-final-champion {
  width:
    min(100%, 1000px);
  margin: 18px auto 10px;
  border: 4px solid #e7b522;
  border-radius: 20px;
  padding:
    clamp(13px, 2vw, 21px)
    clamp(14px, 3vw, 30px);
  background:
    linear-gradient(
      135deg,
      #fff5ad,
      #ffd942
    );
  color: #352500;
  box-shadow:
    0 7px 0 #a87800,
    0 14px 34px
      rgba(0,0,0,.3);
  font-size:
    clamp(1.75rem, 4vw, 4rem);
  font-weight: 1000;
  line-height: 1.05;
}

.classroom-final-message {
  margin: 17px 0 15px;
  color:
    rgba(255,255,255,.9);
  font-size:
    clamp(1rem, 1.6vw, 1.35rem);
  font-weight: 850;
}

.classroom-final-stats {
  display: grid;
  max-width: 1250px;
  margin: 18px auto 0;
  grid-template-columns:
    minmax(0, 1.4fr)
    minmax(280px, .72fr);
  gap: 14px;
}

.classroom-final-card {
  min-width: 0;
  border:
    2px solid
    rgba(255,255,255,.22);
  border-radius: 17px;
  padding: 14px;
  background:
    rgba(255,255,255,.94);
  color: #251b2e;
  box-shadow:
    0 8px 24px
    rgba(0,0,0,.2);
}

.classroom-final-section-label {
  margin: 0 0 10px;
  color: #7043cf;
  font-size: .75rem;
  font-weight: 1000;
  letter-spacing: .13em;
}

.classroom-final-standings,
.classroom-final-performers {
  display: grid;
  gap: 7px;
}

.classroom-final-standing-row {
  display: grid;
  min-height: 52px;
  grid-template-columns:
    34px
    minmax(120px, 1fr)
    auto
    72px;
  align-items: center;
  gap: 9px;
  border-radius: 12px;
  padding: 7px 9px;
  background: #f3f1f8;
}

.classroom-final-place {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: #251b2e;
  color: #ffffff;
}

.classroom-final-team {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.classroom-final-team span {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border-radius: 50%;
}

.classroom-final-team strong {
  min-width: 0;
  overflow: hidden;
  font-size: 1.05rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.classroom-final-record {
  font-size: .82rem;
  font-weight: 850;
  white-space: nowrap;
}

.classroom-final-percentage {
  text-align: right;
  font-size: 1.2rem;
  font-weight: 1000;
}

.classroom-final-performers
.classroom-top-performer-row,
.classroom-final-performers
.classroom-top-performer-tie {
  background: #f3efff;
}

.classroom-final-stats-hidden {
  width: min(100%, 760px);
  margin: 22px auto 0;
  border:
    2px solid
    rgba(255,255,255,.25);
  border-radius: 15px;
  padding: 13px 17px;
  background:
    rgba(255,255,255,.11);
  color:
    rgba(255,255,255,.9);
  font-size: 1rem;
  font-weight: 850;
  text-align: center;
}

@media (max-width: 850px) {
  .classroom-final-view {
    min-height: 75vh;
    overflow: visible;
  }

  .classroom-final-stats {
    grid-template-columns:
      minmax(0, 1fr);
  }

  .classroom-final-standing-row {
    grid-template-columns:
      31px
      minmax(0, 1fr)
      65px;
  }

  .classroom-final-record {
    grid-column: 2 / -1;
  }
}


/* =========================================================
   LIVE TOURNAMENT — JOIN INFO + PLAYERS STAY ON SCREEN
   Standings, results and timer on the left.
   Join address, code and QR top-right; players below it.
   Educator chat along the bottom-left.
   The final "Tournament Over" screen is not affected.
   ========================================================= */

@media (min-width: 901px) {
  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-display-grid {
    grid-template-areas:
      "live join"
      "live players"
      "chat players";
    grid-template-columns:
      minmax(0, 1fr)
      clamp(280px, 23vw, 440px);
    grid-template-rows:
      auto
      minmax(0, 1fr)
      clamp(130px, 19vh, 200px);
    gap: 10px;
    overflow: hidden;
  }

  .classroom-display-view.live-tournament-mode.chat-disabled:not(.final-tournament-mode)
  .classroom-display-grid {
    grid-template-areas:
      "live join"
      "live players"
      "live players";
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-join-panel {
    display: grid;
    min-width: 0;
    min-height: 0;
    grid-area: join;
    grid-template-columns:
      minmax(0, 1fr)
      auto;
    grid-template-areas:
      "url-label url-label"
      "url url"
      "code-label qr"
      "code qr";
    grid-template-rows:
      auto
      auto
      auto
      1fr;
    align-items: start;
    gap: 2px 12px;
    padding: 10px 14px 12px;
    overflow: hidden;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-join-panel
  .classroom-panel-label:nth-of-type(1) {
    grid-area: url-label;
    margin: 0;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-join-panel
  .classroom-panel-label:nth-of-type(2) {
    grid-area: code-label;
    margin: 4px 0 0;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .student-join-url {
    grid-area: url;
    margin: 2px 0 6px;
    font-size: clamp(1.45rem, 2.05vw, 2.5rem);
    font-weight: 900;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-student-code {
    grid-area: code;
    min-height: 0;
    margin: 2px 0 0;
    padding: 4px 6px;
    font-size: clamp(1.6rem, 2.3vw, 3.4rem);
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-qr-code {
    grid-area: qr;
    align-self: end;
    margin: 0;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-qr-code img,
  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-qr-code canvas,
  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-qr-code > div {
    width: clamp(88px, 8.4vw, 160px) !important;
    max-width: clamp(88px, 8.4vw, 160px) !important;
    height: clamp(88px, 8.4vw, 160px) !important;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-participants-panel {
    display: flex;
    min-width: 0;
    min-height: 0;
    grid-area: players;
    flex-direction: column;
    padding: 10px 12px;
    overflow: hidden;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-participants-panel
  .classroom-panel-heading h3 {
    font-size: clamp(1.3rem, 1.7vw, 2rem);
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-participants {
    min-height: 0;
    max-height: none;
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-live-heading {
    grid-template-columns:
      minmax(0, 1fr);
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-live-toolbar {
    justify-content: flex-start;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-chat-panel {
    grid-area: chat;
  }
}

/* Short laptop screens: keep the QR only if there is room. */
@media (min-width: 901px) and (max-height: 700px) {
  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-qr-code {
    display: none;
  }
}

@media (max-width: 900px) {
  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-display-grid {
    grid-template-areas:
      "live"
      "join"
      "players"
      "chat";
    grid-template-rows: none;
    grid-auto-rows: auto;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-join-panel {
    display: block;
    grid-area: join;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-participants-panel {
    display: flex;
    grid-area: players;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-participants {
    max-height: 360px;
    overflow-y: auto;
  }
}

.classroom-player-team.classroom-player-placing {
  max-width: 160px;
}

.classroom-player-team.classroom-player-placing small {
  color: #6b46d9;
  font-style: italic;
}

@media (min-width: 901px) {
  /* One readable player per line while the tournament is live. */
  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-participants {
    grid-template-columns:
      minmax(0, 1fr);
    margin-top: 8px;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-student-row {
    min-height: 38px;
    padding: 3px 7px;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-player-name {
    font-size: clamp(1.05rem, 1.25vw, 1.4rem);
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-player-team {
    max-width: 120px;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-player-team.classroom-player-placing {
    max-width: 160px;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-player-team small {
    font-size: 0.72rem;
  }
}

/*
 * Projector screens: let the classroom display fill exactly the
 * space left under the top bar, so nothing is cut off at the bottom.
 */
@media (min-width: 901px) {
  body.classroom-active .page-shell {
    display: flex;
    flex-direction: column;
  }

  body.classroom-active .classroom-display-view {
    height: auto;
    min-height: 0;
    flex: 1 1 auto;
  }
}

.classroom-result-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.classroom-result-row.classroom-result-canceled {
  background: rgba(39, 29, 54, 0.05);
  color: #6c6173;
}

/*
 * Laptop-width live screens: player name on the first line,
 * team and status underneath, so names stay readable.
 */
@media (min-width: 901px) and (max-width: 1599px) {
  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-student-row {
    grid-template-columns:
      minmax(0, 1fr)
      auto;
    row-gap: 1px;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-player-name {
    grid-column: 1 / -1;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-player-team {
    max-width: none;
    padding-left: 5px;
  }

  .classroom-display-view.live-tournament-mode:not(.final-tournament-mode)
  .classroom-result-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

/* Typed meeting time + clock picker (matches the typed date box). */

#setupView .typed-time-wrap #meetingTimeText {
  width: 100%;
  padding-right: 3.5rem;
}

#setupView .typed-time-picker {
  width: 17rem;
}

#setupView .typed-time-picker-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 800;
}

#setupView .typed-time-picker-row select {
  flex: 1 1 0;
  min-width: 0;
  min-height: 2.6rem;
  padding: 0 0.4rem;
  border: 2px solid #d8b56c;
  border-radius: 0.6rem;
  background: #ffffff;
  color: #21162f;
  font: inherit;
  font-weight: 750;
}

#setupView .typed-time-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

#setupView .typed-time-picker-actions button {
  min-height: 2.4rem;
  padding: 0 1rem;
  border-radius: 0.6rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

#setupView .typed-time-picker-clear {
  border: 2px solid #d8b56c;
  background: #ffffff;
  color: #4d3a5f;
}

#setupView .typed-time-picker-done {
  border: 0;
  background: #6d3fa0;
  color: #ffffff;
}


/* =========================================================
   CLASSROOM DISPLAY — READABLE FROM THE BACK OF THE ROOM
   (authoritative; keep this block last)

   Every size on the projector screen comes from the tokens
   below, which grow with the screen:
     label  = eyebrow labels, tags, badges   (16px @1366, ~20px @1920)
     ui     = links, inputs, small buttons    (~17px @1366, ~22px @1920)
     btn    = main teacher buttons            (~19px @1366, ~24px @1920)
     room   = names, chat, results            (~21px @1366, ~28px @1920)
   Nothing on this screen should be set smaller than "label".
   ========================================================= */

body.classroom-active {
  --zt-u: min(1vw, 1.8vh);
  --zt-fs-label: clamp(16px, calc(var(--zt-u) * 0.75 + 6px), 26px);
  --zt-fs-ui: clamp(17px, calc(var(--zt-u) * 0.9 + 5px), 30px);
  --zt-fs-btn: clamp(18px, calc(var(--zt-u) * 1.0 + 5px), 32px);
  --zt-fs-room: clamp(22px, calc(var(--zt-u) * 1.25 + 4px), 40px);
  --zt-fs-name: clamp(26px, calc(var(--zt-u) * 1.3 + 7px), 44px);
  --zt-fs-big: clamp(24px, calc(var(--zt-u) * 1.6 + 4px), 52px);
}

/* ---------- Top bar + header ---------- */

body.classroom-active .topbar .account-chip,
body.classroom-active .topbar .home-link {
  min-height: 0;
  padding: 0.25em 0.8em;
  font-size: var(--zt-fs-label);
  line-height: 1.2;
}

body.classroom-active .topbar .home-icon {
  font-size: 1em;
}

#classroomDisplayView .classroom-home-link,
#classroomDisplayView .classroom-navigation-buttons .classroom-back-button {
  min-height: 44px;
  padding: 6px 4px;
  font-size: var(--zt-fs-ui);
  line-height: 1.1;
}

#classroomDisplayView .classroom-navigation-buttons {
  flex-wrap: wrap;
  justify-content: flex-end;
  column-gap: 1.1em;
  row-gap: 0;
}


#classroomDisplayView .classroom-notice {
  max-width: min(640px, 90vw);
  padding: 0.5em 0.8em;
  font-size: var(--zt-fs-ui);
}

/* ---------- Labels, badges, tags (no more 10px text) ---------- */

#classroomDisplayView .classroom-panel-label,
#classroomDisplayView .classroom-chat-heading,
#classroomDisplayView .classroom-host-label,
#classroomDisplayView .classroom-results-heading,
#classroomDisplayView .classroom-time-left-primary small,
#classroomDisplayView .classroom-final-section-label {
  font-size: var(--zt-fs-label);
  line-height: 1.15;
  letter-spacing: 0.08em;
}

#classroomDisplayView .classroom-participant-count,
#classroomDisplayView .classroom-chat-count {
  min-width: 1.9em;
  min-height: 1.9em;
  padding: 0 0.35em;
  box-sizing: border-box;
  font-size: var(--zt-fs-label);
  line-height: 1;
}

#classroomDisplayView .classroom-participant-count {
  min-width: 2.3em;
  min-height: 2.3em;
  font-size: var(--zt-fs-ui);
}

/* ---------- Join panel: address, code, QR ---------- */

#classroomDisplayView .classroom-join-panel {
  container-type: inline-size;
}

#classroomDisplayView .student-join-url {
  margin: 0.1em 0 0.3em;
  font-size: clamp(22px, 2vw, 44px);
  font-size: clamp(22px, 10.4cqi, 64px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

#classroomDisplayView .classroom-student-code {
  min-height: 0;
  margin: 0.08em 0 0.18em;
  padding: 0.08em 0.1em;
  font-size: clamp(36px, 4vw, 80px);
  font-size: clamp(36px, 19cqi, 96px);
  line-height: 1.05;
  letter-spacing: 0.04em;
}

#classroomDisplayView .classroom-qr-code {
  min-height: 0;
}

#classroomDisplayView .classroom-qr-code img,
#classroomDisplayView .classroom-qr-code canvas,
#classroomDisplayView .classroom-qr-code > div {
  width: clamp(120px, min(15vw, 30vh), 260px) !important;
  max-width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1;
}

/* ---------- Players roster ---------- */

#classroomDisplayView .classroom-panel-heading {
  min-height: 0;
  gap: 12px;
}

#classroomDisplayView .classroom-panel-heading h3 {
  font-size: var(--zt-fs-big);
  line-height: 1.05;
}

#classroomDisplayView .classroom-participants {
  gap: 6px;
  margin-top: 4px;
}

#classroomDisplayView .classroom-waiting-empty {
  padding: 1em 0.6em;
  font-size: var(--zt-fs-room);
}

/* Name on its own line; team and status underneath. */
#classroomDisplayView .classroom-student-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  align-content: center;
  gap: 0 8px;
  min-height: 0;
  padding: 3px 8px 4px;
  font-size: var(--zt-fs-label);
}

#classroomDisplayView .classroom-player-name {
  grid-column: 1 / -1;
  grid-row: 1;
  padding: 1px 4px;
  font-size: var(--zt-fs-name);
  line-height: 1.08;
}

#classroomDisplayView .classroom-student-actions {
  grid-column: 1;
  grid-row: 1;
}

#classroomDisplayView .classroom-player-team,
#classroomDisplayView .classroom-player-team.classroom-player-placing {
  grid-column: 1;
  grid-row: 2;
  max-width: 100%;
  gap: 0.35em;
  padding-left: 4px;
}

#classroomDisplayView .classroom-player-team > span {
  width: 0.7em;
  height: 0.7em;
}

#classroomDisplayView .classroom-player-team small,
#classroomDisplayView .classroom-player-team.classroom-player-placing small {
  font-size: var(--zt-fs-label);
  font-weight: 850;
  line-height: 1.2;
}

#classroomDisplayView .classroom-player-status {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  padding: 0.2em 0.5em;
  font-size: var(--zt-fs-label);
  letter-spacing: 0.03em;
}

/* Player menu (Change Team / Remove / Cancel). */
#classroomDisplayView .classroom-player-popup {
  width: min(300px, calc(100% - 12px));
  left: 6px;
  gap: 8px;
  padding: 10px;
}

#classroomDisplayView .classroom-player-popup-title {
  font-size: var(--zt-fs-ui);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

#classroomDisplayView .classroom-student-actions .classroom-player-popup button {
  min-height: 50px;
  padding: 8px 12px;
  font-size: var(--zt-fs-ui);
  line-height: 1.15;
}

/* ---------- Educator chat ---------- */

#classroomDisplayView .classroom-chat-heading {
  gap: 10px;
}

/* Sender and message flow together so long messages use the full width. */
#classroomDisplayView .classroom-chat-message {
  display: block;
  padding: 0.3em 2px;
  font-size: var(--zt-fs-room);
  line-height: 1.2;
}

#classroomDisplayView .classroom-chat-message strong,
#classroomDisplayView .classroom-chat-message span {
  font-size: 1em;
}

#classroomDisplayView .classroom-chat-message strong {
  margin-right: 0.4em;
}

#classroomDisplayView .classroom-chat-empty {
  font-size: var(--zt-fs-room);
}

#classroomDisplayView .classroom-chat-form {
  gap: 8px;
  min-height: 0;
}

#classroomDisplayView .classroom-chat-form input {
  min-height: 52px;
  padding: 0.35em 0.55em;
  border-radius: 10px;
  font-size: var(--zt-fs-ui);
}

#classroomDisplayView .classroom-chat-form input::placeholder {
  font-size: 1em;
}

#classroomDisplayView .classroom-chat-form button {
  min-height: 52px;
  padding: 0.3em 0.9em;
  border-radius: 10px;
  font-size: var(--zt-fs-btn);
}

/* ---------- Host controls (pre-start) ---------- */

#classroomDisplayView .classroom-host-controls {
  gap: 16px;
  padding: 8px 14px;
}

#classroomDisplayView .classroom-control-row {
  gap: 12px;
}

#classroomDisplayView .classroom-duration-field {
  gap: 0.5em;
  font-size: var(--zt-fs-ui);
  font-weight: 850;
}

#classroomDisplayView .classroom-duration-field > div {
  display: flex;
  align-items: center;
  gap: 0.4em;
}

#classroomDisplayView .classroom-duration-field input {
  width: 3.6em;
  min-height: 52px;
  padding: 0.15em 0.3em;
  border-width: 2px;
  border-radius: 10px;
  font-size: var(--zt-fs-btn);
  font-weight: 900;
  text-align: center;
}

#classroomDisplayView .classroom-secondary-button,
#classroomDisplayView .classroom-start-button {
  min-height: 56px;
  padding: 0.3em 1.2em;
  border-width: 2px;
  border-radius: 12px;
  font-size: var(--zt-fs-btn);
}

/* ---------- Live tournament ---------- */

#classroomDisplayView .classroom-live-heading h3 {
  font-size: var(--zt-fs-big);
}

#classroomDisplayView .classroom-live-counts span:not(.classroom-time-left) {
  min-height: 0;
  padding: 0.35em 0.7em;
  font-size: var(--zt-fs-ui);
}

#classroomDisplayView .classroom-live-counts span:not(.classroom-time-left) strong {
  font-size: 1.3em;
}

#classroomDisplayView .classroom-live-counts .classroom-time-left-primary {
  min-width: 0;
  min-height: 0;
  padding: 0.25em 0.9em 0.3em;
}

#classroomDisplayView .classroom-live-counts .classroom-time-left-primary strong {
  font-size: clamp(2.8rem, min(5vw, 8.5vh), 6.2rem);
}

#classroomDisplayView .classroom-scores-toggle-button,
#classroomDisplayView.live-tournament-mode .classroom-end-button {
  min-height: 56px;
  padding: 0.3em 1em;
  font-size: var(--zt-fs-btn);
  line-height: 1.15;
}

/* Rank | team name | percentage on one line, record underneath the name. */
#classroomDisplayView .classroom-standing-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.1em 0.6em;
  min-height: 0;
  padding: 0.35em 0.6em;
  font-size: var(--zt-fs-big);
}

#classroomDisplayView .classroom-standing-rank {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 1.45em;
  height: 1.45em;
  font-size: 0.8em;
}

#classroomDisplayView .classroom-standing-team {
  grid-column: 2;
  grid-row: 1;
  gap: 0.35em;
}

#classroomDisplayView .classroom-standing-team > span {
  width: 0.6em;
  height: 0.6em;
}

#classroomDisplayView .classroom-standing-team strong {
  font-size: 1em;
}

#classroomDisplayView .classroom-standing-record {
  grid-column: 2 / -1;
  grid-row: 2;
  padding-left: 0.95em;
  gap: 0.2em 0.8em;
  font-size: var(--zt-fs-label);
}

#classroomDisplayView .classroom-standing-record b {
  font-size: var(--zt-fs-room);
}

#classroomDisplayView .classroom-standing-percentage {
  grid-column: 3;
  grid-row: 1;
  font-size: 1.2em;
}

#classroomDisplayView.scores-hidden .classroom-standing-row {
  grid-template-columns: minmax(0, 1fr);
}

#classroomDisplayView.scores-hidden .classroom-standing-team {
  grid-column: 1;
}

#classroomDisplayView.scores-hidden .classroom-standing-team strong {
  font-size: 1.15em;
}

#classroomDisplayView .classroom-standings-empty,
#classroomDisplayView .classroom-results-empty {
  font-size: var(--zt-fs-ui);
}

#classroomDisplayView .classroom-champion-banner {
  font-size: var(--zt-fs-big);
}

/* Results feed: game on one line, what happened underneath. */
#classroomDisplayView .classroom-result-row {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0.4em 0.65em;
  font-size: var(--zt-fs-ui);
  line-height: 1.2;
}

#classroomDisplayView .classroom-result-row strong {
  min-width: 0;
  color: #5a3fb0;
  font-size: var(--zt-fs-label);
}

#classroomDisplayView .classroom-result-row span {
  font-size: 1em;
}

#classroomDisplayView .classroom-top-performer-row {
  min-height: 0;
  padding: 0.35em 0.6em;
}

#classroomDisplayView .classroom-top-performer-row strong {
  font-size: var(--zt-fs-room);
}

#classroomDisplayView .classroom-top-performer-row span,
#classroomDisplayView .classroom-top-performer-tie {
  font-size: var(--zt-fs-ui);
}

/* ---------- Tournament Complete screen ---------- */

#classroomDisplayView .classroom-final-view {
  padding: clamp(12px, 1.4vh, 20px);
}

#classroomDisplayView .classroom-final-burst {
  font-size: clamp(2rem, min(4.5vw, 6.5vh), 4.4rem);
}

#classroomDisplayView .classroom-final-kicker {
  font-size: var(--zt-fs-label);
}

#classroomDisplayView .classroom-final-celebration h2 {
  font-size: clamp(3rem, min(7vw, 8.5vh), 7rem);
}

#classroomDisplayView .classroom-final-champion {
  margin: clamp(8px, 1.6vh, 18px) auto clamp(6px, 1vh, 10px);
  font-size: clamp(1.75rem, min(4vw, 5.8vh), 4rem);
}

#classroomDisplayView .classroom-final-message {
  margin: clamp(8px, 1.4vh, 16px) 0;
  font-size: var(--zt-fs-room);
}

#classroomDisplayView .classroom-final-stats {
  max-width: 1500px;
  margin-top: clamp(8px, 1.4vh, 18px);
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
}

#classroomDisplayView .classroom-final-card {
  padding: 0.6em 0.8em;
}

#classroomDisplayView .classroom-final-standing-row {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 0.6em;
  min-height: 0;
  padding: 0.3em 0.55em;
  font-size: var(--zt-fs-room);
}

#classroomDisplayView .classroom-final-place {
  width: 1.5em;
  height: 1.5em;
  font-size: 0.9em;
}

#classroomDisplayView .classroom-final-team span {
  width: 0.6em;
  height: 0.6em;
}

#classroomDisplayView .classroom-final-team strong {
  font-size: 1em;
}

#classroomDisplayView .classroom-final-record {
  font-size: var(--zt-fs-label);
}

#classroomDisplayView .classroom-final-percentage {
  font-size: 1.15em;
}

#classroomDisplayView .classroom-final-stats-hidden {
  font-size: var(--zt-fs-room);
}

/* ---------- Projector / desktop layouts ---------- */

@media (min-width: 901px) {
  body.classroom-active .topbar {
    min-height: 0;
    margin: 0 4px 5px;
  }

  #classroomDisplayView .classroom-display-header {
    min-height: 0;
    flex: 0 0 auto;
    padding: 2px 6px 8px;
  }

  #classroomDisplayView .classroom-display-header h2 {
    font-size: clamp(1.9rem, min(2.6vw, 4.6vh), 3.3rem);
  }

  #classroomDisplayView .classroom-logo {
    width: clamp(170px, 12.5vw, 250px);
    max-height: clamp(110px, 14vh, 150px);
  }

  /* ----- Before the tournament starts: join | players | chat ----- */

  #classroomDisplayView:not(.live-tournament-mode):not(.final-tournament-mode) .classroom-display-grid {
    grid-template-areas:
      "join participants chat"
      "controls controls controls";
    grid-template-columns:
      clamp(300px, 22vw, 440px)
      minmax(0, 1fr)
      clamp(310px, 24vw, 500px);
    grid-template-rows:
      minmax(0, 1fr)
      auto;
    gap: 10px;
  }

  #classroomDisplayView:not(.live-tournament-mode):not(.final-tournament-mode).chat-disabled .classroom-display-grid {
    grid-template-areas:
      "join participants participants"
      "controls controls controls";
  }

  #classroomDisplayView.participant-classroom-mode:not(.live-tournament-mode):not(.final-tournament-mode) .classroom-display-grid {
    grid-template-areas:
      "join participants chat";
    grid-template-rows: minmax(0, 1fr);
  }

  #classroomDisplayView.participant-classroom-mode.chat-disabled:not(.live-tournament-mode):not(.final-tournament-mode) .classroom-display-grid {
    grid-template-areas:
      "join participants participants";
  }

  #classroomDisplayView:not(.live-tournament-mode):not(.final-tournament-mode) .classroom-join-panel {
    display: flex;
    grid-area: join;
    flex-direction: column;
    align-self: stretch;
    padding: 12px 14px;
    overflow: hidden;
  }

  #classroomDisplayView:not(.live-tournament-mode):not(.final-tournament-mode) .classroom-qr-code {
    flex: 1 1 auto;
    align-items: center;
    margin-top: 4px;
  }

  #classroomDisplayView:not(.live-tournament-mode):not(.final-tournament-mode) .classroom-participants-panel {
    grid-area: participants;
    height: auto;
    padding: 12px 14px;
  }

  #classroomDisplayView:not(.live-tournament-mode):not(.final-tournament-mode) .classroom-participants {
    grid-template-columns:
      repeat(
        auto-fill,
        minmax(clamp(150px, 11vw, 300px), 1fr)
      );
  }

  #classroomDisplayView:not(.live-tournament-mode):not(.final-tournament-mode) .classroom-chat-panel {
    display: grid;
    grid-area: chat;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 8px;
    padding: 12px 14px;
  }

  #classroomDisplayView:not(.live-tournament-mode):not(.final-tournament-mode) .classroom-chat-heading,
  #classroomDisplayView:not(.live-tournament-mode):not(.final-tournament-mode) .classroom-chat-feed,
  #classroomDisplayView:not(.live-tournament-mode):not(.final-tournament-mode) .classroom-chat-form {
    grid-column: 1;
    grid-row: auto;
  }

  #classroomDisplayView:not(.live-tournament-mode):not(.final-tournament-mode) .classroom-host-controls {
    grid-area: controls;
  }

  /* ----- Live tournament ----- */

  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-display-grid {
    grid-template-columns:
      minmax(0, 1fr)
      clamp(300px, 24vw, 480px);
    grid-template-rows:
      auto
      minmax(0, 1fr)
      clamp(150px, 23vh, 270px);
  }

  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-live-panel {
    gap: 8px;
    padding: 10px 14px;
  }

  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-live-heading {
    gap: 8px;
    padding-bottom: 8px;
  }

  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-live-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0 0.8em;
  }

  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-live-body {
    grid-template-columns:
      minmax(0, 1.5fr)
      minmax(0, 1fr);
  }

  #classroomDisplayView.live-tournament-mode.scores-hidden:not(.final-tournament-mode) .classroom-live-body {
    grid-template-columns: minmax(0, 1fr);
  }

  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-join-panel {
    grid-template-rows: auto auto auto auto;
    align-items: center;
    gap: 2px 12px;
    padding: 10px 14px;
  }

  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .student-join-url {
    font-size: clamp(22px, 9.4cqi, 60px);
  }

  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-student-code {
    align-self: start;
    font-size: clamp(28px, 11.5cqi, 64px);
  }

  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-qr-code img,
  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-qr-code canvas,
  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-qr-code > div {
    width: clamp(84px, min(30cqi, 15vh), 160px) !important;
  }

  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-participants {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-player-name {
    font-size: var(--zt-fs-room);
  }

  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-participants-panel .classroom-panel-heading h3 {
    font-size: var(--zt-fs-big);
  }

  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-chat-panel {
    grid-template-columns:
      minmax(0, 1fr)
      clamp(260px, 26%, 420px);
    grid-template-rows: auto minmax(0, 1fr);
    gap: 6px 12px;
    padding: 10px 14px;
  }

  /* Message box on top, a full-width Send button underneath. */
  #classroomDisplayView .classroom-chat-form {
    flex-direction: column;
  }

  #classroomDisplayView .classroom-chat-form input {
    flex: 0 0 auto;
  }
}

/* Very short screens: drop the live QR so the code and players fit. */
@media (min-width: 901px) and (max-height: 700px) {
  #classroomDisplayView.live-tournament-mode:not(.final-tournament-mode) .classroom-qr-code {
    display: none;
  }
}

/* ---------- Phones / narrow screens ---------- */

@media (max-width: 900px) {
  #classroomDisplayView .student-join-url {
    font-size: clamp(22px, 9cqi, 48px);
  }

  #classroomDisplayView .classroom-navigation-buttons {
    justify-content: flex-start;
  }

  #classroomDisplayView .classroom-participants {
    grid-template-columns:
      repeat(auto-fill, minmax(min(100%, 220px), 1fr));
  }

  #classroomDisplayView .classroom-chat-panel {
    grid-template-rows: auto minmax(90px, 1fr) auto;
  }

  #classroomDisplayView .classroom-chat-form {
    flex-direction: column;
  }

  #classroomDisplayView .classroom-host-controls {
    flex-direction: column;
    align-items: stretch;
  }

  #classroomDisplayView .classroom-control-row {
    flex-direction: column;
    align-items: stretch;
  }

  #classroomDisplayView .classroom-duration-field {
    flex-wrap: wrap;
    margin: 0;
  }

  #classroomDisplayView .classroom-final-standing-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  #classroomDisplayView .classroom-final-place {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  #classroomDisplayView .classroom-final-team {
    grid-column: 2;
    grid-row: 1;
  }

  #classroomDisplayView .classroom-final-percentage {
    grid-column: 3;
    grid-row: 1;
  }

  #classroomDisplayView .classroom-final-record {
    grid-column: 2 / -1;
    grid-row: 2;
  }

  #classroomDisplayView .classroom-final-stats {
    grid-template-columns: minmax(0, 1fr);
  }

  #classroomDisplayView .classroom-live-counts .classroom-time-left-primary strong {
    font-size: clamp(2.6rem, 14vw, 4rem);
  }
}

/* The ZoodleBug Home button is the shared one, top-left on every page
   (/home-button.js): the top bar and the classroom header start after it. */
.topbar { padding-left: var(--zb-home-space, 190px); justify-content: flex-end; }
