/* play.knotwell.app. Tokens mirror the Knotwell design system (discreet and warm, one plum accent, no shadows)
   and the approved canvas boards Play* (ADR 0014). */
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('/fonts/hanken-grotesk-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Young Serif';
  src: url('/fonts/young-serif-latin.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --surface-100: #f8f2f0;
  --surface-200: #ffffff;
  --surface-300: #f0e6e4;
  --ink: #24191c;
  --ink-muted: #6e5f62;
  --line: #e6dad8;
  --line-strong: #948286;
  --plum: #7a2e4a;
  --plum-press: #702c45;
  --on-plum: #ffffff;
  --plum-soft: #efdde3;
  --danger: #a1121a;
  --logo-line: #f6e9e4;
  --serif: 'Young Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface-100: #161113;
    --surface-200: #211a1c;
    --surface-300: #2c2326;
    --ink: #f3ebec;
    --ink-muted: #b3a5a8;
    --line: #3a3033;
    --line-strong: #7a6a6d;
    --plum: #e09ab2;
    --plum-press: #d48aa4;
    --on-plum: #2a0f19;
    --plum-soft: #3d2530;
    --danger: #ff7a7f;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--surface-100);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 24px;
}
.app {
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}
:focus-visible {
  outline: 2px solid var(--plum);
  outline-offset: 2px;
}
h1:focus {
  outline: none;
}

/* Header */
.top {
  height: 64px;
  padding: 0 12px 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1;
}
.logo {
  width: 28px;
  height: 28px;
}
.logo-bg {
  fill: #7a2e4a;
}
.logo-knot,
.logo-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.logo-knot {
  stroke: var(--logo-line);
  stroke-width: 16;
}
.logo-line {
  stroke: #7a2e4a;
  stroke-width: 4;
}
.lang {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font: 600 15px/1 var(--sans);
  cursor: pointer;
}

/* Layout */
.main {
  flex: 1;
  padding: 24px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.actions {
  position: sticky;
  bottom: 0;
  padding: 16px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-100);
}
h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 32px;
  letter-spacing: -0.2px;
}
.sub {
  margin: 8px 0 0;
  font-size: 16px;
  line-height: 22px;
  font-weight: 700;
}
/* A new section of the create form (PlayCriar): 16 px margin + the 16 px stack gap = 32 px above the heading. */
.sub-section {
  margin-top: 16px;
}
p {
  margin: 0;
}
.muted {
  color: var(--ink-muted);
}
.hint {
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-muted);
}
.status {
  font-weight: 600;
}
.callout {
  background: var(--plum-soft);
  border-radius: 12px;
  padding: 16px;
}
.pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--plum);
  border-radius: 999px;
  font-size: 15px;
  line-height: 20px;
  font-weight: 600;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--plum);
}

