/* ==================================================================
   控制条 + 所有覆盖层（开始 / 倒计时 / 轮间 / 暂停 / 结算）
   ================================================================== */

/* ---------------------------------------------------------------- 控制条 */

.dock {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 2vw, 24px);
  padding-top: clamp(4px, 0.8vh, 10px);
  border-top: var(--bw-thin) solid var(--ink-line);
}

.dock__left {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.4vw, 20px);
  min-width: 0;
}

.dock__mode {
  padding: 4px 10px;
  border: var(--bw-thin) solid var(--ink);
  background: var(--paper-hi);
  box-shadow: 2px 2px 0 var(--ink);
  font-size: clamp(11px, 1.05vw, 13px);
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.dock__group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.dock__label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
}

.seg {
  display: flex;
  border: var(--bw-thin) solid var(--ink);
  background: var(--paper-hi);
  box-shadow: 2px 2px 0 var(--ink);
}

.seg__btn {
  appearance: none;
  border: 0;
  border-right: 1.5px solid var(--ink-line);
  background: transparent;
  padding: 4px 9px;
  font-family: var(--font-ui);
  font-size: clamp(11px, 1vw, 12.5px);
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 0.1s linear, color 0.1s linear;
}

.seg__btn:last-child {
  border-right: 0;
}

.seg__btn:hover {
  background: rgba(243, 197, 24, 0.35);
}

.seg__btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper-hi);
}

.dock__right {
  display: flex;
  align-items: center;
  gap: clamp(6px, 0.8vw, 10px);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: clamp(32px, 3vw, 40px);
  height: clamp(32px, 3vw, 40px);
  border: var(--bw-thin) solid var(--ink);
  background: var(--paper-hi);
  box-shadow: 2px 2px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.12s;
}

.icon-btn svg {
  width: 58%;
  height: 58%;
  fill: currentColor;
  stroke: currentColor;
}

.icon-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.icon-btn.is-accent {
  background: var(--green);
  color: var(--paper-hi);
}

/* ---------------------------------------------------------------- 覆盖层 */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  pointer-events: none;
}

.overlay.is-on {
  display: block;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: clamp(10px, 2.2vh, 26px) clamp(12px, 3vw, 40px);
  overflow-y: auto;
}

.screen.is-shown {
  display: grid;
}

.screen--start,
.screen--result {
  background: rgba(245, 241, 228, 0.72);
}

.screen--start.is-shown,
.screen--result.is-shown {
  pointer-events: auto;
}

/* ---------------------------------------------------------------- 纸片 */

.sheet {
  position: relative;
  width: min(760px, 100%);
  background: var(--paper-hi);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow-big);
  padding: clamp(18px, 3vh, 34px) clamp(18px, 3.2vw, 42px) clamp(16px, 2.4vh, 28px);
  animation: sheetIn 0.34s cubic-bezier(0.2, 1.1, 0.35, 1) both;
}

/* 屏幕太矮时才允许滚动，并藏掉越界的装饰，避免被裁成半截 */
@media (max-height: 700px) {
  .sheet {
    max-height: calc(100dvh - 30px);
    overflow-y: auto;
  }

  .sheet__decor {
    display: none;
  }
}

