/* Chitmunk Game Home — Styles */
/* Uses shared tokens from tokens.css */
/*
 * Stages restyle (R1). One card, one table, one form, one button family,
 * one pill — all driven by tokens.css so light and dark stay in step.
 * Bricolage Grotesque for the page title and section headings (26 / 18 / 15),
 * Nunito for body. Fraunces (--font-display) is retired from the product.
 *
 * --on-accent below is the only literal colour in this file: the ink that
 * sits on the amber accent. Amber is theme-invariant, so this value is too.
 * Promote it to tokens.css when that file is next owned.
 */

/* --on-accent now lives in tokens.css (both themes). */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg-secondary);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ═══════════════════ LOGIN WALL ═══════════════════ */

.home-login-wall {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9999;
}

/* ═══════════════════ APP SHELL ═══════════════════ */
/*
 * The band (#cmBand, styled in shell/shell.css) is the top-level nav —
 * there's no left sidebar anymore. --cm-page-bg tells the band which
 * background the content below it uses, so the active tab's rounded
 * "folder" join looks seamless instead of showing a color seam.
 */

.home-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  --cm-page-bg: var(--bg-secondary);
}

#cmBand { flex: none; }

/* ── Global Search (mounted into the band's search slot) ── */

.global-search-wrapper {
  padding: 0 12px 8px;
  position: relative;
}

.global-search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-size: var(--text-base);
  font-family: inherit;
  color: var(--text);
  transition: border-color var(--transition);
}

.global-search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.global-search-input::placeholder { color: var(--text-dim); }

.global-search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% - 4px);
  left: 12px;
  right: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 200;
}

.global-search-dropdown.open { display: block; }

.global-search-category {
  font-size: 11px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
  padding: 8px 12px 4px;
}

.global-search-item {
  padding: 7px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition);
}

.global-search-item:hover,
.global-search-item.selected {
  background: var(--bg-elevated);
}

.global-search-item-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
}

.global-search-item-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-search-empty {
  padding: 16px 12px;
  font-size: var(--text-base);
  color: var(--text-dim);
  text-align: center;
}

/* ═══════════════════ MAIN CONTENT ═══════════════════ */

.home-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-secondary);
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px 64px;
}

/*
 * The top gap is a margin on whatever renders first, not padding on the
 * scroll container: Chromium anchors sticky offsets to the scroller's
 * content box, so container padding would leave a strip of page scrolling
 * above every pinned row.
 */
.home-content > :first-child { margin-top: 28px; }

/* ═══════════════════ SHARED VIEW STYLES ═══════════════════ */

/*
 * One page header: the title and its subtitle stack on the left, everything
 * else in the header (actions, a search field, a back button) rides on the
 * same first row, right-aligned. Views hand us their children in DOM order,
 * so the subtitle is ordered last and wraps onto its own full-width line.
 */
.view-header {
  padding: 0 0 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px 16px;
}

.view-header > .view-title { margin-right: auto; }

.view-header > .view-subtitle {
  flex: 1 0 100%;
  order: 99;
  margin-right: auto;
}

/* The guides reader puts a back button before the title — keep it above. */
.view-header > .guides-back-btn { flex: 1 0 100%; order: -1; }

.view-title {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.view-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.45;
}

.view-body {
  padding: 0 0 24px;
}

/*
 * Long lists keep their search / filter row reachable: it sticks to the top
 * of the scrolling page, directly under the band. The negative margins let
 * its background span the full page gutter instead of leaving two 32px
 * strips of content sliding past.
 */
.dash-tabs-bar,
.filter-bar,
.guides-search-bar,
.view-header:has(> .cv-search) {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg-secondary);
  margin-left: -32px;
  margin-right: -32px;
  padding-left: 32px;
  padding-right: 32px;
}

.dash-tabs-bar,
.filter-bar,
.guides-search-bar {
  padding-top: 10px;
  padding-bottom: 10px;
}

.view-header:has(> .cv-search) { padding-top: 4px; }

/*
 * On routes that carry a sub-nav the sub-nav is already pinned at the top
 * (36px tall, from shell/shell.css), so the filter row stacks
 * flush underneath it instead of hiding it.
 */
.home-content:has(> .cm-subnav) .dash-tabs-bar,
.home-content:has(> .cm-subnav) .filter-bar,
.home-content:has(> .cm-subnav) .guides-search-bar,
.home-content:has(> .cm-subnav) .view-header:has(> .cv-search) { top: 36px; }

/* Fade-in animation for view transitions */
.view-body { animation: viewFadeIn 0.2s ease; }

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════ BUTTONS ═══════════════════ */

/*
 * One button family. The base .btn is the secondary button — outlined, on the
 * card ground — because most buttons on /home are secondary and several views
 * write a bare `class="btn"`. Amber fill is opt-in (.btn-primary/.btn-accent)
 * so there is one filled button per screen. .btn-accent, .btn-secondary and
 * .btn-danger are the editor's names for the same three; /home never loads
 * style.css, so they are aliased here rather than left undefined.
 */
.btn,
.btn-outline,
.btn-secondary {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  border: 1px solid var(--border-light);
  background: var(--bg-primary);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:hover,
.btn-outline:hover,
.btn-secondary:hover { border-color: var(--text-dim); color: var(--text); }

.btn-primary,
.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover,
.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}

.btn-danger-outline,
.btn-danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn-danger-outline:hover,
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; } /* --on-accent is dark ink for amber; red needs white (compliance D-1) */

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); border-color: transparent; color: var(--text); }

.btn-sm { height: 28px; padding: 0 10px; font-size: var(--text-base); border-radius: var(--radius-sm); }

/* ═══════════════════ CARDS ═══════════════════ */

/*
 * One card: page ground is --bg-secondary, the card is --bg-primary with a
 * 1px --border and a 12px radius. No shadows — the border does the work, in
 * both themes. Hover moves the border, not the card.
 */
.card,
.section-card,
.overview-collapsible,
.preflight-category,
.dash-stat,
.dash-project-card,
.dash-game-card,
.feature-card,
.history-item,
.validate-item,
.cv-card,
.toolkit-card,
.guides-card,
.template-card,
.preview-card,
.game-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: none;
}

.card { overflow: hidden; }

.card-hoverable {
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.card-hoverable:hover { border-color: var(--text-dim); }

/* ═══════════════════ SECTION LABEL ═══════════════════ */

.section-label {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  margin-bottom: 14px;
}

/* ═══════════════════ ONE TABLE ═══════════════════ */

.home-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.home-content th,
.home-content td {
  height: 38px;
  padding: 0 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.home-content th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 800;
  white-space: nowrap;
}

/* ═══════════════════ GAME CARD GRID ═══════════════════ */

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.game-card { cursor: pointer; overflow: hidden; transition: border-color 0.15s ease; }

.game-card:hover { border-color: var(--text-dim); }

.game-card-thumb {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -2px;
  position: relative;
}

.game-card-info { padding: 14px 16px; border-top: 1px solid var(--border-subtle); }

.game-card-name { font-family: var(--font-heading); font-size: var(--text-lg); font-weight: 700; margin-bottom: 3px; }

.game-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: center;
}

.game-card-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-dim);
}

.game-card-add {
  border-style: dashed;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  min-height: 190px;
  color: var(--text-muted);
}

.game-card-add:hover { border-color: var(--accent); color: var(--accent); }

.game-card-source-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 10px;
  line-height: 1;
  padding: 3px 5px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

/* ═══════════════════ OVERVIEW GRID ═══════════════════ */

.overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.overview-card { padding: 18px 20px; }

.overview-card h3 {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  margin-bottom: 12px;
}

/*
 * Game details' Actions card is a row of buttons, not six stacked bars.
 * The view sets width:100% inline on each button, so the override has to
 * win on specificity and !important; the first button stays primary.
 */
.overview-card:has(> div > #ovEditCards) > div {
  flex-direction: row !important;
  flex-wrap: wrap;
  gap: 8px !important;
}

