:root {
  color-scheme: dark;
  --bg: #050811;
  --screen: #070b15;
  --screen-2: #0b1020;
  --panel: rgba(15, 21, 39, 0.72);
  --panel-strong: rgba(15, 22, 43, 0.9);
  --panel-soft: rgba(255, 255, 255, 0.045);
  --line: rgba(177, 196, 255, 0.13);
  --line-hot: rgba(157, 95, 255, 0.52);
  --text: #f7f8ff;
  --muted: #8d97ad;
  --soft: #c7d0e4;
  --accent: #9b5cff;
  --accent-2: #67b8ff;
  --accent-3: #d77aff;
  --danger: #ff7a91;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 105%, rgba(116, 122, 255, 0.28), transparent 34%),
    linear-gradient(135deg, #101729 0%, #070a13 44%, #05070d 100%);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin: 0;
  letter-spacing: 0;
}

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px 12px;
}

.phone-shell {
  position: relative;
  width: min(402px, calc(100vw - 24px));
  height: min(882px, calc(100vh - 24px));
  min-height: 720px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 8px;
  padding: max(15px, env(safe-area-inset-top)) 16px max(10px, env(safe-area-inset-bottom));
  border: 1px solid rgba(218, 228, 255, 0.19);
  border-radius: 32px;
  background:
    radial-gradient(circle at 50% 26%, rgba(113, 66, 205, 0.21), transparent 32%),
    linear-gradient(180deg, rgba(9, 14, 28, 0.98), rgba(4, 7, 14, 0.995) 72%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -38px 80px rgba(0, 0, 0, 0.26),
    0 34px 130px rgba(0, 0, 0, 0.58);
  overflow: hidden;
}

.phone-shell::before {
  content: "";
  position: absolute;
  top: 10px;
  left: 50%;
  width: 120px;
  height: 32px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #02040a;
  box-shadow:
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    0 12px 36px rgba(0, 0, 0, 0.28);
  z-index: 3;
  pointer-events: none;
}

.screen-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.12;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 78%);
  pointer-events: none;
}

.phone-shell > *:not(.screen-vignette) {
  position: relative;
  z-index: 2;
}

.statusbar,
.app-header,
.mode-title,
.panel-head,
.time-row,
.controls,
.mode-switch,
.button-row,
.tabbar {
  display: flex;
  align-items: center;
}

.statusbar {
  justify-content: space-between;
  height: 32px;
  padding: 0 10px;
  color: rgba(247, 248, 255, 0.92);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
}

.status-icons {
  color: rgba(238, 243, 255, 0.8);
  font-size: 11px;
}

.app-header {
  justify-content: space-between;
  min-height: 38px;
  gap: 10px;
}

.mode-title {
  min-width: 0;
  justify-content: center;
  gap: 8px;
  color: rgba(235, 239, 255, 0.8);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.mode-dot,
.brain-pulse {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 18px rgba(155, 92, 255, 0.95);
}

.weather-chip {
  height: 32px;
  min-width: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(177, 196, 255, 0.11);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(225, 231, 247, 0.78);
  font-size: 12px;
  white-space: nowrap;
}

.icon-button,
.control-button,
.mode-button,
.login-button,
.mini-button,
.tab-button,
.next-toggle,
.heart-button {
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(177, 196, 255, 0.11);
  color: var(--soft);
}

.icon-button.ghost {
  background: transparent;
  border-color: transparent;
  color: rgba(235, 239, 255, 0.72);
  font-size: 31px;
  line-height: 1;
}

.icon-button.small {
  width: 34px;
  height: 34px;
}

.view-panel {
  min-height: 0;
  display: none;
  align-content: start;
  gap: 10px;
  overflow: auto;
  padding: 2px 0 4px;
  scrollbar-width: none;
}

.view-panel::-webkit-scrollbar {
  display: none;
}

.view-panel.active {
  display: grid;
}

.view-now {
  grid-template-rows: auto auto auto auto auto auto;
}

.dj-orb-card {
  position: relative;
  min-height: 284px;
  display: grid;
  place-items: center;
  margin-top: 2px;
}

.signal-line {
  position: absolute;
  left: -36px;
  right: -36px;
  top: 48%;
  height: 54px;
  opacity: 0.22;
  background:
    linear-gradient(90deg, transparent, rgba(155, 92, 255, 0.7), transparent),
    repeating-linear-gradient(
      90deg,
      transparent 0 16px,
      rgba(103, 184, 255, 0.38) 16px 17px,
      transparent 17px 26px
    );
  mask-image: linear-gradient(90deg, transparent, black 16%, black 84%, transparent);
  filter: blur(0.2px);
}

.orb-ring {
  position: relative;
  width: min(70vw, 238px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(176, 118, 255, 0.86);
  background:
    radial-gradient(circle at 52% 50%, rgba(148, 80, 255, 0.2), rgba(44, 48, 104, 0.14) 44%, rgba(5, 8, 15, 0.08) 68%),
    conic-gradient(from 210deg, rgba(155, 92, 255, 0.1), rgba(103, 184, 255, 0.5), rgba(216, 102, 255, 0.5), rgba(155, 92, 255, 0.12));
  box-shadow:
    inset 0 0 44px rgba(88, 116, 255, 0.1),
    0 0 24px rgba(154, 88, 255, 0.55),
    0 0 82px rgba(89, 108, 255, 0.22);
}

.orb-ring::before {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: inherit;
  border: 1px solid rgba(103, 184, 255, 0.16);
  filter: blur(0.2px);
}

.orb-ring::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: inherit;
  background: radial-gradient(circle, rgba(8, 12, 24, 0.4), rgba(8, 12, 24, 0.08) 70%);
}

.orb-halo {
  position: absolute;
  inset: -40px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(155, 92, 255, 0.22), transparent 66%);
  filter: blur(10px);
}

