@font-face {
  font-family: "Playfair Display";
  src: url("./playfair-display-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  --cream: #f5efe4;
  --cream-deep: #eee5d6;
  --ink: #1f1b17;
  --ink-soft: #5f574d;
  --ink-faint: #958b7c;
  --hairline: rgba(51, 40, 30, 0.12);
  --glass: rgba(255, 252, 246, 0.66);
  --serif-cn: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
  --sans: "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
  --softness: 62%;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

html {
  background: var(--cream);
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 55% 46%, rgba(255, 253, 247, 0.92) 0%, rgba(255, 253, 247, 0) 34%),
    radial-gradient(130% 90% at 5% 0%, rgba(255, 255, 255, 0.66) 0%, rgba(255, 255, 255, 0) 46%),
    radial-gradient(100% 100% at 92% 100%, rgba(226, 207, 181, 0.42) 0%, rgba(226, 207, 181, 0) 58%),
    linear-gradient(145deg, #f8f3e9 0%, #f4ede0 52%, #efe5d4 100%);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(58% 46% at 50% 55%, rgba(255, 255, 255, 0) 42%, rgba(87, 59, 38, 0.035) 100%),
    radial-gradient(40% 30% at 50% 62%, rgba(255, 245, 223, 0.38), transparent 72%);
}

.app {
  position: relative;
  z-index: 3;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  isolation: isolate;
}

.grain {
  position: fixed;
  inset: -20%;
  z-index: 8;
  pointer-events: none;
  opacity: 0.16;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.2'/%3E%3C/svg%3E");
  background-size: 190px 190px;
}

#stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  cursor: default;
}

.action-key-hint {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 10;
  display: none;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid rgba(75, 59, 40, 0.12);
  border-radius: 999px;
  background: rgba(255, 251, 243, 0.76);
  color: #81715e;
  font: 11px/1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0.03em;
  transform: translateX(-50%);
  pointer-events: none;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.action-key-hint kbd {
  display: grid;
  min-width: 21px;
  padding: 0 3px;
  box-sizing: border-box;
  height: 21px;
  place-items: center;
  border: 1px solid rgba(83, 65, 44, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.68);
  color: #514332;
  font: 600 10px/1 ui-sans-serif, system-ui, sans-serif;
}

.action-key-hint > span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.action-key-hint { max-width: calc(100vw - 24px); width: max-content; flex-wrap: wrap; justify-content: center; box-sizing: border-box; }

.action-key-hint i {
  width: 3px;
  height: 3px;
  margin: 0 3px;
  border-radius: 50%;
  background: #bea88d;
}

body.mode-tactile .action-key-hint { display: flex; }
body.mode-explore .action-key-hint { display: none; }

.bubble-layer {
  display: none !important;
}

.collection-bar,
.collection-drawer {
  display: none !important;
}

[hidden] {
  display: none !important;
}

.bear-bubble {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  max-width: min(200px, 60vw);
  padding: 6px 11px 7px;
  color: #40362c;
  font-family: var(--serif-cn);
  font-size: 12px;
  letter-spacing: 0.08em;
  line-height: 1.35;
  white-space: nowrap;
  border: 1px solid rgba(70, 50, 33, 0.11);
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.92);
  box-shadow:
    0 9px 24px -16px rgba(57, 39, 25, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  opacity: 0;
  transform: translate(-50%, -100%) translateY(-6px) scale(0.88);
  transform-origin: 50% 100%;
  transition:
    opacity 0.24s var(--ease-soft),
    transform 0.36s var(--ease-soft);
  will-change: left, top, transform, opacity;
}

.bear-bubble::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  width: 7px;
  height: 7px;
  border-right: 1px solid rgba(70, 50, 33, 0.1);
  border-bottom: 1px solid rgba(70, 50, 33, 0.1);
  background: rgba(255, 252, 246, 0.94);
  transform: translateX(-50%) rotate(45deg);
}

.bear-bubble.is-visible {
  opacity: 1;
  transform: translate(-50%, -100%) translateY(-13px) scale(1);
}

.bear-bubble.is-heart {
  color: #a74d54;
  font-size: 15px;
  letter-spacing: 0.16em;
}

.bear-bubble.is-sleep {
  color: #84786b;
  font-family: "Playfair Display", serif;
  font-size: 14px;
  font-style: italic;
  letter-spacing: 0.24em;
}

.bear-bubble.is-sweet {
  color: #9b613b;
  background: rgba(255, 246, 222, 0.94);
}

.bear-bubble.is-muted {
  padding: 5px 12px 6px;
  font-size: 17px;
  line-height: 1.1;
  letter-spacing: 0.05em;
}

@media (max-width: 700px) {
  .bear-bubble {
    max-width: 64vw;
    padding: 5px 9px 6px;
    font-size: 11px;
  }

  .bear-bubble.is-heart {
    font-size: 14px;
  }

  .bear-bubble.is-sleep {
    font-size: 13px;
  }
}

.masthead {
  position: fixed;
  top: max(44px, 6.2vh);
  left: max(32px, 4.8vw);
  z-index: 4;
  width: min(34vw, 470px);
  pointer-events: none;
  user-select: none;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 clamp(22px, 3.5vh, 38px);
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.24em;
  line-height: 1;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #c36842;
  box-shadow: 0 0 0 4px rgba(195, 104, 66, 0.08);
}

.eyebrow .rule {
  width: 24px;
  height: 1px;
  background: var(--hairline);
}

.title {
  margin: 0;
  color: #1b1714;
  font-family: "Playfair Display", "Bodoni MT", Didot, "Times New Roman", serif;
  font-size: clamp(72px, 8.35vw, 138px);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.79;
  text-rendering: geometricPrecision;
}

.title-line {
  display: block;
  transform: translateX(-0.035em);
}

.title-line + .title-line {
  transform: translateX(0.035em);
}

.title-dot {
  display: inline-block;
  margin-left: 0.015em;
  color: #b45b39;
  transform: translateY(-0.02em);
}

.tagline {
  margin: clamp(28px, 4.8vh, 48px) 0 0 0.12em;
  color: var(--ink-soft);
  font-family: var(--serif-cn);
  font-size: clamp(12px, 0.9vw, 15px);
  letter-spacing: 0.14em;
  line-height: 1.8;
}

.instruction {
  margin: 11px 0 0 0.18em;
  color: var(--ink-faint);
  font-size: 9px;
  letter-spacing: 0.15em;
  line-height: 1.8;
}

.panel {
  position: fixed;
  z-index: 6;
  top: 50%;
  right: max(24px, 3.3vw);
  width: clamp(238px, 18vw, 278px);
  padding: 22px;
  transform: translateY(-50%);
  border: 1px solid rgba(55, 42, 30, 0.11);
  border-radius: 27px;
  background: var(--glass);
  box-shadow:
    0 38px 100px -58px rgba(55, 37, 24, 0.55),
    0 12px 30px -26px rgba(55, 37, 24, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.54);
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  -webkit-backdrop-filter: blur(19px) saturate(1.08);
  backdrop-filter: blur(19px) saturate(1.08);
  user-select: none;
  transition:
    opacity 0.34s var(--ease-soft),
    visibility 0.34s var(--ease-soft);
}

.panel.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.panel-reveal {
  position: fixed;
  z-index: 7;
  right: max(24px, 3.3vw);
  bottom: max(24px, 4vh);
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: #51463b;
  border: 1px solid rgba(55, 42, 30, 0.12);
  border-radius: 999px;
  background: rgba(255, 251, 244, 0.76);
  box-shadow:
    0 18px 42px -26px rgba(55, 37, 24, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.05);
  backdrop-filter: blur(16px) saturate(1.05);
  cursor: pointer;
  transition:
    background 0.3s var(--ease-soft),
    transform 0.3s var(--ease-soft);
}

.panel-reveal:hover {
  background: rgba(255, 253, 247, 0.96);
  transform: scale(1.04);
}

.panel-reveal:active {
  transform: scale(0.96);
}

.panel-reveal svg {
  width: 18px;
  height: 18px;
  overflow: visible;
}

@media (max-width: 1199px) {
  .panel-reveal {
    top: auto;
    right: max(16px, 3.4vw);
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    transform: none;
  }

  .panel-reveal:hover {
    transform: scale(1.04);
  }

  .panel-reveal:active {
    transform: scale(0.96);
  }
}

.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-bear {
  width: 16px;
  height: 16px;
  margin-right: 1px;
  vertical-align: -2px;
  fill: currentColor;
  opacity: 0.82;
}

.panel-overline {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-faint);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.28em;
  line-height: 1;
}

