/* Spacer Cadet — app-specific styles on top of berm.css (the shared design
   system). Layout glue + the few widgets berm doesn't have. */

:root { --accent: #4f7cff; }   /* space-cadet blue — Spacer Cadet's identity */

.sc-main { max-width: 1100px; margin: 0 auto; padding: 14px 16px 0; }

/* ---------------- tabs ---------------- */
.sc-tabs {
  display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: 2px; scrollbar-width: none;
}
.sc-tabs::-webkit-scrollbar { display: none; }
.sc-tab {
  flex: none; padding: .55rem 1.1rem; font: inherit; font-weight: 650; font-size: .92rem;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; border-bottom: none; cursor: pointer;
}
.sc-tab.on { color: var(--text); background: var(--surface-2); border-color: var(--accent); }

/* ---------------- toolbar (nozzle + library) ---------------- */
.sc-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0;
}
.sc-nozzle { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; }
.sc-toolbar-gap { flex: 1; }

/* ---------------- save popover + library drawer ---------------- */
.sc-save { margin-bottom: 12px; }
.sc-save-row { display: flex; gap: 8px; }
.sc-save-row .b-input { flex: 1; }

.sc-library { margin-bottom: 12px; }
.sc-lib-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.sc-lib-list { max-height: 420px; overflow-y: auto; }
.sc-lib-cat { margin: .8rem 0 .3rem; font-size: .74rem; font-weight: 650; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; }
.sc-lib-item {
  display: flex; align-items: center; gap: 10px; padding: .45rem .55rem;
  border-radius: var(--radius-sm); cursor: pointer;
}
.sc-lib-item:hover { background: var(--surface-2); }
.sc-lib-item .sc-thumb {
  flex: none; width: 54px; height: 54px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line); object-fit: contain;
}
.sc-lib-text { flex: 1; min-width: 0; }
.sc-lib-item .nm { font-weight: 600; font-size: .92rem; }
.sc-lib-item .sum { color: var(--muted); font-size: .8rem; margin-top: 2px; line-height: 1.3; }
.sc-lib-item .del {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: .9rem; padding: 2px 6px; border-radius: 6px;
}
.sc-lib-item .del:hover { color: var(--err); background: var(--surface-2); }
.sc-lib-item .lib-dl {
  color: var(--muted); text-decoration: none; font-size: .95rem;
  padding: 2px 7px; border-radius: 6px;
}
.sc-lib-item .lib-dl:hover { color: var(--accent); background: var(--surface-2); }

/* ---------------- info bubbles ---------------- */
/* A small "i" help icon; its tip shows on hover, keyboard focus, or tap
   (tap toggles .open in app.js). Lives inside labels & the toolbar. */
.sc-info {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-left: 5px; flex: none; vertical-align: middle;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--muted); font: italic 700 11px/1 Georgia, 'Times New Roman', serif;
  text-transform: none; letter-spacing: 0; cursor: help; padding: 0;
  transition: color .12s, border-color .12s;
}
.sc-info:hover, .sc-info:focus-visible, .sc-info.open { color: var(--accent); border-color: var(--accent); }
.sc-info:focus { outline: none; }
.sc-tip {
  position: absolute; z-index: 60; top: calc(100% + 8px); left: 0;
  width: max-content; max-width: min(240px, calc(100vw - 24px));
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  padding: .5rem .6rem; font: 400 .78rem/1.4 system-ui, sans-serif;
  font-style: normal; text-align: left; text-transform: none; letter-spacing: 0;
  white-space: normal; opacity: 0; visibility: hidden; transform: translateY(-3px);
  transition: opacity .12s, transform .12s; pointer-events: none;
}
.sc-info--end .sc-tip { left: auto; right: 0; }
.sc-info:hover .sc-tip, .sc-info:focus .sc-tip,
.sc-info:focus-within .sc-tip, .sc-info.open .sc-tip {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.sc-tip b { font-weight: 650; }

/* ---------------- config forms ---------------- */
.sc-panel { border-top-left-radius: 0; }
.sc-blurb { color: var(--muted); font-size: .88rem; margin: .1rem 0 .5rem; }
/* Column min must fit the widest unshrinkable control (the 4-button SPLIT seg,
   ~250px) — narrower tracks make grid items OVERFLOW the card edge instead of
   wrapping (feedback #2). min(...,100%) keeps it safe on small phones. */
.sc-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 4px 18px; }
.f .b-label { margin-top: .55rem; }
.u { text-transform: none; letter-spacing: 0; opacity: .8; }
.pair { display: flex; gap: 10px; align-items: center; }
.pair .num { width: 86px; flex: none; }

/* ---------------- status ---------------- */
.sc-status {
  margin-top: 12px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line); font-size: .9rem;
}
.sc-status.err  { border-color: var(--err);  color: var(--err); }
.sc-status.warn { border-color: var(--warn); color: var(--warn); }

/* ---------------- viewer + stats ---------------- */
.sc-stage { margin-top: 12px; padding: .8rem; }
.sc-cap { display: flex; justify-content: space-between; align-items: center; margin-bottom: .55rem; gap: 8px; flex-wrap: wrap; }
.cap-left { display: inline-flex; align-items: center; gap: 9px; }
.cap-right { display: inline-flex; align-items: center; gap: 8px; }
.viewer { height: 480px; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line); }
#download { text-decoration: none; }
#download.disabled { opacity: .45; pointer-events: none; }

.swatch {
  -webkit-appearance: none; appearance: none;
  width: 15px; height: 15px; padding: 0; border: none; border-radius: 50%;
  background: none; cursor: pointer; opacity: .5; transition: opacity .15s, transform .15s;
}
.swatch:hover { opacity: 1; transform: scale(1.2); }
.swatch::-webkit-color-swatch-wrapper { padding: 0; }
.swatch::-webkit-color-swatch { border: 1px solid var(--line); border-radius: 50%; }
.swatch::-moz-color-swatch { border: 1px solid var(--line); border-radius: 50%; }

.sc-stats {
  margin-top: .7rem; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px 16px;
  font-size: .88rem;
}
.sc-stats:empty { display: none; }
.sc-stats .stat b { display: block; color: var(--muted); font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; }

.sc-footer { text-align: center; font-size: .78rem; padding: 18px 16px 34px; }
.sc-footer code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.hidden { display: none !important; }

/* ---------------- mobile ---------------- */
@media (max-width: 760px) {
  .viewer { height: 380px; }
  .sc-form { grid-template-columns: 1fr; }
  .pair .num { width: 96px; }   /* bigger touch target */
}
