/*
  捏捏菲比 · 样式表
  原站为单行压缩样式，此处仅做格式化与分节注释，规则内容未改动。
  层叠顺序敏感：音游相关规则必须排在工具栏之后，否则 .tea-playing 的隐藏规则会被覆盖。
*/

:root {
  font-family:
    Inter,
    PingFang SC,
    Microsoft YaHei,
    sans-serif;
  color: #373451;
  background: #eeedf6;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
/* ── 画布容器：铺满视口，径向渐变作背景兜底（WebGL 未就绪时可见） ── */
#app {
  height: 100dvh;
  position: relative;
  overflow: hidden;
  background: radial-gradient(
    ellipse at 45% 40%,
    #e5dfea,
    #c8c4db 60%,
    #aaaac5
  );
}
#stage {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
canvas {
  display: block;
  touch-action: none;
  width: 100%;
  height: 100%;
}
/* ── 加载状态条：居中卡片，模型就绪后由 JS 隐藏 ── */
#status {
  position: absolute;
  left: 50%;
  top: 43%;
  transform: translate(-50%, -50%);
  background: #fffc;
  padding: 18px 28px;
  border-radius: 18px;
  max-width: 85%;
  text-align: center;
  font-size: 14px;
}
#status:empty {
  display: none;
}
#stage {
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}
/* ── 拉脸触控层：默认透明且不接收事件，进入拉脸模式后铺满全屏 ── */
.cheek-haptic {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  pointer-events: none;
  touch-action: none;
  margin: 0;
}
#app:has(:is(#single-tool, #double-tool, #tea-play)[aria-pressed="true"])
  .cheek-haptic {
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: auto;
}
/* ── 工具栏通用样式：58×58 方块，毛玻璃底，选中态反色 ── */
.tools {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  display: grid;
  gap: 8px;
}
.tools :is(button, .x-profile) {
  width: 58px;
  height: 58px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2px;
  border: 1px solid #fff9;
  border-radius: 12px;
  background: #f9f7f1eb;
  color: #4e4862;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 8px #39314719;
}
.tools button[aria-pressed="true"] {
  background: #59536d;
  color: #fff;
}
.tools :is(button, .x-profile):focus-visible {
  outline: 2px solid #534b72;
  outline-offset: 3px;
}
.tools button:disabled {
  opacity: 0.5;
  cursor: wait;
}
#app,
#app * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.tools button {
  touch-action: manipulation;
}
#sound-tool[aria-pressed="false"] .sound-waves,
#sound-tool[aria-pressed="true"] .mute-mark {
  display: none;
}
/* ── 左上：显示与设置（脱帽 / 音效 / 语言 / 作者主页） ── */
.settings-tools {
  left: max(16px, env(safe-area-inset-left));
  grid-auto-flow: column;
}
/* ── 右上：脸部动作（捧脸 / 戳脸 / 单手 / 双手 / 音游） ── */
.action-tools {
  right: max(16px, env(safe-area-inset-right));
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.tools button {
  padding-inline: 2px;
}
.tools button span {
  white-space: nowrap;
}
.tea-playing .action-tools button:not(#tea-play) {
  display: none;
}
/* ── 音游：轨道、note、判定特效 ── */
#tea-lane {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  pointer-events: none;
}
.tea-track {
  position: absolute;
  height: 0;
}
.tea-track:before {
  content: "";
  position: absolute;
  inset: -1px 0 auto;
  height: 2px;
  background: linear-gradient(90deg, #9b829f99, #fff9e6aa 35%, transparent);
}
.tea-target {
  position: absolute;
  left: -18px;
  top: -18px;
  width: 36px;
  height: 36px;
  border: 2px solid #fff5dcbf;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #87748890;
  background: #fff5dc18;
}
.tea-note {
  position: absolute;
  left: 0;
  top: -18px;
  height: 36px;
  will-change: transform;
  filter: opacity(0.66);
  --note-fill: #dfa477;
}
.tea-note.single {
  --note-fill: #a88bc4;
}
.tea-note span {
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
}
.tea-note span:before,
.tea-note span:after {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  box-sizing: border-box;
  border-radius: 50%;
}
.tea-note span:before {
  border: 2px solid #fffbf3;
  background: var(--note-fill);
}
.tea-note span:after {
  border: 1.5px solid var(--note-fill);
  transform: scale(var(--approach-scale));
  opacity: var(--approach-opacity);
}
.tea-note.held span:after {
  opacity: 0;
}
.tea-note.single:before {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: 3px;
  height: 30px;
  box-sizing: border-box;
  border: 2px solid #fff6ff;
  border-radius: 15px;
  background: #9379ab;
}
.tea-note.single:after {
  content: "";
  position: absolute;
  right: 7px;
  top: 7px;
  width: 22px;
  height: 22px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1.5px solid #eee2f5;
  background: #bda5ce;
}
.tea-note.single span {
  z-index: 1;
}
.tea-note.single.held span:before {
  border-color: #fff;
  background: #8564a3;
}
.tea-pointer-dot {
  position: fixed;
  top: -6px;
  left: -6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid #fff9;
  background: #83689899;
  pointer-events: none;
}
.tea-burst {
  position: absolute;
  z-index: 3;
  left: -16px;
  top: -16px;
  width: 32px;
  height: 32px;
  border: 3px solid currentColor;
  color: #ffe1a0;
  border-radius: 50%;
}
.tea-burst[data-kind="hold"],
.tea-burst[data-kind="release"] {
  color: #ecdcff;
}
.tea-burst[data-precise="true"]:after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  margin: -1.5px;
  border-radius: 50%;
  box-shadow:
    18px 0,
    -18px 0,
    9px 16px,
    -9px 16px,
    9px -16px,
    -9px -16px;
}
.tea-streak {
  position: absolute;
  left: 4px;
  top: 29px;
  color: #fff4de;
  text-shadow: 0 1px 3px #4e3d59;
  font: 700 12px/1 system-ui;
}
.tea-target.following {
  z-index: 2;
  border-color: transparent;
  background: none;
  box-shadow: none;
}
.rhythm-touch {
  position: fixed;
  width: 28px;
  height: 28px;
  margin: -14px;
  border: 2px solid #fff1d7;
  border-radius: 50%;
  box-shadow: 0 0 5px #95749888;
  pointer-events: none;
}
.tea-playing .settings-tools {
  pointer-events: none;
}
.tea-playing .settings-tools :is(button, .x-profile) {
  pointer-events: auto;
}
/* ── 音游：启动按钮、缓冲提示、消息 ── */
#tea-launch {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  top: calc(max(20px, env(safe-area-inset-top)) + 66px);
  z-index: 2;
  text-align: right;
}
#tea-buffer,
#tea-retry,
#tea-message:not(:empty) {
  background: #f9f7f1f5;
  color: #4e4862;
  border: 1px solid #fff9;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 500;
  line-height: 1.3;
}
#tea-retry {
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}
#tea-message:not(:empty) {
  display: block;
  margin-top: 6px;
  font-size: 13px;
}
html:lang(en) #tea-launch [lang="zh"],
html:lang(zh) #tea-launch [lang="en"] {
  display: none;
}
@media (max-width: 360px) {
  .settings-tools {
    gap: 4px;
  }
  .settings-tools :is(button, .x-profile) {
    width: 48px;
  }
}
.x-profile {
  text-decoration: none;
}
#tea-buffer {
  font-size: 13px;
  text-align: start;
}
#tea-buffer progress {
  display: block;
  width: 100%;
  height: 5px;
  margin-top: 7px;
  accent-color: #776489;
}
/* ── 加载进度条与详情文字 ── */
#model-progress {
  display: block;
  width: 100%;
  height: 5px;
  margin: 10px 0 6px;
  accent-color: #776489;
}
#model-detail {
  font-size: 12px;
  color: #645d70;
}
#status[hidden],
#model-progress[hidden] {
  display: none;
}
#app[data-loading] canvas {
  visibility: hidden;
}