.panel h2 {
  display: flex;
  align-items: center;
  margin: 0;
  color: #2a241e;
  font-family: var(--serif-cn);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.15;
}

.icon-button {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  margin-top: -3px;
  padding: 0;
  place-items: center;
  color: #3f372f;
  border: 1px solid rgba(55, 42, 30, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  cursor: pointer;
  transition:
    background 0.35s var(--ease-soft),
    border-color 0.35s var(--ease-soft),
    transform 0.35s var(--ease-soft);
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.56);
  border-color: rgba(55, 42, 30, 0.2);
}

.icon-button:active {
  transform: scale(0.94);
}

.icon-button svg {
  width: 15px;
  height: 15px;
  overflow: visible;
}

.icon-button .wave,
.icon-button .slash {
  transition: opacity 0.25s ease;
}

.icon-button.is-muted .wave {
  opacity: 0;
}

.icon-button.is-muted .slash {
  opacity: 1;
}

.icon-button .slash {
  opacity: 0;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 18px;
}

.control-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-height: 43px;
  padding: 0 11px;
  overflow: hidden;
  color: #3b332b;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-align: left;
  border: 1px solid rgba(55, 42, 30, 0.1);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.26);
  cursor: pointer;
  transition:
    color 0.35s var(--ease-soft),
    background 0.35s var(--ease-soft),
    border-color 0.35s var(--ease-soft),
    transform 0.35s var(--ease-soft);
}

.control-btn::after {
  content: "";
  position: absolute;
  right: 10px;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.2;
  transition: opacity 0.25s ease;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.62);
  border-color: rgba(55, 42, 30, 0.18);
  transform: translateY(-1px);
}

.control-btn:hover::after {
  opacity: 0.54;
}

.control-btn:active {
  transform: translateY(0) scale(0.985);
}

.control-btn svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  opacity: 0.54;
}

.control-btn.is-active {
  color: #fbf6ec;
  background: #262019;
  border-color: #262019;
  box-shadow: 0 8px 18px -12px rgba(35, 27, 20, 0.85);
}

.control-btn.is-active svg {
  opacity: 0.8;
}

.softness {
  margin-top: 19px;
  padding-top: 17px;
  border-top: 1px solid rgba(55, 42, 30, 0.09);
}

.softness-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.softness-head label {
  color: #3a322a;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
}

.softness-head output {
  color: var(--ink-faint);
  font-family: var(--serif-cn);
  font-size: 11px;
  letter-spacing: 0.08em;
}

input[type="range"] {
  display: block;
  width: 100%;
  height: 18px;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #3b3129 0%,
    #3b3129 var(--softness),
    rgba(55, 42, 30, 0.15) var(--softness),
    rgba(55, 42, 30, 0.15) 100%
  );
}

input[type="range"]::-moz-range-track {
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: rgba(55, 42, 30, 0.15);
}

input[type="range"]::-moz-range-progress {
  height: 2px;
  border-radius: 999px;
  background: #3b3129;
}

