/* ============================================================
   校园整活 · 节奏五连 —— dorm.css
   作用域：只服务 #arcadeHome / #rhythmGame 及新增类名 .ah-* .rg-* .rhythm-note。
   不写全局元素选择器（header/h1/button...），不改动第一关“阿姨别抖了”的外观。
   基线：物理属性 + margin / calc；无 flex gap / clamp / aspect-ratio / inset /
   逻辑属性 / 现代颜色语法；安全区用 var(...,env(...,0px)) 带普通值兜底。
   ============================================================ */

/* ---------- 阿姨别抖了：index.html 依赖的容器规则（原样保留） ---------- */
#auntiePage{display:flex;flex-direction:column;flex:1;min-height:0}
.header-buttons{display:flex;flex-direction:column}
.header-buttons button+button{margin-top:5px}
.header-buttons .small{font-size:9px;padding:5px 8px}

/* ---------- 两个全屏面板（首页 / 节奏关） ---------- */
#arcadeHome,#rhythmGame{position:absolute;top:0;left:0;right:0;bottom:0;z-index:20;display:flex;flex-direction:column;background:#f3efd9;color:#244942;overflow:hidden}
#arcadeHome,#rhythmGame{padding-top:var(--safe-area-inset-top,env(safe-area-inset-top,0px));padding-bottom:var(--safe-area-inset-bottom,env(safe-area-inset-bottom,0px))}
#arcadeHome{overflow-y:auto;-webkit-overflow-scrolling:touch}
.ah-tag,.rg-tag{display:inline-block;background:#f2d979;border:1px solid #244942;border-radius:10px;padding:3px 8px;font-size:9px;font-weight:800;letter-spacing:1px;white-space:nowrap}

/* ---------- 首页 ---------- */
.ah-head{padding:15px 16px 10px;border-bottom:2px solid #244942;flex-shrink:0}
.ah-title{font-size:27px;line-height:1.15;font-weight:900;margin:7px 0 0;letter-spacing:-1px}
.ah-title span{color:#e85d3c;font-size:19px;margin-left:6px;letter-spacing:0}
.ah-sub{font-size:11px;line-height:1.65;margin:6px 0 0;color:#43695c}
.ah-sub b{color:#244942}
.ah-tools{display:flex;align-items:flex-end;justify-content:space-between;margin-top:10px}
.ah-tools-note{flex:1 1 auto;padding-right:9px;font-size:9px;line-height:1.45;color:#5c7a6d}
#arcadeSoundHome{flex-shrink:0;min-height:44px;padding:9px 12px;background:#f3efd9;border:2px solid #244942;border-radius:12px;box-shadow:0 3px 0 #244942;font-size:12px;font-weight:800;color:#244942}
.ah-card{position:relative;display:block;width:100%;min-height:72px;text-align:left;background:#fffbed;border:2px solid #244942;border-radius:14px;box-shadow:0 4px 0 #244942;padding:11px 12px 11px 58px;color:#244942;font-weight:700}
.ah-auntie{margin:12px 16px 0;min-height:84px;background:#e85d3c;color:#fff9e6;padding-left:64px}
.ah-auntie strong{font-size:21px}
.ah-auntie .ah-icon{width:42px;height:42px;margin-top:-21px;background:#f2d979;color:#244942}
.ah-auntie .ah-icon svg{width:26px;height:26px}
.ah-auntie .ah-badge{background:#244942;color:#f2d979}
.ah-auntie .ah-cue{color:#ffe9a8}
.ah-auntie .ah-note{color:#ffe3d5}
.ah-auntie .ah-prog{background:#c8492c}
.ah-auntie .ah-prog i{background:#f2d979}
.ah-icon{position:absolute;left:11px;top:50%;margin-top:-19px;width:38px;height:38px;display:flex;align-items:center;justify-content:center;background:#f2d979;border:2px solid #244942;border-radius:12px;color:#244942}
.ah-icon svg{display:block;width:22px;height:22px}
.ah-badge{position:absolute;right:10px;top:9px;background:#244942;color:#f3efd9;border-radius:9px;padding:3px 7px;font-size:9px;font-weight:800}
.ah-card strong{display:block;font-size:16px;font-weight:900;line-height:1.25;padding-right:46px}
.ah-cue{display:block;font-size:11px;font-weight:800;line-height:1.35;color:#e85d3c;margin-top:3px}
.ah-note{display:block;font-size:10px;font-weight:500;line-height:1.5;color:#4d6a5e;margin-top:3px}
.ah-prog{position:relative;display:block;height:8px;max-width:62%;margin-top:8px;background:#dfe2c8;border:1px solid #244942;border-radius:4px}
.ah-prog i{display:block;height:100%;width:0;background:#e85d3c;border-radius:3px}
.ah-prog b{position:absolute;left:100%;top:-4px;margin-left:6px;font-size:9px;line-height:13px;font-weight:800;white-space:nowrap}
.ah-grid{display:grid;grid-template-columns:1fr 1fr;padding:0 11px;margin-top:8px}
.ah-grid .ah-card{margin:0 5px 8px;min-height:66px;padding:9px 9px 9px 46px}
.ah-grid .ah-icon{left:9px;width:30px;height:30px;margin-top:-15px}
.ah-grid .ah-icon svg{width:18px;height:18px}
.ah-grid .ah-card strong{font-size:14px;padding-right:38px}
.ah-grid .ah-cue{font-size:10px}
.ah-grid .ah-note{font-size:9px}
.ah-grid .ah-prog{max-width:56%;height:7px}
.ah-foot{font-size:9px;line-height:1.6;text-align:center;color:#5c7a6d;margin:10px 16px 18px}

/* ---------- 节奏关：顶栏 / 统计 ---------- */
.rg-head{display:flex;align-items:center;justify-content:space-between;padding:9px 14px 8px;border-bottom:2px solid #244942;flex-shrink:0}
.rg-title{flex:1 1 auto;min-width:0;padding-right:8px}
.rg-title small{display:block;font-size:9px;font-weight:800;letter-spacing:1px;color:#5c7a6d}
.rg-title h2{font-size:20px;line-height:1.15;font-weight:900;margin:1px 0 0;letter-spacing:-0.5px}
.rg-title>span{font-size:10px;color:#5c7a6d}
.rg-btns{display:flex;align-items:center;flex-shrink:0}
.rg-mini{min-width:44px;min-height:44px;padding:6px 9px;margin-left:6px;background:#f3efd9;border:2px solid #244942;border-radius:11px;box-shadow:0 3px 0 #244942;font-size:10px;font-weight:800;color:#244942}
.rg-mini:disabled{opacity:.4;box-shadow:none}
.rg-stats{display:flex;align-items:center;padding:6px 12px;background:#e1e6ce;border-bottom:2px solid #244942;flex-shrink:0}
.rg-stats div{flex:1 1 0;text-align:center;min-width:0}
.rg-stats strong{display:block;font-family:monospace;font-size:16px;line-height:1.15;font-weight:800}
.rg-stats span{display:block;font-size:8px;letter-spacing:.5px;color:#4d6a5e}

/* ---------- 节奏关：场景（角色插画由父级渲染器绘制） ---------- */
.rg-scene{position:relative;flex:1 1 auto;min-height:150px;overflow:hidden;border-bottom:2px solid #244942;background:#b9d0bc}
#rhythmCanvas{display:block;width:100%;height:100%}
.rg-tip{position:absolute;left:10px;top:9px;max-width:54%;background:#fffbed;border:2px solid #244942;border-radius:11px;padding:5px 8px;font-size:10px;font-weight:800;box-shadow:2px 3px 0 rgba(36,73,66,0.35)}
.rg-call{position:absolute;right:10px;top:9px;max-width:60%;background:#f2d979;border:2px solid #244942;border-radius:11px;padding:6px 9px;font-size:12px;font-weight:900;text-align:center;opacity:1;transition:opacity .12s}
.rg-call:empty{opacity:0}
.rg-call-now{background:#e85d3c;color:#fff9e6;font-size:14px}
.rg-call-warn{background:#244942;color:#f2d979}
.rg-count{position:absolute;left:0;right:0;top:38%;text-align:center;font-size:56px;font-weight:900;color:#fff5bd;text-shadow:3px 3px 0 #244942,-2px -2px 0 #244942;pointer-events:none}
.rg-count:empty{display:none}
.rg-judge{position:absolute;left:0;right:0;top:63%;text-align:center;font-size:24px;font-weight:900;color:#fff5bd;text-shadow:2px 2px 0 #244942,-1px -1px 0 #244942;pointer-events:none}
.rg-j-perfect{color:#ffe9a8}
.rg-j-good{color:#d3f3da}
.rg-j-miss{color:#ff9f86}
.rg-j-wait{color:#eaf3e4;font-size:15px}

/* ---------- 节奏关：拍点轨道 ---------- */
.rg-lane{position:relative;height:48px;flex-shrink:0;background:#244942;overflow:hidden}
.rg-lane:before{content:"";position:absolute;left:0;right:0;top:23px;height:1px;background:#6d8b7c}
.rg-zone{position:absolute;top:0;bottom:0;left:42%;width:16%;background:#7a9a7f}
.rg-pulse{position:absolute;left:50%;top:50%;width:34px;height:34px;margin:-17px 0 0 -17px;border-radius:50%;background:#f2d979;border:2px solid #fff5bd;opacity:.3}
.rg-notes{position:absolute;top:0;left:0;right:0;bottom:0}
.rhythm-note{position:absolute;top:50%;width:26px;height:26px;margin:-13px 0 0 -13px;border-radius:50%;background:#fffbed;border:2px solid #244942;box-shadow:0 2px 0 rgba(20,50,45,0.4);font-size:12px;font-weight:900;line-height:22px;text-align:center;color:#244942;transition:opacity .12s}
.rhythm-note[data-action="left"],.rhythm-note[data-action="right"]{background:#f2d979}
.rhythm-note[data-action="hide"],.rhythm-note[data-action="duck"]{background:#e85d3c;color:#fff9e6}
.rhythm-note.rg-n-perfect{background:#f2d979;box-shadow:0 0 0 4px rgba(242,217,121,0.55)}
.rhythm-note.rg-n-good{background:#d3f3da;box-shadow:0 0 0 3px rgba(211,243,218,0.5)}
.rhythm-note.rg-n-miss{background:#e85d3c;color:#fff9e6;border-style:dashed;box-shadow:none}
.rg-cap{position:absolute;bottom:1px;left:50%;margin-left:-11px;font-size:8px;color:#f2d979}

/* ---------- 节奏关：动作按钮 ---------- */
.rg-pad{display:flex;flex-shrink:0;padding:9px 14px;background:#f3efd9}
.rg-act{flex:1 1 0;min-height:56px;background:#e85d3c;border:2px solid #244942;border-radius:13px;box-shadow:0 4px 0 #244942;color:#fff9e6;font-size:17px;font-weight:900}
.rg-act+.rg-act{margin-left:10px}
.rg-act[data-action="hide"],.rg-act[data-action="duck"]{background:#f2d979;color:#244942}
.rg-act span{display:block;line-height:1.2}
.rg-act small{display:block;font-size:9px;font-weight:500;margin-top:2px;opacity:.85}

/* ---------- 节奏关：规则面板 / 关卡选择 ---------- */
.rg-panel{display:flex;flex-direction:column;flex:1 1 auto;min-height:0;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:10px 14px 12px}
.rg-rule-head{display:flex;align-items:center;justify-content:space-between}
.rg-rule-head b{font-size:14px;font-weight:900}
.rg-rules{margin:8px 0 0;padding-left:18px;font-size:11px;line-height:1.7;color:#3f6156}
.rg-rules li{margin-bottom:3px}
.rg-lvwrap{margin-top:10px}
.rg-lvtitle{display:block;font-size:9px;color:#5c7a6d;margin-bottom:5px}
.rg-levels{display:grid;grid-template-columns:repeat(5,1fr)}
.rg-lv{min-height:44px;margin:0 5px 5px 0;background:#fffbed;border:2px solid #244942;border-radius:10px;font-size:13px;font-weight:900;color:#244942}
.rg-lv-pass{background:#b9d0bc}
.rg-lv-now{background:#f2d979;box-shadow:0 3px 0 #244942}
.rg-lv-lock{opacity:.45}
.rg-meta{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;margin-top:8px;font-size:9px;line-height:1.6;color:#5c7a6d}
.rg-begin{width:100%;min-height:54px;margin-top:9px;background:#e85d3c;border:2px solid #244942;border-radius:13px;box-shadow:0 4px 0 #244942;color:#fff9e6;font-size:18px;font-weight:900}
.rg-foot{display:block;text-align:center;font-size:9px;color:#688273;margin-top:8px}

/* ---------- 节奏关：暂停 / 结果弹层 ---------- */
.rg-scrim{position:absolute;top:0;left:0;right:0;bottom:0;z-index:30;display:flex;align-items:center;justify-content:center;background:rgba(22,60,58,0.75);padding:16px}
.rg-modal{width:88%;max-height:90%;overflow-y:auto;-webkit-overflow-scrolling:touch;background:#f3efd9;border:3px solid #244942;border-radius:16px;box-shadow:6px 6px 0 rgba(36,73,66,0.35);padding:18px 16px;text-align:center}
.rg-modal h3{font-size:21px;font-weight:900;margin:6px 0 4px}
.rg-modal p{font-size:11px;line-height:1.7;margin:6px 0 12px;color:#3f6156}
.rg-modal strong{display:block;font-family:monospace;font-size:38px;line-height:1.1;color:#e85d3c;margin-bottom:6px}
.rg-alt{width:100%;min-height:44px;margin-top:8px;background:#f3efd9;border:2px solid #244942;border-radius:12px;font-size:13px;font-weight:800;color:#244942}

/* ---------- 小屏 / 矮屏 ---------- */
@media(max-height:620px){
  .ah-head{padding:10px 14px 8px}
  .ah-title{font-size:23px}
  .rg-head{padding:7px 12px 6px}
  .rg-title h2{font-size:18px}
  .rg-panel{padding:8px 12px 10px}
  .rg-rules{font-size:10px;line-height:1.6;margin-top:6px}
  .rg-scene{min-height:150px}
  .rg-act{min-height:52px}
  .rg-begin{min-height:50px;font-size:17px}
  .rg-foot{display:none}
}
@media(max-width:340px){
  .rg-mini{padding:6px 7px;margin-left:4px;font-size:9px}
  .rg-stats strong{font-size:14px}
  .ah-title span{display:block;margin-left:0;font-size:15px}
  .ah-grid .ah-card strong{font-size:13px}
}

.ah-card:disabled{opacity:.52;cursor:default;box-shadow:none}.ah-card:disabled .ah-badge{background:#d9dfcd;color:#526e61}
.ah-auntie{width:calc(100% - 32px);flex-shrink:0}

.ah-cover{position:relative;height:218px;overflow:hidden;border:2px solid #244942;border-radius:15px;margin-top:12px;background:#b9d0bc}.ah-cover img{width:100%;height:100%;object-fit:cover;object-position:center 48%;display:block}.ah-cover span{position:absolute;bottom:9px;left:10px;border:2px solid #244942;border-radius:8px;background:#f3efd9;padding:5px 9px;font-size:12px;font-weight:800}.ah-title{font-size:31px}.ah-title span{font-size:29px}.ah-head{flex-shrink:0}

.auntie-practice{margin-top:8px}.auntie-practice button{min-height:44px;border:2px solid #244942;border-radius:9px;background:#f3efd9;color:#244942;font-weight:800;padding:7px 12px;margin-right:5px}.auntie-practice button[aria-pressed=true]{background:#f2d979}#rhythmLesson,#rhythmPractice{margin-bottom:8px}#rhythmGame[data-mode=lesson] .rg-tag{background:#b9d0bc}#rhythmGame[data-mode=practice] .rg-tag{background:#f2d979}

#rhythmGame[data-phase=rules] .rg-lane{display:none}
@media(max-height:620px){#rhythmGame[data-phase=rules] .rg-scene{min-height:120px;flex:0 0 120px}.rg-panel{padding-top:7px}.rg-rules{margin-top:5px;margin-bottom:5px}}

.rg-entry-actions{display:flex;flex-shrink:0;margin-bottom:9px}.rg-entry-actions button{flex:1;min-width:0;width:auto;font-size:12px;margin-bottom:0!important;padding:10px 6px}.rg-entry-actions button+button{margin-left:8px}

/* Keep judgement away from the acting hands and faces. */
#rhythmGame .rg-judge{top:auto;bottom:8px;font-size:18px;padding:3px 8px}
#rhythmGame[data-phase="play"] .rg-tip,#rhythmGame[data-phase="countdown"] .rg-tip{display:none}
#rhythmGame[data-phase="play"] .rg-stats div:nth-child(4),#rhythmGame[data-phase="countdown"] .rg-stats div:nth-child(4){display:none}
#rhythmGame .rg-call-now{background:#e85d3c;color:#fff9e6;box-shadow:0 0 0 3px #f2d979}
.rg-ending{background:#d8e6cd;border:2px solid #244942;border-radius:12px;padding:10px 8px;margin:6px 0 10px;animation:rg-ending-in .45s ease-out both}
.rg-ending b,.rg-ending span{display:block}.rg-ending b{font-size:16px;margin:5px 0}.rg-ending span{font-size:11px;line-height:1.5}
.rg-ending-icon svg{width:64px;height:48px}.rg-graduation .rg-ending-icon svg{width:30px;height:35px}
@keyframes rg-ending-in{from{opacity:0;transform:translateY(12px) scale(.96)}to{opacity:1;transform:translateY(0) scale(1)}}
@media (prefers-reduced-motion:reduce){.rg-ending{animation:none}}

.rg-ending .ah-icon{position:static;display:inline-flex;margin:0 2px;width:42px;height:42px;vertical-align:middle}.rg-ending .ah-icon svg{width:26px;height:26px}.rg-graduation .ah-icon{width:25px;height:30px;margin:0 1px}.rg-graduation .ah-icon svg{width:19px;height:22px}

.auntie-practice button:disabled{opacity:.4;cursor:default}.auntie-practice button[aria-pressed="true"]{background:#f2d979;border-color:#244942}

#rhythmGame[data-game="mosquito"] .rg-lane{display:none}#rhythmGame[data-game="mosquito"] canvas{touch-action:none;cursor:crosshair}#rhythmGame[data-game="mosquito"] .rg-call{pointer-events:none}.rg-touch-help{display:block;width:100%;text-align:center;padding:12px;font-weight:800}

#musicRetry{position:fixed;left:10%;bottom:18px;width:80%;z-index:1000;background:#f2d979;color:#244942;border:2px solid #244942;border-radius:12px;padding:14px;font-weight:bold}#campusMusic{display:none}

/* Vertical scrolling remains available on menus; play surfaces consume gestures. */
html,body,#app{touch-action:pan-y}#scene,#play,.rg-scene,.rg-pad{touch-action:none}button{touch-action:manipulation}

#audioDiagnostic{white-space:pre-wrap;word-break:break-word;font:12px/1.6 monospace;color:#244942;margin:10px 0}#audioTest{color:#244942;min-height:44px;width:100%;background:#f2d979;border:2px solid #244942;border-radius:9px;font-weight:800}
