/*
 * The free planner's page (`/game-planner`): the start, then the workspace, the chat on the
 * estate's dark skin beside the plan itself, a light sheet of paper the way a design document
 * reads and prints. The planner owns the whole page, never a box on it (Faris, 2026-11-18), over a
 * soft wash of the skin's own accents. Linked from the planner's page alone, after the estate's
 * stylesheet, whose colours it uses, so a skin's tokens carry through.
 */

.planner {
  --pl-maker: color-mix(in srgb, var(--accent) 16%, var(--panel));
  --pl-glow: color-mix(in srgb, var(--accent) 22%, transparent);
  --pl-glass: color-mix(in srgb, var(--panel) 55%, transparent);
  margin: 28px 0 40px;
  min-height: 320px;
  scroll-margin-top: 12px;
}

/* Once a plan is open the planner is the page under the header, edge to edge. */
.planner.is-working {
  width: 100%;
}

/*
 * The planner's own page, an app: its name and a line over the planner, in the middle of the
 * screen, and nothing below it. Once a plan is open the name goes, and the workspace takes the
 * screen under the header.
 */
body.app {
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(
      70% 55% at 12% -8%,
      color-mix(in srgb, var(--accent) 16%, transparent),
      transparent 70%
    ),
    radial-gradient(
      55% 50% at 100% 105%,
      color-mix(in srgb, var(--accent-2, var(--accent)) 10%, transparent),
      transparent 70%
    ),
    linear-gradient(180deg, var(--bg-2), var(--bg) 55%);
  background-attachment: fixed;
}

body.app > .top {
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  backdrop-filter: blur(10px);
}

body.app main {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding-bottom: 0;
}

.planning--app {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 820px;
  padding: clamp(20px, 6vh, 64px) 0;
}

.planning--app:has(> .planner.is-working) {
  justify-content: flex-start;
  max-width: none;
  padding: 0;
}

body.app:has(.planner.is-working) main {
  padding: 0;
}

.pl-intro {
  margin: 0 0 22px;
  text-align: center;
}

.pl-intro h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 5vw, 3.1rem);
}

.pl-intro p {
  max-width: 58ch;
  margin: 0 auto;
  color: var(--ink-dim);
  font-size: 1.06rem;
}

.planning--app:has(> .planner.is-working) > .pl-intro {
  display: none;
}

.planning--app > .planner {
  margin: 0;
}

/* At work, the page is the screen's height, so the chat and the plan each scroll in their pane. */
body.app:has(.planner.is-working) {
  height: max(100dvh, 560px);
}

body.app:has(.planner.is-working) main,
.planning--app:has(> .planner.is-working) {
  min-height: 0;
}

.planning--app > .planner.is-working {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.planning--app > .planner.is-working > .pl-work {
  flex: 1;
  height: auto;
  min-height: 0;
}

.planner [hidden] {
  display: none !important;
}

.pl-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.pl-screen {
  display: grid;
  gap: 18px;
}

.pl-screen h2 {
  margin: 0;
}

/* Fields, buttons and chips. */

.planner textarea,
.planner select,
.planner input[type='text'] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.planner textarea:focus,
.planner select:focus,
.planner input[type='text']:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--pl-glow);
}

.planner textarea {
  resize: vertical;
  min-height: 5.5em;
}

.planner select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238fc3a6' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 11px;
  cursor: pointer;
}

.planner fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.planner legend {
  padding: 0;
  margin-bottom: 10px;
  font-weight: 700;
}

.planner button.btn {
  margin-top: 0;
  border: 0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.planner button[disabled] {
  opacity: 0.5;
  cursor: wait;
}

.pl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.pl-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.pl-row input[type='text'] {
  flex: 1 1 240px;
  width: auto;
}

.pl-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.pl-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 5px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

.pl-chip:hover {
  border-color: var(--accent);
}

.pl-hint {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.84rem;
}

/* The page's own check boxes: a card each, its box ticked in the accent. */

.pl-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.pl-check {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--bg);
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}