input[type="range"]::-webkit-slider-thumb {
  width: 15px;
  height: 15px;
  margin-top: -6.5px;
  appearance: none;
  -webkit-appearance: none;
  border: 3px solid #f9f4ea;
  border-radius: 999px;
  background: #2e2720;
  box-shadow:
    0 2px 6px rgba(47, 34, 24, 0.25),
    0 0 0 1px rgba(55, 42, 30, 0.16);
  transition: transform 0.2s var(--ease-soft);
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 3px solid #f9f4ea;
  border-radius: 999px;
  background: #2e2720;
  box-shadow:
    0 2px 6px rgba(47, 34, 24, 0.25),
    0 0 0 1px rgba(55, 42, 30, 0.16);
}

input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.16);
}

.softness-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 3px;
  color: var(--ink-faint);
  font-family: var(--serif-cn);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.collection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid rgba(55, 42, 30, 0.08);
}

.star-meter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: #685c4e;
  font-size: 9px;
  letter-spacing: 0.06em;
  line-height: 1;
}

.star-meter svg {
  width: 12px;
  height: 12px;
  overflow: visible;
  fill: #d8a843;
  filter: drop-shadow(0 2px 3px rgba(166, 112, 30, 0.16));
}

.star-meter strong {
  color: #3e3328;
  font-family: var(--serif-cn);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
}

.star-meter.is-bumped svg {
  animation: star-bump 0.5s var(--ease-soft);
}

.star-meter.is-bumped strong {
  animation: number-bump 0.45s var(--ease-soft);
}

.collection-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mini-btn {
  min-height: 26px;
  padding: 0 8px;
  color: #5f5346;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.04em;
  border: 1px solid rgba(55, 42, 30, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.26);
  cursor: pointer;
  transition:
    color 0.25s var(--ease-soft),
    background 0.25s var(--ease-soft),
    border-color 0.25s var(--ease-soft);
}

.mini-btn:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(55, 42, 30, 0.18);
}

.mini-btn[aria-expanded="true"] {
  color: #fbf6ec;
  background: #302820;
  border-color: #302820;
}

.mini-btn span {
  opacity: 0.66;
}

.mini-btn.is-fresh {
  position: relative;
}

.mini-btn.is-fresh::after {
  content: "";
  position: absolute;
  top: -2px;
  right: -1px;
  width: 5px;
  height: 5px;
  border: 1px solid rgba(255, 250, 240, 0.9);
  border-radius: 999px;
  background: #c5784f;
  box-shadow: 0 0 0 2px rgba(197, 120, 79, 0.1);
}

.collection-drawer {
  position: relative;
  max-height: 45vh;
  margin-top: 10px;
  padding: 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(55, 42, 30, 0.1);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
  animation: drawer-in 0.28s var(--ease-soft);
  scrollbar-width: thin;
}

.collection-drawer[hidden],
.drawer-view[hidden] {
  display: none;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.drawer-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-faint);
  font-size: 6.5px;
  font-weight: 600;
  letter-spacing: 0.26em;
  line-height: 1;
  text-transform: uppercase;
}

.drawer-head h3 {
  margin: 0;
  color: #3a3027;
  font-family: var(--serif-cn);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.25;
}

.drawer-close {
  display: grid;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  place-items: center;
  color: #817466;
  font-size: 16px;
  font-weight: 300;
  line-height: 1;
  border: 1px solid rgba(55, 42, 30, 0.1);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.drawer-close:hover {
  color: #3b3128;
  background: rgba(255, 255, 255, 0.5);
}

.bear-picker {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: -1px 0 9px;
}

.bear-dot {
  position: relative;
  display: grid;
  width: 19px;
  height: 19px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(55, 42, 30, 0.12);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.55);
  background: color-mix(in srgb, var(--dot-color, #d9c7b2) 30%, #fffaf2);
  cursor: pointer;
  transition:
    transform 0.22s var(--ease-soft),
    box-shadow 0.22s var(--ease-soft);
}

.bear-dot span {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  background: var(--dot-color, #d9c7b2);
  opacity: 0.8;
  transition:
    opacity 0.22s var(--ease-soft),
    transform 0.22s var(--ease-soft);
}

.bear-dot:hover {
  transform: translateY(-1px);
}

.bear-dot.is-selected {
  box-shadow:
    0 0 0 1.5px #f7f1e6,
    0 0 0 2.5px rgba(55, 42, 30, 0.48);
}

.bear-dot.is-selected span {
  opacity: 1;
  transform: scale(1.08);
}

.accessory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

.accessory-btn {
  display: flex;
  min-width: 0;
  min-height: 58px;
  padding: 6px 3px 5px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #5d5144;
  border: 1px solid rgba(55, 42, 30, 0.09);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.26);
  cursor: pointer;
  transition:
    background 0.25s var(--ease-soft),
    border-color 0.25s var(--ease-soft),
    color 0.25s var(--ease-soft),
    transform 0.25s var(--ease-soft);
}

.accessory-btn:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(55, 42, 30, 0.16);
}

.accessory-btn:active {
  transform: scale(0.97);
}

.accessory-btn svg {
  width: 19px;
  height: 19px;
  overflow: visible;
}

.accessory-btn .accessory-name {
  overflow: hidden;
  max-width: 100%;
  font-family: var(--serif-cn);
  font-size: 8.5px;
  letter-spacing: 0.02em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.accessory-btn .accessory-cost {
  color: var(--ink-faint);
  font-family: var(--sans);
  font-size: 7px;
  letter-spacing: 0.02em;
  line-height: 1;
}

.accessory-btn.is-locked {
  opacity: 0.5;
  cursor: default;
}

.accessory-btn.is-locked:hover {
  background: rgba(255, 255, 255, 0.26);
  border-color: rgba(55, 42, 30, 0.09);
}

.accessory-btn.is-worn {
  color: #fbf5e9;
  background: #302820;
  border-color: #302820;
}

.accessory-btn.is-worn .accessory-cost {
  color: rgba(251, 245, 233, 0.64);
}

.drawer-note {
  margin: 9px 0 0;
  color: var(--ink-faint);
  font-family: var(--serif-cn);
  font-size: 8px;
  letter-spacing: 0.06em;
  line-height: 1.65;
}

.journal-list {
  display: flex;
  max-height: 152px;
  padding-right: 3px;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.journal-entry {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 4px 1px;
  color: #66594b;
  font-family: var(--serif-cn);
  font-size: 8.5px;
  letter-spacing: 0.03em;
  line-height: 1.55;
  border-bottom: 1px dashed rgba(55, 42, 30, 0.08);
}

.journal-entry:last-child {
  border-bottom: 0;
}

.journal-entry .entry-index {
  flex: 0 0 auto;
  color: #b29f8b;
  font-family: var(--sans);
  font-size: 6.5px;
  letter-spacing: 0.08em;
}

.journal-entry.is-locked {
  color: #b0a496;
}

.journal-entry.is-locked .entry-text {
  letter-spacing: 0.2em;
}

.journal-entry.is-new .entry-text {
  color: #a06038;
}

.status {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 17px;
  margin: 18px 0 0;
  padding-top: 13px;
  color: var(--ink-faint);
  font-family: var(--serif-cn);
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1.5;
  border-top: 1px solid rgba(55, 42, 30, 0.08);
}

#statusText {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  flex: 0 0 auto;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #be7557;
  box-shadow: 0 0 0 3px rgba(190, 117, 87, 0.08);
}

.status.is-live .status-dot {
  animation: status-pulse 1.9s ease-in-out infinite;
}

.footer-note {
  position: fixed;
  bottom: max(30px, 4.5vh);
  left: max(32px, 4.8vw);
  z-index: 4;
  margin: 0;
  color: #8d8274;
  font-size: 7px;
  font-weight: 500;
  letter-spacing: 0.24em;
  line-height: 1.7;
  pointer-events: none;
  user-select: none;
}

.footer-note span {
  font-family: var(--serif-cn);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button:focus-visible,
input[type="range"]:focus-visible {
  outline: 2px solid rgba(52, 42, 33, 0.58);
  outline-offset: 3px;
}

@keyframes star-bump {
  0%,
  100% {
    transform: scale(1) rotate(0);
  }
  35% {
    transform: scale(1.32) rotate(14deg);
  }
  68% {
    transform: scale(1.08) rotate(-7deg);
  }
}

@keyframes number-bump {
  0%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-2px);
  }
}

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

@keyframes status-pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.15);
  }
}

