/* 酒话 · 376 ABOVE
   Palette and type borrowed from the 376 ABOVE mini program. */

:root {
  --bg: #101214;
  --bg-deep: #0b0d0f;
  --surface: #191b1d;
  --surface-2: #1e2022;
  --line: rgba(242, 234, 223, 0.12);
  --line-strong: rgba(242, 234, 223, 0.2);
  --text: #f2eadf;
  --text-2: #a1988d;
  --text-3: #7c766e;
  --gold: #c9a96a;
  --gold-2: #d8c08a;
  --gold-dim: rgba(201, 169, 106, 0.22);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Noto Serif CJK SC",
    "Source Han Serif SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    Arial, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overscroll-behavior-y: none;
  touch-action: manipulation;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

img {
  display: block;
}

/* ── atmosphere ─────────────────────────────────────────── */

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(80% 46% at 12% -8%, rgba(201, 169, 106, 0.1), transparent 62%),
    radial-gradient(60% 40% at 100% 104%, rgba(201, 169, 106, 0.055), transparent 60%),
    radial-gradient(120% 80% at 50% 50%, transparent 40%, rgba(0, 0, 0, 0.35) 100%);
}

.bg-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── shell ──────────────────────────────────────────────── */

.app {
  position: relative;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 22px;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  height: calc(52px + env(safe-area-inset-top, 0px));
}

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

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid rgba(201, 169, 106, 0.32);
  object-fit: cover;
}

.brand-name {
  font-size: 10px;
  letter-spacing: 0.24em;
  color: var(--gold);
  white-space: nowrap;
}

.badge {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px 3px 10px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 6px;
}

/* ── hero ───────────────────────────────────────────────── */

.hero {
  padding: 10px 2px 20px;
}

.title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(46px, 15.5vw, 58px);
  line-height: 1.08;
  letter-spacing: 0.14em;
  color: #f7efe3;
}

.subtitle {
  margin: 10px 0 0;
  max-width: 300px;
  font-size: 13px;
  line-height: 1.75;
  letter-spacing: 0.03em;
  color: var(--text-2);
}

.pool {
  margin: 16px 0 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.pool-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(201, 169, 106, 0.7);
}

/* ── card ───────────────────────────────────────────────── */

.card {
  position: relative;
  height: clamp(296px, 46vh, 404px);
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background:
    linear-gradient(165deg, #1b1d1f 0%, #16181a 52%, #141618 100%);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(242, 234, 223, 0.045);
  overflow: hidden;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    120% 60% at 50% -10%,
    rgba(201, 169, 106, 0.07),
    transparent 60%
  );
}

.panel {
  position: relative;
  z-index: 1;
  display: none;
  flex-direction: column;
  height: 100%;
}

body[data-view="idle"] .panel-idle,
body[data-view="play"] .panel-play,
body[data-view="recordIntro"] .panel-record-intro,
body[data-view="recording"] .panel-recording,
body[data-view="preview"] .panel-preview {
  display: flex;
}

/* idle */

.panel-idle {
  align-items: center;
  justify-content: center;
  gap: 24px;
  text-align: center;
}

.orb {
  position: relative;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  border: 1px solid rgba(201, 169, 106, 0.3);
  display: grid;
  place-items: center;
  animation: breathe 6s ease-in-out infinite;
}

.orb::before {
  content: "";
  position: absolute;
  inset: 17px;
  border-radius: 50%;
  border: 1px dashed rgba(201, 169, 106, 0.18);
  animation: spin 28s linear infinite;
}

.orb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 26px rgba(201, 169, 106, 0.55);
}

.idle-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.14em;
  color: var(--text);
}

.idle-sub {
  margin: 8px 0 0;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--text-3);
}

/* panel head */

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--text-3);
  flex: 0 0 auto;
  min-height: 18px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-2);
}

.dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gold);
}

.dot.live {
  animation: pulse 1.4s ease-in-out infinite;
}

.time-label {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* wave */

.wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 72px;
  margin: 10px 0;
  flex: 1;
}

.wave i {
  display: block;
  width: 3px;
  height: var(--h, 40%);
  border-radius: 3px;
  background: linear-gradient(
    180deg,
    var(--gold-2) 0%,
    rgba(201, 169, 106, 0.28) 100%
  );
  transform: scaleY(0.4);
  opacity: 0.5;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.wave.playing i {
  opacity: 1;
  animation: bar 1.2s ease-in-out infinite alternate;
  animation-delay: var(--d, 0s);
}

.wave.live i {
  opacity: 0.9;
  transform: scaleY(var(--s, 0.08));
  transition: none;
  animation: none;
}

/* progress */

.progress {
  position: relative;
  height: 2px;
  border-radius: 2px;
  background: rgba(242, 234, 223, 0.1);
  overflow: hidden;
  flex: 0 0 auto;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  transition: width 0.18s linear;
}

/* play */

.panel-play {
  justify-content: space-between;
}

.play-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
}

.remain {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.play-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  color: var(--text);
  display: grid;
  place-items: center;
  transition: transform 0.15s ease, border-color 0.2s ease;
}

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

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

.icon-btn.more {
  font-size: 14px;
  letter-spacing: 0.05em;
  color: var(--text-2);
  line-height: 1;
  padding-bottom: 4px;
}

.text-btn {
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-2);
  padding: 10px 8px;
  transition: color 0.2s ease;
}

