:root {
  --ink: #130b09;
  --wine: #3b070d;
  --wine-2: #6e1018;
  --red: #c93425;
  --red-bright: #e04d34;
  --gold: #d8ae64;
  --gold-light: #fff0bd;
  --paper: #f7ead0;
  --paper-2: #e4c88f;
  --jade: #183d34;
  --white: #fff9ec;
  --muted: rgba(255, 249, 236, 0.68);
  --glass: rgba(255, 249, 236, 0.1);
  --line: rgba(255, 240, 189, 0.24);
  --shadow: 0 34px 100px rgba(8, 2, 2, 0.45);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--white);
  font-family: "Source Han Serif SC", "Noto Serif CJK SC", "STSong", "SimSun", serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(224, 77, 52, 0.34), transparent 28rem),
    radial-gradient(circle at 78% 16%, rgba(216, 174, 100, 0.22), transparent 26rem),
    linear-gradient(135deg, #170606 0%, #3c070d 42%, #120707 100%);
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.texture {
  position: fixed;
  inset: 0;
  z-index: -5;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 249, 236, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 249, 236, 0.035) 1px, transparent 1px),
    repeating-linear-gradient(116deg, rgba(216, 174, 100, 0.06) 0 1px, transparent 1px 11px);
  background-size: 38px 38px, 38px 38px, 100% 100%;
  mask-image: radial-gradient(circle at 50% 18%, black, transparent 78%);
}

.silk-field {
  position: fixed;
  inset: 0;
  z-index: -4;
  pointer-events: none;
  overflow: hidden;
}

.silk-field span {
  position: absolute;
  display: block;
  width: 82rem;
  height: 12rem;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(201, 52, 37, 0.52), rgba(216, 174, 100, 0.32), transparent);
  filter: blur(3px);
  opacity: 0.4;
}

.silk-field span:nth-child(1) {
  top: 6rem;
  left: -28rem;
  transform: rotate(-15deg);
}

.silk-field span:nth-child(2) {
  right: -30rem;
  bottom: 7rem;
  transform: rotate(18deg);
  opacity: 0.34;
}

.silk-field span:nth-child(3) {
  top: 46%;
  left: 18%;
  width: 48rem;
  transform: rotate(34deg);
  opacity: 0.18;
}

.site-header {
  position: fixed;
  top: 20px;
  left: 50%;
  z-index: 20;
  display: flex;
  width: min(1180px, calc(100% - 34px));
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 240, 189, 0.2);
  border-radius: 999px;
  background: rgba(31, 7, 8, 0.64);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(22px);
  transform: translateX(-50%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(255, 240, 189, 0.42);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 249, 236, 0.98), rgba(255, 230, 176, 0.8) 62%, rgba(110, 16, 24, 0.34)),
    var(--paper);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.24),
    inset 0 0 0 5px rgba(110, 16, 24, 0.08);
  overflow: hidden;
}

.brand-mark img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  transform: scale(1.2);
}

.brand strong,
.brand em {
  display: block;
}

.brand strong {
  font-size: 1.08rem;
  letter-spacing: 0.08em;
}

.brand em {
  margin-top: 2px;
  color: rgba(255, 249, 236, 0.58);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.72rem;
  font-style: normal;
  letter-spacing: 0.18em;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.nav-button,
.btn,
.round-button,
.mode,
.icon-button {
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.nav-button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255, 240, 189, 0.18);
  border-radius: 999px;
  background: rgba(255, 249, 236, 0.08);
  color: var(--white);
}

.nav-button.primary {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #2a0908;
  font-weight: 900;
}

.nav-button:hover,
.btn:hover,
.round-button:hover,
.draw-button:hover,
.mode:hover,
.icon-button:hover {
  transform: translateY(-2px);
}

main {
  width: min(1180px, calc(100% - 34px));
  margin: 0 auto;
}

.poster {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(280px, 0.72fr) minmax(420px, 1.28fr);
  gap: clamp(24px, 4vw, 54px);
  align-items: center;
  padding: 128px 0 42px;
}

.poster-copy {
  position: relative;
  z-index: 2;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 500px;
  margin-bottom: 22px;
  font-family: "SimHei", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: clamp(2.9rem, 5.4vw, 4.8rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 1.08;
  text-shadow: 0 22px 70px rgba(0, 0, 0, 0.36);
}

.lead {
  max-width: 470px;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.16rem);
  line-height: 2;
}

.hero-actions,
.control-row,
.stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.hero-actions {
  margin-top: 34px;
}

.btn {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border-radius: 999px;
}

