:root {
  color-scheme: light;
  --page: #f1f3f4;
  --surface: #ffffff;
  --surface-soft: #f7f8f8;
  --ink: #171a1c;
  --muted: #667078;
  --line: #dce1e3;
  --line-strong: #c9d0d4;
  --accent: #dc3d45;
  --accent-hover: #bd2f38;
  --accent-soft: #fff0f1;
  --green: #16835d;
  --blue: #287b9d;
  --focus: #156f98;
  --shadow: 0 14px 36px rgba(23, 30, 34, 0.08);
  --font: "Segoe UI Variable", "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--ink);
  background: var(--page);
  font-family: var(--font);
  font-size: 15px;
}

button,
input {
  font: inherit;
}

button,
a,
input[type="range"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(21, 111, 152, 0.26);
  outline-offset: 2px;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  padding: 0 max(24px, calc((100vw - 1180px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(220, 225, 227, 0.92);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-size: 19px;
  font-weight: 800;
}

.brand-copy {
  min-width: 0;
  display: grid;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 15px;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

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

.top-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.topnav a {
  min-height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

.topnav a:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.admin-login-button,
.logout-button,
.guest-play-button,
.login-submit {
  border: 0;
  cursor: pointer;
}

.admin-login-button {
  min-height: 40px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 6px;
  color: #fff;
  background: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.admin-login-button:hover {
  background: #30363a;
}

.admin-login-button svg,
.admin-identity svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.admin-session {
  min-height: 40px;
  display: flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.admin-identity {
  min-width: 0;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.admin-identity span {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-button {
  align-self: stretch;
  padding: 0 11px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.logout-button:hover {
  color: var(--ink);
  background: #e9edef;
}

.music-app {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 42px;
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.now-panel,
.library-panel,
.visitor-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.now-panel {
  position: sticky;
  top: 96px;
  padding: 24px;
}

.section-kicker {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.connection-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #d49a29;
  box-shadow: 0 0 0 4px rgba(212, 154, 41, 0.13);
}

.connection-dot.is-ready {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 131, 93, 0.13);
}

.connection-dot.is-error {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(220, 61, 69, 0.12);
}

.cover-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  margin-top: 20px;
  overflow: hidden;
  border-radius: 8px;
  background: #22272a;
}

.current-cover,
.cover-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.current-cover {
  object-fit: cover;
}

.cover-fallback {
  display: grid;
  place-items: center;
  background: #22272a;
}

.cover-fallback span {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 38px;
  font-weight: 800;
}

.track-copy {
  min-width: 0;
  padding-top: 20px;
}

.now-label {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
}

.track-copy h1 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0;
}

.now-artist,
.now-album {
  margin: 7px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-album {
  margin-top: 3px;
  color: #8a9298;
  font-size: 12px;
}

.timeline {
  margin-top: 19px;
}

.range {
  width: 100%;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.progress-range {
  display: block;
}

.time-row {
  margin-top: 2px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.transport {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 40px 40px 52px 40px minmax(72px, 1fr);
  gap: 8px;
  align-items: center;
}

.icon-button,
.play-button,
.search-clear,
.embed-play,
.embed-next {
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface);
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.icon-button:disabled {
  opacity: 0.45;
  cursor: wait;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.play-button {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(220, 61, 69, 0.24);
}

.play-button:hover {
  background: var(--accent-hover);
}

.play-button svg {
  grid-area: 1 / 1;
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.4;
}

.play-button #playIcon path {
  fill: currentColor;
  stroke: none;
}

.volume-control {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.volume-control svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.volume-range {
  min-width: 48px;
}

.player-status {
  min-height: 18px;
  margin: 16px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-panel {
  min-width: 0;
  padding: 24px;
}

.visitor-panel {
  min-width: 0;
  padding: 32px;
}

.visitor-heading {
  display: flex;
  align-items: center;
  gap: 16px;
}

.visitor-icon {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
}

.visitor-icon svg {
  width: 27px;
  height: 27px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.visitor-heading h2 {
  margin: 7px 0 0;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0;
}

.visitor-lead {
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.quota-section {
  margin-top: 28px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.quota-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.quota-copy p {
  margin: 0;
  font-size: 14px;
  font-weight: 750;
}

.quota-copy span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.quota-copy strong {
  min-width: 72px;
  color: var(--accent);
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.quota-meter {
  height: 8px;
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.quota-meter span {
  border-radius: 2px;
  background: #dfe4e6;
  transition: background .18s ease;
}

.quota-meter span.is-available {
  background: var(--green);
}

.quota-reset {
  min-height: 18px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.guest-play-button {
  min-height: 48px;
  margin-top: 22px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 7px;
  color: #fff;
  background: var(--accent);
  font-weight: 750;
}

.guest-play-button:hover {
  background: var(--accent-hover);
}

.guest-play-button:disabled,
.login-submit:disabled,
.logout-button:disabled {
  opacity: .55;
  cursor: wait;
}

.guest-play-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.usage-notice {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.usage-notice h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.usage-notice p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 20px;
  display: grid;
  place-items: center;
  overflow-y: auto;
  background: rgba(20, 24, 26, .58);
  backdrop-filter: blur(5px);
}

.login-dialog {
  position: relative;
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(16, 22, 25, .22);
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.dialog-close:hover {
  color: var(--ink);
  background: var(--surface-soft);
}

.dialog-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.dialog-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 18px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
}

.dialog-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.login-dialog h2 {
  margin: 8px 0 0;
  font-size: 25px;
  letter-spacing: 0;
}

.dialog-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.login-form {
  margin-top: 22px;
  display: grid;
  gap: 9px;
}

.login-form label {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 700;
}

.login-form input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface-soft);
}

.login-form input:focus {
  border-color: var(--focus);
  outline: 3px solid rgba(21, 111, 152, .12);
}

.login-error {
  margin: 3px 0 0;
  color: var(--accent);
  font-size: 12px;
  line-height: 1.5;
}

.login-submit {
  min-height: 46px;
  margin-top: 9px;
  padding: 0 14px;
  border-radius: 6px;
  color: #fff;
  background: var(--ink);
  font-weight: 750;
}

.login-submit:hover {
  background: #30363a;
}

.search-box {
  height: 48px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 9px;
  padding: 0 8px 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
}

.search-box:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(21, 111, 152, 0.12);
}

.search-box > svg,
.search-clear svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.search-box input {
  width: 100%;
  height: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
}

.search-box input::placeholder {
  color: #899198;
}

.search-clear {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: transparent;
}

.search-clear:hover {
  background: #e9edef;
}

.library-heading {
  min-height: 72px;
  padding: 20px 0 14px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.library-heading h2 {
  margin: 7px 0 0;
  overflow-wrap: anywhere;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.list-state {
  min-height: 160px;
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.list-state.is-error {
  color: var(--accent);
}

.track-list {
  max-height: calc(100vh - 258px);
  min-height: 420px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #c4cbcf transparent;
}

.track-row {
  width: 100%;
  min-height: 72px;
  padding: 10px 8px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 0;
  border-bottom: 1px solid #edf0f1;
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.track-row:hover {
  background: var(--surface-soft);
}

.track-row.is-active {
  background: var(--accent-soft);
}

.mini-cover {
  position: relative;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 6px;
  background: #252a2d;
}

.mini-cover img,
.mini-cover-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.mini-cover img {
  object-fit: cover;
}

.mini-cover-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  background: #252a2d;
  font-weight: 800;
}

.track-row-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.track-row-copy strong,
.track-row-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-row-copy strong {
  font-size: 14px;
  font-weight: 700;
}

.track-row-copy span {
  color: var(--muted);
  font-size: 12px;
}

.track-row-end {
  width: 54px;
  display: grid;
  place-items: center end;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.track-indicator {
  display: none;
  color: var(--accent);
}

.track-indicator svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.track-row.is-active .track-duration {
  display: none;
}

.track-row.is-active .track-indicator {
  display: block;
}

.track-row.is-playing .track-indicator {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% { opacity: 0.45; }
}

/* Horizontal player used inside MCSM cards. */
body.embed-page {
  width: 100%;
  height: 168px;
  min-height: 168px;
  overflow: hidden;
  background: transparent;
}

.embed-shell {
  width: 100%;
  height: 168px;
}

.embed-card {
  width: 100%;
  height: 168px;
  padding: 16px;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 92px;
  align-items: center;
  gap: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
}

.embed-cover-wrap {
  position: relative;
  width: 104px;
  height: 104px;
  overflow: hidden;
  border-radius: 8px;
  background: #24292c;
}

.embed-cover,
.embed-cover-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.embed-cover {
  object-fit: cover;
}

.embed-cover-fallback {
  display: grid;
  place-items: center;
  color: #fff;
  background: #24292c;
  font-size: 30px;
  font-weight: 800;
}

.embed-copy {
  min-width: 0;
}

.embed-brand {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.embed-title,
.embed-meta,
.embed-status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.embed-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.embed-meta {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.embed-status {
  margin: 7px 0 0;
  color: #8a9298;
  font-size: 11px;
}

.embed-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.embed-play,
.embed-next {
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.embed-play {
  width: 48px;
  height: 48px;
  color: #fff;
  background: var(--accent);
}

.embed-next {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.embed-play:disabled,
.embed-next:disabled {
  opacity: 0.5;
  cursor: wait;
}

.embed-play svg,
.embed-next svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.embed-play .embed-play-icon path {
  fill: currentColor;
  stroke: none;
}

@media (max-width: 900px) {
  .music-app {
    grid-template-columns: minmax(0, 1fr);
  }

  .now-panel {
    position: static;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    column-gap: 24px;
  }

  .now-panel > .section-kicker,
  .now-panel > .player-status {
    grid-column: 1 / -1;
  }

  .cover-stage {
    grid-row: 2 / 6;
  }

  .track-list {
    max-height: none;
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .topnav {
    display: none;
  }
}

@media (max-width: 620px) {
  .topbar {
    padding: 0 16px;
  }

  .brand-copy small {
    display: none;
  }

  .topnav a {
    padding: 0 8px;
    font-size: 12px;
  }

  .music-app {
    width: calc(100% - 24px);
    padding-top: 12px;
    gap: 12px;
  }

  .now-panel,
  .library-panel,
  .visitor-panel {
    padding: 16px;
  }

  .now-panel {
    display: block;
  }

  .cover-stage {
    max-width: 320px;
    margin-inline: auto;
  }

  .transport {
    grid-template-columns: 38px 38px 50px 38px minmax(52px, 1fr);
    gap: 5px;
  }

  .icon-button {
    width: 38px;
    height: 38px;
  }

  .play-button {
    width: 50px;
    height: 50px;
  }

  .track-row {
    grid-template-columns: 44px minmax(0, 1fr) 42px;
    gap: 10px;
    padding-inline: 3px;
  }

  .mini-cover {
    width: 44px;
    height: 44px;
  }

  .admin-login-button {
    min-height: 38px;
    padding: 0 10px;
  }

  .admin-login-button span {
    font-size: 12px;
  }

  .visitor-heading h2 {
    font-size: 22px;
  }

  .visitor-lead {
    margin-top: 18px;
  }

  .guest-play-button {
    width: 100%;
  }

  .login-dialog {
    padding: 24px 20px;
  }
}

@media (max-width: 400px) {
  .brand-copy {
    display: none;
  }

  .topbar {
    gap: 12px;
  }

  .admin-identity span {
    max-width: 76px;
  }
}

@media (max-width: 500px) {
  .embed-card {
    grid-template-columns: 82px minmax(0, 1fr) 48px;
    gap: 12px;
    padding: 14px;
  }

  .embed-cover-wrap {
    width: 82px;
    height: 82px;
  }

  .embed-controls {
    display: grid;
    justify-items: center;
    gap: 6px;
  }

  .embed-title {
    font-size: 17px;
  }

  .embed-next {
    width: 32px;
    height: 32px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