.pl-check:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line-soft));
}

.pl-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.pl-check__box {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 1.5px solid var(--ink-dim);
  border-radius: 7px;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.pl-check__box::after {
  content: '';
  width: 6px;
  height: 11px;
  margin-top: -3px;
  border: solid var(--accent-ink);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.15s;
}

.pl-check input:checked + .pl-check__box {
  border-color: var(--accent);
  background: var(--accent);
}

.pl-check input:checked + .pl-check__box::after {
  transform: rotate(45deg) scale(1);
}

.pl-check input:focus-visible + .pl-check__box {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.pl-check:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg));
}

.pl-check__text {
  display: grid;
  gap: 3px;
}

.pl-check__text strong {
  font-size: 0.98rem;
}

.pl-check__text small {
  color: var(--ink-dim);
  font-size: 0.82rem;
  line-height: 1.45;
}

/* How much story the game carries: a dropdown in a card like the boxes', its pick's line under it. */

.pl-story {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 12px 16px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--bg);
}

.pl-story:has(select:focus-visible),
.pl-story:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line-soft));
}

.pl-story strong {
  font-size: 0.98rem;
}

.planner .pl-story select {
  padding: 8px 10px;
  font-weight: 600;
}

.pl-story small {
  color: var(--ink-dim);
  font-size: 0.82rem;
  line-height: 1.45;
}

/* The start: the idea, three ideas on asking, the sections to add, the plans kept here. */

.pl-start {
  display: grid;
  gap: 18px;
}

.pl-start__head h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.pl-start__head p {
  max-width: 62ch;
  margin: 8px 0 0;
  color: var(--ink-dim);
}

.planner .pl-start textarea {
  min-height: 7em;
  font-size: 1.05rem;
}

.pl-start__go {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
}

.planner .pl-start__go .btn {
  padding: 14px 30px;
  font-size: 1.02rem;
}

.pl-start__go .note {
  max-width: 48ch;
  margin: 0;
}

.pl-help summary {
  color: var(--accent);
  cursor: pointer;
}

.pl-help[open] summary {
  margin-bottom: 12px;
}

.pl-ideas {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.pl-idea {
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--bg);
}

.pl-idea p {
  margin: 0;
  font-size: 0.92rem;
}

