/* Comic Builder — DArnTech carbon-thin, DARK house standard.
 * Copy-ported from customer-hub/carbon.css, re-tokened to Carbon Gray-100.
 * Self-contained: no framework, no build step.
 */

:root {
  --c-bg:        #161616;
  --c-surface:   #262626;
  --c-surface-2: #393939;
  --c-border:    #393939;
  --c-border-strong: #6f6f6f;
  --c-text:      #f4f4f4;
  --c-text-2:    #c6c6c6;
  --c-text-3:    #8d8d8d;
  --c-text-on-blue: #ffffff;
  --c-blue:      #0f62fe;
  --c-blue-hover:#0353e9;
  --c-blue-soft: #002d9c;
  --c-amber:     #f1c21b;
  --c-red:       #fa4d56;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Top bar ─────────────────────────────────────────────── */
.topbar {
  height: 48px;
  background: #000000;
  color: #ffffff;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--c-border);
}
.topbar-product { font-weight: 600; font-size: 14px; letter-spacing: 0.16px; }
.topbar-product .accent { color: var(--c-amber); }
.topbar-divider { width: 1px; height: 24px; background: var(--c-border); margin: 0 16px; }
.topbar-title { font-size: 13px; color: var(--c-text-2); }
.topbar-spacer { flex: 1; }
.topbar-meta { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--c-text-3); }

.page { padding: 24px 16px 48px; max-width: 1500px; margin: 0 auto; }

