:root {
  color-scheme: dark;
  --ink: #f0ebe1;
  --muted: #9e988f;
  --dim: #716d66;
  --line: rgba(239, 230, 215, 0.13);
  --surface: rgba(22, 21, 19, 0.72);
  --amber: #cda568;
  --crystal: #82b9c2;
  --warm: #c69a5d;
  --soft: #aa8d95;
  --fluid: #769b8b;
  --grain: #a6a298;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #0e0e0d;
}

body {
  color: var(--ink);
  font-family: "Noto Sans SC", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  letter-spacing: 0;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 1px solid rgba(231, 217, 193, 0.76);
  outline-offset: 4px;
}

.lab {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 22% 27%, rgba(135, 91, 43, 0.13), transparent 33%),
    radial-gradient(circle at 72% 58%, rgba(47, 66, 66, 0.08), transparent 38%),
    linear-gradient(148deg, #171613 0%, #10100f 54%, #0c0d0d 100%);
  cursor: none;
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#material3d {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 260ms ease;
}

#material3d.is-visible {
  opacity: 1;
}

.topbar {
  position: absolute;
  z-index: 10;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: max(30px, env(safe-area-inset-top)) 38px 0;
  pointer-events: none;
}

.identity {
  min-width: 0;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--dim);
  font-family: "Segoe UI", sans-serif;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.18em;
}

.identity h1 {
  margin: 0;
  font-family: "STSong", "SimSun", serif;
  font-size: clamp(24px, 2.2vw, 34px);
  font-weight: 400;
  letter-spacing: 0.08em;
}

.material-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.category-mark {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
}

.category-crystal {
  border: 1px solid var(--crystal);
  border-radius: 50%;
}

.category-warm {
  border-radius: 50%;
  background: var(--warm);
}

.category-soft {
  width: 8px;
  height: 2px;
  border-radius: 0;
  background: var(--soft);
}

.category-fluid {
  width: 10px;
  background:
    radial-gradient(circle at 2px 50%, var(--fluid) 0 2px, transparent 2.2px),
    radial-gradient(circle at 8px 50%, var(--fluid) 0 2px, transparent 2.2px);
}

.category-grain {
  width: 11px;
  background:
    radial-gradient(circle at 1.5px 60%, var(--grain) 0 1.4px, transparent 1.6px),
    radial-gradient(circle at 5.5px 30%, var(--grain) 0 1.4px, transparent 1.6px),
    radial-gradient(circle at 9.5px 66%, var(--grain) 0 1.4px, transparent 1.6px);
}

.meta-separator {
  color: #595750;
}

.sound-controls {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  pointer-events: auto;
}

.volume-control {
  position: relative;
}

.mood-control {
  position: relative;
}

.icon-button {
  position: relative;
  display: inline-flex;
  width: 52px;
  height: 47px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #67645e;
  cursor: none;
  transition: color 220ms ease, background 220ms ease, border-color 220ms ease;
}

.icon-button:hover,
.icon-button.is-active {
  color: #c8c0b3;
}

.icon-button:hover {
  border-color: rgba(229, 216, 194, 0.08);
  background: rgba(255, 255, 255, 0.025);
}

.icon-button > span:last-child {
  font-size: 9px;
}

.control-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 16px;
}

.music-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.music-icon i {
  display: block;
  width: 1px;
  height: 6px;
  background: currentColor;
  animation: meter 1.7s ease-in-out infinite alternate;
}

.music-icon i:nth-child(2) {
  height: 12px;
  animation-delay: -0.7s;
}

.music-icon i:nth-child(3) {
  height: 8px;
  animation-delay: -1.2s;
}

.mood-icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.mood-icon i {
  display: block;
  height: 1px;
  background: currentColor;
}

.mood-icon i:nth-child(1) { width: 16px; }
.mood-icon i:nth-child(2) { width: 11px; }
.mood-icon i:nth-child(3) { width: 7px; }

.sound-icon i {
  position: absolute;
  top: 50%;
  left: 3px;
  width: 2px;
  border-radius: 50%;
  border: 1px solid currentColor;
  border-left: 0;
  transform: translateY(-50%);
}

.sound-icon i:nth-child(1) { height: 5px; }
.sound-icon i:nth-child(2) { height: 10px; width: 7px; }
.sound-icon i:nth-child(3) { height: 15px; width: 12px; }

