:root {
  --bg: #131009;
  --bg-deep: #0d0b06;
  --panel: #1b1610;
  --panel-2: #241e15;
  --panel-3: #2c2519;
  --line: #3a3224;
  --line-soft: #2b251a;
  --text: #f3ecdd;
  --muted: #a79b84;
  --dim: #7d735f;
  --accent: #e8a33d;
  --accent-ink: #211303;
  --accent-soft: rgba(232, 163, 61, .13);
  --ok: #9bd48f;
  --err: #ef8084;
  --font-body: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- topbar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 20px;
  background: linear-gradient(180deg, var(--panel), var(--bg));
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 28%, #fcd07a, #d98f26 62%, #8a5410 100%);
  box-shadow:
    0 0 0 3px var(--accent-soft),
    inset 0 1px 2px rgba(255, 235, 190, .6),
    0 3px 10px rgba(0, 0, 0, .5);
  flex: none;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .01em;
  margin: 0;
  color: var(--text);
}

.brand-sub { font-size: 11.5px; color: var(--muted); margin: 2px 0 0; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- buttons ---------- */

.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .06s, box-shadow .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: #4a4030; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(232, 163, 61, .28);
}
.btn-primary:hover { background: #f0b152; border-color: transparent; }
.btn-ghost { background: transparent; }
.btn code { font-size: 11px; opacity: .85; }

/* ---------- segmented control ---------- */

.seg {
  display: inline-flex;
  gap: 3px;
  padding: 4px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.seg-full { display: flex; width: 100%; }
.seg-full .seg-btn { flex: 1; }
.seg-sm { padding: 3px; border-radius: 10px; }
.seg-sm .seg-btn { padding: 6px 10px; font-size: 12px; }

.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 13px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active {
  background: var(--panel-3);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .05), inset 0 0 0 1px var(--line);
}
.seg-btn.is-active .seg-ico { color: var(--accent); }
.seg-ico { display: inline-flex; color: var(--dim); transition: color .18s; }

/* ---------- layout ---------- */

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: 424px 1fr;
  min-height: 0;
}

.panel {
  overflow-y: auto;
  padding: 16px;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(600px 300px at 0% 0%, rgba(232, 163, 61, .05), transparent),
    var(--bg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.preview-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(1100px 520px at 50% -10%, rgba(232, 163, 61, .07), transparent 60%),
    radial-gradient(1400px 700px at 100% 110%, rgba(88, 58, 12, .16), transparent 60%),
    var(--bg-deep);
}

.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--dim);
}
.preview-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.preview-tip { color: var(--muted); font-size: 10px; white-space: nowrap; }
.preview-actions { display: flex; align-items: center; gap: 7px; }

.preview-frame {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 16px 16px;
  min-height: 0;
}

#preview {
  width: 100%;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #000;
  transition: max-width .3s ease, border-radius .3s ease, box-shadow .3s ease;
}
#preview.mobile {
  max-width: 390px;
  border-radius: 26px;
  border-color: #4a4030;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .04);
}

/* ---------- cards ---------- */

.card {
  background: linear-gradient(180deg, var(--panel), rgba(27, 22, 16, .8));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;
  animation: cardIn .5s cubic-bezier(.2, .7, .2, 1) both;
}
.panel .card:nth-child(1) { animation-delay: .02s; }
.panel .card:nth-child(2) { animation-delay: .07s; }
.panel .card:nth-child(3) { animation-delay: .12s; }
.panel .card:nth-child(4) { animation-delay: .17s; }
.panel .card:nth-child(5) { animation-delay: .22s; }

@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.card h2 {
  margin: 0 0 13px;
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 9px;
}
.card h2::before {
  content: "";
  width: 3px;
  height: 15px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--accent), #b8732a);
}
.card h3.list-heading {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--dim);
  margin: 16px 0 8px;
}

.tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(232, 163, 61, .3);
  border-radius: 999px;
  padding: 2px 8px;
}

/* ---------- forms ---------- */

.field { display: block; margin: 0 0 11px; }
.field > span, .field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field > span em { font-style: normal; color: var(--dim); font-size: 11px; }