.overview-card:has(> div > #ovEditCards) > div > .btn {
  width: auto !important;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-base);
}

.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--text-secondary); }
.stat-value { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Settings switch — visual on/off control */
.settings-switch {
  --switch-w: 36px;
  --switch-h: 20px;
  --thumb: 14px;
  position: relative;
  display: inline-block;
  width: var(--switch-w);
  height: var(--switch-h);
  border-radius: 999px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0;
  vertical-align: middle;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}
.settings-switch::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: var(--thumb);
  height: var(--thumb);
  border-radius: 50%;
  background: var(--text-muted);
  transform: translateY(-50%);
  transition: left 0.15s ease, background 0.15s ease;
}
.settings-switch:hover { border-color: var(--text-dim); }
.settings-switch.settings-switch-on {
  background: var(--accent);
  border-color: var(--accent);
}
.settings-switch.settings-switch-on::before {
  left: calc(100% - var(--thumb) - 3px);
  background: var(--on-accent);
}
.settings-switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .settings-switch, .settings-switch::before { transition: none; }
}

.component-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.component-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.component-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }

.component-chip-count { color: var(--text-muted); margin-left: 4px; font-weight: 700; }

/* ═══════════════════ OVERVIEW COLLAPSIBLE SECTIONS ═══════════════════ */

.overview-collapsible {
  margin-bottom: 12px;
  overflow: hidden;
}

.overview-collapsible[open] {
  border-color: var(--border);
}

.overview-collapsible-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background 0.15s;
}

.overview-collapsible-summary::-webkit-details-marker { display: none; }

.overview-collapsible-summary::after {
  content: '\25BE';
  margin-left: auto;
  font-size: 14px;
  color: var(--text-dim);
  transition: transform 0.2s;
}

.overview-collapsible[open] > .overview-collapsible-summary::after {
  transform: rotate(180deg);
}

.overview-collapsible-summary:hover {
  background: var(--bg-hover);
}

.overview-collapsible-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.overview-collapsible-badge:empty { display: none; }

.overview-collapsible-body {
  padding: 0 20px 16px;
}

/* ═══════════════════ EXPORT GRID ═══════════════════ */

.export-grid {
  column-count: 2;
  column-gap: 16px;
}
.export-grid > .card {
  break-inside: avoid;
  margin-bottom: 16px;
}

.export-category-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.export-category-name {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}

.export-category-desc {
  font-size: 12px;
  color: var(--text-muted);
}

.export-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  cursor: pointer;
  transition: background var(--transition);
  font-size: var(--text-base);
  border-bottom: 1px solid var(--border-subtle);
}

.export-item:last-child { border-bottom: none; }
.export-item:hover { background: var(--bg-hover); }

.export-item-name { font-weight: 600; }
.export-item-sub { font-size: 13px; font-weight: 400; color: var(--text-muted); margin-top: 2px; }

.export-item-arrow {
  color: var(--text-dim);
  font-size: 18px;
  font-weight: 400;
  transition: transform var(--transition);
}

.export-item:hover .export-item-arrow { transform: translateX(2px); color: var(--text-muted); }

.tier-badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

/* ═══════════════════ TABS ═══════════════════ */

.tab-bar {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 8px 14px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}

.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-btn:hover:not(.active) { color: var(--text); }

/* ═══════════════════ FILTER PILLS ═══════════════════ */

.filter-bar { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }

/* One pill: 28px tall, fully rounded, filled amber when it's the one on. */
.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.filter-btn.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.filter-btn:hover:not(.active) { border-color: var(--text-dim); color: var(--text); }

/* ═══════════════════ WELCOME BANNER ═══════════════════ */

.welcome-banner {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.welcome-text h2 { font-family: var(--font-heading); font-size: 18px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.015em; }
.welcome-text p { color: var(--text-muted); font-size: var(--text-md); }
.welcome-actions { display: flex; gap: 8px; }

/* ═══════════════════ HISTORY ═══════════════════ */

.history-list { display: flex; flex-direction: column; gap: 6px; }

.history-item {
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background var(--transition);
}

.history-item:hover { background: var(--bg-hover); }

.history-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.history-dot.auto { background: var(--text-dim); }

.history-info { flex: 1; }
.history-name { font-size: var(--text-base); font-weight: 700; }
.history-date { font-size: var(--text-sm); color: var(--text-muted); }

.history-action {
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
  transition: background var(--transition);
}

.history-action:hover { background: var(--accent-bg); }

.history-diff-body {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: -2px 0 4px 0;
  font-size: 12px;
  line-height: 1.6;
}

.history-diff-heading {
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.history-diff-line.add { color: var(--success); }
.history-diff-line.remove { color: var(--danger); }
.history-diff-line.change { color: var(--warn); }
.history-diff-line.same { color: var(--text-dim); font-style: italic; }

/* ═══════════════════ SECTION CARDS ═══════════════════ */

.section-card {
  padding: 18px 20px;
  margin-bottom: 16px;
}

.section-card h3,
.card > h3,
.overview-card > h3 {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

/* Narrow column for form-like views (Settings, Account) */
.view-body-narrow { max-width: 800px; }

/* ═══════════════════ FEATURE REQUESTS ═══════════════════ */

.fr-submit-card {
  display: flex;
  flex-direction: column;
  padding: 28px 28px 24px;
  margin-bottom: 20px;
  border-left: 3px solid var(--accent);
  position: relative;
  overflow: hidden;
}
.fr-submit-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h1v1H0zM10 10h1v1h-1z' fill='%23000' fill-opacity='.02'/%3E%3C/svg%3E");
  pointer-events: none;
}
.fr-submit-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.fr-submit-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fr-submit-icon svg { display: block; }
.fr-submit-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.fr-submit-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 1px;
}
.fr-submit-card .form-input {
  position: relative;
}
.fr-submit-card .form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.fr-submit-row { margin-top: 0; }

/* ── Filter bar ── */
.fr-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.fr-filter-label {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.fr-filter-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: -4px;
}
.fr-filter-spacer { flex: 1; }
.fr-filter-select {
  font-size: 13px;
  padding: 6px 10px;
  width: auto;
  min-width: 130px;
  border-radius: var(--radius);
}

/* ── Grid ── */
.fr-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Request cards ── */
.fr-card {
  display: flex;
  gap: 16px;
  padding: 18px 20px;
  align-items: flex-start;
  transition: border-color 0.15s;
}
.fr-card:hover { border-color: var(--text-dim); }

/* ── Vote column ── */
.fr-vote-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 44px;
  flex-shrink: 0;
  padding-top: 2px;
}
.fr-vote-btn {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  width: 40px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
  font-family: inherit;
}
.fr-vote-btn svg {
  transition: transform 0.2s ease;
}
.fr-vote-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}
.fr-vote-btn:hover svg { transform: translateY(-1px); }
.fr-vote-btn.voted {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.fr-vote-btn.voted svg { transform: translateY(-1px); }
.fr-vote-btn:disabled { opacity: 0.35; cursor: default; }
.fr-vote-btn:disabled:hover { border-color: var(--border); color: var(--text-muted); background: transparent; }
.fr-vote-count {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  transition: color 0.2s ease;
}
.fr-vote-btn.voted ~ .fr-vote-count { color: var(--accent); }

/* ── Content area ── */
.fr-content { flex: 1; min-width: 0; }
.fr-card-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.fr-card-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}
.fr-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.01em;
}
.fr-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.fr-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 6px;
}
.fr-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.fr-meta-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: var(--text-muted);
  flex-shrink: 0;
  text-transform: uppercase;
}
.fr-admin-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle, var(--border));
}
.fr-status-select {
  font-size: 11px;
  padding: 4px 8px;
  width: auto;
  border-radius: var(--radius);
}
.fr-delete-btn {
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: 6px;
  color: var(--danger);
  font-size: 15px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.fr-delete-btn:hover { background: var(--danger-dim); border-color: var(--danger); }

/* ── Empty state ── */
.fr-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 56px 24px;
}
.fr-empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--accent-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.fr-empty-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.015em;
}
.fr-empty-desc {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 340px;
  line-height: 1.5;
}