/* Tablet and compact desktop: controls become a soft bottom bar. */
@media (min-width: 1200px) and (max-height: 820px) {
  .masthead {
    top: max(32px, 5vh);
  }

  .eyebrow {
    margin-bottom: 20px;
  }

  .title {
    font-size: clamp(64px, 7.25vw, 104px);
  }

  .tagline {
    margin-top: 25px;
  }
}

@media (max-width: 1199px) {
  .masthead {
    top: max(30px, 4.6vh);
    left: max(25px, 4vw);
    width: min(48vw, 430px);
  }

  .eyebrow {
    margin-bottom: clamp(16px, 2.4vh, 26px);
  }

  .title {
    font-size: clamp(58px, 10.6vw, 96px);
  }

  .tagline {
    margin-top: 25px;
    font-size: 12px;
  }

  .instruction {
    margin-top: 9px;
    color: #84796c;
    font-size: 9px;
    letter-spacing: 0.12em;
  }

  .footer-note {
    display: none;
  }

  .panel {
    top: auto;
    right: max(22px, 3.4vw);
    bottom: max(20px, 3.2vh);
    left: max(22px, 3.4vw);
    width: auto;
    padding: 16px 18px 14px;
    transform: none;
    border-radius: 23px;
    background: rgba(255, 251, 244, 0.78);
  }

  .panel-top {
    align-items: center;
  }

  .panel-overline {
    display: none;
  }

  .panel h2 {
    font-size: 15px;
  }

  .controls {
    grid-template-columns: repeat(4, 1fr);
    margin-top: 12px;
  }

  .control-btn {
    min-height: 40px;
    justify-content: center;
  }

  .control-btn::after {
    display: none;
  }

  .softness {
    display: grid;
    grid-template-columns: 72px 1fr;
    align-items: center;
    gap: 8px 12px;
    margin-top: 12px;
    padding-top: 12px;
  }

  .softness-head {
    display: contents;
  }

  .softness-head label {
    grid-column: 1;
    margin: 0;
    font-size: 9px;
  }

  .softness-head output {
    display: none;
  }

  input[type="range"] {
    grid-column: 2;
    grid-row: 1;
  }

  .softness-scale {
    display: none;
  }

  .collection-bar {
    margin-top: 10px;
    padding-top: 9px;
  }

  .star-meter {
    font-size: 8.5px;
  }

  .star-meter strong {
    font-size: 12px;
  }

  .mini-btn {
    min-height: 24px;
    padding: 0 7px;
    font-size: 8.5px;
  }

  .collection-drawer {
    margin-top: 8px;
    padding: 10px;
  }

  .accessory-btn {
    min-height: 54px;
  }

  .panel.is-drawer-open .controls,
  .panel.is-drawer-open .softness {
    display: none;
  }

  .status {
    margin-top: 9px;
    padding-top: 9px;
    font-size: 9px;
  }
}