.orb-ring.speaking {
  box-shadow:
    inset 0 0 46px rgba(103, 184, 255, 0.14),
    0 0 32px rgba(103, 184, 255, 0.45),
    0 0 92px rgba(155, 92, 255, 0.25);
}

.orb-ring.playing-music {
  box-shadow:
    inset 0 0 46px rgba(155, 92, 255, 0.16),
    0 0 36px rgba(155, 92, 255, 0.6),
    0 0 96px rgba(103, 184, 255, 0.18);
}

.orb-copy {
  position: relative;
  z-index: 1;
  width: 72%;
  text-align: center;
}

.orb-status,
.label {
  color: rgba(199, 208, 228, 0.58);
  font-size: 12px;
}

.orb-copy h1 {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.94);
  font-size: 17px;
  line-height: 1.28;
}

.orb-copy p:last-child {
  margin-top: 10px;
  color: rgba(241, 244, 255, 0.86);
  font-size: 14px;
  line-height: 1.72;
}

.track-card {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 34px;
  gap: 14px;
  align-items: center;
  padding: 4px 18px 2px;
}

.album-art {
  width: 66px;
  aspect-ratio: 1;
  border-radius: 9px;
  object-fit: cover;
  border: 1px solid rgba(221, 229, 255, 0.12);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.34),
    0 0 28px rgba(155, 92, 255, 0.22);
}

.segment-title {
  color: var(--text);
  font-size: 17px;
  line-height: 1.22;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.segment-meta {
  margin-top: 6px;
  color: rgba(199, 208, 228, 0.62);
  font-size: 12px;
  line-height: 1.44;
  overflow-wrap: anywhere;
}

.heart-button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: transparent;
  color: #f2c6ff;
  font-size: 28px;
  line-height: 1;
}

.progress-wrap {
  padding: 0 20px;
}

.progress-line {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: visible;
}

.progress-fill {
  position: relative;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 16px rgba(155, 92, 255, 0.78);
}

.progress-fill::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -4px;
  width: 10px;
  height: 10px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: #86c8ff;
  box-shadow: 0 0 16px rgba(103, 184, 255, 0.9);
}

.time-row {
  justify-content: space-between;
  margin-top: 10px;
  color: rgba(199, 208, 228, 0.62);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.control-card {
  padding: 2px 4px 0;
}

.controls {
  justify-content: space-between;
  min-height: 64px;
  padding: 0 10px;
}

.control-button {
  display: grid;
  place-items: center;
  color: var(--text);
}

.control-button.secondary,
.control-button.utility {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: transparent;
  color: rgba(239, 243, 255, 0.8);
}

.control-button.secondary {
  font-size: 42px;
  line-height: 1;
}

.control-button.utility {
  color: rgba(199, 208, 228, 0.66);
  font-size: 20px;
}

.control-button.primary {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 48% 42%, rgba(255, 255, 255, 0.24), transparent 40%),
    linear-gradient(145deg, rgba(155, 92, 255, 0.94), rgba(78, 117, 255, 0.82));
  color: #fff;
  font-size: 0;
  box-shadow:
    0 0 0 1px rgba(230, 236, 255, 0.24),
    0 0 0 8px rgba(155, 92, 255, 0.13),
    0 0 34px rgba(155, 92, 255, 0.66);
}

