/* 深山矿语 · 设计系统 */
:root {
  --bg: #16110b;
  --panel: #221a11;
  --panel-2: #2b2115;
  --line: rgba(255, 240, 210, 0.09);
  --text: #f0e7d6;
  --muted: #a3937c;
  --accent: #e0a33c;
  --accent-soft: rgba(224, 163, 60, 0.14);
  --cyan: #5ad0e6;
  --danger: #e06a4c;
  --radius: 18px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

[v-cloak] { display: none; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(224, 163, 60, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.i { width: 20px; height: 20px; flex: none; }

/* ---------- 通用组件 ---------- */
.glass {
  background: rgba(34, 26, 17, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--shadow);
}

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  font: 600 14px/1 inherit;
  font-family: inherit;
  padding: 11px 18px;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s, border-color 0.2s, opacity 0.2s;
}
.btn:hover:not(:disabled) { border-color: rgba(224, 163, 60, 0.5); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #241703;
}
.btn.primary:hover:not(:disabled) { background: #eeb254; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.big { width: 100%; padding: 15px; font-size: 16px; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s var(--ease);
}
.icon-btn:hover { border-color: rgba(224, 163, 60, 0.5); }
.icon-btn:active { transform: scale(0.94); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: 0.02em; }
.brand .i { color: var(--accent); width: 22px; height: 22px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.money-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

/* ---------- 场景布局 ---------- */
.scene {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 80px;
  display: grid;
  gap: 22px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  animation: rise 0.55s var(--ease) both;
}
.panel h2 { font-size: 19px; margin-bottom: 18px; letter-spacing: 0.01em; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- 小镇 hero ---------- */
.hero { display: grid; grid-template-columns: 1fr 1.25fr; gap: 30px; align-items: start; }
.eyebrow { color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: 0.14em; margin-bottom: 10px; }
.hero-copy h1 { font-size: clamp(30px, 4.4vw, 44px); line-height: 1.18; letter-spacing: -0.02em; margin-bottom: 14px; }
.lead { color: var(--muted); line-height: 1.8; max-width: 34ch; }

.mine-list { display: grid; gap: 12px; }
.mine-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  background: var(--panel-2);
  transition: border-color 0.2s, transform 0.2s var(--ease);
}
.mine-card:hover { border-color: rgba(224, 163, 60, 0.45); transform: translateY(-2px); }
.mine-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.mine-head h3 { font-size: 16px; }
.fee { color: var(--accent); font-size: 13px; font-weight: 700; }
.ore-preview { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ore-dot { width: 24px; height: 24px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,.45)); }
.mine-desc { color: var(--muted); font-size: 13px; margin-bottom: 12px; line-height: 1.6; }

/* ---------- 商店 ---------- */
.shop-rows { display: grid; gap: 12px; }
.shop-row {
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px;
  background: var(--panel-2);
}
.shop-icon {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.shop-icon svg { width: 24px; height: 24px; }
.shop-img { width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.shop-info { flex: 1; min-width: 0; }
.shop-name { font-weight: 700; margin-bottom: 3px; }
.lv { color: var(--cyan); font-size: 12px; margin-left: 8px; }
.shop-next { color: var(--muted); font-size: 13px; }
.shop-next.muted { color: var(--cyan); }

.records { display: flex; flex-wrap: wrap; gap: 12px; }
.record {
  flex: 1; min-width: 130px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--panel-2);
  display: flex; align-items: baseline; justify-content: space-between;
}
.record span { color: var(--muted); font-size: 13px; }
.record b { font-size: 18px; }
.record.king b { color: var(--accent); }
.king-hint { color: var(--muted); font-size: 13px; margin-top: 14px; }

/* ---------- 矿石陈列室 ---------- */
.museum-sub { color: var(--muted); font-size: 13px; line-height: 1.7; margin: -10px 0 18px; }
.museum-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; margin-bottom: 24px; }
.m-card {
  position: relative;
  display: flex; gap: 14px; align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  background: var(--panel-2);
  opacity: 0.5;
  cursor: default;
  transition: opacity 0.35s, border-color 0.35s, box-shadow 0.35s, transform 0.2s var(--ease);
}
.m-card.found { cursor: pointer; }
.m-card.found:not(.show-active):hover { transform: translateY(-2px); border-color: rgba(224, 163, 60, 0.45); box-shadow: 0 10px 24px rgba(0,0,0,0.4); }
.m-card.found:active { transform: translateY(0) scale(0.98); }
.m-card:not(.found):hover { animation: shake 0.4s; border-color: rgba(255, 240, 210, 0.18); }
@keyframes shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-3px);} 75%{transform:translateX(3px);} }
.m-card.found { opacity: 1; }
.m-card.rare { border-color: rgba(90, 208, 230, 0.45); box-shadow: 0 0 18px rgba(90, 208, 230, 0.12); }
.m-icon {
  width: 54px; height: 54px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--line);
}
.m-icon img, .m-icon svg { width: 40px; height: 40px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
.m-card:not(.found) .m-icon img, .m-card:not(.found) .m-icon svg { filter: grayscale(1) brightness(.35); }
.m-body { flex: 1; min-width: 0; }
.m-body h3 { font-size: 15px; margin-bottom: 6px; letter-spacing: 0.01em; }
.m-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.m-tags span {
  font-size: 11px; font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}
.m-tags span:last-child { color: var(--accent); border-color: rgba(224, 163, 60, 0.35); }
.m-fact { color: var(--muted); font-size: 12.5px; line-height: 1.75; }
.m-fact.locked { color: rgba(163, 147, 124, 0.55); font-style: italic; }
.m-formula {
  display: inline-block; margin: 4px 0 6px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: 12.5px; letter-spacing: 0.02em;
  color: #f0e4c2; background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(224, 163, 60, 0.4);
  border-radius: 6px; padding: 2px 8px;
}
.m-formula b { font-weight: 600; }
.m-count { position: absolute; top: 10px; right: 12px; color: var(--accent); font-size: 12px; font-weight: 700; }
.ore-gem { width: 40px; height: 40px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0,0,0,.45)); }
.dex-val { color: var(--accent); font-size: 12px; font-weight: 700; }

