/* =========================================================
   《云学校》v1.3 — 二号教学楼的两间专属教室
   🎹 音乐教室（老式脚踏风琴）  🖥️ 千禧微机室（大屁股 CRT）
   依然是纯本地 CSS，没有任何外部资源、字体或图片引用。
   所有尺寸都跟着舞台宽度变量 --u（= 舞台宽度 / 100）等比缩放，
   文字用 clamp() 兜住最小值，手机窄屏 390×844 也绝不横向溢出。
   ========================================================= */

/* ---------------- 两间屋子共用的骨架 ---------------- */

.room {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  color: #fff6e6;
  font-family: var(--font-ui);
}

.room [hidden] {
  display: none !important;
}

.room__backdrop {
  position: absolute;
  inset: -6%;
  z-index: 0;
  pointer-events: none;
  background-position: center;
  background-size: cover;
  filter: blur(30px) brightness(0.36) saturate(0.85);
  transform: scale(1.08);
}

.room__bar {
  position: relative;
  z-index: 8;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: clamp(8px, 1.6vw, 18px) clamp(10px, 2.2vw, 26px) 4px;
  pointer-events: none;
}

.room__brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  filter: drop-shadow(0 2px 10px rgba(18, 12, 8, 0.5));
}

.room__brand-row {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.2vw, 14px);
  flex-wrap: wrap;
}

.room__title {
  margin: 0;
  font-family: var(--font-hand);
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 600;
  letter-spacing: 0.22em;
  color: #fff8ea;
  white-space: nowrap;
}

.room__title span {
  color: #ffe6b8;
}

.room__exit {
  padding: clamp(5px, 0.7vw, 8px) clamp(10px, 1.2vw, 15px);
  border-radius: 999px;
  border: 1px solid rgba(255, 240, 214, 0.34);
  background: rgba(30, 22, 15, 0.42);
  color: #fff3df;
  font-size: clamp(11px, 1.05vw, 14px);
  letter-spacing: 0.08em;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
  pointer-events: auto;
}

.room__exit:hover,
.room__exit:focus-visible {
  background: rgba(58, 42, 26, 0.72);
  border-color: rgba(255, 226, 168, 0.68);
  transform: translateX(-2px);
}

.room__sub {
  margin: 0;
  font-size: clamp(10px, 1vw, 13px);
  letter-spacing: 0.16em;
  color: rgba(255, 244, 226, 0.7);
}

.room__sub.is-offline {
  color: rgba(255, 226, 178, 0.55);
}

.room__tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: auto;
}

.room__pill {
  padding: clamp(5px, 0.7vw, 8px) clamp(10px, 1.2vw, 15px);
  border-radius: 999px;
  border: 1px solid rgba(255, 240, 214, 0.32);
  background: rgba(30, 22, 15, 0.4);
  color: #fff3df;
  font-size: clamp(11px, 1.05vw, 14px);
  letter-spacing: 0.06em;
  white-space: nowrap;
  backdrop-filter: blur(10px) saturate(1.05);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.room__pill:hover,
.room__pill:focus-visible {
  border-color: rgba(255, 226, 168, 0.62);
}

.room__pill.is-off {
  border-color: rgba(255, 214, 140, 0.52);
  background: rgba(64, 40, 20, 0.55);
  box-shadow: 0 0 14px rgba(255, 196, 112, 0.16) inset;
}

.room__main {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 2px clamp(6px, 1.6vw, 18px) clamp(6px, 1.4vw, 14px);
}

.room__stage {
  position: relative;
  overflow: hidden;
  border-radius: clamp(8px, 1.4vw, 16px);
  background: #1a130c;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 240, 210, 0.16),
    inset 0 0 0 1px rgba(20, 12, 8, 0.4);
  --u: 6px;
}

.room__scene {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  z-index: 0;
}

.room__fx {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

/* ---------------- 同屋校友名牌条（绝不挡琴键） ---------------- */

.room__peers {
  position: absolute;
  left: 1.8%;
  top: 3%;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 0.42);
  max-width: 40%;
  pointer-events: none;
}

.room-peer {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--u) * 0.32);
  padding: calc(var(--u) * 0.24) calc(var(--u) * 0.6);
  border-radius: 999px;
  background: rgba(26, 18, 12, 0.46);
  border: 1px solid rgba(255, 238, 208, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(16, 10, 6, 0.32);
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}

.room-peer__face {
  font-size: clamp(9px, calc(var(--u) * 0.85), 15px);
  line-height: 1;
}