.btn.gold {
  background: linear-gradient(135deg, #fff2c6, var(--gold) 48%, #9a6428);
  color: #2a0908;
  font-weight: 900;
  box-shadow: 0 18px 46px rgba(216, 174, 100, 0.25);
}

.btn.glass {
  border: 1px solid rgba(255, 240, 189, 0.22);
  background: rgba(255, 249, 236, 0.1);
  color: var(--white);
}

.btn.glass.dark {
  color: var(--wine);
  border-color: rgba(59, 7, 13, 0.16);
  background: rgba(255, 249, 236, 0.7);
}

.btn.danger {
  border: 1px solid rgba(142, 24, 31, 0.18);
  background: rgba(142, 24, 31, 0.08);
  color: var(--wine);
}

.motto-card {
  width: min(390px, 100%);
  margin-top: 42px;
  padding: 18px 20px;
  border: 1px solid rgba(255, 240, 189, 0.16);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 249, 236, 0.12), rgba(255, 249, 236, 0.03));
  backdrop-filter: blur(12px);
}

.motto-card span {
  display: block;
  margin-bottom: 7px;
  color: rgba(255, 249, 236, 0.5);
  font-size: 0.78rem;
  letter-spacing: 0.2em;
}

.motto-card strong {
  color: #fff0bd;
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 1.45rem;
  letter-spacing: 0.05em;
}

.stage {
  position: relative;
  min-height: min(720px, calc(100vh - 170px));
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid rgba(255, 240, 189, 0.22);
  border-radius: clamp(30px, 5vw, 58px);
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 239, 189, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(66, 7, 12, 0.95), rgba(16, 7, 7, 0.95));
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
}

.stage::before {
  position: absolute;
  inset: 18px;
  z-index: -1;
  content: "";
  border: 1px solid rgba(255, 240, 189, 0.16);
  border-radius: clamp(22px, 4vw, 44px);
}

.stage::after {
  position: absolute;
  right: 7%;
  bottom: -9%;
  left: 7%;
  z-index: -1;
  height: 30%;
  content: "";
  border-radius: 50% 50% 0 0;
  background:
    radial-gradient(ellipse at center, rgba(216, 174, 100, 0.28), transparent 62%),
    repeating-linear-gradient(90deg, rgba(255, 240, 189, 0.1) 0 1px, transparent 1px 34px);
  transform: perspective(600px) rotateX(64deg);
}

.stage-halo {
  position: absolute;
  top: 12%;
  left: 50%;
  width: min(52vw, 580px);
  height: min(52vw, 580px);
  border: 1px solid rgba(255, 240, 189, 0.18);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 240, 189, 0.22), transparent 58%),
    conic-gradient(from 20deg, rgba(216, 174, 100, 0.2), transparent, rgba(224, 77, 52, 0.24), transparent);
  filter: blur(0.2px);
  transform: translateX(-50%);
  animation: slowSpin 24s linear infinite;
}

.stage-emblem {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 0;
  width: min(54vw, 560px);
  max-width: 78%;
  opacity: 0.075;
  filter:
    sepia(1)
    saturate(1.8)
    hue-rotate(330deg)
    drop-shadow(0 20px 42px rgba(0, 0, 0, 0.2));
  mix-blend-mode: screen;
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(-8deg);
}

.curtain {
  position: absolute;
  top: -12%;
  bottom: -8%;
  width: 34%;
  opacity: 0.56;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 18px),
    linear-gradient(90deg, rgba(50, 3, 7, 0.2), rgba(224, 77, 52, 0.72), rgba(60, 4, 9, 0.46));
  filter: blur(0.2px);
}

.curtain.left {
  left: -12%;
  transform: skewX(-10deg);
}

.curtain.right {
  right: -12%;
  transform: skewX(10deg);
}

.stage-topline {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mode-switch {
  display: inline-flex;
  padding: 5px;
  border: 1px solid rgba(255, 240, 189, 0.18);
  border-radius: 999px;
  background: rgba(255, 249, 236, 0.08);
}

.mode {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 249, 236, 0.7);
}

.mode.active {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: #2a0908;
  font-weight: 900;
}