.pl-idea__genre {
  color: var(--ink-dim);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pl-idea__hook {
  color: var(--ink-dim);
}

.pl-status {
  margin: 8px 0 0;
  color: var(--ink-dim);
}

.pl-kept {
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.pl-kept h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.pl-kept ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pl-kept__plan {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pl-kept__plan:hover {
  border-color: var(--accent);
}

.pl-kept__plan small {
  color: var(--ink-dim);
  font-size: 0.78rem;
}

/* Waiting with no plan to show beside it, and a refusal with none. */

.pl-busy {
  justify-items: center;
  padding: 56px 0;
  color: var(--ink-dim);
  text-align: center;
}

.pl-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: pl-spin 0.9s linear infinite;
}

@keyframes pl-spin {
  to {
    transform: rotate(360deg);
  }
}

.pl-error {
  padding: 24px 0;
}

.pl-error p {
  margin: 0;
}

/* The workspace: the chat beside the plan, each scrolling in its own pane, the screen's height. */

.pl-work {
  display: grid;
  grid-template-columns: minmax(360px, 5fr) minmax(0, 8fr);
  grid-template-areas: 'chat plan';
  overflow: hidden;
}

.pl-work__tabs {
  display: none;
}

.pl-work__chat {
  position: relative;
  grid-area: chat;
  min-height: 0;
  border-right: 1px solid color-mix(in srgb, var(--line-soft) 70%, transparent);
  background: var(--pl-glass);
  backdrop-filter: blur(14px);
}

/* The plan's pyramid in small (src/planner/glyph.ts), at the chat's foot when the plan is a tab away. */
.pl-work__glyph {
  display: none;
}

/* Its parts as the board's pieces stand: a loose outline, smoked glass, lit, ivory stone, amber. */
.pl-glyph {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.pl-glyph__part {
  fill: transparent;
  stroke: color-mix(in srgb, var(--accent) 40%, transparent);
  stroke-width: 1.4;
  transition:
    fill 0.4s ease,
    stroke 0.4s ease;
}

.pl-glyph__part.is-forming {
  fill: color-mix(in srgb, var(--accent) 30%, transparent);
  stroke: color-mix(in srgb, var(--accent) 60%, transparent);
}

.pl-glyph__part.is-setting {
  fill: var(--accent);
  stroke: var(--accent);
  animation: pl-glyph-set 1.1s ease-in-out infinite alternate;
}

.pl-glyph__part.is-set {
  fill: #f4eee2;
  stroke: #e2d6bf;
}

.pl-glyph__cap.is-set {
  fill: #d4af62;
  stroke: #f6e3a8;
}

.pl-glyph__part.is-stale {
  fill: color-mix(in srgb, #e2a63a 35%, transparent);
  stroke: #e2a63a;
}

@keyframes pl-glyph-set {
  to {
    opacity: 0.45;
  }
}

.pl-work__plan {
  grid-area: plan;
  min-height: 0;
}

.pl-work__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 2px;
}

@media (max-width: 899px) {
  .pl-work {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
      'tabs'
      'pane';
  }

  .pl-work__tabs {
    grid-area: tabs;
    display: flex;
    gap: 4px;
    padding: 6px var(--gutter);
    border-bottom: 1px solid color-mix(in srgb, var(--line-soft) 70%, transparent);
    background: var(--pl-glass);
  }

  .pl-work[data-showing='chat'] .pl-work__glyph {
    position: absolute;
    bottom: 12px;
    left: 16px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 5px 5px 6px;
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    background: var(--bg);
    cursor: pointer;
    transition:
      border-color 0.15s ease,
      transform 0.15s ease;
  }

  .pl-work__glyph:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
  }

  .pl-work__glyph.is-moved {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--pl-glow);
  }

  /* The composer's last line, its hint, makes room for the glyph beside it. */
  .pl-work[data-showing='chat'] .pl-composer > .pl-hint:last-child {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding-left: 50px;
  }

  .pl-work[data-showing='chat'] .pl-composer {
    padding-bottom: 12px;
  }

  .pl-work__tab {
    flex: 1;
    min-height: 40px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--ink-dim);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
  }

  .pl-work__tab[aria-selected='true'] {
    background: var(--bg);
    color: var(--ink);
    box-shadow: inset 0 0 0 1px var(--line-soft);
  }

  .pl-work__chat,
  .pl-work__plan {
    grid-area: pane;
    border-right: 0;
  }

  .pl-work[data-showing='chat'] .pl-work__plan,
  .pl-work[data-showing='plan'] .pl-work__chat {
    display: none;
  }
}

/* The chat: its head, the thread, and the composer under it. */

.pl-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.pl-chat__head {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid color-mix(in srgb, var(--line-soft) 60%, transparent);
  font-size: 0.92rem;
}

.pl-chat__head span {
  color: var(--ink-dim);
  font-size: 0.8rem;
}