@keyframes sheetIn {
  from {
    opacity: 0;
    transform: translateY(16px) rotate(-0.6deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.tape {
  position: absolute;
  top: -13px;
  width: clamp(64px, 11vw, 106px);
  height: 26px;
  background: rgba(233, 222, 178, 0.78);
  border: 1px solid rgba(18, 18, 17, 0.1);
  box-shadow: 0 1px 2px rgba(60, 50, 20, 0.12);
  pointer-events: none;
}

.tape--l {
  left: 6%;
  transform: rotate(-5deg);
}

.tape--r {
  right: 6%;
  transform: rotate(4.5deg);
}

.sheet__decor {
  position: absolute;
  pointer-events: none;
  opacity: 0.95;
}

.sheet__decor--l {
  width: 66px;
  left: -26px;
  top: 64px;
  transform: rotate(-12deg);
}

.sheet__decor--r {
  width: 62px;
  right: -22px;
  top: 34px;
  transform: rotate(8deg);
}

/* ---------------------------------------------------------------- 开始页 */

.eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.sheet__title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 68px);
  line-height: 0.92;
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

.sheet__title span {
  position: relative;
  display: inline-block;
  isolation: isolate;
}

.sheet__title span::after {
  content: "";
  position: absolute;
  left: -1%;
  right: -1%;
  bottom: 9%;
  height: 27%;
  background: var(--yellow);
  opacity: 0.9;
  transform: rotate(-1.4deg);
  z-index: -1;
}

.sheet__sub {
  margin: 0 0 clamp(14px, 2.4vh, 24px);
  font-size: clamp(12px, 1.35vw, 15px);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
}

.sheet__body {
  display: grid;
  gap: clamp(10px, 1.7vh, 18px);
}

.field__label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.field__label em {
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 132px;
  padding: 7px 12px;
  border: var(--bw-thin) solid var(--ink);
  background: var(--paper-hi);
  box-shadow: 2px 2px 0 var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, background-color 0.12s;
}

.chips--mode .chip {
  flex: 1 1 180px;
}

.chip b {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.chip small {
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink-mute);
}

.chip:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper-hi);
}

.chip[aria-pressed="true"] small {
  color: rgba(255, 253, 247, 0.7);
}

.chip--num {
  min-width: 0;
  padding: 6px 14px;
  align-items: center;
  justify-content: center;
}

.chips__unit {
  align-self: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
}

/* 开关 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  cursor: pointer;
  width: fit-content;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch__box {
  position: relative;
  flex: none;
  width: 40px;
  height: 22px;
  border: var(--bw-thin) solid var(--ink);
  background: var(--paper-hi);
  transition: background-color 0.14s linear;
}

.switch__box::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--ink);
  transition: transform 0.16s cubic-bezier(0.2, 1.2, 0.4, 1);
}

.switch input:checked + .switch__box {
  background: var(--green);
}

.switch input:checked + .switch__box::after {
  transform: translateX(18px);
  background: var(--paper-hi);
}

.switch__text {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.switch__text em {
  font-style: normal;
  font-weight: 500;
  color: var(--ink-mute);
  font-size: 11px;
}

/* 按钮 */
.sheet__foot {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: clamp(16px, 2.6vh, 26px);
}

.btn-start {
  appearance: none;
  border: var(--bw) solid var(--ink);
  background: var(--ink);
  color: var(--paper-hi);
  padding: 0.6em 1.7em;
  font-family: var(--font-ui);
  font-size: clamp(15px, 1.7vw, 19px);
  font-weight: 900;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--green);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-start:hover {
  box-shadow: 4px 4px 0 var(--green), inset 0 0 0 3px var(--green);
}

.btn-start:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 var(--green);
}

.btn-start--small {
  font-size: 15px;
  padding: 0.5em 1.3em;
}