.room-peer__name {
  font-size: clamp(9px, calc(var(--u) * 0.8), 14px);
  letter-spacing: 0.04em;
  color: #fff4e0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-peer__act {
  font-size: clamp(8px, calc(var(--u) * 0.72), 13px);
  color: rgba(255, 230, 190, 0.74);
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-peer__act::before {
  content: "· ";
  opacity: 0.6;
}

.room__toast {
  position: absolute;
  left: 50%;
  bottom: 30%;
  transform: translate(-50%, 8px);
  z-index: 9;
  max-width: 78%;
  padding: clamp(6px, 0.9vw, 10px) clamp(12px, 1.6vw, 20px);
  border-radius: 999px;
  background: rgba(28, 20, 13, 0.74);
  border: 1px solid rgba(255, 236, 202, 0.28);
  color: #fff6e4;
  font-size: clamp(10px, 1vw, 13px);
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-align: center;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.room__toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* =========================================================
   🎹 音乐教室
   ========================================================= */

.room--music .room__stage {
  background: #241a12;
}

.music__sun {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(38% 56% at 79% 20%, rgba(255, 236, 190, 0.3), rgba(255, 236, 190, 0) 72%),
    radial-gradient(50% 40% at 50% 96%, rgba(48, 28, 12, 0.34), rgba(48, 28, 12, 0) 70%);
  mix-blend-mode: screen;
}

/* 左侧三角铁热区 */
.music__triangle {
  position: absolute;
  left: 2.2%;
  top: 40%;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: calc(var(--u) * 0.34);
  padding: calc(var(--u) * 0.3) calc(var(--u) * 0.66);
  border-radius: 999px;
  background: rgba(28, 20, 13, 0.5);
  border: 1px solid rgba(255, 238, 206, 0.26);
  color: #fff3df;
  font-size: clamp(9px, calc(var(--u) * 0.78), 13px);
  letter-spacing: 0.04em;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transform-origin: 50% 20%;
  transition: border-color 180ms ease, background 180ms ease;
}

.music__triangle:hover,
.music__triangle:focus-visible {
  border-color: rgba(255, 226, 168, 0.7);
  background: rgba(56, 38, 22, 0.66);
}

.music__triangle-icon {
  display: inline-block;
  font-size: clamp(11px, calc(var(--u) * 1.05), 18px);
  line-height: 1;
  transform-origin: 50% 12%;
}

.music__triangle.is-ringing .music__triangle-icon {
  animation: triangle-ring 620ms ease-out;
}

@keyframes triangle-ring {
  0% { transform: rotate(0deg) scale(1); }
  12% { transform: rotate(-16deg) scale(1.14); }
  28% { transform: rotate(13deg) scale(1.08); }
  44% { transform: rotate(-9deg) scale(1.05); }
  62% { transform: rotate(6deg) scale(1.02); }
  82% { transform: rotate(-3deg) scale(1); }
  100% { transform: rotate(0deg) scale(1); }
}

.music__triangle-key {
  padding: 0 calc(var(--u) * 0.3);
  border-radius: calc(var(--u) * 0.26);
  border: 1px solid rgba(255, 238, 206, 0.34);
  font-size: clamp(8px, calc(var(--u) * 0.66), 11px);
  color: rgba(255, 240, 214, 0.8);
}

/* 窗边旧歌本 */
.music__songbook {
  position: absolute;
  right: 2.2%;
  top: 3%;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: calc(var(--u) * 0.5);
  max-width: 62%;
}

.music__songbook-toggle {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--u) * 0.34);
  padding: calc(var(--u) * 0.3) calc(var(--u) * 0.7);
  border-radius: 999px;
  background: rgba(28, 20, 13, 0.5);
  border: 1px solid rgba(255, 238, 206, 0.26);
  color: #fff3df;
  font-size: clamp(9px, calc(var(--u) * 0.78), 13px);
  letter-spacing: 0.04em;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.music__songbook-toggle:hover,
.music__songbook-toggle:focus-visible {
  border-color: rgba(255, 226, 168, 0.7);
  background: rgba(56, 38, 22, 0.66);
}

.music__card {
  width: min(340px, 100%);
  padding: calc(var(--u) * 0.7);
  border-radius: calc(var(--u) * 0.7);
  background:
    linear-gradient(180deg, rgba(255, 251, 238, 0.97), rgba(242, 231, 206, 0.97));
  border: 1px solid rgba(158, 128, 88, 0.5);
  box-shadow: 0 14px 30px rgba(20, 12, 6, 0.4);
  color: #4a3a26;
  text-align: left;
  transform-origin: top right;
  animation: card-in 180ms ease-out;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(-6px) rotate(-1.2deg); }
  to { opacity: 1; transform: translateY(0) rotate(0deg); }
}