.volume-icon::before {
  position: absolute;
  top: 5px;
  left: 1px;
  width: 5px;
  height: 6px;
  border: 1px solid currentColor;
  border-right: 0;
  content: "";
}

.volume-icon::after {
  position: absolute;
  top: 3px;
  left: 5px;
  width: 6px;
  height: 10px;
  background: currentColor;
  clip-path: polygon(0 35%, 100% 0, 100% 100%, 0 65%);
  content: "";
}

.volume-icon i {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 5px;
  height: 10px;
  border: 1px solid currentColor;
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-left: 0;
  border-radius: 0 50% 50% 0;
  transform: translateY(-50%);
}

.volume-icon i:nth-child(2) {
  left: 13px;
  width: 7px;
  height: 14px;
  opacity: .45;
}

.volume-panel {
  position: absolute;
  z-index: 20;
  top: 54px;
  right: -30px;
  width: 174px;
  padding: 12px 13px;
  border: 1px solid rgba(232, 218, 196, .13);
  border-radius: 4px;
  background: rgba(18, 18, 17, .94);
  box-shadow: 0 18px 35px rgba(0, 0, 0, .32);
  backdrop-filter: blur(12px);
}

.mood-menu {
  position: absolute;
  z-index: 21;
  top: 54px;
  right: -54px;
  width: 188px;
  padding: 6px;
  border: 1px solid rgba(232, 218, 196, .13);
  border-radius: 4px;
  background: rgba(18, 18, 17, .95);
  box-shadow: 0 18px 35px rgba(0, 0, 0, .32);
  backdrop-filter: blur(12px);
}

.mood-menu[hidden] {
  display: none;
}

.mood-option {
  display: grid;
  width: 100%;
  min-height: 42px;
  grid-template-columns: 10px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  padding: 7px 8px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #918a80;
  cursor: none;
  text-align: left;
}

.mood-option:hover,
.mood-option.is-selected {
  background: rgba(255, 255, 255, .035);
  color: #d7ccbd;
}

.mood-option i {
  width: 4px;
  height: 4px;
  grid-row: 1 / 3;
  border: 1px solid #b69372;
  border-radius: 50%;
}

.mood-option.is-selected i {
  background: #d8ad82;
  box-shadow: 0 0 8px rgba(216, 173, 130, .34);
}

.mood-option span {
  font-size: 10px;
}

.mood-option small {
  margin-top: 2px;
  color: #66615b;
  font-size: 8px;
}

.volume-panel[hidden] {
  display: none;
}

.volume-panel label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: #aaa298;
  font-size: 10px;
}

.volume-panel output {
  color: #d3c7b4;
  font-variant-numeric: tabular-nums;
}

.volume-panel input {
  width: 100%;
  height: 16px;
  margin: 0 0 10px;
  accent-color: #b99b6d;
  cursor: pointer;
}

.volume-panel input:last-child {
  margin-bottom: 0;
}

.headphone-icon {
  width: 15px;
  height: 12px;
  margin-top: 2px;
  border: 1px solid currentColor;
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
}

.headphone-icon::before,
.headphone-icon::after {
  position: absolute;
  bottom: -4px;
  width: 3px;
  height: 7px;
  border: 1px solid currentColor;
  border-radius: 2px;
  content: "";
}

.headphone-icon::before { left: -3px; }
.headphone-icon::after { right: -3px; }

@keyframes meter {
  to { transform: scaleY(0.42); }
}

.interaction-hint {
  position: absolute;
  z-index: 8;
  left: 50%;
  bottom: 132px;
  color: rgba(190, 182, 171, 0.54);
  font-size: 10px;
  letter-spacing: 0.12em;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity 600ms ease;
}

.interaction-hint.is-hidden {
  opacity: 0;
}

.special-experiment {
  position: absolute;
  z-index: 12;
  left: max(30px, calc(50% - 395px));
  top: calc(50% + 205px);
  width: min(290px, 28vw);
  pointer-events: auto;
  color: #cfc2b0;
}

.special-kicker {
  display: block;
  margin-bottom: 7px;
  color: #e0b896;
  font-size: 9px;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.special-experiment .special-action {
  width: 100%;
  min-height: 48px;
  padding: 9px 12px;
  border: 1px solid rgba(232, 190, 157, .26);
  border-radius: 6px;
  background: rgba(30, 27, 24, .68);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .18);
  color: #d6c5b3;
  cursor: none;
}

