:root {
  color-scheme: light;
  --paper: #f0f1ec;
  --paper-bright: #fffdf8;
  --ink: #201917;
  --muted: #776a60;
  --red: #b6322f;
  --red-deep: #702020;
  --red-bright: #e95c4e;
  --jade: #38685d;
  --bronze: #ad7a35;
  --brick: #9e3f34;
  --indigo: #35546a;
  --line: rgba(64, 40, 29, 0.16);
  --shadow: 0 18px 60px rgba(78, 24, 20, 0.13);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: url("./assets/minnan-tile-pattern.svg");
  background-size: 160px 160px;
  opacity: 0.035;
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(63, 110, 98, 0.35);
  outline-offset: 3px;
}

.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;
}

.app-shell {
  width: min(100%, 1100px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 32px 24px;
}

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

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

.music-menu {
  position: relative;
  z-index: 30;
}

.music-summary {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--red-deep);
  background: rgba(255, 250, 242, 0.72);
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 19px;
  list-style: none;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.music-summary::-webkit-details-marker {
  display: none;
}

.music-summary:hover {
  border-color: rgba(112, 32, 32, 0.42);
  background: #fffaf2;
  transform: translateY(-1px);
}

.music-summary i {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border: 1px solid #f6ede0;
  border-radius: 50%;
  background: #aaa096;
}

.music-summary i.active {
  background: #4e9678;
  box-shadow: 0 0 0 3px rgba(78, 150, 120, 0.14);
}

.music-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 310px;
  padding: 17px;
  border: 1px solid rgba(77, 42, 30, 0.18);
  border-radius: 6px;
  background: #fffaf1;
  box-shadow: 0 18px 55px rgba(64, 27, 18, 0.2);
}

.music-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.music-panel-heading > div {
  display: grid;
  gap: 3px;
}

.music-panel-heading strong {
  font-family: "Songti SC", SimSun, serif;
  font-size: 17px;
}

.music-panel-heading small {
  color: var(--muted);
  font-size: 11px;
}

.music-play-button {
  min-width: 74px;
  min-height: 35px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(112, 32, 32, 0.28);
  border-radius: 4px;
  color: #fff9ef;
  background: var(--red);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.music-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-top: 15px;
  padding: 4px;
  border: 1px solid rgba(64, 40, 29, 0.12);
  border-radius: 5px;
  background: rgba(81, 72, 60, 0.045);
}

.music-presets button {
  min-height: 33px;
  padding: 4px 5px;
  border: 0;
  border-radius: 3px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.music-presets button.selected {
  color: var(--red-deep);
  background: #fffdf8;
  box-shadow: 0 1px 5px rgba(65, 30, 20, 0.13);
  font-weight: 700;
}

.music-volume {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 11px;
}

.music-volume input {
  width: 100%;
  accent-color: var(--jade);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: "Songti SC", SimSun, serif;
  font-weight: 700;
  text-decoration: none;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 18px;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0;
}

.brand-seal {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff7ed;
  background: var(--red);
  border: 2px solid rgba(113, 23, 26, 0.35);
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px rgba(255, 247, 237, 0.2);
}

.gesture-toggle {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 250, 242, 0.72);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.module-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid transparent;
  transition: color 160ms ease, border-color 160ms ease;
}

.module-link:hover {
  color: var(--red-deep);
  border-bottom-color: rgba(182, 50, 47, 0.38);
}

.yanwei-divider {
  height: 36px;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.yanwei-divider img {
  width: min(720px, 84vw);
  height: 54px;
  transform: translateY(-8px);
}

.gesture-toggle:hover {
  border-color: rgba(189, 47, 44, 0.42);
  background: var(--paper-bright);
  transform: translateY(-1px);
}

.gesture-toggle[aria-pressed="true"] {
  color: #fff;
  border-color: var(--jade);
  background: var(--jade);
}

.camera-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(63, 110, 98, 0.12);
}

.ritual-stage {
  min-height: 690px;
  display: grid;
  grid-template-rows: auto minmax(340px, 1fr) auto;
  align-items: center;
  padding: 36px 0 40px;
  text-align: center;
  background: rgba(255, 253, 248, 0.34);
}