.music__card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-hand);
  font-size: clamp(12px, calc(var(--u) * 0.92), 16px);
  letter-spacing: 0.1em;
  color: #6a4f2f;
  padding-bottom: calc(var(--u) * 0.4);
  border-bottom: 1px dashed rgba(150, 118, 76, 0.45);
}

.music__card-close {
  width: clamp(18px, calc(var(--u) * 1.5), 26px);
  height: clamp(18px, calc(var(--u) * 1.5), 26px);
  border-radius: 50%;
  background: rgba(120, 92, 58, 0.16);
  color: #6a4f2f;
  font-size: clamp(9px, calc(var(--u) * 0.72), 12px);
  line-height: 1;
}

.music__tabs {
  display: flex;
  gap: calc(var(--u) * 0.3);
  margin: calc(var(--u) * 0.5) 0 calc(var(--u) * 0.35);
  flex-wrap: wrap;
}

.music__tab {
  padding: calc(var(--u) * 0.2) calc(var(--u) * 0.62);
  border-radius: 999px;
  border: 1px solid rgba(150, 118, 76, 0.42);
  background: rgba(255, 255, 255, 0.4);
  color: #6a4f2f;
  font-size: clamp(9px, calc(var(--u) * 0.7), 12px);
  letter-spacing: 0.06em;
}

.music__tab.is-on {
  background: #c0623f;
  border-color: #a94e2e;
  color: #fff8ec;
}

.music__score {
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 0.2);
}

.music__score-title {
  margin: 0;
  font-family: var(--font-hand);
  font-size: clamp(12px, calc(var(--u) * 0.95), 17px);
  letter-spacing: 0.08em;
}

.music__score-line {
  margin: 0;
  font-family: var(--font-hand);
  font-size: clamp(13px, calc(var(--u) * 1.15), 22px);
  letter-spacing: 0.26em;
  color: #3f3323;
  white-space: nowrap;
  overflow-x: auto;
}

.music__score-caption {
  margin: calc(var(--u) * 0.2) 0 0;
  font-size: clamp(8px, calc(var(--u) * 0.66), 11px);
  color: rgba(96, 76, 50, 0.82);
  letter-spacing: 0.04em;
}

.music__card-foot {
  margin: calc(var(--u) * 0.42) 0 0;
  font-size: clamp(8px, calc(var(--u) * 0.62), 11px);
  color: rgba(120, 96, 64, 0.8);
}

/* 老式脚踏风琴 */
.organ {
  position: absolute;
  left: 50%;
  bottom: 1.4%;
  transform: translateX(-50%);
  width: 90%;
  height: 27%;
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: calc(var(--u) * 0.4);
  padding: calc(var(--u) * 0.5) calc(var(--u) * 0.7) calc(var(--u) * 0.55);
  border-radius: calc(var(--u) * 0.8);
  background:
    linear-gradient(180deg, #a3713f 0%, #7c4f26 34%, #5a3517 72%, #40230d 100%);
  box-shadow:
    0 14px 30px rgba(24, 12, 4, 0.5),
    inset 0 1px 0 rgba(255, 214, 160, 0.34),
    inset 0 0 0 1px rgba(255, 206, 148, 0.14);
}

.organ__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(var(--u) * 0.6);
  flex: 0 0 auto;
  font-size: clamp(8px, calc(var(--u) * 0.76), 13px);
  letter-spacing: 0.08em;
  color: rgba(255, 228, 188, 0.86);
  text-shadow: 0 1px 2px rgba(30, 14, 2, 0.6);
}

.organ__brand {
  font-family: var(--font-hand);
  letter-spacing: 0.16em;
  color: #ffe7bd;
  white-space: nowrap;
}

.organ__tip {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255, 226, 186, 0.66);
}

