/* ==========================================================================
   GameCraft Studio - design system
   Colours and layout follow the reference dashboard screenshot.
   ========================================================================== */

:root {
  /* Backgrounds */
  --bg:            #FAF6F0;   /* warm cream page background */
  --bg-card:       #FFFFFF;
  --bg-sidebar:    #FFFFFF;
  --bg-soft:       #F6F1E9;
  --bg-sunken:     #F2ECE2;

  /* Borders */
  --line:          #EFE7DB;
  --line-strong:   #E2D8C8;

  /* Text */
  --text:          #2B2438;
  --text-muted:    #7A7288;
  --text-faint:    #A49CB0;

  /* Brand colour */
  --primary:       #6C4BD6;
  --primary-dark:  #5B3CC4;
  --primary-soft:  #EFEAFD;
  --primary-line:  #DDD3FA;

  /* Accent colours */
  --amber:         #E0952E;
  --amber-soft:    #FDF1DC;
  --amber-line:    #F5E0BC;

  --green:         #3FA796;
  --green-soft:    #E3F3EF;

  --red:           #D9534F;
  --red-soft:      #FBEAE9;

  --blue:          #3A7BD5;
  --blue-soft:     #E8F0FB;

  /* Corner radii */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  22px;
  --r-full: 999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(43, 36, 56, .06);
  --shadow-md: 0 2px 8px rgba(43, 36, 56, .07);
  --shadow-lg: 0 10px 30px rgba(43, 36, 56, .10);

  /* Layout sizes */
  --sidebar-w: 244px;
  --topbar-h:  66px;
  --content-max: 1240px;

  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

/* --------------------------------------------------------------------------
   Foundations
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 14px; }
p  { margin: 0 0 10px; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { max-width: 100%; }

hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

::selection { background: var(--primary-soft); }

:focus-visible {
  outline: 3px solid var(--primary-line);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------------------
   Main layout: sidebar plus content
   -------------------------------------------------------------------------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 14px;
}

.sidebar__logo {
  width: 38px; height: 38px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, #7C5CE6, #5B3CC4);
  box-shadow: var(--shadow-sm);
  flex: 0 0 auto;
}

.sidebar__name { font-weight: 800; font-size: 16px; line-height: 1.1; }
.sidebar__sub  { font-size: 9.5px; letter-spacing: .22em; color: var(--text-faint); font-weight: 700; }

.sidebar__nav { padding: 6px 12px; overflow-y: auto; flex: 1; }

.nav-group + .nav-group { margin-top: 14px; }

.nav-group__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: background .13s, color .13s;
}
.nav-item:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }
.nav-item svg { flex: 0 0 auto; opacity: .8; }

.nav-item--active {
  background: var(--amber-soft);
  color: var(--amber);
  font-weight: 700;
}
.nav-item--active:hover { background: var(--amber-soft); color: var(--amber); }
.nav-item--active svg { opacity: 1; }

.sidebar__plan { padding: 12px; border-top: 1px solid var(--line); }

.plan-card {
  background: linear-gradient(150deg, #FDF3E2, #F8ECFB);
  border: 1px solid var(--amber-line);
  border-radius: var(--r-lg);
  padding: 13px;
}
.plan-card__row { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.plan-card__name { font-weight: 800; font-size: 13.5px; }
.plan-card__desc { font-size: 11.5px; color: var(--text-muted); margin-bottom: 10px; }

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__tagline {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 11px 5px 5px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: #fff;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}
.topbar__user:hover { text-decoration: none; border-color: var(--line-strong); }

.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: grid; place-items: center;
  font-weight: 800; font-size: 12px; color: var(--primary);
  flex: 0 0 auto;
  overflow: hidden;
}
.avatar--lg { width: 54px; height: 54px; font-size: 19px; }

.content {
  padding: 24px 22px 60px;
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 9px 16px;
  font: inherit;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  transition: background .14s, border-color .14s, transform .05s, box-shadow .14s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: .55; pointer-events: none; }

.btn--primary { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(108, 75, 214, .28); }
.btn--primary:hover { background: var(--primary-dark); color: #fff; }

.btn--ghost { background: #fff; color: var(--text); border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--bg-soft); color: var(--text); }

.btn--soft { background: var(--primary-soft); color: var(--primary); }
.btn--soft:hover { background: var(--primary-line); color: var(--primary-dark); }

.btn--amber { background: var(--amber); color: #fff; }
.btn--amber:hover { background: #C9821F; color: #fff; }

.btn--danger { background: var(--red-soft); color: var(--red); border-color: #F2D4D3; }
.btn--danger:hover { background: var(--red); color: #fff; }

.btn--lg { padding: 12px 22px; font-size: 15px; border-radius: var(--r-lg); }
.btn--sm { padding: 6px 11px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn--block { width: 100%; }
.btn--icon { padding: 8px; width: 34px; height: 34px; }

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-sm);
}
.card__body { padding: 18px; }
.card__head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card__foot { padding: 14px 18px; border-top: 1px solid var(--line); }

/* --------------------------------------------------------------------------
   Welcome banner (FR-04)
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: linear-gradient(112deg, #FFFDF9 0%, #FDF4E6 52%, #F3E7FB 100%);
  border: 1px solid var(--line);
  display: flex;
  align-items: stretch;
  margin-bottom: 26px;
  box-shadow: var(--shadow-sm);
}
.hero__text { padding: 30px 32px; flex: 1 1 56%; min-width: 0; }
.hero__eyebrow { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.hero__title { font-size: 33px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 10px; }
.hero__title .spark { color: var(--amber); }
.hero__desc { color: var(--text-muted); max-width: 50ch; margin-bottom: 18px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.hero__hint { font-size: 12.5px; color: var(--text-muted); margin-top: 14px; }
.hero__art { flex: 0 0 40%; min-width: 0; position: relative; }
.hero__art svg, .hero__art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* --------------------------------------------------------------------------
   The "How it works" block (FR-08)
   -------------------------------------------------------------------------- */

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; }

