:root {
  --ink: #140820;
  --paper: #ffffff;
  --gold: #9d4dff;
  --coral: #c44dff;
  --mute: rgba(255, 255, 255, 0.45);
  --line: rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(800px 420px at 50% -10%, rgba(157, 77, 255, 0.28), transparent 55%),
    var(--ink);
  color: var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

body {
  min-height: 100vh;
}

#app {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 18px 16px 96px;
}

.hidden {
  display: none !important;
}

.app-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.app-bar h1,
.page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.login-logo.tiny {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  margin: 0;
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(140, 70, 255, 0.35);
}

.login-logo.tiny b {
  font-size: 20px;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: #e3c9ff;
}

h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.sub,
.hint {
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  margin: 4px 0 0;
  font-size: 13px;
}

.panel {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
}

.enter label,
#mine label {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 14px;
}

input {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--paper);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  outline: none;
}

input:focus {
  border-color: rgba(157, 77, 255, 0.8);
}

.mono {
  font-family: "Cascadia Mono", "Consolas", monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--gold);
  color: #fff;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

button.ghost {
  background: rgba(255, 255, 255, 0.14);
  color: var(--paper);
  border: 0;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.panel-head h2,
.audience h3,
#stage-title {
  margin: 0;
  font-size: 20px;
}

.room-list {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.room-list.empty {
  color: var(--mute);
}

.room-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  border: 1px solid transparent;
  color: inherit;
  width: 100%;
  text-align: left;
}

.room-card:hover {
  border-color: rgba(157, 77, 255, 0.55);
}

.room-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  background: linear-gradient(165deg, #b08cff, #7b5cff);
}

.room-avatar.letter {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.room-meta {
  min-width: 0;
  flex: 1;
}

.room-card b {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.room-card span,
#room-count,
#home-room-count {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.stage-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.stage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

.seats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.seat {
  aspect-ratio: 1;
  width: 100%;
  max-width: 170px;
  margin: 0 auto;
  border-radius: 50%;
  border: 1px dashed rgba(236, 230, 214, 0.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.03);
  position: relative;
}

.seat.taken {
  border-style: solid;
  border-color: rgba(157, 77, 255, 0.7);
}

.seat.speaking {
  box-shadow: 0 0 0 6px rgba(157, 77, 255, 0.2), 0 0 28px rgba(196, 77, 255, 0.4);
  border-color: var(--coral);
}

.seat .idx {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--mute);
  font-family: "Segoe UI", sans-serif;
}

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(165deg, #b08cff, #7b5cff);
  color: #fff;
  font-size: 22px;
  margin-bottom: 8px;
}

.seat .name {
  font-size: 14px;
}

.seat .tag {
  font-size: 11px;
  color: var(--mute);
  margin-top: 4px;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.controls {
  display: flex;
  gap: 8px;
}

.controls button {
  flex: 1;
}

.player {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
}

.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

#now-playing {
  margin: 0;
  font-size: 13px;
  color: #fff;
  min-width: 0;
}

.player-nav {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.genre-row {
  display: flex;
  gap: 8px;
}

.genre-btn {
  flex: 1;
  border: 1px solid var(--line);
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  padding: 6px 0;
  font: inherit;
  font-size: 12px;
}

.genre-btn.on {
  background: #9d4dff;
  border-color: #9d4dff;
  color: #fff;
}

.bgm-ctrl {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.bgm-ctrl input[type="range"] {
  flex: 1;
  margin: 0;
  accent-color: #9d4dff;
}

.bot-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bot-panel select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-radius: 14px;
  padding: 10px 12px;
  font: inherit;
}

.seat.bot .avatar {
  background: linear-gradient(165deg, #7b5cff, #4aa3ff);
}

.msg.bot b {
  color: #cbb6ff;
}

.chat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

.messages {
  flex: 1;
  overflow: auto;
  max-height: 240px;
  font-size: 14px;
  line-height: 1.55;
}

.msg {
  margin-bottom: 8px;
}

.msg b {
  color: var(--gold);
  margin-right: 6px;
  font-weight: 600;
}

#chat-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

#chat-form input {
  width: auto;
  flex: 1;
  min-width: 0;
  margin-top: 0;
}

.audience {
  font-size: 14px;
}

#audience {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  color: rgba(236, 230, 214, 0.8);
}

.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: #2a1248;
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(157, 77, 255, 0.45);
  z-index: 40;
}