.culture-stamp {
  width: max-content;
  margin: 0 auto 12px;
  padding: 5px 9px;
  border: 1px solid rgba(182, 50, 47, 0.27);
  border-radius: 3px;
  color: var(--red-deep);
  background: rgba(255, 250, 241, 0.54);
  font-family: "Songti SC", SimSun, serif;
  font-size: 12px;
}

.question-wrap {
  position: relative;
  z-index: 2;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--jade);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.question-line {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  color: var(--red-deep);
  font-family: "Songti SC", SimSun, serif;
  font-size: clamp(28px, 3.6vw, 46px);
  font-weight: 700;
}

.question-input {
  width: min(78vw, 760px);
  min-width: 0;
  min-height: 1.35em;
  max-height: 2.7em;
  padding: 2px 4px 7px;
  border: 0;
  border-bottom: 1px dashed transparent;
  color: var(--ink);
  background: transparent;
  font: inherit;
  line-height: 1.25;
  text-align: center;
  overflow: hidden;
  resize: none;
  transition: border-color 160ms ease;
}

.question-input:hover,
.question-input:focus {
  border-bottom-color: rgba(189, 47, 44, 0.38);
}

.cup-arena {
  position: relative;
  width: min(100%, 620px);
  height: 360px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  perspective: 900px;
  isolation: isolate;
}

.cup-arena::before,
.cup-arena::after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 49px;
  width: 108px;
  height: 42px;
  border-top: 3px solid rgba(158, 63, 52, 0.18);
  border-bottom: 1px solid rgba(158, 63, 52, 0.15);
  background:
    linear-gradient(90deg, transparent 48%, rgba(158, 63, 52, 0.13) 48% 52%, transparent 52%),
    linear-gradient(rgba(158, 63, 52, 0.1) 48%, transparent 48% 52%, rgba(158, 63, 52, 0.1) 52%);
  background-size: 36px 18px;
  transform: skewY(-4deg);
}

.cup-arena::before { left: 54px; }
.cup-arena::after { right: 54px; transform: skewY(4deg); }

.aura {
  position: absolute;
  left: 50%;
  top: 51%;
  border: 1px solid rgba(189, 47, 44, 0.15);
  clip-path: polygon(28% 0, 72% 0, 100% 28%, 100% 72%, 72% 100%, 28% 100%, 0 72%, 0 28%);
  transform: translate(-50%, -50%);
  animation: breathe 4s ease-in-out infinite;
  pointer-events: none;
}

.aura-one {
  width: 330px;
  height: 330px;
}

.aura-two {
  width: 245px;
  height: 245px;
  border-color: rgba(170, 122, 61, 0.19);
  animation-delay: -2s;
}

@keyframes breathe {
  0%, 100% { opacity: 0.42; transform: translate(-50%, -50%) scale(0.97); }
  50% { opacity: 0.92; transform: translate(-50%, -50%) scale(1.03); }
}

.cup {
  position: relative;
  z-index: 2;
  width: 145px;
  height: 185px;
  transform-origin: 50% 80%;
  will-change: transform, filter;
}

.cup::after {
  content: "凸面";
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  min-width: 50px;
  padding: 4px 9px;
  border: 1px solid rgba(112, 32, 32, 0.26);
  border-radius: 999px;
  color: #fff8ed;
  background: #792126;
  box-shadow: 0 5px 14px rgba(70, 17, 20, 0.16);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  transition: opacity 160ms ease, background 160ms ease, color 160ms ease;
}

.cup-left::after {
  transform: translate(-50%, -50%) rotate(9deg);
}

.cup-right::after {
  transform: translate(-50%, -50%) rotate(-188deg);
}

.cup[data-face="flat"]::after {
  content: "平面";
  color: #64211e;
  background: #f2c58e;
}

.cup-arena.is-casting .cup::after {
  opacity: 0;
}

.cup-left {
  transform: rotate(-16deg) translateY(8px);
}

.cup-right {
  transform: rotate(196deg) translateY(-8px);
}