input[type="text"], input[type="url"], input[type="number"], input[type="password"], textarea, select {
  width: 100%;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, textarea:focus, select:focus {
  border-color: rgba(232, 163, 61, .65);
  box-shadow: 0 0 0 3px rgba(232, 163, 61, .14);
}
textarea { resize: vertical; }

.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.6px solid var(--muted);
  border-bottom: 1.6px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
  transition: border-color .15s;
}
.select-wrap:hover::after { border-color: var(--text); }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  cursor: pointer;
}
.select-wrap select:disabled { opacity: .5; cursor: not-allowed; }

.hint { display: block; font-size: 11px; line-height: 1.55; color: var(--dim); margin-top: 6px; }
.hint code { background: var(--panel-3); padding: 1px 5px; border-radius: 4px; font-size: 10px; color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.row > .btn { flex: none; }

.accent-row { display: flex; align-items: center; gap: 11px; }
#f-accent {
  width: 40px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
  cursor: pointer;
  flex: none;
}
.swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  padding: 0;
}
.swatch:hover { transform: scale(1.14); }
.swatch.is-active { border-color: var(--text); box-shadow: 0 0 0 2px var(--accent-soft); }

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  position: relative;
  user-select: none;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  position: relative;
  width: 34px;
  height: 20px;
  flex: none;
  border-radius: 999px;
  background: var(--line);
  transition: background .2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f4eee0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}
.check input:checked + .switch { background: var(--accent); }
.check input:checked + .switch::after { transform: translateX(14px); }
.check input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

.or-divider {
  text-align: center;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 13px 0;
  position: relative;
}
.or-divider::before, .or-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 36%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line));
}
.or-divider::before { left: 0; }
.or-divider::after { right: 0; background: linear-gradient(90deg, var(--line), transparent); }

.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  background: var(--panel-2);
  border: 1.5px dashed #4a4030;
  border-radius: 10px;
  padding: 9px 13px;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.file-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.file-btn.is-dragging {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .18);
  transform: scale(1.02);
}