.organ__keys {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  border-radius: calc(var(--u) * 0.35);
  background: linear-gradient(180deg, #351f0c, #23140a);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.organ__key {
  position: relative;
  padding: 0;
  font-family: var(--font-ui);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.organ__key--white {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: calc(var(--u) * 0.12);
  padding-bottom: calc(var(--u) * 0.34);
  border: 0;
  border-right: 1px solid rgba(96, 64, 30, 0.5);
  border-radius: 0 0 calc(var(--u) * 0.45) calc(var(--u) * 0.45);
  background: linear-gradient(180deg, #fffdf6 0%, #f5eddb 62%, #ddcaa6 100%);
  box-shadow: inset 0 -3px 6px rgba(120, 88, 46, 0.22);
  transform-origin: top center;
  transition: transform 90ms ease, background 90ms ease, box-shadow 90ms ease;
}

.organ__key--white:last-of-type {
  border-right: 0;
}

.organ__key--black {
  position: absolute;
  top: 0;
  width: 6%;
  height: 58%;
  border-radius: 0 0 calc(var(--u) * 0.32) calc(var(--u) * 0.32);
  background: linear-gradient(180deg, #4a3a2c 0%, #221812 55%, #0f0a07 100%);
  box-shadow:
    0 calc(var(--u) * 0.2) calc(var(--u) * 0.4) rgba(0, 0, 0, 0.55),
    inset 0 -2px 3px rgba(255, 214, 160, 0.18);
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: calc(var(--u) * 0.2);
  transform-origin: top center;
  transition: transform 90ms ease, box-shadow 90ms ease;
}

.organ__key-hint {
  font-size: clamp(7px, calc(var(--u) * 0.62), 12px);
  letter-spacing: 0.04em;
  color: rgba(78, 56, 32, 0.62);
  line-height: 1;
}

.organ__key--black .organ__key-hint {
  color: rgba(255, 224, 182, 0.7);
}

.organ__key-jianpu {
  font-family: var(--font-hand);
  font-size: clamp(9px, calc(var(--u) * 0.82), 16px);
  line-height: 1;
  color: #4a3720;
}

.organ__key--white.is-down,
.organ__key--white.is-down-remote {
  transform: scaleY(0.94) translateY(1px);
  background: linear-gradient(180deg, #e8d9b7 0%, #d3bd93 70%, #bda88a 100%);
  box-shadow: inset 0 5px 9px rgba(96, 64, 26, 0.4);
}

.organ__key--black.is-down,
.organ__key--black.is-down-remote {
  transform: scaleY(0.92);
  box-shadow: inset 0 -1px 2px rgba(255, 214, 160, 0.3);
}

.organ__key--white.is-down-remote {
  background: linear-gradient(180deg, #f2ead6 0%, #e2d6ba 70%, #cdbc99 100%);
}

.organ__pedals {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  gap: calc(var(--u) * 1.6);
  height: 22%;
  align-items: flex-end;
}

.organ__pedal {
  width: 22%;
  max-width: 120px;
  height: 100%;
  border-radius: calc(var(--u) * 0.3) calc(var(--u) * 0.3) calc(var(--u) * 0.15) calc(var(--u) * 0.15);
  background: linear-gradient(180deg, #d9b45c 0%, #b2892f 45%, #7d5c17 100%);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 236, 176, 0.6);
  transform-origin: top center;
  transition: transform 140ms ease, filter 140ms ease;
}

.organ__pedal.is-down {
  transform: perspective(60px) rotateX(16deg) translateY(2px);
  filter: brightness(1.12);
}

@media (prefers-reduced-motion: reduce) {
  .organ__key--white,
  .organ__key--black,
  .organ__pedal,
  .music__card {
    transition: none;
    animation: none;
  }

  .music__triangle.is-ringing .music__triangle-icon {
    animation: none;
    filter: brightness(1.25);
  }
}

/* =========================================================
   🖥️ 千禧微机室
   ========================================================= */

.room--computer .room__toast {
  bottom: 8%;
  max-width: 60%;
}

.computer__dim {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(58% 62% at 50% 46%, rgba(6, 8, 14, 0.4), rgba(6, 8, 14, 0.1) 62%, rgba(6, 8, 14, 0) 80%);
}

.crt {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  z-index: 6;
}

.crt__bezel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 3.4% 3.6% 0;
  border-radius: 5% / 6%;
  background:
    linear-gradient(165deg, #efe7d2 0%, #ddd2b6 42%, #c8bb9c 78%, #b3a686 100%);
  box-shadow:
    0 16px 40px rgba(10, 8, 6, 0.55),
    inset 0 2px 0 rgba(255, 253, 244, 0.9),
    inset 0 -3px 8px rgba(120, 106, 78, 0.4);
}

.crt__glass {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 3.5% / 5%;
  background: #070a10;
  overflow: hidden;
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.9),
    inset 0 0 0 2px rgba(38, 32, 24, 0.85);
}

.crt__screen {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.crt__scan {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.045) 0px,
    rgba(255, 255, 255, 0.045) 1px,
    rgba(0, 0, 0, 0.06) 2px,
    rgba(0, 0, 0, 0.06) 3px
  );
  opacity: 0.55;
  mix-blend-mode: overlay;
}

.crt__glare {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(50% 42% at 26% 12%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 70%),
    radial-gradient(70% 80% at 96% 92%, rgba(140, 190, 255, 0.08), rgba(255, 255, 255, 0) 70%);
  border-radius: inherit;
}

.crt__degauss {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(120% 120% at 50% 50%,
      rgba(255, 60, 60, 0.42) 0%,
      rgba(255, 210, 60, 0.32) 26%,
      rgba(60, 255, 160, 0.28) 48%,
      rgba(60, 140, 255, 0.34) 70%,
      rgba(120, 60, 255, 0.24) 100%);
  mix-blend-mode: screen;
}

.crt__degauss.is-on {
  animation: degauss-warp 650ms cubic-bezier(0.3, 0.9, 0.2, 1) 1;
}

@keyframes degauss-warp {
  0% { opacity: 0; transform: scale(1); filter: blur(0); }
  12% { opacity: 0.95; transform: scale(1.05) skewX(1.4deg); filter: blur(1px); }
  38% { opacity: 0.7; transform: scale(0.94) skewX(-1deg); filter: blur(0.6px); }
  62% { opacity: 0.55; transform: scale(1.03); filter: blur(0.4px); }
  84% { opacity: 0.22; transform: scale(0.995); }
  100% { opacity: 0; transform: scale(1); filter: blur(0); }
}

.crt__glass.is-degaussing {
  animation: degauss-shudder 650ms cubic-bezier(0.3, 0.9, 0.2, 1) 1;
}

@keyframes degauss-shudder {
  0% { transform: translate(0, 0); filter: saturate(1); }
  18% { transform: translate(-0.5%, 0.4%); filter: saturate(1.6) hue-rotate(8deg); }
  40% { transform: translate(0.4%, -0.3%); filter: saturate(1.3) hue-rotate(-6deg); }
  64% { transform: translate(-0.2%, 0.2%); filter: saturate(1.15); }
  100% { transform: translate(0, 0); filter: saturate(1); }
}

/* 减弱动态时：只做一下柔和的色温闪动，绝不剧烈抖动 */
@keyframes degauss-soft {
  0% { opacity: 0; }
  35% { opacity: 0.32; }
  100% { opacity: 0; }
}

@keyframes degauss-soft-tint {
  0% { filter: saturate(1) brightness(1); }
  35% { filter: saturate(1.1) brightness(1.08) hue-rotate(6deg); }
  100% { filter: saturate(1) brightness(1); }
}

@media (prefers-reduced-motion: reduce) {
  .crt__degauss.is-on {
    animation: degauss-soft 650ms ease-out 1;
  }

  .crt__glass.is-degaussing {
    animation: degauss-soft-tint 650ms ease-out 1;
  }
}

.crt__chin {
  flex: 0 0 auto;
  height: 15%;
  min-height: 22px;
  display: flex;
  align-items: center;
  gap: 2.4%;
  padding: 0 1.2%;
}

.crt__led {
  flex: 0 0 auto;
  width: clamp(4px, 0.5%, 8px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #58e06a;
  box-shadow: 0 0 6px rgba(88, 224, 106, 0.9), 0 0 12px rgba(88, 224, 106, 0.5);
}

.crt__led.is-busy {
  animation: led-pulse 1.6s ease-in-out infinite;
}

@keyframes led-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(88, 224, 106, 0.9); }
  50% { opacity: 0.45; box-shadow: 0 0 3px rgba(88, 224, 106, 0.5); }
}

.crt__modes {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  gap: 1.4%;
  align-items: center;
}

.crt__mode {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.28em 0.4em;
  border-radius: 999px;
  border: 1px solid rgba(122, 104, 74, 0.4);
  background: rgba(255, 252, 242, 0.5);
  color: #5a4a32;
  font-size: clamp(7px, 0.62vw, 11px);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.crt__mode:hover,
.crt__mode:focus-visible {
  border-color: rgba(150, 120, 70, 0.8);
}

.crt__mode.is-on {
  background: #3b4a6b;
  border-color: #2c3853;
  color: #f4f8ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.crt__degauss-btn {
  flex: 0 0 auto;
  padding: 0.28em 0.62em;
  border-radius: 999px;
  border: 1px solid rgba(150, 96, 60, 0.55);
  background: linear-gradient(180deg, #c0623f, #9c4526);
  color: #fff4e4;
  font-size: clamp(7px, 0.62vw, 11px);
  letter-spacing: 0.06em;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(70, 30, 10, 0.35);
}

.crt__degauss-btn:hover,
.crt__degauss-btn:focus-visible {
  filter: brightness(1.08);
}

.crt__overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.crt__hint {
  position: absolute;
  left: 2.4%;
  bottom: 2%;
  margin: 0;
  padding: 0.2em 0.6em;
  border-radius: 999px;
  background: rgba(4, 8, 16, 0.55);
  color: rgba(206, 232, 255, 0.82);
  font-size: clamp(7px, 0.58vw, 11px);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 88%;
}

.crt__paint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 2%;
  padding: 2.2%;
  background: linear-gradient(180deg, #d9d6cc, #bdb9ad);
  pointer-events: auto;
}

.crt__paint-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.crt__palette {
  display: flex;
  gap: clamp(2px, 0.4%, 5px);
  flex-wrap: wrap;
}

.crt__swatch {
  width: clamp(10px, 2.4%, 20px);
  aspect-ratio: 1;
  border-radius: 3px;
  border: 1px solid rgba(60, 52, 40, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.crt__swatch.is-on {
  outline: 2px solid #c0623f;
  outline-offset: 1px;
}

.crt__paint-tools {
  display: flex;
  gap: 4px;
}

.crt__paint-btn {
  padding: 0.2em 0.5em;
  border-radius: 4px;
  border: 1px solid rgba(90, 78, 58, 0.5);
  background: linear-gradient(180deg, #f4f1e8, #d9d5c8);
  color: #4a4032;
  font-size: clamp(7px, 0.58vw, 11px);
  white-space: nowrap;
}

.crt__paint-btn.is-on {
  background: linear-gradient(180deg, #c0623f, #9c4526);
  border-color: #8a3d21;
  color: #fff6ea;
}

.crt__paint-canvas {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  background: #f4f0e4;
  border: 1px solid rgba(70, 62, 48, 0.6);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  cursor: crosshair;
  touch-action: none;
}

/* 右侧机械鼠标热区 */
.computer__mouse {
  position: absolute;
  right: 2%;
  bottom: 3%;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: calc(var(--u) * 0.34);
  padding: calc(var(--u) * 0.3) calc(var(--u) * 0.68);
  border-radius: 999px;
  background: rgba(28, 20, 13, 0.5);
  border: 1px solid rgba(255, 238, 206, 0.26);
  color: #fff3df;
  font-size: clamp(9px, calc(var(--u) * 0.78), 13px);
  letter-spacing: 0.04em;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.computer__mouse:hover,
.computer__mouse:focus-visible {
  border-color: rgba(255, 226, 168, 0.7);
  background: rgba(56, 38, 22, 0.68);
  transform: translateY(-1px);
}

/* ---------------- 窄屏微调（390×844 也不横向溢出） ---------------- */

@media (max-width: 720px) {
  .room__bar {
    gap: 6px;
    padding-bottom: 2px;
  }

  .room__title {
    letter-spacing: 0.16em;
  }

  .room__sub {
    letter-spacing: 0.1em;
  }

  .room__peers {
    max-width: 46%;
  }

  .room-peer__act {
    display: none;
  }

  .organ__tip {
    display: none;
  }

  .music__card {
    width: min(260px, 100%);
  }

  .crt__chin {
    height: 17%;
    min-height: 26px;
  }

  .computer__mouse {
    bottom: 1.5%;
  }

  /* 微机室的提示条要避开右下角的鼠标热区 */
  .room--computer .room__toast {
    bottom: 12%;
    max-width: 84%;
  }

  .room__toast {
    bottom: 31%;
    max-width: 88%;
  }
}

@media (max-width: 420px) {
  .room__title {
    font-size: 18px;
  }

  .room__pill,
  .room__exit {
    font-size: 11px;
    padding: 4px 9px;
  }

  .music__score-line {
    letter-spacing: 0.16em;
  }
}
