/* ==================== 基础色彩与页面骨架 ==================== */
:root {
  --ink: #26334a;
  --ink-soft: #697792;
  --ink-faint: #9aa7bb;
  --blue: #4b9df5;
  --blue-deep: #2d7ce4;
  --blue-pale: #e8f3ff;
  --coral: #f26f68;
  --coral-deep: #dc5a58;
  --yellow: #f6c84d;
  --mint: #54c7ad;
  --purple: #9e7cdd;
  --paper: rgba(255, 255, 255, 0.88);
  --paper-strong: #ffffff;
  --line: rgba(115, 142, 181, 0.2);
  --shadow-soft: 0 18px 45px rgba(75, 110, 157, 0.12);
  --shadow-card: 0 9px 22px rgba(72, 103, 150, 0.11);
  --radius-large: 28px;
  --radius-medium: 18px;
  --radius-small: 12px;
  --header-height: 76px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: #eff5fd;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 233, 179, 0.55), transparent 28%),
    radial-gradient(circle at 92% 5%, rgba(190, 224, 255, 0.7), transparent 30%),
    linear-gradient(135deg, #fffaf0 0%, #f0f7ff 54%, #edf6fb 100%);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(75, 157, 245, 0.5);
  outline-offset: 3px;
}

.is-hidden {
  display: none !important;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  padding: 14px 16px 16px;
  animation: page-in 360ms ease-out both;
}

/* ==================== 加载与错误状态 ==================== */
.loading-overlay,
.error-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 218, 118, 0.35), transparent 25%),
    linear-gradient(135deg, #fdfaf1, #edf5ff);
}

.loading-card,
.error-card {
  width: min(420px, 100%);
  padding: 38px 34px 34px;
  text-align: center;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 30px;
  box-shadow: 0 25px 70px rgba(70, 101, 148, 0.2);
  backdrop-filter: blur(16px);
}

.brand-mark {
  position: relative;
  display: inline-flex;
  align-items: flex-end;
  justify-content: center;
  width: 38px;
  height: 38px;
  gap: 3px;
  padding: 6px 5px;
  overflow: hidden;
  background: linear-gradient(145deg, #60b4ff, #4e8fe7);
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 13px;
  box-shadow: 0 8px 16px rgba(65, 139, 229, 0.22), inset 0 1px 2px rgba(255, 255, 255, 0.8);
  transform: rotate(-5deg);
}

.brand-mark::before {
  position: absolute;
  top: -6px;
  right: -4px;
  width: 18px;
  height: 18px;
  content: "";
  background: rgba(255, 255, 255, 0.38);
  border-radius: 50%;
}

.brand-mark span {
  position: relative;
  z-index: 1;
  display: block;
  width: 6px;
  background: #fff;
  border-radius: 8px 8px 3px 3px;
}

.brand-mark span:nth-child(1) { height: 11px; opacity: 0.68; }
.brand-mark span:nth-child(2) { height: 19px; }
.brand-mark span:nth-child(3) { height: 14px; opacity: 0.82; }

.brand-mark-large {
  width: 56px;
  height: 56px;
  margin-bottom: 18px;
  border-radius: 18px;
  transform: rotate(-6deg) scale(1.03);
}

.brand-mark-large span {
  width: 9px;
}

.brand-mark-large span:nth-child(1) { height: 17px; }
.brand-mark-large span:nth-child(2) { height: 30px; }
.brand-mark-large span:nth-child(3) { height: 22px; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue-deep);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

.loading-card h1,
.error-card h1 {
  margin: 0 0 13px;
  color: var(--ink);
  font-size: clamp(22px, 4vw, 28px);
  letter-spacing: -0.04em;
}

.loading-card p:last-child,
.error-card p:not(.eyebrow) {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.7;
}

.loading-bar {
  height: 8px;
  margin: 20px auto 12px;
  overflow: hidden;
  background: #eaf1fa;
  border-radius: 99px;
}

.loading-bar span {
  display: block;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #74d4cc);
  border-radius: inherit;
  animation: loading-slide 1.35s ease-in-out infinite;
}

.error-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 17px;
  color: #fff;
  font-size: 27px;
  font-weight: 900;
  background: linear-gradient(145deg, #f8a04f, var(--coral));
  border-radius: 18px;
  box-shadow: 0 10px 22px rgba(242, 111, 104, 0.25);
}

.error-card p:not(.eyebrow) {
  margin-bottom: 22px;
}

/* ==================== 顶部栏 ==================== */
.app-header {
  display: flex;
  flex: 0 0 var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 14px 10px 16px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 23px;
  box-shadow: 0 8px 28px rgba(70, 104, 153, 0.08);
  backdrop-filter: blur(18px);
}

.brand-block,
.header-actions,
.object-counter,
.status-pill,
.button,
.stage-title-group,
.selection-info,
.selection-actions,
.slider-title-row,
.slider-row,
.panel-heading,
.tip-card-heading,
.drawer-tab,
.drawer-tower-button {
  display: flex;
  align-items: center;
}

.brand-block {
  gap: 11px;
  min-width: 188px;
}

.brand-block h1 {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 1;
}

.brand-block .eyebrow {
  margin-bottom: 4px;
  color: #7690b5;
  font-size: 9px;
  letter-spacing: 0.11em;
}

.header-actions {
  justify-content: flex-end;
  gap: 9px;
}

.object-counter,
.status-pill {
  height: 38px;
  padding: 0 13px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  background: rgba(244, 248, 253, 0.86);
  border: 1px solid rgba(124, 151, 190, 0.16);
  border-radius: 12px;
}

.counter-dot,
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  background: var(--mint);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(84, 199, 173, 0.14);
}