.planner .pl-room {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.pl-thread {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  margin: 0;
  padding: 18px 16px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}

.pl-msg {
  max-width: min(88%, 560px);
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.96rem;
  line-height: 1.5;
}

.pl-msg :where(p) {
  margin: 0;
}

.pl-msg > * + * {
  margin-top: 8px;
}

.pl-msg--planner {
  align-self: flex-start;
  border: 1px solid color-mix(in srgb, var(--line-soft) 70%, transparent);
  border-bottom-left-radius: 6px;
  background: color-mix(in srgb, var(--panel-2) 88%, transparent);
}

.pl-msg--maker {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  background: var(--pl-maker);
}

.pl-msg--planner:has(.pl-basics, .pl-lookcard, .pl-offers) {
  width: 100%;
  max-width: 100%;
}

.pl-msg__kicker {
  color: var(--ink-dim);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pl-msg__aside {
  color: var(--ink-dim);
  font-size: 0.88rem;
}

.pl-long > summary {
  list-style: none;
  cursor: pointer;
}

.pl-long > summary::-webkit-details-marker {
  display: none;
}

.pl-long > summary b {
  color: var(--accent);
  font-weight: 600;
}

.pl-long[open] > summary {
  display: none;
}

/* An answer in the thread, open to change where it stands. */

.pl-said > summary {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
}

.pl-said > summary::-webkit-details-marker {
  display: none;
}

.pl-said__edit {
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.15s;
}

.pl-msg--maker:hover .pl-said__edit,
.pl-said[open] .pl-said__edit,
.pl-said > summary:focus-visible .pl-said__edit {
  opacity: 1;
}

@media (hover: none) {
  .pl-said__edit {
    opacity: 0.85;
  }
}

.pl-said[open] {
  min-width: min(100%, 420px);
}

.pl-said[open] > summary {
  margin-bottom: 10px;
}

.pl-said .pl-actions {
  margin-top: 10px;
}

/* The basics, in the planner's first message. */

.pl-basics {
  display: grid;
  gap: 12px;
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg);
}

.pl-basic {
  display: grid;
  gap: 4px;
}

.pl-basic > span {
  color: var(--ink-dim);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pl-basics__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.planner .pl-basics select,
.planner .pl-basics input[type='text'] {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.9rem;
}

.planner .pl-basics select {
  padding-right: 30px;
}

.planner .pl-basic--title input[type='text'] {
  font-size: 1.05rem;
  font-weight: 700;
}

.pl-titles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.pl-titles .pl-chip {
  min-height: 30px;
  padding: 3px 12px;
  font-size: 0.82rem;
}

.planner .pl-save {
  justify-self: start;
  padding: 8px 14px;
  font-size: 0.88rem;
}

/* The look, beside the basics: the gallery's pictures in a strip, the pick ringed. */

.pl-lookcard {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg);
}

.pl-looks {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* The look's tiles, dense and edge to edge with thin gutters, the way the front page's templates read. */
.pl-looks__strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 4px;
  max-height: min(46dvh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 12px;
  scrollbar-width: thin;
}

.pl-look {
  position: relative;
  display: block;
  overflow: hidden;
  cursor: pointer;
}

/* The pick's tick, in the tile's corner. */
.pl-look::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3L15 7' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
      center / 14px no-repeat,
    var(--accent);
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity 0.15s ease,
    transform 0.15s ease;
}

.pl-look:has(input:checked)::after {
  opacity: 1;
  transform: none;
}

.pl-look input {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.pl-look__picture {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  background: var(--line-soft);
  object-fit: cover;
  transition:
    filter 0.2s ease,
    transform 0.3s ease;
}

.pl-look:hover .pl-look__picture {
  transform: scale(1.05);
}

.pl-looks__strip:has(input:checked) .pl-look:not(:has(input:checked)) .pl-look__picture {
  filter: saturate(0.7) brightness(0.72);
}

.pl-look:has(input:checked) {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.pl-look:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* The look's name over the tile's foot. */
.pl-look__name {
  position: absolute;
  inset: auto 0 0;
  padding: 18px 8px 6px;
  background: linear-gradient(transparent, rgb(0 0 0 / 78%));
  color: #fff;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgb(0 0 0 / 60%);
}

.pl-look:has(input:checked) .pl-look__name {
  font-weight: 800;
}

/* The question waiting: its options, and room for the maker's own words. */

.pl-question {
  display: grid;
  gap: 10px;
}

/*
 * The options, one to a line on the chat's own dark ground (Faris, 2026-11-18): a round mark for one
 * pick, a square for several, the pick lit in the accent.
 */
.pl-options {
  display: grid;
  gap: 6px;
}

.pl-option {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  min-height: 44px;
  padding: 11px 14px 11px 12px;
  border: 1px solid color-mix(in srgb, var(--line-soft) 75%, transparent);
  border-radius: 12px;
  background: transparent;
  font-size: 0.92rem;
  line-height: 1.35;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.pl-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pl-option:hover {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line-soft));
  background: color-mix(in srgb, var(--accent) 5%, var(--bg));
}

.pl-option:active {
  transform: scale(0.99);
}

.pl-option__mark {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border: 1.5px solid color-mix(in srgb, var(--ink-dim) 75%, transparent);
  border-radius: 50%;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.pl-question--several .pl-option__mark {
  border-radius: 5px;
}

.pl-option:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.pl-option:has(input:checked) .pl-option__mark {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--bg);
}

.pl-question--several .pl-option:has(input:checked) .pl-option__mark {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 10.5l3.2 3L15 7' fill='none' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
      center / 14px no-repeat,
    var(--accent);
  box-shadow: none;
}

.pl-option:has(input:checked) .pl-option__text {
  color: var(--ink);
  font-weight: 600;
}

.pl-option:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* The prompt box: the maker's own words, the send button a small round one inside it. */
.pl-prompt {
  position: relative;
}

.planner .pl-prompt :is(input, textarea) {
  width: 100%;
  padding: 12px 54px 12px 14px;
  border-radius: 14px;
  font-size: 0.94rem;
}

.planner .pl-prompt textarea {
  min-height: 3.4em;
  resize: none;
}

.pl-send {
  position: absolute;
  right: 7px;
  bottom: 7px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

.pl-send:hover {
  transform: translateY(-1px);
}

.pl-send:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

/* The composer sits on the chat's own ground, never a panel of its own. */
.pl-composer {
  display: grid;
  gap: 10px;
  padding: 6px 16px 14px;
}

.pl-composer .pl-options {
  max-height: 38dvh;
  overflow-y: auto;
}

.pl-composer__asks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: space-between;
}

.pl-composer--quiet {
  justify-items: center;
}

/* The part the planner talks about, switched by the maker. */
.pl-about {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--ink-dim);
  font-size: 0.8rem;
}

.planner .pl-about__pick {
  width: auto;
  min-height: 0;
  padding: 4px 28px 4px 10px;
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
}

/* The planner at work: thinking, and the steps of writing the plan. */

.pl-typing {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink-dim);
}

