:root {
  --bg: #071221;
  --surface: rgba(9, 24, 44, 0.82);
  --line: rgba(131, 178, 255, 0.28);
  --text: #e6f0ff;
  --muted: #99b4d8;
  --gold-1: #f8d27a;
  --gold-2: #c8923f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Microsoft YaHei UI", "Noto Sans SC", sans-serif;
  background:
    linear-gradient(180deg, rgba(4, 11, 21, 0.18), rgba(3, 10, 19, 0.6)),
    url("./wechat-reference.jpg") center top / cover no-repeat fixed;
}

.room-shell {
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px 14px 30px;
  position: relative;
}

.room-shell::before {
  content: "";
  position: absolute;
  inset: 10px 8px 12px;
  border-radius: 16px;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5, 12, 24, 0.45), rgba(7, 18, 34, 0.14) 50%, rgba(5, 12, 24, 0.4)),
    linear-gradient(180deg, rgba(7, 16, 31, 0.16), rgba(7, 16, 31, 0.36));
  z-index: 0;
}

.room-head {
  position: relative;
  z-index: 1;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.kicker {
  margin: 0;
  color: #8dc4ff;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 700;
}

.room-head h1 {
  margin: 8px 0;
  font-size: 32px;
}

.sub {
  margin: 0;
  color: #c8ddfc;
  line-height: 1.6;
}

.head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.layout {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 12px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 14px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.billing-strip {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(235, 197, 107, 0.3);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(52, 39, 12, 0.34), rgba(17, 29, 52, 0.48));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.billing-balance {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.billing-label {
  color: #d6e5fb;
  font-size: 13px;
}

#beanBalance {
  color: var(--gold-1);
  font-size: 24px;
  line-height: 1;
}

.billing-rules {
  color: #cbb98d;
  font-size: 13px;
}

.board-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  display: grid;
  place-items: center;
  background: rgba(13, 34, 62, 0.72);
}

.board-mount {
  width: min(100%, 760px);
  display: grid;
  place-items: center;
}

.control-row {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

select,
textarea,
button {
  font: inherit;
}

select,
textarea {
  border: 1px solid rgba(139, 180, 245, 0.5);
  border-radius: 10px;
  background: rgba(14, 33, 58, 0.9);
  color: var(--text);
  padding: 8px 10px;
}

textarea {
  width: 100%;
  resize: vertical;
}

.btn {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(139, 180, 245, 0.45);
  border-radius: 10px;
  background: rgba(15, 35, 63, 0.82);
  color: #dbe9ff;
  padding: 9px 12px;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(5, 16, 34, 0.34);
  transition:
    transform 0.18s ease,
    filter 0.2s ease,
    box-shadow 0.22s ease,
    border-color 0.22s ease,
    background-color 0.22s ease;
}

.btn::after {
  content: "";
  position: absolute;
  top: -35%;
  left: -120%;
  width: 52%;
  height: 170%;
  transform: rotate(18deg);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0.24),
    rgba(255, 255, 255, 0)
  );
  pointer-events: none;
  transition: left 0.48s ease;
}

.btn:hover {
  border-color: rgba(180, 216, 255, 0.72);
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 12px 26px rgba(8, 22, 45, 0.44);
}

.btn:hover::after {
  left: 128%;
}

.btn:active,
.btn.is-pressed {
  transform: translateY(0) scale(0.975);
  box-shadow: 0 4px 12px rgba(8, 20, 40, 0.35);
}

.btn-primary {
  color: #342104;
  border-color: rgba(237, 186, 100, 0.9);
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  font-weight: 700;
  animation: primaryPulse 2.8s ease-in-out infinite;
}

#btnShashaMove {
  position: relative;
  z-index: 1;
}

#btnShashaMove::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 14px;
  border: 1px solid rgba(248, 210, 122, 0.45);
  box-shadow:
    0 0 0 0 rgba(248, 210, 122, 0.32),
    0 0 22px rgba(200, 146, 63, 0.26);
  opacity: 0.7;
  pointer-events: none;
  animation: shashaHalo 2.2s ease-out infinite;
}

.btn-ghost {
  background: rgba(15, 35, 63, 0.58);
}

@keyframes primaryPulse {
  0%,
  100% {
    box-shadow: 0 8px 18px rgba(5, 16, 34, 0.34);
  }
  50% {
    box-shadow: 0 11px 24px rgba(194, 144, 61, 0.3);
  }
}

