/* ==========================================================================
   SSFT 學校服務 — 工具頁專屬樣式（計時器、抽籤、分組、座位表、我的班級）
   ========================================================================== */

/* ---------- 計時器 ---------- */
.progress {
  height: 12px;
  border: var(--bw-bold) solid currentColor;
  border-radius: var(--r-sm);
  margin-bottom: var(--space-32);
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  width: 100%;
  background-color: currentColor;
  transform-origin: left center;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-12);
}

.presets .btn {
  font-family: var(--font-num);
}

.timer-done {
  font-size: var(--fs-h1);
  line-height: var(--lh-h1);
  font-weight: var(--fw-black);
  margin-top: var(--space-16);
}

/* 時間到：stage 換成白紙底、數字紅筆（紅在藍底上對比不足，所以整塊換底）；不閃爍 */
.stage.is-done {
  background-color: var(--paper);
  color: var(--ink);
  outline: var(--space-8) solid var(--accent);
  outline-offset: calc(-1 * var(--space-8));
}

.stage.is-done .stage__top .eyebrow {
  color: var(--ink-2);
}

.stage.is-done .projection,
.stage.is-done .timer-done {
  color: var(--accent);
}

.stage.is-done .btn--ghost {
  border-color: var(--ink);
  color: var(--ink);
}

.stage.is-done .btn--on-brand {
  background-color: var(--brand);
  color: var(--paper);
}

.stage.is-done :focus-visible {
  outline-color: var(--brand);
}

.time-inputs {
  display: flex;
  align-items: end;
  gap: var(--space-8);
}

.time-inputs .field {
  gap: var(--space-4);
}

/* ---------- 抽籤 ---------- */
.pick-name {
  display: inline-block;
  padding-inline: var(--space-16);
  border-radius: var(--r-sm);
}

.pick-name.is-picked {
  background-color: var(--highlight);
  color: var(--ink);
}

.pick-remain {
  margin-top: var(--space-24);
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  max-width: none;
}

/* ---------- 分組 ---------- */
.groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-16);
  width: 100%;
  padding: 0;
  list-style: none;
  text-align: start;
}

.group {
  background-color: var(--paper);
  color: var(--ink);
  border-radius: var(--r-md);
  padding: var(--card-pad);
}

.group__title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-8);
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
  padding-bottom: var(--space-8);
  margin-bottom: var(--space-8);
  border-bottom: var(--bw-bold) solid var(--ink);
}

.group__count {
  font-family: var(--font-num);
  font-size: var(--fs-small);
  font-weight: var(--fw-regular);
  color: var(--ink-2);
}

.group ul {
  list-style: none;
  padding: 0;
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  font-weight: var(--fw-bold);
}

.stage:fullscreen .group ul {
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
}

/* ---------- 座位表 ---------- */
.seating {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  width: 100%;
  overflow-x: auto;
}

.seating.is-teacher {
  flex-direction: column-reverse;
}

.seating__desk {
  align-self: center;
  min-width: 50%;
  padding: var(--space-4) var(--space-24);
  border: var(--bw-bold) solid currentColor;
  border-radius: var(--r-sm);
  font-weight: var(--fw-bold);
  text-align: center;
}

.seats {
  display: grid;
  gap: var(--space-8);
  min-width: min-content;
}

.seat {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-8);
  min-height: 48px;
  min-width: 88px;
  padding: var(--space-4) var(--space-8);
  background-color: var(--paper);
  color: var(--ink);
  border: var(--bw-bold) solid var(--paper);
  border-radius: var(--r-sm);
  font-weight: var(--fw-bold);
  font-size: var(--fs-lead);
  line-height: var(--lh-small);
  text-align: center;
  transition: background-color var(--dur-fast) var(--ease-out);
}

/* 窄螢幕放不下同一行時，座號和名字各自換到一行，不在字中間斷開 */
.seat {
  flex-wrap: wrap;
  row-gap: 0;
}

.seat > span {
  white-space: nowrap;
}

.seat__no {
  font-family: var(--font-num);
  font-size: var(--fs-micro);
  line-height: var(--lh-micro);
  font-weight: var(--fw-regular);
  color: var(--ink-2);
}

.seat:hover {
  background-color: var(--paper-sunk);
}

.seat[aria-pressed='true'] {
  background-color: var(--highlight);
  border-color: var(--ink);
}

.seat.is-empty {
  background-color: transparent;
  color: var(--paper);
  border-color: var(--paper);
  font-weight: var(--fw-regular);
  font-size: var(--fs-small);
}

.seat.is-empty .seat__no {
  color: var(--paper);
}

/* 手機：分組結果很長，把按鈕移到結果上方，不用捲到底才能重新分組 */
@media (max-width: 39.9375em) {
  .stage--list .stage__top {
    order: -2;
  }

  .stage--list .stage__controls {
    order: -1;
  }

  .seat {
    flex-direction: column;
    align-items: center;
  }
}

.stage__alert {
  align-self: center;
  background-color: var(--paper);
  color: var(--accent);
  font-weight: var(--fw-bold);
  padding: var(--space-8) var(--space-16);
  border-radius: var(--r-sm);
  max-width: none;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 12mm;
  }

  .seat,
  .seat.is-empty,
  .group {
    border: var(--bw) solid var(--ink);
    color: var(--ink);
  }

  .seat.is-empty .seat__no {
    color: var(--ink-3);
  }

  .stage__alert {
    border: var(--bw) solid var(--accent);
  }
}

/* ---------- 我的班級 ---------- */
.page-head {
  padding-block: var(--section-y) var(--space-32);
  border-bottom: var(--bw-bold) solid var(--ink);
}

.page-head h1 {
  margin-block: var(--space-8) var(--space-16);
}

.page-head p {
  color: var(--ink-2);
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
}

.class-list {
  display: grid;
  gap: var(--space-8);
  padding: 0;
  list-style: none;
}

.class-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-8);
  width: 100%;
  min-height: 56px;
  padding: var(--space-8) var(--space-16);
  background-color: var(--paper);
  border: var(--bw-bold) solid var(--line);
  border-radius: var(--r-sm);
  font-weight: var(--fw-bold);
  text-align: start;
}

.class-item:hover {
  border-color: var(--ink-3);
}

.class-item[aria-current='true'] {
  border-color: var(--ink);
  background-color: var(--highlight);
}

.class-item__count {
  font-family: var(--font-num);
  font-size: var(--fs-small);
  font-weight: var(--fw-regular);
  color: var(--ink-2);
}

.danger-zone {
  display: grid;
  gap: var(--space-12);
  padding-top: var(--space-24);
  border-top: var(--bw) solid var(--line);
}