.text-btn:active {
  color: var(--gold-2);
}

.text-btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

.text-btn.subtle {
  color: var(--text-3);
  font-size: 12px;
}

.more-wrap {
  position: relative;
}

.menu {
  position: absolute;
  right: 0;
  bottom: 46px;
  min-width: 132px;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #202224;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  z-index: 5;
}

.menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 9px;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: #d8a795;
}

.menu button:active {
  background: rgba(242, 234, 223, 0.06);
}

.tap-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 4;
  padding: 11px 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #14110d;
  font-size: 13px;
  letter-spacing: 0.08em;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.tap-play:active {
  transform: translate(-50%, -50%) scale(0.97);
}

/* record intro */

.panel-record-intro {
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.mic {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 1px solid rgba(201, 169, 106, 0.3);
  display: grid;
  place-items: center;
  color: var(--gold);
  margin-bottom: 4px;
}

.mic svg {
  width: 22px;
  height: 22px;
}

.rec-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.12em;
  color: var(--text);
}

.rec-warn {
  margin: 6px 0 14px;
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--text-3);
}

.panel-record-intro .btn {
  max-width: 260px;
}

/* recording */

.timer {
  font-family: var(--serif);
  font-size: clamp(40px, 13vw, 52px);
  line-height: 1.15;
  letter-spacing: 0.04em;
  color: #f7efe3;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.timer-total {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.panel-recording {
  justify-content: space-between;
}

.rec-hint {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--text-3);
  text-align: center;
  flex: 0 0 auto;
}

/* preview */

.panel-preview {
  justify-content: space-between;
}

.preview-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 6px 0 4px;
  flex: 0 0 auto;
}

.panel-preview .btn {
  flex: 0 0 auto;
}

/* buttons */

.btn {
  width: 100%;
  height: 52px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14.5px;
  letter-spacing: 0.08em;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.btn-gold {
  background: linear-gradient(180deg, #d8c08a 0%, #c9a96a 100%);
  color: #14110d;
  font-weight: 600;
  box-shadow:
    0 12px 32px rgba(201, 169, 106, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-ghost {
  background: rgba(242, 234, 223, 0.02);
  border-color: var(--line-strong);
  color: var(--text);
}

.btn:active {
  transform: scale(0.985);
}

.btn[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

/* actions */

.actions {
  margin-top: auto;
  padding: 16px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body:not([data-view="idle"]):not([data-view="play"]) .actions {
  display: none;
}

/* focused states: keep hero + card optically centred */
body[data-view="recordIntro"] .main,
body[data-view="recording"] .main,
body[data-view="preview"] .main {
  justify-content: center;
}

/* footer */

.foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 16px 0 calc(14px + var(--safe-bottom));
  font-size: 9.5px;
  letter-spacing: 0.3em;
  color: #5e5b55;
  text-indent: 0.3em;
}

.foot-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.foot .icp {
  font-size: 9px;
  letter-spacing: 0.08em;
  text-indent: 0;
  color: #4f4c47;
  text-decoration: none;
}

.foot .icp:active {
  color: var(--gold);
}

.foot i {
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #4a4742;
}

.foot a {
  color: #5e5b55;
  text-decoration: none;
}

.foot a:active {
  color: var(--gold);
}

.rec-legal {
  margin: -4px 0 10px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--text-3);
}

.rec-legal a {
  color: var(--text-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── privacy doc ────────────────────────────────────────── */

.doc {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 22px calc(40px + var(--safe-bottom));
  line-height: 1.85;
}

.doc-back {
  display: inline-block;
  margin-bottom: 22px;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--gold);
  text-decoration: none;
}

.doc h1 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: #f7efe3;
}

.doc .doc-meta {
  margin: 0 0 26px;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.doc h2 {
  margin: 28px 0 8px;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--gold);
  font-weight: 600;
}

.doc p,
.doc li {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-2);
}

.doc ul {
  margin: 0 0 10px;
  padding-left: 18px;
}

.doc li::marker {
  color: var(--gold);
}

.doc strong {
  color: var(--text);
  font-weight: 500;
}

.doc a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.doc hr {
  margin: 26px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  transform: translate(-50%, 10px);
  max-width: min(84vw, 340px);
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(30, 32, 34, 0.94);
  color: var(--text);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 60;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

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

/* ── keyframes ──────────────────────────────────────────── */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
    border-color: rgba(201, 169, 106, 0.26);
  }
  50% {
    transform: scale(1.035);
    border-color: rgba(201, 169, 106, 0.42);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(201, 169, 106, 0.35);
  }
  50% {
    opacity: 0.6;
    box-shadow: 0 0 0 4px rgba(201, 169, 106, 0);
  }
}

@keyframes bar {
  from {
    transform: scaleY(0.32);
  }
  to {
    transform: scaleY(1);
  }
}

/* ── responsive / a11y ──────────────────────────────────── */

@media (max-height: 700px) {
  .hero {
    padding: 4px 2px 14px;
  }
  .title {
    font-size: 44px;
  }
  .card {
    height: 288px;
    padding: 18px;
  }
  .btn {
    height: 48px;
  }
  .foot {
    padding-top: 10px;
  }
}

@media (min-width: 600px) {
  .app {
    max-width: 400px;
  }
  .card {
    height: 400px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .wave.playing i {
    transform: scaleY(0.7);
  }
  .orb::before {
    animation: none;
  }
}