.special-experiment .special-action:hover,
.special-experiment .special-action.is-active {
  border-color: rgba(239, 177, 145, .7);
  background: rgba(45, 33, 29, .8);
  box-shadow: 0 0 24px rgba(222, 151, 124, .16), 0 8px 26px rgba(0, 0, 0, .2);
}

.special-experiment .special-action strong {
  color: #f0d3ba;
  font-size: 11px;
}

.special-experiment .special-action small {
  color: #a99a8d;
  font-size: 9px;
}

.special-mode-help {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 4px 8px;
  align-items: center;
  margin-top: 7px;
  color: #bcaea0;
  font-size: 9px;
}

.special-mode-help[hidden] {
  display: none;
}

.special-progress {
  grid-column: 1 / -1;
  color: #dfbf99;
  font-variant-numeric: tabular-nums;
}

.special-mode-help button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #a89585;
  font: inherit;
  cursor: none;
}

.special-mode-help button:hover {
  color: #f0d3ba;
}

.context-panel {
  position: absolute;
  z-index: 11;
  top: 43%;
  right: 38px;
  width: 174px;
  color: #827d75;
  pointer-events: auto;
  transform: translateY(-50%);
}

.action-guide {
  margin-bottom: 26px;
}

.action-guide p {
  margin: 0 0 8px;
  font-size: 10px;
  line-height: 1.55;
}

.context-label,
.brush-control label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #9b958c;
  font-size: 10px;
}

.soundscape-control {
  margin-bottom: 24px;
}

.special-control {
  margin-bottom: 22px;
}

.special-action {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border: 0;
  border-top: 1px solid rgba(232, 219, 199, .09);
  border-bottom: 1px solid rgba(232, 219, 199, .09);
  background: transparent;
  color: #bdb4a9;
  cursor: none;
  text-align: left;
}

.special-action strong,
.special-action small {
  display: block;
  font-weight: 400;
}

.special-action strong {
  color: #cfc2b0;
  font-size: 10px;
}

.special-action small {
  margin-top: 3px;
  color: #716c65;
  font-size: 8px;
}

.special-glyph {
  position: relative;
  display: block;
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  border: 1px solid rgba(206, 177, 156, .3);
  border-radius: 50%;
}

.special-glyph i {
  position: absolute;
  top: 8px;
  left: 4px;
  width: 10px;
  height: 1px;
  background: currentColor;
  opacity: .48;
  transform-origin: center;
}

.special-glyph i:nth-child(1) { transform: rotate(18deg); }
.special-glyph i:nth-child(2) { transform: rotate(82deg) scaleX(.72); }
.special-glyph i:nth-child(3) { transform: rotate(-42deg) scaleX(.58); }

.special-action:hover,
.special-action.is-active {
  color: #edcfb8;
}

.special-action.is-active .special-glyph {
  border-color: rgba(229, 180, 157, .68);
  box-shadow: 0 0 14px rgba(213, 158, 151, .16);
}

.soundscape-button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: #d0c5b5;
  cursor: none;
  font-size: 11px;
  text-align: left;
}

.soundscape-button > span:first-child {
  width: 12px;
  color: #e1bd86;
  font-size: 9px;
  text-align: center;
}

.soundscape-progress {
  position: relative;
  width: 100%;
  height: 1px;
  overflow: hidden;
  background: rgba(232, 219, 199, .11);
}

.soundscape-progress i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, rgba(221, 182, 127, .62), rgba(210, 163, 177, .58));
  transition: width 180ms linear;
}

.brush-control {
  margin-bottom: 21px;
}

.brush-control[hidden] {
  display: none;
}

.brush-control output {
  color: #c7bbab;
  font-variant-numeric: tabular-nums;
}

.brush-control input {
  width: 100%;
  height: 15px;
  margin: 0;
  accent-color: #bd9d71;
  cursor: pointer;
}

.reset-material {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: #aaa197;
  cursor: none;
  font-size: 10px;
}

.reset-material[hidden] {
  display: none;
}

.reset-material:hover,
.soundscape-button:hover {
  color: #eee2d0;
}

.soundscape-button.is-active {
  color: #ead7bc;
}

.soundscape-button.is-active > span:first-child {
  color: #e4b9c2;
  text-shadow: 0 0 8px rgba(228, 185, 194, .28);
}

.sleep-control {
  margin-bottom: 24px;
}

