/* physics sim · reptides liquid glass shell for the powder toy engine.
   the tokens are the app's --lg-* set (dark, light, carbon) so the page drops
   into the app without a restyle. the particles keep the engine's own look;
   the branding lives in the chrome only. */
html[data-design="lg"] {
  color-scheme: dark;
  --lg-bg-base: #131019;
  --lg-bg-scene: radial-gradient(120% 80% at 50% 0%, #1a1426 0%, #141020 46%, #0e1016 100%);
  --lg-ink: #efeaf6;
  --lg-ink-2: #c5bdd4;
  --lg-ink-3: #9b91ad;
  --lg-glass-hi: rgba(36, 31, 48, 0.6);
  --lg-glass-lo: rgba(22, 18, 32, 0.32);
  --lg-chip-hi: rgba(46, 40, 62, 0.65);
  --lg-chip-lo: rgba(26, 22, 38, 0.35);
  --lg-plate-hi: rgba(60, 55, 78, 0.82);
  --lg-plate-lo: rgba(43, 39, 58, 0.66);
  --lg-edge: rgba(255, 255, 255, 0.14);
  --lg-rim-hi: rgba(255, 255, 255, 0.16);
  --lg-underside: rgba(0, 0, 0, 0.32);
  --lg-shadow: rgba(0, 0, 0, 0.45);
  --lg-accent: #ae90ef;
  --lg-on-accent: #191124;
  --lg-danger: #ff7b7b;
  --lg-fDisplay: 'Poppins', system-ui, -apple-system, sans-serif;
  --lg-fBody: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --lg-fMono: 'Space Mono', ui-monospace, SFMono-Regular, monospace;
  --lg-r-plate: 22px;
  --lg-r-control: 14px;
  --lg-r-chip: 999px;
  --stage-frame: #26222f;
}
html[data-design="lg"][data-theme="light"] {
  color-scheme: light;
  --lg-bg-base: #f5efe9;
  --lg-bg-scene: radial-gradient(120% 80% at 50% 0%, #fdf3ec 0%, #f4eefa 46%, #edf4ef 100%);
  --lg-ink: #241c30;
  --lg-ink-2: #4c4358;
  --lg-ink-3: #6f6580;
  --lg-glass-hi: rgba(255, 255, 255, 0.6);
  --lg-glass-lo: rgba(255, 255, 255, 0.28);
  --lg-chip-hi: rgba(255, 255, 255, 0.7);
  --lg-chip-lo: rgba(255, 255, 255, 0.3);
  --lg-plate-hi: rgba(255, 253, 251, 0.8);
  --lg-plate-lo: rgba(249, 244, 240, 0.58);
  --lg-edge: rgba(255, 255, 255, 0.55);
  --lg-rim-hi: rgba(255, 255, 255, 0.9);
  --lg-underside: rgba(60, 40, 90, 0.12);
  --lg-shadow: rgba(60, 40, 90, 0.22);
  --lg-accent: #7c4fe0;
  --lg-on-accent: #ffffff;
  --lg-danger: #c43d3d;
  --stage-frame: #d9d0e6;
}
html[data-design="lg"][data-theme="carbon"] {
  --lg-bg-base: #07060b;
  --lg-bg-scene: repeating-linear-gradient(135deg, #0b0b0f 0 2px, #0e0e13 2px 4px);
  --lg-glass-hi: rgba(30, 30, 36, 0.7);
  --lg-glass-lo: rgba(14, 14, 18, 0.4);
  --lg-chip-hi: rgba(40, 40, 46, 0.7);
  --lg-chip-lo: rgba(20, 20, 24, 0.4);
  --lg-plate-hi: rgba(40, 36, 54, 0.86);
  --lg-plate-lo: rgba(29, 26, 40, 0.7);
  --stage-frame: #1c1c22;
}

* { box-sizing: border-box; }
html, body { height: 100%; max-width: 100%; overflow: hidden; }
body {
  margin: 0;
  background: var(--lg-bg-scene) fixed, var(--lg-bg-base);
  color: var(--lg-ink);
  font: 500 14px/1.35 var(--lg-fBody);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#physics-sim {
  height: 100dvh;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
}

/* the sandbox */
#stage {
  position: relative;
  min-height: 0;
  border: 1px solid var(--stage-frame);
  border-radius: var(--lg-r-plate);
  background: #000;
  overflow: hidden;
  touch-action: none;
  cursor: crosshair;
  isolation: isolate;
  box-shadow: inset 0 1px 0 var(--lg-rim-hi), 0 18px 40px -24px var(--lg-shadow);
}
#world-viewport { position: absolute; left: 0; top: 0; transform-origin: top left; overflow: hidden; pointer-events: none; }
#canvas { position: absolute; left: 0; top: 0; image-rendering: pixelated; pointer-events: none; }
#loading { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--lg-ink-2); background: #0a0b11; font: 600 13px/1.4 var(--lg-fMono); letter-spacing: 0.04em; }
#loading[hidden] { display: none; }
/* the aim line for guns: a sibling of the world viewport, not a child, so the
   camera transform never scales the stroke. under the hud, over the canvas. */
#aim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  color: var(--lg-ink, #fff);
}

#hud {
  position: absolute; left: 50%; top: 8px; z-index: 2; transform: translateX(-50%);
  display: flex; gap: 6px; align-items: center;
  padding: 4px 9px;
  border-radius: var(--lg-r-chip);
  border: 1px solid var(--lg-edge);
  background: linear-gradient(160deg, var(--lg-chip-hi), var(--lg-chip-lo));
  color: var(--lg-ink-2);
  font: 700 9px/1 var(--lg-fMono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
}
#hud-material { color: var(--lg-ink); }
#hud-count:empty { display: none; }
#hud-count::before { content: '·'; margin-right: 6px; color: var(--lg-ink-3); }

/* the dock */
.dock {
  display: grid;
  gap: 8px;
  padding: 10px 10px 8px;
  border-radius: var(--lg-r-plate);
  border: 1px solid var(--lg-edge);
  background: linear-gradient(165deg, var(--lg-plate-hi), var(--lg-plate-lo));
  box-shadow: inset 0 1px 0 var(--lg-rim-hi), inset 0 -1px 0 var(--lg-underside), 0 14px 30px -20px var(--lg-shadow);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}
.dock-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.brand { min-width: 0; line-height: 1.05; }
.brand b { display: block; font: 800 18px/1 var(--lg-fDisplay); letter-spacing: -0.02em; color: var(--lg-ink); }
.brand b i { font-style: normal; color: var(--lg-accent); }
.brand small { display: block; margin-top: 3px; font: 700 9px/1 var(--lg-fMono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--lg-ink-3); white-space: nowrap; }
.dock-actions { display: flex; gap: 6px; flex: none; }

button, input, select { font: inherit; color: var(--lg-ink); }
.chip, .seg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; min-width: 40px; padding: 0 14px;
  border: 1px solid var(--lg-edge);
  border-radius: var(--lg-r-chip);
  background: linear-gradient(160deg, var(--lg-chip-hi), var(--lg-chip-lo));
  box-shadow: inset 0 1px 0 var(--lg-rim-hi);
  color: var(--lg-ink);
  font: 700 12px/1 var(--lg-fMono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  transition: transform 110ms ease, background-color 160ms ease, border-color 160ms ease;
}
.chip svg { width: 16px; height: 16px; fill: currentColor; }
.chip.is-icon { padding: 0; width: 40px; }
.chip.is-primary { background: var(--lg-accent); border-color: var(--lg-accent); color: var(--lg-on-accent); }
.chip.is-danger { color: var(--lg-danger); }
.chip:active:not(:disabled), .seg-btn:active:not(:disabled) { transform: scale(0.97); }
.chip[aria-pressed="true"], .seg-btn[aria-pressed="true"] { border-color: var(--lg-accent); box-shadow: inset 0 0 0 1px var(--lg-accent), inset 0 1px 0 var(--lg-rim-hi); color: var(--lg-accent); }
.chip.is-primary[aria-pressed="true"] { color: var(--lg-on-accent); }
button:disabled { opacity: 0.4; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--lg-accent); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .chip:hover:not(:disabled), .seg-btn:hover:not(:disabled) { border-color: color-mix(in srgb, var(--lg-accent) 55%, var(--lg-edge)); }
}
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--lg-r-chip); border: 1px solid var(--lg-edge); background: linear-gradient(160deg, var(--lg-glass-lo), var(--lg-glass-hi)); }
.seg-btn { min-height: 32px; border: 0; background: transparent; box-shadow: none; padding: 0 12px; color: var(--lg-ink-2); }
.seg-btn[aria-pressed="true"] { background: linear-gradient(160deg, var(--lg-chip-hi), var(--lg-chip-lo)); }