.pane { animation: paneIn .28s ease both; }
@keyframes paneIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-heading h2 { margin-bottom: 0; }
.song-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.music-add-form {
  margin-top: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.music-add-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.music-add-row .btn { min-width: 58px; }
.music-add-form .status { display: block; min-height: 18px; margin-top: 7px; }
.music-add-form .status:empty { min-height: 0; }

.song-form { padding: 11px; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 11px; }
.form-note { font-size: 12px; color: var(--accent); }

.song-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.song-list:empty::before {
  content: "No songs yet.";
  display: block;
  font-size: 12px;
  color: var(--dim);
  padding: 15px;
  border: 1.5px dashed var(--line);
  border-radius: 11px;
  text-align: center;
}

.song-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  padding: 8px 9px;
  transition: border-color .15s;
}
.song-item:hover { border-color: var(--line); }
.song-thumb {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: cover;
  background: linear-gradient(135deg, #4a4030, #241e15);
  display: grid;
  place-items: center;
}
.song-thumb--empty::after { content: "♪"; color: var(--dim); }
.song-meta { min-width: 0; }
.song-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-artist { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-actions { display: flex; gap: 2px; }
.icon-btn {
  font: inherit;
  background: transparent;
  border: 0;
  color: var(--dim);
  width: 27px;
  height: 27px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn.danger:hover { color: var(--err); background: rgba(239, 128, 132, .1); }

.status { font-size: 12px; line-height: 1.5; min-height: 18px; margin: 9px 0 0; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.status.pending { color: var(--muted); }

.site-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.site-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 13px;
}
.site-item a { color: var(--accent); text-decoration: none; font-weight: 500; }
.site-item a:hover { text-decoration: underline; }

/* ---------- vercel deploy ---------- */

.vercel {
  margin: 14px 0 0;
  border-top: 1px solid var(--line-soft);
  padding-top: 13px;
}
.vercel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 11px; }
.vercel-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  color: #ececec;
  background: #0a0a0a;
  border: 1px solid #2e2e2e;
  border-radius: 999px;
  padding: 5px 11px;
}
.vercel-badge svg { color: #ffffff; }
.check-sm { font-size: 12px; }

.btn-vercel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #0a0a0a;
  border-color: #2e2e2e;
  color: #ffffff;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .5);
}
.btn-vercel:hover { background: #1a1a1a; border-color: #454545; }
.btn-vercel svg { color: #ffffff; flex: none; }
.btn-vercel:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 2, .72);
  backdrop-filter: blur(3px);
  animation: fadeIn .2s ease both;
}
.modal-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--panel), #221b12);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .7);
  animation: modalIn .22s cubic-bezier(.2, .8, .2, 1) both;
}
.modal-card h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.08;
  margin: 5px 0 10px;
}
.modal-card p { font-size: 13px; line-height: 1.55; color: var(--muted); margin: 0 0 16px; }
.modal-card ul { margin: 0 0 16px; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 6px; }
.modal-card li { font-size: 12px; line-height: 1.5; color: var(--muted); }
.modal-card code { background: var(--panel-3); padding: 1px 5px; border-radius: 4px; font-size: 10.5px; color: var(--text); }
.modal-card .row { justify-content: space-between; margin-top: 20px; }
.modal-card .row > * { flex: none; }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.modal-heading .icon-btn { flex: none; margin: -3px -4px 0 0; }
.library-card { max-width: 510px; }
.library-list { list-style: none; margin: 14px 0 0; max-height: min(52vh, 460px); overflow: auto; padding: 0; display: grid; gap: 8px; }
.library-item { align-items: center; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 12px; display: flex; gap: 12px; justify-content: space-between; padding: 11px 12px; }
.library-item > div { min-width: 0; }
.library-item strong { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-item small { color: var(--muted); display: block; font-size: 11px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-item .btn { flex: none; text-decoration: none; }
.library-empty { color: var(--muted); font-size: 13px; line-height: 1.5; padding: 18px 4px; text-align: center; }
.modal-kicker { display: block; color: var(--accent); font-size: 10px; letter-spacing: .12em; font-weight: 700; text-transform: uppercase; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
.modal-close:hover { background: var(--panel-3); color: var(--text); }
.publish-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; padding: 11px 12px; border: 1px solid rgba(245,158,11,.2); border-radius: 10px; background: rgba(245,158,11,.07); color: #d2c8bb; font-size: 12px; line-height: 1.4; }
.publish-note span { color: var(--accent); }
.publish-success { text-align: center; }
.success-mark { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 15px; border-radius: 50%; color: #162015; background: #91e3a0; box-shadow: 0 8px 28px rgba(81,189,105,.25); font-size: 24px; font-weight: 700; }
.published-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text) !important; font-family: var(--font-mono); font-size: 12px !important; }
.published-link { display: flex; justify-content: center; margin: 16px 0 20px; text-decoration: none; }
.share-heading { display: flex; align-items: center; gap: 10px; margin: 4px 0 11px; color: var(--muted); font-size: 11px; font-weight: 600; text-align: left; text-transform: uppercase; letter-spacing: .08em; }
.share-heading i { display: block; flex: 1; height: 1px; background: var(--line); }
.share-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.share-btn { display: grid; gap: 4px; place-items: center; min-height: 62px; padding: 7px 3px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-3); color: var(--text); cursor: pointer; font: inherit; transition: transform .15s, border-color .15s, background .15s; }
.share-btn:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.32); background: #3a3024; }
.share-btn b { font-size: 17px; line-height: 1; }
.share-btn span { overflow: hidden; max-width: 100%; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.share-btn--x b { font-size: 15px; }.share-btn--facebook b { color: #8bb6ff; font-family: Arial, sans-serif; font-size: 20px; }.share-btn--instagram b { color: #e49eb9; }.share-btn--snapchat b { font-size: 17px; }
.share-status { min-height: 18px; margin: 10px 0 0 !important; font-size: 11px !important; }
.publish-done { width: 100%; margin-top: 5px; }
.domain-input { display: flex; align-items: stretch; }
.domain-input input { min-width: 0; border-radius: 9px 0 0 9px; }
.domain-input code { display: flex; align-items: center; padding: 0 10px; color: var(--muted); background: var(--panel-3); border: 1px solid var(--line); border-left: 0; border-radius: 0 9px 9px 0; font-size: 11px; white-space: nowrap; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: none; }
}

.hidden { display: none !important; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .preview-pane { display: none; }
  .brand-sub { display: none; }
}

@media (max-width: 520px) {
  .topbar { gap: 10px; padding-inline: 16px; }
  /* The preview is intentionally hidden at this breakpoint, so its width
     toggle would only consume the space needed for the Publish action. */
  .topbar-actions .seg { display: none; }
  .btn { padding-inline: 12px; }
}