@media (max-width: 700px) {
  .grain {
    opacity: 0.12;
  }

  .masthead {
    top: max(22px, 3.2vh);
    left: 22px;
    width: calc(100vw - 44px);
  }

  .eyebrow {
    margin-bottom: 15px;
    font-size: 8px;
  }

  .title {
    font-size: clamp(48px, 14vw, 68px);
    line-height: 0.82;
  }

  .tagline {
    margin-top: 18px;
    font-size: 10.5px;
    letter-spacing: 0.11em;
  }

  .panel {
    right: 13px;
    bottom: calc(13px + env(safe-area-inset-bottom, 0px));
    left: 13px;
    padding: 13px 14px 11px;
    border-radius: 20px;
    background: rgba(255, 251, 244, 0.84);
    box-shadow:
      0 24px 60px -38px rgba(55, 37, 24, 0.5),
      inset 0 1px 0 rgba(255, 255, 255, 0.58);
  }

  .panel h2 {
    font-size: 14px;
  }

  .icon-button {
    width: 32px;
    height: 32px;
  }

  .controls {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin-top: 10px;
  }

  .control-btn {
    min-height: 40px;
    gap: 6px;
    font-size: 11.5px;
    border-radius: 11px;
    touch-action: manipulation;
  }

  .control-btn svg {
    width: 13px;
    height: 13px;
  }

  .softness {
    grid-template-columns: 58px 1fr;
    margin-top: 9px;
    padding-top: 9px;
  }

  input[type="range"] {
    height: 22px;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 17px;
    height: 17px;
    margin-top: -7.5px;
  }

  input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
  }

  .softness-head label {
    font-size: 8px;
  }

  .collection-bar {
    margin-top: 8px;
    padding-top: 7px;
  }

  .star-meter {
    gap: 4px;
    font-size: 8px;
  }

  .star-meter svg {
    width: 11px;
    height: 11px;
  }

  .star-meter strong {
    font-size: 11px;
  }

  .mini-btn {
    min-height: 23px;
    padding: 0 6px;
    font-size: 8px;
  }

  .collection-drawer {
    margin-top: 7px;
    padding: 9px;
    border-radius: 13px;
  }

  .drawer-head {
    margin-bottom: 8px;
  }

  .drawer-head h3 {
    font-size: 12px;
  }

  .accessory-grid {
    gap: 4px;
  }

  .accessory-btn {
    min-height: 50px;
    border-radius: 9px;
  }

  .accessory-btn svg {
    width: 17px;
    height: 17px;
  }

  .journal-list {
    max-height: 126px;
  }

  .status {
    margin-top: 7px;
    padding-top: 7px;
    font-size: 8.5px;
  }
}

@media (max-width: 370px) {
  .title {
    font-size: 45px;
  }

  .tagline {
    display: none;
  }

  .control-btn {
    min-height: 35px;
    font-size: 10.5px;
  }
}

@media (max-height: 620px) and (max-width: 1199px) {
  .tagline,
  .instruction,
  .status {
    display: none;
  }

  .masthead {
    top: 20px;
  }

  .title {
    font-size: clamp(42px, 8vh, 62px);
  }

  .panel {
    padding-top: 11px;
    padding-bottom: 10px;
  }

  .softness {
    margin-top: 7px;
    padding-top: 7px;
  }
}

/* A compact bar for phones and tablets held sideways. */
@media (max-height: 540px) and (orientation: landscape) and (max-width: 1199px) {
  .masthead {
    top: 16px;
    left: 22px;
    width: min(44vw, 410px);
  }

  .eyebrow {
    margin-bottom: 10px;
    font-size: 7px;
  }

  .title {
    font-size: clamp(42px, 7.2vh, 58px);
    line-height: 0.8;
  }

  .panel {
    right: 16px;
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    left: 16px;
    padding: 8px 12px;
    border-radius: 16px;
  }

  .panel-top {
    align-items: center;
  }

  .panel h2 {
    font-size: 13px;
  }

  .panel-overline {
    display: none;
  }

  .panel-top .icon-button {
    width: 28px;
    height: 28px;
    margin-top: 0;
  }

  .controls {
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-top: 6px;
  }

  .control-btn {
    min-height: 33px;
    padding: 0 8px;
    font-size: 10px;
    border-radius: 9px;
  }

  .control-btn svg {
    width: 12px;
    height: 12px;
  }

  .softness {
    grid-template-columns: 52px 1fr;
    gap: 2px 8px;
    margin-top: 6px;
    padding-top: 6px;
  }

  .softness-head label {
    font-size: 8px;
  }

  .collection-bar {
    margin-top: 5px;
    padding-top: 5px;
  }

  .star-meter {
    font-size: 8px;
  }

  .star-meter strong {
    font-size: 11px;
  }

  .mini-btn {
    min-height: 21px;
    padding: 0 6px;
    font-size: 8px;
  }

  .collection-drawer {
    max-height: 33vh;
    margin-top: 6px;
    padding: 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .accessory-btn {
    min-height: 46px;
  }

  input[type="range"] {
    height: 16px;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    margin-top: -6px;
  }

  input[type="range"]::-moz-range-thumb {
    width: 11px;
    height: 11px;
  }

  .status {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
  }

  .status.is-live .status-dot {
    animation: none;
  }
}

/* --------------------------------------------------------------------------
   Simplified icon-only console
   -------------------------------------------------------------------------- */
.panel {
  width: clamp(196px, 15vw, 224px);
  padding: 14px;
  border-radius: 22px;
}

.panel-top .icon-button {
  margin-top: 0;
}

.panel-actions {
  width: 100%;
  justify-content: space-between;
}

.controls {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.control-btn {
  min-height: 42px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border-radius: 13px;
}

.control-btn svg {
  width: 17px;
  height: 17px;
  opacity: 0.58;
}

.control-btn::after {
  display: none;
}

.softness {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid rgba(55, 42, 30, 0.09);
}

.softness-glyph {
  display: grid;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: #5c4f43;
  opacity: 0.46;
  place-items: center;
}

.softness-glyph svg {
  width: 16px;
  height: 16px;
}

.softness input[type="range"] {
  flex: 1;
  min-width: 0;
}

.softness-head,
.softness-scale {
  display: none !important;
}

@media (max-width: 1199px) {
  .panel {
    top: auto;
    right: auto;
    bottom: max(18px, 3.2vh);
    left: 50%;
    width: min(302px, calc(100vw - 36px));
    padding: 12px 14px;
    border-radius: 20px;
    transform: translateX(-50%);
  }

  .panel.is-hidden {
    transform: translateX(-50%);
  }
}

@media (max-width: 700px) {
  .panel {
    right: auto;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    width: min(300px, calc(100vw - 28px));
    padding: 11px 13px 10px;
    border-radius: 18px;
  }

  .panel-top .icon-button {
    width: 30px;
    height: 30px;
  }

  .controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    margin-top: 8px;
  }

  .control-btn {
    min-height: 37px;
    border-radius: 11px;
  }

  .control-btn svg {
    width: 16px;
    height: 16px;
  }

  .softness {
    display: flex;
    gap: 8px;
    margin-top: 9px;
    padding-top: 8px;
  }

  .softness-glyph {
    width: 15px;
    height: 15px;
  }

  .softness-glyph svg {
    width: 15px;
    height: 15px;
  }

  .softness input[type="range"] {
    height: 22px;
  }
}

/* --------------------------------------------------------------------------
   Thirty-second weightlessness
   -------------------------------------------------------------------------- */

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(52% 42% at 50% 52%, rgba(255, 247, 220, 0.28), transparent 72%),
    radial-gradient(64% 54% at 38% 36%, rgba(211, 218, 245, 0.24), transparent 74%),
    radial-gradient(44% 36% at 68% 64%, rgba(245, 223, 211, 0.18), transparent 76%);
  transition: opacity 0.9s ease;
}

