:root {
  --ink: #161a1c;
  --ink-soft: #23292c;
  --panel: #f5f3ee;
  --paper: #ebe9e3;
  --paper-deep: #deddd6;
  --line: #cacac3;
  --muted: #6f7675;
  --muted-dark: #8f9897;
  --teal: #0eaa9b;
  --teal-dark: #08796f;
  --yellow: #f7c54b;
  --coral: #ef735f;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(17, 20, 23, 0.12);
  font-family: Inter, "SF Pro Display", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid rgba(14, 170, 155, 0.35); outline-offset: 2px; }
a { color: inherit; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(240px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 15px 28px;
  background: var(--ink);
  color: var(--white);
}

.brand-lockup, .topbar-meta, .transport-controls, .transport-left, .transport-right, .track-url-row, .mode-heading, .action-row, .queue-footer, .statusbar { display: flex; align-items: center; }
.brand-lockup { gap: 12px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.35); color: var(--yellow); font-size: 12px; font-weight: 800; letter-spacing: .05em; }
.eyebrow { margin: 0 0 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .18em; line-height: 1; }
.topbar .eyebrow { color: #8f9a99; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 18px; line-height: 1; letter-spacing: -.02em; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -.03em; }
.topbar-meta { justify-content: center; gap: 9px; color: #c2c8c7; font-size: 12px; white-space: nowrap; }
.meta-divider { width: 1px; height: 16px; background: #4b5455; }
.live-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px rgba(14,170,155,.13); }
.button { border: 0; cursor: pointer; }
.file-button { justify-self: end; display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--yellow); color: var(--ink); font-size: 12px; font-weight: 800; }
.file-button input { display: none; }
.file-button span:first-child { font-size: 18px; line-height: 12px; }

.workspace { flex: 1; display: grid; grid-template-columns: 300px minmax(420px, 1fr) 260px; gap: 24px; width: min(1600px, 100%); margin: 0 auto; padding: 28px; }
.panel-line { min-width: 0; }
.queue-panel, .inspector-panel { display: flex; flex-direction: column; min-height: 680px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; min-height: 52px; }
.icon-button { width: 26px; height: 26px; padding: 0; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 19px; line-height: 1; }
.is-hidden { display: none !important; }
.search-field { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px; margin: 19px 0 11px; border: 1px solid var(--line); background: rgba(255,255,255,.28); color: var(--muted); }
.search-field > span { font-size: 21px; line-height: 1; }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.search-field input::placeholder { color: #929794; }
kbd { padding: 2px 5px; border: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1; }
.filter-row { display: flex; gap: 4px; margin-bottom: 13px; }
.filter-button { flex: 1; min-width: 0; padding: 7px 5px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 750; }
.filter-button span { margin-left: 3px; color: #9a9f9d; font-variant-numeric: tabular-nums; }
.filter-button.is-active { background: var(--ink); color: var(--white); }
.filter-button.is-active span { color: var(--yellow); }
.queue-scroll { position: relative; flex: 1 1 0; height: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); scrollbar-color: #9ba09e transparent; scrollbar-width: thin; }
.queue-spacer { width: 1px; opacity: 0; pointer-events: none; }
.queue-items { position: absolute; inset: 0 0 auto; }
.queue-item { display: grid; grid-template-columns: 32px minmax(0,1fr) 36px; gap: 9px; align-items: center; height: 68px; padding: 8px 6px; border-bottom: 1px solid rgba(202,202,195,.68); cursor: pointer; }
.queue-item:hover { background: rgba(255,255,255,.45); }
.queue-item.is-current { background: var(--ink); color: var(--white); }
.queue-item.is-current .queue-meta, .queue-item.is-current .queue-number { color: #9da9a7; }
.queue-number { color: #959b98; font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; }
.queue-copy { min-width: 0; }
.queue-title { display: block; overflow: hidden; margin-bottom: 5px; font-size: 12px; font-weight: 700; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.queue-meta { display: block; overflow: hidden; color: var(--muted); font-size: 9px; letter-spacing: .03em; text-overflow: ellipsis; white-space: nowrap; }
.queue-type { justify-self: end; padding: 4px 3px; color: var(--teal-dark); font-size: 8px; font-weight: 900; letter-spacing: .08em; writing-mode: vertical-rl; }
.queue-item.is-current .queue-type { color: var(--yellow); }
.empty-state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 12px; }
.empty-state strong { color: var(--ink); }
.empty-icon { color: var(--coral); font-size: 30px; }
.queue-footer { justify-content: center; gap: 7px; min-height: 43px; color: var(--muted); font-size: 10px; }
.footer-dot { color: var(--teal); font-size: 18px; line-height: 1; }

.player-column { min-width: 0; }
.player-stage { position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; aspect-ratio: 16 / 9; min-height: 370px; background: #1a1e20; box-shadow: var(--shadow); }
.player-stage::before { position: absolute; inset: 0; background: radial-gradient(circle at 50% 42%, rgba(14,170,155,.08), transparent 36%), linear-gradient(135deg, transparent 0 49.8%, rgba(255,255,255,.04) 50%, transparent 50.2%); content: ""; pointer-events: none; }
.player-stage video { width: 100%; height: 100%; display: block; object-fit: contain; background: #111417; }
.player-placeholder { position: absolute; z-index: 1; display: flex; flex-direction: column; align-items: center; color: #e0e6e3; pointer-events: none; }
.placeholder-glyph { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 16px; border: 1px solid rgba(255,255,255,.35); color: var(--yellow); font-size: 21px; }
.player-placeholder p { margin-bottom: 7px; font-size: 14px; font-weight: 700; }
.player-placeholder span { color: #8b9895; font-size: 10px; letter-spacing: .17em; }
.player-loading, .player-error { position: absolute; z-index: 2; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: rgba(17,20,23,.82); color: white; font-size: 13px; }
.spinner { width: 24px; height: 24px; border: 2px solid rgba(255,255,255,.24); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.player-error strong { color: #fff; }
.player-error > span:not(.error-glyph) { color: #aab4b1; font-size: 11px; }
.error-glyph { display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--coral); color: var(--coral); font-weight: 900; }
.stage-corner { position: absolute; z-index: 3; width: 18px; height: 18px; border-color: rgba(247,197,75,.65); border-style: solid; pointer-events: none; }
.stage-corner-left { top: 16px; left: 16px; border-width: 1px 0 0 1px; }
.stage-corner-right { right: 16px; bottom: 16px; border-width: 0 1px 1px 0; }
.now-playing-badge { position: absolute; z-index: 3; top: 17px; right: 18px; display: flex; align-items: center; gap: 8px; padding: 6px 9px; background: rgba(17,20,23,.75); color: #c1cfcb; font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.now-playing-badge .live-dot { width: 5px; height: 5px; flex-basis: 5px; }
.transport { padding: 16px 0 12px; }
.progress-line { display: grid; grid-template-columns: 45px minmax(0,1fr) 45px; gap: 10px; align-items: center; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.progress-line span:last-child { text-align: right; }
input[type="range"] { width: 100%; height: 4px; margin: 0; accent-color: var(--teal); cursor: pointer; }
.transport-controls { justify-content: space-between; padding: 17px 0 4px; }
.transport-left, .transport-right { gap: 11px; }
.control-button, .play-button, .text-icon-button, .download-button { border: 0; cursor: pointer; }
.control-button { display: grid; place-items: center; width: 34px; height: 34px; background: transparent; color: var(--ink); font-size: 21px; }
.control-button:hover { color: var(--teal-dark); }
.skip-button { position: relative; }
.skip-button small { position: absolute; font-size: 7px; font-weight: 900; line-height: 1; transform: translateY(1px); }
.play-button { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--teal); color: var(--white); font-size: 17px; box-shadow: 0 7px 18px rgba(14,170,155,.2); }
.play-button:hover { background: var(--teal-dark); }
.track-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 20px 0 15px; border-top: 1px solid var(--line); }
.track-header h2 { max-width: 620px; overflow: hidden; font-size: clamp(20px, 2.3vw, 31px); line-height: 1.15; text-overflow: ellipsis; white-space: nowrap; }
.type-badge { flex: 0 0 auto; padding: 6px 8px; background: var(--ink); color: var(--yellow); font-size: 10px; font-weight: 900; letter-spacing: .1em; }
.track-url-row { min-width: 0; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.url-label { flex: 0 0 auto; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .13em; }
.track-url-row a { min-width: 0; overflow: hidden; flex: 1; color: var(--teal-dark); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.text-icon-button { width: 28px; height: 28px; flex: 0 0 auto; background: transparent; color: var(--muted); font-size: 15px; }
.text-icon-button:hover { color: var(--ink); }
.download-button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; padding: 7px 10px; background: var(--coral); color: var(--white); font-size: 10px; font-weight: 850; }
.download-button:hover { background: #d65b48; }
.download-button span { font-size: 17px; line-height: 10px; }

.inspector-panel { padding-left: 2px; }
.status-chip { display: inline-flex; align-items: center; gap: 7px; color: var(--teal-dark); font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.status-chip .live-dot { width: 5px; height: 5px; flex-basis: 5px; }
.mode-block { padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.mode-heading { justify-content: space-between; margin-bottom: 13px; color: var(--muted); font-size: 11px; font-weight: 750; }
.mode-heading span:last-child { color: var(--teal-dark); font-size: 10px; }
.mode-toggle { display: flex; align-items: center; width: 100%; gap: 10px; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; }
.mode-icon { display: grid; place-items: center; width: 33px; height: 33px; background: var(--ink); color: var(--yellow); font-size: 20px; }
.mode-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.mode-copy strong { font-size: 12px; }
.mode-copy small { color: var(--muted); font-size: 9px; white-space: nowrap; }
.toggle-track { width: 31px; height: 18px; padding: 2px; flex: 0 0 31px; background: #bfc1bc; border-radius: 12px; transition: background .2s ease; }
.toggle-track span { display: block; width: 14px; height: 14px; border-radius: 50%; background: var(--white); transition: transform .2s ease; }
.mode-toggle[aria-pressed="true"] .toggle-track { background: var(--teal); }
.mode-toggle[aria-pressed="true"] .toggle-track span { transform: translateX(13px); }
.quick-actions { padding: 24px 0; border-bottom: 1px solid var(--line); }
.quick-actions .eyebrow { margin-bottom: 12px; }
.action-row { width: 100%; gap: 10px; padding: 11px 0; border: 0; border-bottom: 1px solid rgba(202,202,195,.55); background: transparent; cursor: pointer; font-size: 11px; text-align: left; }
.action-row:last-child { border-bottom: 0; }
.action-icon { width: 20px; color: var(--teal-dark); font-size: 17px; text-align: center; }
.action-row span:nth-child(2) { flex: 1; }
.action-arrow { color: var(--muted); font-size: 17px; transition: transform .2s ease; }
.action-row:hover .action-arrow { color: var(--ink); transform: translateX(3px); }
.metadata-block { padding: 24px 0; }
.metadata-block .eyebrow { margin-bottom: 13px; }
dl { margin: 0; }
dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid rgba(202,202,195,.55); font-size: 10px; }
dt { color: var(--muted); }
dd { max-width: 150px; overflow: hidden; margin: 0; font-weight: 750; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.tip-block { display: flex; align-items: flex-start; gap: 9px; margin-top: auto; padding-top: 18px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.tip-block p { margin: 0; }
.tip-mark { display: grid; place-items: center; width: 15px; height: 15px; flex: 0 0 15px; border: 1px solid var(--muted); border-radius: 50%; font-family: Georgia, serif; font-size: 10px; }
code { color: var(--teal-dark); font-size: 10px; }
.statusbar { justify-content: space-between; gap: 18px; min-height: 35px; padding: 0 28px; border-top: 1px solid #c4c5bf; color: var(--muted); font-size: 9px; letter-spacing: .08em; }
.statusbar span:nth-child(2) { color: var(--teal-dark); font-weight: 750; letter-spacing: 0; }

.toast { position: fixed; z-index: 10; right: 24px; bottom: 48px; max-width: min(360px, calc(100vw - 48px)); padding: 11px 14px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 11px; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 260px minmax(400px, 1fr); }
  .inspector-panel { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; min-height: 0; padding-top: 4px; }
  .inspector-panel .panel-heading { grid-column: 1 / -1; min-height: auto; }
  .mode-block, .quick-actions { border-top: 1px solid var(--line); border-bottom: 0; }
  .metadata-block { padding: 24px 0; border-top: 1px solid var(--line); }
  .tip-block { display: none; }
}

@media (max-width: 760px) {
  .topbar { grid-template-columns: 1fr auto; gap: 12px; padding: 13px 16px; }
  .topbar-meta { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; order: 3; }
  .file-button { grid-column: 2; grid-row: 1; padding: 9px 11px; }
  .file-button span:last-child { display: none; }
  .workspace { display: flex; flex-direction: column; gap: 22px; padding: 20px 16px 24px; }
  .player-column { order: 1; }
  .queue-panel { order: 2; min-height: 430px; }
  .queue-scroll { height: 360px; flex: 0 0 360px; }
  .inspector-panel { order: 3; display: flex; gap: 0; min-height: 0; }
  .player-stage { min-height: 0; }
  .track-header h2 { max-width: calc(100vw - 120px); font-size: 21px; }
  .inspector-panel .panel-heading { min-height: 52px; }
  .mode-block, .quick-actions, .metadata-block { border-top: 1px solid var(--line); border-bottom: 0; }
  .tip-block { display: flex; }
  .statusbar { flex-wrap: wrap; gap: 5px 15px; padding: 10px 16px; line-height: 1.5; }
  .statusbar span:last-child { display: none; }
}

@media (max-width: 450px) {
  .topbar-meta { font-size: 10px; }
  .meta-divider { height: 13px; }
  .track-url-row { flex-wrap: wrap; }
  .track-url-row a { order: 3; flex-basis: 100%; }
  .download-button { margin-left: auto; }
  .transport { padding-top: 12px; }
}