.step { position: relative; padding: 4px 18px 4px 0; display: flex; gap: 12px; }
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 10px; top: 22px;
  width: 14px; height: 2px;
  background: var(--line-strong);
}
.step__icon {
  width: 42px; height: 42px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  flex: 0 0 auto;
  background: var(--primary-soft);
  color: var(--primary);
}
.step__no {
  display: inline-grid; place-items: center;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10px; font-weight: 800;
  margin-right: 6px;
  vertical-align: 1px;
}
.step__title { font-weight: 700; font-size: 13px; margin-bottom: 2px; }
.step__desc  { font-size: 12px; color: var(--text-muted); line-height: 1.45; }

/* --------------------------------------------------------------------------
   Section headings
   -------------------------------------------------------------------------- */

.section { margin-bottom: 26px; }
.section__head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 13px;
}
.section__title { font-size: 17px; font-weight: 800; }
.section__count {
  font-size: 12px; color: var(--text-muted); font-weight: 600;
  background: var(--bg-sunken); padding: 2px 9px; border-radius: var(--r-full);
}
.section__tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.section__link { font-size: 13px; font-weight: 700; }

/* --------------------------------------------------------------------------
   Project grid (FR-09)
   -------------------------------------------------------------------------- */

.grid { display: grid; gap: 16px; }
.grid--projects { grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
.grid--wide     { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid--tiles    { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.grid--cards    { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: box-shadow .16s, transform .16s, border-color .16s;
  position: relative;
}
.project-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--line-strong); }

.project-card__art {
  position: relative;
  aspect-ratio: 16 / 11;
  background: var(--bg-sunken);
  overflow: hidden;
  display: block;
}
.project-card__art img, .project-card__art svg { width: 100%; height: 100%; object-fit: cover; display: block; }

.project-card__badge { position: absolute; top: 9px; left: 9px; }
.project-card__menu  { position: absolute; top: 9px; right: 9px; }

.project-card__body { padding: 12px 13px 13px; flex: 1; display: flex; flex-direction: column; }
.project-card__title {
  font-weight: 700; font-size: 13.5px; margin-bottom: 5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.project-card__meta {
  font-size: 11.5px; color: var(--text-muted);
  display: flex; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 7px;
}
.project-card__time { font-size: 11px; color: var(--text-faint); margin-top: auto; }

/* Edit and Delete sit on the face of the card, not behind the overflow menu */
.project-card__actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.project-card__actions .btn { flex: 1; justify-content: center; }
.project-card__actions form { flex: 1; display: flex; }

/* The "Create New Game" tile at the end of the list (FR-15) */
.project-card--new {
  border: 2px dashed var(--primary-line);
  background: var(--primary-soft);
  box-shadow: none;
  align-items: center; justify-content: center;
  text-align: center; padding: 24px 16px;
  min-height: 210px;
}
.project-card--new:hover { background: #E9E1FC; transform: translateY(-2px); box-shadow: var(--shadow-md); }
.project-card--new .plus {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; margin-bottom: 10px;
}

/* List view mode (FR-13) */
.list-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 10px 14px 10px 10px;
  margin-bottom: 9px;
  box-shadow: var(--shadow-sm);
}
.list-row:hover { border-color: var(--line-strong); }
.list-row__art {
  width: 78px; height: 54px; border-radius: var(--r-sm);
  overflow: hidden; flex: 0 0 auto; background: var(--bg-sunken);
}
.list-row__art img, .list-row__art svg { width: 100%; height: 100%; object-fit: cover; }
.list-row__main { flex: 1; min-width: 0; }
.list-row__title { font-weight: 700; font-size: 14px; }
.list-row__meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }
.list-row__side { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

/* --------------------------------------------------------------------------
   Status badges (FR-10)
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}
.badge--draft    { background: #EFEBE4; color: #6E6656; }
.badge--progress { background: var(--amber-soft); color: var(--amber); }
.badge--ready    { background: var(--green-soft); color: #2E8375; }
.badge--published{ background: var(--primary-soft); color: var(--primary); }
.badge--tier     { background: var(--bg-sunken); color: var(--text-muted); }
.badge--locked   { background: #F2ECE2; color: var(--text-faint); }
.badge--new      { background: var(--blue-soft); color: var(--blue); }

.badge--dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block;
}

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field { margin-bottom: 16px; }
.label {
  display: block;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 6px;
}
.label__hint { font-weight: 500; color: var(--text-muted); font-size: 12px; }

/* Sits under an input to say what the value is used for */
.field__hint { margin-top: 5px; font-size: 12px; color: var(--text-muted); }

.input::placeholder,
.textarea::placeholder { font-style: italic; }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: #fff;
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  transition: border-color .13s, box-shadow .13s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.6; }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237A7288' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.field__error { color: var(--red); font-size: 12px; font-weight: 600; margin-top: 5px; }
.input--error { border-color: var(--red); }

.search {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.search svg { position: absolute; left: 11px; color: var(--text-faint); pointer-events: none; }
.search .input { padding-left: 34px; min-width: 230px; }

.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row > * { flex: 1 1 200px; }

/* Card-style choice groups */
.choice-grid { display: grid; gap: 12px; }
.choice {
  position: relative;
  display: block;
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  padding: 14px;
  cursor: pointer;
  transition: border-color .14s, box-shadow .14s, background .14s;
}
.choice:hover { border-color: var(--primary-line); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice input:checked ~ .choice__inner { color: var(--text); }
.choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.choice:has(input:disabled) { opacity: .5; cursor: not-allowed; background: var(--bg-sunken); }
.choice__title { font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.choice__desc  { font-size: 12px; color: var(--text-muted); }

/* Picture pickers */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 12px; }
.pick {
  position: relative;
  border: 2px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  display: block;
}
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.pick:has(input:disabled) { cursor: not-allowed; }

/*
 * A tile the plan does not include. Shown rather than hidden, so the buyer can
 * see what the next plan adds - drained of colour, with a padlock over the art.
 */
.pick--locked { cursor: not-allowed; }
.pick--locked .pick__art { filter: grayscale(1) opacity(.45); }
.pick--locked .pick__label { color: var(--text-faint); }
.pick--locked:hover { border-color: var(--line); box-shadow: none; }

.pick__art { position: relative; }
.pick__lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-soft);
}
/* .pick__art svg already claims 100% of the tile, so this has to outrank it */
.pick__art .pick__lock svg {
  width: 26px;
  height: 26px;
  padding: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .16);
}
.pick__art { aspect-ratio: 4 / 3; background: var(--bg-sunken); }
.pick__art img, .pick__art svg { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Two designs in one tile: the move card and the mission card of a set */
.pick__art--pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 2px;
}
.pick__art--pair img { object-fit: contain; }
.pick__label { padding: 7px 9px; font-size: 12px; font-weight: 600; }