.control-button.primary::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 17px solid #fff;
}

.control-button.primary.playing::before {
  width: 18px;
  height: 24px;
  margin-left: 0;
  border: 0;
  background:
    linear-gradient(90deg, #fff 0 6px, transparent 6px 12px, #fff 12px 18px);
}

.mode-switch {
  gap: 8px;
  margin-top: 6px;
  padding: 0 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.mode-switch::-webkit-scrollbar {
  display: none;
}

.mode-button {
  flex: 1 0 auto;
  min-width: 76px;
  height: 39px;
  border-radius: 999px;
  border: 1px solid rgba(177, 196, 255, 0.11);
  background: rgba(255, 255, 255, 0.045);
  color: rgba(226, 232, 250, 0.74);
  font-size: 13px;
}

.mode-button.active {
  border-color: rgba(155, 92, 255, 0.72);
  color: #fff;
  background:
    linear-gradient(145deg, rgba(155, 92, 255, 0.4), rgba(103, 184, 255, 0.13)),
    rgba(255, 255, 255, 0.04);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 24px rgba(155, 92, 255, 0.18);
}

.next-card,
.brain-compact,
.queue li,
.brain-panel,
.library-block,
.status-strip,
.settings-form,
.qr-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.064), rgba(255, 255, 255, 0.021)),
    var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 14px 36px rgba(0, 0, 0, 0.2);
}

.next-card {
  display: grid;
  margin-top: 4px;
  min-height: 64px;
  overflow: hidden;
}

.next-toggle {
  width: 100%;
  min-height: 62px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.next-cover {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 54% 45%, rgba(226, 122, 255, 0.82), rgba(106, 85, 203, 0.38) 46%, rgba(10, 14, 27, 0.9) 72%),
    #12182d;
  box-shadow: 0 0 22px rgba(155, 92, 255, 0.26);
}

.next-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.next-copy strong {
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.next-copy span:last-child {
  color: rgba(199, 208, 228, 0.6);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  color: rgba(199, 208, 228, 0.62);
  font-size: 18px;
}

.next-reason {
  padding: 0 12px 12px 60px;
  color: rgba(222, 228, 244, 0.8);
  font-size: 12px;
  line-height: 1.55;
}

.brain-compact {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  cursor: pointer;
}

.brain-compact strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.brain-compact p {
  margin-top: 5px;
  color: rgba(199, 208, 228, 0.62);
  font-size: 12px;
  line-height: 1.42;
}

.panel-head {
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0 12px;
}

.panel-head h2 {
  color: var(--text);
  font-size: 21px;
  line-height: 1.2;
}

.panel-head span,
.tiny-status {
  color: rgba(199, 208, 228, 0.62);
  font-size: 12px;
}

.plan-list,
.recent-list,
.source-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 9px;
}

.queue li {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 11px;
}

.queue li.active {
  border-color: rgba(155, 92, 255, 0.62);
  background:
    linear-gradient(90deg, rgba(155, 92, 255, 0.18), rgba(255, 255, 255, 0.035)),
    var(--panel);
}

.queue-time {
  color: var(--accent-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.queue-title {
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
  font-weight: 750;
}

.queue-type,
.queue-duration {
  color: rgba(199, 208, 228, 0.6);
  font-size: 12px;
}

.brain-panel {
  padding: 14px;
}

.brain-hero {
  display: grid;
  gap: 8px;
  min-height: 88px;
  padding: 14px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 92% 50%, rgba(155, 92, 255, 0.42), transparent 24%),
    linear-gradient(90deg, rgba(155, 92, 255, 0.14), rgba(255, 255, 255, 0.035));
}

.brain-hero span {
  color: rgba(199, 208, 228, 0.62);
  font-size: 12px;
}

.brain-hero strong {
  font-size: 18px;
  line-height: 1.35;
}

.brain-block {
  margin-top: 14px;
}

.brain-block h3,
.library-block h3 {
  color: rgba(231, 236, 255, 0.84);
  font-size: 14px;
}

.brain-block ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: rgba(222, 228, 244, 0.82);
  font-size: 13px;
  line-height: 1.78;
}

.brain-json {
  margin-top: 14px;
  color: rgba(199, 208, 228, 0.62);
  font-size: 12px;
}

.brain-json pre {
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: rgba(5, 8, 15, 0.78);
  color: rgba(222, 228, 244, 0.86);
  white-space: pre-wrap;
  word-break: break-word;
}

.library-block {
  padding: 14px;
}

.library-block + .library-block {
  margin-top: 12px;
}