.cup-art {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cup-silhouette {
  fill: #5e1115;
  stroke: #5e1115;
  stroke-width: 7;
  stroke-linejoin: round;
}

.cup-flat {
  opacity: 0;
  transition: opacity 130ms linear;
}

.cup-flat-detail {
  fill: rgba(255, 226, 185, 0.14);
  stroke: rgba(255, 226, 185, 0.62);
  stroke-width: 3;
  opacity: 0;
  transition: opacity 130ms linear;
}

.cup[data-face="flat"] .cup-flat {
  opacity: 1;
}

.cup[data-face="flat"] .cup-flat-detail {
  opacity: 1;
}

.cup[data-face="flat"] .cup-curve,
.cup[data-face="flat"] .cup-highlight {
  opacity: 0;
}

.cup[data-face="flat"] .cup-art {
  filter: saturate(.72) brightness(1.18);
}

.cup-highlight {
  fill: rgba(255, 192, 161, 0.32);
  transition: opacity 130ms linear;
}

.cup-ridge {
  fill: none;
  stroke: rgba(255, 179, 151, 0.22);
  stroke-width: 3;
  stroke-linecap: round;
}

.cup-mark {
  fill: rgba(255, 238, 212, 0.82);
  font-family: "Songti SC", SimSun, serif;
  font-size: 18px;
  font-weight: 700;
}

.cup[data-face="flat"] .cup-mark {
  fill: rgba(255, 229, 205, 0.55);
}

.floor-shadow {
  position: absolute;
  z-index: 0;
  left: 50%;
  bottom: 55px;
  width: 305px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(80, 24, 20, 0.23), transparent 70%);
  filter: blur(4px);
  transform: translateX(-50%);
  transition: transform 500ms ease, opacity 500ms ease;
}

.cup-arena.is-casting .floor-shadow {
  opacity: 0.22;
  transform: translateX(-50%) scale(0.55);
}

.action-area {
  position: relative;
  z-index: 3;
}