.pl-dots {
  display: inline-flex;
  gap: 4px;
}

.pl-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pl-bounce 1.2s ease-in-out infinite;
}

.pl-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.pl-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes pl-bounce {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

.pl-steps {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.pl-steps li {
  position: relative;
  padding: 7px 12px 7px 36px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink-dim);
  font-size: 0.9rem;
}

.pl-steps li::before {
  position: absolute;
  left: 13px;
  content: '○';
}

.pl-steps li.is-running {
  color: var(--ink);
}

.pl-steps li.is-running::before {
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -8px;
  border: 2px solid var(--line-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  content: '';
  animation: pl-spin 0.8s linear infinite;
}

.pl-steps li.is-done {
  color: var(--ink);
}

.pl-steps li.is-done::before {
  color: var(--accent);
  content: '✓';
}

.pl-steps li.is-skipped::before {
  content: '–';
}

/* The longer plans, offered once the one-page plan is written. */

.pl-offers {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.pl-offer {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: linear-gradient(
    150deg,
    color-mix(in srgb, var(--accent) 10%, var(--bg)),
    var(--bg) 60%
  );
}

.pl-offer[data-offer='2'] {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line-soft));
}

.pl-offer__head {
  display: flex;
  gap: 18px;
  align-items: center;
}

.pl-offer h4 {
  margin: 0;
  font-size: 1.15rem;
}

.pl-offer p {
  margin: 0;
}

.pl-offer__meta {
  color: var(--ink-dim);
  font-size: 0.8rem;
}

.planner .pl-offer__go {
  justify-self: start;
  margin-top: 8px;
  padding: 11px 20px;
  white-space: normal;
}

.pl-offer__note {
  color: var(--ink-dim);
  font-size: 0.78rem;
}

/* A stack of paper sheets, the count of pages on it. */
.pl-stack {
  position: relative;
  flex: none;
  width: 50px;
  height: 64px;
  margin: 10px 10px 0 2px;
}

.pl-stack__sheet {
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 8px, #d9cfbd 8px 10px) 8px 12px / 62% 70%
      no-repeat,
    #fbf7ef;
  box-shadow: 0 2px 6px rgb(0 0 0 / 35%);
  transform: translate(calc(var(--at) * 3px), calc(var(--at) * -3px))
    rotate(calc((var(--at) - 1) * 2deg));
}

.pl-stack__count {
  position: absolute;
  right: -10px;
  bottom: -8px;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 0 0 3px var(--bg);
}

.pl-inside summary {
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.pl-inside ol {
  display: grid;
  gap: 6px;
  max-height: 280px;
  margin: 10px 0 0;
  padding: 0 4px 0 0;
  overflow-y: auto;
  list-style: none;
}

.pl-inside li {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 8px;
  align-items: baseline;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel-2);
  font-size: 0.86rem;
}

.pl-inside li span {
  display: -webkit-box;
  flex-basis: 100%;
  overflow: hidden;
  color: var(--ink-dim);
  font-size: 0.8rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.pl-inside em {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* The plan beside the chat: its bar of tools, a panel under it, and the sheet. */

.pl-ledger {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  /* A glow behind the pyramid; the page's own wash shows through the rest. */
  background: radial-gradient(
    70% 55% at 50% 30%,
    color-mix(in srgb, var(--accent) 7%, transparent),
    transparent 75%
  );
}

.pl-ledger__bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--line-soft) 60%, transparent);
  background: color-mix(in srgb, var(--panel-2) 55%, transparent);
}