.sleep-button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 5px 0 6px;
  border: 0;
  background: transparent;
  color: #bdb4a9;
  cursor: none;
  text-align: left;
}

.sleep-button strong,
.sleep-button small {
  display: block;
  font-weight: 400;
}

.sleep-button strong {
  color: #cbc0b1;
  font-size: 11px;
}

.sleep-button small {
  margin-top: 3px;
  color: #777169;
  font-size: 9px;
}

.sleep-orbit {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border: 1px solid rgba(218, 185, 170, .3);
  border-radius: 50%;
}

.sleep-orbit::before,
.sleep-orbit::after,
.sleep-orbit i {
  position: absolute;
  display: block;
  border-radius: 50%;
  content: "";
}

.sleep-orbit::before {
  top: 3px;
  left: 4px;
  width: 4px;
  height: 4px;
  background: #d9b7a8;
  opacity: .65;
}

.sleep-orbit::after {
  right: 3px;
  bottom: 3px;
  width: 3px;
  height: 3px;
  background: #a9c7bd;
  opacity: .7;
}

.sleep-orbit i:nth-child(1) {
  top: 1px;
  right: 2px;
  width: 2px;
  height: 2px;
  background: #e4cca3;
}

.sleep-orbit i:nth-child(2) {
  bottom: 2px;
  left: 2px;
  width: 2px;
  height: 2px;
  background: #d9b2c2;
}

.sleep-orbit i:nth-child(3) {
  top: 7px;
  left: 7px;
  width: 3px;
  height: 3px;
  background: #e8d9c2;
  opacity: .45;
}

.sleep-progress {
  position: relative;
  width: 100%;
  height: 2px;
  overflow: hidden;
  background: rgba(232, 219, 199, .08);
}

.sleep-action-state {
  display: flex;
  min-height: 22px;
  align-items: center;
  gap: 7px;
  margin: 1px 0 6px 28px;
  color: rgba(205, 194, 181, .7);
  font-size: 9px;
  transition: opacity 240ms ease;
}

.sleep-action-state[hidden] {
  display: none;
}

.sleep-action-dot {
  width: 4px;
  height: 4px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #d9b4bf;
  box-shadow: 0 0 9px rgba(217, 180, 191, .5);
  animation: sleep-action-breathe 1.8s ease-in-out infinite;
}

@keyframes sleep-action-breathe {
  50% { opacity: .35; transform: scale(.7); }
}

.sleep-progress i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, rgba(182, 151, 177, .7), rgba(164, 193, 175, .72));
  transition: width 240ms linear;
}

.sleep-button:hover,
.sleep-control.is-active .sleep-button {
  color: #ead6c7;
}

.sleep-control.is-active .sleep-orbit {
  border-color: rgba(218, 185, 170, .65);
  box-shadow: 0 0 15px rgba(193, 156, 183, .18);
}

.lab.soundscape-active .material-dock {
  opacity: .48;
  transition: opacity 350ms ease;
}

.lab.soundscape-active .material-dock:hover,
.lab.soundscape-active .material-dock:focus-within {
  opacity: 1;
}

.lab.sleep-active .material-dock {
  opacity: .4;
  transition: opacity 350ms ease;
}

.lab.sleep-active .material-dock:hover,
.lab.sleep-active .material-dock:focus-within {
  opacity: 1;
}