.recent-list,
.source-list {
  margin-top: 10px;
}

.recent-list li,
.source-list li {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: rgba(222, 228, 244, 0.84);
  font-size: 13px;
}

.source-list span {
  color: rgba(199, 208, 228, 0.56);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-strip {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 12px;
}

.status-label {
  color: rgba(199, 208, 228, 0.62);
  font-size: 12px;
}

.status-value {
  margin-top: 4px;
  font-weight: 800;
}

.button-row {
  gap: 8px;
}

.button-row.stretch {
  align-items: stretch;
}

.button-row.stretch .mini-button {
  flex: 1;
}

.mini-button {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(177, 196, 255, 0.12);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  white-space: nowrap;
}

.mini-button.primary {
  border-color: rgba(155, 92, 255, 0.52);
  background: linear-gradient(145deg, #9b5cff, #65b7ff);
  color: #fff;
  font-weight: 800;
}

.mini-button.muted {
  color: rgba(199, 208, 228, 0.62);
}

.qr-box {
  display: grid;
  place-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  background: #f8f8f8;
  color: #161616;
}

.qr-box[hidden] {
  display: none;
}

.qr-box img {
  width: min(220px, 72vw);
  height: auto;
  display: block;
}

.qr-box p {
  margin: 0;
  font-weight: 700;
}

.settings-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
}

.settings-form label {
  display: grid;
  gap: 6px;
  color: rgba(199, 208, 228, 0.7);
  font-size: 13px;
}

.settings-form textarea {
  min-height: 74px;
  resize: vertical;
  border-radius: 8px;
  border: 1px solid rgba(177, 196, 255, 0.12);
  background: rgba(5, 8, 15, 0.78);
  color: var(--text);
  padding: 10px 12px;
  line-height: 1.45;
}

.form-status {
  min-height: 18px;
  color: var(--accent-2);
  font-size: 13px;
}

.tabbar {
  justify-content: space-between;
  gap: 4px;
  min-height: 62px;
  padding: 7px;
  border: 1px solid rgba(155, 92, 255, 0.28);
  border-radius: 10px;
  background: rgba(6, 9, 18, 0.84);
  backdrop-filter: blur(18px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 -14px 42px rgba(0, 0, 0, 0.28);
}

.tab-button {
  flex: 1;
  min-width: 0;
  height: 48px;
  display: grid;
  place-items: center;
  gap: 2px;
  border-radius: 8px;
  background: transparent;
  color: rgba(199, 208, 228, 0.58);
  font-size: 14px;
}

.tab-button span:last-child {
  font-size: 9px;
  letter-spacing: 0.02em;
}

.tab-icon {
  font-size: 17px;
  line-height: 1;
}

.tab-button.active {
  color: #fff;
  background: linear-gradient(145deg, rgba(155, 92, 255, 0.35), rgba(103, 184, 255, 0.1));
  box-shadow:
    inset 0 0 0 1px rgba(155, 92, 255, 0.42),
    0 0 24px rgba(155, 92, 255, 0.18);
}

.login-dialog {
  width: min(350px, calc(100vw - 34px));
  border: 1px solid rgba(177, 196, 255, 0.26);
  border-radius: 12px;
  background: rgba(15, 22, 43, 0.95);
  color: var(--text);
  padding: 0;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.5);
}

.login-dialog::backdrop {
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(2px);
}

.login-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.login-form h2 {
  font-size: 21px;
}

.login-form label {
  display: grid;
  gap: 6px;
  color: rgba(199, 208, 228, 0.72);
}

.login-form input {
  height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(177, 196, 255, 0.14);
  background: rgba(5, 8, 15, 0.85);
  color: var(--text);
  padding: 0 12px;
}

.login-button {
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(145deg, #9b5cff, #65b7ff);
  color: #fff;
  font-weight: 800;
}

.login-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 13px;
}

@media (max-width: 390px) {
  .stage {
    padding: 0;
  }

  .phone-shell {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .dj-orb-card {
    min-height: 228px;
  }

  .orb-ring {
    width: min(60vw, 202px);
  }

  .orb-copy p:last-child {
    font-size: 13px;
    line-height: 1.62;
  }

  .track-card {
    grid-template-columns: 56px minmax(0, 1fr) 30px;
    padding-inline: 12px;
  }

  .album-art {
    width: 56px;
  }

  .controls {
    min-height: 58px;
  }

  .control-button.primary {
    width: 56px;
    height: 56px;
  }

  .segment-title {
    font-size: 16px;
  }

  .mode-button {
    min-width: 68px;
    font-size: 12px;
  }
}