/* ── Sign-in prompt ── */
.fr-signin-card {
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 20px;
}
.fr-signin-card .fr-signin-text {
  color: var(--text-muted);
  font-size: 14px;
}

/* ═══════════════════ VALIDATE ═══════════════════ */

.validate-results { display: flex; flex-direction: column; gap: 8px; }

.validate-item {
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: var(--text-base);
}

.validate-icon { font-size: 16px; margin-top: 1px; }
.validate-label { font-weight: 700; margin-bottom: 2px; }
.validate-desc { font-size: 12px; color: var(--text-muted); }

.validate-card-group summary:hover { background: var(--bg-hover); }
.validate-card-group summary::-webkit-details-marker { color: var(--text-muted); }

.validate-issue-row:hover { background: var(--bg-hover); }

.validate-goto-link:hover {
  background: var(--accent) !important;
  color: var(--on-accent) !important;
}

/* ═══════════════════ PREFLIGHT ═══════════════════ */

/* Summary card with progress ring */
.preflight-summary {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px 28px !important;
  margin-bottom: 16px;
}

.preflight-ring { flex-shrink: 0; }

.preflight-ring-progress {
  transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.preflight-summary-text { flex: 1; min-width: 0; }

.preflight-summary-label {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}

.preflight-summary-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.preflight-stat {
  font-size: var(--text-md);
  color: var(--text-muted);
}

.preflight-stat-count {
  font-weight: 800;
  margin-right: 3px;
}

/* Category (collapsible <details>) */
.preflight-category {
  margin-bottom: 12px;
  overflow: hidden;
}

.preflight-category[open] > .preflight-category-body {
  animation: viewFadeIn 0.15s ease;
}

.preflight-category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  list-style: none;
}

.preflight-category-header::-webkit-details-marker { display: none; }

.preflight-category-header::after {
  content: '\25B8';
  margin-left: auto;
  font-size: 12px;
  color: var(--text-dim);
  transition: transform var(--transition);
}

.preflight-category[open] > .preflight-category-header::after {
  transform: rotate(90deg);
}

.preflight-category-header:hover {
  background: var(--bg-hover);
}

.preflight-category-icon {
  display: flex;
  align-items: center;
  color: var(--text-dim);
}

.preflight-category-title { flex-shrink: 0; }

.preflight-category-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--bg-tertiary);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.preflight-level-error .preflight-category-count { background: var(--danger-dim); color: var(--danger); }
.preflight-level-warning .preflight-category-count { background: var(--warning-dim); color: var(--warn); }

.preflight-category-badges {
  display: flex;
  gap: 6px;
  margin-left: 4px;
}

.preflight-category-body {
  padding: 0 20px 16px;
}

/* Badges (pills) */
.preflight-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.preflight-badge-pass { background: var(--success-dim); color: var(--success); }
.preflight-badge-error { background: var(--danger-dim); color: var(--danger); }
.preflight-badge-warning { background: var(--warning-dim); color: var(--warn); }

/* Structural check list */
.preflight-check-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.preflight-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
}

.preflight-check-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.preflight-check-label {
  font-weight: 700;
  margin-right: 6px;
}

.preflight-check-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* Checks-run list (accessibility) */
.preflight-checks-run {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.preflight-checks-run-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 8px;
}

.preflight-checks-run-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: var(--text-md);
  color: var(--text-secondary);
}

/* Fix All row */
.preflight-fix-all-row {
  margin-bottom: 14px;
  display: flex;
}

/* Card groups (per-component) */
.preflight-card-group {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
}

.preflight-card-group > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg-primary);
  cursor: pointer;
  font-size: var(--text-base);
  font-weight: 600;
  list-style: none;
}

.preflight-card-group > summary::-webkit-details-marker { display: none; }

.preflight-card-group > summary:hover { background: var(--bg-hover); }

.preflight-card-name { flex: 1; }

/* Subgroups: message shown once, elements listed below */
.preflight-subgroup {
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
}

.preflight-subgroup:first-child { border-top: none; }

.preflight-subgroup-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.preflight-issue-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 1px;
  display: flex;
  align-items: center;
}

.preflight-subgroup-message {
  font-size: var(--text-md);
  color: var(--text);
  font-weight: 600;
  line-height: 1.4;
}

.preflight-subgroup-elements {
  padding-left: 24px;
}

/* Element rows (compact) */
.preflight-element-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: var(--text-base);
  transition: background var(--transition);
  border-radius: var(--radius-sm);
  margin: 0 -6px;
  padding-left: 6px;
  padding-right: 6px;
}

.preflight-element-row:hover { background: var(--bg-hover); }

.preflight-element-location {
  flex: 1;
  min-width: 0;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preflight-element-detail {
  flex-shrink: 0;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.preflight-element-actions {
  flex-shrink: 0;
  display: flex;
  gap: 4px;
  align-items: center;
}

/* Action buttons */
.preflight-goto {
  border: 1px solid var(--border) !important;
  color: var(--accent) !important;
  font-size: var(--text-sm) !important;
  text-decoration: none;
  white-space: nowrap;
  background: transparent;
}

.preflight-goto:hover {
  background: var(--accent) !important;
  color: var(--on-accent) !important;
  border-color: var(--accent) !important;
}

.preflight-fix-btn {
  border: 1px solid var(--accent) !important;
  color: var(--accent) !important;
  font-size: var(--text-sm) !important;
  white-space: nowrap;
  background: transparent;
}

.preflight-fix-btn:hover {
  background: var(--accent) !important;
  color: var(--on-accent) !important;
}

/* All-clear state */
.preflight-all-clear {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--success);
}

/* Empty state */
.preflight-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px !important;
  text-align: center;
}

.preflight-empty h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.preflight-empty p {
  font-size: var(--text-md);
  color: var(--text-muted);
}

/* Tips bar */
.preflight-tips {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 20px !important;
  margin-top: 4px;
}

.preflight-tips-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.preflight-tips-title {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}

.preflight-tips-text {
  font-size: var(--text-md);
  color: var(--text-muted);
  line-height: 1.5;
}

/* ═══════════════════ FONT FIX PREVIEW ═══════════════════ */

.font-fix-modal { width: min(780px, 94vw) !important; }

.font-fix-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 22px;
  max-height: 60vh;
}

.font-fix-card-info {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  margin-top: 16px;
  margin-bottom: 8px;
}

.font-fix-card-info:first-child { margin-top: 0; }

.font-fix-pair {
  display: flex;
  gap: 16px;
}

.font-fix-side {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.font-fix-label {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.font-fix-label-after { color: var(--accent); }

.font-fix-canvas-slot {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-secondary);
}

.font-fix-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.font-fix-changes {
  margin-top: 8px;
  margin-bottom: 4px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
}

.font-fix-change-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  font-size: var(--text-sm);
}

.font-fix-change-name {
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}

.font-fix-change-old {
  color: var(--text-muted);
  text-decoration: line-through;
}

.font-fix-change-arrow {
  color: var(--accent);
  font-weight: 700;
}

.font-fix-change-new {
  color: var(--accent);
  font-weight: 700;
}

.font-fix-change-pt {
  color: var(--text-dim);
  font-size: var(--text-xs);
}

.font-fix-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}

@media (max-width: 600px) {
  .font-fix-pair { flex-direction: column; }
}

/* ═══════════════════ PLAYTEST HERO ═══════════════════ */

.playtest-hero {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  margin-bottom: 24px;
}

.playtest-hero h2 { font-family: var(--font-heading); font-size: 18px; font-weight: 700; margin-bottom: 6px; letter-spacing: -0.015em; }
.playtest-hero p { color: var(--text-muted); margin-bottom: 20px; font-size: var(--text-md); }

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.feature-card {
  padding: 18px 20px;
  text-align: center;
}