body.is-weightless::after {
  opacity: 1;
}

.control-btn[data-action="gravity"] {
  --gravity-progress: 1;
}

.panel-actions {
  justify-content: flex-start;
  gap: 8px;
}

.panel-actions #hidePanel {
  margin-right: auto;
}

.icon-button.is-music-on {
  color: #554433;
  background: #f1e5d0;
  border-color: rgba(124, 95, 63, 0.22);
}

.icon-button.is-music-on:hover {
  background: #f8eedc;
}

.control-btn[data-action="gravity"].is-active {
  color: #5b4a39;
  background: #f3eadb;
  border-color: rgba(132, 99, 60, 0.26);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.5) inset,
    0 8px 18px -14px rgba(68, 49, 30, 0.55);
}

.control-btn[data-action="gravity"].is-active:hover {
  background: #faf2e5;
}

.control-btn[data-action="gravity"].is-active svg {
  color: #7b6044;
  opacity: 0.72;
}

.control-btn[data-action="gravity"].is-active::before {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 5px;
  height: 2px;
  border-radius: 2px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    #b18550 0 calc(var(--gravity-progress, 1) * 100%),
    rgba(112, 86, 58, 0.13) calc(var(--gravity-progress, 1) * 100%)
  );
  opacity: 0.9;
}

/* --------------------------------------------------------------------------
   A short first-run tutorial
   -------------------------------------------------------------------------- */

body.tutorial-open {
  overflow: hidden;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(77, 61, 46, 0.18);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.tutorial-overlay[hidden] {
  display: none;
}

.tutorial-card {
  width: min(510px, 100%);
  padding: 21px 24px 19px;
  border: 1px solid rgba(79, 60, 42, 0.12);
  border-radius: 28px;
  background: #fbf4e8;
  box-shadow:
    0 30px 70px -34px rgba(48, 35, 23, 0.5),
    0 2px 0 rgba(255, 255, 255, 0.7) inset;
  color: #2c241d;
}

.tutorial-overlay:not([hidden]) .tutorial-card {
  animation: tutorial-card-in 0.38s cubic-bezier(0.22, 0.8, 0.28, 1) both;
}

.tutorial-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tutorial-kicker {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  color: #8e7457;
}

.tutorial-count {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: #a08a72;
}

.tutorial-skip {
  min-width: 34px;
  min-height: 30px;
  padding: 4px 2px 4px 8px;
  border: 0;
  background: none;
  color: #927b62;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.tutorial-skip:hover {
  color: #4b3b2d;
}

.tutorial-visual {
  display: grid;
  place-items: center;
  height: 79px;
  margin: 5px 0 1px;
  border-radius: 18px;
  background:
    radial-gradient(52% 70% at 50% 58%, rgba(244, 226, 196, 0.7), transparent 76%);
  color: #75583d;
}

.tutorial-visual svg {
  width: 100px;
  height: 62px;
  overflow: visible;
}

.tutorial-title {
  margin: 5px 0 5px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 34px;
  font-weight: 500;
  font-style: italic;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.tutorial-copy {
  min-height: 45px;
  margin: 0;
  color: #6f5d4b;
  font-size: 12.5px;
  line-height: 1.75;
  letter-spacing: 0.01em;
}

.tutorial-mobile {
  display: none;
}

.tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid rgba(79, 60, 42, 0.09);
}

.tutorial-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tutorial-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(85, 65, 44, 0.18);
  transition: width 0.25s ease, background-color 0.25s ease;
}

.tutorial-dots span.is-active {
  width: 17px;
  border-radius: 4px;
  background: #493a2b;
}

.tutorial-next {
  min-height: 36px;
  padding: 9px 17px;
  border: 0;
  border-radius: 999px;
  background: #2c241d;
  color: #fbf6ec;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease;
}

.tutorial-next:hover {
  background: #44362a;
}

.tutorial-next:active {
  transform: scale(0.97);
}

.tutorial-skip:focus-visible,
.tutorial-next:focus-visible {
  outline: 2px solid rgba(187, 153, 107, 0.58);
  outline-offset: 2px;
}

