/* builder.css — chrome for the standalone external character builder.
 *
 * SCOPE RULE: this file styles the PAGE AROUND the creator, plus the printable sheet. It must not
 * restyle any `cc-*` rule — those live in style.css and are shared with the in-app creator, so a
 * tweak here to make the builder look nicer would silently change the app. If a `cc-*` rule needs
 * to change, change it in style.css where both surfaces get it.
 *
 * style.css is loaded first (see builder.html) for exactly that reason: the creator arrives fully
 * styled and this file only adds the frame.
 */

.builder-body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg, #14110f);
  color: var(--fg, #e8e2d8);
  font-family: var(--font-body, system-ui, -apple-system, "Segoe UI", sans-serif);
}

/* ── Header ─────────────────────────────────────────────────────────────────────────────── */

.builder-header {
  border-bottom: 1px solid var(--rule, rgba(255, 255, 255, 0.12));
  background: var(--panel, rgba(255, 255, 255, 0.03));
}

.builder-header-inner {
  max-width: 62rem;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  align-items: baseline;
  justify-content: space-between;
}

.builder-title {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.01em;
}

.builder-tagline,
.builder-manifest {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  opacity: 0.7;
}

.builder-header-side { text-align: right; }

/* Optional sign-in strip (only rendered when the auth SDK loaded). */
.builder-auth { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.4rem 0.6rem; margin: 0 0 0.4rem; }
.builder-auth-who { font-size: 0.82rem; color: var(--ink-soft, #b7ad97); }
.builder-link-btn { background: none; border: none; padding: 0; color: var(--ember, #c9a227); font-weight: 600; font-size: 0.85rem; cursor: pointer; }
.builder-link-btn:hover { text-decoration: underline; }
.builder-auth-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.builder-auth-form input { font: inherit; font-size: 0.85rem; padding: 0.3rem 0.45rem; border: 1px solid var(--border, #4a4030); border-radius: 6px; background: var(--card, #241f18); color: var(--ink, #ece4d6); min-width: 8.5rem; }
.builder-auth-form .builder-btn.is-primary { padding: 0.32rem 0.7rem; font-size: 0.82rem; }
.builder-auth-msg { font-size: 0.78rem; color: var(--ink-soft, #b7ad97); }
.builder-auth-new { display: block; font-size: 0.78rem; color: var(--ink-soft, #b7ad97); text-decoration: none; margin-top: 0.15rem; }
.builder-auth-new:hover { text-decoration: underline; }

.builder-home { margin: 0; font-size: 0.9rem; }
.builder-home a { color: var(--ember, #c9a227); text-decoration: none; font-weight: 600; }
.builder-home a:hover { text-decoration: underline; }
.builder-home a:focus-visible { outline: 2px solid var(--ember, #c9a227); outline-offset: 3px; border-radius: 2px; }

/* ── Main ───────────────────────────────────────────────────────────────────────────────── */

.builder-main {
  max-width: 62rem;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

.builder-footer {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule, rgba(255, 255, 255, 0.12));
}

.builder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Mode toggle: build one character vs roll a whole party. Segmented, echoing .builder-btn. */
.builder-modes {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.builder-mode-btn {
  min-height: 40px;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--rule, rgba(255, 255, 255, 0.25));
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.builder-mode-btn:hover { background: rgba(255, 255, 255, 0.06); }
.builder-mode-btn.is-active {
  background: var(--accent, #c9a227);
  border-color: var(--accent, #c9a227);
  color: #14110f;
  font-weight: 600;
}

/* Party-member sheet modal — a rolled card's full sheet, rendered by WFBuilderSheet. */
.builder-sheet-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 2rem 1rem; overflow: auto;
}
.builder-sheet-modal[hidden] { display: none; }
.builder-sheet-modal-inner {
  position: relative; width: 100%; max-width: 60rem;
  background: #fff; border-radius: 10px; box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
}
.builder-sheet-modal-close {
  position: absolute; top: 0.5rem; right: 0.5rem; z-index: 1;
  width: 2rem; height: 2rem; border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.15); background: #fff; color: #333;
  font-size: 1rem; cursor: pointer;
}
.builder-sheet-modal-close:hover { background: #f2f2f2; }
.builder-sheet-modal-body { padding: 1.25rem; }

/* 44px min-height: the WCAG 2.2 tap-target floor the app's E2 pass established. The builder is a
 * new surface and had no reason to inherit the mistake that pass fixed. */
.builder-btn {
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  border-radius: 6px;
  border: 1px solid var(--rule, rgba(255, 255, 255, 0.25));
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.builder-btn:hover { background: rgba(255, 255, 255, 0.06); }

.builder-btn:focus-visible {
  outline: 2px solid var(--accent, #c9a227);
  outline-offset: 2px;
}

.builder-btn.is-primary {
  background: var(--accent, #c9a227);
  border-color: var(--accent, #c9a227);
  color: #14110f;
  font-weight: 600;
}

.builder-btn.is-primary:hover { filter: brightness(1.08); }

.builder-status {
  margin: 0.75rem 0 0;
  min-height: 1.4em;
  font-size: 0.9rem;
}

.builder-status.is-ok { color: var(--ok, #7fb069); }
.builder-status.is-warn { color: var(--warn, #d98c4a); }

.builder-hint,
.builder-legal {
  font-size: 0.8rem;
  opacity: 0.6;
  line-height: 1.5;
}

.builder-hint { margin: 0.5rem 0 0; }

.builder-legal {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule, rgba(255, 255, 255, 0.08));
}

.builder-legal a { color: inherit; }

@media (max-width: 40rem) {
  .builder-header-inner { padding: 1rem; }
  .builder-header-side { text-align: left; }
  .builder-main { padding: 1rem 1rem 3rem; }
  .builder-btn { width: 100%; }
}

/* The printable sheet styles moved to the shared frontend/sheet.css (used by both this offline
   builder and the in-app Print-sheet export). Loaded via <link> in builder.html. */