.feature-card h4 { font-family: var(--font-heading); font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.feature-card p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* ═══════════════════ FORM INPUTS ═══════════════════ */

.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: 6px;
}

/* One form control: 36px tall, 7px radius, --border-light, page-white fill. */
.form-input,
.dash-search-input,
.guides-search-input,
.cv-search,
.fr-filter-select,
.fr-status-select {
  width: 100%;
  height: 36px;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: var(--text-base);
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

textarea.form-input { height: auto; padding: 8px 10px; }

/* Filter selects hug their content instead of filling the row. */
.fr-filter-select,
.fr-status-select { width: auto; min-width: 130px; }

.form-input:focus,
.dash-search-input:focus,
.guides-search-input:focus,
.cv-search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-input::placeholder { color: var(--text-dim); }

.form-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: 4px;
}

/* ═══════════════════ TEMPLATE GRID ═══════════════════ */

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
}

/* One tile: a 120px picture area over a two-line label block. */
.template-card { transition: border-color 0.15s; cursor: pointer; overflow: hidden; }

.template-card:hover { border-color: var(--text-dim); }

.template-preview {
  height: 120px;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-info { padding: 10px 12px; border-top: 1px solid var(--border-subtle); }
.template-name { font-size: var(--text-base); font-weight: 700; }
.template-type { font-size: var(--text-sm); color: var(--text-muted); }

/* "Create Your Own" card — locked-in first item in template grid */
.template-create-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 14px;
  border: 1px dashed var(--accent);
  border-radius: 12px;
  background: var(--accent-dim);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: center;
  min-height: 178px;
}
.template-create-card:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
}
.template-create-icon {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-bg);
  color: var(--accent);
}
.template-create-label {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--accent);
}
.template-create-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.35;
  max-width: 150px;
}

/* ═══════════════════ DASHBOARD ═══════════════════ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.dash-section-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  margin-bottom: 12px;
}

/* ── Resume Hero ── */

.dash-resume-hero {
  display: flex;
  gap: 24px;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 24px;
  transition: border-color 0.15s;
  position: relative;
  overflow: hidden;
}

/* Subtle felt texture overlay */
.dash-resume-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h1v1H0zM10 10h1v1h-1z' fill='%23000' fill-opacity='.02'/%3E%3C/svg%3E");
  pointer-events: none;
}

.dash-resume-hero:hover { border-color: var(--text-dim); }