@keyframes tutorial-card-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (hover: none), (max-width: 700px) {
  .tutorial-overlay {
    align-items: end;
    padding: 14px;
  }

  .tutorial-card {
    width: 100%;
    max-height: min(620px, calc(100dvh - 28px));
    overflow-y: auto;
    padding: 17px 18px calc(14px + env(safe-area-inset-bottom));
    border-radius: 24px;
  }

  .tutorial-visual {
    height: 67px;
    margin-top: 2px;
  }

  .tutorial-visual svg {
    width: 84px;
    height: 52px;
  }

  .tutorial-title {
    margin-top: 3px;
    font-size: 27px;
  }

  .tutorial-copy {
    min-height: 57px;
    font-size: 12px;
    line-height: 1.7;
  }

  .tutorial-desktop {
    display: none;
  }

  .tutorial-mobile {
    display: block;
  }

  .tutorial-footer {
    margin-top: 11px;
    padding-top: 11px;
  }

  .tutorial-next {
    min-height: 42px;
    padding: 10px 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tutorial-overlay:not([hidden]) .tutorial-card {
    animation: none;
  }
}

/* --------------------------------------------------------------------------
   Modes: tactile, dance and gummy match
   -------------------------------------------------------------------------- */

body.mode-dance .panel,
body.mode-dance .panel-reveal,
body.mode-dance .bubble-layer,
body.mode-rhythm .panel,
body.mode-rhythm .panel-reveal,
body.mode-rhythm .bubble-layer,
body.mode-fling .panel,
body.mode-fling .panel-reveal,
body.mode-fling .bubble-layer {
  display: none !important;
}

body.mode-dance #stage { cursor: pointer; }

.mode-switch {
  position: fixed;
  top: max(26px, 4vh);
  left: auto;
  right: max(28px, 4vw);
  z-index: 15;
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(65, 49, 34, 0.12);
  border-radius: 999px;
  background: rgba(252, 247, 238, 0.78);
  box-shadow: 0 8px 22px -18px rgba(44, 32, 20, 0.45);
  backdrop-filter: blur(12px);
  transform: none;
}

.mode-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8a7b6a;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, transform .18s ease;
}

.mode-button:hover { color: #493d31; transform: translateY(-1px); }
.mode-button[aria-pressed="true"] { color: #3d3024; background: #fff9ee; box-shadow: 0 3px 12px rgba(54,39,25,.09); }
.mode-button svg { width: 18px; height: 18px; }
.mode-button:focus-visible, #stage:focus-visible { outline: 2px solid #977a5e; outline-offset: 2px; }

body.mode-dance::after,
body.mode-rhythm::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
  background:
    radial-gradient(40% 48% at 26% 68%, rgba(243, 209, 187, 0.36), transparent 74%),
    radial-gradient(34% 42% at 72% 42%, rgba(210, 210, 241, 0.3), transparent 74%),
    radial-gradient(28% 30% at 54% 24%, rgba(255, 235, 181, 0.3), transparent 76%);
  animation: dance-glow 7s ease-in-out infinite alternate;
}

.rhythm-stage-fx {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: none;
  overflow: hidden;
  pointer-events: none;
}

body.mode-dance .rhythm-stage-fx {
  display: block;
}

.rhythm-beam {
  position: absolute;
  top: -18%;
  width: 32vw;
  height: 118vh;
  opacity: 0.14;
  filter: blur(7px);
  background: linear-gradient(180deg, rgba(255,255,255,.62), rgba(242,211,177,.16) 58%, transparent 88%);
  transform-origin: 50% 0;
  animation: rhythm-beam-sway 7.2s ease-in-out infinite alternate;
}

.rhythm-beam--left { left: 9%; transform: rotate(15deg); }
.rhythm-beam--right { right: 9%; transform: rotate(-15deg); animation-delay: -3.6s; }

.rhythm-floor-pulse {
  position: absolute;
  left: 50%;
  bottom: 12%;
  width: min(68vw, 760px);
  aspect-ratio: 3.8 / 1;
  border: 1px solid rgba(194, 152, 110, .2);
  border-radius: 50%;
  opacity: 0;
  transform: translateX(-50%) scale(.76);
}

.rhythm-stage-fx.is-beat .rhythm-floor-pulse {
  animation: rhythm-floor-beat .48s ease-out;
}

.rhythm-stage-fx.is-accent .rhythm-floor-pulse {
  border-color: rgba(215, 169, 75, .5);
  box-shadow: 0 0 52px rgba(245, 207, 121, .22);
}

body.rhythm-fever .rhythm-beam { opacity: 0.23; animation-duration: 4.8s; }

@keyframes rhythm-beam-sway {
  from { translate: -4vw 0; rotate: -5deg; }
  to { translate: 5vw 0; rotate: 6deg; }
}

@keyframes rhythm-floor-beat {
  0% { opacity: .62; transform: translateX(-50%) scale(.72); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.08); }
}

@keyframes dance-glow {
  from {
    transform: scale(1);
    filter: saturate(0.92);
  }
  to {
    transform: scale(1.035);
    filter: saturate(1.08);
  }
}

/* Match mode */

body.mode-fling #stage {
  display: none;
}

/* Gummy Fling */

.fling-mode {
  position: fixed;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(48% 44% at 48% 40%, rgba(255, 251, 241, 0.78), transparent 80%),
    #f5efe4;
}

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

#flingStage {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.fling-hud {
  position: fixed;
  left: max(24px, 4vw);
  right: max(24px, 4vw);
  bottom: max(20px, 3.5vh);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}