/* ── Cards / buttons (carbon-thin) ───────────────────────── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  padding: 16px;
  margin-bottom: 16px;
}
.card h3 {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.32px;
  color: var(--c-text-2);
  margin-bottom: 12px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 8px 14px;
  border: 1px solid var(--c-border-strong);
  background: var(--c-surface);
  color: var(--c-text);
  cursor: pointer; text-decoration: none;
  transition: background 80ms;
  border-radius: 0;
  min-height: 40px;
}
.btn:hover { background: var(--c-surface-2); }
.btn-primary { background: var(--c-blue); color: var(--c-text-on-blue); border-color: var(--c-blue); }
.btn-primary:hover { background: var(--c-blue-hover); }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── Strip preview ───────────────────────────────────────── */
.strip-wrap { padding: 12px; }
.strip-scroll { overflow-x: auto; background: #ffffff; border: 1px solid var(--c-border); }
#strip { display: block; touch-action: none; margin: 0 auto; }
.strip-hint { margin: 6px 2px 0; font-size: 11px; color: var(--c-text-secondary, #8d8d8d); }
.strip-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.strip-actions .spacer { flex: 1; }

/* ── Composer ────────────────────────────────────────────── */
.char-row {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 4px 0 8px;
  -webkit-overflow-scrolling: touch;
}
.char-chip {
  flex: 0 0 auto;
  width: 92px;
  border: 1px solid var(--c-border);
  background: #ffffff;
  cursor: pointer;
  padding: 0;
  text-align: center;
}
.char-chip img {
  width: 90px; height: 90px;
  object-fit: contain; object-position: bottom;
  display: block;
}
.char-chip .nm {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #161616;
  background: #e0e0e0;
  padding: 1px 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.char-chip.sel { outline: 3px solid var(--c-blue); outline-offset: -3px; }
.char-chip { position: relative; }
.char-chip .rm {
  position: absolute; top: 0; right: 0;
  width: 20px; height: 20px; line-height: 20px;
  font-size: 11px; color: #ffffff; background: rgba(22,22,22,0.75);
  cursor: pointer;
}
.char-chip.add-photo .plus {
  display: block; width: 90px; height: 90px; line-height: 90px;
  font-size: 32px; color: #8d8d8d;
}

/* ── Pose / balloon radial wheel ─────────────────────────── */
.pose-wheel-wrap { display: flex; justify-content: center; padding: 10px 0 6px; }
.pose-wheel { position: relative; width: min(560px, 94vw); aspect-ratio: 1; }
.wheel-hub {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 31%; aspect-ratio: 1; border-radius: 50%;
  background: #ffffff; border: 1px solid var(--c-border-strong);
  overflow: hidden;
}
.wheel-hub img {
  position: absolute; left: 6%; top: 4%; width: 88%; height: 76%;
  object-fit: contain; object-position: bottom;
}
.wheel-hub .lbl {
  position: absolute; left: 0; right: 0; bottom: 0;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px;
  color: #161616; background: #e0e0e0;
  padding: 2px 0 5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wheel-pose {
  position: absolute; transform: translate(-50%, -50%);
  aspect-ratio: 1; border-radius: 50%;
  border: 1px solid var(--c-border);
  background: #ffffff;
  padding: 0; cursor: pointer; overflow: hidden;
}
.wheel-pose img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 0;
  display: block;
}
.wheel-pose.ph img { object-fit: contain; object-position: 50% 50%; }
.wheel-balloon {
  position: absolute; transform: translate(-50%, -50%);
  width: 11%; aspect-ratio: 1; border-radius: 50%;
  background: #ffffff; border: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: center;
  padding: 0; cursor: pointer;
}
.wheel-balloon svg { width: 60%; height: 60%; display: block; }
.wheel-pose.sel, .wheel-balloon.sel { outline: 3px solid var(--c-blue); outline-offset: -3px; }
.wheel-pose:hover, .wheel-balloon:hover { border-color: var(--c-border-strong); }

.say-row { display: flex; gap: 8px; flex-wrap: wrap; }
.say-input {
  flex: 1; min-width: 180px;
  background: var(--c-bg); color: var(--c-text);
  border: 1px solid var(--c-border-strong);
  font-family: inherit; font-size: 14px;
  padding: 8px 12px; border-radius: 0; min-height: 40px;
}
.say-input:focus, .btn:focus { outline: 2px solid var(--c-blue); outline-offset: -2px; }

/* ── Message log ─────────────────────────────────────────── */
.msg-log { list-style: none; }
.msg-log li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--c-border);
  font-size: 13px;
}
.msg-log li:last-child { border-bottom: 0; }
.msg-log img { width: 32px; height: 32px; object-fit: contain; background: #fff; }
.msg-log .who { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--c-text-3); text-transform: uppercase; }
.msg-log .txt { flex: 1; color: var(--c-text); }
.msg-log .del {
  background: none; border: none; color: var(--c-text-3);
  font-size: 16px; cursor: pointer; padding: 4px 8px;
}
.msg-log .del:hover { color: var(--c-red); }
.msg-log .edit {
  background: none; border: none; color: var(--c-text-3);
  font-size: 14px; cursor: pointer; padding: 4px 6px;
}
.msg-log .edit:hover { color: var(--c-blue); }

/* ── Background dialog ───────────────────────────────────── */
dialog {
  background: var(--c-surface); color: var(--c-text);
  border: 1px solid var(--c-border-strong);
  padding: 16px; max-width: min(560px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,0.6); }
dialog h3 {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.32px; color: var(--c-text-2); margin-bottom: 12px;
}
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.bg-grid button { border: 1px solid var(--c-border); background: #fff; cursor: pointer; padding: 0; }
.bg-grid button.sel { outline: 3px solid var(--c-blue); outline-offset: -3px; }
.bg-grid img { width: 100%; height: 72px; object-fit: cover; display: block; }
.bg-grid .bg-none {
  height: 72px; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #161616;
}

/* ── Panel editor dialog ─────────────────────────────────── */
#panel-dialog { width: min(640px, 94vw); }
#pe-body { max-height: 70vh; overflow-y: auto; }
.pe-lbl {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px;
  color: var(--c-text-3);
  margin: 14px 0 6px;
}
.pe-lbl:first-child { margin-top: 0; }
.pe-text-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pe-text-row .say-input { min-width: 140px; }
.pe-balloons { display: flex; gap: 6px; }
.pe-balloon {
  width: 40px; height: 40px; border-radius: 50%;
  background: #ffffff; border: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: center;
  padding: 0; cursor: pointer;
}
.pe-balloon svg { width: 60%; height: 60%; display: block; }
.pe-row {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 2px 0 6px;
  -webkit-overflow-scrolling: touch;
}
.pe-chip {
  flex: 0 0 auto; width: 64px;
  border: 1px solid var(--c-border); background: #ffffff;
  cursor: pointer; padding: 0; text-align: center;
}
.pe-chip img {
  width: 62px; height: 56px;
  object-fit: contain; object-position: bottom;
  display: block;
}
.pe-chip img.cover { object-fit: cover; object-position: center; }
.pe-chip .none {
  display: flex; align-items: center; justify-content: center;
  width: 62px; height: 56px;
  font-size: 11px; color: #161616;
}
.pe-chip .nm {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; color: #161616; background: #e0e0e0;
  padding: 1px 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pe-chip.sel, .pe-balloon.sel { outline: 3px solid var(--c-blue); outline-offset: -3px; }
.pe-chip:hover, .pe-balloon:hover { border-color: var(--c-border-strong); }
.pe-share {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; color: var(--c-text-2);
}
.pe-share .btn { min-height: 32px; padding: 4px 10px; font-size: 12px; }
.pe-actions { display: flex; gap: 8px; margin-top: 16px; }
.pe-actions .spacer { flex: 1; }
.pe-del { color: var(--c-red); border-color: var(--c-red); }

.foot {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; color: var(--c-text-3);
  margin-top: 24px; line-height: 1.7;
}
.foot a { color: var(--c-blue); text-decoration: none; }
.foot a:hover { text-decoration: underline; }