.dash-resume-visual {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.dash-resume-cover {
  width: 84px;
  height: 84px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-resume-initials {
  font-size: 28px;
  font-weight: 800;
  color: rgba(255,255,255,0.7);
}

/* Card thumbnail fan next to cover */
.dash-resume-fan {
  display: flex;
  align-items: center;
  position: relative;
  width: 80px;
  height: 80px;
}

.dash-resume-fan-card {
  position: absolute;
  width: 52px;
  height: 72px;
  border-radius: 4px;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transform-origin: bottom center;
}

.dash-resume-info { flex: 1; }

.dash-resume-label {
  display: inline-block;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0;
  margin-bottom: 6px;
}

.dash-resume-name {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 4px;
}

.dash-resume-name:hover { color: var(--accent); }

.dash-resume-meta {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin-bottom: 14px;
}

.dash-resume-actions { display: flex; gap: 8px; }

/* ── Quick Stats Strip ── */

.dash-stats-strip {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
}

.dash-stat {
  flex: 1;
  padding: 14px 16px;
  text-align: center;
}

.dash-stat-clickable {
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.dash-stat-clickable:hover { border-color: var(--text-dim); }

.dash-stat-icon {
  font-size: 18px;
  margin-bottom: 4px;
  opacity: 0.5;
}

.dash-stat-value {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
  margin-bottom: 2px;
}

.dash-stat-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 600;
}

/* ── Recent Projects Row ── */

.dash-projects-row {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.dash-project-card {
  flex-shrink: 0;
  width: 160px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}

.dash-project-card:hover { border-color: var(--text-dim); }

.dash-project-thumb {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  position: relative;
}

.dash-project-name {
  padding: 8px 10px 2px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-project-meta {
  padding: 0 10px 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.dash-project-card-new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  gap: 4px;
}

.dash-project-card-new:hover { border-color: var(--accent); color: var(--accent); }

/* ── Storage Tabs + Search Bar ── */

.dash-tabs-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.dash-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* Same pill as .filter-btn — the storage filters are filters. */
.dash-tab {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-secondary);
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.dash-tab:hover:not(.active) {
  color: var(--text);
  border-color: var(--text-dim);
}

.dash-tab.active {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}

.dash-search-input {
  flex: 0 1 260px;
  height: 28px;
  margin-left: auto;
}

.dash-search-input::placeholder { color: var(--text-dim); }

/* ── Unified Game Grid ── */

.dash-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

.dash-game-card {
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s;
}

.dash-game-card:hover { border-color: var(--text-dim); }

.dash-game-thumb {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
}

.dash-game-name {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 2px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-game-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
}

.dash-game-meta {
  padding: 2px 12px 10px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-game-card.dash-game-new {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  min-height: 176px;
}

.dash-game-card.dash-game-new .dash-game-name {
  color: var(--text-dim);
  font-weight: 600;
  padding: 0;
}

.dash-game-card.dash-game-new:hover {
  border-color: var(--accent);
}

.dash-game-card.dash-game-new:hover .dash-game-name {
  color: var(--accent);
}

.dash-game-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
  font-size: 14px;
}

/* ── What's New ── */

/* What's New */
.dash-whatsnew-card {
  max-width: 560px;
}
#whatsNewContent {
  max-height: 280px;
  overflow-y: auto;
}

.dash-whatsnew-entry {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.dash-whatsnew-entry:last-child { border-bottom: none; }

.dash-whatsnew-latest {
  padding-bottom: 14px;
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  margin-left: -2px;
}

.dash-whatsnew-version {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 2px;
}

.dash-whatsnew-theme {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.dash-whatsnew-desc {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.dash-whatsnew-changes {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── Recent Exports Timeline ── */

.dash-export-timeline { display: flex; flex-direction: column; gap: 2px; }

.dash-export-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-base);
}

.dash-export-item:last-child { border-bottom: none; }

.dash-export-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  min-width: 36px;
  text-align: center;
}

/* Format tints come from tokens, so both themes stay legible. */
.dash-export-badge[data-format="ZIP"] { background: var(--success-dim); color: var(--success); }
.dash-export-badge[data-format="PDF"] { background: var(--danger-dim); color: var(--danger); }
.dash-export-badge[data-format="CMYK PDF"] { background: var(--tier-epic-bg); color: var(--tier-epic); }
.dash-export-badge[data-format="TTS"] { background: var(--tier-rare-bg); color: var(--tier-rare); }
.dash-export-badge[data-format="TGC"] { background: var(--accent-bg); color: var(--accent); }
.dash-export-badge[data-format="JSON"] { background: var(--tier-common-bg); color: var(--tier-common); }

.dash-export-game { flex: 1; color: var(--text-secondary); }
.dash-export-time { font-size: var(--text-sm); color: var(--text-dim); }

/* ── Empty State Hero ── */

.dash-empty-hero {
  text-align: center;
  padding: 48px 32px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

/* "Current draft" chip on the autosave card in My Games */
.dash-draft-badge {
  display: inline-block;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ═══════════════════ LAYOUT CONSTRAINTS ═══════════════════ */

/* Force 2-column minimum on grids that shouldn't go single-column */
.overview-grid { grid-template-columns: 1fr 1fr; }
.dashboard-grid { grid-template-columns: 1fr 1fr; }
.export-grid { column-count: 2; }
.feature-row { grid-template-columns: repeat(3, 1fr); }

/* ═══════════════════ MOBILE LAYOUT (<=768px) ═══════════════════ */
/*
 * The band handles its own responsive nav (shell/shell.css collapses the
 * tab row into the `.cm-more` hamburger menu at <=900px) — .home-content
 * just needs to stay full width and trim its padding down here.
 */
@media (max-width: 768px) {
  .home-content {
    width: 100%;
    padding: 0 20px 40px;
  }
  .home-content > :first-child { margin-top: 16px; }
  .view-header { padding: 0 0 16px; }
  .view-body { padding: 0 0 24px; }
  .view-title { font-size: 22px; }

  /* The sticky filter rows bleed to the narrower mobile gutter. */
  .dash-tabs-bar,
  .filter-bar,
  .guides-search-bar,
  .view-header:has(> .cv-search) {
    margin-left: -20px;
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
  }

  /* Multi-column grids collapse to single column on small screens */
  .overview-grid,
  .dashboard-grid,
  .feature-row {
    grid-template-columns: 1fr;
  }
  .export-grid { column-count: 1; }
}

/* Card grids: 1 column at <=640px */
@media (max-width: 640px) {
  .dash-game-grid,
  .game-grid,
  .preview-card-grid {
    grid-template-columns: 1fr;
  }
}

/* Card grids: 2 columns at 641–1024px (3+ above is the default auto-fill rule) */
@media (min-width: 641px) and (max-width: 1024px) {
  .dash-game-grid,
  .game-grid,
  .preview-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ═══════════════════ PREVIEW CARD GRID ═══════════════════ */

.preview-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.preview-card {
  aspect-ratio: 5/7;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}
/* When the card is a <button>, strip default UA styling */
button.preview-card,
.preview-card-btn {
  font-family: inherit;
  color: inherit;
  padding: 0;
  text-align: center;
}
.preview-card:hover { border-color: var(--accent); }
.preview-card:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.preview-card-3d-hint {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  background: rgba(0, 0, 0, 0.65);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  border-radius: var(--radius-pill);
  opacity: 0;
  transform: translateY(-4px);
  transition: all 0.15s;
  pointer-events: none;
}
.preview-card:hover .preview-card-3d-hint,
.preview-card:focus-visible .preview-card-3d-hint {
  opacity: 1;
  transform: translateY(0);
}

.preview-card-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
  background: var(--bg-primary);
  padding: 4px;
  border-top: 1px solid var(--border-subtle);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ═══════════════════ PREVIEW CONTROLS ═══════════════════ */

.preview-controls {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
}

.face-toggle {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  overflow: hidden;
  flex-shrink: 0;
}

.face-toggle-btn {
  height: 26px;
  padding: 0 14px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.face-toggle-btn.active {
  background: var(--accent);
  color: var(--on-accent);
}

.face-toggle-btn:hover:not(.active) {
  color: var(--text);
  background: var(--bg-hover);
}

.preview-card-empty {
  cursor: default;
  opacity: 0.5;
}
.preview-card-empty:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}

.preview-card-no-back {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
  padding: 12px 8px;
  line-height: 1.4;
}

/* ═══════════════════ MEMBER LIST ═══════════════════ */

.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-base);
}

.member-row:last-child { border-bottom: none; }

.member-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: var(--on-accent);
}

.member-name { font-weight: 600; flex: 1; }
.member-role { font-size: var(--text-sm); color: var(--text-muted); }

/* ═══════════════════ TOOLKIT GRID ═══════════════════ */

.toolkit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 8px;
}

.toolkit-card {
  padding: 14px 16px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.toolkit-card:hover { border-color: var(--text-dim); }

.toolkit-card-name {
  font-size: var(--text-base);
  font-weight: 700;
  margin-bottom: 4px;
}

.toolkit-card-summary {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.toolkit-card:hover .toolkit-card-name { color: var(--accent); }

.toolkit-card-coming-soon {
  opacity: 0.5;
  cursor: default;
  border-style: dashed;
}

.toolkit-card-coming-soon:hover {
  border-color: var(--border);
  box-shadow: none;
  transform: none;
}

.toolkit-card-coming-soon .toolkit-card-name::after {
  content: ' (coming soon)';
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0;
}

.toolkit-card-coming-soon:hover .toolkit-card-name { color: inherit; }

/* Square toolkit cards with image previews (legacy) */
.toolkit-grid-square {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.toolkit-card-square {
  padding: 0;
  overflow: hidden;
}

.toolkit-card-square .toolkit-card-name {
  padding: 8px 10px;
  font-size: var(--text-sm);
  margin-bottom: 0;
}

.toolkit-card-preview {
  height: 120px;
  background: var(--bg-secondary);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Toolkit cards with landscape preview + description */
.toolkit-grid-preview {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.toolkit-card-with-preview {
  padding: 0;
  overflow: hidden;
}

.toolkit-card-preview-landscape {
  height: 120px;
}

.toolkit-card-with-preview .toolkit-card-info {
  padding: 10px 12px;
}

.toolkit-card-with-preview .toolkit-card-name {
  margin-bottom: 2px;
}

.toolkit-card-with-preview .toolkit-card-summary {
  -webkit-line-clamp: 2;
}

/* Selected state */
.toolkit-card.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

/* ═══════════════════ TOOLKIT DETAIL PANEL ═══════════════════ */

.toolkit-detail {
  position: fixed;
  right: -380px;
  top: 0;
  bottom: 0;
  width: 380px;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  display: flex;
  flex-direction: column;
  transition: right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.toolkit-detail.open { right: 0; }

.toolkit-detail-header {
  padding: 24px 24px 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-subtle);
}

.toolkit-detail-name {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 2px;
}

.toolkit-detail-type {
  font-size: var(--text-sm);
  color: var(--accent);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
}

.toolkit-detail-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color var(--transition);
}

.toolkit-detail-close:hover { color: var(--text); }

.toolkit-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.toolkit-detail-summary {
  font-size: var(--text-md);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
}

.toolkit-detail-section { margin-bottom: 20px; }

.toolkit-detail-section-label {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  margin-bottom: 10px;
}

.toolkit-detail-params {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toolkit-detail-params li {
  font-size: var(--text-base);
  color: var(--text-secondary);
  padding: 6px 10px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.toolkit-detail-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
}

.toolkit-detail-footer .btn { width: 100%; justify-content: center; }

/* ═══════════════════ CONTEXT MENU ═══════════════════ */

.game-context-menu {
  position: fixed;
  z-index: 1000;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  min-width: 160px;
  animation: contextFadeIn 0.1s ease;
}

@keyframes contextFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.game-context-item {
  display: block;
  width: 100%;
  padding: 7px 12px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.game-context-item:hover { background: var(--bg-elevated); }

.game-context-danger { color: var(--danger); }
.game-context-danger:hover { background: var(--danger-dim); }

.game-context-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 8px;
}

/* ═══════════════════ EDITABLE FIELD ═══════════════════ */

.editable-field {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 2px 0;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.editable-field:hover { background: var(--bg-hover); padding: 2px 6px; margin: 0 -6px; }

.editable-field .edit-hint {
  font-size: var(--text-xs);
  color: var(--text-dim);
  opacity: 0;
  transition: opacity var(--transition);
}

.editable-field:hover .edit-hint { opacity: 1; }

/* Inline edit mode */
.editable-field.editing { cursor: default; background: none; padding: 2px 0; margin: 0; }
.editable-field.editing:hover { background: none; padding: 2px 0; margin: 0; }

.inline-edit-wrap { display: flex; align-items: center; gap: 6px; width: 100%; }
.inline-edit-wrap .form-input { padding: 4px 8px; font-size: inherit; }
.inline-edit-wrap textarea.form-input { resize: vertical; min-height: 52px; }
.inline-edit-wrap .inline-edit-num { width: 64px; text-align: center; }
.inline-edit-wrap .inline-edit-sep { color: var(--text-dim); font-size: 13px; flex-shrink: 0; }

.inline-edit-actions { display: flex; gap: 2px; flex-shrink: 0; }
.inline-edit-actions .btn { height: 26px; width: 26px; padding: 0; min-width: 0; font-size: 15px; line-height: 1; background: transparent; border-color: transparent; }
.inline-edit-actions .btn:hover { background: var(--bg-hover); border-color: transparent; }
.inline-edit-actions .btn-save { color: var(--success); }
.inline-edit-actions .btn-cancel { color: var(--text-dim); }

/* ─────────────────────────────────────────────────────────────── */
/* Component Viewer                                                */
/* ─────────────────────────────────────────────────────────────── */

.cv-search {
  display: block;
  width: 100%;
  max-width: 340px;
}

.cv-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  align-items: start;
}

/* The category list is its own sticky rail, parked below the pinned page
   header (37px of sub-nav plus the header's own height) rather than under
   it. */
.cv-sidebar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 122px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}
.cv-cat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
}
.cv-cat:hover { background: var(--bg-hover); color: var(--text); }
.cv-cat.active { background: var(--accent-bg); color: var(--accent); }
.cv-cat-count {
  font-size: var(--text-xs);
  padding: 2px 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-weight: 700;
}
.cv-cat.active .cv-cat-count { background: var(--accent-dim); color: var(--accent); }

.cv-main { min-width: 0; }
.cv-category-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.cv-category-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0;
}
.cv-category-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.cv-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-base);
}

.cv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.cv-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 0 12px;
  overflow: hidden;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition);
}
.cv-card > :not(.cv-thumb) { padding-left: 12px; padding-right: 12px; }
.cv-card:hover { border-color: var(--text-dim); }
.cv-card:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
/* The picture area every tile shares: 120px, walnut ground so the beige
   component art reads the same in light and dark. */
.cv-thumb {
  width: 100%;
  height: 120px;
  background: var(--walnut) center / contain no-repeat;
  margin-bottom: 8px;
}
.cv-card-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.cv-card-dims {
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.cv-card-category {
  font-size: var(--text-xs);
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
  margin-top: 4px;
}
.cv-card-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 8px;
  margin-top: 4px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 700;
  border-radius: var(--radius-pill);
}
.cv-card-template-result .cv-template-result-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  padding: 2px 6px;
  background: rgba(0,0,0,0.5);
  color: var(--accent);
  border-radius: var(--radius-pill);
}