/* Controls */
.btn {
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 12px;
  font: 600 16px/22px var(--sans);
  text-align: center;
  cursor: pointer;
  width: 100%;
}
.btn-primary {
  background: var(--plum);
  border: 1.5px solid var(--plum);
  color: var(--on-plum);
}
.btn-primary:hover,
.btn-primary:active {
  background: var(--plum-press);
}
.btn-secondary {
  background: transparent;
  border: 1.5px solid var(--line-strong);
  color: var(--ink);
}
.btn-secondary:hover,
.btn-secondary:active {
  background: var(--surface-300);
}
.group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.label {
  font-size: 16px;
  line-height: 22px;
  font-weight: 600;
}
.card .label,
.label.small {
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-muted);
}
.field {
  width: 100%;
  min-height: 52px;
  padding: 14px;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-200);
  color: var(--ink);
  font: 17px/22px var(--sans);
}
.field:focus {
  outline: none;
  border: 2px solid var(--plum);
  padding: 13.5px;
}
/* Fields inside an item card are smaller, as on the PlayCriar board (48 px, 12 px padding). */
.card .field {
  min-height: 48px;
  padding: 12px;
}
.card .field:focus {
  padding: 11.5px;
}
.card {
  background: var(--surface-200);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.row {
  display: grid;
  grid-template-columns: 72px 72px minmax(0, 1fr);
  gap: 8px;
}
.segs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1.5px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-200);
}
.seg {
  flex: 1;
  min-height: 44px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 600 15px/1 var(--sans);
  cursor: pointer;
}
.seg[aria-pressed='true'] {
  background: var(--plum);
  color: var(--on-plum);
}
.remove {
  align-self: flex-start;
  min-height: 44px;
  padding: 0 12px;
  margin-left: -12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--danger);
  font: 600 15px/1 var(--sans);
  cursor: pointer;
}
.switch-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 8px 0;
}
.switch-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.switch-text .label {
  font-size: 17px;
}
.switch {
  flex-shrink: 0;
  position: relative;
  width: 52px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface-300);
  cursor: pointer;
}
.switch[aria-checked='true'] {
  background: var(--plum);
  border-color: var(--plum);
}
.knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-200);
  transition: left 200ms ease-out;
}
.switch[aria-checked='true'] .knob {
  left: 23px;
}
.url {
  font-size: 15px;
  line-height: 22px;
  color: var(--ink-muted);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Board content */
.reason {
  background: var(--surface-300);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.reason-label,
.result-label {
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-muted);
  font-weight: 600;
}
.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.items {
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
}
.items li {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.item-name {
  font-weight: 600;
  line-height: 22px;
}
.item-range {
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-muted);
}
.result {
  background: var(--plum-soft);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.result-name {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 28px;
  overflow-wrap: anywhere;
}
.result-qty {
  font-size: 32px;
  line-height: 38px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* The draw: three cards pass slowly and stop on one (200 ms-scale easing, nothing bounces). */
.deck {
  position: relative;
  height: 320px;
}
.card-anim {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 240px;
  height: 150px;
  margin: -75px 0 0 -120px;
  padding: 20px;
  border-radius: 24px;
  background: var(--surface-200);
  border: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 24px;
  color: var(--ink-muted);
  overflow: hidden;
  animation: pass 2.4s ease-out both;
}
.card-anim.c0 {
  --x: -14px;
  --y: -22px;
  --r: -6deg;
}
.card-anim.c1 {
  --x: 12px;
  --y: -10px;
  --r: 4deg;
  animation-delay: 0.2s;
}
.card-anim.c2 {
  --x: 0px;
  --y: 8px;
  --r: 0deg;
  animation-delay: 0.4s;
  border: 2px solid var(--plum);
  color: var(--ink);
}
@keyframes pass {
  0% {
    opacity: 0;
    transform: translate(-60px, 40px) rotate(-12deg);
  }
  60% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translate(var(--x), var(--y)) rotate(var(--r));
  }
}
@media (prefers-reduced-motion: reduce) {
  .card-anim,
  .knob {
    animation: none;
    transition: none;
  }
}

/* Suggestions (board PlaySugestoes) */
.back {
  align-self: flex-start;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--plum);
  font: 600 16px/22px var(--sans);
  cursor: pointer;
}
.back:hover {
  text-decoration: underline;
}
.back {
  gap: 4px;
  margin-left: -4px;
}
.back-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* «Escolher das sugestões» on the create screen (PlayCriar): 52 px, plum outline and text, light bulb. */
.btn-suggest {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface-200);
  border: 1.5px solid var(--plum);
  color: var(--plum);
  font-weight: 700;
}
.btn-suggest:hover,
.btn-suggest:active {
  background: var(--surface-300);
}
.suggest-icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hint-tight {
  margin-top: -8px;
}
.btn:disabled {
  opacity: 0.45;
  cursor: default;
}
.hint strong {
  color: var(--ink);
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -24px;
  padding: 0 24px 4px;
}
.chip {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font: 600 15px/1 var(--sans);
  cursor: pointer;
}
.chip[aria-pressed='true'] {
  border-color: var(--plum);
  background: var(--plum);
  color: var(--on-plum);
}
.sug-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sug-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sug-section .sub {
  margin: 0;
}
.sug-section .items li {
  padding: 0;
  display: block;
}
.check-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  cursor: pointer;
}
.check-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.check-box {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-top: 2px;
  border-radius: 6px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface-200);
  display: flex;
  align-items: center;
  justify-content: center;
}
.check-mark {
  display: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--on-plum);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.check-input:checked + .check-box {
  border-color: var(--plum);
  background: var(--plum);
}
.check-input:checked + .check-box .check-mark {
  display: block;
}
.check-input:focus-visible + .check-box {
  outline: 2px solid var(--plum);
  outline-offset: 2px;
}
.check-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink-muted);
  font-size: 13px;
  line-height: 20px;
  font-weight: 600;
}
.tag-explicit {
  border-color: var(--plum);
  color: var(--plum);
}