/* Second line on a tile whose label needs a word of explanation */
.pick__note { display: block; margin-top: 2px; font-size: 10.5px; font-weight: 500; color: var(--text-muted); line-height: 1.35; }

/*
 * Preview cards on supplied frame artwork - the same geometry the print sheet
 * uses, so what is on the screen is what comes out of the printer.
 *
 * The content sits in an absolutely positioned box because top and bottom
 * percentages resolve against the HEIGHT; padding percentages would resolve
 * against the width and put the text back over the frame's decoration.
 */
.pcard { padding: 12px; min-height: 120px; }
.pcard--framed {
  aspect-ratio: 709 / 945;
  min-height: 0;
  border: 0;
  padding: 0;
  position: relative;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  overflow: hidden;
}

.pcard__inner {
  position: absolute;
  left: 10%;
  right: 10%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pcard--mission .pcard__inner {
  top: var(--mission-top, 22%);
  bottom: var(--mission-bottom, 20%);
}
.pcard--move .pcard__inner {
  top: var(--move-top, 24%);
  bottom: var(--move-bottom, 24%);
  align-items: center;
  justify-content: center;
}

/* The picture window some frames draw, and the small hero for those that do not */
.pcard__window {
  position: absolute;
  left: var(--hero-left, 16%);
  right: var(--hero-right, 16%);
  top: var(--hero-top, 8%);
  height: var(--hero-height, 44%);
}
.pcard__hero {
  flex: 0 0 auto;
  height: 26%;
  margin-bottom: 4px;
}
.pcard__window,
.pcard__hero,
[class*='hero-'] {
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.pcard--framed .small,
.pcard--framed .bold { text-shadow: 0 1px 0 rgba(255, 255, 255, .65); }

/* The band is shallow, so the type inside a framed preview card comes down */
.pcard--framed .small { font-size: 11px; line-height: 1.35; }
.pcard--framed .small.faint { font-size: 10px; }
.pcard--tight .flex { display: none; }
.pcard--tight .small { font-size: 10px; line-height: 1.3; }
.pcard--tight .small.faint { font-size: 9px; }

/* The tile that means "no ready-made scene" - drawn, not photographed */
.pick__art--custom {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  background: var(--primary-soft);
}
.pick--custom { border-style: dashed; }
.pick__lock {
  position: absolute; inset: 0;
  background: rgba(250, 246, 240, .82);
  display: grid; place-items: center;
  text-align: center; padding: 10px;
  font-size: 11.5px; font-weight: 700; color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   The create-a-game step flow
   -------------------------------------------------------------------------- */

.wizard { display: flex; gap: 24px; align-items: flex-start; }
.wizard__main { flex: 1; min-width: 0; }
.wizard__side { flex: 0 0 268px; position: sticky; top: calc(var(--topbar-h) + 20px); }

.stepbar {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.stepbar__item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 13px;
  border-radius: var(--r-full);
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 700; color: var(--text-muted);
}
.stepbar__item .n {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg-sunken); color: var(--text-muted);
  font-size: 11px;
}
.stepbar__item--done { color: var(--green); border-color: #CFE7E1; background: var(--green-soft); }
.stepbar__item--done .n { background: var(--green); color: #fff; }
.stepbar__item--active { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.stepbar__item--active .n { background: var(--primary); color: #fff; }

.wizard__actions {
  display: flex; align-items: center; gap: 10px;
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--line);
}
.wizard__actions .spacer { flex: 1; }

/* --------------------------------------------------------------------------
   Prompt block (FR-30)
   -------------------------------------------------------------------------- */

.prompt-box {
  background: #2B2438;
  border-radius: var(--r-lg);
  overflow: hidden;
}
.prompt-box__head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  color: #E6E1F0; font-size: 12.5px; font-weight: 700;
}
.prompt-box__head .spacer { flex: 1; }
.prompt-box__text {
  margin: 0;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
  color: #D6CFE8;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 340px;
  overflow-y: auto;
}
.btn--copy { background: rgba(255,255,255,.14); color: #fff; border: 0; }
.btn--copy:hover { background: rgba(255,255,255,.24); color: #fff; }

.howto-list { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.howto-list li {
  counter-increment: s;
  position: relative;
  padding-left: 30px;
  margin-bottom: 9px;
  font-size: 13px;
  color: var(--text-muted);
}
.howto-list li::before {
  content: counter(s);
  position: absolute; left: 0; top: 1px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 800;
}

/* --------------------------------------------------------------------------
   Drag-and-drop upload area
   -------------------------------------------------------------------------- */

.dropzone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--bg-soft);
  padding: 30px 20px;
  text-align: center;
  transition: border-color .14s, background .14s;
  cursor: pointer;
  display: block;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone__icon { color: var(--primary); margin-bottom: 8px; }
.dropzone__title { font-weight: 700; margin-bottom: 3px; }
.dropzone__hint { font-size: 12px; color: var(--text-muted); }
.dropzone input[type=file] { display: none; }

.upload-preview {
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}
.upload-preview img { width: 100%; display: block; }

/* --------------------------------------------------------------------------
   Mission cards in the Studio
   -------------------------------------------------------------------------- */

.mission-cell {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: #fff;
  margin-bottom: 12px;
  overflow: hidden;
}
.mission-cell__head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  font-weight: 700; font-size: 13px;
}
.mission-cell__no {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
  flex: 0 0 auto;
}

.mission-row {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.mission-row:last-child { border-bottom: 0; }
.mission-row__sticker {
  width: 34px; height: 34px; border-radius: var(--r-sm);
  background: var(--primary-soft);
  display: grid; place-items: center; flex: 0 0 auto;
}
.mission-row__body { flex: 1; min-width: 0; }
.mission-row__q { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.mission-row__a { font-size: 12px; color: var(--text-muted); }
.mission-row__tools { display: flex; gap: 5px; flex: 0 0 auto; }

.mission-row--custom { background: #FFFDF6; }

/* --------------------------------------------------------------------------
   Pricing table (FR-28)
   -------------------------------------------------------------------------- */

.pricing { display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 18px; }

.price-card {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--r-xl);
  padding: 22px;
  display: flex; flex-direction: column;
  position: relative;
}
.price-card--current { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.price-card--popular { border-color: var(--amber); }

.price-card__flag {
  position: absolute; top: -11px; left: 22px;
  background: var(--amber); color: #fff;
  font-size: 11px; font-weight: 800;
  padding: 3px 11px; border-radius: var(--r-full);
}
.price-card__name { font-size: 18px; font-weight: 800; }
.price-card__price { font-size: 34px; font-weight: 800; letter-spacing: -.03em; margin: 6px 0 2px; }
.price-card__price small { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.price-card__tagline { font-size: 12.5px; color: var(--text-muted); margin-bottom: 16px; }

.perks { list-style: none; padding: 0; margin: 0 0 18px; flex: 1; }
.perks li {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 13px; margin-bottom: 8px; color: var(--text);
}
.perks li svg { flex: 0 0 auto; margin-top: 3px; color: var(--green); }
.perks li.is-locked { color: var(--text-faint); }
.perks li.is-locked svg { color: var(--text-faint); }

.quota-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.quota {
  background: var(--bg-soft);
  border-radius: var(--r-md);
  padding: 11px 13px;
  text-align: center;
}
.quota__n { font-size: 21px; font-weight: 800; line-height: 1.1; }
.quota__l { font-size: 11px; color: var(--text-muted); font-weight: 600; }

/* --------------------------------------------------------------------------
   Notifications
   -------------------------------------------------------------------------- */

.flash-stack {
  position: fixed;
  top: 14px; right: 14px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  max-width: 360px;
}
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 600;
  animation: flash-in .22s ease-out;
}
.flash--success { border-left: 4px solid var(--green); }
.flash--error   { border-left: 4px solid var(--red); }
.flash--info    { border-left: 4px solid var(--blue); }
.flash--warning { border-left: 4px solid var(--amber); }
.flash__close { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--text-faint); font-size: 16px; line-height: 1; padding: 0 2px; }

@keyframes flash-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

.notice {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--r-md);
  font-size: 13px;
  margin-bottom: 16px;
}
.notice--info    { background: var(--blue-soft);  color: #2B5DA8; }
.notice--warning { background: var(--amber-soft); color: #96631A; }
.notice--success { background: var(--green-soft); color: #2E8375; }
.notice--error   { background: var(--red-soft);   color: #A83A36; }
.notice svg { flex: 0 0 auto; margin-top: 1px; }
.notice a { color: inherit; text-decoration: underline; font-weight: 700; }

/* --------------------------------------------------------------------------
   Empty states
   -------------------------------------------------------------------------- */

.empty {
  text-align: center;
  padding: 46px 20px;
  background: #fff;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-xl);
}
.empty__icon { color: var(--text-faint); margin-bottom: 12px; }
.empty__title { font-weight: 800; font-size: 16px; margin-bottom: 5px; }
.empty__desc { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }

/* --------------------------------------------------------------------------
   Quick action menu (FR-14)
   -------------------------------------------------------------------------- */

.menu { position: relative; }
.menu__trigger {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  border: 0;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: grid; place-items: center;
  color: var(--text);
}
.menu__trigger:hover { background: #fff; }
.menu__list {
  position: absolute;
  right: 0; top: calc(100% + 5px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: 5px;
  min-width: 178px;
  z-index: 40;
  display: none;
}
.menu.is-open .menu__list { display: block; }
.menu__item {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 0; background: none;
  border-radius: var(--r-sm);
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--text); text-align: left; cursor: pointer;
}
.menu__item:hover { background: var(--bg-soft); text-decoration: none; color: var(--text); }
.menu__item--danger { color: var(--red); }
.menu__item--danger:hover { background: var(--red-soft); color: var(--red); }
.menu__sep { height: 1px; background: var(--line); margin: 4px 0; }

/* View mode toggle (FR-13) */
.viewtoggle { display: inline-flex; background: var(--bg-sunken); border-radius: var(--r-sm); padding: 2px; }
.viewtoggle a {
  width: 30px; height: 27px; border-radius: 6px;
  display: grid; place-items: center;
  color: var(--text-muted);
}
.viewtoggle a:hover { text-decoration: none; }
.viewtoggle a.is-active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* --------------------------------------------------------------------------
   Sign-in and registration pages
   -------------------------------------------------------------------------- */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth__panel {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
}
.auth__box { width: 100%; max-width: 384px; }
.auth__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth__title { font-size: 25px; font-weight: 800; margin-bottom: 5px; }
.auth__sub { color: var(--text-muted); margin-bottom: 22px; }
.auth__art {
  background: linear-gradient(150deg, #F5EDFB, #FDF2E2);
  position: relative;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
}
.auth__art-inner { max-width: 440px; text-align: center; }
.auth__foot { margin-top: 20px; font-size: 13px; color: var(--text-muted); text-align: center; }

/* "or" rule between the password form and the Google button */
.auth__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-faint);
  font-size: 12px;
  font-weight: 600;
}
.auth__divider::before,
.auth__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* --------------------------------------------------------------------------
   Small stat tiles
   -------------------------------------------------------------------------- */

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 14px 16px;
}
.stat__label { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 3px; }
.stat__value { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.stat__sub { font-size: 11.5px; color: var(--text-faint); }

.bar { height: 7px; border-radius: var(--r-full); background: var(--bg-sunken); overflow: hidden; margin-top: 8px; }
.bar__fill { height: 100%; border-radius: var(--r-full); background: var(--primary); transition: width .3s; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; }
table.data tbody tr:hover { background: var(--bg-soft); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.muted   { color: var(--text-muted); }
.faint   { color: var(--text-faint); }
.small   { font-size: 12px; }
.bold    { font-weight: 700; }
.center  { text-align: center; }
.right   { text-align: right; }
.nowrap  { white-space: nowrap; }
.mt-0 { margin-top: 0; }  .mt-1 { margin-top: 8px; }  .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .flex-col { flex-direction: column; }
.items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.flex-1 { flex: 1; } .flex-wrap { flex-wrap: wrap; }
.hidden { display: none; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--bg-sunken);
  font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.chip--active { background: var(--primary-soft); color: var(--primary); }
.chip:hover { text-decoration: none; }

/* --------------------------------------------------------------------------
   Small screens
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .steps { grid-template-columns: repeat(2, 1fr); gap: 16px 0; }
  .step:nth-child(2)::after { display: none; }
  .wizard { flex-direction: column; }
  .wizard__side { position: static; width: 100%; flex: 1 1 auto; }
}

@media (max-width: 860px) {
  :root { --sidebar-w: 68px; }
  .sidebar__name, .sidebar__sub, .nav-item span, .nav-group__label, .sidebar__plan { display: none; }
  .sidebar__brand { justify-content: center; padding: 16px 8px; }
  .nav-item { justify-content: center; padding: 11px 0; }
  .hero { flex-direction: column; }
  .hero__art { flex: 0 0 auto; height: 190px; position: relative; }
  .hero__text { padding: 24px 22px; }
  .hero__title { font-size: 26px; }
  .auth { grid-template-columns: 1fr; }
  .auth__art { display: none; }
  .topbar__tagline { display: none; }
  .content { padding: 18px 14px 48px; }
}

@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; }
  .step::after { display: none !important; }
  .grid--projects { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .search .input { min-width: 0; width: 100%; }
  .section__tools { width: 100%; }
}

/* --------------------------------------------------------------------------
   Respect reduced-motion preferences
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
