:root {
  --bg: #0d1017;
  --bg-2: #141924;
  --panel: #171d29;
  --panel-2: #1d2534;
  --line: #26303f;
  --text: #dbe3f0;
  --dim: #8695ad;
  --accent: #f0b429;
  --accent-2: #5ea9ff;
  --ok: #52d17c;
  --warn: #ffb454;
  --err: #ff6b6b;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* The page is one screen: the header, the two columns and the footer fill the
 * viewport and the log scrolls inside its card.  On phones the page is
 * allowed to scroll normally. */
html, body { height: 100%; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #1b2436 0%, var(--bg) 60%);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

code { font-family: var(--mono); font-size: .92em; color: var(--accent); }

/* ---------------------------------------------------------------- header */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(23,29,41,.92), rgba(13,16,23,.72));
  flex: 0 0 auto;
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand > div { min-width: 0; }

.logo {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), #b8791a);
  color: #1a1206; font-weight: 800; letter-spacing: .5px;
  box-shadow: 0 6px 18px rgba(240,180,41,.25);
}

.topbar h1 { margin: 0; font-size: 17px; letter-spacing: .2px; }
.sub { margin: 1px 0 0; color: var(--dim); font-size: 12.5px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; }
.chip {
  font: 12px/1 var(--mono); padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--panel); color: var(--dim);
  white-space: nowrap;
}
.chip.ok { color: var(--ok); border-color: rgba(82,209,124,.4); }
.chip.bad { color: var(--err); border-color: rgba(255,107,107,.4); }

/* -------------------------------------------------------- the file:// case */

#serve-warning {
  margin: 12px 24px 0; padding: 12px 16px;
  border: 1px solid rgba(255,180,84,.45); border-radius: var(--radius);
  background: rgba(255,180,84,.09); color: var(--text); font-size: 13px;
}
#serve-warning b { color: var(--warn); }
#serve-warning code { color: var(--accent); }

/* ------------------------------------------------------------------ main */

main {
  display: grid; grid-template-columns: minmax(340px, 430px) 1fr;
  gap: 16px; padding: 12px 24px;
  flex: 1 1 auto; min-height: 0;
  max-width: 1500px; width: 100%; margin: 0 auto;
}

@media (max-width: 900px) {
  html, body { height: auto; }
  body { overflow: auto; }
  main { grid-template-columns: 1fr; }
}

.col.left, .col.right {
  display: flex; flex-direction: column; gap: 8px;
  min-height: 0; overflow-y: auto; padding-right: 2px;
}

h2 {
  margin: 2px 0 0; font-size: 11px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--dim); font-weight: 700;
}

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 9px 12px;
  flex: 0 0 auto;
}
.card.collapsed .drop, .card.collapsed .songlist { display: none; }

.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card h3 { margin: 0; font-size: 14px; }
.hint { margin: 2px 0 6px; color: var(--dim); font-size: 12px; }
.hint b { color: var(--text); font-weight: 600; }

.badge {
  font: 10px/1 var(--mono); text-transform: uppercase; letter-spacing: 1px;
  padding: 4px 7px; border-radius: 5px;
}
.badge.required { color: var(--warn); background: rgba(255,180,84,.12); }
.badge.optional { color: var(--dim); background: rgba(134,149,173,.12); }

/* --------------------------------------------------------------- dropzone */