.sleep-next {
  position: absolute;
  z-index: 14;
  top: 0;
  left: 50%;
  display: inline-flex;
  min-width: 118px;
  height: 30px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 4px;
  border: 0;
  border-bottom: 1px solid rgba(225, 202, 174, .18);
  background: transparent;
  color: rgba(218, 207, 192, .72);
  cursor: none;
  font-size: 10px;
  transform: translateX(-50%);
  transition: color 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

.sleep-next[hidden] {
  display: none;
}

.sleep-next:hover {
  border-color: rgba(231, 203, 172, .42);
  color: #eee0cc;
}

.material-dock {
  position: absolute;
  z-index: 12;
  bottom: max(26px, env(safe-area-inset-bottom));
  left: 50%;
  display: grid;
  width: min(760px, calc(100% - 56px));
  height: 76px;
  grid-template-columns: 32px minmax(0, 1fr) 32px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(17, 17, 16, 0.6);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.material-rail {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 0 6px;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.material-rail::-webkit-scrollbar {
  display: none;
}

.material-item {
  position: relative;
  display: flex;
  width: 72px;
  min-width: 72px;
  height: 52px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  cursor: none;
}

.material-swatch {
  position: relative;
  display: block;
  width: 42px;
  height: 27px;
  overflow: hidden;
  border: 1px solid rgba(238, 229, 213, 0.11);
  border-radius: 2px;
  background: var(--swatch, #4e4d49);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.28);
  opacity: 0.58;
  transform: translateY(2px) scale(0.9);
  transition: width 280ms cubic-bezier(.2,.8,.2,1), height 280ms cubic-bezier(.2,.8,.2,1), opacity 220ms ease, transform 280ms cubic-bezier(.2,.8,.2,1), border-color 220ms ease;
}

.material-swatch::before {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,.18), transparent 42%, rgba(0,0,0,.18));
  content: "";
}

.material-item:hover .material-swatch {
  opacity: 0.84;
}

.material-item[aria-selected="true"] .material-swatch {
  width: 49px;
  height: 34px;
  border-color: rgba(236, 218, 190, 0.25);
  opacity: 1;
  transform: translateY(-5px) scale(1);
}

.dock-category {
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--dot, #999);
  opacity: 0.62;
  transform: translateX(-50%);
  transition: width 240ms ease, opacity 240ms ease;
}

.material-item[aria-selected="true"] .dock-category {
  width: 18px;
  height: 2px;
  border-radius: 0;
  opacity: 1;
}

.material-tooltip {
  position: absolute;
  z-index: 5;
  bottom: 86px;
  left: 50%;
  min-width: max-content;
  padding: 6px 9px;
  border: 1px solid rgba(230, 218, 199, .12);
  border-radius: 3px;
  background: rgba(17, 17, 16, .9);
  color: #d3cabe;
  font-size: 10px;
  letter-spacing: .04em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 5px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.material-tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.dock-arrow {
  width: 32px;
  height: 48px;
  border: 0;
  background: transparent;
  color: #747069;
  cursor: none;
  font-family: Georgia, serif;
  font-size: 26px;
  transition: color 200ms ease;
}

.dock-arrow:hover {
  color: #d1c7b7;
}

.touch-lens {
  --lens-scale-x: 1;
  --lens-scale-y: 1;
  --cursor-size: 22px;
  --brush-preview-size: 48px;
  --brush-preview-color: rgba(239, 205, 170, .58);
  position: fixed;
  z-index: 30;
  top: 0;
  left: 0;
  width: var(--cursor-size);
  height: var(--cursor-size);
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(248, 217, 190, .34) 0, rgba(239, 190, 207, .24) 27%, rgba(231, 188, 207, .09) 52%, rgba(231, 188, 207, 0) 74%);
  box-shadow: none;
  filter: blur(1.5px);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%) scale(var(--lens-scale-x), var(--lens-scale-y));
  transition: opacity 140ms ease, transform 160ms ease;
}

.touch-lens::before {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: var(--brush-preview-size);
  height: var(--brush-preview-size);
  border: 1px solid var(--brush-preview-color);
  border-radius: 50%;
  box-shadow: 0 0 13px rgba(235, 196, 181, .12), inset 0 0 10px rgba(241, 215, 170, .06);
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.84);
}

.touch-lens::after {
  display: none;
}

.touch-lens.is-visible {
  opacity: 1;
}

.touch-lens.is-ui {
  width: var(--cursor-size);
  height: var(--cursor-size);
  background: radial-gradient(circle, rgba(244, 214, 188, .3) 0, rgba(235, 188, 204, .2) 31%, rgba(235, 188, 204, 0) 73%);
  box-shadow: none;
}

.touch-lens.is-contact {
  --lens-scale-x: .84;
  --lens-scale-y: .84;
  opacity: .76;
  box-shadow: none;
}

.touch-lens.is-grab {
  width: var(--cursor-size);
  height: var(--cursor-size);
  background: radial-gradient(circle, rgba(244, 211, 184, .28) 0, rgba(232, 185, 204, .2) 32%, rgba(232, 185, 204, 0) 74%);
  box-shadow: none;
}

.touch-lens.lens-crystal,
.touch-lens.lens-warm,
.touch-lens.lens-soft,
.touch-lens.lens-fluid,
.touch-lens.lens-grain { background-color: transparent; }