/* ─── Component drawer ─────────────────────────────────────────── */

.cv-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0);
  z-index: 9998;
  transition: background 200ms ease;
  pointer-events: none;
}
.cv-drawer-backdrop.open {
  background: rgba(0,0,0,0.55);
  pointer-events: auto;
  backdrop-filter: blur(3px);
}

.cv-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 92vw);
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 32px rgba(0,0,0,0.35);
  z-index: 9999;
  transform: translateX(100%);
  transition: transform 240ms cubic-bezier(0.22, 0.61, 0.36, 1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.cv-drawer.open { transform: translateX(0); }

.cv-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 2;
}
.cv-drawer-category {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--accent);
  margin-bottom: 4px;
}
.cv-drawer-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0 0 4px 0;
  line-height: 1.15;
}
.cv-drawer-dims {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.cv-drawer-close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all var(--transition);
  margin-left: 12px;
  flex-shrink: 0;
}
.cv-drawer-close:hover { background: var(--bg-hover); color: var(--text); }

.cv-drawer-3d {
  width: 100%;
  aspect-ratio: 16 / 11;
  background: var(--walnut);
  position: relative;
  overflow: hidden;
}
.cv-drawer-3d canvas { display: block; width: 100%; height: 100%; }
.cv-drawer-3d-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.cv-drawer-start {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.cv-drawer-section-label {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  margin-bottom: 10px;
}
.cv-drawer-start-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.cv-start-card {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-areas: "icon title" "desc desc" "cta cta";
  gap: 6px 10px;
  padding: 14px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.cv-start-card:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.cv-start-card:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.cv-start-icon {
  grid-area: icon;
  width: 22px; height: 22px;
  color: var(--accent);
  align-self: center;
}
.cv-start-icon svg { width: 22px; height: 22px; display: block; }
.cv-start-title {
  grid-area: title;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text);
  align-self: center;
}
.cv-start-desc {
  grid-area: desc;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
}
.cv-start-cta {
  grid-area: cta;
  justify-self: start;
  margin-top: 2px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  padding: 6px 12px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  white-space: nowrap;
}
.cv-start-card:hover .cv-start-cta { background: var(--accent); color: var(--on-accent); }
.cv-drawer-section-hint {
  margin: -4px 0 12px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.45;
}

.cv-drawer-tabs {
  padding: 0 20px;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 1;
}
.cv-drawer-tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
}
.cv-drawer-tab {
  background: transparent;
  border: none;
  padding: 10px 12px;
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
}
.cv-drawer-tab:hover { color: var(--text); }
.cv-drawer-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.cv-drawer-tab-content {
  padding: 16px 20px 32px;
}

.cv-specs-table {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.cv-specs-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
}
.cv-specs-label {
  color: var(--text-muted);
  font-weight: 600;
}
.cv-specs-value {
  color: var(--text);
  word-break: break-word;
}

.cv-templates-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.cv-template-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
}
.cv-template-card:hover { border-color: var(--accent); }
.cv-template-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}
.cv-template-preview {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-sm);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}
.cv-template-name {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}
.cv-template-category {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.cv-template-action-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--accent);
  border-radius: 12px;
}
.cv-template-action-label {
  font-size: var(--text-sm);
  color: var(--text);
}

/* ─────────────────────────────────────────────────────────────── */
/* 3D Preview modal (click any component in the Preview grid)    */
/* ─────────────────────────────────────────────────────────────── */

.p3d-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 9998;
  transition: background 200ms ease;
  pointer-events: none;
}
.p3d-modal-backdrop.open {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  pointer-events: auto;
}
.p3d-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(720px, 92vw);
  max-height: 92vh;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translate(-50%, -50%) scale(0.96);
  opacity: 0;
  transition: all 220ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.p3d-modal.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}
.p3d-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.p3d-modal-eyebrow {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0;
  color: var(--accent);
  margin-bottom: 4px;
}
.p3d-modal-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0 0 4px 0;
  line-height: 1.15;
}
.p3d-modal-meta {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.p3d-modal-close {
  width: 34px;
  height: 34px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all var(--transition);
  margin-left: 16px;
  flex-shrink: 0;
}
.p3d-modal-close:hover { background: var(--bg-hover); color: var(--text); }
.p3d-modal-3d {
  flex: 1;
  min-height: 380px;
  background: var(--walnut);
  position: relative;
  overflow: hidden;
}
.p3d-modal-3d canvas { display: block; width: 100%; height: 100%; }
.p3d-modal-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.p3d-modal-nav {
  display: flex;
  justify-content: space-between;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}
.p3d-modal-nav-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}
.p3d-modal-nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.p3d-modal-footer {
  display: flex;
  justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

/* ═══════════════════ SKELETON LOADING ═══════════════════ */

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-secondary) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius);
}
@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
/*
 * A handful of views still set `text-transform: uppercase; letter-spacing`
 * inline on their section eyebrows and small badges (export's "Not sure what
 * you need?", settings' group headings, the accessibility labels). The markup
 * belongs to another agent, so the tracked all-caps is unwound here instead.
 * Casing of the underlying copy is left exactly as written.
 *
 * Same story for the last three hardcoded Fraunces references (print-pricing's
 * price figures, share-dashboard's counts, new-game's storage-picker titles):
 * the font is no longer loaded, so they are steered onto Bricolage rather
 * than left to fall back to Georgia.
 */
.home-content [style*="Fraunces"],
.home-content .sp-title { font-family: var(--font-heading) !important; }

/* Marketplace's Browse / My Templates pair is a filter, so it reads as one. */
.mkt-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.skeleton-text { height: 14px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }

/* ═══════════════════ MODAL (shared by wizards opened from /home) ═══════════════════ */

