/* features.css · 4 大功能弹窗样式（实验室 / 宠物小屋 / 错题竞技场 / 成就） */
/* 与 codex-modal 同款风格：暖色奶油 + 薄荷绿描边 */

.feat-modal {
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.feat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  border-bottom: 1px dashed rgba(180, 140, 100, 0.3);
}
.feat-head h3 {
  font-size: 22px;
  font-weight: 800;
  color: #3a2818;
}
.feat-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 248, 235, 0.8);
  border: 1.5px solid rgba(94, 234, 212, 0.5);
  font-size: 16px;
  color: #7a6048;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s;
}
.feat-close:hover {
  background: #ff7a8a;
  color: #fff;
  border-color: #ff7a8a;
}
.feat-empty {
  text-align: center;
  padding: 60px 24px;
  color: #7a6048;
  font-weight: 700;
}
.feat-emoji {
  font-size: 56px;
  margin-bottom: 12px;
}

/* ============ 实验室 ============ */
.feat-lab { padding-bottom: 16px; }
.lab-tabs {
  display: flex;
  gap: 8px;
  padding: 12px 24px 0;
  flex-wrap: wrap;
}
.lab-tab {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 248, 235, 0.6);
  border: 1.5px solid rgba(180, 140, 100, 0.3);
  font-size: 13px;
  font-weight: 800;
  color: #7a6048;
  cursor: pointer;
  transition: all 0.15s;
}
.lab-tab.active {
  background: linear-gradient(160deg, #5eead4 0%, #34d399 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(94, 234, 212, 0.35);
}
.lab-body {
  padding: 16px 24px 0;
  overflow-y: auto;
  max-height: 60vh;
}
.lab-pane { display: none; }
.lab-pane.active { display: block; }

/* 计算器 */
.lab-calc-input {
  width: 100%;
  font-size: 22px;
  font-weight: 800;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fffaf0;
  border: 1.5px solid rgba(180, 140, 100, 0.3);
  text-align: right;
  color: #3a2818;
  letter-spacing: 1px;
  margin-bottom: 12px;
  font-family: inherit;
}
.lab-calc-input:focus { outline: 2px solid #5eead4; }
.lab-calc-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}
.lab-calc-row:has(.eq) { grid-template-columns: 1fr 1fr 2fr; }
.lab-key {
  padding: 12px 0;
  font-size: 17px;
  font-weight: 800;
  border-radius: 10px;
  background: linear-gradient(160deg, #fff8eb 0%, #fef0d8 100%);
  border: 1.5px solid rgba(180, 140, 100, 0.3);
  color: #4a3520;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
  font-family: inherit;
}
.lab-key:hover { transform: translateY(-1px); background: #fff; }
.lab-key:active { transform: translateY(1px); }
.lab-key.op { background: linear-gradient(160deg, #ffe5e0 0%, #ffcfc6 100%); color: #b14a3a; }
.lab-key.eq {
  background: linear-gradient(160deg, #5eead4 0%, #34d399 100%);
  color: #fff;
  border-color: transparent;
}
.lab-calc-result {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fffaf0;
  font-size: 16px;
  font-weight: 800;
  color: #4a3520;
  min-height: 24px;
}

/* 计数器 */
.lab-count { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.lab-count-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  min-height: 200px;
  padding: 12px;
  background: #fffaf0;
  border-radius: 14px;
  border: 1.5px solid rgba(180, 140, 100, 0.3);
}
.lab-apple {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff8a73 0%, #ef4444 50%, #b91c1c 100%);
  box-shadow: inset -2px -2px 4px rgba(0, 0, 0, 0.15);
}
.lab-count-info { text-align: center; }
.lab-count-big {
  font-size: 56px;
  font-weight: 900;
  color: #ef6c5b;
  line-height: 1;
}
.lab-count-label {
  font-size: 14px;
  color: #7a6048;
  margin: 4px 0 14px;
  font-weight: 700;
}
.lab-count-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.lab-count-buttons .btn {
  padding: 8px 4px;
  font-size: 13px;
}

/* 乘法表 */
.lab-mul-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.lab-mul-tab {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 248, 235, 0.6);
  border: 1.5px solid rgba(180, 140, 100, 0.3);
  font-weight: 800;
  color: #4a3520;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
}
.lab-mul-tab.active {
  background: linear-gradient(160deg, #5eead4 0%, #34d399 100%);
  color: #fff;
  border-color: transparent;
}
.lab-mul-table {
  background: #fffaf0;
  border-radius: 14px;
  border: 1.5px solid rgba(180, 140, 100, 0.3);
  padding: 12px;
}
.lab-mul-row {
  display: grid;
  grid-template-columns: 60px 20px 60px;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(180, 140, 100, 0.2);
  align-items: center;
  font-size: 16px;
  font-weight: 800;
  color: #4a3520;
}
.lab-mul-row:last-child { border-bottom: none; }
.lab-mul-row b { color: #ef6c5b; }
.lab-mul-ans { color: #5eead4; text-align: left; }

/* ============ 宠物小屋 ============ */
.feat-room { padding-bottom: 16px; }
.room-stage {
  position: relative;
  height: 300px;
  margin: 16px 24px 0;
  border-radius: 18px;
  overflow: hidden;
  border: 1.5px solid rgba(180, 140, 100, 0.3);
  transition: background 1.2s ease;
}
/* SVG 背景铺满整个房间 */
.room-bg-svg {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block;
}
.room-stage img, .room-stage svg.room-bg-svg {
  filter: none;
  max-height: none; max-width: none;
}
.room-pet-wrap {
  position: absolute; bottom: 12%; left: 50%; transform: translateX(-50%);
  z-index: 3; pointer-events: none;
}
.room-pet-wrap img, .room-pet-wrap svg { width: 80px !important; height: 80px !important; filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3)); object-fit: contain; }
.room-time-tabs {
  display: flex; gap: 4px; margin-left: auto; margin-right: 8px;
}
.room-time-btn {
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 800;
  background: rgba(255,248,235,0.5); border: 1.5px solid rgba(180,140,100,0.3); color: #7a6048; cursor: pointer; font-family: inherit;
  transition: all .2s;
}
.room-time-btn:hover { transform: translateY(-1px); }
.room-time-btn.active { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; border-color: transparent; box-shadow: 0 0 8px rgba(251,191,36,0.4); }
.room-time-btn[data-time="day"].active { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.room-time-btn[data-time="evening"].active { background: linear-gradient(135deg, #f97316, #c2410c); }
.room-time-btn[data-time="night"].active { background: linear-gradient(135deg, #6366f1, #312e81); }

/* ===== 房间时段配色（SVG 内 class 由这些规则控制填充） ===== */
.r-wall { fill: #fce4e7; transition: fill 1.2s ease; }
.r-ceiling { fill: #fff5e6; transition: fill 1.2s ease; }
.r-wall-trim { fill: rgba(180,140,100,0.5); }
.r-floor { fill: #d6a97c; transition: fill 1.2s ease; }
.r-baseboard { fill: #b88a5c; transition: fill 1.2s ease; }
.r-windowsill { fill: #e8dcc4; }
.r-curtain { fill: #b4d0e8; transition: fill 1.2s ease; }
.r-cord { stroke: rgba(80,60,40,0.6); }
.r-lamp ellipse:first-child, .r-lamp path { fill: #d97a7a; transition: fill 1.2s ease; }
.r-lamp-bulb { fill: #fff5c8; transition: fill 1.2s ease; }
.r-lamp-glow { fill: rgba(255,235,180,0.15); transition: fill 1.2s ease; }
.r-sky { fill: #cfe7ff; transition: fill 1.2s ease; }
.r-mountain { fill: #a8b8d4; transition: fill 1.2s ease; }
.r-star { fill: #fff; opacity: 0; transition: opacity 1.2s ease; }
.r-moon { fill: #fef9c3; opacity: 0; transition: opacity 1.2s ease; }
.r-sun { fill: #fde047; opacity: 1; transition: opacity 1.2s ease; }

/* === 白天 === */
.room-time-day .r-wall { fill: #fce4e7; }
.room-time-day .r-ceiling { fill: #fff5e6; }
.room-time-day .r-floor { fill: #e8b890; }
.room-time-day .r-curtain { fill: #b4d0e8; }
.room-time-day .r-sky { fill: #cfe7ff; }
.room-time-day .r-mountain { fill: #a8b8d4; }
.room-time-day .r-sun { opacity: 1; }
.room-time-day .r-moon { opacity: 0; }
.room-time-day .r-star { opacity: 0; }
.room-time-day .r-lamp-glow { fill: rgba(255,235,180,0.08); }

/* === 傍晚 === */
.room-time-evening .r-wall { fill: #f7c5a8; }
.room-time-evening .r-ceiling { fill: #f0b89a; }
.room-time-evening .r-floor { fill: #d99570; }
.room-time-evening .r-curtain { fill: #c47f8a; }
.room-time-evening .r-sky { fill: #ffb380; }
.room-time-evening .r-mountain { fill: #8a5b6e; }
.room-time-evening .r-sun { opacity: 0.7; }
.room-time-evening .r-moon { opacity: 0; }
.room-time-evening .r-star { opacity: 0; }
.room-time-evening .r-lamp-glow { fill: rgba(255,180,100,0.18); }

/* === 晚上 === */
.room-time-night .r-wall { fill: #3a3a5e; }
.room-time-night .r-ceiling { fill: #2a2a48; }
.room-time-night .r-floor { fill: #5a4060; }
.room-time-night .r-curtain { fill: #4a5e7a; }
.room-time-night .r-sky { fill: #1e2746; }
.room-time-night .r-mountain { fill: #0f1430; }
.room-time-night .r-sun { opacity: 0; }
.room-time-night .r-moon { opacity: 1; }
.room-time-night .r-star { opacity: 1; }
.room-time-night .r-lamp-bulb { fill: #ffeb99; }
.room-time-night .r-lamp-glow { fill: rgba(255,220,140,0.32); }

.room-stage-deco {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 2;
}
.room-deco {
  position: absolute;
  font-size: 30px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}
.room-deco:nth-child(1) { bottom: 14%; left: 14%; }
.room-deco:nth-child(2) { bottom: 18%; right: 14%; }
.room-deco:nth-child(3) { top: 60%; left: 8%; }
.room-deco:nth-child(4) { top: 56%; right: 32%; }
.room-deco:nth-child(5) { top: 72%; left: 28%; }
.room-deco:nth-child(6) { top: 70%; right: 8%; }
.room-hint { text-align: center; font-size: 12px; margin: 12px 0 10px; }
/* 宠物互动栏 */
.room-pet-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px; flex-wrap: wrap;
}
.rpb-mood { font-size: 13px; font-weight: 800; color: #4a3520; white-space: nowrap; }
.rpb-exp { flex: 1; min-width: 120px; }
.rpb-exp span { display: block; font-size: 11px; font-weight: 700; color: #7a6048; margin-bottom: 3px; }
.rpb-track { height: 8px; background: rgba(0,0,0,0.12); border-radius: 999px; overflow: hidden; }
.rpb-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #8a5cff, #ec4899); transition: width .4s ease; }
.rpb-evolve { font-size: 12px; font-weight: 700; color: #7a6048; white-space: nowrap; }
.room-feed-btn { font-size: 12px !important; padding: 6px 14px !important; white-space: nowrap; }
.room-feed-btn:disabled { opacity: .5; }
.room-item.disabled { opacity: .4; cursor: not-allowed; }
.room-item .ri-price { font-size: 11px; font-weight: 800; color: #f59e0b; margin-top: 2px; }
.room-item.on .ri-price { color: #34d399; font-weight: 800; }
/* room-items/room-item/ri-* 已在 hub.css 中定义 */

/* ============ 错题竞技场 ============ */
.feat-arena { padding-bottom: 16px; }
.arena-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 16px 16px;
}
.arena-stat {
  text-align: center;
  padding: 10px 4px;
  border-radius: 14px;
  background: linear-gradient(160deg, #fff8eb 0%, #fef0d8 100%);
  border: 1.5px solid rgba(180, 140, 100, 0.3);
}
.arena-stat.as-due {
  background: linear-gradient(160deg, #ffe5e0 0%, #ffc8b8 100%);
  border-color: rgba(232, 93, 74, 0.5);
  animation: arenaDuePulse 1.6s ease-in-out infinite;
}
@keyframes arenaDuePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
.as-num { font-size: 26px; font-weight: 900; color: #ef6c5b; line-height: 1; }
.as-lbl { font-size: 11px; color: #7a6048; margin-top: 4px; font-weight: 700; }
.arena-section-title {
  padding: 8px 24px 4px;
  font-size: 13px;
  font-weight: 800;
  color: #7a6048;
}
.arena-cleared-section {
  margin: 0 16px;
  border-top: 1px dashed rgba(180, 140, 100, 0.4);
  padding: 8px 0;
}
.arena-cleared-section summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  color: #7a6048;
  padding: 6px 8px;
  list-style: none;
}
.arena-cleared-section summary::-webkit-details-marker { display: none; }
.arena-list {
  padding: 0 16px;
  overflow-y: auto;
  max-height: 50vh;
}
.arena-card {
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(160deg, #fff8eb 0%, #fef0d8 100%);
  border: 1.5px solid rgba(180, 140, 100, 0.25);
  margin-bottom: 10px;
}
.arena-card.is-cleared {
  opacity: 0.7;
  background: linear-gradient(160deg, #f0f5f0 0%, #d8e8d8 100%);
}
.arena-meta { display: flex; justify-content: space-between; font-size: 11px; color: #7a6048; margin-bottom: 6px; font-weight: 700; gap: 6px; align-items: center; flex-wrap: wrap; }
.arena-box { padding: 2px 8px; border-radius: 999px; color: #fff; font-size: 10px; font-weight: 800; }
.arena-tag { padding: 2px 8px; border-radius: 999px; font-weight: 800; }
.arena-tag.ok { background: rgba(94, 234, 212, 0.25); color: #0d9488; }
.arena-tag.wait { background: rgba(255, 184, 102, 0.25); color: #b07a3a; }
.arena-q { font-size: 14px; font-weight: 800; color: #3a2818; line-height: 1.5; margin-bottom: 8px; }
.arena-kp, .arena-hint-block {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
}
.arena-kp {
  background: rgba(255, 213, 99, 0.18);
  border-left: 3px solid #f0a93b;
}
.arena-hint-block {
  background: rgba(108, 196, 230, 0.15);
  border-left: 3px solid #5cb8e6;
}
.arena-kp-label, .arena-hint-label {
  font-size: 11px;
  font-weight: 800;
  color: #7a6048;
  margin-bottom: 3px;
}
.arena-kp-text, .arena-hint-text { color: #3a2818; }
.arena-trap { font-size: 11px; color: #b07a3a; margin-top: 4px; }
.arena-kp.muted .arena-kp-text { color: #7a6048; font-style: italic; }
.arena-explain { font-size: 12px; margin-top: 6px; line-height: 1.5; }
.arena-foot { display: flex; gap: 10px; font-size: 11px; color: #7a6048; margin-top: 10px; font-weight: 700; flex-wrap: wrap; }
.arena-kps { background: rgba(180, 140, 100, 0.12); padding: 2px 6px; border-radius: 6px; }
.arena-hint { text-align: center; font-size: 12px; padding: 12px 24px 0; }

.arena-actions { display: flex; gap: 8px; margin-top: 10px; }
.arena-btn {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  background: #fff;
  transition: transform 0.1s, box-shadow 0.1s;
}
.arena-btn:active { transform: scale(0.97); }
.arena-btn.redo { border-color: #5cb8e6; color: #1e7aab; }
.arena-btn.redo:hover { background: rgba(92, 184, 230, 0.1); }
.arena-btn.ai { border-color: #c08fff; color: #7a3ed1; }
.arena-btn.ai:hover { background: rgba(192, 143, 255, 0.1); }
.arena-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* v177：AI 重练按钮上的「下一次会发什么」小角标
   v181：轮次按 (关卡, 原题) 逐卡算 ⇒ 多出「题库第3轮」与「维护中」两种状态 */
.ai-step {
  display: none;
  margin-left: 6px; padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px; font-weight: 800; line-height: 1.5;
  background: rgba(192, 143, 255, 0.18); color: #6a2ec0;
  vertical-align: 1px;
}
.ai-step[data-step='alt1'], .ai-step[data-step='alt2'], .ai-step[data-step='alt3'] { display: inline-block; }
.ai-step[data-step='ai'] { display: inline-block; background: rgba(255, 176, 60, 0.22); color: #9a6100; }
/* 题库三组练完、后台又没配 Key ⇒ 下一轮必然走「维护中」，先提示，别让用户白点 */
.ai-step[data-step='maintain'] { display: inline-block; background: rgba(150, 150, 150, 0.22); color: #6b6b6b; }

/* v177：AI 重练结果页的「再点一次会发什么」引导 */
.ai-result-next {
  margin: 4px 0 14px; padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(125, 95, 255, 0.1);
  border: 1.5px dashed rgba(125, 95, 255, 0.4);
  color: #5b3ec0; font-size: 13px; font-weight: 700; text-align: center;
}

/* 重做 overlay */
.redo-modal { padding: 0; max-width: 480px; }
.redo-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border-bottom: 1.5px solid rgba(180, 140, 100, 0.2);
}
.redo-head h3 { margin: 0; font-size: 18px; color: #3a2818; flex: 1; }
.redo-tag { color: #fff; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; }
.redo-close { background: none; border: none; font-size: 18px; color: #7a6048; cursor: pointer; padding: 4px 8px; }
.redo-stage { padding: 16px 20px; min-height: 200px; }
.redo-foot { text-align: center; font-size: 11px; padding: 8px 20px 16px; }

/* AI 重练：加载态 + 结果页 */
.arena-spinner {
  display: inline-block;
  width: 11px; height: 11px;
  margin-right: 5px;
  vertical-align: -1px;
  border: 2px solid rgba(122, 62, 209, 0.3);
  border-top-color: #7a3ed1;
  border-radius: 50%;
  animation: arenaSpin 0.7s linear infinite;
}
@keyframes arenaSpin { to { transform: rotate(360deg); } }
.arena-btn.ai[data-busy='1'] { opacity: 0.75; cursor: progress; }

.ai-practice-modal { max-width: 520px; }
.ai-result { text-align: center; }
.ai-result-score { font-size: 26px; font-weight: 900; color: #3a2818; margin-bottom: 4px; }
.ai-result-tip { font-size: 13px; color: #7a6048; font-weight: 700; margin-bottom: 14px; }
.ai-result-list { display: flex; flex-direction: column; gap: 10px; text-align: left; max-height: 46vh; overflow-y: auto; }
.ai-result-item {
  border: 1.5px solid rgba(180, 140, 100, 0.25);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fffdf7;
}
.ai-result-item.ok { border-color: rgba(46, 204, 113, 0.5); background: rgba(46, 204, 113, 0.06); }
.ai-result-item.bad { border-color: rgba(231, 76, 60, 0.45); background: rgba(231, 76, 60, 0.05); }
.ari-head { font-size: 12px; font-weight: 800; color: #7a6048; margin-bottom: 4px; }
.ari-q { font-size: 14px; font-weight: 700; color: #3a2818; margin-bottom: 6px; }
.ari-ans { font-size: 13px; color: #3a2818; margin-bottom: 4px; }
.ari-ans b { color: #2ecc71; }
.ari-exp { font-size: 12px; color: #7a6048; line-height: 1.6; }
.ari-kps { margin-top: 6px; font-size: 11px; font-weight: 700; color: #7a3ed1; }

/* ============ 成就墙 ============ */
.feat-ach { padding-bottom: 16px; }
.ach-stats {
  text-align: center;
  padding: 14px 24px;
  font-size: 15px;
  color: #7a6048;
  font-weight: 700;
  border-bottom: 1px dashed rgba(180, 140, 100, 0.3);
}
.ach-stats b { color: #ef6c5b; font-size: 20px; }
.ach-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px 24px 24px;
  overflow-y: auto;
  max-height: 60vh;
}
.ach-card {
  text-align: center;
  padding: 16px 8px;
  border-radius: 16px;
  background: linear-gradient(160deg, #fff8eb 0%, #fef0d8 100%);
  border: 1.5px solid rgba(180, 140, 100, 0.3);
  transition: all 0.2s;
}
.ach-card.unlocked {
  background: linear-gradient(160deg, #fff8eb 0%, rgba(94, 234, 212, 0.2) 100%);
  border-color: #5eead4;
  box-shadow: 0 4px 12px rgba(94, 234, 212, 0.25);
  transform: translateY(-2px);
}
.ach-card.locked { opacity: 0.6; }
.ach-icon { font-size: 38px; margin-bottom: 6px; }
.ach-name { font-size: 14px; font-weight: 800; color: #3a2818; }
.ach-desc { font-size: 11px; color: #7a6048; margin-top: 4px; }
.ach-card.unlocked .ach-desc { color: #0d9488; font-weight: 800; }

/* 响应式 */
@media (max-width: 520px) {
  .feat-head h3 { font-size: 18px; }
  .lab-count { grid-template-columns: 1fr; }
  .room-items, .ach-grid { grid-template-columns: repeat(2, 1fr); }
  .arena-stats { padding: 12px 16px; }
}

/* ============ 实验室·通用：最大化按钮 + 最大化态 ============ */
.feat-head-tools { display: flex; align-items: center; gap: 6px; }
.feat-max {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 248, 235, 0.8);
  border: 1.5px solid rgba(94, 234, 212, 0.5);
  font-size: 16px;
  color: #7a6048;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.feat-max:hover { background: #fff; transform: translateY(-1px); }
.feat-modal.is-max {
  position: fixed;
  top: 16px; left: 16px; right: 16px; bottom: 16px;
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  z-index: 999;
  box-shadow: 0 20px 60px rgba(0,0,0,0.35);
  border-radius: 18px;
}

/* ============ 实验室·第 4 tab：图形拼搭器 ============ */
.sh-lab { padding: 4px 4px 12px; }
.sh-wrap {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  align-items: stretch;
  min-height: 480px;
}
.sh-shelf {
  background: linear-gradient(160deg, #fff8eb 0%, #fef0d8 100%);
  border: 1.5px solid rgba(180, 140, 100, 0.3);
  border-radius: 14px;
  padding: 10px 8px;
  overflow-y: auto;
  align-self: stretch;
  min-height: 480px;
}
.sh-shelf-title { font-size: 12px; font-weight: 800; color: #7a6048; text-align: center; margin-bottom: 8px; }
.sh-shelf-section { margin-bottom: 10px; }
.sh-shelf-h { font-size: 11px; font-weight: 800; color: #b07a3a; margin-bottom: 4px; padding-left: 2px; }
.sh-shelf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sh-tile {
  background: #fffaf0;
  border: 1.5px dashed rgba(180, 140, 100, 0.4);
  border-radius: 10px;
  padding: 4px;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  transition: transform .12s, background .12s;
}
.sh-tile:hover { background: #fff; transform: translateY(-1px); }
.sh-tile:active { cursor: grabbing; transform: translateY(0); }
.sh-tile svg { width: 100%; height: 100%; pointer-events: none; display: block; }

.sh-stage {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  min-height: 480px;
}
.sh-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: linear-gradient(160deg, #fff8eb 0%, #fef0d8 100%);
  border: 1.5px solid rgba(180, 140, 100, 0.3);
  border-radius: 12px;
  padding: 8px 10px;
}
.sh-tpls { display: flex; gap: 6px; }
.sh-tpl-pill {
  background: rgba(255, 248, 235, 0.7);
  border: 1.5px solid rgba(180, 140, 100, 0.3);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
  color: #7a6048;
  cursor: pointer;
  font-family: inherit;
  transition: all .15s;
}
.sh-tpl-pill:hover { background: #fff; }
.sh-tpl-pill.active {
  background: linear-gradient(160deg, #5eead4 0%, #34d399 100%);
  color: #fff;
  border-color: transparent;
}
.sh-stats { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #7a6048; font-weight: 700; }
.sh-stats b { color: #ef6c5b; font-weight: 900; font-size: 14px; }
.sh-clear { padding: 4px 10px !important; font-size: 12px !important; }

.sh-canvas {
  position: relative;
  background-color: #fffaf0;
  background-image:
    linear-gradient(rgba(180, 140, 100, 0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(180, 140, 100, 0.10) 1px, transparent 1px);
  background-size: 20px 20px;
  border: 1.5px solid rgba(180, 140, 100, 0.3);
  border-radius: 14px;
  overflow: hidden;
  min-height: 420px;
  user-select: none;
  touch-action: none;
}
.sh-tpl-layer { position: absolute; inset: 0; pointer-events: none; }
.sh-tpl-layer svg { width: 100%; height: 100%; }
.sh-piece-layer { position: absolute; inset: 0; }

.sh-piece {
  position: absolute;
  width: 100px;
  height: 100px;
  top: 0; left: 0;
  cursor: grab;
  user-select: none;
  touch-action: none;
  z-index: 5;
}
.sh-piece:active { cursor: grabbing; }
.sh-piece-inner {
  width: 100%; height: 100%;
  display: block;
  pointer-events: none;
}
.sh-piece-inner svg { width: 100%; height: 100%; display: block; }
.sh-piece.selected { z-index: 20; }
.sh-piece-actions {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 3px;
  background: #fff;
  border: 1.5px solid rgba(94, 234, 212, 0.7);
  border-radius: 8px;
  padding: 3px;
  z-index: 60;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}
.sh-piece-actions button {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(255, 248, 235, 0.7);
  border: 1px solid rgba(180, 140, 100, 0.3);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  display: grid;
  place-items: center;
  font-family: inherit;
}
.sh-piece-actions button:hover { background: #fff; }
.sh-piece-actions .act-del { background: linear-gradient(160deg, #ffe5e0 0%, #ffcfc6 100%); color: #b14a3a; }
.sh-ghost {
  position: absolute;
  width: 100px;
  height: 100px;
  pointer-events: none;
  opacity: 0.7;
  z-index: 50;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
}
.sh-hint {
  font-size: 11px;
  color: #7a6048;
  text-align: center;
  font-weight: 700;
  padding: 4px 0;
}

/* 响应式：图形拼搭器 */
@media (max-width: 720px) {
  .sh-wrap { grid-template-columns: 120px 1fr; min-height: 400px; }
  .sh-shelf { min-height: 400px; padding: 8px 6px; }
  .sh-canvas { min-height: 360px; }
}
@media (max-width: 520px) {
  .sh-wrap { grid-template-columns: 1fr; }
  .sh-shelf { min-height: auto; max-height: 180px; }
  .sh-canvas { min-height: 320px; }
}