.fling-score {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 150px;
  padding: 8px 13px 7px;
  border: 1px solid rgba(65, 49, 34, 0.11);
  border-radius: 999px;
  background: rgba(252, 247, 238, 0.72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #3d3024;
}

.fling-score__label {
  color: #96816b;
  font-size: 9px;
  letter-spacing: 0.14em;
}

.fling-score strong {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 19px;
  font-weight: 500;
  font-style: italic;
  line-height: 1;
}

.fling-score__total {
  color: #a28c75;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.fling-shots {
  margin-left: auto;
  color: #9a8269;
  font-size: 9px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.fling-rule {
  margin: 0;
  color: #8a7560;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-align: center;
}

.fling-reset {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(65, 49, 34, 0.13);
  border-radius: 50%;
  background: rgba(252, 247, 238, 0.72);
  color: #4a3a2b;
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 0.2s ease, transform 0.18s ease;
}

.fling-reset:hover {
  background: #fbf5ea;
}

.fling-reset:active {
  transform: scale(0.94);
}

.fling-reset svg {
  width: 16px;
  height: 16px;
}

.fling-result {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(77, 61, 46, 0.18);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.fling-result[hidden] {
  display: none;
}

.fling-result__card {
  width: min(390px, 100%);
  padding: 24px 25px 21px;
  border: 1px solid rgba(79, 60, 42, 0.12);
  border-radius: 26px;
  background: #fbf4e8;
  box-shadow: 0 30px 70px -34px rgba(48, 35, 23, 0.5);
  text-align: center;
}

.fling-result__kicker {
  margin: 0 0 7px;
  color: #967b5f;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.fling-result h2 {
  margin: 0 0 7px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 30px;
  font-weight: 500;
  font-style: italic;
  color: #2c241d;
}

.fling-result p:not(.fling-result__kicker) {
  margin: 0 0 16px;
  color: #756353;
  font-size: 12px;
  line-height: 1.7;
}

.fling-again {
  min-height: 38px;
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: #2c241d;
  color: #fbf6ec;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.fling-again:hover {
  background: #44362a;
}

@media (max-width: 700px) {
  .fling-hud {
    left: 14px;
    right: 14px;
    bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .fling-score {
    min-width: 132px;
    padding: 7px 10px;
  }

  .fling-score strong {
    font-size: 17px;
  }

  .fling-shots {
    font-size: 8px;
  }

  .fling-rule {
    display: none;
  }

  .fling-reset {
    width: 36px;
    height: 36px;
  }

  .fling-result h2 {
    font-size: 26px;
  }
}

.match-mode {
  position: fixed;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(52% 50% at 50% 44%, rgba(255, 250, 238, 0.7), transparent 78%),
    #f5efe4;
}

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

#matchStage {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

.match-hud {
  position: fixed;
  left: max(24px, 4vw);
  right: max(24px, 4vw);
  bottom: max(20px, 3.5vh);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}

.match-score {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 102px;
  padding: 8px 13px 7px;
  border: 1px solid rgba(65, 49, 34, 0.11);
  border-radius: 999px;
  background: rgba(252, 247, 238, 0.7);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #3d3024;
}

.match-score__label {
  color: #96816b;
  font-size: 9px;
  letter-spacing: 0.14em;
}

.match-score strong {
  font-family: "Playfair Display", Georgia, serif;
  font-size: 19px;
  font-weight: 500;
  font-style: italic;
  line-height: 1;
}

.match-rule {
  margin: 0;
  color: #8a7560;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-align: center;
}

.match-reset {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(65, 49, 34, 0.13);
  border-radius: 50%;
  background: rgba(252, 247, 238, 0.72);
  color: #4a3a2b;
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 0.2s ease, transform 0.18s ease;
}

.match-reset:hover {
  background: #fbf5ea;
}

.match-reset:active {
  transform: scale(0.94);
}

.match-reset svg {
  width: 16px;
  height: 16px;
}

.match-result {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(77, 61, 46, 0.18);
  -webkit-backdrop-filter: blur(7px);
  backdrop-filter: blur(7px);
}

.match-result[hidden] {
  display: none;
}

.match-result__card {
  width: min(390px, 100%);
  padding: 24px 25px 21px;
  border: 1px solid rgba(79, 60, 42, 0.12);
  border-radius: 26px;
  background: #fbf4e8;
  box-shadow: 0 30px 70px -34px rgba(48, 35, 23, 0.5);
  text-align: center;
}

.match-result__kicker {
  margin: 0 0 7px;
  color: #967b5f;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.match-result h2 {
  margin: 0 0 7px;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 30px;
  font-weight: 500;
  font-style: italic;
  color: #2c241d;
}

.match-result p:not(.match-result__kicker) {
  margin: 0 0 16px;
  color: #756353;
  font-size: 12px;
  line-height: 1.7;
}

.match-again {
  min-height: 38px;
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: #2c241d;
  color: #fbf6ec;
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.match-again:hover {
  background: #44362a;
}

@media (max-width: 700px) {
  .mode-switch { top: 13px; left: auto; right: 12px; }

  .match-hud {
    left: 14px;
    right: 14px;
    bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .match-score {
    min-width: 84px;
    padding: 7px 10px;
  }

  .match-score strong {
    font-size: 17px;
  }

  .match-rule {
    display: none;
  }

  .match-reset {
    width: 36px;
    height: 36px;
  }

  .match-result h2 {
    font-size: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.mode-dance::after,
  body.mode-rhythm::after {
    animation: none;
  }

  .rhythm-marker {
    animation: none;
  }

  .rhythm-beam { animation: none; }
}
/* 年轮入口：独立游戏仍可一键回到主站。 */
.year-ring-home{position:fixed;z-index:40;left:18px;bottom:18px;display:grid;place-items:center;width:40px;height:40px;border:1px solid rgba(61,50,39,.14);border-radius:14px;background:rgba(251,247,239,.82);color:#443b32;box-shadow:0 8px 28px rgba(66,51,35,.08);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);transition:background .18s ease,border-color .18s ease,transform .18s ease}
.year-ring-home:hover{background:#fffaf1;border-color:rgba(61,50,39,.25);transform:translateY(-1px)}
.year-ring-home svg{width:18px;height:18px}
@media(max-width:640px){.year-ring-home{left:12px;bottom:12px;width:38px;height:38px;border-radius:13px}}