@keyframes homeModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes homeModalSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  animation: homeModalFadeIn 0.2s ease-out;
}
.modal-overlay.hidden { display: none; }

.modal {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 420px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: homeModalSlideIn 0.25s ease-out;
  z-index: 9999;
}
.modal h2 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 18px;
  color: var(--text);
  letter-spacing: -0.015em;
}
.modal .form-group {
  margin-bottom: 14px;
}
.modal .form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: none;
  letter-spacing: 0;
}
.modal .form-group select,
.modal .form-group input {
  width: 100%;
  height: 36px;
  background: var(--bg-primary);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}
.modal .form-group select:focus-visible,
.modal .form-group input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}
.modal .form-input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  background: var(--bg-primary);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
}
.modal .form-input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
  outline: none;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 6px;
  overflow: hidden;
  margin: 14px 0;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover), var(--accent));
  background-size: 200% 100%;
  animation: progressShimmer 2s ease-in-out infinite;
  transition: width 0.3s ease;
  border-radius: 6px;
}
@keyframes progressShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.progress-text {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ── Production Export Wizard ── */
.pe-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 4px;
}
.pe-step {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
}
.pe-step:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.pe-step:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.pe-step-active {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent);
}
.pe-step-done { color: var(--success); }
.pe-step-num {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}
.pe-step-done .pe-step-num {
  background: var(--success);
  color: var(--bg);
  border-color: var(--success);
}
.pe-step-line {
  width: 16px;
  height: 2px;
  background: var(--border);
}
.pe-dest-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.pe-dest-card:hover { border-color: var(--accent); }
.pe-dest-selected {
  background: var(--accent-dim);
  border-color: var(--accent);
  border-width: 2px;
  padding: 11px;
}

/* ── Sell Sheet Wizard ── */
.ss-form { font-size: 13px; }
.ss-row { margin-bottom: 10px; }
.ss-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; text-transform: none; letter-spacing: 0; }
.ss-input { width: 100%; background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; font-size: 13px; font-family: inherit; outline: none; transition: border-color var(--transition); box-sizing: border-box; }
.ss-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.ss-textarea { resize: vertical; min-height: 60px; }
.ss-row-double { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.ss-row-double > div { min-width: 0; }
.ss-divider { height: 1px; background: var(--border); margin: 14px 0; }
.ss-layout-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ss-layout-opt { background: var(--bg-input); border: 2px solid var(--border); border-radius: var(--radius); padding: 10px; cursor: pointer; text-align: center; transition: border-color 0.15s; }
.ss-layout-opt:hover { border-color: var(--text-muted); }
.ss-layout-opt.active { border-color: var(--accent); background: var(--accent-dim); }
.ss-layout-name { font-size: 11px; font-weight: 600; margin-top: 6px; }
.ss-layout-preview { height: 60px; background: var(--bg-secondary); border-radius: 4px; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 6px; }
.ss-lp-hero { width: 28px; height: 40px; background: var(--accent); border-radius: 4px; opacity: 0.6; }
.ss-lp-text { flex: 1; height: 30px; background: var(--border); border-radius: 4px; }
.ss-lp-hero-c { width: 36px; height: 30px; background: var(--accent); border-radius: 4px; opacity: 0.6; }
.ss-lp-text-c { width: 100%; height: 12px; background: var(--border); border-radius: 4px; }
.ss-lp-grid { display: flex; gap: 3px; }
.ss-lp-grid::before, .ss-lp-grid::after { content: ''; display: block; width: 16px; height: 22px; background: var(--accent); border-radius: 4px; opacity: 0.6; }
.ss-card-select { display: flex; flex-wrap: wrap; gap: 6px; }
.ss-card-check { display: flex; align-items: center; gap: 5px; font-size: 12px; cursor: pointer; padding: 4px 8px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ss-card-check:has(input:checked) { border-color: var(--accent); background: var(--accent-dim); }

/* ═══════════════════ GUIDES VIEW ═══════════════════ */

/* Search bar */
.guides-search-bar { margin-bottom: 16px; }
.guides-search-input { max-width: 340px; }

/* Category sections */
.guides-category { margin-bottom: 32px; }
.guides-category-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.guides-category-head h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0;
}
.guides-category-count {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}

/* Card grid */
.guides-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* Individual guide card */
.guides-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 18px 20px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}
.guides-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.guides-card:hover { border-color: var(--text-dim); }
.guides-card:hover::before { transform: scaleX(1); }


.guides-card-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  color: var(--text);
}
.guides-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
  flex: 1;
}
.guides-card-read {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.guides-no-results {
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px 0;
}

/* Back button */
.guides-back-btn {
  align-self: flex-start;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  height: 28px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  margin-bottom: 4px;
  transition: color 0.15s, border-color 0.15s;
}
.guides-back-btn:hover { color: var(--text); border-color: var(--accent); }

/* Loading state */
.guides-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  padding: 40px 0;
  font-size: 14px;
}
.guides-loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: guideSpin 0.6s linear infinite;
}
@keyframes guideSpin { to { transform: rotate(360deg); } }

/* ── Reader content (dark-themed guide content) ── */
.guides-reader-content {
  max-width: 760px;
  line-height: 1.7;
}
.guides-reader-content h1 {
  font-size: clamp(26px, 3vw, 36px);
  font-family: var(--font-heading);
  margin: 0 0 12px;
  color: var(--text);
}
.guides-reader-content .guide-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.guides-reader-content h2 {
  font-size: 22px;
  font-family: var(--font-heading);
  margin: 40px 0 14px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text);
}
.guides-reader-content h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 24px;
}
.guides-reader-content h3 {
  font-size: 17px;
  font-family: var(--font-heading);
  margin: 28px 0 10px;
  color: var(--text);
}
.guides-reader-content p {
  margin: 0 0 14px;
  color: var(--text-secondary, var(--text-muted));
  font-size: 15px;
  line-height: 1.7;
}
.guides-reader-content strong { color: var(--text); font-weight: 700; }
.guides-reader-content a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.15s;
}
.guides-reader-content a:hover { border-bottom-color: var(--accent); }
.guides-reader-content ul, .guides-reader-content ol {
  margin: 0 0 14px;
  padding-left: 22px;
  color: var(--text-secondary, var(--text-muted));
  font-size: 15px;
  line-height: 1.7;
}
.guides-reader-content li { margin-bottom: 6px; }

.guides-reader-content code {
  background: var(--bg-elevated);
  padding: 2px 7px;
  border-radius: 4px;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 13px;
  color: var(--accent);
  border: 1px solid var(--border);
}
.guides-reader-content pre {
  background: var(--bg-input);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0 0 18px;
  border: 1px solid var(--border);
}
.guides-reader-content pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: 13px;
  color: var(--text);
}

.guides-reader-content .tip {
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 0 0 18px;
  background: var(--accent-dim);
  border-left: 4px solid var(--accent);
}
.guides-reader-content .tip strong { color: var(--accent); }
.guides-reader-content .tip p { margin: 0; color: var(--text); }
.guides-reader-content .tip p + p { margin-top: 8px; }

.guides-reader-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 18px;
  font-size: 13px;
  background: var(--bg-primary);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.guides-reader-content th, .guides-reader-content td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.guides-reader-content th {
  background: var(--bg-secondary);
  font-weight: 800;
  color: var(--text-secondary);
}
.guides-reader-content td { color: var(--text-muted); }
.guides-reader-content tr:last-child td { border-bottom: none; }

.guides-reader-content kbd {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  box-shadow: 0 1px 0 var(--border);
}

.guides-reader-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin: 8px 0;
}



