/* Loopkins — Character Creator styles. All classes prefixed cr- to avoid collisions.
   Consumes the shared paper/ink tokens from :root (styles.css). */

.cr-wrap { display: flex; flex-direction: column; gap: 20px; }

/* ---------- live preview + name + actions ---------- */
.cr-previewCard { display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: var(--card, #fffaf2); border: 2.5px solid var(--line, #2c2622); border-radius: var(--radius-card, 24px);
  padding: 22px 16px; box-shadow: 4px 5px 0 var(--line, #2c2622); }
.cr-preview { width: 200px; height: 200px; display: grid; place-items: center; }
.cr-avatar { display: block; }
.cr-avatar svg { width: 100%; height: 100%; display: block; overflow: visible; }

.cr-nameRow { display: flex; align-items: center; gap: 10px; }
.cr-nameInput { font-family: var(--font-hand, cursive); font-size: 20px; font-weight: 700; text-align: center; color: var(--ink, #2c2622);
  background: var(--paper, #f5efe1); border: 2.5px dashed var(--line, #2c2622); border-radius: var(--radius-tab, 14px);
  padding: 10px 16px; min-height: 48px; width: 220px; max-width: 60vw; }
.cr-nameInput:focus { outline: 3px solid var(--focus, #1d6fe0); outline-offset: 1px; }
.cr-iconbtn { font-size: 24px; min-width: 64px; min-height: 64px; border-radius: var(--radius-tab, 16px);
  background: var(--card, #fffaf2); border: 2px solid var(--line, #2c2622); color: var(--ink, #2c2622); cursor: pointer;
  box-shadow: 2px 2px 0 var(--line, #2c2622); transition: transform .08s, box-shadow .08s; }
.cr-iconbtn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--line, #2c2622); }

.cr-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.cr-btn { font-family: var(--font-hand, cursive); font-size: 17px; font-weight: 700; min-height: 64px; padding: 14px 22px;
  border-radius: var(--radius-btn, 16px); cursor: pointer; border: 2px solid var(--line, #2c2622);
  box-shadow: 3px 3px 0 var(--line, #2c2622); transition: transform .08s, box-shadow .08s; }
.cr-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--line, #2c2622); }
.cr-btn:disabled { opacity: .6; cursor: default; transform: none; box-shadow: 3px 3px 0 var(--line, #2c2622); }
.cr-btn-random { background: var(--card, #fffaf2); color: var(--ink, #2c2622); }
.cr-btn-save { background: var(--accent, #ffd23f); color: var(--accent-ink, #2c2622); }

/* ---------- editor: tabs + options grid ---------- */
.cr-editor { background: var(--card, #fffaf2); border: 2.5px solid var(--line, #2c2622); border-radius: var(--radius-card, 24px); padding: 16px; }
.cr-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cr-tab { min-width: 64px; min-height: 64px; font-size: 26px; line-height: 1; border-radius: var(--radius-tab, 16px);
  background: var(--paper, #f5efe1); border: 2px solid var(--line, #2c2622); color: var(--ink, #2c2622); cursor: pointer;
  box-shadow: 2px 2px 0 var(--line, #2c2622); transition: transform .08s, box-shadow .08s, background .1s; }
.cr-tab:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--line, #2c2622); }
.cr-tab-active { background: var(--accent, #ffd23f); }

.cr-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 12px; }
.cr-option { min-width: 64px; min-height: 64px; border-radius: var(--radius-tab, 16px); background: var(--paper, #f5efe1);
  border: 2px solid var(--line-soft, #a89678); display: grid; place-items: center; cursor: pointer; padding: 6px;
  transition: transform .08s, border-color .1s, background .1s; }
.cr-option:active { transform: scale(.94); }
.cr-option .cr-avatar { width: 56px; height: 56px; }
.cr-option-selected { border-color: var(--line, #2c2622); background: var(--accent, #ffd23f); }
.cr-option-none { font-size: 28px; }
.cr-noneMark { opacity: .7; }

.cr-swatch { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--line, #2c2622);
  background: var(--sw); cursor: pointer; box-shadow: 2px 2px 0 var(--line, #2c2622); transition: transform .08s; }
.cr-swatch:active { transform: scale(.92); }
.cr-swatch-selected { box-shadow: 0 0 0 3px var(--card, #fffaf2), 0 0 0 6px var(--line, #2c2622); }

.cr-empty { font-family: var(--font-body, sans-serif); color: var(--ink-soft, #5b534a); }

/* ---------- sound picker ---------- */
.cr-soundGroup { margin-bottom: 16px; }
.cr-soundGroup:last-child { margin-bottom: 0; }
.cr-soundGroupTitle { font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--c); margin: 0 0 8px; }
.cr-chipRow { display: flex; flex-wrap: wrap; gap: 10px; }
.cr-chip { display: flex; align-items: center; gap: 8px; min-height: 64px; padding: 10px 16px;
  border-radius: var(--radius-pill, 999px); background: var(--paper, #f5efe1); border: 2px solid var(--c, var(--line-soft, #a89678));
  color: var(--ink, #2c2622); cursor: pointer; transition: transform .08s, background .1s; }
.cr-chip:active { transform: scale(.96); }
.cr-chip-selected { background: color-mix(in srgb, var(--c, var(--cat-fallback, #8a8172)) 28%, var(--paper, #f5efe1)); border-color: var(--line, #2c2622); }
.cr-chip-playing { box-shadow: 0 0 0 3px var(--c, var(--cat-fallback, #8a8172)); }
.cr-chipEmoji { font-size: 24px; }
.cr-chipName { font-family: var(--font-hand, cursive); font-size: 15px; font-weight: 700; }

/* ---------- my loopkins gallery ---------- */
.cr-gallery { padding-bottom: 8px; }
.cr-galleryTitle { font-size: 15px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft, #5b534a); margin: 0 0 10px; }
.cr-galleryEmpty { font-family: var(--font-body, sans-serif); color: var(--ink-soft, #5b534a); }
.cr-galleryStrip { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.cr-galleryItem { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 88px; }
.cr-galleryLoad { width: 80px; height: 80px; border-radius: var(--radius-tab, 20px); background: var(--card, #fffaf2);
  border: 2px solid var(--line, #2c2622); display: grid; place-items: center; cursor: pointer; padding: 4px;
  box-shadow: 2px 2px 0 var(--line, #2c2622); transition: transform .08s, box-shadow .08s; }
.cr-galleryLoad:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--line, #2c2622); }
.cr-galleryLoad .cr-avatar { width: 68px; height: 68px; }
.cr-galleryName { font-family: var(--font-hand, cursive); font-size: 13px; font-weight: 700; max-width: 88px; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-galleryDelete { min-width: 64px; min-height: 44px; font-size: 16px; background: var(--paper, #f5efe1);
  border: 1.5px solid var(--line-soft, #a89678); border-radius: 10px; color: var(--ink-soft, #5b534a); cursor: pointer; }
.cr-galleryDelete:active { transform: scale(.94); }

@media (max-width: 720px) {
  .cr-options { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .cr-preview { width: 160px; height: 160px; }
}
@media (prefers-reduced-motion: reduce) {
  .cr-btn, .cr-tab, .cr-option, .cr-swatch, .cr-chip, .cr-galleryLoad, .cr-iconbtn, .cr-galleryDelete { transition: none; }
}

:focus-visible { outline: 3px solid var(--focus, #1d6fe0); outline-offset: 2px; }