.pl-ledger__badge {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin: 0;
  font-size: 0.92rem;
}

.pl-ledger__badge span {
  color: var(--ink-dim);
  font-size: 0.8rem;
}

.pl-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.pl-tool {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-soft);
  color: var(--ink);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.pl-tool:hover {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.pl-tool--go {
  background: var(--accent);
  box-shadow: none;
  color: var(--accent-ink);
}

.pl-more {
  position: relative;
}

.pl-more > summary {
  list-style: none;
}

.pl-more > summary::-webkit-details-marker {
  display: none;
}

.pl-more__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 3;
  display: grid;
  min-width: 200px;
  padding: 6px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--panel-2);
  box-shadow: 0 16px 40px rgb(0 0 0 / 50%);
}

.pl-more__menu .pl-tool {
  justify-content: flex-start;
  box-shadow: none;
}

.pl-more__menu .pl-tool:hover {
  background: var(--bg);
}

.pl-ledger__panel:not(:empty) {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel-2);
}

.pl-panel {
  display: grid;
  gap: 12px;
}

.pl-panel .note {
  margin: 0;
}

.pl-ledger__scroll {
  flex: 1;
  min-height: 0;
  padding: clamp(14px, 2.4vw, 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
  container: sheet / inline-size;
}

/* The sheet: a design document on paper. */

.pl-sheet {
  overflow-x: auto;
}

.gdd {
  --paper: #fbf7ef;
  --paper-2: #f1eadc;
  --ink-paper: #1f1b16;
  --ink-paper-dim: #5c5246;
  --rule: #ddd2bf;
  --mark: #0b7a3e;
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(20px, 5vw, 56px);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink-paper);
  box-shadow: 0 18px 50px rgb(0 0 0 / 45%);
  font-size: 1rem;
  line-height: 1.6;
}