@keyframes shashaHalo {
  0% {
    transform: scale(1);
    opacity: 0.75;
    box-shadow:
      0 0 0 0 rgba(248, 210, 122, 0.28),
      0 0 20px rgba(200, 146, 63, 0.24);
  }
  70% {
    transform: scale(1.045);
    opacity: 0.08;
    box-shadow:
      0 0 0 12px rgba(248, 210, 122, 0),
      0 0 28px rgba(200, 146, 63, 0.1);
  }
  100% {
    transform: scale(1);
    opacity: 0;
    box-shadow:
      0 0 0 0 rgba(248, 210, 122, 0),
      0 0 20px rgba(200, 146, 63, 0);
  }
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chat-log {
  min-height: 420px;
  max-height: 56vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: rgba(9, 24, 44, 0.95);
  display: grid;
  gap: 8px;
}

.chat-item {
  padding: 8px 10px;
  border-radius: 8px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.chat-item.user {
  background: rgba(34, 76, 138, 0.42);
}

.chat-item.bot {
  background: rgba(29, 59, 42, 0.42);
}

.chat-meta {
  color: #9bb6dd;
  font-size: 12px;
  margin-bottom: 3px;
}

.chat-input-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: end;
}

.voice-stack {
  display: grid;
  gap: 6px;
  align-content: end;
  justify-items: center;
  min-width: 112px;
}

.btn-voice {
  width: 100%;
  font-weight: 700;
  border-color: rgba(130, 201, 255, 0.6);
}

.voice-viz {
  width: 100%;
  height: 26px;
  border: 1px solid rgba(137, 194, 255, 0.35);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(10, 31, 57, 0.85), rgba(6, 20, 38, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 10px;
  opacity: 0.72;
  box-shadow: inset 0 0 20px rgba(53, 147, 255, 0.08);
}

.voice-viz span {
  width: 4px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #9cd4ff, #42abff);
  transform-origin: center bottom;
  animation: voiceIdle 1.6s ease-in-out infinite;
  animation-play-state: paused;
}

.voice-viz span:nth-child(2) {
  animation-delay: 0.1s;
}

.voice-viz span:nth-child(3) {
  animation-delay: 0.2s;
}

.voice-viz span:nth-child(4) {
  animation-delay: 0.3s;
}

.voice-viz span:nth-child(5) {
  animation-delay: 0.4s;
}

.voice-stack.is-recording .btn-voice {
  color: #3b1806;
  border-color: rgba(255, 169, 120, 0.95);
  background: linear-gradient(180deg, #ffcfab, #ff9d67);
}

.voice-stack.is-recording .voice-viz {
  border-color: rgba(255, 176, 130, 0.85);
  box-shadow:
    inset 0 0 20px rgba(255, 138, 79, 0.2),
    0 0 16px rgba(255, 138, 79, 0.22);
  opacity: 1;
}

.voice-stack.is-recording .voice-viz span {
  animation-play-state: running;
  animation-duration: 0.7s;
  background: linear-gradient(180deg, #ffd2b6, #ff955d);
}

.voice-stack.is-transcribing .btn-voice {
  border-color: rgba(248, 210, 122, 0.95);
  background: linear-gradient(180deg, rgba(248, 210, 122, 0.92), rgba(201, 147, 65, 0.95));
  color: #3a2507;
}

.voice-stack.is-transcribing .voice-viz {
  border-color: rgba(248, 210, 122, 0.72);
  opacity: 1;
}

.voice-stack.is-transcribing .voice-viz span {
  animation-play-state: running;
  animation-duration: 1s;
  background: linear-gradient(180deg, #ffe6a8, #e3b14d);
}

.voice-stack.is-disabled {
  opacity: 0.58;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .room-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-log {
    min-height: 260px;
    max-height: 42vh;
  }

  .billing-strip {
    align-items: flex-start;
  }

  .billing-balance {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .chat-input-row {
    grid-template-columns: 1fr;
  }

  .voice-stack {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn::after,
  .btn-primary,
  #btnShashaMove::before,
  .voice-viz span {
    transition: none;
    animation: none;
  }

  .btn:hover,
  .btn:active,
  .btn.is-pressed {
    transform: none;
    box-shadow: 0 8px 18px rgba(5, 16, 34, 0.34);
  }
}

.chat-input-wrapper {
  position: relative;
  width: 100%;
}

.chat-prompt-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.chat-prompt-list {
  padding: 8px 0;
}

.chat-prompt-item {
  padding: 10px 16px;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 14px;
  width: 100%;
  transition: background-color 0.2s;
}

.chat-prompt-item:hover {
  background-color: rgba(131, 178, 255, 0.15);
}

.chat-prompt-item.selected {
  background-color: rgba(248, 210, 122, 0.2);
  color: var(--gold-1);
}

.chat-prompt-item-placeholder {
  padding: 12px 16px;
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  text-align: center;
}

@keyframes voiceIdle {
  0%,
  100% {
    transform: scaleY(0.55);
    opacity: 0.65;
  }
  50% {
    transform: scaleY(1.85);
    opacity: 1;
  }
}