.cast-button,
.again-button {
  min-width: 144px;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 24px;
  border: 1px solid var(--red-deep);
  border-radius: 6px;
  color: #fff9ef;
  background: linear-gradient(180deg, #cd3c35, #a52225);
  box-shadow: 0 10px 25px rgba(127, 25, 28, 0.22), inset 0 1px rgba(255, 255, 255, 0.2);
  cursor: pointer;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.cast-button:hover,
.again-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(127, 25, 28, 0.28), inset 0 1px rgba(255, 255, 255, 0.24);
  filter: saturate(1.08);
}

.cast-button:active,
.again-button:active {
  transform: translateY(1px) scale(0.98);
}

.cast-button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.cast-symbol {
  font-size: 23px;
  line-height: 1;
  transform: rotate(-12deg);
}

.gesture-hint {
  margin: 15px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.history-band {
  padding: 24px 0 28px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.culture-note {
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) 2fr;
  gap: 48px;
  padding: 50px 0;
  border-bottom: 1px solid var(--line);
  background: rgba(56, 104, 93, 0.055);
  box-shadow: 0 0 0 100vmax rgba(56, 104, 93, 0.055);
  clip-path: inset(0 -100vmax);
}

.culture-heading p {
  margin: 0 0 9px;
  color: var(--brick);
  font-family: Georgia, serif;
  font-size: 10px;
}

.culture-heading h2 {
  margin: 0;
  font-family: "Songti SC", SimSun, serif;
  font-size: 25px;
  line-height: 1.4;
}

.culture-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.culture-facts article {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.culture-facts article > span {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(56, 104, 93, 0.3);
  border-radius: 50%;
  color: var(--jade);
  font-family: "Songti SC", SimSun, serif;
  font-size: 12px;
}

.culture-facts h3 {
  margin: 1px 0 7px;
  font-family: "Songti SC", SimSun, serif;
  font-size: 16px;
}

.culture-facts p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.history-heading h2 {
  margin: 0;
  font-family: "Songti SC", SimSun, serif;
  font-size: 18px;
}

.text-button {
  padding: 5px 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.history-list {
  min-height: 58px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.history-item,
.history-empty {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 250, 242, 0.42);
}

.history-empty {
  grid-column: 1 / -1;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}

.history-glyph {
  flex: 0 0 auto;
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  font-family: "Songti SC", SimSun, serif;
  font-weight: 700;
}

.history-item[data-kind="xiao"] .history-glyph {
  background: var(--bronze);
}

.history-item[data-kind="yin"] .history-glyph {
  background: var(--jade);
}

.history-copy {
  min-width: 0;
  text-align: left;
}

.history-copy strong,
.history-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-copy strong {
  font-size: 13px;
}

.history-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.site-footer p {
  margin: 0;
}

.camera-panel {
  position: fixed;
  z-index: 40;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: min(260px, calc(100vw - 36px));
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  background: #151210;
  box-shadow: 0 18px 60px rgba(31, 17, 13, 0.3);
}

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

.camera-panel video,
.camera-panel canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-panel canvas {
  pointer-events: none;
}

.camera-status {
  position: absolute;
  left: 9px;
  right: 38px;
  bottom: 12px;
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border-radius: 5px;
  color: #fff;
  background: rgba(20, 17, 15, 0.72);
  backdrop-filter: blur(8px);
  font-size: 11px;
}

.gesture-guide {
  position: absolute;
  z-index: 2;
  top: 9px;
  left: 9px;
  padding: 6px 9px;
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(20, 17, 15, 0.68);
  backdrop-filter: blur(8px);
  font-size: 10px;
}

.gesture-guide span {
  padding: 0 3px;
  color: #ffb278;
}

.gesture-progress {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
}

.gesture-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: #f2a45e;
  transition: width 120ms linear, background 160ms ease;
}

.status-light {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #e5b047;
  box-shadow: 0 0 0 3px rgba(229, 176, 71, 0.18);
}

.status-light.ready {
  background: #63d39c;
  box-shadow: 0 0 0 3px rgba(99, 211, 156, 0.18);
}

.status-light.locked {
  background: #ff725f;
  box-shadow: 0 0 0 3px rgba(255, 114, 95, 0.22);
}

.camera-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: #fff;
  background: rgba(20, 17, 15, 0.62);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.result-layer {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
}

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

.result-backdrop {
  position: absolute;
  inset: 0;
  background: #934039;
  animation: backdrop-in 500ms cubic-bezier(.2, .8, .2, 1) both;
}

.result-layer[data-kind="xiao"] .result-backdrop {
  background: #9d713e;
}

.result-layer[data-kind="yin"] .result-backdrop {
  background: #356359;
}

.result-paper {
  position: relative;
  z-index: 1;
  width: min(92vw, 430px);
  min-height: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 42px 36px;
  border: 1px solid rgba(110, 50, 34, 0.24);
  border-radius: 4px;
  background:
    linear-gradient(90deg, rgba(162, 106, 67, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(162, 106, 67, 0.05) 1px, transparent 1px),
    #fff9ee;
  background-size: 18px 18px;
  box-shadow: 0 30px 100px rgba(72, 17, 18, 0.35);
  text-align: center;
  animation: paper-in 720ms cubic-bezier(.16, 1, .3, 1) 100ms both;
}

.result-paper::before,
.result-paper::after {
  content: "";
  position: absolute;
  width: 19px;
  height: 19px;
  border-color: rgba(189, 47, 44, 0.52);
  border-style: solid;
}

.result-paper::before {
  top: 14px;
  left: 14px;
  border-width: 2px 0 0 2px;
}

.result-paper::after {
  right: 14px;
  bottom: 14px;
  border-width: 0 2px 2px 0;
}

.result-kicker {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.result-glyph {
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
  border: 2px solid var(--red);
  border-radius: 50%;
  color: var(--red);
  font-family: "Songti SC", SimSun, serif;
  font-size: 92px;
  font-weight: 700;
  line-height: 1;
  box-shadow: inset 0 0 0 8px rgba(189, 47, 44, 0.06);
}

.result-paper[data-kind="xiao"] .result-glyph {
  color: var(--bronze);
  border-color: var(--bronze);
  box-shadow: inset 0 0 0 8px rgba(170, 122, 61, 0.07);
}

.result-paper[data-kind="yin"] .result-glyph {
  color: var(--jade);
  border-color: var(--jade);
  box-shadow: inset 0 0 0 8px rgba(63, 110, 98, 0.07);
}

.result-paper h2 {
  margin: 18px 0 4px;
  font-family: "Songti SC", SimSun, serif;
  font-size: 30px;
}

.result-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.result-face-map {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 17px;
}

.result-face-map em {
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 19px;
  font-style: normal;
}

.result-face {
  min-width: 72px;
  display: grid;
  grid-template-columns: 30px auto;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(99, 36, 31, 0.18);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.52);
}

.result-face i {
  position: relative;
  width: 29px;
  height: 16px;
  display: block;
  overflow: hidden;
  border: 2px solid #722024;
  border-radius: 50% 50% 44% 44%;
  background: linear-gradient(180deg, #ed6957, #9e2728);
  box-shadow: inset 0 3px 3px rgba(255, 214, 181, 0.36);
}

.result-face[data-face="flat"] i {
  height: 10px;
  border-radius: 3px;
  background: #e4ab72;
  box-shadow: inset 0 2px rgba(255, 235, 205, 0.55);
}

.result-face b {
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.result-divider {
  width: 160px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 19px 0 20px;
}

.result-divider span {
  height: 1px;
  flex: 1;
  background: var(--line);
}

.result-divider i {
  width: 7px;
  height: 7px;
  border: 1px solid var(--red);
  transform: rotate(45deg);
}

.result-message {
  max-width: 310px;
  margin: 0;
  font-family: "Songti SC", SimSun, serif;
  font-size: 17px;
  line-height: 1.8;
}

.result-culture-note {
  max-width: 315px;
  margin: 13px 0 0;
  padding-top: 12px;
  border-top: 1px dashed rgba(64, 40, 29, 0.15);
  color: var(--jade);
  font-size: 11px;
  line-height: 1.7;
}

.result-question {
  max-width: 320px;
  margin: 12px 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.again-button {
  min-height: 44px;
  margin-top: 28px;
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes paper-in {
  0% { opacity: 0; transform: translateY(40px) rotate(-2deg) scale(0.9); }
  58% { opacity: 1; transform: translateY(-7px) rotate(0.5deg) scale(1.015); }
  100% { opacity: 1; transform: translateY(0) rotate(0) scale(1); }
}

.toast {
  position: fixed;
  z-index: 150;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: calc(100vw - 40px);
  padding: 10px 14px;
  border-radius: 6px;
  color: #fff;
  background: rgba(30, 25, 22, 0.9);
  box-shadow: var(--shadow);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 760px) {
  .app-shell {
    padding: 0 18px 22px;
  }

  .topbar {
    height: 66px;
  }

  .brand-copy small {
    display: none;
  }

  .music-panel {
    position: fixed;
    top: 62px;
    right: 14px;
    left: 14px;
    width: auto;
  }

  .module-link {
    min-height: 36px;
    padding: 0 3px;
    font-size: 12px;
  }

  .gesture-toggle {
    min-height: 36px;
    padding: 0 10px;
  }

  .yanwei-divider {
    height: 28px;
  }

  .ritual-stage {
    min-height: 650px;
    grid-template-rows: auto minmax(330px, 1fr) auto;
    padding: 27px 0 34px;
  }

  .question-line {
    gap: 2px;
    font-size: clamp(24px, 7.5vw, 34px);
  }

  .question-input {
    width: min(78vw, 480px);
  }

  .cup-arena {
    height: 340px;
    gap: 4px;
  }

  .cup {
    width: 128px;
    height: 166px;
  }

  .aura-one {
    width: 290px;
    height: 290px;
  }

  .aura-two {
    width: 214px;
    height: 214px;
  }

  .history-list {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 3px;
  }

  .history-item {
    min-width: 145px;
    scroll-snap-align: start;
  }

  .history-empty {
    width: 100%;
    flex: 0 0 100%;
  }

  .culture-note {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 38px 0;
  }

  .culture-facts {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .result-paper {
    min-height: min(620px, calc(100vh - 40px));
    padding: 34px 28px 28px;
  }

  .result-glyph {
    width: 132px;
    height: 132px;
    font-size: 78px;
  }
}

@media (max-width: 420px) {
  .brand-copy strong {
    font-size: 17px;
  }

  .brand {
    gap: 7px;
  }

  .brand-seal {
    width: 31px;
    height: 31px;
  }

  .top-actions {
    gap: 6px;
  }

  .module-link {
    display: none;
  }

  .gesture-toggle {
    padding: 0 8px;
    font-size: 12px;
  }

  .ritual-stage {
    min-height: 610px;
    padding-top: 32px;
  }

  .eyebrow {
    margin-bottom: 12px;
  }

  .cup-arena {
    height: 320px;
  }

  .cup {
    width: 112px;
    height: 150px;
  }

  .floor-shadow {
    width: 250px;
  }
}

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