/* Print pricing view: hover states that used to be inline handlers (CSP blocks those). */
.pp-tgc-link { flex-shrink: 0; font-size: 12px; font-weight: 600; color: #fff; background: rgba(255,255,255,0.12); padding: 6px 12px; border-radius: 6px; text-decoration: none; white-space: nowrap; transition: background 0.15s; }
.pp-tgc-link:hover { background: rgba(255,255,255,0.2); }
.pp-printer-link { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); text-decoration: none; color: inherit; transition: border-color 0.15s, background 0.15s; }
.pp-printer-link:hover { border-color: var(--accent); background: rgba(255,255,255,0.03); }

/* ═══════════════════ UX RULES CAMPAIGN (2026-10-13) — home views ═══════════════════ */

/* Dashboard empty state: stacks full-width at 44px on phones (M-17) */
.dash-empty-actions { display: flex; gap: 12px; justify-content: center; }
.dash-empty-cta { font-size: 14px; padding: 0 24px; min-height: 40px; justify-content: center; }
@media (max-width: 640px) {
  .dash-empty-hero { padding: 32px 16px; }
  .dash-empty-actions { flex-direction: column-reverse; align-items: stretch; } /* primary last on phones (rule 12) */
  .dash-empty-cta { width: 100%; min-height: 44px; }
}

/* "New game" tile is a real button with a plus (H-39) */
button.dash-game-card.dash-game-new {
  font: inherit; color: var(--text-dim); background: transparent; gap: 8px;
  border-width: 1px; border-style: dashed; border-color: var(--border); border-radius: var(--radius-lg, 12px);
}
button.dash-game-card.dash-game-new:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.dash-game-card.dash-game-new:hover { color: var(--accent); }

/* Trash tab (H-02) */
.dash-trash-note { padding: 0 0 8px; text-align: left; font-size: 13px; }
.dash-trash-card { display: flex; flex-direction: column; cursor: default; }
.dash-trash-card .dash-game-thumb { opacity: 0.6; }
.dash-restore-btn { margin: 8px 12px 12px; align-self: flex-start; }

/* Game details (H-29, H-30) */
.ov-add-link {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600;
  color: var(--accent); text-decoration: underline; text-underline-offset: 2px;
}
.ov-stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.ov-stat-tile { background: var(--bg-elevated, var(--bg-secondary)); border-radius: var(--radius); padding: 12px 8px; text-align: center; }
.ov-stat-value { font-size: 24px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ov-stat-label { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-top: 4px; }
.ov-source { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.ov-source-chip { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--bg-elevated, var(--bg-secondary)); color: var(--text); }

/* Share rows: 28px controls, no inline sizing (H-31) */
.cs-row-btn { height: 28px; padding: 0 12px; font-size: 12px; white-space: nowrap; }
.cs-row-select { height: 28px; padding: 0 8px; font-size: 12px; width: auto; }
.cs-link-create { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
.cs-check { display: flex; align-items: center; gap: 8px; font-size: var(--text-md, 14px); color: var(--text); cursor: pointer; }
.cs-link-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* Publish template (H-04, H-38) */
.pub-form { padding: 24px; max-width: 600px; }
.pub-chip-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 36px; padding: 4px 8px;
  border: 1px solid var(--border-light); border-radius: 7px; background: var(--bg-primary);
}
.pub-chip-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.pub-chips { display: contents; }
.pub-chip-input { flex: 1; min-width: 140px; border: none; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 14px; height: 26px; }
.pub-chip {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; font: inherit; font-size: 12px; font-weight: 600;
  border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--bg-elevated, var(--bg-secondary)); color: var(--text);
}
.pub-chip-x { border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 0 0 2px; }
.pub-chip-x:hover { color: var(--text); }
.pub-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pub-chip-suggest { cursor: pointer; }
.pub-chip-suggest:hover { border-color: var(--accent); }
.pub-chip-suggest.is-on { border-color: var(--accent); background: var(--accent-dim); color: var(--accent); }
.pub-chip-suggest:focus-visible, .pub-chip-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pub-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); cursor: pointer; margin-bottom: 12px; }
.pub-note { background: var(--bg-tertiary, var(--bg-secondary)); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.pub-note a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.pub-actions { display: flex; gap: 8px; margin-top: 16px; }
.pub-status { margin-top: 12px; font-size: 13px; color: var(--text-secondary); }
.pub-status.is-error { color: var(--danger); }
.mkt-error { grid-column: 1 / -1; text-align: center; padding: 32px; color: var(--text-muted); }
.mkt-error p { margin-bottom: 12px; }

/* Feature requests: the new idea lights up for a moment (H-23) */
.fr-card-new { box-shadow: 0 0 0 2px var(--accent); transition: box-shadow 0.3s; }

/* Phone tap targets and order (H-R07, rule 12): 44px full-width actions, primary last; chips 36px */
.ov-actions { display: flex; flex-direction: column; gap: 6px; }
.ov-actions .btn { width: 100%; justify-content: center; }
.fr-submit-btn { margin-top: 12px; align-self: flex-start; padding: 10px 24px; }
@media (max-width: 640px) {
  .pub-actions { flex-direction: column-reverse; }
  .pub-actions .btn { width: 100%; min-height: 44px; justify-content: center; }
  .pub-chip { height: 36px; padding: 0 12px; }
  .pub-chip-input { height: 36px; }
  .pub-chip-x { min-width: 28px; min-height: 28px; }
  .cs-row-btn { height: 44px; padding: 0 16px; }
  .cs-row-select { height: 44px; }
  .fr-submit-btn { align-self: stretch; min-height: 44px; }
  .ov-actions { flex-direction: column-reverse; gap: 8px; }
  .ov-actions .btn { min-height: 44px; }
  .dash-restore-btn { min-height: 44px; }
}

/* What's-new strip on phones: 44px tap targets (rule 12, loop wave 2026-10-13). */
@media (max-width: 640px) {
  #dashWhatsNewAll { min-height: 44px; }
  .dash-whatsnew-strip-close { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
}

/* Home tour popover on phones: 44px tap targets (rule 12). */
@media (max-width: 640px) {
  .home-tour-skip, .home-tour-next { min-height: 44px; min-width: 44px; padding-inline: 16px; }
}

/* Skip link: off-screen until focused (same look as the marketing shell). */
.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 10000;
  padding: 12px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  background: var(--bg-card);
  color: var(--text);
  font-weight: 700;
  font-size: 15px;
  border-radius: 8px;
  border: 2px solid var(--focus-ring);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus, .skip-link:focus-visible {
  transform: none;
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}
#homeContent:focus { outline: none; }

/* Terms re-acceptance wall (ui/terms-wall.js) — copied from style.css so /home
   can show it; app.html keeps its own copy. */
.terms-wall {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Nunito', sans-serif;
}
.terms-wall-card {
  background: var(--bg-secondary, #1e1c19);
  border: 1px solid var(--border, #2a2825);
  border-radius: var(--radius-lg, 12px);
  padding: 40px;
  max-width: 480px;
  width: 90%;
  text-align: center;
}
.terms-wall-card h2 {
  margin: 0 0 12px;
  font-size: 22px;
  color: var(--text-secondary, #c4bdb2);
}
.terms-wall-card p {
  margin: 0 0 20px;
  color: var(--text-muted, #8F8880);
  font-size: 14px;
  line-height: 1.5;
}
.terms-wall-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
}
.terms-wall-links a {
  color: var(--accent, #e8913a);
  text-decoration: underline;
  font-size: 14px;
}
.terms-wall-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  font-size: 13px;
  color: var(--text-muted, #8F8880);
  margin-bottom: 24px;
  cursor: pointer;
  line-height: 1.4;
}
.terms-wall-check input {
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--accent, #e8913a);
}
.terms-wall-card .btn-accent {
  width: 100%;
}
.terms-wall-card .btn-accent:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}
.terms-wall-decline {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px;
  background: none;
  border: none;
  color: var(--text-muted, #8F8880);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s;
}
.terms-wall-decline:hover {
  color: var(--text-secondary, #c4bdb2);
}
.terms-wall-decline:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.terms-wall-error {
  color: #ef4444;
  font-size: 13px;
  margin-top: 12px;
}
