/* The designer: a bar across the top, the canvas, and the tools (beside it on wide screens,
   under it on phones). */
.designer {
  display: grid;
  grid-template-areas: "bar bar" "stage panel";
  grid-template-columns: 1fr 22rem;
  grid-template-rows: auto 1fr;
  height: 100vh;
  height: 100dvh;
}

.designer-bar {
  grid-area: bar;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  padding: 0.7rem 1rem;
  background: rgb(255 255 255 / 0.6);
  border-bottom: 1px solid rgb(91 58 85 / 0.12);
}
.designer-bar .wordmark {
  margin-right: 0;
  font-weight: 800;
  text-decoration: none;
}
.design-name { margin-right: auto; }
.designer-choices,
.designer-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.designer-stage {
  grid-area: stage;
  position: relative;
  min-height: 0;
  overflow: hidden;
  touch-action: none; /* the canvas handles drags and pinches itself */
}
/* Front / Back, floating over the top of the canvas. */
.stage-sides {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  background: rgb(255 255 255 / 0.75);
  box-shadow: 0 2px 10px rgb(91 58 85 / 0.12);
}
.designer-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 600;
}
/* The starter design's description (designer.ts), a quiet caption under the paddle, above the
   status line. */
.template-note {
  position: absolute;
  bottom: 2.6rem;
  left: 50%;
  z-index: 1;
  width: max-content;
  max-width: min(36rem, calc(100% - 2rem));
  margin: 0;
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--plum);
  text-align: center;
  background: rgb(255 255 255 / 0.75);
  border-radius: 0.6rem;
  box-shadow: 0 2px 10px rgb(91 58 85 / 0.1);
  transform: translateX(-50%);
  pointer-events: none;
}
.template-note[hidden] { display: none; }
.designer-status {
  position: absolute;
  right: 1rem;
  bottom: 0.75rem;
  left: 1rem;
  font-weight: 600;
  color: #a0144f;
  text-align: center;
  pointer-events: none;
}

.designer-panel {
  grid-area: panel;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  overflow-y: auto;
  background: rgb(255 255 255 / 0.55);
  border-left: 1px solid rgb(91 58 85 / 0.12);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: rgb(91 58 85 / 0.08);
  border-radius: 999px;
}
.segmented button {
  appearance: none;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-weight: 600;
  color: var(--plum);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.segmented button[aria-pressed="true"] {
  background: var(--white);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.12);
}

.tool {
  appearance: none;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-weight: 600;
  color: var(--plum);
  background: var(--white);
  border: 1px solid rgb(91 58 85 / 0.2);
  border-radius: 999px;
  cursor: pointer;
}
.tool:disabled { opacity: 0.4; cursor: default; }
.tool[aria-pressed="true"] { color: var(--white); background: var(--plum); }
.tool.danger { color: #a0144f; }

.designer-tabs {
  display: flex;
  justify-content: space-between;
  gap: 0;
  border-bottom: 1px solid rgb(91 58 85 / 0.15);
}
.designer-tabs button {
  appearance: none;
  padding: 0.6rem 0.35rem;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  color: rgb(91 58 85 / 0.6);
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}
.designer-tabs [aria-selected="true"] {
  color: var(--plum);
  border-bottom-color: var(--pink);
}

.designer-section,
.text-editor {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.field textarea {
  padding: 0.6rem 0.8rem;
  font: inherit;
  font-size: 1rem;
  color: var(--plum);
  border: 2px solid rgb(91 58 85 / 0.2);
  border-radius: 0.8rem;
  resize: vertical;
}
.field.slider {
  display: grid;
  grid-template-columns: 4.5rem 1fr 7rem;
  align-items: center;
  gap: 0.5rem;
}
.slider input { width: 100%; accent-color: var(--plum); }
.slider output {
  font-size: 0.85rem;
  font-weight: 500;
  text-align: right;
  opacity: 0.8;
}

.font-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
  max-height: 15rem;
  overflow-y: auto;
}
.font-choice,
.art-choice,
.template-choice {
  appearance: none;
  background: var(--white);
  border: 2px solid transparent;
  border-radius: 0.7rem;
  cursor: pointer;
}
.font-choice { height: 2.6rem; padding: 0.35rem 0.5rem; }
.font-choice svg,
.art-choice svg {
  width: 100%;
  height: 100%;
  fill: var(--plum);
}
/* A heavy motif's picture (motifs/<id>.png), coloured like the drawn icons. Hidden picker groups
   are display: none, so their pictures aren't fetched until the group is opened. */
.art-picture {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--plum);
  mask: var(--picture) center / contain no-repeat;
}
.font-choice[aria-selected="true"] { border-color: var(--pink); }
.font-choice:hover,
.art-choice:hover,
.template-choice:hover { border-color: rgb(255 126 182 / 0.6); }