.drop {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  background: var(--bg-2); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover { border-color: var(--accent-2); background: #182031; }
.drop.over { border-color: var(--accent); background: #1d2230; }
.drop.small { padding: 13px; margin-bottom: 8px; }
.drop.done { border-color: rgba(82,209,124,.55); }
.drop.error { border-color: rgba(255,107,107,.6); }

.drop-icon { font-size: 18px; color: var(--dim); }
.drop-text { font-size: 13px; color: var(--dim); flex: 1 1 auto; }
.drop-text b { color: var(--text); }
.drop-sub {
  font: 11px/1.3 var(--mono); color: var(--dim);
  flex: 0 1 auto; max-width: 45%; text-align: right;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drop.done .drop-sub { color: var(--ok); }
.drop.error .drop-sub { color: var(--err); }

/* The explicit picker button under each drop zone: phones have no drag and
 * drop, and a click target is friendlier anyway. */
.upload {
  display: block; width: 100%; margin-top: 6px; padding: 7px 12px;
  font: 600 12.5px/1 inherit; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer;
}
.upload:hover { border-color: var(--accent-2); color: #fff; }
.upload:active { background: #232c3d; }

.progress { height: 3px; margin-top: 10px; border-radius: 3px; background: var(--bg); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent-2); transition: width .2s; }

/* ---------------------------------------------------------------- options */

.opt { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
.opt input { margin-top: 3px; accent-color: var(--accent); }
.opt small { color: var(--dim); }

.songlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 4px; margin: 6px 0 10px; }
.songlist:empty { display: none; }
.songlist label {
  display: flex; gap: 6px; align-items: center; font: 12px/1.6 var(--mono);
  color: var(--dim); cursor: pointer;
}
.songlist input { accent-color: var(--accent); }

/* ------------------------------------------------------------------ build */

.card.build { flex: 1 1 auto; min-height: 70px; display: flex; flex-direction: column; }

.build-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.build-hint { font-size: 12px; color: var(--dim); }

button, .button {
  font: 600 14px/1 inherit; padding: 9px 15px; border-radius: 8px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  display: inline-block;
}
button.primary, .button.primary {
  background: linear-gradient(145deg, var(--accent), #d2961a); color: #1a1206;
  box-shadow: 0 4px 14px rgba(240,180,41,.2);
}
button.primary:disabled { background: #2b3446; color: #5d6a80; box-shadow: none; cursor: not-allowed; }
button.ghost { background: transparent; border-color: var(--line); color: var(--dim); }
button.ghost:hover { color: var(--text); border-color: var(--accent-2); }

.log {
  background: #0a0d13; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; flex: 1 1 auto; min-height: 0; overflow: auto;
  font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word;
  color: #b9c6da;
}
.log-empty { color: #4d5a70; }
.log .ok { color: var(--ok); }
.log .err { color: var(--err); }
.log .warn { color: var(--warn); }
.log .dim { color: #5d6a80; }

/* ----------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; font: 12px/1.5 var(--mono); }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 600; }
td.num { text-align: right; color: var(--dim); }
tr:last-child td { border-bottom: none; }

.result-list { list-style: none; margin: 0 0 14px; padding: 0; font: 12px/1.7 var(--mono); }
.result-list li { display: flex; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--line); }
.result-list li span:last-child { color: var(--dim); }

footer {
  border-top: 1px solid var(--line); padding: 6px 24px; color: var(--dim);
  font-size: 12px; text-align: center; flex: 0 0 auto;
}

/* ----------------------------------------------------------------- phones
 * A phone gets the one column layout (see the 900px query above) and a
 * trimmed down header: the blurb and the chips go, the logo shrinks and
 * the title keeps only the part that fits, so the bar is one thin line
 * instead of a block.  The build button takes the full width and the
 * build status next to it is hidden - the log under the button already
 * says what the build is doing. */

@media (max-width: 640px) {
  .topbar { padding: 6px 12px; gap: 10px; }
  .brand { gap: 9px; }
  .logo {
    width: 28px; height: 28px; border-radius: 7px;
    font-size: 11.5px; letter-spacing: .2px;
  }
  .topbar h1 { font-size: 14px; line-height: 1.2; }
  .sub, .chips, .wide-only { display: none; }

  main { padding: 10px 12px; gap: 10px; }
  .card { padding: 10px 12px; }
  .drop { padding: 9px 10px; flex-wrap: wrap; row-gap: 2px; }
  /* The file name gets a line of its own instead of squeezing the label. */
  .drop-sub { flex: 1 1 100%; max-width: 100%; margin-left: 28px; text-align: left; }
  .upload { padding: 10px 12px; font-size: 13px; }

  .build-row { gap: 0; }
  .build-row .primary {
    flex: 1 1 auto; width: 100%; padding: 13px 15px; font-size: 15px;
  }
  .build-hint { display: none; }

  footer { padding: 8px 12px; }
}