.carousel {
  position: relative;
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: 20px;
  min-height: 180px;
}

.carousel-track {
  display: flex;
  transition: transform 0.45s ease;
}

.slide {
  position: relative;
  min-width: 100%;
  padding: 0;
  min-height: 180px;
}

.slide img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.slide-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px 48px 20px 16px;
  background: linear-gradient(transparent, rgba(16, 4, 32, 0.88));
}

.slide h3 {
  margin: 0 0 4px;
  font-size: 20px;
}

.slide p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.45;
  font-size: 13px;
}

.carousel-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: var(--paper);
  border: 1px solid var(--line);
}

.carousel-nav.prev {
  left: 10px;
}

.carousel-nav.next {
  right: 10px;
}

.carousel-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.carousel-dots button {
  width: 8px;
  height: 8px;
  padding: 0;
  border-radius: 50%;
  background: rgba(236, 230, 214, 0.28);
}

.carousel-dots button.active {
  background: #fff;
  width: 18px;
  border-radius: 99px;
}

.login-splash {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 12;
  overflow: hidden;
  width: min(430px, 100%);
  transform: translateX(-50%);
  background: #140820;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

.login-mosaic {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
}

.login-mosaic img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
  display: block;
}

.login-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(20, 8, 32, 0.15) 0%, transparent 18%, transparent 42%, rgba(18, 6, 36, 0.72) 68%, rgba(16, 4, 32, 0.94) 100%);
}

.login-brand {
  position: absolute;
  left: 0;
  right: 0;
  top: 34%;
  text-align: center;
  color: #fff;
}

