/* The look, in the tokens' words. Every value that is a choice — a colour, a
   space, a radius, a size — is a var(--…) from /tokens.css, which
   design/tokens.json compiles to at boot; `bun run lint:design` refuses a raw
   colour here. Light and dark are the tokens' business, not this file's. */

/* The page. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-fg);
  font: var(--text-base) / var(--leading-body) var(--font-sans);
}
.page {
  max-width: 68rem;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-6);
}
.head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
}
h1 {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: var(--leading-tight);
}
p {
  margin: 0;
}
a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}
code,
.mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.muted {
  color: var(--color-muted);
}
.you {
  color: var(--color-muted);
  white-space: nowrap;
}

/* Blocks. */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}
.row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.note {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--color-line);
}
.note:first-child {
  border-top: 0;
}
.note p {
  overflow-wrap: anywhere;
}
.note small {
  font-size: var(--text-sm);
}
.empty {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--color-muted);
  border: 1px dashed var(--color-line);
  border-radius: var(--radius-md);
}
footer {
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  display: grid;
  gap: var(--space-1);
}
footer code {
  overflow-wrap: anywhere;
}

/* Controls: at least 44px on a side, keyboard and mouse alike. */
.input {
  flex: 1;
  min-width: 0;
  min-height: var(--size-tap);
  padding: 0 var(--space-3);
  font: inherit;
  font-size: max(16px, var(--text-base));
  color: inherit;
  background: var(--color-bg);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
}
.input::placeholder {
  color: var(--color-muted);
}
.button {
  min-height: var(--size-tap);
  padding: 0 var(--space-4);
  font: inherit;
  font-weight: 600;
  color: var(--color-accent-fg);
  background: var(--color-accent);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.button:hover {
  filter: brightness(1.08);
}
.button-quiet {
  color: var(--color-muted);
  background: transparent;
  padding: 0 var(--space-3);
}
.button-quiet:hover {
  color: var(--color-fg);
  border-color: var(--color-line);
  filter: none;
}
.pill {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-muted);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-pill);
}
.pill[data-env="production"] {
  color: var(--color-accent);
  border-color: currentColor;
}

/* Headings inside cards, and the name at the top that goes home. */
h2 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-lg);
  line-height: var(--leading-tight);
}
h2 small {
  font-weight: 400;
  font-size: var(--text-sm);
}
main > h2 {
  margin-bottom: var(--space-3);
}
.home {
  color: inherit;
  text-decoration: none;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 0 var(--space-4);
  align-items: start;
}
.grid .card,
.controls {
  display: grid;
  gap: var(--space-3);
}
.row.wrap {
  flex-wrap: wrap;
}
.item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--color-line);
}
.item:first-child {
  border-top: 0;
}
.item p {
  overflow-wrap: anywhere;
}
.item small {
  font-size: var(--text-sm);
}
.list-plain,
.howto {
  margin: 0;
  padding-left: var(--space-5);
}
.howto li + li {
  margin-top: var(--space-1);
}
.chat {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-1);
  overflow-wrap: anywhere;
}
.score {
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
}
.scrawl {
  font-weight: 600;
  font-style: italic;
}
.callout {
  padding: var(--space-3);
  border-left: 3px solid var(--color-accent);
  background: var(--color-bg);
}
.share {
  overflow-wrap: anywhere;
}
kbd {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: 0 var(--space-1);
  border: 1px solid var(--color-line);
  border-radius: 4px;
}
.button-big {
  min-height: calc(var(--size-tap) + 8px);
  padding: 0 var(--space-5);
  font-size: var(--text-lg);
}
.button-alt {
  color: var(--color-fg);
  background: var(--color-surface);
  border-color: var(--color-line);
}

/* The stage: a canvas that is its size before a pixel is drawn, so nothing moves. */
.stage {
  margin-bottom: var(--space-5);
}
.viewport {
  position: relative;
  aspect-ratio: 4 / 3;
  max-height: 72vh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--color-game-sky);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
}
.viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
.viewport-note {
  position: absolute;
  inset: auto var(--space-4) var(--space-4);
  padding: var(--space-3);
  text-align: center;
  color: var(--color-fg);
  background: var(--color-surface);
  border-radius: var(--radius-md);
}
.viewport.ready .viewport-note {
  display: none;
}
.tags {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.tag {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  justify-items: center;
  gap: 2px;
  font-size: var(--text-sm);
  line-height: var(--leading-tight);
  white-space: nowrap;
}
.tag b {
  padding: 1px var(--space-2);
  color: var(--color-fg);
  background: var(--color-surface);
  border-radius: var(--radius-pill);
}
.tag-me b {
  color: var(--color-accent-fg);
  background: var(--color-accent);
}
.tag span {
  order: -1;
  max-width: 14rem;
  padding: var(--space-1) var(--space-2);
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--color-toast-fg);
  background: var(--color-toast-bg);
  border-radius: var(--radius-md);
}
.hud {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  right: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  pointer-events: none;
  font-size: var(--text-sm);
}
.hud p:empty {
  display: none;
}
.hud p {
  padding: 2px var(--space-2);
  color: var(--color-fg);
  background: var(--color-surface);
  border-radius: var(--radius-pill);
}
.over {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  text-align: center;
  color: var(--color-fg);
  background: var(--color-surface);
}
.over[hidden] {
  display: none;
}
.over-title {
  font-size: var(--text-xl);
  font-weight: 700;
}
.pad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-top: var(--space-3);
}
.pad .button {
  justify-content: center;
}

/* A word from the last request, shown once, gone in a moment. */
.toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-5);
  transform: translateX(-50%);
  max-width: calc(100% - 2 * var(--space-4));
  padding: var(--space-3) var(--space-4);
  color: var(--color-toast-fg);
  background: var(--color-toast-bg);
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 24px var(--color-shadow);
  animation: toast 6s forwards;
}
@keyframes toast {
  0%,
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    visibility: hidden;
  }
}
/* Motion is a courtesy: whoever asked for less gets none. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .toast {
    animation: none;
  }
}

/* Cheffry's dressing room: the class picker. */
.class-pick {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}
.class-card {
  display: grid;
  gap: var(--space-1);
  align-content: start;
  padding: var(--space-3);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: var(--size-tap);
}
.class-card:has(input:checked) {
  border-color: var(--color-accent);
  outline: 2px solid var(--color-accent);
}
.class-card input {
  accent-color: var(--color-accent);
}
.class-name {
  font-weight: bold;
}
.class-tag {
  font-size: var(--text-sm);
  color: var(--color-muted);
}

/* Cheffry's Spice Rack: the kitchen wall, chalked. */
.chalk {
  margin: 0;
  padding: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.04em;
  color: var(--color-toast-fg);
  background: var(--color-toast-bg);
  border-radius: var(--radius-md);
}
#spice-rack h3,
#exchange h3,
#vault h3 {
  margin: var(--space-3) 0 var(--space-1);
  font-size: var(--text-base);
}

/* Cheffry's Bread Vault: the door chalked shut, the house on top. */
.chalk + .chalk {
  margin-top: var(--space-2);
}
.house {
  border-left: 4px solid var(--color-accent);
  padding-left: var(--space-2);
}
.wallet {
  font-size: var(--text-lg);
}
.loaves {
  font-family: var(--font-mono);
  white-space: nowrap;
}
