/* Hallmark · macrostructure: Sweet counter / full-width tin · tone: tactile playful
 * anchor hue: existing strawberry · fonts: inherited · no decorative motion
 * pre-emit critique: P5 H4 E4 S5 R4 V5 · browser acceptance: pending parent
 */
@import url('./assets/depth-tokens.css');

html, body { overflow-x: clip; }
.shop, .screen, .hud, .hud-title, .tray, .controls, .move-lens { min-width: 0; }
:where(h1, h2, h3, .wordmark) { overflow-wrap: anywhere; min-width: 0; font-style: normal; }

/* Give the score a quiet enamel face and reserve the dark cap for readable labels. */
.play { gap: var(--space-depth-3); padding-inline: var(--space-depth-1); }
.hud { gap: var(--space-depth-2); }
.hud-top {
  grid-template-columns: var(--tap) minmax(0, 1fr);
  gap: var(--space-depth-2);
  align-items: start;
}
.hud-title { align-self: center; }
.hud-title b { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.2; }
.hud-title small { color: var(--color-depth-muted); letter-spacing: .025em; }
.hud-goal { color: var(--color-depth-ink); line-height: 1.35; }
.hud-lives { color: var(--color-depth-action); }
.plates {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-depth-2);
  align-items: center;
}
.plate, .plate.score { min-width: 0; border-color: var(--color-depth-action); }
.plate small {
  background: var(--color-depth-action);
  color: var(--color-depth-action-ink);
  font-size: .6875rem;
  line-height: 1.6;
  letter-spacing: .1em;
}
.plate b { font-size: 1.5rem; padding-inline: var(--space-depth-2); }
.plate.moves { background: var(--paper); }
.plate.low small { background: var(--color-depth-action-hover); }
.plate.low b { color: var(--color-depth-action-hover); }
.bar-legend { color: var(--color-depth-muted); font-size: .8125rem; gap: var(--space-depth-2); }
.bar-legend > span { min-width: 0; }
.order { border-color: var(--color-depth-rule); }

/* A tray is sized by available width. Short phones scroll rather than crushing the sweets. */
.play .tray {
  width: 100%;
  max-width: none;
  padding: var(--space-depth-1);
  border: 2px solid var(--color-depth-action);
  border-radius: var(--radius-depth-tray);
  background: linear-gradient(180deg, var(--color-depth-tin-light), var(--color-depth-tin));
  box-shadow: inset 0 2px 0 var(--color-depth-cream), 0 4px 0 var(--color-depth-action);
}
.board { border-radius: var(--radius-depth-control); background: var(--ice-2); }
.holes {
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--rows), minmax(0, 1fr));
}
.holes i:not([data-jelly]):not([data-icing]):not([data-lane]) {
  box-shadow: inset 0 2px 0 color-mix(in oklab, var(--color-depth-tin-edge) 18%, var(--color-depth-clear)),
    inset 0 -1px 0 var(--color-depth-cream);
}
.tile:not([data-kind='frog']) .sweet { width: 94%; height: 94%; }
body.big-tiles .tile:not([data-kind='frog']) .sweet { width: 100%; height: 100%; }
.tile[data-kind='row']::before, .tile[data-kind='col']::before, .tile[data-kind='wrap']::before {
  inset: 3%;
  filter: none;
}
.tile.picked::after {
  background-image: none;
  inset: 2%;
  border: 3px solid var(--color-depth-ink);
  outline: 2px solid var(--color-depth-cream);
  outline-offset: -5px;
  border-radius: 22%;
}
.board:focus-visible { outline: 3px solid var(--color-depth-ink); outline-offset: 3px; }