.btn-ghost {
  appearance: none;
  border: var(--bw-thin) solid var(--ink);
  background: transparent;
  padding: 0.55em 1.2em;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-ghost:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.hint {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
}

/* ---------------------------------------------------------------- 倒计时 */

.countdown {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  justify-items: center;
  gap: 6px;
  pointer-events: none;
  background: rgba(245, 241, 228, 0.86);
}

.countdown.is-shown {
  display: grid;
}

.countdown__num {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(90px, 17vw, 220px);
  line-height: 0.82;
  letter-spacing: -0.05em;
  color: var(--ink);
  text-shadow: 7px 7px 0 var(--yellow);
  display: block;
  min-width: 2ch;
  text-align: center;
}

.countdown__sub {
  position: relative;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.countdown.is-go .countdown__num {
  color: var(--green);
  text-shadow: 7px 7px 0 var(--ink);
  font-size: clamp(80px, 15vw, 190px);
}

.countdown.is-tick .countdown__num {
  animation: countTick 0.34s cubic-bezier(0.16, 1.3, 0.3, 1);
}

@keyframes countTick {
  0% {
    opacity: 0;
    transform: scale(1.45) rotate(-3deg);
  }
  55% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

/* ---------------------------------------------------------------- 轮间 */

.banner {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  justify-items: center;
  pointer-events: none;
  text-align: center;
}

.banner.is-shown {
  display: grid;
}

.banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(245, 241, 228, 0.66);
}

.banner__card {
  position: relative;
  background: var(--paper-hi);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow-big);
  padding: clamp(14px, 2.2vh, 26px) clamp(26px, 4.4vw, 62px);
  transform: rotate(-1.2deg);
}

.banner__k,
.banner__v,
.banner__s {
  position: relative;
  margin: 0;
}

.banner__k {
  font-size: clamp(10px, 1.1vw, 13px);
  font-weight: 800;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--red);
}

.banner__v {
  font-family: var(--font-display);
  font-size: clamp(40px, 6.4vw, 96px);
  line-height: 1;
  letter-spacing: -0.04em;
  margin: 4px 0 6px;
}

.banner__s {
  font-size: clamp(12px, 1.4vw, 16px);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
}

.banner.is-in .banner__card {
  animation: bannerPop 0.46s cubic-bezier(0.2, 1.3, 0.35, 1) both;
}

@keyframes bannerPop {
  from {
    opacity: 0;
    transform: scale(0.82) rotate(-4deg);
  }
  to {
    opacity: 1;
    transform: rotate(-1.2deg);
  }
}

/* ---------------------------------------------------------------- 暂停 */

.pause {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(245, 241, 228, 0.92);
  pointer-events: none;
}

.pause.is-shown {
  display: grid;
  pointer-events: auto;
}

.pause__card {
  position: relative;
  background: var(--paper-hi);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--shadow-big);
  padding: clamp(20px, 3vh, 34px) clamp(26px, 4vw, 56px);
  text-align: center;
  transform: rotate(-1deg);
}

.pause__decor {
  position: absolute;
  width: 42px;
  right: -18px;
  top: -22px;
  transform: rotate(10deg);
}

.pause__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 56px);
  letter-spacing: -0.03em;
  line-height: 1;
}

.pause__sub {
  margin: 8px 0 18px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
}

/* ---------------------------------------------------------------- 结算 */

.sheet--result {
  text-align: center;
  width: min(620px, 100%);
}

.result__title {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: clamp(44px, 7vw, 84px);
  line-height: 0.92;
  letter-spacing: -0.045em;
  text-shadow: 5px 5px 0 var(--yellow);
}

