:root {
  --primary: #7B61FF;
  --primary-light: #EDE9FF;
  --secondary: #1E1B4B;
  --text: #111827;
  --muted: #6B7280;
  --bg: #FFFFFF;
  --surface: #F8FAFC;
  --line: #E5E7EB;
  --paper: #FFFFFF;
  --ink: #111827;
  --accent: #7B61FF;
  --danger: #8a3b2a;
  --shadow: 0 4px 16px rgba(0,0,0,0.06);
  --left: 220px;
  --right: 340px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--surface); color: var(--text); }
body {
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.shell {
  display: grid;
  grid-template-columns: var(--left) minmax(0, 1fr) var(--right);
  width: min(1200px, calc(100vw - 48px));
  max-width: 1200px;
  margin-inline: auto;
  height: 100vh;
  max-height: 100vh;
  min-width: 0;
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--line);
}
.left, .right, .center-col {
  min-height: 0;
  height: 100vh;
  overflow: auto;
}
.left {
  padding: 28px 20px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.brand {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--secondary);
}
.brand-home { color: inherit; text-decoration: none; }
.home-cta { margin: 14px 0 8px; text-align: left; }
.home-cta a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #8B6CFF 0%, #6D4DFF 100%);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(124, 92, 255, 0.25);
  cursor: pointer;
}
.home-cta a .cta-ico { width: 16px; height: 16px; flex: 0 0 auto; }
.home-cta a:hover {
  background: linear-gradient(180deg, #7A58F5 0%, #5B3AF0 100%);
  box-shadow: 0 8px 24px rgba(124, 92, 255, 0.35);
}
.home-cta a:active {
  background: linear-gradient(180deg, #6A48E8 0%, #4E2EE0 100%);
  box-shadow: 0 2px 8px rgba(124, 92, 255, 0.2);
}
.home-cta a.is-off,
.home-cta a[aria-disabled="true"] {
  background: #EDE9FF;
  color: #A78BFA;
  box-shadow: none;
  pointer-events: none;
}
.sub.slogan {
  margin: 6px 0 28px;
  font-size: 12px;
  line-height: 18px;
  color: var(--muted);
}
#nav { display: flex; flex-direction: column; gap: 4px; }
#nav button {
  text-align: left; border: 0; background: transparent;
  padding: 10px 14px; border-radius: 12px; color: var(--text);
  font-size: 14px; font-weight: 600;
}
#nav button.on { background: var(--primary-light); color: var(--primary); }
.gap { display: none !important; }

.center-col { display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--bg); }
.center-h { display: none; }
.center-h:has(#browseHead:not([hidden])) { display: block; padding: 12px 24px 0; }
.browse-head { font-size: 12px; color: var(--muted); margin: 0; }
#center { flex: 1; min-height: 0; overflow: auto; padding: 20px 28px 48px; }

.branding-h04 {
  background:
    radial-gradient(90% 140% at 92% -10%, #EDE9FF 0%, transparent 58%),
    linear-gradient(180deg, #F8FAFC 0%, #FFFFFF 100%);
  border-radius: 16px;
  padding: 28px 28px 24px;
  margin: 0 0 20px;
}
.branding-h04 .vision {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.branding-h04 h1 {
  font-size: 36px;
  line-height: 1.2;
  font-weight: 800;
  margin: 8px 0 10px;
  color: var(--secondary);
}
.branding-h04 h1 em {
  font-style: normal;
  color: var(--primary);
}
.branding-h04 .desc {
  margin: 0;
  font-size: 14px;
  line-height: 22px;
  color: var(--muted);
}
.branding-h04 .cat {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.feed-h {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 8px;
}
.feed-h h2 { font-size: 18px; line-height: 26px; margin: 0; font-weight: 700; }
.feed-h .count { font-size: 13px; color: var(--muted); }
.feed-h .btn { margin-left: auto; }
.feed-h .home-cta { margin: 0 0 0 auto; text-align: right; flex: 0 0 auto; }

.ogroup { border-bottom: 1px solid var(--line); }
.ogroup-h {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 12px 8px;
  cursor: pointer;
  border-radius: 12px;
  align-items: center;
}
.ogroup-h:hover { background: var(--surface); }
.ogroup.open > .ogroup-h { background: var(--primary-light); }
.ogroup-h .rank {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.ogroup-h h2 {
  font-size: 16px; margin: 0; line-height: 1.3; font-weight: 700;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ogroup-h .artist {
  font-size: 12px; color: var(--muted); margin: 2px 0 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ogroup-h .n { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.ogroup-x { padding: 0 8px 12px 48px; }

.rfrow {
  display: grid;
  grid-template-columns: 28px 88px minmax(0, 1fr) auto;
  gap: 10px;
  padding: 8px 4px;
  border-radius: 10px;
  align-items: center;
}
.rfrow:hover { background: var(--surface); }
.rfrow img {
  width: 88px; height: 50px; object-fit: cover; border-radius: 8px; background: #111;
  flex-shrink: 0;
}
.rfrow .rf-body { min-width: 0; }
.rfrow h3 {
  font-size: 14px; margin: 0 0 4px; font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rfrow .meta {
  font-size: 12px; color: var(--muted); margin: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rfrow.playing { background: var(--primary-light); }
.rfrow.paused { background: color-mix(in srgb, var(--primary-light) 70%, white); }
.rf-playmark {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--secondary); font-size: 10px; padding: 0;
}
.rfrow.playing .rf-playmark { background: var(--primary); color: #fff; border-color: var(--primary); }
.row-acts {
  display: flex; gap: 6px; flex-shrink: 0; white-space: nowrap;
  visibility: hidden;
}
.rfrow:hover .row-acts,
.rfrow:focus-within .row-acts { visibility: visible; }
.act-add, .act-play {
  border: 0; border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700;
}
.act-add { background: var(--primary-light); color: var(--primary); }
.rfrow.queued .act-add { background: var(--secondary); color: #fff; }
.act-play { background: var(--primary); color: #fff; }
.theme-more {
  margin: 6px 0 12px 36px;
  padding: 8px 8px 6px 12px;
  border-left: 3px solid var(--primary);
  background: var(--surface);
  border-radius: 0 12px 12px 0;
}
.theme-more-h {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 8px;
}
.theme-more .theme-rf { grid-template-columns: 22px 56px minmax(0, 1fr) auto; }
.theme-more .theme-rf img { width: 56px; height: 32px; }
.sec { margin: 18px 0 8px; }
.sec-h { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sec-h h2 { font-size: 15px; margin: 0 0 4px; }
.sec-h .meta { font-size: 12px; color: var(--muted); margin: 0; }
.cat {
  display: flex; justify-content: space-between; width: 100%;
  border: 0; border-bottom: 1px solid var(--line); background: transparent;
  padding: 11px 0; text-align: left; color: inherit;
}
.cat b { font-size: 14px; }
.cat span { font-size: 12px; color: var(--muted); }
.btn {
  border: 0; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 700;
  background: var(--primary); color: #fff;
}
.btn.secondary { background: transparent; color: var(--primary); border: 1px solid var(--line); }
.btn.block { display: block; width: 100%; margin: 8px 0 16px; }
.empty { padding: 32px 8px; color: var(--muted); text-align: center; }
.empty.tiny { padding: 8px 0 16px; font-size: 12px; }
.ghost {
  border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: 4px 10px; font-size: 12px; color: var(--primary);
}
.sentinel { height: 1px; }

.right {
  padding: 16px 16px 24px;
  overflow: auto;
  background: var(--surface);
  border-left: 1px solid var(--line);
  min-width: 0;
  max-width: var(--right);
  width: var(--right);
}
#ytPersist {
  width: 100%; aspect-ratio: 16/9; background: #111; border-radius: 12px; overflow: hidden; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
#ytMount, #ytPersist iframe { width: 100%; height: 100%; border: 0; }
.kicker { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.right h1,
#nowTitle {
  font-size: 18px; margin: 0 0 6px; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.meta { font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.transport {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin: 12px 0 10px;
  flex-shrink: 0;
}
.icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: transparent; color: var(--secondary);
  display: grid; place-items: center;
  position: relative;
}
.icon-btn[aria-pressed="true"] { color: var(--primary); }
.repeat-mark {
  position: absolute;
  left: 50%; top: 52%;
  transform: translate(-50%, -50%);
  font-size: 9px; font-weight: 800; line-height: 1;
  color: #111827;
  pointer-events: none;
}
.repeat-btn.is-all .repeat-mark {
  width: 5px; height: 5px; border-radius: 50%;
  background: #111827; font-size: 0; top: 50%;
}
.repeat-btn.is-off .repeat-mark { display: none; }
.icon-btn svg { width: 20px; height: 20px; display: block; }
.play-main {
  width: 56px; height: 56px; border: 0; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
}
.play-main svg { width: 24px; height: 24px; display: block; }
.play-main .i-pause { display: none; }
.play-main[data-state="playing"] .i-play { display: none; }
.play-main[data-state="playing"] .i-pause { display: block; }
.play-main[data-state="paused"] .i-play,
.play-main:not([data-state="playing"]) .i-play { display: block; }
.player-sliders { display: grid; gap: 8px; margin: 0 0 16px; }
.seek-row, .vol-row {
  display: grid; gap: 8px; align-items: center;
}
.seek-row { grid-template-columns: 36px 1fr 36px; }
.vol-row { grid-template-columns: 36px 1fr; }
.tiny { font-size: 11px; color: var(--muted); text-align: center; }
input[type=range] {
  width: 100%; accent-color: var(--primary);
}
.qhead { font-size: 14px; margin: 8px 0 10px; font-weight: 700; }
.row-item {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 8px;
  padding: 6px 4px; border-radius: 10px; align-items: center;
  cursor: grab;
  min-width: 0;
}
.row-item:hover { background: var(--bg); }
.row-item img { width: 56px; height: 32px; object-fit: cover; border-radius: 6px; background: #111; flex-shrink: 0; }
.row-item.active { background: var(--primary-light); }
.row-item b {
  font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row-item .qtext { min-width: 0; }
.row-item .qops { flex-shrink: 0; }
.row-item .qdel {
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 16px;
}
/* P8-3A: restore approved Home Connection surface visibility.
 * paintConn mounts .conn only on Home; OPEN_SCOPE nav/search locks unchanged.
 * Prior kill-switch hid Connection from users despite JS mount (P8-3 blocker).
 */
.conn {
  display: block;
  margin: 8px 0 16px;
  padding: 10px 0 16px;
  border-top: 1px solid var(--line);
  background: transparent;
}
.conn-themes { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.conn-themes .ghost.on { background: var(--accent, var(--primary)); color: #fff; }
.conn-list { display: flex; flex-direction: column; gap: 0; }
.conn-list .ogroup { margin: 0; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--secondary); color: #fff; padding: 8px 12px; border-radius: 999px;
  font-size: 12px; display: none; z-index: 80;
}

/* UI gate: hide Connection 3 explore controls (exposure only; reco contracts retained) */
.conn, .conn-themes, .conn-list { display: none !important; }



body.open-scope-lock .search-row,
body.open-scope-lock .search-row[hidden] { display: none !important; }
body.open-scope-lock [data-nav]:not([data-nav="home"]) { display: none !important; }
body.open-scope-lock #searchSheet { display: none !important; }
body.open-scope-lock .center-h { display: none !important; }