.art-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.chip {
  appearance: none;
  padding: 0.3rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--plum);
  background: var(--white);
  border: 1px solid rgb(91 58 85 / 0.2);
  border-radius: 999px;
  cursor: pointer;
}
.chip[aria-pressed="true"] {
  color: var(--white);
  background: var(--plum);
  border-color: var(--plum);
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}
.art-choice { aspect-ratio: 1; padding: 0.55rem; }

.upload {
  display: grid;
  gap: 0.6rem;
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid rgb(91 58 85 / 0.15);
}
.upload-title { margin: 0; font-size: 1rem; }
.upload-pick { justify-self: start; cursor: pointer; }
.upload-pick:focus-within { outline: 2px solid var(--pink); outline-offset: 2px; }
.upload-editor { display: grid; gap: 0.6rem; }
.upload-preview {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 0.6rem;
  background: #f3e3cc;
}
.upload-status { margin: 0; min-height: 1.2em; font-size: 0.85rem; }
.upload-status.is-problem { color: #a0144f; }
.upload-actions { display: flex; gap: 0.5rem; align-items: center; }

.template-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}
.template-choice {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.4rem 0.4rem 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--plum);
}
.template-choice canvas {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1; /* until it's drawn */
}
/* The "Start from" tab (template_picker.ts). */
.template-picker input[type="search"] { width: 100%; padding: 0.55rem 0.9rem; }
.template-shelf {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
}
.template-shelf select {
  flex: 1;
  padding: 0.3rem 0.5rem;
  font: inherit;
  color: var(--plum);
  background: var(--white);
  border: 1px solid rgb(91 58 85 / 0.2);
  border-radius: 0.6rem;
}
.template-filters .chip { font-size: 0.8rem; }
[data-role="template-more"] { width: 100%; }

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgb(91 58 85 / 0.12);
}

.designer-saved,
.hint {
  font-size: 0.8rem;
  opacity: 0.65;
}

@media (max-width: 899px) {
  .designer {
    grid-template-areas: "bar" "stage" "panel";
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(40vh, 1fr) auto;
  }
  .designer-panel {
    max-height: 50vh;
    border-top: 1px solid rgb(91 58 85 / 0.12);
    border-left: 0;
  }
}

/* The design's name, saving, and the account link (in the bar). */
.design-name input {
  width: 13rem;
  padding: 0.45rem 0.9rem;
  font-weight: 700;
}
.designer-account {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.save-status {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.75;
}
.save-status.is-problem {
  max-width: 22rem;
  color: #a0144f;
  opacity: 1;
}

/* When another tab saved first (see saver.ts). */
.designer-conflict {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  left: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-weight: 600;
  background: var(--white);
  border: 2px solid var(--pink);
  border-radius: 1rem;
  box-shadow: 0 6px 24px rgb(91 58 85 / 0.15);
}
.designer-conflict p { flex: 1 1 16rem; }

/* The finishes: a swatch of the wood with a sample of the burn on it, the name, a line about it. */
.finish-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.finish-choice {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 0.6rem;
  font: inherit;
  color: var(--plum);
  text-align: left;
  appearance: none;
  background: var(--white);
  border: 2px solid transparent;
  border-radius: 0.7rem;
  cursor: pointer;
}
.finish-choice:hover { border-color: rgb(255 126 182 / 0.6); }
.finish-choice[aria-selected="true"] { border-color: var(--pink); }
.finish-swatch {
  display: grid;
  flex: none;
  place-items: center;
  width: 3rem;
  height: 2.2rem;
  font-family: "Pacifico", cursive;
  font-size: 0.95rem;
  border-radius: 0.4rem;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.12);
}
.finish-words { display: flex; flex-direction: column; line-height: 1.25; }
.finish-words small { font-size: 0.8rem; opacity: 0.75; }

/* The handle tab: section titles, colour dots, and the charms. */
.panel-title {
  margin-top: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.7;
}
.handle-swatch { display: none; }
.color-row { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.15rem 0.1rem; }
.color-choice {
  width: 1.9rem;
  height: 1.9rem;
  appearance: none;
  border: 2px solid var(--white);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(91 58 85 / 0.25);
  cursor: pointer;
}
.color-choice[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--pink); }
.charm-row { align-self: flex-start; flex-wrap: wrap; }
.hint.is-advice { font-weight: 600; color: #a0144f; }

/* The admin's template editor: what the check on every paddle found (template_editor.ts). */
.template-check {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  left: 1rem;
  max-height: 40%;
  padding: 0.75rem 1rem;
  overflow-y: auto;
  font-size: 0.9rem;
  background: var(--white);
  border: 2px solid var(--pink);
  border-radius: 0.75rem;
}
.template-check p { font-weight: 700; }
.template-check ul { margin-top: 0.4rem; padding-left: 1.2rem; }
.template-check li.is-problem { color: #a0144f; font-weight: 600; }