.sheet--result .sheet__foot {
  justify-content: center;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.stats li {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 4px;
  border: var(--bw-thin) solid var(--ink);
  background: var(--paper-card);
}

.result__meta {
  margin: 10px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
}

.stats b {
  font-family: var(--font-display);
  font-size: clamp(18px, 2.4vw, 30px);
  line-height: 1;
  letter-spacing: -0.02em;
}

.stats span {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
}

.stamp {
  position: absolute;
  right: clamp(8px, 2vw, 26px);
  bottom: clamp(6px, 1.4vh, 18px);
  display: grid;
  place-items: center;
  width: clamp(70px, 8vw, 96px);
  height: clamp(70px, 8vw, 96px);
  border: 3px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  font-family: var(--font-display);
  font-size: clamp(14px, 1.7vw, 19px);
  letter-spacing: -0.02em;
  transform: rotate(-13deg);
  opacity: 0.8;
}

/* ---------------------------------------------------------------- 窄屏 */

@media (max-width: 720px) {
  .dock {
    flex-wrap: wrap;
    row-gap: 8px;
    justify-content: center;
  }

  .dock__left {
    gap: 8px;
  }

  .dock__mode {
    display: none;
  }

  .sheet__decor {
    display: none;
  }

  .sheet__foot {
    justify-content: center;
  }

  .hint {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .seg__btn {
    padding: 4px 7px;
  }
}

/* ---------------------------------------------------------------- 手机横屏 */

/* 横屏只有 370～430px 高，开始面板必须一屏塞得下，否则老师要滚动才看得到「开始」 */
@media (orientation: landscape) and (max-height: 560px) {
  .screen {
    padding: 8px 14px;
    place-items: start center;
  }

  .sheet {
    width: min(720px, 100%);
    padding: 12px 18px 10px;
  }

  .sheet__head {
    margin-bottom: 8px;
  }

  .sheet__title {
    margin-bottom: 4px;
    font-size: clamp(24px, 4.6vw, 38px);
  }

  .sheet__sub {
    font-size: 12px;
    line-height: 1.35;
  }

  .field {
    margin-top: 7px;
  }

  .chips {
    gap: 6px;
  }

  /* 只收窄模式卡；速度/顺序是数字小卡，别一起改宽 */
  .chip {
    padding: 4px 9px;
    gap: 1px;
  }

  .chips--mode .chip {
    flex: 1 1 96px;
    min-width: 96px;
  }

  .chip b {
    font-size: 12.5px;
  }

  .chip small {
    font-size: 9.5px;
    line-height: 1.2;
  }

  .sheet__foot {
    margin-top: 8px;
    gap: 10px;
  }

  .btn-start {
    padding: 0.45em 1.4em;
    font-size: 15px;
  }

  .hint {
    font-size: 11px;
  }

  .dock {
    row-gap: 4px;
  }

  .round-counter.is-swap {
    animation-duration: 0.3s;
  }

  /* 横屏宽度富余、高度不够：开始面板改左右两栏，左标题右选项，
     一屏就能看到「开始」按钮，不用滚动 */
  .screen--start .sheet {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    column-gap: 22px;
    align-items: start;
  }

  .screen--start .sheet__head {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .screen--start .sheet__body {
    grid-column: 2;
    grid-row: 1;
  }

  .screen--start .sheet__foot {
    grid-column: 2;
    grid-row: 2;
    margin-top: 10px;
    justify-content: flex-start;
  }

  .screen--start .hint {
    width: auto;
    text-align: left;
  }
}

/* ==================================================================
   声音诊断（只在网址加 ?debug=1 时出现，正常使用看不到）
   ================================================================== */

.diag {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(30, 26, 18, 0.35);
}

.diag[hidden] {
  display: none;
}

.diag__card {
  width: min(100%, 380px);
  max-height: 100%;
  overflow: auto;
  padding: 14px 16px 15px;
  background: var(--paper-hi);
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}

.diag__title {
  margin: 0 0 8px;
  font-weight: 900;
  letter-spacing: 0.04em;
  font-size: 13px;
  text-transform: uppercase;
}

.diag__row {
  display: flex;
  gap: 8px;
  margin: 0;
  align-items: baseline;
  font-size: 12.5px;
  line-height: 1.6;
}

.diag__row span:first-child {
  flex: none;
  width: 62px;
  color: var(--ink-mute);
  font-weight: 700;
}

.diag__row span:last-child {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  word-break: break-all;
}

.diag__row.is-bad span:last-child {
  color: var(--red);
}

.diag__row.is-good span:last-child {
  color: #15803d;
}

.diag__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.diag__btn {
  padding: 9px 16px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  font-size: 13px;
  font-weight: 900;
  box-shadow: 2px 2px 0 var(--ink);
}

.diag__btn--ghost {
  background: var(--paper-hi);
}

.diag__btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.diag__hint {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--ink-mute);
}

/* 关掉浮层后留一个小角标，方便随时再打开 */
.diag__pill {
  position: fixed;
  right: 6px;
  top: 6px;
  z-index: 91;
  padding: 3px 9px;
  border: 2px solid var(--ink);
  background: var(--yellow);
  font-size: 11px;
  font-weight: 900;
  opacity: 0.85;
}
