/* layout.css — v4.0.0 画布框架 + PC/移动双端适配
   核心画布：全高竖屏容器，移动端满屏，PC 端居中限宽。
   所有内部元素用百分比定位，天然自适应。 */

html, body {
  height: 100%;
}

body {
  /* PC 端容器外背景：暖色填充 */
  background: #2b2622;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* —— 视口外壳：承接 PC 两侧多出的背景区域 —— */
#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #d1eaf8;
  transition: background 0.35s ease;
  --stage-safe-top: env(safe-area-inset-top);
  --stage-safe-bottom: env(safe-area-inset-bottom);
}

/* 全高舞台：移动端铺满视口，PC 保持 480px 最大宽度。 */
.design-stage {
  position: relative;
  flex: 0 0 auto;
  width: min(100%, 480px);
  height: 100%;
  overflow: hidden;
  background: #f4ead3;
  container-type: size;
  container-name: stage;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
}

/* 单屏：绝对定位铺满画布 */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transform: scale(1.02);
  transition: opacity 0.55s ease, transform 0.55s ease, visibility 0s linear 0.55s;
  z-index: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen.is-active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
  transition: opacity 0.55s ease, transform 0.55s ease, visibility 0s;
  z-index: 2;
}

/* —— 全局音乐播放器（矢量图标，播放时 360°慢旋转）—— */
.music-toggle {
  position: absolute;
  top: calc(var(--stage-safe-top) + 14px);
  left: 14px;
  width: 10cqw;
  height: 10cqw;
  max-width: 48px;
  max-height: 48px;
  min-width: 36px;
  min-height: 36px;
  z-index: 60;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #111111;
}
.music-icon {
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;
  overflow: visible;
  will-change: transform;
}
.music-ring,
.music-stem,
.music-slash {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.music-ring { stroke-width: 3.6; }
.music-stem { stroke-width: 4.2; }
.music-note-head { fill: currentColor; }
.music-slash {
  stroke-width: 4.8;
  opacity: 1;
  transition: opacity 0.2s ease;
}
/* 播放态：斜线消失，整个矢量图标匀速旋转。 */
.music-toggle.is-playing .music-icon {
  animation: musicSpin 6s linear infinite;
}
.music-toggle.is-playing .music-slash { opacity: 0; }
.music-toggle.is-muted .music-icon { animation: none; }
.music-toggle.is-muted .music-slash { opacity: 1; }
.music-toggle:focus-visible {
  outline: 3px solid rgba(232, 85, 19, 0.9);
  outline-offset: 3px;
  border-radius: 50%;
}
@keyframes musicSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* —— 按钮通用 —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 50px;
  padding: 0 28px;
  border-radius: var(--r-pill);
  font-size: 17px;
  font-weight: 700;
  font-family: var(--font-title);
  letter-spacing: 1px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: translateY(3px); box-shadow: none !important; }
.btn-primary {
  background: var(--btn-primary);
  color: var(--btn-primary-tx);
  box-shadow: 0 6px 0 var(--btn-primary-sh);
}
.btn-primary:active { box-shadow: 0 2px 0 var(--btn-primary-sh); }
.btn-ghost {
  background: #fff;
  color: var(--btn-primary-tx);
  border: 2px solid var(--stroke-blue);
  box-shadow: 0 4px 0 rgba(97, 163, 189, 0.35);
}

/* —— toast —— */
#toast {
  position: absolute;
  left: 50%;
  bottom: calc(13cqh + var(--stage-safe-bottom));
  transform: translateX(-50%) translateY(10px);
  background: rgba(26, 26, 26, 0.9);
  color: #fff;
  font-size: var(--fs-sm);
  padding: 10px 20px;
  border-radius: var(--r-pill);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 200;
  white-space: nowrap;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