.opera-art {
  position: absolute;
  inset: 72px 4% 94px;
  z-index: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.opera-art svg {
  display: none;
}

.opera-mask {
  width: min(68%, 520px);
  max-height: 82%;
  object-fit: contain;
  opacity: 0.94;
  filter: drop-shadow(0 28px 48px rgba(0, 0, 0, 0.34));
  transform: translateY(-1%);
  animation: floatMask 7s ease-in-out infinite alternate;
}

.name-stage {
  position: absolute;
  right: clamp(18px, 4vw, 54px);
  bottom: clamp(116px, 13vw, 160px);
  left: clamp(18px, 4vw, 54px);
  z-index: 4;
  text-align: center;
}

.name-stage p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.name-stage h2 {
  margin: 0;
}

.name-stage h2 span {
  display: inline-block;
  max-width: 100%;
  padding: 12px 28px 18px;
  color: var(--gold-light);
  font-family: "KaiTi", "STKaiti", serif;
  font-size: clamp(3.4rem, 9vw, 8.4rem);
  font-weight: 900;
  line-height: 0.95;
  text-shadow:
    0 10px 32px rgba(0, 0, 0, 0.55),
    0 0 38px rgba(216, 174, 100, 0.22);
  word-break: break-word;
}

.name-stage strong {
  display: block;
  margin-top: 8px;
  color: rgba(255, 249, 236, 0.72);
  font-weight: 500;
}

.stage-actions {
  position: absolute;
  right: 0;
  bottom: 34px;
  left: 0;
  z-index: 5;
  justify-content: center;
}

.draw-button {
  position: relative;
  min-width: min(76vw, 310px);
  min-height: 76px;
  padding: 0 34px;
  border-radius: 999px;
  background:
    linear-gradient(135deg, #fff7d9 0%, var(--gold-light) 18%, var(--gold) 55%, #8d5b23 100%),
    var(--gold);
  color: #2a0908;
  cursor: pointer;
  font-size: 1.26rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  box-shadow:
    0 24px 62px rgba(216, 174, 100, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
  overflow: hidden;
}

.draw-button::before {
  position: absolute;
  inset: -40% -20%;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.48), transparent);
  transform: translateX(-80%) rotate(12deg);
  transition: transform 540ms ease;
}

.draw-button:hover::before {
  transform: translateX(80%) rotate(12deg);
}

.draw-button:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.draw-button span {
  position: relative;
  z-index: 1;
}

.round-button {
  min-height: 50px;
  padding: 0 18px;
  border: 1px solid rgba(255, 240, 189, 0.2);
  border-radius: 999px;
  background: rgba(255, 249, 236, 0.08);
  color: var(--white);
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  justify-items: end;
}

.overlay-scrim {
  position: absolute;
  inset: 0;
  background: rgba(8, 2, 2, 0.58);
  backdrop-filter: blur(10px);
}

.drawer {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  height: 100%;
  padding: 28px;
  overflow: auto;
  background:
    radial-gradient(circle at 80% 0%, rgba(216, 174, 100, 0.28), transparent 18rem),
    linear-gradient(180deg, #fff6e6, #ead3a8);
  color: var(--ink);
  box-shadow: -30px 0 80px rgba(0, 0, 0, 0.34);
  animation: drawerIn 240ms ease both;
}

.compact-drawer {
  width: min(460px, 100%);
}

.drawer .eyebrow {
  color: var(--wine-2);
}

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

.drawer-head h2 {
  margin-bottom: 0;
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 2.5rem;
  line-height: 1;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(59, 7, 13, 0.14);
  border-radius: 50%;
  background: rgba(255, 249, 236, 0.62);
  color: var(--wine);
  font-size: 1.6rem;
}

.field-grid {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  color: rgba(19, 11, 9, 0.72);
  font-size: 0.92rem;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(59, 7, 13, 0.16);
  border-radius: 18px;
  outline: 0;
  background: rgba(255, 249, 236, 0.78);
  color: var(--ink);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

input {
  height: 48px;
  padding: 0 15px;
}

textarea {
  min-height: 210px;
  padding: 14px 15px;
  resize: vertical;
  line-height: 1.7;
}

input:focus,
textarea:focus {
  border-color: rgba(110, 16, 24, 0.5);
  background: rgba(255, 249, 236, 0.95);
  box-shadow: 0 0 0 4px rgba(216, 174, 100, 0.2);
}

.drop-zone {
  min-height: 112px;
  margin: 18px 0;
  place-items: center;
  padding: 18px;
  border: 1px dashed rgba(110, 16, 24, 0.3);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 249, 236, 0.7), rgba(216, 174, 100, 0.22)),
    rgba(255, 249, 236, 0.45);
  cursor: pointer;
  text-align: center;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-zone span {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(110, 16, 24, 0.1);
  color: var(--wine-2);
  font-weight: 900;
}

.drop-zone strong {
  color: var(--ink);
  font-weight: 500;
}

.textarea-label {
  margin-top: 4px;
}

.control-row {
  margin-top: 16px;
}

.drawer-note {
  margin: 16px 0 0;
  color: rgba(19, 11, 9, 0.62);
}

.music-card {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(59, 7, 13, 0.1);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 249, 236, 0.52), rgba(216, 174, 100, 0.12)),
    rgba(255, 249, 236, 0.38);
}