.status-pill {
  color: #438e86;
  background: rgba(229, 250, 244, 0.9);
  border-color: rgba(84, 199, 173, 0.2);
}

.status-dot {
  width: 6px;
  height: 6px;
  margin-right: 7px;
  box-shadow: 0 0 0 3px rgba(84, 199, 173, 0.16);
}

.status-pill.is-busy .status-dot {
  background: var(--yellow);
  box-shadow: 0 0 0 3px rgba(246, 200, 77, 0.2);
  animation: soft-pulse 1.1s ease-in-out infinite;
}

.button {
  justify-content: center;
  min-height: 42px;
  gap: 7px;
  padding: 0 15px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 13px;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
  user-select: none;
}

.button:hover {
  transform: translateY(-2px);
}

.button:active {
  transform: translateY(1px) scale(0.98);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.button-icon {
  font-size: 17px;
  font-weight: 400;
  line-height: 1;
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-deep));
  box-shadow: 0 10px 20px rgba(75, 157, 245, 0.23);
}

.button-coral {
  color: #fff;
  background: linear-gradient(135deg, #f68b73, var(--coral-deep));
  box-shadow: 0 10px 20px rgba(242, 111, 104, 0.23);
}

.button-soft {
  color: #62748f;
  background: rgba(247, 250, 254, 0.9);
  border-color: rgba(124, 151, 190, 0.2);
}

.button-outline {
  color: var(--blue-deep);
  background: #f8fbff;
  border-color: rgba(75, 157, 245, 0.28);
}

.button-wide {
  width: 100%;
}

/* ==================== 主体与侧栏 ==================== */
.app-main {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: 222px minmax(420px, 1fr) 292px;
  gap: 14px;
  min-height: 0;
  padding-top: 14px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 20px 17px 16px;
  overflow: auto;
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.panel-heading {
  justify-content: space-between;
  gap: 8px;
}

.panel-heading .eyebrow {
  margin-bottom: 5px;
  color: #88a1bf;
  font-size: 9px;
}

.panel-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.05em;
}

.panel-badge {
  padding: 5px 8px;
  color: #bd8d17;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
  background: #fff4cb;
  border-radius: 8px;
}

.panel-badge-blue {
  color: var(--blue-deep);
  background: var(--blue-pale);
}

.panel-intro {
  margin: 10px 0 16px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.7;
}

.shape-list {
  display: grid;
  gap: 9px;
}

.shape-button {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 66px;
  gap: 9px;
  padding: 9px 8px;
  text-align: left;
  cursor: pointer;
  background: #fff;
  border: 1px solid rgba(118, 151, 192, 0.14);
  border-radius: 16px;
  box-shadow: 0 5px 13px rgba(75, 106, 150, 0.06);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.shape-button:hover {
  border-color: rgba(75, 157, 245, 0.36);
  box-shadow: 0 9px 18px rgba(75, 106, 150, 0.12);
  transform: translateY(-2px);
}

.shape-button:active {
  transform: translateY(1px) scale(0.985);
}

.shape-icon {
  position: relative;
  display: grid;
  flex: 0 0 40px;
  place-items: center;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border-radius: 13px;
}

.shape-icon::after {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 9px;
  height: 5px;
  content: "";
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  transform: rotate(-25deg);
}

.shape-icon-sphere { background: #fff0ec; }
.shape-icon-box { background: #fff7da; }
.shape-icon-cylinder { background: #e8fbf4; }

.shape-icon-sphere span {
  width: 22px;
  height: 22px;
  background: linear-gradient(145deg, #ff9881, #ee5f66);
  border-radius: 50%;
  box-shadow: inset -4px -4px 0 rgba(180, 53, 71, 0.12), 0 4px 7px rgba(233, 92, 103, 0.24);
}

.shape-icon-box span {
  width: 22px;
  height: 22px;
  background: linear-gradient(145deg, #ffd969, #f1b735);
  border-radius: 5px;
  box-shadow: inset -4px -4px 0 rgba(196, 137, 26, 0.14), 0 4px 7px rgba(226, 167, 37, 0.24);
  transform: rotate(-8deg);
}

.shape-icon-cylinder span {
  position: relative;
  width: 19px;
  height: 23px;
  background: linear-gradient(90deg, #4bbd9e, #87dbc2 46%, #39b48d 100%);
  border-radius: 5px 5px 6px 6px;
  box-shadow: inset -4px -3px 0 rgba(20, 131, 116, 0.12), 0 4px 7px rgba(43, 167, 140, 0.2);
}

.shape-icon-cylinder span::before {
  position: absolute;
  top: -4px;
  left: 0;
  width: 19px;
  height: 8px;
  content: "";
  background: #9ce6d0;
  border-radius: 50%;
}

.shape-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.shape-copy strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.shape-copy small {
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 9px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shape-arrow {
  color: #9bb1cb;
  font-size: 17px;
  font-weight: 400;
}

.panel-divider {
  height: 1px;
  margin: 20px 0 15px;
  background: var(--line);
}

.tip-card {
  padding: 13px 12px 12px;
  background: #f6faff;
  border: 1px solid #e5f0fb;
  border-radius: 15px;
}

.tip-card-heading {
  gap: 7px;
  color: var(--ink);
  font-size: 11px;
}

.tip-spark {
  color: var(--yellow);
  font-size: 16px;
  text-shadow: 0 2px 6px rgba(232, 170, 40, 0.28);
}

.tip-card ul {
  display: grid;
  gap: 9px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.tip-card li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 10px;
}

.tip-card li span {
  font-weight: 800;
}

.tip-card li small {
  color: var(--ink-faint);
  font-size: 9px;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 40px;
  padding: 4px 8px;
  color: var(--blue-deep);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  background: transparent;
  border-radius: 10px;
  transition: background 160ms ease, color 160ms ease;
}

.text-button:hover {
  background: var(--blue-pale);
}

.help-button {
  align-self: flex-start;
  margin-top: auto;
  padding-left: 0;
}

.help-button span {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  color: #fff;
  font-size: 12px;
  background: var(--blue);
  border-radius: 50%;
}

/* ==================== 中央立体场景 ==================== */
.stage-panel {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(150deg, rgba(226, 241, 255, 0.86), rgba(249, 249, 245, 0.62));
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-soft);
}

.stage-header {
  position: absolute;
  top: 18px;
  right: 20px;
  left: 20px;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.stage-title-group {
  align-items: flex-start;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
}

.stage-title-group p {
  margin: 0;
  color: #71849e;
  font-size: 11px;
  font-weight: 700;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  color: #4a9a8b;
  font-size: 10px;
  font-weight: 900;
  background: rgba(241, 255, 251, 0.78);
  border: 1px solid rgba(84, 199, 173, 0.21);
  border-radius: 9px;
  backdrop-filter: blur(10px);
}

.live-indicator span {
  width: 6px;
  height: 6px;
  background: var(--mint);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(84, 199, 173, 0.13);
}

.selection-hint {
  padding: 8px 10px;
  color: #8697af;
  font-size: 10px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.57);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 10px;
  backdrop-filter: blur(10px);
}

.scene-host {
  position: relative;
  flex: 1 1 auto;
  min-height: 330px;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.scene-host:active {
  cursor: grabbing;
}

.scene-host canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
}

.scene-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), transparent 18%, transparent 76%, rgba(50, 86, 132, 0.08));
}

.scene-empty-mark {
  position: absolute;
  top: 49%;
  left: 50%;
  z-index: 1;
  display: flex;
  gap: 6px;
  opacity: 0.25;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: opacity 260ms ease;
}

.scene-empty-mark span {
  display: block;
  width: 9px;
  height: 9px;
  background: #91b7df;
  border-radius: 50%;
}

.scene-empty-mark span:nth-child(2) {
  width: 13px;
  height: 13px;
  margin-top: -4px;
  background: #f5c960;
}

.scene-empty-mark span:nth-child(3) {
  background: #85d1bd;
}

.stage-panel.has-objects .scene-empty-mark {
  opacity: 0;
}

.guide-card {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  width: min(280px, calc(100% - 40px));
  padding: 23px 24px 22px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.95);
  border-radius: 22px;
  box-shadow: 0 20px 45px rgba(69, 105, 153, 0.16);
  backdrop-filter: blur(16px);
  transform: translate(-50%, -48%);
  transition: opacity 220ms ease, transform 220ms ease;
}

.guide-card.is-dismissed {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -42%) scale(0.96);
}

.guide-close {
  position: absolute;
  top: 9px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #8da0b9;
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  background: transparent;
  border-radius: 50%;
}

.guide-close:hover {
  color: var(--ink);
  background: #edf4fc;
}

.guide-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  color: #fff;
  font-size: 17px;
  background: linear-gradient(145deg, #f8d674, #edb846);
  border-radius: 11px;
  box-shadow: 0 7px 14px rgba(222, 170, 52, 0.22);
}

.guide-card h2 {
  margin: 0 0 15px;
  color: var(--ink);
  font-size: 21px;
  letter-spacing: -0.05em;
}

.guide-card ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-card li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.35;
}

.guide-card li span {
  display: grid;
  flex: 0 0 22px;
  place-items: center;
  width: 22px;
  height: 22px;
  color: var(--blue-deep);
  font-size: 10px;
  font-weight: 900;
  background: var(--blue-pale);
  border-radius: 50%;
}

.guide-card li p {
  margin: 0;
}

.compact-help {
  position: absolute;
  bottom: 17px;
  left: 18px;
  z-index: 4;
  padding: 8px 11px;
  color: #6f829e;
  font-size: 10px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  box-shadow: 0 7px 17px rgba(74, 106, 152, 0.1);
  backdrop-filter: blur(9px);
  pointer-events: none;
}

.compact-help span {
  margin-right: 3px;
  color: var(--yellow);
}

.impact-fx {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--coral-deep);
  font-size: 12px;
  font-weight: 900;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.impact-fx.is-playing .impact-ring {
  animation: impact-ring 480ms ease-out both;
}

.impact-arrow {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  color: #fff;
  font-size: 19px;
  background: linear-gradient(145deg, #f78a72, var(--coral-deep));
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(242, 111, 104, 0.28);
}

.impact-ring {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(242, 111, 104, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.scene-toast {
  position: absolute;
  bottom: 23px;
  left: 50%;
  z-index: 9;
  max-width: min(92%, 380px);
  padding: 10px 14px;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  background: rgba(40, 55, 78, 0.87);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 12px 25px rgba(38, 51, 74, 0.21);
  transform: translateX(-50%);
}

.stage-footer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  gap: 6px;
  color: #8a9ab1;
  font-size: 10px;
  font-weight: 700;
}

.mouse-icon {
  color: #6fa6dd;
  font-size: 17px;
}

.selection-bar {
  position: absolute;
  bottom: 46px;
  left: 50%;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(600px, calc(100% - 32px));
  gap: 12px;
  padding: 9px 10px 9px 14px;
  background: rgba(40, 55, 78, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 17px;
  box-shadow: 0 15px 34px rgba(39, 56, 83, 0.24);
  backdrop-filter: blur(13px);
  transform: translateX(-50%);
  animation: bar-in 220ms ease-out both;
}

.selection-info {
  min-width: 0;
  gap: 8px;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.selection-orb {
  display: block;
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.18);
}

.selection-actions {
  justify-content: flex-end;
  gap: 5px;
}

.selection-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 49px;
  height: 34px;
  gap: 4px;
  padding: 0 7px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 9px;
  transition: background 160ms ease, transform 160ms ease, color 160ms ease;
}

.selection-button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.selection-button span:first-child {
  font-size: 15px;
  font-weight: 400;
}

.selection-push {
  color: #ffe5a0;
  background: rgba(245, 182, 64, 0.18);
  border-color: rgba(246, 200, 77, 0.28);
}

.selection-delete {
  color: #ffb5b1;
  background: rgba(242, 111, 104, 0.15);
  border-color: rgba(242, 111, 104, 0.23);
}

/* ==================== 物理实验台与滑块 ==================== */
.physics-panel .panel-intro {
  margin-bottom: 13px;
}

.slider-stack {
  display: grid;
  gap: 10px;
}

.slider-card {
  padding: 12px 12px 11px;
  background: rgba(249, 252, 255, 0.9);
  border: 1px solid #e5eff9;
  border-radius: 15px;
  transition: box-shadow 180ms ease, border-color 180ms ease;
}

.slider-card.is-pulsing {
  border-color: rgba(75, 157, 245, 0.45);
  box-shadow: 0 0 0 4px rgba(75, 157, 245, 0.09);
}

.slider-title-row {
  justify-content: space-between;
  margin-bottom: 9px;
}

.slider-title-row label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.slider-title-row output {
  min-width: 43px;
  color: var(--blue-deep);
  font-size: 15px;
  font-weight: 900;
  text-align: right;
  letter-spacing: -0.03em;
}

.slider-row {
  gap: 6px;
}

.slider-row > span {
  color: #a6b3c4;
  font-size: 9px;
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  height: 23px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--blue);
  appearance: none;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: linear-gradient(90deg, #7eb9f6 0%, #d8e8f8 100%);
  border-radius: 99px;
}

input[type="range"]::-moz-range-track {
  height: 6px;
  background: linear-gradient(90deg, #7eb9f6 0%, #d8e8f8 100%);
  border-radius: 99px;
}

input[type="range"]::-webkit-slider-thumb {
  width: 18px;
  height: 18px;
  margin-top: -6px;
  cursor: grab;
  background: #fff;
  border: 4px solid var(--blue);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(62, 136, 221, 0.25);
  appearance: none;
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  cursor: grab;
  background: #fff;
  border: 4px solid var(--blue);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(62, 136, 221, 0.25);
}

input[type="range"]:active::-webkit-slider-thumb,
input[type="range"]:active::-moz-range-thumb {
  cursor: grabbing;
}

.slider-card p {
  margin: 7px 0 0;
  color: var(--ink-faint);
  font-size: 9px;
  line-height: 1.35;
}

.physics-panel > .button {
  margin-top: 14px;
}

.physics-callout {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 14px;
  padding: 11px 10px;
  color: #7789a4;
  background: #fff8e6;
  border: 1px solid #f8eac0;
  border-radius: 13px;
}

.callout-icon {
  color: #e8ae32;
  font-size: 17px;
  line-height: 1;
}

.physics-callout p {
  margin: 0;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.55;
}

.drawer-close-button {
  display: none;
  align-self: center;
  margin-top: auto;
}

/* ==================== 移动端底部抽屉 ==================== */
.mobile-drawer-bar {
  display: none;
}

/* ==================== 动效 ==================== */
@keyframes page-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes loading-slide {
  0% { transform: translateX(-120%); }
  50% { transform: translateX(110%); }
  100% { transform: translateX(260%); }
}

@keyframes soft-pulse {
  0%, 100% { transform: scale(0.85); opacity: 0.65; }
  50% { transform: scale(1.25); opacity: 1; }
}

@keyframes bar-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes impact-ring {
  from { opacity: 0.8; transform: translate(-50%, -50%) scale(0.7); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(2.35); }
}

/* ==================== 平板布局 ==================== */
@media (max-width: 1199px) and (min-width: 768px) {
  :root {
    --header-height: 70px;
  }

  .app-shell {
    padding: 12px;
  }

  .app-main {
    position: relative;
    display: block;
  }

  .stage-panel {
    width: 100%;
    height: 100%;
  }

  .object-panel,
  .physics-panel {
    position: absolute;
    top: 14px;
    z-index: 12;
    width: min(285px, calc(50% - 24px));
    max-height: calc(100% - 28px);
  }

  .object-panel {
    left: 14px;
  }

  .physics-panel {
    right: 14px;
  }

  .shape-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .shape-button {
    flex-direction: column;
    align-items: center;
    min-height: 94px;
    padding: 9px 5px;
    text-align: center;
  }

  .shape-copy {
    align-items: center;
  }

  .shape-arrow {
    position: absolute;
    top: 5px;
    right: 7px;
  }

  .tip-card,
  .help-button {
    display: none;
  }
}

/* ==================== 手机布局：场景优先，面板变成底部抽屉 ==================== */
@media (max-width: 767px) {
  :root {
    --header-height: 58px;
  }

  html,
  body {
    overflow: hidden;
  }

  .app-shell {
    padding: 8px 8px 72px;
  }

  .app-header {
    flex-basis: var(--header-height);
    gap: 8px;
    padding: 7px 8px 7px 10px;
    border-radius: 17px;
  }

  .brand-block {
    min-width: 0;
    gap: 7px;
  }

  .brand-block .brand-mark {
    width: 32px;
    height: 32px;
    padding: 5px 4px;
    border-width: 2px;
    border-radius: 10px;
  }

  .brand-block .brand-mark span {
    width: 5px;
  }

  .brand-block .brand-mark span:nth-child(1) { height: 9px; }
  .brand-block .brand-mark span:nth-child(2) { height: 15px; }
  .brand-block .brand-mark span:nth-child(3) { height: 11px; }

  .brand-block h1 {
    font-size: 16px;
  }

  .brand-block .eyebrow,
  .object-counter,
  .status-pill {
    display: none;
  }

  .header-actions {
    gap: 5px;
  }

  .header-push,
  .header-push .button-icon {
    min-height: 36px;
  }

  .header-push {
    padding: 0 9px;
    font-size: 11px;
    border-radius: 11px;
  }

  .header-push .button-icon {
    font-size: 16px;
  }

  #restartButton {
    min-width: 36px;
    width: 36px;
    padding: 0;
    font-size: 0;
    border-radius: 11px;
  }

  #restartButton .button-icon {
    font-size: 19px;
  }

  .app-main {
    display: block;
    padding-top: 8px;
  }

  .stage-panel {
    height: 100%;
    min-height: 0;
    border-radius: 21px;
  }

  .scene-host {
    min-height: 0;
  }

  .stage-header {
    top: 12px;
    right: 12px;
    left: 12px;
  }

  .stage-title-group p {
    display: none;
  }

  .selection-hint {
    padding: 6px 8px;
    font-size: 9px;
  }

  .stage-footer-note {
    min-height: 28px;
    font-size: 9px;
  }

  .selection-bar {
    bottom: 38px;
    width: calc(100% - 16px);
    padding: 7px;
    gap: 5px;
    border-radius: 14px;
  }

  .selection-info {
    display: none;
  }

  .selection-actions {
    width: 100%;
    justify-content: space-between;
    gap: 4px;
  }

  .selection-button {
    flex: 1;
    min-width: 0;
    height: 38px;
    padding: 0 3px;
    font-size: 10px;
  }

  .selection-button span:first-child {
    font-size: 14px;
  }

  .guide-card {
    width: min(282px, calc(100% - 28px));
    padding: 20px 19px;
  }

  .compact-help {
    bottom: 10px;
    left: 12px;
    padding: 7px 9px;
    font-size: 9px;
  }

  .side-panel {
    position: fixed;
    right: 8px;
    bottom: 70px;
    left: 8px;
    z-index: 30;
    display: none;
    width: auto;
    max-height: 42dvh;
    padding: 17px 15px 14px;
    border-radius: 21px;
    box-shadow: 0 15px 38px rgba(50, 79, 121, 0.22);
  }

  body[data-drawer="objects"] .object-panel,
  body[data-drawer="physics"] .physics-panel {
    display: flex;
    animation: drawer-up 220ms ease-out both;
  }

  .object-panel .panel-intro,
  .physics-panel .panel-intro {
    margin-top: 7px;
    margin-bottom: 11px;
  }

  .shape-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
  }

  .shape-button {
    flex-direction: column;
    align-items: center;
    min-height: 88px;
    gap: 4px;
    padding: 8px 4px 6px;
    text-align: center;
  }

  .shape-icon {
    flex-basis: 34px;
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  .shape-copy {
    align-items: center;
  }

  .shape-copy strong {
    font-size: 10px;
  }

  .shape-copy small {
    display: none;
  }

  .shape-arrow {
    position: absolute;
    top: 3px;
    right: 5px;
    font-size: 14px;
  }

  .panel-divider,
  .tip-card,
  .help-button {
    display: none;
  }

  .drawer-close-button {
    display: inline-flex;
    min-height: 30px;
  }

  .slider-stack {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
  }

  .slider-card {
    padding: 9px 8px 8px;
    border-radius: 12px;
  }

  .slider-title-row {
    display: block;
    margin-bottom: 3px;
    text-align: center;
  }

  .slider-title-row label,
  .slider-title-row output {
    display: block;
    min-width: 0;
    text-align: center;
  }

  .slider-title-row label {
    font-size: 10px;
  }

  .slider-title-row output {
    font-size: 14px;
  }

  .slider-row {
    display: block;
  }

  .slider-row > span {
    display: none;
  }

  .slider-card p {
    display: none;
  }

  .physics-callout {
    display: none;
  }

  .physics-panel > .button {
    margin-top: 9px;
  }

  .mobile-drawer-bar {
    position: fixed;
    right: 8px;
    bottom: 8px;
    left: 8px;
    z-index: 40;
    display: grid;
    grid-template-columns: 1fr 1.35fr 1fr;
    height: 56px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.89);
    border: 1px solid rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    box-shadow: 0 10px 28px rgba(56, 83, 122, 0.18);
    backdrop-filter: blur(16px);
  }

  .drawer-tab,
  .drawer-tower-button {
    justify-content: center;
    flex-direction: column;
    gap: 2px;
    color: #7588a3;
    font-size: 9px;
    font-weight: 900;
    cursor: pointer;
    background: transparent;
    border-radius: 13px;
  }

  .drawer-tab span:first-child,
  .drawer-tower-button span:first-child {
    font-size: 17px;
    line-height: 1;
  }

  .drawer-tab:hover,
  body[data-drawer="objects"] .drawer-tab:first-child,
  body[data-drawer="physics"] .drawer-tab:last-child {
    color: var(--blue-deep);
    background: var(--blue-pale);
  }

  .drawer-tower-button {
    color: #fff;
    background: linear-gradient(135deg, #f58d74, var(--coral-deep));
    box-shadow: 0 6px 13px rgba(242, 111, 104, 0.23);
  }
}

@keyframes drawer-up {
  from { opacity: 0; transform: translateY(13px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
