* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--np-cream); color: var(--np-ink); font: 15px/1.35 var(--np-font-body); }
button, select { color: inherit; font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .46; cursor: default; }
button:focus-visible, select:focus-visible, canvas:focus-visible {
  outline: 3px solid var(--np-fit); outline-offset: 2px;
}
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }
.game {
  display: grid; grid-template-rows: auto auto minmax(186px, 1fr) auto auto;
  width: min(100%, 850px); min-height: 540px; height: 100vh; height: 100dvh; margin: auto;
  background: var(--np-paper); box-shadow: var(--np-shadow-card);
}
.head, .host { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.head { padding: 14px 16px 9px; }
.head h1 { margin: 0; font: 700 clamp(26px, 6vw, 39px)/1.06 var(--np-font-heading); letter-spacing: -.03em; }
.series { margin: 0 0 4px; font-size: 12px; font-weight: 750; color: var(--np-muted); }
.host {
  justify-content: flex-start; margin: 0 16px 10px; min-height: 46px; padding: 3px 10px 3px 5px;
  background: var(--np-cream); border-radius: var(--np-radius-sm);
}
.host img { flex: none; object-fit: contain; width: 42px; height: 42px; }
.host p { margin: 0; font-size: 13px; }
.board-wrap { position: relative; min-height: 0; background: var(--np-tray); overflow: hidden; }
#board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#board:focus-visible { outline-offset: -3px; }
.feedback {
  position: absolute; z-index: 1; inset: auto 8px 8px; margin: 0 auto; width: max-content; max-width: calc(100% - 16px);
  padding: 4px 10px; background: var(--np-paper-wash); border: 1px solid var(--np-line);
  border-radius: var(--np-radius-round); font-size: 12px; font-weight: 750; text-align: center;
  pointer-events: none;
}
.feedback[data-kind="fit"] { color: var(--np-fit); background: var(--np-fit-fill); border-color: currentColor; }
.feedback[data-kind="blocked"] { color: var(--np-blocked); background: var(--np-blocked-fill); border-color: currentColor; }
.feedback[data-kind="rule"] { color: var(--np-rule); background: var(--np-rule-fill); border-color: currentColor; }
.packing {
  position: relative; border-radius: var(--np-radius-md) var(--np-radius-md) 0 0;
  border-top: 2px solid var(--np-line); background: var(--np-paper); box-shadow: var(--np-shadow-sheet);
  padding: 7px 12px 8px; z-index: 2;
}
.toolbar { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; }
.toolbar button, .levels button, .levels select, .icon-only, .primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 40px;
  border-radius: var(--np-radius-sm); border: 1px solid var(--np-line); background: var(--np-paper);
  box-shadow: var(--np-shadow-button); font-size: 12px; font-weight: 750; padding: 4px 6px;
}
.toolbar img, .levels img { width: 24px; height: 24px; }
.icon-only { width: 44px; min-height: 44px; flex: none; }
.tray-head { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 0 4px; }
.tray-head h2 { font: 700 17px/1.1 var(--np-font-heading); margin: 0; }
.tray-head span { color: var(--np-muted); font-size: 12px; }
.tray-status { display: flex; align-items: center; gap: 7px; }
.tray-status button { padding: 1px 6px; border: 1px solid var(--np-line); border-radius: var(--np-radius-xs);
  background: var(--np-paper); color: var(--np-muted); font-size: 11px; font-weight: 750; }
.tray {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(53px,1fr)); gap: 4px;
  list-style: none; margin: 0; padding: 0;
}
.tray li { min-width: 0; }
.tray button {
  display: grid; grid-template-rows: 31px auto; justify-items: center; align-content: center;
  width: 100%; min-height: 51px; padding: 1px 2px 3px; touch-action: none; user-select: none;
  border: 1px solid var(--np-line); border-radius: var(--np-radius-xs);
  background: var(--np-cell); box-shadow: var(--np-shadow-inset);
  font-size: 10px; font-weight: 750; line-height: 1.08; overflow-wrap: anywhere;
}
.tray button[aria-pressed="true"] { border: 2px solid var(--np-fit); background: var(--np-fit-fill); }
.tray button img { width: 48px; height: 30px; object-fit: contain; pointer-events: none; }
.tray .food-glyph { font-size: 22px; align-self: center; }
.levels {
  display: grid; grid-template-columns: 42px minmax(0,1fr) 42px auto; gap: 5px;
  padding: 5px 12px 11px; border-top: 1px solid var(--np-line);
}
.levels select { width: 100%; text-overflow: ellipsis; }
.levels button, .levels select { min-height: 36px; }
.completion { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; background: var(--np-scrim); padding: 9px; }
.completion > div {
  text-align: center; background: var(--np-paper); width: min(95%, 270px); border: 1px solid var(--np-line);
  border-radius: var(--np-radius-lg); padding: 11px 15px 15px; box-shadow: var(--np-shadow-card);
}
.completion img { display: block; margin: 0 auto 2px; }
.completion h2 { margin: 0; font: 700 28px/1.1 var(--np-font-heading); }
.completion p { margin: 5px 0 10px; font-size: 13px; }
.primary { width: 100%; background: var(--np-gold); border-color: var(--np-gold-rim); box-shadow: var(--np-shadow-button-gold); }
@media (max-height: 690px) {
  .head { padding-top: 8px; }
  .host { margin-bottom: 6px; }
  .host img { width: 35px; height: 35px; }
  .tray button { grid-template-rows: 27px auto; min-height: 45px; }
  .tray button img { height: 26px; }
}
@media (min-width: 680px) {
  .game { grid-template-rows: auto auto minmax(250px, 1fr) auto auto; }
  .head, .toolbar { gap: 10px; }
  .tray { grid-template-columns: repeat(auto-fit, minmax(60px,1fr)); }
  .tray button { min-height: 58px; }
}