.gdd h1,
.gdd h2,
.gdd h3,
.gdd h4 {
  color: var(--ink-paper);
}

.gdd__cover {
  display: grid;
  gap: 12px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--ink-paper);
}

.gdd__kicker {
  margin: 0;
  color: var(--ink-paper-dim);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.gdd__cover h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  letter-spacing: -0.02em;
}

.gdd__pitch {
  margin: 0;
  font-size: 1.2rem;
  font-style: italic;
  color: var(--ink-paper-dim);
}

.gdd__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 0;
}

.gdd__facts div {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--paper-2);
}

.gdd__facts dt {
  display: inline;
  color: var(--ink-paper-dim);
  font-size: 0.8rem;
}

.gdd__facts dt::after {
  content: ': ';
}

.gdd__facts dd {
  display: inline;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.gdd__art {
  margin: 8px 0 0;
}

.gdd__art img {
  width: 100%;
  border-radius: 6px;
  background: var(--paper-2);
  aspect-ratio: 3 / 2;
  object-fit: contain;
}

.gdd__art figcaption {
  margin-top: 6px;
  color: var(--ink-paper-dim);
  font-size: 0.8rem;
}

.gdd__toc {
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
}

.gdd__toc h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.gdd__toc ol {
  columns: 2 220px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gdd__toc a {
  color: var(--ink-paper);
  text-decoration: none;
}

.gdd__toc a:hover {
  text-decoration: underline;
}

.gdd__section {
  padding: 28px 0 8px;
  border-bottom: 1px solid var(--rule);
}

.gdd__section h2 {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin: 0 0 8px;
  font-size: 1.6rem;
}

.gdd__num {
  display: inline-grid;
  place-items: center;
  min-width: 1.8em;
  height: 1.8em;
  border-radius: 50%;
  background: var(--ink-paper);
  color: var(--paper);
  font-size: 0.7em;
  font-weight: 700;
}

.gdd__summary {
  margin: 0 0 12px;
  font-size: 1.08rem;
  color: var(--ink-paper-dim);
}

.gdd h3 {
  margin: 18px 0 6px;
  font-size: 1.1rem;
}

.gdd h4 {
  margin: 14px 0 4px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-paper-dim);
}

.gdd p {
  margin: 0 0 10px;
}

.gdd ul,
.gdd ol {
  margin: 0 0 12px;
  padding-left: 1.3em;
}

.gdd__table {
  margin: 12px 0 16px;
  overflow-x: auto;
}

.gdd table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.gdd th,
.gdd td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.gdd th {
  border-bottom: 2px solid var(--ink-paper);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gdd tbody tr:nth-child(even) {
  background: var(--paper-2);
}

.gdd__features {
  display: grid;
  gap: 6px;
  margin: 14px 0 18px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--paper-2);
  list-style: none;
}

.gdd__chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: 1px;
}

.gdd__chip--p0 {
  background: #b5371d;
  color: #fff;
}

.gdd__chip--p1 {
  background: #e0a526;
  color: #2a1d00;
}

.gdd__chip--p2 {
  background: #d8cfbf;
  color: var(--ink-paper);
}

.gdd__chip--stale {
  margin: 0 0 8px;
  background: #fde7b0;
  color: #5a3d00;
  text-transform: none;
  letter-spacing: 0;
}

.gdd__chip--built {
  background: var(--mark);
  color: #fff;
}

.gdd__chip--kind {
  background: var(--paper-2);
  color: var(--ink-paper);
  box-shadow: inset 0 0 0 1px var(--rule);
}

/* The build path at a glance: each stage a floor, what a player can play after it beside it. */
.gdd__path {
  display: grid;
  gap: 0;
  margin: 16px 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
}