.find { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 8px; align-items: center; }
.rail { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.rail::-webkit-scrollbar { display: none; }
.rail .chip { min-height: 34px; padding: 0 12px; font-size: 11px; white-space: nowrap; flex: none; }
.search { display: block; }
.search input {
  width: 100%; min-height: 40px; padding: 0 14px;
  border: 1px solid var(--lg-edge); border-radius: var(--lg-r-chip);
  background: linear-gradient(160deg, var(--lg-glass-lo), var(--lg-glass-hi));
  box-shadow: inset 0 1px 2px var(--lg-underside);
  font: 500 14px/1 var(--lg-fBody);
}
.search input::placeholder { color: var(--lg-ink-3); }

.materials {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, 56px);
  grid-auto-columns: 128px;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
  margin: -2px;
  scroll-snap-type: x proximity;
}
.materials::-webkit-scrollbar { display: none; }
.materials .none-found { grid-row: 1 / -1; align-self: center; color: var(--lg-ink-3); font: 500 13px/1.3 var(--lg-fBody); padding: 0 6px; }
.mat {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: 8px;
  min-height: 56px; padding: 6px 8px 6px 6px;
  border: 1px solid var(--lg-edge);
  border-radius: var(--lg-r-control);
  background: linear-gradient(160deg, var(--lg-chip-hi), var(--lg-chip-lo));
  box-shadow: inset 0 1px 0 var(--lg-rim-hi);
  color: var(--lg-ink);
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
  transition: border-color 160ms ease, transform 110ms ease;
}
.mat:active { transform: scale(0.97); }
.mat[aria-pressed="true"] { border-color: var(--lg-accent); box-shadow: inset 0 0 0 1px var(--lg-accent), inset 0 1px 0 var(--lg-rim-hi); }
.mat .swatch { width: 40px; height: 40px; border-radius: 11px; background: var(--swatch); box-shadow: inset 0 1px 0 #ffffff33, inset 0 -6px 10px -6px #00000080, 0 0 0 1px #00000040; position: relative; overflow: hidden; }
.mat .name { display: block; font: 600 13px/1.15 var(--lg-fBody); letter-spacing: -0.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mat .kind { display: block; margin-top: 3px; font: 700 9px/1 var(--lg-fMono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--lg-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tools { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tools::-webkit-scrollbar { display: none; }
.tools .chip { flex: none; padding: 0 12px; }
.tools .seg { flex: none; }
.tools #clear { margin-left: auto; }
.selected { margin: 0; display: flex; gap: 8px; align-items: baseline; min-width: 0; font: 500 12px/1.3 var(--lg-fBody); color: var(--lg-ink-2); }
.selected strong { flex: none; color: var(--lg-ink); font-weight: 700; }
.selected span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* settings sheet */
.sheet { position: fixed; inset: 0; z-index: 10; display: grid; place-items: end center; padding: 8px; background: color-mix(in srgb, var(--lg-bg-base) 55%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet[hidden] { display: none; }
.sheet-card {
  width: min(520px, 100%); display: grid; gap: 10px; padding: 14px;
  border-radius: var(--lg-r-plate); border: 1px solid var(--lg-edge);
  background: linear-gradient(165deg, var(--lg-plate-hi), var(--lg-plate-lo));
  box-shadow: inset 0 1px 0 var(--lg-rim-hi), 0 24px 50px -24px var(--lg-shadow);
  padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head b { font: 800 16px/1 var(--lg-fDisplay); letter-spacing: -0.01em; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 4px 0; border-top: 1px solid var(--lg-edge); font: 600 13px/1 var(--lg-fBody); }
.row-value { display: flex; align-items: center; gap: 10px; }
.row output { font: 700 12px/1 var(--lg-fMono); color: var(--lg-accent); min-width: 44px; text-align: right; }
input[type="range"] { width: 150px; accent-color: var(--lg-accent); }
.fine { margin: 0; font: 500 12px/1.45 var(--lg-fBody); color: var(--lg-ink-3); }
.fine a { color: var(--lg-ink-2); }

/* wide and landscape: the sandbox takes the height, the dock stays a strip at the bottom */
@media (min-width: 900px) and (orientation: landscape) {
  #physics-sim { padding: 12px 14px 10px; gap: 10px; }
  .dock { grid-template-columns: minmax(300px, max-content) minmax(0, 1fr); grid-template-areas: "head find" "tools materials" "selected materials"; column-gap: 14px; row-gap: 8px; align-items: center; }
  .dock-head { grid-area: head; }
  .find { grid-area: find; grid-template-columns: minmax(0, 1fr) 220px; }
  .materials { grid-area: materials; grid-template-rows: repeat(2, 56px); }
  .tools { grid-area: tools; flex-wrap: wrap; }
  .tools #clear { margin-left: 0; }
  .selected { grid-area: selected; }
  #hud { font-size: 9.5px; }
}
@media (max-width: 420px) {
  .find { grid-template-columns: minmax(0, 1fr); }
  .search { display: none; }
  .materials { grid-template-rows: repeat(2, 52px); grid-auto-columns: 118px; }
  .mat { min-height: 52px; }
}
@media (prefers-reduced-motion: reduce) { .chip, .seg-btn, .mat { transition: none; } }

/* short landscape (a phone on its side): the sandbox keeps the height, the
   dock shrinks to two thin rows, no subtitle, one row of materials */
@media (max-height: 520px) and (orientation: landscape) {
  #physics-sim { padding: 6px 8px; gap: 6px; }
  .dock { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "head find actions" "tools materials materials"; column-gap: 8px; row-gap: 6px; padding: 6px 8px; align-items: center; }
  .dock-head { display: contents; }
  .brand { grid-area: head; }
  .brand b { font-size: 15px; }
  .brand small { display: none; }
  .dock-actions { grid-area: actions; }
  .find { grid-area: find; grid-template-columns: minmax(0, 1fr) 140px; }
  .rail .chip { min-height: 30px; font-size: 10px; padding: 0 10px; }
  .materials { grid-area: materials; grid-template-rows: 46px; grid-auto-columns: 118px; }
  .mat { min-height: 46px; padding: 4px 6px 4px 5px; grid-template-columns: 32px minmax(0, 1fr); }
  .mat .swatch { width: 32px; height: 32px; border-radius: 9px; }
  .mat .kind { display: none; }
  .tools { grid-area: tools; flex-wrap: wrap; max-width: 300px; }
  .tools .chip, .seg-btn { min-height: 32px; font-size: 10px; padding: 0 10px; }
  .tools #clear { margin-left: 0; }
  .selected { display: none; }
  .chip.is-primary { min-height: 34px; }
}

/* a phone held upright: the world is the tall 384×612 build, so the sandbox
   gets most of the screen and the dock folds to one row of materials */
@media (orientation: portrait) and (max-width: 520px) {
  #physics-sim { gap: 6px; padding: max(6px, env(safe-area-inset-top)) 6px max(6px, env(safe-area-inset-bottom)); }
  .dock { padding: 8px 8px 6px; gap: 6px; }
  .brand b { font-size: 16px; }
  .brand small { display: none; }
  .materials { grid-template-rows: 54px; grid-auto-columns: 124px; }
  .mat { min-height: 54px; }
  .selected { display: none; }
  .chip, .seg-btn { min-height: 36px; }
  .rail .chip { min-height: 32px; }
}


/* polish: a glassier dock, cards that glow with their material, chips with
   a soft accent halo when pressed, and a wordmark with some depth */
.dock { position: relative; }
.dock::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0) 38%); }
.brand b { background: linear-gradient(180deg, var(--lg-ink) 0%, color-mix(in srgb, var(--lg-ink) 70%, var(--lg-accent)) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand b i { background: linear-gradient(180deg, var(--lg-accent), color-mix(in srgb, var(--lg-accent) 60%, #fff)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chip, .seg-btn { transition: transform 110ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease; }
.chip[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--lg-accent), inset 0 1px 0 var(--lg-rim-hi), 0 0 0 3px color-mix(in srgb, var(--lg-accent) 22%, transparent), 0 6px 18px -10px var(--lg-accent); }
.chip.is-primary { background: linear-gradient(165deg, color-mix(in srgb, var(--lg-accent) 88%, #fff), var(--lg-accent)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 8px 20px -10px var(--lg-accent); }
.mat { position: relative; overflow: hidden; background: linear-gradient(160deg, var(--lg-chip-hi), var(--lg-chip-lo)); transition: border-color 160ms ease, transform 110ms ease, box-shadow 160ms ease; }
.mat::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 12% 0%, color-mix(in srgb, var(--swatch, var(--lg-accent)) 18%, transparent), transparent 55%); opacity: 0.9; }
.mat .swatch { position: relative; z-index: 1; border-radius: 11px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.28), inset 0 -8px 12px -8px rgba(0,0,0,0.55), 0 4px 10px -6px color-mix(in srgb, var(--swatch, #000) 70%, transparent), 0 0 0 1px rgba(255,255,255,0.08); }
/* the gloss is ::before; ::after is the material glyph (material-icons.css) */
.mat .swatch::before { content: ''; position: absolute; left: 3px; top: 3px; width: 40%; height: 28%; border-radius: 6px 6px 8px 8px; background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0)); pointer-events: none; }
.mat .name, .mat .kind { position: relative; z-index: 1; }
.mat[aria-pressed="true"] { border-color: color-mix(in srgb, var(--swatch, var(--lg-accent)) 70%, var(--lg-accent)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--swatch, var(--lg-accent)) 60%, var(--lg-accent)), inset 0 1px 0 var(--lg-rim-hi), 0 0 0 3px color-mix(in srgb, var(--lg-accent) 18%, transparent), 0 10px 24px -14px color-mix(in srgb, var(--swatch, var(--lg-accent)) 80%, transparent); transform: translateY(-1px); }
@media (hover: hover) and (pointer: fine) {
  .mat:hover:not([aria-pressed="true"]) { border-color: color-mix(in srgb, var(--swatch, var(--lg-accent)) 45%, var(--lg-edge)); transform: translateY(-1px); box-shadow: inset 0 1px 0 var(--lg-rim-hi), 0 10px 22px -16px var(--lg-shadow); }
}
.rail .chip[aria-pressed="true"] { background: linear-gradient(160deg, color-mix(in srgb, var(--lg-accent) 26%, var(--lg-chip-hi)), var(--lg-chip-lo)); }
.search input { transition: border-color 160ms ease, box-shadow 160ms ease; }
.search input:focus { border-color: color-mix(in srgb, var(--lg-accent) 60%, var(--lg-edge)); box-shadow: inset 0 1px 2px var(--lg-underside), 0 0 0 3px color-mix(in srgb, var(--lg-accent) 18%, transparent); outline: none; }
#hud { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 6px 16px -10px var(--lg-shadow); }
#stage { box-shadow: inset 0 1px 0 var(--lg-rim-hi), inset 0 0 0 1px rgba(255,255,255,0.03), 0 24px 50px -28px var(--lg-shadow); }
.selected strong { color: var(--lg-accent); }
/* mid widths (a desktop pane, a tablet): the tools wrap instead of clipping */
@media (min-width: 600px) and (max-width: 899px) {
  .tools { flex-wrap: wrap; overflow: visible; }
  .tools #clear { margin-left: 0; }
}

/* embedded in the reptides app: the door back is the first chip of the dock
   head, in the arcade's deep blue, the same glass as every other chip */
.chip.is-exit {
  --exit: #2f66ff;
  flex: none;
  padding: 0 14px 0 9px;
  gap: 5px;
  color: #eef2ff;
  border-color: color-mix(in srgb, var(--exit) 55%, var(--lg-edge));
  background: linear-gradient(165deg, color-mix(in srgb, var(--exit) 78%, #fff 0%), color-mix(in srgb, var(--exit) 70%, #0b1030));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 8px 18px -10px var(--exit);
}
.chip.is-exit svg { width: 14px; height: 14px; }
.chip.is-exit[hidden] { display: none; }
html[data-theme="light"] .chip.is-exit { color: #fff; }
@media (hover: hover) and (pointer: fine) {
  .chip.is-exit:hover { border-color: color-mix(in srgb, var(--exit) 80%, #fff); }
}
@media (orientation: portrait) and (max-width: 520px) {
  .chip.is-exit { padding: 0 11px 0 8px; font-size: 11px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .chip.is-exit { grid-area: head; justify-self: start; }
}

/* the selected material's note reads on every screen: two lines on a phone,
   one on a short landscape. what it is, what it does. */
@media (orientation: portrait) and (max-width: 520px) {
  .selected { display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 11.5px; line-height: 1.3; }
  .selected span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .selected { display: flex; grid-area: tools; align-self: end; font-size: 10.5px; }
}

/* the glyph fills its square; the square is the material's colour */
.mat .swatch[data-icon]::after { inset: 1px; opacity: 0.94; }
.mat .swatch[data-icon] { background-image: linear-gradient(155deg, #ffffff2a, #00000038); }

/* the selection toast at the top of the sandbox */
#toast {
  position: absolute; left: 50%; top: 12px; z-index: 3;
  transform: translate(-50%, -8px);
  display: grid; gap: 2px; justify-items: start;
  max-width: min(86%, 380px); padding: 7px 12px 8px;
  border-radius: 16px; border: 1px solid var(--lg-edge);
  background: linear-gradient(165deg, var(--lg-plate-hi), var(--lg-plate-lo));
  box-shadow: inset 0 1px 0 var(--lg-rim-hi), 0 14px 30px -18px var(--lg-shadow);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  color: var(--lg-ink-2); font: 500 11px/1.35 var(--lg-fBody);
  opacity: 0; pointer-events: none;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
#toast.in { opacity: 1; transform: translate(-50%, 0); }
#toast[hidden] { display: none; }
#toast b { font: 800 12px/1.1 var(--lg-fDisplay); letter-spacing: -0.01em; text-shadow: 0 1px 0 #0006; }
#toast b::after { content: ' selected'; font: 700 8.5px/1 var(--lg-fMono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--lg-ink-3); margin-left: 6px; vertical-align: 1px; }
#hud + #toast { top: 36px; }

/* the description lives in the toast now; a note line in the dock changed the
   dock's height with every pick and resized the sandbox with it */
.selected { display: none !important; }