.touch-lens.lens-crystal { --brush-preview-color: rgba(208, 236, 234, .6); }
.touch-lens.lens-warm { --brush-preview-color: rgba(235, 196, 135, .58); }
.touch-lens.lens-soft { --brush-preview-color: rgba(225, 185, 199, .58); }
.touch-lens.lens-fluid { --brush-preview-color: rgba(177, 221, 207, .58); }
.touch-lens.lens-grain { --brush-preview-color: rgba(208, 198, 178, .52); }

.touch-lens.is-brush-preview::before {
  animation: brush-preview 1.6s ease-out both;
}

@keyframes brush-preview {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.72); }
  18% { opacity: .8; transform: translate(-50%, -50%) scale(1); }
  72% { opacity: .46; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.06); }
}

.lens-center {
  display: none;
}

.sound-gate {
  position: absolute;
  z-index: 50;
  inset: 0;
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: rgba(11, 11, 10, 0.82);
  color: var(--ink);
  cursor: pointer;
  transition: opacity 900ms ease, visibility 900ms ease;
}

.sound-gate.is-open {
  visibility: hidden;
  opacity: 0;
}

.gate-orbit {
  position: relative;
  width: 58px;
  height: 58px;
  margin-bottom: 18px;
  border: 1px solid rgba(213, 187, 145, 0.28);
  border-radius: 50%;
  box-shadow: inset 5px 5px 15px rgba(127, 167, 169, 0.07);
}

.gate-orbit::after {
  position: absolute;
  top: 9px;
  left: 11px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(207, 171, 113, 0.68);
  box-shadow: 0 0 14px rgba(207, 171, 113, 0.35);
  content: "";
}

.gate-title {
  font-family: "STSong", "SimSun", serif;
  font-size: 20px;
  letter-spacing: .12em;
}

.gate-subtitle {
  color: var(--dim);
  font-size: 10px;
  letter-spacing: .18em;
}

.gate-headphone {
  margin-top: 5px;
  color: #8d867d;
  font-size: 9px;
  letter-spacing: .12em;
}

.vignette {
  position: absolute;
  z-index: 5;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(0,0,0,.24) 100%);
  pointer-events: none;
}

@media (max-width: 700px) {
  .lab {
    min-height: 520px;
  }

  .topbar {
    padding: max(22px, env(safe-area-inset-top)) 20px 0;
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 9px;
  }

  .identity h1 {
    font-size: 24px;
  }

  .material-meta {
    margin-top: 7px;
    font-size: 10px;
  }

  .sound-controls {
    gap: 1px;
  }

  .icon-button {
    width: 40px;
  }

  .icon-button > span:last-child {
    display: none;
  }

  .material-dock {
    bottom: max(16px, env(safe-area-inset-bottom));
    width: calc(100% - 24px);
    height: 68px;
    grid-template-columns: 26px minmax(0, 1fr) 26px;
  }

  .material-item {
    width: 61px;
    min-width: 61px;
  }

  .material-swatch {
    width: 38px;
    height: 24px;
  }

  .material-item[aria-selected="true"] .material-swatch {
    width: 44px;
    height: 31px;
  }

  .interaction-hint {
    display: none;
    white-space: nowrap;
  }

  .context-panel {
    top: auto;
    right: 18px;
    bottom: 96px;
    left: 18px;
    display: grid;
    width: auto;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: flex-end;
    gap: 10px 18px;
    transform: none;
  }

  .special-experiment {
    top: auto;
    right: 18px;
    bottom: 202px;
    left: 18px;
    width: auto;
  }

  .action-guide {
    display: none;
  }

  .soundscape-control,
  .brush-control,
  .special-control {
    width: auto;
    margin-bottom: 0;
  }

  .special-control {
    grid-column: 1 / -1;
  }

  .special-action {
    min-height: 36px;
  }

  .special-mode-help {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 3px 6px;
    margin-top: 4px;
    font-size: 8px;
  }

  .special-mode-help .special-progress {
    grid-column: 1;
  }

  .sleep-control {
    width: min(100%, 240px);
    margin-bottom: 0;
    grid-column: 1 / -1;
  }

  .mood-menu {
    right: -72px;
  }

  .sleep-button strong {
    font-size: 10px;
  }

  .reset-material {
    flex: 0 0 auto;
  }
}

@media (pointer: coarse) {
  .lab,
  .icon-button,
  .material-item,
  .dock-arrow {
    cursor: default;
  }

  .touch-lens {
    display: none;
  }
}

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