/* Six labeled fittings, each its own generous touch target. Their original listeners stay put. */
.controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: center;
  gap: var(--space-depth-1);
  border-top-color: var(--color-depth-rule);
  padding-top: var(--space-depth-3);
}
.controls .icon-btn {
  width: 100%;
  min-width: 44px;
  height: auto;
  min-height: 56px;
  padding: var(--space-depth-1) 0;
  gap: var(--space-depth-1);
  background: var(--color-depth-paper);
  border-color: var(--color-depth-rule);
  border-radius: var(--radius-depth-small);
  color: var(--color-depth-ink);
  transition: background-color var(--dur-depth-press) var(--ease-depth-press);
}
.controls .icon-btn svg { width: 24px; height: 24px; }
.depth-control-label { font: 600 .625rem/1 var(--font-depth-body); white-space: nowrap; }
.controls .icon-btn:active { background: var(--paper-3); }
.controls .icon-btn[aria-pressed='true'][data-on='true'],
.controls .icon-btn[aria-pressed='true']:not([data-on]) { border-color: var(--color-depth-action); background: var(--paper); }
.controls .icon-btn:disabled { opacity: .55; cursor: not-allowed; background: var(--paper); }
.controls .icon-btn[aria-busy='true'] { border-style: dashed; }
.controls .icon-btn[aria-invalid='true'] { border-color: var(--color-depth-action); }
.controls .icon-btn[data-state='success'] { border-color: var(--color-depth-mint-edge); }
:where(.icon-btn, .btn, .node, .guide-nav a, .guide-sec .up, .move-lens summary, .lens-actions button):focus-visible {
  outline: 3px solid var(--color-depth-ink);
  outline-offset: 3px;
}
.btn { white-space: nowrap; background: var(--color-depth-action); border-color: var(--color-depth-action); }
.btn.big { background: var(--color-depth-action); border-color: var(--color-depth-action); color: var(--color-depth-action-ink); }
.btn.ghost, .btn.daily { background: var(--color-depth-paper); color: var(--color-depth-ink); }
.btn:active, .btn.big:active { background: var(--color-depth-action-hover); }
.btn.ghost:active, .btn.daily:active { background: var(--paper); }
.coach { background: var(--color-depth-action); color: var(--color-depth-action-ink); }
.guide-nav a, .guide-sec .up { min-height: 44px; display: inline-flex; align-items: center; white-space: nowrap; }
.guide-sec h3 { display: flex; align-items: center; justify-content: space-between; gap: var(--space-depth-2); }
.move-lens { border-color: var(--color-depth-rule); margin-top: var(--space-depth-1); }
.move-lens summary { padding: var(--space-depth-3); font-size: .9375rem; }
.move-lens summary span { display: none; }
.lens-actions { align-items: center; }
.lens-actions button { white-space: nowrap; border-color: var(--color-depth-action); }
.lens-note, .lens-legend { color: var(--color-depth-muted); }

@media (hover: hover) and (pointer: fine) {
  .controls .icon-btn:hover { background: var(--paper); }
  .btn:hover, .btn.big:hover { background: var(--color-depth-action-hover); }
  .btn.ghost:hover, .btn.daily:hover { background: var(--paper); }
  .lens-actions button:hover:not(:disabled) { background: var(--paper-3); }
}
@media (min-width: 36rem) {
  .play { padding-inline: var(--space-depth-3); }
  .hud-top { grid-template-columns: var(--tap) minmax(0, 1fr) auto; align-items: center; }
  .plates { grid-column: auto; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .plate.score { min-width: 92px; }
  .plate.moves { min-width: 64px; }
  .plate b { font-size: 1.375rem; }
  .controls .icon-btn { min-height: 60px; }
  .depth-control-label { font-size: .6875rem; }
}
@media (max-width: 22rem) {
  .controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .controls .icon-btn { display: flex; align-items: center; justify-content: center; gap: var(--space-depth-2); min-height: 44px; }
  .depth-control-label { font-size: .6875rem; }
}
@media (max-height: 40rem) {
  .bar-legend { display: flex; }
  .hud-title small { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .controls .icon-btn { transition: none; }
  .tile.hinted .sweet { animation: none; }
  .tile.hinted { outline: 2px dashed var(--color-depth-ink); outline-offset: -3px; }
  .tile[data-kind='frog'].ready::after { animation: none; }
}