.gdd__path li {
  display: grid;
  grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
  gap: 4px 16px;
  padding: 10px 14px;
  border-top: 1px solid var(--rule);
}

.gdd__path li:first-child {
  border-top: 0;
}

.gdd__path a {
  display: flex;
  gap: 8px;
  align-items: center;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.gdd__path li > span {
  color: var(--ink-paper-dim);
}

@media (max-width: 560px) {
  .gdd__path li {
    grid-template-columns: minmax(0, 1fr);
  }
}

.gdd__stages {
  display: grid;
  gap: 16px;
  margin: 16px 0;
  padding: 0;
  list-style: none;
}

.gdd__stage {
  position: relative;
  padding: 18px 20px;
  border: 1px solid var(--rule);
  border-left: 4px solid var(--ink-paper);
  border-radius: 8px;
  background: #fff;
  break-inside: avoid;
}

.gdd__stage.is-built {
  border-left-color: var(--mark);
}

.gdd__stage header {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.gdd__stage h3 {
  margin: 0;
}

.gdd__playable {
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--paper-2);
}

.gdd__brief summary {
  cursor: pointer;
  color: var(--mark);
  font-weight: 600;
}

.gdd__brief pre {
  margin: 8px 0 0;
  padding: 12px;
  border-radius: 6px;
  background: var(--paper-2);
  white-space: pre-wrap;
  font-size: 0.82rem;
  line-height: 1.5;
}

.gdd__stage .pl-actions {
  margin-top: 12px;
}

.gdd__stage .btn--quiet {
  color: var(--mark);
  box-shadow: inset 0 0 0 1px var(--rule);
}

/* The sheet sized to its pane, not the screen. */

.pl-ledger .gdd {
  padding: clamp(20px, 6cqi, 52px);
}

.pl-ledger .gdd__cover h1 {
  font-size: clamp(1.9rem, 7cqi, 3.2rem);
}

@container sheet (max-width: 560px) {
  .gdd__path li {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* A written plan's two faces: its pyramid, or the document. */

.pl-faces {
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  box-shadow: inset 0 0 0 1px var(--line-soft);
}

.pl-face {
  min-height: 30px;
  padding: 4px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.pl-face[aria-pressed='true'] {
  background: var(--bg);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-soft);
}

.pl-ledger[data-view='pyramid'] .pl-sheet,
.pl-ledger[data-view='plan'] .pl-board {
  display: none;
}

/* On a phone the bar keeps to two rows: the plan's name beside its faces, the tools under them. */
@media (max-width: 520px) {
  .pl-ledger__badge span {
    display: none;
  }

  .pl-tools {
    gap: 4px;
  }

  .pl-tool {
    min-height: 32px;
    padding: 5px 9px;
    font-size: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pl-glyph__part.is-setting {
    animation: none;
  }

  .pl-look__picture {
    transition: none;
  }

  .pl-look:hover .pl-look__picture {
    transform: none;
  }

  .pl-dots i {
    animation: none !important;
  }
}

@media print {
  body > :not(main),
  main > :not(article),
  .planning--app > :not(.planner),
  .pl-noprint,
  .pl-work__tabs,
  .pl-work__chat,
  .pl-board {
    display: none !important;
  }

  html,
  body,
  .planner,
  .planner.is-working {
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: #fff;
  }

  .pl-work,
  .pl-work__plan,
  .pl-ledger,
  .pl-ledger__scroll,
  .pl-ledger .pl-sheet {
    display: block !important;
    height: auto;
    padding: 0;
    overflow: visible;
    border: 0;
    background: none;
    box-shadow: none;
  }

  .gdd,
  .pl-ledger .gdd {
    max-width: none;
    padding: 0;
    box-shadow: none;
    background: #fff;
  }

  .gdd__brief[open] pre,
  .gdd__brief pre {
    display: block;
  }

  .gdd__section {
    break-inside: auto;
  }

  .gdd__section h2 {
    break-after: avoid;
  }
}