/* ---------- 矿洞 ---------- */
.cave {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cave-hud {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px;
  border-left: 0; border-right: 0; border-top: 0;
  border-radius: 0;
  z-index: 5;
}
.hud-block { display: flex; align-items: center; gap: 8px; color: var(--accent); }
.bar { width: 130px; height: 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.5); overflow: hidden; border: 1px solid var(--line); }
.bar.light i { display: block; height: 100%; background: linear-gradient(90deg, #c96f2f, #ffd97a); border-radius: inherit; transition: width 0.3s linear; }
.hud-mid { flex: 1; display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.hud-mid strong { color: var(--text); }
.hud-mid b { color: var(--accent); }
.haste-chip {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(120, 220, 160, 0.5);
  background: rgba(120, 220, 160, 0.1);
  color: #9ae8b8;
  font-size: 12px;
  animation: hastePulse 1s ease-in-out infinite;
}
@keyframes hastePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.sep { width: 1px; height: 14px; background: var(--line); }

.cave-wrap { flex: 1; min-height: 0; position: relative; }
.cave-wrap canvas { width: 100%; height: 100%; display: block; touch-action: none; }

.key-hint {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  color: rgba(240, 231, 214, 0.55);
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
}

/* 洞中生物图鉴（左下角） */
.critter-legend {
  position: fixed; left: 16px; bottom: 14px; z-index: 20;
  display: grid; gap: 4px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(20, 14, 8, 0.55);
  backdrop-filter: blur(6px);
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
  max-width: 178px;
}
.critter-legend .legend-title {
  font-size: 10px; letter-spacing: 0.12em;
  color: rgba(240, 231, 214, 0.45);
}
.critter-legend span { display: flex; align-items: center; gap: 6px; }
.critter-legend i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.critter-legend .bad { color: #ff9d85; }
.critter-legend .good { color: #9ae8b8; }

/* 虚拟方向键 */
.dpad {
  position: fixed; right: 22px; bottom: 30px; z-index: 10;
  display: grid;
  grid-template-columns: repeat(3, 54px);
  grid-template-rows: repeat(3, 54px);
  gap: 4px;
}
.dp {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(34, 26, 17, 0.8);
  backdrop-filter: blur(8px);
  color: var(--text);
  display: grid; place-items: center;
  touch-action: none;
}
.dp svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.dp:active { background: var(--accent-soft); border-color: var(--accent); }
.dp.up { grid-area: 1 / 2; }
.dp.left { grid-area: 2 / 1; }
.dp.right { grid-area: 2 / 3; }
.dp.down { grid-area: 3 / 2; }

/* toast */
.cave-toasts {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  z-index: 30;
  display: grid; gap: 8px;
  justify-items: center;
  pointer-events: none;
  width: min(90vw, 460px);
}
.toast {
  padding: 10px 18px;
  border-radius: 12px;
  background: rgba(20, 14, 8, 0.9);
  border: 1px solid var(--line);
  font-size: 14px;
  text-align: center;
  backdrop-filter: blur(8px);
}
.toast.warn { border-color: rgba(224, 163, 60, 0.55); color: #ffd97a; }
.toast.rare { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 24px rgba(90, 208, 230, 0.25); }
.toast.danger { border-color: var(--danger); color: #ff9d85; }
.toast.good { border-color: rgba(120, 220, 160, 0.55); color: #9ae8b8; box-shadow: 0 0 22px rgba(120, 220, 160, 0.2); }
.toast-enter-active, .toast-leave-active { transition: all 0.35s var(--ease); }
.toast-enter-from { opacity: 0; transform: translateY(-10px); }
.toast-leave-to { opacity: 0; transform: translateY(-6px); }

/* ---------- 结算 ---------- */
.result-panel { max-width: 620px; margin: 40px auto 0; text-align: center; }
.result-head h1 { font-size: clamp(26px, 4vw, 36px); margin-bottom: 10px; }
.result-head.blackout h1 { color: var(--danger); }
.result-head.critter h1 { color: #ff9d85; }
.result-head p { color: var(--muted); margin-bottom: 22px; }
.loot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 22px; }
.loot-item {
  display: grid; justify-items: center; gap: 4px;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 10px; background: var(--panel-2);
  animation: rise 0.5s var(--ease) both;
}
.loot-item b { font-size: 14px; }
.loot-item span { color: var(--muted); font-size: 13px; }
.empty-loot { color: var(--muted); margin-bottom: 22px; }
.result-total {
  display: flex; align-items: baseline; justify-content: center; gap: 14px;
  margin-bottom: 26px;
  padding: 16px;
  border-radius: 14px;
  background: var(--accent-soft);
}
.result-total span { color: var(--muted); }
.result-total b { font-size: 30px; color: var(--accent); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 7, 4, 0.6);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 20px;
}
.modal {
  max-width: 480px; width: 100%;
  border-radius: 20px;
  padding: 28px;
}
.modal h2 { margin-bottom: 16px; }
.help-list { margin: 0 0 22px 18px; display: grid; gap: 10px; color: var(--muted); line-height: 1.7; font-size: 14px; }
.help-list b { color: var(--text); }
.fade-enter-active, .fade-leave-active { transition: opacity 0.25s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

/* ---------- 陈列室 canvas 展示（锚定在被点击的矿石上） ---------- */
.m-card.show-active {
  z-index: 5;
  transform: scale(1.05);
  border-color: var(--ore);
  box-shadow: 0 0 26px var(--ore), 0 14px 30px rgba(0, 0, 0, 0.5);
}
.m-card.show-active .m-icon {
  opacity: 0;             /* 由英雄元素接管矿石本体 */
  transition: opacity 0.2s;
}
.m-card.found.g1 { border-color: rgba(90, 208, 230, 0.4); }
.m-card.found.g2 { border-color: rgba(245, 205, 90, 0.5); box-shadow: 0 0 18px rgba(245, 205, 90, 0.14); }

/* 卡片左上角稀有度角标 */
.m-grade {
  position: absolute; top: 10px; left: 12px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  padding: 2px 7px; border-radius: 999px;
}
.m-grade.g1 { color: var(--cyan); border: 1px solid rgba(90, 208, 230, 0.45); background: rgba(90, 208, 230, 0.08); }
.m-grade.g2 { color: #f5cd5a; border: 1px solid rgba(245, 205, 90, 0.55); background: rgba(245, 205, 90, 0.1); box-shadow: 0 0 10px rgba(245, 205, 90, 0.25); }

.show-layer { position: fixed; inset: 0; z-index: 100; pointer-events: none; overflow: hidden; }
.show-catch { position: absolute; inset: 0; pointer-events: auto; background: transparent; }
.show-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* 矿石英雄元素：从卡片图标位置弹出、持续摇摆浮起 */
.show-hero { position: fixed; z-index: 1; pointer-events: none; }
.show-hero-in { transform: translate(-50%, -50%); animation: heroIn 0.72s var(--ease) both; }
.show-hero-sw { animation: heroSway 3s ease-in-out 0.72s infinite; }
.show-hero img, .show-hero svg { display: block; width: 92px; height: 92px; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)); }
.show-hero-sw.g1 img, .show-hero-sw.g1 svg { filter: drop-shadow(0 0 16px rgba(120, 220, 255, 0.7)) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)); }
.show-hero-sw.g2 img, .show-hero-sw.g2 svg { filter: drop-shadow(0 0 22px rgba(255, 205, 80, 0.85)) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)); }
@keyframes heroIn {
  0% { transform: translate(-50%, -50%) scale(0.3) rotate(-14deg); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.16) rotate(6deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}
@keyframes heroSway {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-5px) rotate(3deg); }
}

.show-pop {
  position: fixed; z-index: 2; pointer-events: auto;
  width: min(330px, 88vw);
  padding: 20px 22px 18px;
  text-align: center;
  border-radius: 16px;
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.55);
}
.show-pop > * { animation: riseIn 0.5s var(--ease) both; }
.show-pop h2 { font-size: 20px; margin-bottom: 10px; letter-spacing: 0.02em; animation-delay: 0.08s; }
.show-pop .m-tags { justify-content: center; animation-delay: 0.16s; }
.show-fact { margin: 12px 0 8px; line-height: 1.8; color: var(--text); font-size: 13.5px; animation-delay: 0.24s; }
.show-formula {
  display: inline-block; margin: 2px 0 10px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: 14px; letter-spacing: 0.02em;
  color: #f0e4c2; background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(224, 163, 60, 0.4);
  border-radius: 6px; padding: 3px 10px;
  animation-delay: 0.2s;
}
.show-formula b { font-weight: 600; }
.show-count { color: var(--accent); margin-bottom: 14px; font-weight: 700; letter-spacing: 0.04em; animation-delay: 0.32s; }
.show-pop .btn { animation-delay: 0.4s; }
.show-badge {
  display: inline-block; margin-bottom: 8px; animation-delay: 0.02s;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 10px; border-radius: 999px;
}
.show-badge.g1 { color: var(--cyan); border: 1px solid rgba(90, 208, 230, 0.5); background: rgba(90, 208, 230, 0.1); }
.show-badge.g2 { color: #f5cd5a; border: 1px solid rgba(245, 205, 90, 0.6); background: rgba(245, 205, 90, 0.12); box-shadow: 0 0 14px rgba(245, 205, 90, 0.3); }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.show-enter-active, .show-leave-active { transition: opacity 0.3s; }
.show-enter-from, .show-leave-to { opacity: 0; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .scene { padding: 18px 14px 60px; }
  .panel { padding: 20px; }
  .key-hint { display: none; }
  .bar { width: 90px; }
  .hud-mid .sep:nth-of-type(2) { display: none; }
  .critter-legend { left: 8px; bottom: 8px; padding: 7px 10px; font-size: 11px; max-width: 134px; }
  .critter-legend .legend-title { display: none; }
}
@media (pointer: coarse) {
  .key-hint { display: none; }
}

/* ---------- 石英晶体观察窗口 ---------- */
.show-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.show-pop:has(.show-actions .btn:nth-child(2)) { max-height: calc(100dvh - 24px); overflow-y: auto; }
.m-card:focus-visible, .show-actions .btn:focus-visible,
.crystal-dialog :is(button, a, summary, iframe):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.crystal-dialog {
  margin: auto; padding: 0; width: min(1040px, calc(100vw - 48px));
  max-width: none; max-height: calc(100dvh - 48px);
  color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--muted) var(--panel);
}
.crystal-dialog::backdrop { background: rgba(8, 5, 3, 0.82); }
.crystal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 26px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2; background: var(--panel);
}
.crystal-head .eyebrow { margin: 0 0 6px; font-size: 11px; }
.crystal-head h2 { font-size: 24px; font-weight: 700; }
.crystal-head h2 span { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 10px; }
.crystal-head .btn { flex: none; min-height: 44px; }
.crystal-body { display: grid; grid-template-columns: minmax(0, 1fr) 270px; }
.crystal-observe { min-width: 0; padding: 20px; border-right: 1px solid var(--line); }
.crystal-stage {
  position: relative; height: clamp(280px, 48dvh, 440px);
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.crystal-stage iframe { display: block; width: 100%; height: 100%; border: 0; }
.crystal-stage-label { position: absolute; left: 16px; bottom: 14px; font-size: 11px; color: var(--muted); pointer-events: none; }
.crystal-status {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 24px;
  text-align: center; background: var(--bg); font-size: 14px;
}
.crystal-status span { color: var(--muted); line-height: 1.7; }
.crystal-hint { margin: 12px 0; font-size: 12px; line-height: 1.7; color: var(--muted); }
.crystal-controls, .crystal-control-group { display: flex; flex-wrap: wrap; gap: 6px; }
.crystal-controls { gap: 10px; }
.crystal-controls .btn { min-width: 44px; min-height: 44px; padding: 10px 12px; }
.crystal-controls .btn[aria-pressed="true"] { border-color: var(--cyan); color: var(--cyan); }
.crystal-notes { padding: 24px; font-size: 14px; line-height: 1.7; }
.crystal-notes h3 { font-size: 16px; margin-bottom: 20px; }
.crystal-model-name { margin-bottom: 16px; }
.crystal-model-note { margin: 16px 0; padding-left: 12px; border-left: 2px solid var(--accent); color: var(--text); }
.crystal-legend { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.crystal-legend span { display: flex; align-items: center; gap: 8px; }
.crystal-legend i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.crystal-legend .silicon { background: var(--accent); }
.crystal-legend .oxygen { background: var(--danger); }
.crystal-ratio { margin: 24px 0; padding-top: 20px; border-top: 1px solid var(--line); }
.crystal-ratio b { display: block; font-size: 32px; line-height: 1.2; color: var(--accent); margin-bottom: 8px; }
.crystal-small, .crystal-source { font-size: 12px; color: var(--muted); }
.crystal-small + .crystal-small { margin-top: 10px; }
.crystal-source { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.crystal-source summary { cursor: pointer; color: var(--text); min-height: 32px; }
.crystal-source p { margin: 8px 0; }
.crystal-source a { display: inline-block; padding: 8px 0; margin-right: 12px; color: var(--cyan); }
@media (max-width: 700px) {
  .crystal-dialog { width: 100%; height: 100dvh; max-height: 100dvh; border: 0; border-radius: 0; }
  .crystal-head { padding: max(16px, env(safe-area-inset-top)) 16px 16px; }
  .crystal-body { grid-template-columns: minmax(0, 1fr); }
  .crystal-observe { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; }
  .crystal-stage { height: clamp(240px, 40dvh, 380px); }
  .crystal-notes { padding: 22px 20px max(22px, env(safe-area-inset-bottom)); }
  .crystal-legend { flex-direction: row; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
  .crystal-notes h3 { margin-bottom: 14px; }
}