.login-logo {
  width: 108px;
  height: 108px;
  margin: 0 auto 18px;
  border-radius: 28px;
  background: linear-gradient(165deg, #b08cff 0%, #c44dff 42%, #7b5cff 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 40px rgba(140, 70, 255, 0.45);
}

.login-logo b {
  font-size: 34px;
  letter-spacing: 0.12em;
  line-height: 1.1;
}

.login-logo span {
  margin-top: 6px;
  font-size: 12px;
  background: #fff;
  color: #7a4dff;
  border-radius: 8px;
  padding: 2px 8px;
  font-weight: 700;
}

.login-brand p {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.login-actions {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-wechat,
.btn-phone {
  width: 100%;
  height: 52px;
  border-radius: 999px;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.btn-wechat {
  background: #9d4dff;
  color: #fff;
}

.btn-phone {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 0;
  backdrop-filter: blur(10px);
}

.agree {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  margin-top: 6px;
}

.agree input {
  display: none;
}

.tick {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  flex-shrink: 0;
  position: relative;
}

.agree input:checked + .tick {
  background: #fff;
}

.agree input:checked + .tick::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 9px;
  border: 2px solid #7a4dff;
  border-top: 0;
  border-left: 0;
  transform: rotate(45deg);
}

.legal-link {
  background: none;
  border: 0;
  color: #fff;
  padding: 0;
  font: inherit;
}

.phone-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 18%;
  background: linear-gradient(180deg, rgba(28, 12, 48, 0.96), #160824);
  border-radius: 24px 24px 0 0;
  padding: 18px 22px 96px;
  z-index: 2;
  color: #fff;
}

.sheet-back,
.ghost-text {
  background: none;
  border: 0;
  color: rgba(255, 255, 255, 0.75);
  padding: 0;
  font: inherit;
}

.phone-sheet h3 {
  margin: 8px 0 18px;
  font-size: 24px;
}

.phone-sheet label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.phone-sheet input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.ghost-text {
  width: 100%;
  margin-top: 14px;
}

.legal-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  padding: 24px;
}

.legal-card {
  width: min(440px, 100%);
  background: #1b1028;
  color: #fff;
  border-radius: 18px;
  padding: 20px;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

.legal-body {
  max-height: 240px;
  overflow: auto;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.78);
  margin: 10px 0 16px;
  font-size: 14px;
}

body.auth-open #app,
body.auth-open .tabbar {
  display: none !important;
}

.login-splash.hidden {
  display: none !important;
}

.profile-head {
  align-items: flex-start;
}

.profile-copy {
  flex: 1;
  min-width: 0;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 12px;
  margin-bottom: 16px;
}

.quick-card {
  text-align: left;
  background: linear-gradient(160deg, rgba(157, 77, 255, 0.35), rgba(255, 255, 255, 0.06));
  border: 1px solid var(--line);
  color: var(--paper);
  border-radius: 18px;
  padding: 16px;
}

.quick-card span,
.play-card p,
.uid,
.bio {
  display: block;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  margin-bottom: 6px;
}

.quick-card b,
.play-card b {
  font-size: 18px;
}

.quick-card.join {
  background: rgba(0, 0, 0, 0.22);
}

.row.tight {
  margin-top: 8px;
}

.play-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.play-card {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.play-card p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.profile-head {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(165deg, #b08cff, #7b5cff);
  color: #fff;
  font-size: 28px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.profile-head h2 {
  margin: 0 0 4px;
  font-size: 28px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-row div {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
}

.stat-row b {
  display: block;
  font-size: 22px;
  color: var(--gold);
}

.stat-row span {
  font-size: 12px;
  color: var(--mute);
}

.wallet-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(157, 77, 255, 0.4), rgba(255, 255, 255, 0.06));
}

.wallet-card span {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: 4px;
}

.wallet-card b {
  font-size: 28px;
  color: #fff;
}

.wallet-card button {
  flex-shrink: 0;
  min-width: 84px;
}

.pack-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0 16px;
}

.pack {
  position: relative;
  text-align: left;
  padding: 14px 12px 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font: inherit;
}

.pack.on {
  border-color: #9d4dff;
  background: rgba(157, 77, 255, 0.22);
}

.pack b {
  display: block;
  font-size: 22px;
}

.pack span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.pack em {
  position: absolute;
  top: 8px;
  right: 8px;
  font-style: normal;
  font-size: 11px;
  color: #fff;
  background: #9d4dff;
  border-radius: 999px;
  padding: 2px 6px;
}

.order-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.order-list.empty {
  color: var(--mute);
  font-size: 13px;
}

.order-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
}

.pay-sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(10, 4, 18, 0.62);
  display: grid;
  place-items: end center;
}

.pay-card {
  width: min(430px, 100%);
  padding: 22px 18px 28px;
  border-radius: 22px 22px 0 0;
  background: #1c0d2c;
  border: 1px solid var(--line);
}

.pay-card h3 {
  margin: 0 0 8px;
}

.pay-card p {
  margin: 0 0 18px;
  color: rgba(255, 255, 255, 0.7);
}

.pay-card button {
  width: 100%;
  margin-top: 8px;
}

#save-profile {
  width: 100%;
  margin-top: 4px;
}

button.tiny {
  padding: 6px 12px;
  font-size: 13px;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(398px, calc(100% - 24px));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(20, 8, 32, 0.88);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  z-index: 15;
}

.tabbar button {
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  padding: 10px 8px;
}

.tabbar button.active {
  background: #9d4dff;
  color: #fff;
}

body.in-room .tabbar {
  display: none;
}

body.in-room #app {
  padding-bottom: 48px;
}

.stage-grid,
.row {
  max-width: 100%;
}

@media (max-width: 860px) {
  .stage-grid,
  .row {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
  }
  .seats {
    grid-template-columns: repeat(2, 1fr);
  }
  .quick-grid,
  .play-row {
    grid-template-columns: 1fr;
  }
}