.audio-zone {
  min-height: 92px;
  margin: 0;
}

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

.music-row p {
  margin: 0;
  color: rgba(19, 11, 9, 0.62);
  font-size: 0.9rem;
  line-height: 1.6;
}

.name-cloud {
  display: flex;
  max-height: 210px;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  overflow: auto;
}

.name-cloud span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(59, 7, 13, 0.12);
  border-radius: 999px;
  background: rgba(255, 249, 236, 0.62);
  color: rgba(19, 11, 9, 0.72);
  font-size: 0.9rem;
}

.name-cloud .empty-note {
  width: 100%;
  justify-content: center;
  border-style: dashed;
}

.history-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.history-item,
.empty-state {
  border: 1px solid rgba(59, 7, 13, 0.12);
  border-radius: 18px;
  background: rgba(255, 249, 236, 0.58);
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
}

.history-item strong {
  display: block;
  color: var(--wine-2);
  font-size: 1.12rem;
}

.history-item span,
.history-item em {
  color: rgba(19, 11, 9, 0.6);
  font-size: 0.82rem;
}

.history-item em {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: rgba(110, 16, 24, 0.08);
  color: var(--wine-2);
  font-family: Georgia, "Times New Roman", serif;
  font-style: normal;
  font-weight: 900;
}

.empty-state {
  padding: 22px;
  text-align: center;
}

.empty-state p {
  margin: 8px 0 0;
  color: rgba(19, 11, 9, 0.58);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  max-width: min(360px, calc(100% - 44px));
  padding: 14px 18px;
  border: 1px solid rgba(255, 240, 189, 0.26);
  border-radius: 18px;
  background: rgba(24, 5, 6, 0.94);
  color: var(--white);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 220ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.reveal {
  animation: rise 720ms ease both;
}

.rolling #resultName {
  animation: pulseName 110ms ease infinite alternate;
}

.rolling .opera-mask {
  animation: rollShake 180ms ease infinite alternate;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(22px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slowSpin {
  to {
    transform: translateX(-50%) rotate(360deg);
  }
}

@keyframes floatMask {
  from {
    transform: translateY(2%) rotate(-1deg);
  }

  to {
    transform: translateY(-1%) rotate(1deg);
  }
}

@keyframes rollShake {
  from {
    transform: translateY(0) rotate(-1.2deg) scale(1);
  }

  to {
    transform: translateY(-1.5%) rotate(1.2deg) scale(1.01);
  }
}

@keyframes pulseName {
  from {
    transform: scale(0.99);
  }

  to {
    transform: scale(1.035);
  }
}

@keyframes drawerIn {
  from {
    opacity: 0;
    transform: translateX(32px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 980px) {
  .site-header {
    position: sticky;
    transform: none;
    left: auto;
    top: 12px;
    margin: 12px auto 0;
  }

  .poster {
    grid-template-columns: 1fr;
    padding-top: 48px;
  }

  .poster-copy {
    text-align: center;
  }

  .lead,
  .motto-card {
    margin-right: auto;
    margin-left: auto;
  }

  .hero-actions {
    justify-content: center;
  }

  .stage {
    min-height: 680px;
  }
}

@media (max-width: 680px) {
  .site-header {
    align-items: flex-start;
    border-radius: 28px;
  }

  .brand em {
    display: none;
  }

  .header-actions {
    flex-direction: column;
  }

  .nav-button {
    min-height: 38px;
    padding: 0 12px;
    font-size: 0.88rem;
  }

  main,
  .site-header {
    width: min(100% - 24px, 1180px);
  }

  h1 {
    font-size: clamp(2.65rem, 12vw, 4.2rem);
  }

  .stage {
    min-height: 620px;
    border-radius: 30px;
  }

  .stage-topline {
    display: block;
  }

  .mode-switch {
    margin-top: 10px;
  }

  .opera-art {
    inset: 100px -12% 140px;
  }

  .name-stage {
    bottom: 126px;
  }

  .name-stage h2 span {
    font-size: clamp(3rem, 16vw, 5.8rem);
  }

  .stage-actions {
    right: 22px;
    left: 22px;
  }

  .draw-button,
  .round-button,
  .hero-actions .btn {
    width: 100%;
  }

  .drawer {
    padding: 22px;
  }

  .music-row {
    display: block;
  }

  .music-row .btn {
    width: 100%;
    margin-top: 10px;
  }
}

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