.classroom-tool {
  display: grid;
  align-content: start;
  gap: 1rem;
  color: var(--ink, #123f37);
}

.classroom-tool [hidden] {
  display: none !important;
}

.classroom-tool .ct-panel,
.classroom-tool .ct-noise {
  min-width: 0;
  padding: clamp(1rem, 3vw, 1.7rem);
  border: 1px solid var(--line, #d9e1d7);
  border-radius: 1rem;
  background: var(--white, #fff);
}

.classroom-tool .ct-panel {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.classroom-tool :is(h2, h3, p, ul) {
  margin: 0;
}

.classroom-tool h2 {
  font-size: clamp(1.18rem, 2vw, 1.45rem);
  font-weight: 750;
  line-height: 1.18;
}

.classroom-tool h3 {
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.32;
}

.classroom-tool .ct-hint,
.classroom-tool .ct-field small {
  color: var(--muted, #45625b);
  font-size: .9rem;
  line-height: 1.52;
}

.classroom-tool .ct-message {
  color: var(--muted, #45625b);
  font-size: .96rem;
  line-height: 1.5;
}

.classroom-tool .ct-message:empty {
  display: none;
}

.classroom-tool .ct-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: .65rem;
}

.classroom-tool :is(.ct-class, .ct-field) {
  display: grid;
  gap: .7rem;
  min-width: 0;
}

.classroom-tool .ct-field {
  gap: .4rem;
  width: min(100%, 40rem);
  font-weight: 650;
}

.classroom-tool .ct-row .ct-field {
  flex: 0 1 auto;
  width: min(100%, 16rem);
}

.classroom-tool input[type='number'] {
  max-width: 9rem;
}

.classroom-tool .ct-field small {
  font-weight: 400;
}

.classroom-tool :is(input, select, textarea):not([type='checkbox'], [type='range']) {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  min-height: 2.85rem;
  border: 1px solid var(--line, #d9e1d7);
  border-radius: .65rem;
  background: var(--white, #fff);
  color: var(--ink, #123f37);
  padding: .58rem .8rem;
  font: inherit;
  font-weight: 450;
  line-height: 1.5;
}

.classroom-tool :is(input, textarea)::placeholder {
  color: var(--muted, #45625b);
  opacity: .9;
}

.classroom-tool textarea {
  resize: vertical;
}

.classroom-tool input[type='range'] {
  width: 100%;
}

.classroom-tool input:is([type='checkbox'], [type='range']) {
  accent-color: var(--accent, #12664f);
}

.classroom-tool .ct-button {
  min-height: 2.8rem;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .58rem .92rem;
  border: 1px solid var(--line, #d9e1d7);
  border-radius: .65rem;
  background: var(--white, #fff);
  color: var(--ink, #123f37);
  text-align: center;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.classroom-tool .ct-button:hover:not(:disabled) {
  background: var(--paper, #f8f5ed);
}

.classroom-tool :is(.ct-button--primary, .ct-button[aria-pressed='true']) {
  border-color: var(--ink, #123f37);
  background: var(--ink, #123f37);
  color: #fff;
}

.classroom-tool :is(.ct-button--primary, .ct-button[aria-pressed='true']):hover:not(:disabled) {
  background: var(--accent, #12664f);
}

.classroom-tool :is(button, input, textarea, select):disabled {
  opacity: .55;
  cursor: default;
}

.classroom-tool :is(button, input, textarea, select, .ct-seat-scroll):focus-visible {
  outline: 2px solid var(--ink, #123f37);
  outline-offset: 3px;
}

.classroom-tool .ct-check {
  min-height: 2.8rem;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--ink, #123f37);
  padding: .25rem;
}

.classroom-tool .ct-check input {
  appearance: auto;
  inline-size: 1.1rem;
  block-size: 1.1rem;
  margin: 0;
}

.classroom-tool :is(.ct-clock, .ct-result) {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 5.5rem;
  padding: .6rem;
  background: var(--paper, #f8f5ed);
  border: 1px solid var(--line, #d9e1d7);
  border-radius: .8rem;
  font-weight: 750;
  text-align: center;
  line-height: 1;
  overflow-wrap: anywhere;
}

.classroom-tool .ct-clock {
  min-height: 6.2rem;
  font-size: clamp(2.7rem, 12vw, 5.4rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.035em;
}

.classroom-tool .ct-result {
  font-size: clamp(1.25rem, 4.3vw, 2.8rem);
}

.classroom-tool .ct-list {
  display: grid;
  gap: .35rem;
  padding: 0;
  list-style: none;
  overflow-wrap: anywhere;
}

.classroom-tool .ct-teams {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(10.5rem, 100%), 1fr));
  gap: .65rem;
}

.classroom-tool .ct-teams:empty {
  display: none;
}

.classroom-tool .ct-team {
  display: grid;
  align-content: start;
  gap: .65rem;
  padding: .85rem;
  border: 1px solid var(--line, #d9e1d7);
  border-radius: .7rem;
  background: var(--paper, #f8f5ed);
}

.classroom-tool .ct-noise {
  display: grid;
  gap: .5rem;
  background: #e3f2e9;
  border-color: #b7d8c4;
  color: #163d2d;
}

.classroom-tool .ct-noise[data-level='1'] {
  background: #fbf0ca;
  border-color: #e2cb79;
  color: #5d400c;
}

.classroom-tool .ct-noise[data-level='2'] {
  background: #fce5df;
  border-color: #e7b2a4;
  color: #712819;
}

.classroom-tool .ct-noise strong {
  font-size: clamp(1.8rem, 7vw, 3.7rem);
  line-height: 1;
  letter-spacing: -.03em;
}

.classroom-tool .ct-kicker {
  font-size: .88rem;
  font-weight: 750;
}

.classroom-tool .ct-meter {
  display: flex;
  gap: .35rem;
  margin-top: .7rem;
}

.classroom-tool .ct-meter span {
  flex: 1;
  height: .65rem;
  border-radius: .35rem;
  background: currentColor;
  opacity: .16;
}

.classroom-tool .ct-meter span:first-child,
.classroom-tool .ct-noise[data-level='1'] .ct-meter span:nth-child(2),
.classroom-tool .ct-noise[data-level='2'] .ct-meter span {
  opacity: .9;
}

.classroom-tool .ct-passage {
  padding: .85rem;
  background: var(--paper, #f8f5ed);
  border: 1px solid var(--line, #d9e1d7);
  border-radius: .75rem;
  font-size: clamp(1.02rem, 2.3vw, 1.25rem);
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.classroom-tool .ct-history-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .4rem .85rem;
  padding: .7rem 0;
  border-bottom: 1px solid var(--line, #d9e1d7);
}

.classroom-tool .ct-seat-scroll {
  overflow: auto;
  min-width: 0;
  max-width: 100%;
  padding: .6rem;
  border: 1px solid var(--line, #d9e1d7);
  border-radius: .75rem;
  background: var(--paper, #f8f5ed);
}

.ct-chalkboard {
  box-sizing: border-box;
  padding: .45rem .7rem;
  border-radius: .45rem;
  background: #1f5448;
  color: #fff;
  font-weight: 700;
  text-align: center;
}

.classroom-tool .ct-seats {
  display: grid;
  grid-template-columns: repeat(var(--seat-columns), minmax(4.75rem, 1fr));
  gap: .45rem;
  margin-top: .6rem;
}

.classroom-tool .ct-seats .ct-seat {
  min-height: 2.95rem;
  padding: .35rem .2rem;
  border: 1px solid var(--line, #d9e1d7);
  border-radius: .5rem;
  background: var(--white, #fff);
  color: var(--ink, #123f37);
  font: inherit;
  font-size: .85rem;
  font-weight: 680;
  line-height: 1.3;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.classroom-tool .ct-seat[data-empty='true'] {
  border-style: dashed;
  color: var(--muted, #45625b);
}

.classroom-tool .ct-seat[aria-pressed='true'] {
  border-color: var(--ink, #123f37);
  background: var(--ink, #123f37);
  color: #fff;
}

.uroki-seating-print {
  display: none;
}

@media print {
  body:has(.uroki-seating-print) > :not(.uroki-seating-print) {
    display: none !important;
  }

  body:has(.uroki-seating-print) {
    background: #fff;
  }

  .uroki-seating-print {
    display: block;
    color: #000;
  }

  .uroki-seating-print .ct-chalkboard {
    border: 1px solid #333;
    background: #fff;
    color: #000;
  }

  .uroki-seating-print .ct-print-grid {
    display: grid;
    grid-template-columns: repeat(var(--seat-columns), minmax(0, 1fr));
    gap: .3rem;
  }

  .uroki-seating-print .ct-print-seat {
    display: grid;
    align-items: center;
    min-height: 2rem;
    padding: .25rem;
    border: 1px solid #777;
    font-size: 11pt;
    text-align: center;
    overflow-wrap: anywhere;
    break-inside: avoid;
  }
}

@media (max-width: 420px) {
  .classroom-tool .ct-row .ct-field {
    flex: 1 1 min(100%, 8rem);
  }

  .classroom-tool .ct-button {
    padding-inline: .67rem;
  }

  .classroom-tool .ct-clock {
    min-height: 5.2rem;
  }
}
