/* src/character-select.css — CHAR-SLOTS-04 (#3178) / CHARSEL-V2-LOOKS-01 (#3228)
 * Full-screen character manager: list (left) · class art preview (center) ·
 * identity (right). Centered states (loading / entering / error) reuse .cs-card.
 * Cyan accent language per art bible; class differentiation via hue.
 */

/* ── Overlay backdrop ──────────────────────────────────────────── */

#character-select-overlay {
  position: fixed;
  inset: 0;
  z-index: 8850;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(12, 20, 34, 0.82), rgba(4, 6, 12, 0.94));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
}

#character-select-overlay.cs-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Centered states (loading / entering / error) ──────────────── */

.cs-card {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  padding: 32px 28px 28px;
  border-radius: 16px;
  background: rgba(8, 12, 20, 0.93);
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7);
  color: #cbd5e1;
}
.cs-card--centered { text-align: center; }

/* ── Full-screen manager ───────────────────────────────────────── */

.cs-screen {
  position: relative;
  width: min(1040px, calc(100vw - 40px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px clamp(16px, 3vw, 36px) 32px;
  border-radius: 20px;
  background: rgba(8, 12, 20, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 200, 255, 0.05) inset;
  animation: cs-fade-up 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cs-fade-up {
  from { opacity: 0; transform: translateY(12px) scale(0.99); }
  to   { opacity: 1; transform: none; }
}

.cs-header { text-align: center; }

.cs-title {
  font-size: clamp(20px, 2.4vw, 26px);
  font-weight: 800;
  color: #e2e8f0;
  margin: 0 0 4px;
  letter-spacing: 0.01em;
}
.cs-sub { font-size: 13px; color: #64748b; margin: 0; }

.cs-body {
  display: grid;
  grid-template-columns: minmax(230px, 0.9fr) 1.2fr minmax(230px, 1fr);
  gap: clamp(14px, 2vw, 26px);
  align-items: stretch;
  min-height: 0;
}

/* ── Left: character list ──────────────────────────────────────── */

.cs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.cs-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.55);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 80ms ease;
}
.cs-list-item:hover { border-color: rgba(148, 163, 184, 0.34); background: rgba(15, 23, 42, 0.8); }
.cs-list-item:active { transform: translateY(1px); }
.cs-list-item--active {
  border-color: rgba(0, 200, 255, 0.6);
  background: rgba(0, 200, 255, 0.08);
  box-shadow: 0 0 0 1px rgba(0, 200, 255, 0.2) inset;
}
.cs-list-item--empty {
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.3);
  color: #94a3b8;
}
.cs-list-item:focus-visible { outline: 2px solid rgba(0, 200, 255, 0.5); outline-offset: 2px; }

.cs-list-emblem {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: rgba(8, 12, 20, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
}
.cs-list-emblem--plus { font-size: 24px; color: #67e8f9; }
.cs-list-text { min-width: 0; }
.cs-list-name { font-size: 14px; font-weight: 700; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-list-class { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #67e8f9; }
.cs-list-create { font-size: 13px; font-weight: 600; }

/* ── Center: class art preview ─────────────────────────────────── */

.cs-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.cs-preview-frame {
  width: clamp(150px, 16vw, 210px);
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(0, 200, 255, 0.14), transparent 70%),
    linear-gradient(160deg, rgba(15, 23, 42, 0.9), rgba(8, 12, 20, 0.95));
  border: 1px solid rgba(0, 200, 255, 0.22);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}
.cs-preview-emblem { font-size: clamp(64px, 9vw, 104px); line-height: 1; filter: drop-shadow(0 6px 18px rgba(0, 200, 255, 0.35)); }
.cs-preview-name { font-size: clamp(16px, 1.8vw, 20px); font-weight: 800; color: #e2e8f0; text-align: center; }
.cs-preview-empty { color: #475569; font-size: 14px; }

/* ── Right: identity ───────────────────────────────────────────── */

.cs-identity {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}
.cs-identity-class {
  font-size: 16px; font-weight: 800; letter-spacing: 0.04em;
  color: #67e8f9;
}
.cs-identity-desc { font-size: 13px; line-height: 1.5; color: #94a3b8; margin: 0; }
.cs-identity-created { font-size: 11px; letter-spacing: 0.04em; color: #475569; margin: 0; }

/* ── Starter identity accent — single class: Soma Recruit (cyan) ── */
.cs-class-recruit.cs-list-emblem,
.cs-class-recruit.cs-preview-frame .cs-preview-emblem { color: #67e8f9; }
.cs-class-recruit.cs-identity-class { color: #67e8f9; }

/* ── Play button ───────────────────────────────────────────────── */

.cs-play-btn {
  margin-top: 6px;
  padding: 12px 24px;
  border-radius: 10px;
  border: 1px solid rgba(0, 200, 255, 0.45);
  background: rgba(0, 200, 255, 0.16);
  color: #a5f3fc;
  font-size: 14px; font-weight: 800; letter-spacing: 0.04em;
  font-family: inherit;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, transform 80ms ease;
}
.cs-play-btn:hover { background: rgba(0, 200, 255, 0.28); border-color: rgba(0, 200, 255, 0.7); }
.cs-play-btn:active { transform: translateY(1px); }
.cs-play-btn:focus-visible { outline: 2px solid rgba(0, 200, 255, 0.6); outline-offset: 2px; }

/* ── IDENTITY-NAME-01F: callsign section + Choose/Rename ───────────── */
.cs-callsign {
  margin-top: 14px; padding: 12px 14px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.16);
  display: flex; flex-direction: column; gap: 6px;
}
.cs-callsign-handle {
  font-size: 15px; font-weight: 800; letter-spacing: 0.02em; color: #e2e8f0;
  font-variant-numeric: tabular-nums; word-break: break-all;
}
.cs-callsign-status { font-size: 12px; color: #64748b; }
.cs-callsign-status--forced { color: #fca5a5; font-weight: 700; }
.cs-callsign-btn {
  align-self: flex-start; margin-top: 4px;
  padding: 7px 14px; border-radius: 8px;
  border: 1px solid rgba(0, 200, 255, 0.4);
  background: rgba(0, 200, 255, 0.10); color: #a5f3fc;
  font-size: 12px; font-weight: 700; letter-spacing: 0.03em; font-family: inherit;
  cursor: pointer; transition: background 150ms ease, border-color 150ms ease;
}
.cs-callsign-btn:hover { background: rgba(0, 200, 255, 0.2); border-color: rgba(0, 200, 255, 0.65); }
.cs-callsign-btn:focus-visible { outline: 2px solid rgba(0, 200, 255, 0.6); outline-offset: 2px; }
.cs-callsign-btn--required { border-color: rgba(250, 204, 21, 0.6); background: rgba(250, 204, 21, 0.14); color: #fde68a; }
.cs-callsign-btn--required:hover { background: rgba(250, 204, 21, 0.24); }
.cs-play-btn--blocked { opacity: 0.4; cursor: not-allowed; }
.cs-play-btn--blocked:hover { background: rgba(0, 200, 255, 0.16); border-color: rgba(0, 200, 255, 0.45); }

/* ── Log out / switch account (CHARSEL-V2-LOGOUT-01) ───────────────
 * Understated top-right chrome — must not compete with the cyan Play CTA.
 * Muted slate at rest; warms to a "leave" red on hover. */
.cs-logout-btn {
  position: absolute;
  top: clamp(14px, 2vw, 20px);
  right: clamp(14px, 2.4vw, 24px);
  z-index: 2;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.55);
  color: #94a3b8;
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease, transform 80ms ease;
}
.cs-logout-btn:hover { border-color: rgba(248, 113, 113, 0.5); color: #fca5a5; background: rgba(69, 10, 10, 0.4); }
.cs-logout-btn:active { transform: translateY(1px); }
.cs-logout-btn:focus-visible { outline: 2px solid rgba(0, 200, 255, 0.5); outline-offset: 2px; }
.cs-logout-btn[disabled] { opacity: 0.6; cursor: default; }

/* ── Status / spinner / error / retry (centered states) ────────── */

.cs-status { font-size: 13px; color: #64748b; margin: 16px 0 0; }
.cs-error-msg { font-size: 13px; color: #f87171; margin: 12px 0 16px; }
.cs-retry-btn {
  padding: 9px 22px; border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.22); background: transparent;
  color: #94a3b8; font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; display: block; margin: 0 auto;
  transition: border-color 150ms ease, color 150ms ease;
}
.cs-retry-btn:hover { border-color: rgba(148, 163, 184, 0.4); color: #cbd5e1; }
.cs-retry-btn:focus-visible { outline: 2px solid rgba(0, 200, 255, 0.5); outline-offset: 2px; }

.cs-spinner {
  width: 28px; height: 28px; margin: 18px auto 4px;
  border: 3px solid rgba(148, 163, 184, 0.25);
  border-top-color: #67e8f9;
  border-radius: 50%;
  animation: cs-spin 700ms linear infinite;
}
@keyframes cs-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .cs-spinner { animation-duration: 1600ms; }
  .cs-screen { animation: none; }
}

/* ── Responsive: stack columns on narrow viewports ─────────────── */

@media (max-width: 760px) {
  .cs-body { grid-template-columns: 1fr; }
  .cs-preview { order: -1; }
  .cs-preview-frame { width: clamp(120px, 30vw, 160px); }
}

/* ── CHAR-DELETE-V1: character deletion button ─────────────────────
 * Understated secondary action sitting below the primary Play CTA.
 * Muted slate at rest; warms to danger red on hover (same pattern as
 * the logout button — both are "leave" affordances, not game CTAs). */
.cs-delete-btn {
  align-self: flex-end;
  margin-bottom: 2px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: transparent;
  color: #64748b;
  font-size: 11px; font-weight: 600; letter-spacing: 0.03em;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease, transform 80ms ease;
}
.cs-delete-btn:hover {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fca5a5;
  background: rgba(69, 10, 10, 0.35);
}
.cs-delete-btn:active { transform: translateY(1px); }
.cs-delete-btn:focus-visible { outline: 2px solid rgba(248, 113, 113, 0.5); outline-offset: 2px; }
