/* S2 · Worker 4 — catalog surfaces: Crate room, publish card, Fix sheet.
   Uses primitives + vars from tokens.css; layout shell from app.css. */

/* ================= Crate room ================= */
#crateRoot {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px calc(150px + var(--safe-b)); /* room for the record puck */
}

.crate-title-row { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 12px; }
.crate-title { font-size: 26px; margin: 0; }

.crate-chips {
  display: flex; align-items: center; gap: 8px;
  overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px;
  scrollbar-width: none;
}
.crate-chips::-webkit-scrollbar { display: none; }
.crate-sep { width: 1px; height: 18px; background: var(--line-2); flex: none; }

.crate-list { border-top: 1px solid var(--line); }
.crate-empty { text-align: center; padding: 56px 12px; }

.crate-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px 10px; padding: 12px 2px;
  border-bottom: 1px solid var(--line);
}
.cr-art {
  position: relative; width: 40px; height: 40px; border-radius: 8px;
  border: 1px solid var(--line-2); padding: 0; cursor: pointer;
  flex: none; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.cr-playmark {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #fff; background: rgba(0, 0, 0, 0.32);
  opacity: 0; transition: opacity 0.15s;
}
.cr-art:hover .cr-playmark, .cr-art:focus-visible .cr-playmark { opacity: 1; }

.cr-t { flex: 1; min-width: 0; }
.cr-name {
  display: block; font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cr-take { margin-left: 4px; }
.cr-sub {
  display: block; font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cr-plays { color: var(--ok); } /* green strictly = PUBLIC-state signal */

.cr-meta { display: inline-flex; gap: 6px; flex: none; }

.cr-actions { display: flex; align-items: center; gap: 6px; flex-basis: 100%; padding-left: 50px; }
.cr-actions .chip { padding: 4px 10px; font-size: 11px; }
.cr-heart { min-width: 30px; justify-content: center; font-size: 13px; }
.cr-heart.on { border-color: var(--red); color: var(--red); background: rgba(255, 40, 0, 0.1); }

@media (min-width: 768px) {
  #crateRoot { padding-top: 26px; }
  .cr-actions { flex-basis: auto; padding-left: 0; margin-left: auto; }
}

/* ================= Publish card ================= */
.pub-body {
  padding: 10px 18px calc(18px + var(--safe-b));
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
}
@media (min-width: 768px) { .pub-body { padding-top: 18px; } }

.pub-head { display: flex; align-items: center; gap: 10px; }
.pub-art { width: 28px; height: 28px; border-radius: 6px; flex: none; border: 1px solid var(--line-2); }
.pub-name {
  font-size: 14.5px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pub-close { padding: 4px 9px; font-size: 11px; }

.pub-toggle-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.pub-toggle-lab { color: var(--soft); }

.switch {
  position: relative; width: 40px; height: 23px; border-radius: 12px;
  background: var(--line-2); border: 0; padding: 0; cursor: pointer; flex: none;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.switch::after {
  content: ""; position: absolute; top: 2.5px; left: 2.5px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform 0.15s;
}
.switch.on { background: var(--red); }
.switch.on::after { transform: translateX(17px); }

.pub-link {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-2); border-radius: 10px;
  padding: 8px 12px; background: var(--panel-2);
}
.pub-url {
  flex: 1; min-width: 0; font-size: 11px; color: var(--soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pub-link .chip { padding: 4px 10px; font-size: 11px; }

.pub-actions { display: flex; gap: 10px; }
.pub-actions .btn { flex: 1; }
.pub-sheet .btn[disabled] { opacity: 0.4; cursor: default; }
.pub-sheet .btn[disabled]:active { transform: none; }

.pub-stat { color: var(--ok); }
.pub-hint { color: var(--muted); }
.pub-stat, .pub-hint { margin: 0; }

/* ================= Fix sheet ================= */
.fix-body {
  padding: 8px 18px calc(18px + var(--safe-b));
  display: flex; flex-direction: column; gap: 12px;
  overflow-y: auto;
}
@media (min-width: 768px) { .fix-body { padding-top: 16px; } }

.fix-title { font-size: 20px; margin: 2px 0 0; }

.fix-sections { display: flex; flex-direction: column; gap: 7px; }
.sectrow {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 3px 9px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; background: var(--panel-2);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.sectrow:hover:not(.mute) { border-color: var(--line-2); }
.sectrow.on { border-color: var(--red); background: rgba(255, 40, 0, 0.07); }
.sectrow.mute { opacity: 0.5; cursor: default; }
.sec-dot { width: 7px; height: 7px; border-radius: 50%; background: transparent; flex: none; }
.sectrow.on .sec-dot { background: var(--red); }
.sec-name { font-size: 13px; font-weight: 600; }
.sec-len { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.sec-lyric {
  grid-column: 2 / 4; font-size: 11.5px; color: var(--muted); font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.fix-input {
  width: 100%; border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--panel-2); color: var(--ink);
  font-family: var(--sans); font-size: 16px; /* ≥16px: no iOS focus zoom */
  padding: 11px 14px; appearance: none;
}
.fix-input::placeholder { color: var(--muted); }
.fix-input:focus { outline: none; border-color: var(--red); }

.fix-actions { display: flex; gap: 10px; }
.fix-actions .btn { flex: 1; }
.fix-hint { margin: 0; }

.fix-ab { border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.fix-ab-chips { display: flex; flex-wrap: wrap; gap: 8px; }
