/* v12.22 toolbox (Dad t2294); v12.23 closed-state clock back to centre (Dad t2309).
   WHY this file is separate: radio.css is already merged from two other builds (library now-playing and city cards), so the toolbox lives in its own file and the merge stays easy to read.
   Contents: (1) closed = v12.20 clock position (nothing moves), (2) the compact clock + forecast up top while the toolbox is open,
   (3) the tool window and its tools, (4) phone sheet. Everything is hidden in the Labyrinth, like the dock clock. */

/* ---------- 0. the button ---------- */
html[data-lab-chrome="maze"] .toolbox-btn,
html[data-lab-chrome="gate"] .toolbox-btn,
html[data-lab-chrome="maze"] .tool-window,
html[data-lab-chrome="gate"] .tool-window { display: none !important; }
.toolbox-btn[aria-expanded="true"] { background: #f0c05a; border-color: #e8b24a; color: #1a1204; }

/* ---------- 1. toolbox closed: NOTHING moves ----------
   WHY (Dad t2309): v12.22 raised the clock permanently and it landed on top of the 279.3 logo row. With the toolbox closed
   the clock and the 5-day forecast now sit exactly where they did in v12.20 (centred, normal and fullscreen). They only go up
   while the window is open (section 2); toolbox.js glides them there and back (FLIP, translate only). */

/* ---------- 2. toolbox open: clock + 5-day go up into the top row, side by side ---------- */
html:not(.is-phone):not([data-dock-clock="on"]):not([data-lab-chrome="maze"]):not([data-lab-chrome="gate"]) .dash-ui.toolbox-open[data-layout] .clock-block {
  position: absolute;
  left: 50%;
  top: 0;
  right: auto;
  bottom: auto;
  transform: translate(-50%, calc(-1 * var(--clock-raise, 0px)));
  width: max-content;
  max-width: calc(100% - 24rem);
  min-height: var(--top-row-h, 6rem);
  margin: 0;
  padding: 0;
  flex: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
}
html:not(.is-phone) .dash-ui.toolbox-open[data-layout] .clock-block .dash-hero { flex: 0 0 auto; margin: 0; }
html:not(.is-phone) .dash-ui.toolbox-open[data-layout] .hero-clock { font-size: clamp(2.4rem, 4.2vw, 3.7rem); }
html:not(.is-phone) .dash-box:fullscreen:not(.is-staged) .dash-ui.toolbox-open[data-layout] .hero-clock,
html:not(.is-phone) .dash-box:-webkit-full-screen:not(.is-staged) .dash-ui.toolbox-open[data-layout] .hero-clock,
html:not(.is-phone) .dash-box.is-fullscreen:not(.is-staged) .dash-ui.toolbox-open[data-layout] .hero-clock { font-size: clamp(3rem, 5vw, 5rem); }
html:not(.is-phone) .dash-ui.toolbox-open[data-layout] .analog-clock { width: clamp(3.6rem, 6vw, 5.2rem); height: clamp(3.6rem, 6vw, 5.2rem); margin: 0 auto; }
html:not(.is-phone) .dash-ui.toolbox-open[data-layout] .radio-clock { margin-top: 0.1rem; font-size: 0.7rem; }
html:not(.is-phone) .dash-ui.toolbox-open[data-layout] .clock-block .wx-strip {
  margin: 0;
  flex: 0 0 auto;
  width: max-content !important;
  font-size: 0.8rem;
}
html:not(.is-phone) .dash-ui.toolbox-open[data-layout] .wx-strip-city { display: none; }
html:not(.is-phone) .dash-ui.toolbox-open.tb-tight[data-layout] .clock-block .wx-strip { display: none; }
/* the side panels sit behind the window while it is open */
.dash-ui.toolbox-open .dash-mid,
.dash-ui.toolbox-open .restore-tab { visibility: hidden; pointer-events: none; }

/* ---------- 3. the window ---------- */
.tool-window {
  --tw-ink: #10142b;
  --tw-line: #7fe9ff;
  --tw-gold: #f0c05a;
  position: absolute;
  z-index: 8;
  left: 0;
  right: 0;
  top: 0;
  bottom: calc(-1 * var(--tw-extra, 0px));
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 0.4rem 0.55rem 0.5rem;
  border-radius: 16px;
  border: 2px solid var(--tw-line);
  background: rgba(10, 14, 34, 0.92);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #eef3ff;
  pointer-events: auto;
  font-size: 0.86rem;
}
.tool-window[hidden] { display: none; }
.tw-head { display: flex; align-items: center; gap: 0.6rem; flex: 0 0 auto; padding-bottom: 0.35rem; border-bottom: 2px dashed rgba(127, 233, 255, 0.35); }
.tw-title {
  margin: 0;
  font-family: var(--display, inherit);
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tw-gold);
  text-shadow: 2px 2px 0 #000;
  flex: 0 0 auto;
}
.tw-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; flex: 1 1 auto; min-width: 0; }
.tw-tab {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  border: 2px solid var(--tw-ink);
  outline: 1px solid rgba(255, 255, 255, 0.25);
  background: #232b57;
  color: #eef3ff;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}
.tw-tab:hover { background: #2f3a74; }
.tw-tab.is-on { background: var(--tw-gold); color: #1a1204; }
.tw-close { flex: 0 0 auto; width: 2rem; height: 2rem; }
.tw-pane { flex: 1 1 0; min-height: 0; container-type: size; container-name: twpane; overflow: auto; padding-top: 0.4rem; }
.tw-pane[hidden] { display: none; }
.tw-sub { margin: 0 0 0.3rem; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: #9fb3d9; }
.tw-hint { margin: 0.4rem 0 0; font-size: 0.72rem; line-height: 1.35; color: #b9c6e4; }
.tw-lab { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: #9fb3d9; }
.tw-input {
  font: inherit;
  color: #fff;
  background: #0b1030;
  border: 2px solid #3c4a8a;
  border-radius: 8px;
  padding: 0.28rem 0.5rem;
  min-width: 0;
}
.tw-input:focus-visible, .tw-tab:focus-visible, .ck:focus-visible, .pt-cell:focus-visible, .pt-chip:focus-visible { outline: 2px solid var(--tw-gold); outline-offset: 1px; }

/* calculator */
.calc-wrap { height: 100%; display: flex; gap: 1.2rem; justify-content: center; align-items: stretch; }
.calc { width: min(21rem, 62%); display: flex; flex-direction: column; gap: 0.4rem; min-height: 0; }
.calc-screen {
  flex: 0 0 auto;
  text-align: right;
  background: #0b1030;
  border: 2px solid #3c4a8a;
  border-radius: 10px;
  padding: 0.3rem 0.7rem 0.35rem;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.4);
}
.calc-expr { min-height: 1em; font-size: 0.75rem; color: #9fb3d9; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.calc-out { font-size: clamp(1.4rem, 3.4cqh, 2rem); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--clock, #ff9a32); text-shadow: 2px 2px 0 #000; overflow: hidden; white-space: nowrap; line-height: 1.15; }
.calc-out.is-err { font-size: 1rem; color: #ff8f8f; }
.calc-pads { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.calc[data-mode="sci"] .calc-pads { flex-direction: row; }
.calc-sci { display: none; }
.calc[data-mode="sci"] { width: auto; flex: 1 1 auto; max-width: 44rem; }
.calc[data-mode="sci"] .calc-sci { display: grid; flex: 1.28 1 0; min-width: 0; min-height: 0; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, minmax(1.9rem, 1fr)); gap: 0.3rem; }
.calc[data-mode="sci"] .calc-keys { flex: 1 1 0; min-width: 0; }
.calc[data-mode="sci"] .calc-expr { text-overflow: clip; font-size: 0.82rem; }
.calc-keys { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(5, minmax(1.9rem, 1fr)); gap: 0.3rem; }
.ck {
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  border-radius: 10px;
  border: 2px solid var(--tw-ink);
  outline: 1px solid rgba(255, 255, 255, 0.18);
  background: #2a3366;
  color: #fff;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.55);
  padding: 0;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.ck:hover { background: #38448a; }
.ck:active, .ck.is-hit { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.55); }
.ck-fn { background: #4b4f78; color: #e7ecff; }
.ck-op { background: #1d6f8f; }
.ck-op:hover { background: #2a86aa; }
.ck-op.is-pend { background: #7fe9ff; color: #06202b; }
.ck-sci { background: #3a3470; font-size: 0.82rem; font-weight: 700; }
.ck-sci:hover { background: #4b4590; }
.ck-sci sup { font-size: 0.65em; line-height: 0; }
.ck-mode { background: #5a3d7a; font-size: 0.74rem; }
.ck-mode:hover { background: #70499a; }
.ck-mode.is-on { background: #ff9ec7; color: #10142b; }
.ck-eq { background: var(--tw-gold); color: #1a1204; }
.ck-eq:hover { background: #ffd37a; }
.calc-side { flex: 0 1 15rem; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.calc-tape { margin: 0; padding: 0; list-style: none; flex: 1 1 0; min-height: 0; overflow: auto; font-variant-numeric: tabular-nums; font-size: 0.78rem; }
.calc-tape li { padding: 0.15rem 0.1rem; border-bottom: 1px dashed rgba(255, 255, 255, 0.14); display: flex; justify-content: space-between; gap: 0.6rem; }
.calc-tape li b { color: #ffd37a; }
.calc-tape-empty { color: #8fa0c8; justify-content: flex-start !important; border-bottom: 0 !important; }

/* periodic table */
.pt-body {
  --c: max(1.25rem, min(calc((100cqw - 17.5rem) / 18.4), calc((100cqh - 0.3rem) / 9.4)));
  height: 100%; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 0.9rem; }
.pt-stage {
  position: relative;
  flex: 0 0 auto;
  width: calc(var(--c) * 18);
  height: calc(var(--c) * 9.4);
}
.pt-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(18, var(--c));
  grid-template-rows: repeat(7, var(--c)) calc(var(--c) * 0.4) var(--c) var(--c);
}
.pt-cell {
  font: inherit;
  position: relative;
  box-sizing: border-box;
  margin: 1px;
  padding: 0;
  border: 2px solid var(--tw-ink);
  border-radius: 5px;
  background: var(--cat, #888);
  color: #10142b;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.55);
  transition: transform 0.08s ease, opacity 0.15s ease;
  overflow: hidden;
}
.pt-cell:hover { transform: translateY(-2px) scale(1.06); z-index: 2; }
.pt-cell .pt-n { position: absolute; top: 1px; left: 3px; font-size: calc(var(--c) * 0.22); font-weight: 700; opacity: 0.8; }
.pt-cell .pt-s { font-size: calc(var(--c) * 0.4); font-weight: 900; }
.pt-cell .pt-m { position: absolute; bottom: 1px; font-size: calc(var(--c) * 0.17); opacity: 0.75; display: none; }
.pt-cell.is-on { outline: 3px solid #fff; z-index: 3; transform: scale(1.12); }
.pt-stage.has-hl .pt-cell:not(.is-hl) { opacity: 0.22; }
.pt-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 1px;
  border: 2px dashed rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  font-size: calc(var(--c) * 0.2);
  color: #c4d0ee;
  text-align: center;
  line-height: 1.05;
}
.pt-side {
  flex: 0 0 auto;
  width: 16.5rem;
  height: calc(var(--c) * 9.4);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
}
.pt-info {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  box-sizing: border-box;
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  border: 2px solid var(--tw-line);
  background: rgba(8, 12, 30, 0.92);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
  font-size: 0.7rem;
  line-height: 1.25;
  min-height: 3.2rem;
  padding-bottom: 0.6rem;
}
.pt-info.pop { animation: ptpop 0.28s ease-out; }
@keyframes ptpop { 0% { transform: translateY(8px) scale(0.93); opacity: 0.25; } 70% { transform: translateY(-2px) scale(1.02); opacity: 1; } 100% { transform: none; opacity: 1; } }
.pt-teacher { flex: 1 1 0; min-height: 0; position: relative; pointer-events: none; }
.pt-lyra {
  position: absolute;
  right: 0.35rem;
  bottom: 0;
  height: min(110%, 18rem);
  width: auto;
  z-index: 3;
  transform-origin: 70% 100%;
  filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.45));
}
.pt-lyra.tap { animation: lyratap 0.55s ease-out; }
@keyframes lyratap { 0% { transform: rotate(0); } 25% { transform: rotate(-3deg); } 50% { transform: rotate(1.5deg); } 75% { transform: rotate(-1deg); } 100% { transform: rotate(0); } }
.pt-info-empty { margin: auto; color: #b9c6e4; text-align: center; }
.pt-big {
  flex: 0 0 auto;
  width: 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  border: 2px solid var(--tw-ink);
  background: var(--cat, #888);
  color: #10142b;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}
.pt-big .sym { font-size: 2.1rem; font-weight: 900; line-height: 1; }
.pt-big .num { font-size: 0.78rem; font-weight: 800; }
.pt-facts { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; }
.pt-facts .nm { font-size: 1.35em; font-weight: 900; color: var(--tw-gold); text-shadow: 1px 1px 0 #000; line-height: 1.1; }
.pt-facts .rw b { color: #9fe9ff; font-weight: 700; }
.pt-more { display: none; }
@container twpane (min-height: 318px) { .pt-more { display: block; } .pt-cell .pt-m { display: block; } }
@container twpane (max-width: 620px) {
  .pt-body { flex-direction: column; height: auto; min-height: 100%; justify-content: flex-start; align-items: stretch; gap: 0.35rem; }
  .pt-body { --c: max(1.25rem, calc(100cqw / 18.4)); }
  .pt-stage { width: 100%; height: auto; }
  .pt-grid { position: static; height: calc(var(--c) * 9.4); }
  .pt-legend { position: static; width: auto; height: auto; margin-top: 0.3rem; display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 0.25rem; }
  .pt-chip { font-size: 0.66rem; padding: 0.15rem 0.45rem 0.15rem 0.35rem; }
  .pt-side { width: auto; height: auto; flex-direction: row; align-items: flex-end; gap: 0.3rem; }
  .pt-info { flex: 1 1 auto; font-size: 0.78rem; min-width: 0; }
  .pt-more { display: block; }
  .pt-teacher { flex: 0 0 6.2rem; height: 9.5rem; }
  .pt-lyra { height: 10.5rem; }
}
.pt-legend {
  position: absolute;
  left: calc(var(--c) * 2 + 3px);
  top: 1px;
  width: calc(var(--c) * 10 - 6px);
  height: calc(var(--c) * 3 - 3px);
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 2px 3px;
}
.pt-chip {
  font: inherit;
  font-size: clamp(0.5rem, calc(var(--c) * 0.27), 0.66rem);
  font-weight: 700;
  padding: 0 0.3rem 0 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 999px;
  border: 2px solid var(--tw-ink);
  background: #1b2250;
  color: #eef3ff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
  min-width: 0;
}
.pt-chip::before { content: ""; width: 0.7em; height: 0.7em; border-radius: 3px; background: var(--cat); border: 1px solid #000; }
.pt-chip.is-on { background: #fff; color: #10142b; }
.pt-c-nm { --cat: #6ee59a; } .pt-c-ng { --cat: #8ea2ff; } .pt-c-am { --cat: #ff7a59; } .pt-c-ae { --cat: #ffb347; }
.pt-c-md { --cat: #46d9b6; } .pt-c-hl { --cat: #ffe45e; } .pt-c-pt { --cat: #6fd0ff; } .pt-c-tm { --cat: #ff9ec7; }
.pt-c-ln { --cat: #b6ef6a; } .pt-c-ac { --cat: #e987ff; }

/* small tools */
.tw-tool { max-width: 44rem; margin: 0 auto; padding: 0 0.3rem; }
.cv-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.cv-main { align-items: flex-end; }
.cv-side { display: flex; flex-direction: column; gap: 0.25rem; flex: 1 1 10rem; min-width: 0; }
.cv-num { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.cv-out { display: block; color: var(--clock, #ff9a32); min-height: 1.4em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-swap { flex: 0 0 auto; width: 2.6rem; height: 2.4rem; padding: 0; font-size: 1.1rem; }
.sw-wrap { text-align: center; }
.sw-face { font-size: clamp(2rem, 14cqh, 3.4rem); font-weight: 800; font-variant-numeric: tabular-nums; color: var(--clock, #ff9a32); text-shadow: 3px 3px 0 #000; margin: 0.1rem 0 0.4rem; line-height: 1.05; }
.sw-btns { display: flex; justify-content: center; gap: 0.5rem; }
.sw-btns .dash-btn[disabled] { opacity: 0.45; cursor: default; }
.sw-laps { list-style: none; margin: 0.5rem auto 0; padding: 0; max-width: 24rem; max-height: 7rem; overflow: auto; font-variant-numeric: tabular-nums; font-size: 0.8rem; text-align: left; }
.sw-laps li { display: flex; justify-content: space-between; padding: 0.12rem 0.3rem; border-bottom: 1px dashed rgba(255, 255, 255, 0.14); }
.sw-laps li.is-best b { color: #6ee59a; }
.sw-laps li.is-worst b { color: #ff8f8f; }
.dice-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; }
.dice-kind { font: inherit; font-weight: 800; font-size: 0.8rem; padding: 0.25rem 0.7rem; border-radius: 8px; border: 2px solid var(--tw-ink); background: #232b57; color: #fff; cursor: pointer; box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5); }
.dice-kind.is-on { background: #ff9ec7; color: #10142b; }
.dice-count { width: 4rem; }
.dice-out { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; min-height: 3.2rem; padding: 0.3rem 0; }
.dice-hint { color: #9fb3d9; }
.die { min-width: 2.6rem; height: 2.6rem; padding: 0 0.3rem; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; border: 2px solid var(--tw-ink); background: #fff; color: #10142b; font-size: 1.2rem; font-weight: 900; box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.55); }
.die.is-coin { border-radius: 50%; background: var(--tw-gold); width: 3.2rem; height: 3.2rem; font-size: 1.1rem; }
.dice-total { margin-left: 0.5rem; font-weight: 800; color: #ffd37a; }
.dice-log { list-style: none; margin: 0; padding: 0; font-size: 0.74rem; color: #b9c6e4; max-height: 4.5rem; overflow: auto; }
.col-main { display: flex; gap: 1rem; align-items: stretch; flex-wrap: wrap; }
.col-swatch { flex: 0 0 9rem; min-height: 7rem; border-radius: 14px; border: 3px solid var(--tw-ink); outline: 2px solid rgba(255, 255, 255, 0.4); box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.55); display: flex; align-items: center; justify-content: center; font-size: 2.6rem; font-weight: 900; background: #ff9a32; color: #000; }
.col-ctl { flex: 1 1 18rem; min-width: 0; }
.col-ln { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; flex-wrap: wrap; }
.col-ln input[type="range"] { flex: 1 1 8rem; min-width: 5rem; accent-color: #f0c05a; }
.col-ln output { width: 2.2rem; text-align: right; font-variant-numeric: tabular-nums; }
.col-pick { width: 2.6rem; height: 2rem; padding: 0; border: 2px solid var(--tw-ink); border-radius: 6px; background: none; cursor: pointer; }
.col-hex { width: 6.5rem; font-family: ui-monospace, Consolas, monospace; }
.col-btns .dash-btn { font-size: 0.74rem; padding: 0.25rem 0.7rem; }
.col-msg { font-size: 0.72rem; color: #6ee59a; }

/* ---------- 4. phone: a full screen sheet, like the To-Do and Library sheets ---------- */
html.is-phone .tool-window {
  position: fixed;
  inset: 0.5rem;
  z-index: 10010;
  bottom: 0.5rem;
  padding: 0.35rem 0.45rem 0.45rem;
  font-size: 0.82rem;
  max-height: none;
}
html.is-phone .tw-head { flex-wrap: wrap; row-gap: 0.3rem; }
html.is-phone .tw-title { order: 1; }
html.is-phone .tw-close { order: 2; margin-left: auto; width: 2.6rem; height: 2.6rem; }
html.is-phone .tw-tabs { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.2rem; -webkit-overflow-scrolling: touch; }
html.is-phone .tw-tab { flex: 0 0 auto; padding: 0.35rem 0.8rem; }
html.is-phone .calc-wrap { flex-direction: column; align-items: center; justify-content: flex-start; height: auto; min-height: 100%; gap: 0.6rem; }
html.is-phone .calc { width: 100%; max-width: 22rem; flex: 0 0 auto; }
html.is-phone .calc-pads { flex: 0 0 auto; }
html.is-phone .calc-keys { flex: 0 0 auto; grid-template-rows: repeat(5, 3.2rem); }
html.is-phone .calc-screen { padding: 0.5rem 0.8rem; }
html.is-phone .calc-out { font-size: 2rem; }
html.is-phone .calc-side { flex: 0 0 auto; width: 100%; max-width: 22rem; }
html.is-phone .calc-tape { max-height: 4.2rem; }
html.is-phone .ck { font-size: 1.15rem; }
html.is-phone .toolbox-btn svg { width: 14px; height: 14px; }
html.is-phone.is-phone-landscape .tw-pane { overflow: auto; }

@media (prefers-reduced-motion: reduce) {
  .pt-cell, .ck { transition: none; }
}

/* phone: lift the dash box above the site header while the sheet is up (same trick as the To-Do / Library sheets) */
html.is-phone.is-tool-open .dash-box { z-index: 100; }
html.is-phone.is-tool-open header { z-index: 1; }

html.is-phone .calc-tape { flex: 0 0 auto; }
html.is-phone-landscape .calc-wrap { flex-direction: row; align-items: flex-start; justify-content: center; }
html.is-phone-landscape .calc { width: 20rem; max-width: 20rem; }
html.is-phone-landscape .calc-keys { grid-template-rows: repeat(5, 2.2rem); }
html.is-phone-landscape .calc-screen { padding: 0.25rem 0.7rem; }
html.is-phone-landscape .calc-out { font-size: 1.5rem; }
html.is-phone-landscape .calc-side { flex: 1 1 12rem; width: auto; }
html.is-phone-landscape .tw-title { order: 0; }
html.is-phone-landscape .tw-tabs { order: 1; flex: 1 1 0; }
html.is-phone-landscape .tw-close { order: 2; width: 2.2rem; height: 2.2rem; }

/* Short sideways phones (844x390): the city-card row plus the F/C toggle and the Open-Meteo credit made the weather band 26px taller than the 5-day panel could clear
   (the 9 phone-landscape overlap fails that already showed up in the v12.21 city-card build). Letting the card row shrink puts the F/C toggle beside it instead of under it. WHY: Dad asked that both builds' tests pass together. */
html.is-phone-landscape .weather-band .weather-strip { flex: 1 1 0; min-width: 0; }

/* The third button hangs below the gear instead of making the whole button stack (and the MARU-TIMER box) taller.
   WHY: Dad's arrow pointed at the empty spot right under the gear. A taller stack grew the top row by 17px and squeezed the middle band on short screens
   (the dock clock then touched the SHOW TO-DO tab). The negative margin keeps the top row, timer box and everything under it exactly as they were.
   Phones lay the stack out as a row, and the Labyrinth hides the button, so neither gets the margin. */
html:not(.is-phone) .dash-tool-stack { margin-bottom: calc(-1 * (2.25rem + 0.35rem)); }
html[data-lab-chrome="maze"] .dash-tool-stack,
html[data-lab-chrome="gate"] .dash-tool-stack { margin-bottom: 0; }
/* the window starts just under the hanging button so it never covers it */
.tool-window { top: var(--tw-top, 0px); }

/* ---------- scientific calculator on phone landscape (Dad t2307) ---------- */
html.is-phone-landscape .calc[data-mode="sci"] { width: auto; max-width: none; flex: 1 1 0; }
html.is-phone-landscape .calc[data-mode="sci"] .calc-sci { grid-template-rows: repeat(5, 2.2rem); }
html.is-phone-landscape .tool-window.calc-is-sci .calc-side { display: none; }
html.is-phone .calc[data-mode="sci"] .calc-sci { gap: 0.2rem; }

/* ---------- star finder (Dad t2307) ---------- */
.sf-wrap { height: 100%; display: flex; gap: 0.9rem; align-items: stretch; }
.sf-chartbox { flex: 0 0 auto; height: 100%; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; min-width: 0; }
.sf-chart { display: block; border-radius: 50%; max-width: 100%; }
.sf-side { flex: 1 1 0; min-width: 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 0.1rem; padding-right: 0.2rem; }
.sf-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; }
.sf-head b { color: var(--tw-gold); font-size: 0.95rem; text-shadow: 1px 1px 0 #000; }
.sf-when { color: #9fe9ff; font-size: 0.78rem; }
.sf-note { margin: 0.1rem 0 0.2rem; font-size: 0.74rem; line-height: 1.3; color: #cfe0ff; }
.sf-list { list-style: none; margin: 0 0 0.3rem; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 6px; }
.sf-none { color: #9fb3d9; font-size: 0.74rem; grid-column: 1 / -1; }
.sf-item {
  font: inherit;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0.08rem 0.5rem 0.12rem;
  border-radius: 8px;
  border: 2px solid var(--tw-ink);
  background: #1b2250;
  color: #eef3ff;
  cursor: pointer;
  box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.5);
  line-height: 1.2;
}
.sf-item b { font-size: 0.74rem; }
.sf-item b, .sf-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sf-item span { font-size: 0.64rem; color: #9fb3d9; }
.sf-item:hover { background: #28326a; }
.sf-item.is-on { background: var(--tw-gold); color: #1a1204; }
.sf-item.is-on span { color: #4b3606; }
.sf-item:focus-visible, .sf-ctl input:focus-visible { outline: 2px solid var(--tw-gold); outline-offset: 2px; }
.sf-ctl { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.2rem; flex-wrap: wrap; }
.sf-ctl input[type="range"] { flex: 1 1 8rem; min-width: 5rem; accent-color: #f0c05a; }
.sf-ctl output { min-width: 3.2rem; font-variant-numeric: tabular-nums; font-size: 0.78rem; color: #ffd37a; }
.sf-ctl .dash-btn { font-size: 0.72rem; padding: 0.2rem 0.7rem; }
@container twpane (max-width: 560px) {
  .sf-wrap { flex-direction: column; align-items: stretch; height: auto; min-height: 100%; }
  .sf-chartbox { width: min(100%, 22rem); height: auto; margin: 0 auto; }
  .sf-side { overflow: visible; }
  .sf-list { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .pt-info.pop, .pt-lyra.tap { animation: none; }
}

/* =====================================================================
   v12.24 toolbox3 (Dad t2313 + t2314). Every rule below carries its WHY in the comment above it.
   ===================================================================== */

/* ---------- (a) header weather in toolbox mode ----------
   WHY (Dad: "the black box behind the weather looks off in tool mode"): the 5-day strip is a size container (container-type: inline-size),
   so `width: max-content` gave it ZERO content width: its dark glass box shrank to a narrow pill behind the first day and the days spilled
   out of it. In the header we switch the containment off so the box wraps all five days, and give it the same light glass as the city cards. */
html:not(.is-phone) .dash-ui.toolbox-open[data-layout] .clock-block .wx-strip {
  container-type: normal;
  background: rgba(8, 14, 26, 0.32);
  border-color: rgba(255, 255, 255, 0.14);
  padding: 0.3em 0.55em 0.35em;
}

/* ---------- (t2314) no scrollbar flashing in the tool window ----------
   WHY (Dad t2314: "whenever i click an element this bar appear on the right, and then disappears"): the card's pop-in animation started 8px
   lower and overshot to 102%, and chibi Lyra's tap rotated her past the pane; for those few frames the content was taller than the pane, so
   the pane's scrollbar flashed. The pop now only fades and grows from 96% to 100% (never bigger than its box), and on the wide layouts the
   table area clips paint-only effects (the 1.12x selected cell, Lyra's tap) at its own edge with a small margin. Nothing that is laid out
   is ever cut: the wide layouts are sized to the pane, and the narrow/phone layouts keep their normal scrolling. */
@keyframes ptpop { 0% { transform: scale(0.96); opacity: 0.2; } 100% { transform: none; opacity: 1; } }
@keyframes lyratap { 0% { transform: rotate(0); } 30% { transform: rotate(-2.5deg); } 60% { transform: rotate(1deg); } 100% { transform: rotate(0); } }
@container twpane (min-width: 621px) {
  .pt-body, .sf-wrap, .sw-wrap, .dice-wrap, .col-wrap, .cv-wrap { overflow: clip; }
}

/* ---------- 2. periodic table: the big card ----------
   WHY (Dad: "lets make box for element bigger - maybe add more info since we have more space now"): the right column is wider and the card
   fills its whole height instead of a 140px strip at the top. Chibi Lyra (the approved art, mirrored) stands on the left of the column and
   points her stick up at the card. The card's size is fixed by the column, so picking an element never changes the layout. */
.pt-body { padding: 0 2px; box-sizing: border-box; }
@container twpane (min-width: 621px) { .pt-body { --c: max(1.25rem, min(calc((100cqw - 25rem) / 18.4), calc((100cqh - 0.3rem) / 9.4))); } }
.pt-side {
  flex: 1 1 0;
  width: auto;
  min-width: 21rem;
  max-width: 38rem;
  height: calc(var(--c) * 9.4);
  display: grid;
  grid-template-columns: minmax(4.5rem, 22%) 1fr;
  grid-template-rows: 1fr auto;
  gap: 0.2rem 0.35rem;
}
.pt-info {
  grid-column: 2; grid-row: 1;
  min-height: 0;
  height: 100%;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0.65rem 0.55rem;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(127, 233, 255, 0.45) transparent;
  scrollbar-gutter: stable;
  font-size: clamp(0.7rem, 1.9cqh, 0.86rem);
}
.pt-info-empty { font-size: 0.85rem; padding: 0 0.6rem; line-height: 1.4; }
.pt-teacher { grid-column: 1; grid-row: 1 / 3; position: relative; min-height: 0; overflow: visible; }
.pt-lyra { left: 0; right: auto; bottom: 0; height: min(100%, 17rem); max-width: 100%; object-fit: contain; object-position: bottom; transform-origin: 40% 100%; }
.pt-lyra:not(.tap) { transform: scaleX(-1); }
.pt-lyra.tap { animation: lyratapm 0.55s ease-out; }
@keyframes lyratapm { 0% { transform: scaleX(-1) rotate(0); } 30% { transform: scaleX(-1) rotate(-2.5deg); } 60% { transform: scaleX(-1) rotate(1deg); } 100% { transform: scaleX(-1) rotate(0); } }
.pt-credit { grid-column: 2; grid-row: 2; margin: 0; font-size: 0.56rem; line-height: 1.25; color: #8fa0c8; }
.pt-card-head { display: flex; gap: 0.7rem; align-items: stretch; flex: 0 0 auto; }
.pt-big { width: clamp(3.6rem, 9cqh, 5.4rem); padding: 0.25rem 0; }
.pt-big .sym { font-size: clamp(1.9rem, 5.6cqh, 3rem); }
.pt-big .num { font-size: 0.82rem; }
.pt-big .ms { font-size: 0.66rem; font-weight: 700; opacity: 0.8; }
.pt-facts .nm { font-size: clamp(1.15rem, 3.6cqh, 1.7rem); }
.pt-facts .rw { display: none; }
.pt-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.3rem; }
.pt-tag { font-size: 0.72em; font-weight: 800; padding: 0.1rem 0.5rem; border-radius: 999px; border: 2px solid var(--tw-ink); background: var(--cat, #2a3366); color: #10142b; }
.pt-tag-st { background: #1b2250; color: #eef3ff; border-color: #3c4a8a; }
.pt-dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.18rem 0.8rem; }
.pt-row { min-width: 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.12); padding-bottom: 0.12rem; }
.pt-row dt { font-size: 0.78em; letter-spacing: 0.06em; text-transform: uppercase; color: #9fe9ff; font-weight: 700; }
.pt-row dd { margin: 0; color: #eef3ff; overflow-wrap: anywhere; }
.pt-row dd sup { font-size: 0.7em; line-height: 0; }
.pt-row-wide { grid-column: 1 / -1; }
.pt-fact { margin: 0; padding: 0.35rem 0.5rem; border-radius: 8px; background: rgba(240, 192, 90, 0.12); border: 1px solid rgba(240, 192, 90, 0.45); line-height: 1.35; }
.pt-fact b { color: var(--tw-gold); }
.pt-note { margin: 0; font-size: 0.85em; color: #b9c6e4; font-style: italic; }
.pt-more { display: block; }
@container twpane (max-width: 620px) {
  .pt-side { display: grid; grid-template-columns: 5.5rem 1fr; grid-template-rows: auto auto; height: auto; min-width: 0; max-width: none; }
  .pt-info { height: auto; overflow: visible; }
  .pt-teacher { grid-row: 1; height: auto; min-height: 9rem; }
  .pt-lyra { height: 10rem; }
  .pt-credit { grid-column: 1 / -1; }
}

/* ---------- 3. star finder: dome left, teaching card middle, lists right ----------
   WHY (Dad: "drag and spin for the globe ... click the names on the globe ... another lyra chibi to teach the constellation in a card - card in
   middle and list to right"). */
.sf-wrap { display: grid; grid-template-columns: auto minmax(15rem, 1.15fr) minmax(12rem, 1fr); gap: 0.8rem; height: 100%; }
.sf-chartbox { height: 100%; aspect-ratio: auto; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; width: calc(100cqh - 0.4rem); max-width: 46cqw; min-width: 0; position: relative; }
.sf-chart { cursor: grab; touch-action: none; }
.sf-chart.is-dragging { cursor: grabbing; }
.sf-chart:focus-visible { outline: 2px solid var(--tw-gold); outline-offset: 3px; }
.sf-chart-ctl { display: flex; align-items: center; justify-content: center; gap: 0.5rem; margin-top: 0.15rem; min-height: 1.4rem; flex: 0 0 auto; }
.sf-mini { font: inherit; font-size: 0.68rem; font-weight: 800; padding: 0.1rem 0.6rem; border-radius: 999px; border: 2px solid var(--tw-ink); background: #f0c05a; color: #1a1204; cursor: pointer; }
.sf-mini[hidden] { display: none; }
.sf-drag-hint { font-size: 0.66rem; color: #9fb3d9; }
.sf-drag-hint.is-done { opacity: 0.55; }
.sf-teach { position: relative; min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(4rem, 26%) 1fr; align-items: stretch; }
.sf-card {
  grid-column: 2;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(127, 233, 255, 0.45) transparent;
  box-sizing: border-box;
  padding: 0.55rem 0.75rem 0.6rem;
  border-radius: 12px;
  border: 2px solid var(--tw-line);
  background: rgba(8, 12, 30, 0.92);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5);
  font-size: clamp(0.72rem, 2cqh, 0.86rem);
  line-height: 1.35;
}
.sf-card.pop { animation: ptpop 0.28s ease-out; }
.sf-card-kick { font-size: 0.72em; letter-spacing: 0.12em; text-transform: uppercase; color: #ff9ec7; font-weight: 800; }
.sf-card-name { margin: 0.05rem 0 0; font-size: clamp(1.1rem, 3.6cqh, 1.6rem); color: var(--tw-gold); text-shadow: 1px 1px 0 #000; line-height: 1.1; }
.sf-card-en { color: #9fe9ff; font-weight: 700; margin-bottom: 0.3rem; }
.sf-card-star { margin: 0 0 0.3rem; padding: 0.2rem 0.45rem; border-radius: 7px; background: rgba(255, 244, 194, 0.1); color: #fff4c2; }
.sf-card-dl { margin: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.sf-card-dl dt { font-size: 0.76em; letter-spacing: 0.08em; text-transform: uppercase; color: #9fb3d9; font-weight: 800; }
.sf-card-dl dd { margin: 0; }
.sf-card-fact { margin: 0.4rem 0 0; padding: 0.35rem 0.5rem; border-radius: 8px; background: rgba(240, 192, 90, 0.12); border: 1px solid rgba(240, 192, 90, 0.45); }
.sf-card-empty { color: #b9c6e4; margin: auto 0; }
.sf-lyra { grid-column: 1; grid-row: 1; align-self: end; justify-self: center; width: auto; height: auto; max-height: min(100%, 16rem); max-width: 100%; transform: scaleX(-1); transform-origin: 40% 100%; filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.45)); pointer-events: none; }
.sf-lyra.tap { animation: lyratapm 0.55s ease-out; }
.sf-side { min-width: 0; min-height: 0; }
.sf-list { grid-template-columns: 1fr; gap: 3px; }
.sf-item.is-auto { border-color: #f0c05a; }
@container twpane (max-width: 900px) and (min-width: 561px) {
  .sf-wrap { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .sf-chartbox { grid-row: 1 / 3; }
  .sf-side { grid-column: 2; grid-row: 2; max-height: 38cqh; overflow: auto; }
  .sf-list { grid-template-columns: 1fr 1fr; }
}
@container twpane (max-width: 560px) {
  .sf-wrap { display: flex; flex-direction: column; height: auto; min-height: 100%; }
  .sf-chartbox { width: min(100%, 22rem); max-width: none; height: auto; margin: 0 auto; }
  .sf-teach { grid-template-columns: 5rem 1fr; }
  .sf-card { overflow: visible; }
  .sf-lyra { max-height: 9rem; }
  .sf-list { grid-template-columns: 1fr 1fr; }
}
@media (prefers-reduced-motion: reduce) { .sf-card.pop, .sf-lyra.tap { animation: none; } }

/* ---------- 4. converter ----------
   WHY (Dad: "i cant click the drop down in converter"): the pickers are in-page lists now (see toolbox.js), and the tool is scaled up to use
   the panel: measure chips, big number boxes, and a quick table of the same amount in every unit. */
.cv-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; overflow: hidden; clip-path: inset(50%); }
.cv-wrap { max-width: 64rem; margin: 0 auto; padding: 0.2rem 0.6rem 0; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(12rem, 1fr); grid-template-rows: auto auto auto 1fr; column-gap: 1.4rem; height: 100%; box-sizing: border-box; font-size: clamp(0.85rem, 2.3cqh, 1.05rem); }
.cv-wrap > .cv-kinds, .cv-wrap > .cv-row, .cv-wrap > .cv-main, .cv-wrap > .cv-line { grid-column: 1; }
.cv-table-wrap { grid-column: 2; grid-row: 1 / 5; min-height: 0; overflow: auto; scrollbar-width: thin; }
.cv-kinds { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.cv-kind { font: inherit; font-size: 0.85em; font-weight: 800; display: inline-flex; gap: 0.35rem; align-items: center; padding: 0.3rem 0.8rem; border-radius: 999px; border: 2px solid var(--tw-ink); background: #232b57; color: #eef3ff; cursor: pointer; box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5); }
.cv-kind:hover { background: #2f3a74; }
.cv-kind.is-on { background: var(--tw-gold); color: #1a1204; }
.cv-kind:focus-visible, .tw-dd-btn:focus-visible, .tw-dd-list:focus-visible { outline: 2px solid var(--tw-gold); outline-offset: 2px; }
.cv-row { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.cv-main { display: flex; align-items: flex-end; gap: 0.7rem; }
.cv-side { flex: 1 1 0; display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.cv-num { font-size: clamp(1.4rem, 5cqh, 2.3rem); padding: 0.3rem 0.6rem; }
.cv-swap { width: 3rem; height: 3rem; font-size: 1.4rem; margin-bottom: 0.2rem; }
.cv-line { margin: 0.7rem 0 0; color: #ffd37a; font-weight: 700; font-size: 0.95em; }
.cv-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.9em; }
.cv-table th { text-align: left; font-weight: 600; color: #b9c6e4; padding: 0.22rem 0.4rem; }
.cv-table td { text-align: right; font-weight: 800; color: #eef3ff; padding: 0.22rem 0.4rem; }
.cv-table tr { border-bottom: 1px dashed rgba(255, 255, 255, 0.12); }
.cv-table tr.is-to td, .cv-table tr.is-to th { color: var(--clock, #ff9a32); }
/* the in-page dropdown */
.tw-dd { position: relative; min-width: 0; }
.cv-row .tw-dd { min-width: 12rem; }
.tw-dd-btn { font: inherit; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; text-align: left; color: #fff; background: #0b1030; border: 2px solid #3c4a8a; border-radius: 8px; padding: 0.4rem 0.6rem; cursor: pointer; }
.tw-dd-btn:hover { border-color: #7fe9ff; }
.tw-dd.is-open .tw-dd-btn { border-color: var(--tw-gold); }
.tw-dd-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-dd-car { flex: 0 0 auto; transition: transform 0.15s ease; }
.tw-dd.is-open .tw-dd-car { transform: rotate(180deg); }
.tw-dd-list { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 0.25rem; list-style: none; max-height: min(18rem, 60cqh); overflow: auto; scrollbar-width: thin; background: #0b1030; border: 2px solid var(--tw-gold); border-radius: 10px; box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.55); }
.tw-dd.is-up .tw-dd-list { top: auto; bottom: calc(100% + 4px); }
.tw-dd-list[hidden] { display: none; }
.tw-dd-list li { padding: 0.32rem 0.55rem; border-radius: 6px; cursor: pointer; color: #eef3ff; white-space: nowrap; }
.tw-dd-list li.is-act { background: #2f3a74; }
.tw-dd-list li.is-sel { color: var(--tw-gold); font-weight: 800; }
.tw-dd-list li.is-sel::before { content: "\2713  "; }
@container twpane (min-width: 621px) { .cv-wrap { overflow: visible; } }
@container twpane (max-width: 620px) {
  .cv-wrap { display: flex; flex-direction: column; height: auto; }
  .cv-main { flex-wrap: wrap; }
  .cv-side { flex: 1 1 100%; }
  .cv-swap { align-self: center; }
  .cv-table-wrap { overflow: visible; margin-top: 0.6rem; }
}

/* ---------- 5. stopwatch: big, Sophie-themed ----------
   WHY (Dad: "make stop watch bigger and themed with sophie, theres a lot of empty space"): a round dial in St. Lyra pink and gold with Sophie's
   yellow star clip on the crown; the ring fills once a minute and a little star rides it. Big digits, big buttons, laps in their own column. */
.sw-wrap { height: 100%; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(13rem, 1fr); gap: 1.2rem; align-items: stretch; text-align: center; max-width: 72rem; margin: 0 auto; padding: 0 0.6rem; box-sizing: border-box; }
.sw-dialbox { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.7rem; min-height: 0; }
.sw-dial { position: relative; height: min(100cqh - 5.2rem, 46cqw); aspect-ratio: 1 / 1; min-height: 9rem; }
.sw-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sw-ring-bg { fill: rgba(8, 12, 30, 0.85); stroke: #ff9ec7; stroke-width: 7; }
.sw-ring-fill { fill: none; stroke: var(--tw-gold); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transform: rotate(-90deg); transform-origin: 100px 100px; }
.sw-ticks line { stroke: rgba(255, 255, 255, 0.35); stroke-width: 1; }
.sw-ticks line.big { stroke: #ffd37a; stroke-width: 2; }
.sw-orbit-star { fill: #ffe45e; stroke: #10142b; stroke-width: 1; }
.sw-clip { position: absolute; left: 50%; top: -9%; width: 18%; aspect-ratio: 1; transform: translateX(-50%) rotate(-8deg); filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, 0.55)); }
.sw-clip svg { width: 100%; height: 100%; fill: #ffd84a; stroke: #10142b; stroke-width: 1.4; stroke-linejoin: round; }
.sw-dial.is-running .sw-clip { animation: swclip 1.6s ease-in-out infinite; }
@keyframes swclip { 0%, 100% { transform: translateX(-50%) rotate(-8deg); } 50% { transform: translateX(-50%) rotate(6deg); } }
.sw-center { position: absolute; inset: 18%; display: flex; flex-direction: column; align-items: center; justify-content: center; container-type: inline-size; }
.sw-name { font-size: max(0.6rem, 7cqw); letter-spacing: 0.18em; text-transform: uppercase; color: #ff9ec7; font-weight: 800; }
.sw-face { font-size: 19cqw; margin: 0.05em 0; line-height: 1; color: var(--clock, #ff9a32); text-shadow: 3px 3px 0 #000; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sw-sub { font-size: max(0.6rem, 6cqw); text-transform: uppercase; letter-spacing: 0.2em; color: #9fe9ff; }
.sw-btns { display: flex; justify-content: center; gap: 0.7rem; flex: 0 0 auto; }
.sw-btn { font-size: 1.05rem !important; min-width: 6.5rem; padding: 0.55rem 1.2rem !important; border-radius: 999px !important; }
.sw-btn.is-stop { background: #ff9ec7 !important; color: #10142b !important; }
.sw-btn-lap:not([disabled]) { background: #1d6f8f; color: #fff; }
.sw-side { display: flex; flex-direction: column; min-height: 0; text-align: left; padding: 0.3rem 0; }
.sw-laps { max-width: none; max-height: none; flex: 1 1 0; min-height: 0; margin: 0; font-size: clamp(0.85rem, 2.6cqh, 1.05rem); scrollbar-width: thin; }
.sw-laps li { padding: 0.28rem 0.4rem; }
.sw-laps li.is-worst b { color: #ff9ec7; }
.sw-empty { color: #9fb3d9; font-size: 0.82rem; margin: 0.2rem 0; }
.sw-empty[hidden] { display: none; }
@container twpane (max-width: 620px) {
  .sw-wrap { display: flex; flex-direction: column; height: auto; }
  .sw-dial { height: auto; width: min(80cqw, 17rem); }
  .sw-laps { max-height: 12rem; }
}
@media (prefers-reduced-motion: reduce) { .sw-dial.is-running .sw-clip { animation: none; } }

/* ---------- 6. dice & coin: bigger, animated, with history ----------
   WHY (Dad: "same for dice. its really small plenty of room for stuff or bigger"). */
.dice-wrap { height: 100%; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(12rem, 1fr); gap: 1.2rem; max-width: 72rem; margin: 0 auto; padding: 0 0.6rem; box-sizing: border-box; }
.dice-main { display: flex; flex-direction: column; min-height: 0; }
.dice-kinds { gap: 0.45rem; }
.dice-kind { display: inline-flex; flex-direction: column; align-items: center; gap: 0.15rem; padding: 0.35rem 0.75rem 0.3rem; font-size: 0.9rem; min-width: 3.4rem; }
.dk-shape { width: 1.3rem; height: 1.3rem; background: currentColor; opacity: 0.85; }
.dk-tri .dk-shape { clip-path: polygon(50% 4%, 96% 92%, 4% 92%); }
.dk-sq .dk-shape { border-radius: 4px; }
.dk-dia .dk-shape { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.dk-kite .dk-shape { clip-path: polygon(50% 0, 100% 40%, 50% 100%, 0 40%); }
.dk-pent .dk-shape { clip-path: polygon(50% 0, 98% 36%, 80% 96%, 20% 96%, 2% 36%); }
.dk-hex .dk-shape { clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); }
.dk-circ .dk-shape { border-radius: 50%; }
.dice-ctl { gap: 0.6rem; }
.dice-count-ctl { display: inline-flex; align-items: center; gap: 0.25rem; }
.dice-step { font: inherit; font-weight: 900; font-size: 1.1rem; width: 2.2rem; height: 2.2rem; border-radius: 8px; border: 2px solid var(--tw-ink); background: #232b57; color: #fff; cursor: pointer; }
.dice-count { width: 3.4rem; text-align: center; font-size: 1.1rem; font-weight: 800; }
.dice-big { font-size: 1rem !important; padding: 0.5rem 1.2rem !important; }
.dice-table { flex: 1 1 0; min-height: 7rem; display: flex; align-items: center; justify-content: center; gap: 1.2rem; border-radius: 16px; border: 2px dashed rgba(127, 233, 255, 0.3); background: radial-gradient(ellipse at 50% 40%, rgba(46, 72, 140, 0.45), rgba(8, 12, 30, 0.2)); margin-top: 0.3rem; padding: 0.6rem; }
.dice-out { flex: 0 1 auto; justify-content: center; gap: clamp(0.4rem, 1.4cqh, 0.9rem); min-height: 0; --die: clamp(3rem, min(22cqh, 11cqw), 6.4rem); }
.dice-out[data-n="5"], .dice-out[data-n="6"] { --die: clamp(2.8rem, min(17cqh, 9cqw), 5rem); }
.dice-out[data-n="7"], .dice-out[data-n="8"] { --die: clamp(2.6rem, min(15cqh, 7.5cqw), 4.4rem); }
.dice-hint { font-size: 1rem; }
.die { position: relative; width: var(--die); min-width: 0; height: var(--die); padding: 0; font-size: calc(var(--die) * 0.42); border-radius: 18%; border-width: 3px; box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.55), inset 0 -4px 0 rgba(0, 0, 0, 0.12); }
.die::after { content: attr(data-sides); position: absolute; bottom: 6%; right: 9%; font-size: 0.32em; font-weight: 800; opacity: 0.45; }
.die-tri { clip-path: polygon(50% 2%, 98% 96%, 2% 96%); border-radius: 0; padding-top: 18%; box-sizing: border-box; background: #b6ef6a; }
.die-dia { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); border-radius: 0; background: #8ea2ff; }
.die-kite { clip-path: polygon(50% 0, 100% 40%, 50% 100%, 0 40%); border-radius: 0; background: #6fd0ff; }
.die-pent { clip-path: polygon(50% 0, 98% 36%, 80% 98%, 20% 98%, 2% 36%); border-radius: 0; background: #ff9ec7; }
.die-hex { clip-path: polygon(25% 2%, 75% 2%, 100% 50%, 75% 98%, 25% 98%, 0 50%); border-radius: 0; background: #ffe45e; }
.die-circ { border-radius: 50%; background: #ffb347; font-size: calc(var(--die) * 0.34); }
.die-dia::after, .die-kite::after, .die-pent::after, .die-hex::after, .die-tri::after { display: none; }
.die-pips { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 14%; box-sizing: border-box; gap: 4%; }
.die-pips .die-v { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.pip { border-radius: 50%; background: transparent; align-self: center; justify-self: center; width: 78%; aspect-ratio: 1; }
.pip.on { background: #10142b; }
.die.is-rolling { animation: dieroll 0.55s cubic-bezier(.2, .8, .3, 1.2) both; }
@keyframes dieroll { 0% { transform: translateY(-40%) rotate(-200deg) scale(0.6); opacity: 0; } 60% { transform: translateY(4%) rotate(12deg) scale(1.02); opacity: 1; } 100% { transform: none; } }
.die.is-coin { width: var(--die); height: var(--die); border-radius: 50%; font-size: calc(var(--die) * 0.38); background: radial-gradient(circle at 35% 30%, #fff1b0, #f0c05a 55%, #b8862a); border-color: #6b4a10; color: #3a2606; }
.die.is-coin::before { content: "\2605"; position: absolute; top: 10%; font-size: 0.42em; color: #fff7d1; }
.die.is-coin.is-tails::before { content: "279.3"; font-size: 0.24em; font-weight: 900; letter-spacing: 0.04em; top: 14%; }
.die.is-flipping { animation: coinflip 0.9s cubic-bezier(.3, .7, .3, 1) both; }
@keyframes coinflip { 0% { transform: translateY(0) rotateX(0); } 40% { transform: translateY(-45%) rotateX(900deg); } 100% { transform: translateY(0) rotateX(1800deg); } }
.dice-sum { display: flex; flex-direction: column; align-items: center; min-width: 4rem; color: #ffd37a; }
.dice-sum span { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: #9fb3d9; }
.dice-sum b { font-size: clamp(1.6rem, 9cqh, 3.2rem); line-height: 1; text-shadow: 2px 2px 0 #000; }
.dice-sum small { color: #9fb3d9; }
.dice-side { display: flex; flex-direction: column; min-height: 0; padding: 0.2rem 0; }
.dice-log { flex: 1 1 0; min-height: 0; max-height: none; font-size: clamp(0.8rem, 2.4cqh, 0.95rem); scrollbar-width: thin; }
.dice-log li { padding: 0.2rem 0.3rem; border-bottom: 1px dashed rgba(255, 255, 255, 0.12); }
.dice-log li.is-new { color: #ffd37a; font-weight: 800; }
.dice-stats { display: flex; gap: 0.8rem; font-size: 0.8rem; color: #b9c6e4; margin: 0.35rem 0; }
.dice-stats b { color: #fff; }
.dice-clear { align-self: flex-start; font-size: 0.75rem !important; }
@container twpane (max-width: 620px) {
  .dice-wrap { display: flex; flex-direction: column; height: auto; }
  .dice-table { min-height: 8rem; flex: 0 0 auto; }
  .dice-out { --die: clamp(2.6rem, 15cqw, 4rem); }
  .dice-log { max-height: 9rem; }
}
@media (prefers-reduced-motion: reduce) { .die.is-rolling, .die.is-flipping { animation: none; } }

/* ---------- 7. colour: bigger, with a matcher and CMYK ----------
   WHY (Dad: "colour can be bigger, add like a color matcher like complementary and tri and all that. maybe CMYK bar too"). */
.col-wrap { height: 100%; display: grid; grid-template-columns: minmax(11rem, 0.9fr) minmax(14rem, 1.1fr) minmax(14rem, 1.1fr); gap: 1rem; max-width: 80rem; margin: 0 auto; padding: 0 0.5rem; box-sizing: border-box; }
.col-left, .col-mid, .col-right { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.col-mid { gap: 0.15rem; overflow: auto; scrollbar-width: thin; }
.col-swatch { flex: 1 1 0; min-height: 5rem; font-size: clamp(2rem, 9cqh, 4rem); flex-direction: column; margin-bottom: 0.5rem; }
.col-swatch small { font-size: 0.32em; font-weight: 800; letter-spacing: 0.08em; }
.col-group { margin-bottom: 0.15rem; }
.col-group .tw-sub { margin-bottom: 0.1rem; }
.col-ch { margin-bottom: 0.12rem; flex-wrap: nowrap; }
.col-ch .tw-lab { width: 1rem; }
.col-ch input[type="range"] { -webkit-appearance: none; appearance: none; height: 0.8rem; border-radius: 999px; background: var(--trk, #333); border: 1px solid rgba(255, 255, 255, 0.25); margin: 0; }
.col-ch input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: #fff; border: 3px solid var(--tw-ink); box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5); cursor: pointer; }
.col-ch input[type="range"]::-moz-range-thumb { width: 0.8rem; height: 0.8rem; border-radius: 50%; background: #fff; border: 3px solid var(--tw-ink); cursor: pointer; }
.col-ch output { width: 2.8rem; font-size: 0.8rem; }
.col-read { font-variant-numeric: tabular-nums; }
.col-harm-tabs { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.45rem; }
.col-harm-tab { font: inherit; font-size: 0.74rem; font-weight: 800; padding: 0.2rem 0.6rem; border-radius: 999px; border: 2px solid var(--tw-ink); background: #232b57; color: #eef3ff; cursor: pointer; }
.col-harm-tab.is-on { background: var(--tw-gold); color: #1a1204; }
.col-harm { flex: 1 1 0; min-height: 4rem; display: flex; gap: 0.35rem; }
.col-hs { font: inherit; flex: 1 1 0; min-width: 0; border-radius: 12px; border: 3px solid var(--tw-ink); outline: 1px solid rgba(255, 255, 255, 0.3); box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5); cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; padding: 0.4rem 0.2rem; gap: 0.1rem; transition: transform 0.1s ease; }
.col-hs:hover { transform: translateY(-2px); }
.col-hs:focus-visible, .col-harm-tab:focus-visible { outline: 2px solid var(--tw-gold); outline-offset: 2px; }
.col-hs b { font-size: 0.74rem; letter-spacing: 0.02em; }
.col-hs small { font-size: 0.62rem; opacity: 0.85; }
.col-hs.is-base { outline: 2px solid #fff; }
@container twpane (max-width: 900px) and (min-width: 621px) {
  .col-wrap { grid-template-columns: minmax(10rem, 1fr) minmax(14rem, 1.3fr); grid-template-rows: minmax(0, 1fr) auto; }
  .col-right { grid-column: 1 / -1; }
  .col-harm { min-height: 3.6rem; }
}
@container twpane (max-width: 620px) {
  .col-wrap { display: flex; flex-direction: column; height: auto; }
  .col-swatch { flex: 0 0 6rem; }
  .col-mid { overflow: visible; }
  .col-harm { flex: 0 0 5rem; }
}
/* v12.24 sizing pass after the first previews: bigger type where the pane is tall, converter centred in the pane. */
.pt-info { font-size: clamp(0.74rem, 2.5cqh, 0.98rem); }
.sf-card { font-size: clamp(0.76rem, 2.7cqh, 1rem); }
@container twpane (min-width: 621px) {
  .cv-wrap { align-content: center; grid-template-rows: auto auto auto auto; font-size: clamp(0.9rem, 3cqh, 1.15rem); }
  .cv-table { font-size: 1em; }
  .cv-table-wrap { align-self: center; max-height: 100%; }
  .sw-dial { height: min(100cqh - 4.6rem, 48cqw); }
}
.sf-side { overflow: auto; scrollbar-width: thin; scrollbar-color: rgba(127, 233, 255, 0.45) transparent; }

/* ---------- v12.24 clock / dock layout (Dad t2313 h, i, j) ---------- */
/* (h) WHY (Dad: "move the time up slight when both songs and to-do are open, the open space on top is noticeable"): with BOTH panels
   open the clock sat under the whole logo row, leaving an empty band. It now tucks up into the empty middle of that row (the logo is left,
   the timer right, so nothing is under it), and the panels gain that height. Only this one state: closed panels / one panel / toolbox open
   / dock / phone are untouched, and the v12.23 rule (centred by default, raised only while the toolbox is open) stands. */
html:not(.is-phone):not([data-dock-clock="on"]):not([data-lab-chrome="maze"]):not([data-lab-chrome="gate"]) .dash-ui[data-layout="both"]:not(.toolbox-open) .clock-block {
  margin-top: calc(-0.5 * var(--top-row-h, 6rem));
}
/* (i) WHY (Dad: "mars is coming out the box"): the Mars 5-day has an extra report line and a date under every Sol, so with the big analog
   face in the centred layout it ran down into the city cards at 1600x900 and 1280x720. Only for the Mars strip, the face gets a height
   cap so face + label + strip fit above the cities. (The phone/narrow "pill" was the strip's own container collapse, fixed in radio.css.) */
html:not(.is-phone):not([data-dock-clock="on"]) .dash-ui[data-layout="both-min"]:not(.toolbox-open) .clock-block:has(.is-mars-strip) .analog-clock {
  width: min(34vw, 18rem, calc(30vh - 5.5rem));
  height: min(34vw, 18rem, calc(30vh - 5.5rem));
}
/* (j) WHY (Dad: "great stuff on the dock clock love, but the show library and to do go way up during it"): v12.17 lifted the tabs to the top
   of the stage so they never sat on the docked weather/time. They now stay in their normal middle spot, and the dock itself is inset past
   the tabs on both sides, so neither the 5-day (left) nor the clock (right) can run under a tab at any size. */
@media (min-width: 801px) {
  html[data-dock-clock="on"]:not([data-lab-chrome="maze"]):not([data-lab-chrome="gate"]) .restore-tab {
    top: 50%;
    transform: translateY(-50%);
  }
  html[data-dock-clock="on"]:not([data-lab-chrome="maze"]):not([data-lab-chrome="gate"]) .dash-ui[data-layout] .clock-block {
    padding-left: 3.1rem;
    padding-right: 3.1rem;
  }
}
/* (j, part 2) WHY (the 22px dip at 1280x720): the tabs hang from the middle line of the stage (a "transform: none !important" reset
   cancels their old translateY(-50%)), so on a short stage SHOW LIBRARY ran ~22px down into the city cards. Their spot is unchanged
   wherever they fit (1920x1080, 1600x900: same pixels as v12.23); only when the stage is too short do they stop at its bottom edge.
   The heights are the tabs' own (8.5rem / 9.5rem at their 0.86rem type). Desktop only; phone tabs are icon buttons. */
@media (min-width: 801px) {
  html:not(.is-phone) .listen-dash .restore-todo { top: min(50%, calc(100% - 8.85rem)); }
  html:not(.is-phone) .listen-dash .restore-lib { top: min(50%, calc(100% - 9.85rem)); }
}
/* t2314: compact card (set by ptFit in toolbox.js only when the full card would not fit its box) */
.pt-info.is-compact { gap: 0.25rem; padding-top: 0.4rem; padding-bottom: 0.4rem; }
.pt-info.is-compact .pt-row.pt-dup { display: none; }
.pt-info.is-compact .pt-card-head { gap: 0.55rem; }
.pt-info.is-compact .pt-big { width: 4.6em; padding: 0.15rem 0; }
.pt-info.is-compact .pt-big .sym { font-size: 2.3em; }
.pt-info.is-compact .pt-big .num, .pt-info.is-compact .pt-big .ms { font-size: 0.85em; }
.pt-info.is-compact .pt-tags { margin-top: 0.15rem; }
.pt-info.is-compact .pt-facts .nm { font-size: 1.25em; }
.pt-info.is-compact .pt-dl { grid-template-columns: minmax(0, 1fr); gap: 0.08rem; }
.pt-info.is-compact .pt-row { display: grid; grid-template-columns: 40% 1fr; gap: 0.4em; align-items: baseline; padding-bottom: 0.06rem; }
.pt-info.is-compact .pt-row dt { font-size: 0.74em; letter-spacing: 0.03em; }
.pt-info.is-compact .pt-fact { padding: 0.25rem 0.45rem; line-height: 1.28; }
.sf-card.is-compact { padding-top: 0.4rem; padding-bottom: 0.4rem; line-height: 1.25; }
.sf-card.is-compact .sf-card-dl { gap: 0.12rem; }
.sf-side { scrollbar-gutter: stable; }
/* Short panes (1280x720 and similar, the pane is under ~330px tall): everything is laid out to fit without a scrollbar.
   WHY (t2314): a scroller that only overflows on some screens or some picks is exactly the bar that "comes and goes". */
@container twpane (min-width: 621px) and (max-height: 340px) {
  .cv-wrap { font-size: 0.84rem; }
  .cv-num { font-size: 1.45rem; padding: 0.2rem 0.5rem; }
  .cv-kinds { margin-bottom: 0.3rem; }
  .cv-row { margin-bottom: 0.35rem; }
  .cv-swap { width: 2.6rem; height: 2.6rem; }
  .col-mid { gap: 0; }
  .col-group { margin-bottom: 0.05rem; }
  .col-group .tw-sub { margin: 0 0 0.05rem; font-size: 0.66rem; }
  .col-ch { margin-bottom: 0.04rem; }
  .col-ch input[type="range"] { height: 0.7rem; }
  /* stopwatch: buttons beside the dial instead of under it, so the dial (and its digits) get the full height */
  .sw-dialbox { flex-direction: row; gap: 1rem; }
  .sw-btns { flex-direction: column; }
  .sw-dial { height: min(100cqh - 0.8rem, 44cqw); }
}
@container twpane (min-width: 621px) and (max-height: 340px) {
  .pt-credit { font-size: 0.52rem; }
}
/* the mirrored chibi flips about her own middle so she stays inside her column (40% origin pushed her ~20px over the dome) */
.sf-lyra, .pt-lyra { transform-origin: 50% 100%; }
/* dice faces: bigger again after the first previews (Dad: "its really small, plenty of room") */
.dice-out { --die: clamp(3rem, min(30cqh, 13cqw), 8.5rem); }
.dice-out[data-n="5"], .dice-out[data-n="6"] { --die: clamp(2.8rem, min(22cqh, 10cqw), 6.5rem); }
.dice-out[data-n="7"], .dice-out[data-n="8"] { --die: clamp(2.6rem, min(18cqh, 8cqw), 5.6rem); }
/* narrow/phone: the 20px cell floor made the 18 columns ~7px wider than a 390px phone, so the last column (He..Og) was cut.
   Cells now always fit the pane width. */
@container twpane (max-width: 620px) { .pt-body { --c: min(calc((100cqw - 8px) / 18.4), 2.4rem); } }

/* ---------- v12.24 Colour studio (Dad t2316 + t2317): our own wheel, schemes, palette, preview, hover code, info card ----------
   WHY: Dad asked for "something like paletton.com": drag the ring for hue, the inner disc for shade, scheme buttons, My Palette with shades,
   a preview, a code on hover and a card on click. Layout is fixed-size (no content-dependent scrollers) so nothing flashes a scrollbar (t2314). */
.col-wrap { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); gap: 0.9rem; height: 100%; max-width: 92rem; margin: 0 auto; padding: 0 0.5rem; box-sizing: border-box; align-items: stretch; }
.col-wheelbox { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; min-width: 0; gap: 0.15rem; }
.col-wheel { position: relative; width: min(calc(100cqh - 2rem), 42cqw, 34rem); aspect-ratio: 1 / 1; touch-action: none; cursor: crosshair; border-radius: 50%; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.col-wheel:focus-visible { outline: 3px solid var(--tw-gold); outline-offset: 3px; }
.col-wheel canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.col-ring { transition: opacity 0.18s ease; }
.col-wheel.is-disc-drag .col-ring { opacity: 0.38; }
.col-wheel-help, .col-shifthint { margin: 0; text-align: center; font-size: 0.68rem; line-height: 1.2; min-height: 1.2em; }
.col-shifthint { color: #ffd37a; font-weight: 800; }
.col-shifthint[hidden], .col-wheel-help[hidden] { display: none; }
.col-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.col-schemes { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.col-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.8rem; }
.col-fl { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; font-weight: 800; color: #cfe0ff; white-space: nowrap; }
.col-fl.is-off { opacity: 0.45; }
.col-num { width: 3.7rem; padding: 0.15rem 0.3rem; }
.col-main .col-hex { width: 5.9rem; }
.col-chip { width: 1.1rem; height: 1.1rem; border-radius: 4px; border: 2px solid var(--tw-ink); outline: 1px solid rgba(255, 255, 255, 0.4); }
.col-chk input { width: 1rem; height: 1rem; accent-color: #f0c05a; }
.col-main .col-pick { width: 1.9rem; height: 1.6rem; }
.col-btns { display: inline-flex; gap: 0.3rem; }
.col-btns .dash-btn { font-size: 0.72rem; padding: 0.2rem 0.6rem; }
.col-free-hint { margin: 0; }
.col-palette { display: flex; gap: 0.35rem; height: clamp(4.4rem, 17cqh, 7.5rem); flex: 0 0 auto; }
.col-pc { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.col-sw { font: inherit; cursor: pointer; border: 3px solid var(--tw-ink); outline: 1px solid rgba(255, 255, 255, 0.28); padding: 0; box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5); transition: transform 0.08s ease; }
.col-sw:hover { transform: translateY(-1px); outline-color: rgba(255, 255, 255, 0.7); }
.col-sw:focus-visible { outline: 3px solid var(--tw-gold); outline-offset: 1px; }
.col-main-bar { flex: 1 1 auto; min-height: 0; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; letter-spacing: 0.04em; }
.col-main-bar b { font-weight: 800; }
.col-shades { display: flex; gap: 3px; height: 38%; flex: 0 0 auto; }
.col-shade { flex: 1 1 0; min-width: 0; border-radius: 6px; }
.col-views { display: flex; align-items: center; gap: 0.3rem; flex: 0 0 auto; }
.col-views .col-harm-tab { font-size: 0.72rem; padding: 0.15rem 0.6rem; }
.col-views .col-msg { margin-left: auto; font-size: 0.72rem; }
.col-preview { flex: 1 1 0; min-height: 3.2rem; display: flex; gap: 0.35rem; }
.col-preview[hidden], .col-sliders[hidden] { display: none; }
.col-pv { flex: 1 1 0; min-width: 0; position: relative; border-radius: 12px; border: 3px solid var(--tw-ink); outline: 1px solid rgba(255, 255, 255, 0.25); overflow: hidden; box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5); }
.col-pv-hit { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; outline: 0; box-shadow: none; border-radius: 0; background: transparent; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; padding: 0.35rem 0.5rem; text-align: left; }
.col-pv-hit:hover { transform: none; }
.col-pv-hit:focus-visible { outline: 3px solid var(--tw-gold); outline-offset: -5px; }
.col-pv-hit .aa { font-size: clamp(1.2rem, 6cqh, 2.4rem); font-weight: 900; line-height: 1; }
.col-pv-hit .hx { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.05em; opacity: 0.85; }
.col-pv-sqs { position: absolute; right: 0.35rem; bottom: 0.35rem; display: flex; gap: 0.25rem; }
.col-pv-sq { width: clamp(1.15rem, 5cqh, 2rem); aspect-ratio: 1; border-radius: 5px; border-width: 2px; }
.col-sliders { flex: 1 1 0; min-height: 3.2rem; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.2rem 1rem; align-content: start; }
.col-tip { position: absolute; z-index: 8; pointer-events: none; padding: 0.2rem 0.5rem; border-radius: 7px; background: #05070f; color: #fff; border: 2px solid var(--tw-gold); font-size: 0.74rem; white-space: nowrap; box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.55); }
.col-tip[hidden] { display: none; }
.col-tip b { color: var(--tw-gold); letter-spacing: 0.05em; }
/* the info card */
.col-info { position: absolute; inset: 0; z-index: 9; display: flex; align-items: center; justify-content: center; background: rgba(4, 7, 18, 0.62); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); border-radius: 10px; }
.col-info[hidden] { display: none; }
.col-info-box { width: min(44rem, 98%); max-height: 100%; box-sizing: border-box; padding: 0.5rem 0.8rem 0.55rem; border-radius: 12px; border: 2px solid var(--tw-line); background: rgba(8, 12, 30, 0.98); box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.55); display: flex; flex-direction: column; gap: 0.4rem; }
.col-info-head { display: flex; align-items: center; justify-content: space-between; }
.col-info-head h4 { margin: 0; font-size: 0.95rem; color: var(--tw-gold); text-shadow: 1px 1px 0 #000; }
.col-info-x { padding: 0.1rem 0.55rem; }
.col-info-body { display: grid; grid-template-columns: clamp(7rem, 24%, 11rem) minmax(0, 1fr); gap: 0.8rem; min-height: 0; }
.col-info-sw { border-radius: 12px; border: 3px solid var(--tw-ink); outline: 2px solid rgba(255, 255, 255, 0.35); box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.55); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: clamp(2rem, 9cqh, 3.4rem); font-weight: 900; min-height: 6rem; }
.col-info-sw small { font-size: 0.3em; font-weight: 800; letter-spacing: 0.08em; }
.col-info-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.2rem 0.9rem; align-content: start; font-size: 0.8rem; }
.col-ir { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "k cp" "v cp"; align-items: center; column-gap: 0.4rem; border-bottom: 1px dashed rgba(255, 255, 255, 0.14); padding-bottom: 0.12rem; min-width: 0; }
.col-ir .k { grid-area: k; font-size: 0.66rem; letter-spacing: 0.07em; text-transform: uppercase; color: #9fe9ff; font-weight: 800; }
.col-ir .v { grid-area: v; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.col-cp { grid-area: cp; font: inherit; font-size: 0.66rem; font-weight: 800; padding: 0.1rem 0.45rem; border-radius: 999px; border: 2px solid var(--tw-ink); background: #232b57; color: #eef3ff; cursor: pointer; }
.col-cp:hover { background: #2f3a74; }
.col-pf { font-weight: 900; }
.col-pf.is-ok { color: #6ee59a; }
.col-pf.is-no { color: #ff8e9e; }
.col-info-foot { display: flex; align-items: center; gap: 0.5rem; }
.col-info-foot .col-msg { font-size: 0.74rem; }
/* short panes (1280x720): tighter, still no scrollbar */
@container twpane (min-width: 621px) and (max-height: 340px) {
  .col-wrap { gap: 0.7rem; }
  .col-main { gap: 0.3rem; }
  .col-schemes .col-harm-tab { padding: 0.12rem 0.55rem; font-size: 0.7rem; }
  .col-fl { font-size: 0.72rem; }
  .col-num { width: 3.2rem; }
  .col-btns .dash-btn { padding: 0.12rem 0.5rem; font-size: 0.68rem; }
  .col-palette { height: 4.1rem; }
  .col-main-bar { font-size: 0.7rem; }
  .col-info-box { padding: 0.35rem 0.6rem 0.4rem; gap: 0.25rem; }
  .col-info-list { font-size: 0.72rem; gap: 0.1rem 0.8rem; }
  .col-ir { padding-bottom: 0.05rem; }
  .col-info-sw { min-height: 4rem; }
  .col-sliders { gap: 0 0.8rem; }
}
/* phone / narrow: stacked, the pane scrolls like the other tools do */
@container twpane (max-width: 620px) {
  .col-wrap { display: flex; flex-direction: column; height: auto; gap: 0.7rem; padding: 0 0.25rem; }
  .col-wheel { width: min(calc(100cqw - 1.4rem), 22rem); }
  .col-palette { height: 6.5rem; }
  .col-preview { flex: none; height: 9rem; }
  .col-sliders { grid-template-columns: minmax(0, 1fr); }
  .col-info { align-items: flex-start; }
  .col-info-body { grid-template-columns: minmax(0, 1fr); }
  .col-info-sw { min-height: 5rem; }
  .col-info-list { grid-template-columns: minmax(0, 1fr); font-size: 0.86rem; }
  .col-btns { flex-wrap: wrap; }
  .col-views { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { .col-ring, .col-sw { transition: none; } }
.col-views .col-btns { margin-left: auto; }
.col-views .col-msg { margin-left: 0.4rem; min-width: 0; max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =====================================================================================================================
   v12.25 toolbox4 (Dad t2319 / t2320)
   ===================================================================================================================== */
/* --- chibi Lyra facing right: a hand-edited mirrored copy with NO star clip (chibi-lyra-pointer-right.webp), so no CSS flip any more.
   WHY: Dad: "when sophie is facing right her star pin shouldnt be there". The left-facing original keeps the clip. Also a bit bigger
   ("maybe we make her chibi a little bigger too"). */
.pt-lyra, .pt-lyra:not(.tap), .sf-lyra { transform: none; transform-origin: 50% 100%; }
.pt-lyra.tap, .sf-lyra.tap { animation: lyratap 0.55s ease-out; }
@container twpane (min-width: 621px) and (min-height: 341px) { .pt-side { grid-template-columns: minmax(5.2rem, 27%) 1fr; } } /* wider chibi column on tall desktop panes; at 1280x720 the card keeps its width (it needs >= 300px), phone keeps 5.5rem */
/* the legend's last chip row ended exactly on the top of row 4's cells once the table grew a little; 3px of air keeps it clear */
@container twpane (min-width: 621px) { .pt-legend { height: calc(var(--c) * 3 - 6px); } }
.pt-lyra { height: min(100%, 21rem); }
.sf-teach { grid-template-columns: minmax(4.8rem, 31%) 1fr; }
.sf-lyra { max-height: min(100%, 20rem); }

/* --- element card: the atom row at the bottom of the card (Dad t2319: "add like the chemical formula picture thing at the bottom of the card").
   Bohr shell diagram (SVG from electrons per shell) on the left, shells + valence electrons + Lewis dots on the right. It takes the space
   the facts leave (flex-grow) with a readable floor; if the facts need more, the card's normal fit (compact rows, smaller type) kicks in. */
.pt-atom { flex: 1 0 clamp(3.4rem, 16cqh, 6.5rem); min-height: clamp(3.4rem, 16cqh, 6.5rem); max-height: 13rem; display: flex; align-items: stretch; gap: 0.7rem; border-top: 1px dashed rgba(255, 255, 255, 0.14); padding-top: 0.3rem; }
.pt-atom-fig { flex: 0 0 auto; height: 100%; max-height: 12.5rem; aspect-ratio: 1 / 1; }
.pt-bohr { width: 100%; height: 100%; display: block; overflow: visible; }
.pt-orbit { fill: none; stroke: rgba(127, 233, 255, 0.6); stroke-width: 0.8; }
.pt-e { fill: #ffe27a; stroke: #1a1204; stroke-width: 0.35; }
.pt-nuc { stroke: #10142b; stroke-width: 1.2; fill: var(--cat, #f0c05a); }
.pt-nuc-t { fill: #10142b; font-weight: 900; text-anchor: middle; font-family: inherit; }
.pt-atom-line { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 0.6rem; }
.pt-atom-txt { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.pt-atom-k { font-size: 0.78em; letter-spacing: 0.06em; text-transform: uppercase; color: #9fe9ff; font-weight: 700; }
.pt-shells { display: flex; flex-wrap: wrap; gap: 0.18rem; }
.pt-sh { font-size: 0.86em; padding: 0.02rem 0.38rem; border-radius: 999px; background: #1b2250; border: 1px solid #3c4a8a; color: #eef3ff; }
.pt-sh b { color: var(--tw-gold); margin-right: 0.15em; }
.pt-lewis { flex: 0 0 auto; height: min(100%, 5.2rem); aspect-ratio: 1 / 1; width: auto; display: block; margin-left: auto; }
.pt-lewis-t { fill: #eef3ff; font-weight: 900; text-anchor: middle; font-family: inherit; }
@container twpane (max-width: 620px) { .pt-atom { flex: 0 0 auto; height: 7.5rem; } }
.pt-atom.is-tiny { display: none; }
.pt-info.is-compact .pt-atom-txt { gap: 0.1rem; }
.pt-info.is-compact .pt-atom { padding-top: 0.15rem; flex-basis: 3.1rem; min-height: 3.1rem; }
/* the four "dup" rows (number, mass, family, state) are already in the big tile and the tags, so the card drops them to give the diagram room */
.pt-info.has-atom .pt-row.pt-dup { display: none; }
/* short panes (1280x720): the bottom atom row has no room, so a small Bohr diagram sits at the right of the head row (that space is free) */
.pt-atom-mini { display: none; margin-left: auto; flex: 0 0 auto; align-self: center; height: clamp(3.2rem, 15cqh, 4.6rem); aspect-ratio: 1 / 1; }
.pt-info.atom-mini .pt-atom-mini { display: block; }
.pt-atom-mini .pt-atom-fig { height: 100%; }

/* --- constellation card: the stick-figure shape fills the free space at the bottom (Dad t2319) --- */
.sf-card { display: flex; flex-direction: column; }
.sf-card > * { flex: 0 0 auto; }
.sf-card > .sf-shape { flex: 1 0 clamp(4rem, 20cqh, 7rem); min-height: clamp(4rem, 20cqh, 7rem); max-height: 15rem; display: flex; flex-direction: column; margin-top: 0.4rem; border-top: 1px dashed rgba(255, 255, 255, 0.14); padding-top: 0.25rem; }
.sf-shape.is-tiny { display: none !important; }
.sf-shape-k { font-size: 0.76em; letter-spacing: 0.08em; text-transform: uppercase; color: #9fb3d9; font-weight: 800; }
.sf-shape-svg { flex: 1 1 auto; min-height: 0; width: 100%; height: 100%; display: block; }
.sf-sh-line { fill: none; stroke: #7fe9ff; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; opacity: 0.85; }
.sf-sh-star { fill: #fff4c2; stroke: #0a0f24; stroke-width: 0.6; }
.sf-sh-bright { fill: none; stroke: #f0c05a; stroke-width: 1.3; }
.sf-sh-label { fill: #f0c05a; font-size: 8.5px; font-weight: 800; font-family: inherit; paint-order: stroke; stroke: #0a0f24; stroke-width: 2.4px; }
@container twpane (max-width: 560px) { .sf-card > .sf-shape { flex: 0 0 auto; height: 8rem; } }

/* --- stopwatch fits (Dad t2319 "stop watch dont fit on screen"): the dial's size comes from the pane height, with room kept above it for
   the star clip (it pokes ~9% above the ring) and the buttons always sit beside the dial on desktop, so nothing touches the panel edges at
   1920x1080, 1600x900 or 1280x720. Phones stack dial, buttons, laps, with the same headroom for the clip. */
@container twpane (min-width: 621px) {
  .sw-dialbox { flex-direction: row; gap: clamp(0.8rem, 2cqw, 1.6rem); justify-content: center; align-items: center; padding: 0; }
  .sw-btns { flex-direction: column; }
  .sw-dial { --d: min(calc((100cqh - 1.2rem) / 1.12), 40cqw); height: var(--d); width: var(--d); min-height: 0; margin-top: calc(var(--d) * 0.1); margin-bottom: 0; }
  .sw-btn { min-width: 6.2rem; }
}
@container twpane (min-width: 621px) and (max-height: 340px) {
  .sw-btn { font-size: 0.95rem !important; padding: 0.4rem 1rem !important; min-width: 5.4rem; }
}
@container twpane (max-width: 620px) {
  .sw-dial { margin-top: calc(min(80cqw, 17rem) * 0.11); }
}

/* ---- v12.25 dice (Dad t2319) ---- */
/* WHY: "at the bottom of d100 it says text": the faint data-sides corner label read as stray text. The die type is already in the total line and history, so the label goes everywhere. */
.die::after { content: none !important; display: none !important; }
/* WHY: "d4 is cut off the numbers": the old padding-top:18% was a percent of the dice ROW's width (CSS % padding), not the die's, so on a wide
   table it pushed the number out of the bottom of the triangle. Use the die size instead and centre on the triangle's centroid (~64% down). */
.die-tri { align-items: center; padding-top: calc(var(--die) * 0.26); font-size: calc(var(--die) * 0.34); line-height: 1; }
/* WHY: "d6 has no numbers": pips were inline <i>s, so their width/aspect-ratio never applied and they drew as specks. Make them real dots, and print the number too (a gold label under each die). */
/* Same root cause as d4: padding:14% / gap:4% were percents of the row width, which squashed the 3x3 pip grid to nothing on wide tables. */
.die-pips { padding: calc(var(--die) * 0.13); gap: calc(var(--die) * 0.03); }
.die-pips .pip { display: block; width: 78%; }
.die-pips { overflow: visible; margin-bottom: calc(var(--die) * 0.22); }
.die-pips .die-v { position: absolute; width: auto; height: auto; overflow: visible; clip-path: none; left: 50%; top: calc(100% + 0.3em); transform: translateX(-50%); font-size: 0.42em; line-height: 1; color: #ffd37a; text-shadow: 1px 1px 0 #000; }

/* Who rolled? */
.dice-who { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px dashed rgba(127, 233, 255, 0.25); }
.dice-who .tw-sub { margin: 0; }
.dw-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; min-height: 1.9rem; align-items: center; }
.dw-none { font-size: 0.78rem; color: #8fa2c8; }
.dw-chip { display: inline-flex; align-items: stretch; border-radius: 999px; border: 2px solid rgba(127, 233, 255, 0.4); background: rgba(10, 16, 40, 0.6); overflow: hidden; }
.dw-chip.is-on { border-color: #ffd37a; background: rgba(255, 211, 122, 0.18); box-shadow: 0 0 0 2px rgba(255, 211, 122, 0.25); }
.dw-pick, .dw-x { font: inherit; border: 0; background: none; color: #e9f0ff; cursor: pointer; }
.dw-pick { padding: 0.2rem 0.3rem 0.2rem 0.65rem; font-size: 0.85rem; font-weight: 800; display: inline-flex; gap: 0.35rem; align-items: center; }
.dw-chip.is-on .dw-pick { color: #ffd37a; }
.dw-chip.is-on .dw-pick::before { content: "\25B6"; font-size: 0.6em; }
.dw-tot { background: #ffd37a; color: #2a1c04; border-radius: 999px; padding: 0 0.4rem; font-size: 0.75rem; }
.dw-x { padding: 0 0.55rem 0 0.3rem; font-size: 1rem; color: #9fb3d9; }
.dw-x:hover, .dw-x:focus-visible { color: #ff9ec7; }
.dw-add { display: flex; gap: 0.35rem; }
.dw-name { flex: 1 1 auto; min-width: 0; }
.dw-addbtn { font-size: 0.8rem !important; }
.dw-opts { display: flex; gap: 0.9rem; font-size: 0.78rem; color: #b9c6e4; }
.dw-opts label { display: inline-flex; gap: 0.3rem; align-items: center; cursor: pointer; }
.dw-tag { color: #7fe9ff; font-weight: 800; }
.dice-log li.is-new .dw-tag { color: #7fe9ff; }
.dice-log { scrollbar-gutter: stable; }
@container twpane (max-height: 520px) and (min-width: 621px) {
  .dw-opts, .dw-none { font-size: 0.72rem; }
  .dice-who { gap: 0.25rem; margin-bottom: 0.3rem; padding-bottom: 0.3rem; }
  .dw-chips { min-height: 1.6rem; }
  .dw-pick { font-size: 0.78rem; padding-top: 0.1rem; padding-bottom: 0.1rem; }
}

/* LYRA coin: two gen'd faces on a 3D disc; rotateY flip ends on the rolled face. */
.lyra-coin { position: relative; width: calc(var(--die) * 1.5); height: calc(var(--die) * 1.5); perspective: 900px; display: inline-block; }
.lc-spin { position: absolute; inset: 0; transform-style: preserve-3d; border-radius: 50%; }
.lc-face { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; backface-visibility: hidden; -webkit-backface-visibility: hidden; filter: drop-shadow(3px 5px 0 rgba(0, 0, 0, 0.55)); user-select: none; }
.lc-t { transform: rotateY(180deg); }
.lyra-coin .die-v { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.lyra-coin.is-heads .lc-spin { transform: rotateY(0deg); animation: lcflipH 1.1s cubic-bezier(.25, .7, .3, 1) both; }
.lyra-coin.is-tails .lc-spin { transform: rotateY(180deg); animation: lcflipT 1.1s cubic-bezier(.25, .7, .3, 1) both; }
@keyframes lcflipH { 0% { transform: translateY(0) rotateY(0deg); } 40% { transform: translateY(-18%) rotateY(900deg); } 100% { transform: translateY(0) rotateY(1440deg); } }
@keyframes lcflipT { 0% { transform: translateY(0) rotateY(0deg); } 40% { transform: translateY(-18%) rotateY(1000deg); } 100% { transform: translateY(0) rotateY(1620deg); } }
@media (prefers-reduced-motion: reduce) { .lyra-coin .lc-spin { animation: none !important; } }

/* ---- v12.25 colour: wheel + palette shifted left, info card as a fixed right column (Dad t2319) ----
   WHY: Dad: "bump it all to the left and add the colour card to the right hand side where it would fit instead of a full pop up".
   Three fixed columns (wheel | controls | card); the card always shows the base colour or the clicked swatch. Fixed sizes, no scrollers (t2314). */
@container twpane (min-width: 621px) {
  .col-wrap { grid-template-columns: auto minmax(0, 1fr) clamp(13.5rem, 24cqw, 21rem); max-width: none; margin: 0; }
  .col-wheel { width: min(calc(100cqh - 2rem), 30cqw, 32rem); }
  .col-info { position: static; inset: auto; z-index: auto; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; display: flex; align-items: stretch; justify-content: stretch; min-height: 0; min-width: 0; overflow: hidden; }
  .col-info-box { width: 100%; height: 100%; max-height: none; padding: 0.45rem 0.6rem 0.5rem; gap: 0.35rem; box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.5); }
  .col-info-body { display: flex; flex-direction: column; gap: 0.35rem; flex: 1 1 auto; min-height: 0; }
  .col-info-sw { flex: 1 1 3rem; min-height: 2.6rem; max-height: 7rem; font-size: clamp(1.4rem, 7cqh, 2.6rem); flex-direction: row; gap: 0.6rem; }
  .col-info-sw small { font-size: 0.42em; }
  .col-info-list { grid-template-columns: minmax(0, 1fr); gap: 0; font-size: 0.74rem; flex: 0 0 auto; }
  .col-ir { grid-template-columns: 6.6rem minmax(0, 1fr) auto; grid-template-areas: "k v cp"; padding: 0.08rem 0; }
  .col-ir .k { font-size: 0.6rem; }
  .col-ir .v { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
  .col-cp { font-size: 0.6rem; padding: 0 0.4rem; }
  .col-info-foot { flex-wrap: nowrap; }
  .col-info-foot .dash-btn { font-size: 0.7rem; padding: 0.15rem 0.55rem; white-space: nowrap; }
  .col-info-foot .col-msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .col-info-head h4 { font-size: 0.85rem; }
}
.col-info:not(.is-pinned) .col-info-x { visibility: hidden; }
.col-info-x { font-size: 0.68rem; }
.col-info-base:disabled, #col-info-base:disabled { opacity: 0.45; cursor: default; }
/* short panes (1280x720): the WCAG luminance row and the RGB % row give way so the card never needs a scrollbar */
@container twpane (min-width: 621px) and (max-height: 340px) {
  .col-info-list { font-size: 0.68rem; }
  .col-ir { padding: 0; }
  .col-ir:nth-child(3), .col-ir:nth-child(7) { display: none; }
  .col-info-sw { min-height: 1.9rem; font-size: 1.2rem; }
  .col-info-box { padding: 0.3rem 0.5rem 0.35rem; gap: 0.25rem; }
  .col-info-body { gap: 0.25rem; }
}
/* narrow / phone: card stacks under the palette, full width */
@container twpane (max-width: 620px) {
  .col-info { position: static; inset: auto; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; display: block; }
  .col-info-box { width: 100%; }
}
@container twpane (min-width: 621px) {
  .col-main { flex-wrap: nowrap; } /* an old v12.2x rule let the preview wrap into a new column, under the card */
  .col-wheelbox { max-width: 31cqw; }
}
@container twpane (min-width: 621px) and (max-height: 340px) {
  .col-wheel { width: min(calc(100cqh - 2rem), 26cqw); }
  .col-wheelbox { max-width: 27cqw; }
  .col-wrap { grid-template-columns: auto minmax(0, 1fr) clamp(12.5rem, 23cqw, 16rem); }
  /* the card already has Copy hex and a Copy on the rgb() row, so the duplicate buttons step aside to keep one row */
  #col-copy-hex, #col-copy-rgb { display: none; }
  .col-schemes { gap: 0.2rem; }
  .col-preview { min-height: 2.6rem; }
}
@container twpane (min-width: 621px) and (max-height: 340px) {
  .col-wrap { grid-template-columns: auto minmax(0, 1fr) clamp(12.5rem, 25cqw, 16rem); }
  .col-ir { grid-template-columns: 4.3rem minmax(0, 1fr) auto; column-gap: 0.25rem; }
  .col-ir .k { font-size: 0.55rem; letter-spacing: 0.02em; }
  .col-cp { font-size: 0; padding: 0.05rem 0.3rem; line-height: 1; } /* short panes: the per-row Copy shrinks to an icon (aria-label still says Copy X) */
  .col-cp::after { content: ""; display: block; width: 0.42rem; height: 0.48rem; margin: 0.05rem 0.08rem 0.12rem 0; border: 1.5px solid currentColor; border-radius: 2px; box-shadow: 2.5px 2.5px 0 -0.5px #232b57, 2.5px 2.5px 0 1px currentColor; }
}

/* ---- v12.25 main menu "Lyra's Pocket Lab" (Dad t2319/t2320) ----
   WHY: Dad wanted a first screen with bigger buttons to pick from, a better name than Toolbox, and Lyra on the side. Seven big buttons
   (icon, name, one line), a fixed 4x2 grid on desktop so nothing scrolls, Lyra standing on the right looking at them. Tabs stay; the
   house "Menu" button comes back here. */
.tw-home { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 0.3rem; font: inherit; font-size: 0.78rem; font-weight: 800; padding: 0.22rem 0.7rem 0.22rem 0.55rem; border-radius: 999px; border: 2px solid var(--tw-ink); outline: 1px solid rgba(255, 255, 255, 0.25); background: #1b5a6e; color: #eafcff; cursor: pointer; box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5); }
.tw-home:hover { background: #237390; }
.tw-home[aria-pressed="true"] { background: #7fe9ff; color: #06202a; }
.tw-home:focus-visible { outline: 2px solid var(--tw-gold); outline-offset: 1px; }
.tw-title { text-transform: none; letter-spacing: 0.04em; }
.tw-menu { overflow: clip; }
.twm-wrap { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.8rem; max-width: 84rem; margin: 0 auto; padding: 0 0.4rem; box-sizing: border-box; }
.twm-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; gap: 0.35rem; }
.twm-title { margin: 0.1rem 0 0; font-family: var(--display, inherit); font-size: clamp(1.3rem, 7cqh, 2.4rem); line-height: 1.05; color: var(--tw-gold); text-shadow: 3px 3px 0 #000; letter-spacing: 0.02em; }
.twm-sub { margin: 0 0 0.2rem; font-size: clamp(0.72rem, 2.6cqh, 0.95rem); color: #b9c6e4; }
.twm-grid { flex: 1 1 0; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: clamp(0.4rem, 1.8cqh, 0.9rem); }
.twm-btn { font: inherit; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: clamp(0.2rem, 1.4cqh, 0.6rem); text-align: left; padding: clamp(0.4rem, 2.2cqh, 1.1rem) clamp(0.55rem, 1.6cqw, 1.1rem); border-radius: 16px; border: 3px solid var(--tw-ink); outline: 1px solid rgba(255, 255, 255, 0.25); background: linear-gradient(160deg, #2a3570, #1a2150); color: #eef3ff; cursor: pointer; box-shadow: 3px 4px 0 rgba(0, 0, 0, 0.55); transition: transform 0.1s ease, background 0.1s ease; overflow: hidden; }
.twm-btn:hover { transform: translateY(-2px); background: linear-gradient(160deg, #34418a, #222a63); }
.twm-btn:focus-visible { outline: 3px solid var(--tw-gold); outline-offset: 2px; }
.twm-ico { width: clamp(1.6rem, 11cqh, 3.4rem); height: clamp(1.6rem, 11cqh, 3.4rem); flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.twm-ico .f { fill: currentColor; stroke: none; }
.twm-txt { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.twm-name { font-size: clamp(0.9rem, 4.4cqh, 1.35rem); font-weight: 900; line-height: 1.1; }
.twm-desc { font-size: clamp(0.66rem, 2.6cqh, 0.88rem); line-height: 1.25; color: #b9c6e4; }
.twm-calc .twm-ico { color: #ffd37a; } .twm-ptable .twm-ico { color: #b6ef6a; } .twm-stars .twm-ico { color: #7fe9ff; }
.twm-convert .twm-ico { color: #ff9ec7; } .twm-stopwatch .twm-ico { color: #ffb347; } .twm-dice .twm-ico { color: #8ea2ff; } .twm-colour .twm-ico { color: #ff7a7a; }
.twm-lyra { align-self: end; height: min(100%, 26rem); width: auto; max-width: 18cqw; object-fit: contain; object-position: bottom; filter: drop-shadow(3px 4px 0 rgba(0, 0, 0, 0.5)); pointer-events: none; user-select: none; }
/* short panes (1280x720): name + icon side by side, description stays one line */
@container twpane (min-width: 621px) and (max-height: 340px) {
  .twm-btn { flex-direction: row; align-items: center; }
  .twm-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
/* narrow / phone: two columns, Lyra small at the top right, the pane may scroll like the other tools */
@container twpane (max-width: 620px) {
  .twm-wrap { display: block; height: auto; position: relative; padding: 0 0.2rem 0.6rem; }
  .twm-title { font-size: 1.5rem; padding-right: 5.5rem; }
  .twm-sub { padding-right: 5.5rem; font-size: 0.8rem; }
  .twm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; grid-auto-rows: auto; margin-top: 0.4rem; }
  .twm-btn { padding: 0.7rem; gap: 0.4rem; }
  .twm-ico { width: 2.2rem; height: 2.2rem; }
  .twm-name { font-size: 1rem; } .twm-desc { font-size: 0.78rem; }
  .twm-lyra { position: absolute; right: 0.2rem; top: -0.2rem; height: 6.4rem; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .twm-btn { transition: none; } }
html.is-phone .tw-home { order: 2; padding: 0.3rem 0.7rem; }
@container twpane (min-width: 621px) {
  .twm-wrap { grid-template-rows: minmax(0, 1fr); }
  .twm-lyra { height: 100%; max-height: 26rem; min-height: 0; }
}
@container twpane (max-width: 620px) { .twm-grid { flex: none; } .twm-main { display: block; } }

/* ---- v12.26 (Dad t2325 "can we spread out the calc and have lyra on the side saying the answers too, thatd be cute") ----
   WHY: the keypad sat in the middle with a big empty area on the left. Wide (scientific) mode now stretches the keypad
   across the free width, and the left-facing chibi (the approved original, with her clip) stands between the keys and the
   tape, pointing at the keys, with a bubble that says the answer. Narrow / phone: unchanged (no room for her). */
.calc-wrap { justify-content: center; }
.calc[data-mode="sci"] { flex: 1 1 auto; width: auto; max-width: 62rem; }
.calc-lyra { display: none; }
.calc-is-sci .calc-lyra {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  width: clamp(8rem, 17cqw, 13rem); margin: 0; min-height: 0; position: relative;
}
.calc-lyra-img { display: block; width: auto; height: min(74cqh, 21rem); max-width: 100%; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45)); }
.calc-bubble {
  position: relative; margin: 0 0 0.7rem; padding: 0.45rem 0.8rem; max-width: 100%; box-sizing: border-box;
  background: #fffaf0; color: #1a1430; border: 3px solid var(--tw-ink, #10142b); border-radius: 18px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
  font-weight: 800; font-size: clamp(1.1rem, 4cqh, 1.7rem); line-height: 1.1; text-align: center;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere; transform-origin: 50% 100%;
}
.calc-bubble::after {
  content: ""; position: absolute; left: 50%; bottom: -13px; width: 16px; height: 16px; margin-left: -8px;
  background: #fffaf0; border-right: 3px solid var(--tw-ink, #10142b); border-bottom: 3px solid var(--tw-ink, #10142b);
  transform: rotate(45deg); border-bottom-right-radius: 4px;
}
.calc-bubble.is-long { font-size: clamp(0.9rem, 3cqh, 1.2rem); }
.calc-bubble.is-xlong { font-size: 0.8rem; }
.calc-bubble.is-err { color: #a3153f; font-size: clamp(0.85rem, 2.8cqh, 1.05rem); }
.calc-bubble.is-pop { animation: calcBubblePop 0.32s ease-out; }
@keyframes calcBubblePop { 0% { transform: scale(0.6); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .calc-bubble.is-pop { animation: none; } }
html.is-phone .calc-lyra { display: none !important; }

/* ---- v12.26 (Dad t2325 "can we make sophie bigger in teh p-table?") ----
   WHY: Dad boxed the whole column under the noble gases, left of the element card, down to the bottom. The table is
   height-limited on desktop, so the chibi column now takes as much as a full-height chibi needs (~0.56 x the table
   height), but never squeezes the card under 300px (the card's floor since v12.24). She stands on the bottom edge and
   fills the column's height. */
@container twpane (min-width: 621px) {
  .pt-side { grid-template-columns: minmax(5.2rem, min(calc(var(--c) * 9.4 * 0.56), calc(100% - 300px - 0.35rem))) 1fr; }
  .pt-teacher { display: flex; align-items: flex-end; justify-content: center; }
  .pt-lyra { position: static; display: block; height: 100%; max-height: none; width: 100%; max-width: 100%; object-fit: contain; object-position: 50% 100%; }
}

/* ---- v12.26 (Dad t2325 "sophie can def be bigger on the constelaion screen") ----
   WHY: Dad boxed the whole column between the sky globe and the Sky Lesson card. The lists column gives up a little width
   (it scrolls anyway), the chibi column grows to what a full-height chibi needs (~0.56 x pane height, at most 45% of the
   middle), and she fills that column from the bottom edge up. Phone / narrow layouts keep their own rules. */
@container twpane (min-width: 621px) {
  .sf-wrap { grid-template-columns: auto minmax(15rem, 1.5fr) minmax(12rem, 0.85fr); }
  .sf-teach { grid-template-columns: minmax(4.8rem, min(calc(100cqh * 0.56), 45%)) 1fr; }
  .sf-lyra { align-self: stretch; justify-self: stretch; width: 100%; height: 100%; max-height: none; max-width: 100%; object-fit: contain; object-position: 50% 100%; }
}

/* ---- v12.26 (Dad t2325 "the stop watch cuts off on the left") ----
   WHY: the dial was sized from the pane (height, or 40% of the pane's width) but sits in a row with the buttons inside
   the left grid column. When that column was narrower than dial + gap + buttons (narrower windows, other fonts), the
   centred row overflowed both ways and .sw-wrap's clip cut the ring's left side. Now the dial box is its own width
   container, the dial can never be wider than (box - buttons - gap), and "safe center" keeps any overflow off the left. */
@container twpane (min-width: 621px) {
  .sw-dialbox { container: swbox / inline-size; min-width: 0; justify-content: safe center; gap: clamp(0.7rem, 3cqw, 1.4rem); }
  .sw-dial { --d: max(7rem, min(calc((100cqh - 1.2rem) / 1.12), calc(100cqw - 8.4rem))); }
  .sw-btns { flex: 0 0 auto; }
}

/* ---- v12.26 (Dad t2325): painter chibi in the colour card's free space, bottom right ----
   WHY: Dad drew her in the empty space at the bottom of the Base colour card. She is an image edit of the approved chibi
   (same face, hair, ahoge star and star clip; smock, beret, palette and brush added), front-facing so the clip shows.
   The swatch gives up a little height and the spot takes what is left; if that is under ~3.7rem she steps
   aside so nothing ever needs a scrollbar. Phones (stacked card) do not show her. */
.col-painter-spot { display: none; }
@container twpane (min-width: 621px) {
  .col-info-sw { flex: 0 0 auto; height: clamp(2.4rem, 8cqh, 3.4rem); min-height: 0; max-height: none; font-size: clamp(1.2rem, 5cqh, 2rem); }
  .col-painter-spot { display: flex; flex: 2 1 0; min-height: 0; justify-content: flex-end; align-items: flex-end; container: colpaint / size; margin-bottom: calc(-0.35rem - 1.9rem); pointer-events: none; position: relative; z-index: 1; }
  .col-painter { display: block; height: 100%; max-height: 15rem; width: auto; max-width: 100%; object-fit: contain; object-position: 100% 100%; filter: drop-shadow(2px 3px 0 rgba(0, 0, 0, 0.5)); }
  .col-info-foot { position: relative; z-index: 2; padding-right: 0; }
}
@container colpaint (max-height: 3.7rem) { .col-painter { display: none; } }

/* ---- v12.26 (Dad t2326 "move the stop watch to the left and have sophie chibi holding a stopwatch with a little bubble of her announcing
   the start or stop or lap when it's clicked") ----
   WHY: layout is now  dial (left, buttons in a compact row under it) | Sophie holding a stopwatch, where the button column used to be |
   laps (right). The dial is sized from the pane height minus the button row, and from its own column width, so it can never spill
   (the t2325 overflow fix still holds). The bubble is positioned beside her head and never covers the dial or the laps.
   Narrow / phone panes: unchanged stacked layout, and Sophie is not shown (no room). */
.sw-sophie { display: none; }
@container twpane (min-width: 621px) {
  .sw-wrap { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.8fr) minmax(12rem, 1fr); gap: clamp(0.6rem, 2cqw, 1.4rem); max-width: 80rem; }
  .sw-dialbox { flex-direction: column; justify-content: safe center; align-items: center; gap: clamp(0.5rem, 2cqh, 0.9rem); }
  .sw-dial { --d: max(7rem, min(calc((100cqh - 4.6rem) / 1.12), 100cqw)); height: var(--d); width: var(--d); margin-top: calc(var(--d) * 0.04); margin-bottom: 0; }
  .sw-btns { flex-direction: row; flex-wrap: nowrap; gap: 0.5rem; justify-content: center; max-width: 100%; }
  .sw-btn { font-size: 0.95rem !important; min-width: 0; padding: 0.4rem 1.1rem !important; }
  .sw-sophie { display: flex; align-items: flex-end; justify-content: center; margin: 0; min-height: 0; min-width: 0; }
  .sw-sophie-in { position: relative; height: min(100cqh - 0.4rem, 26rem); aspect-ratio: 280 / 556; max-width: 100%; }
  .sw-sophie-img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.45)); }
  .sw-bubble { position: absolute; left: 74%; top: 7%; margin: 0; width: max-content; max-width: 9rem; z-index: 2; font-size: clamp(1rem, 4.2cqh, 1.5rem); transform-origin: 0% 100%; }
  .sw-bubble[hidden] { display: none; }
  .sw-bubble::after { left: 14px; margin-left: 0; bottom: -13px; }
}
@container twpane (max-height: 340px) and (min-width: 621px) {
  .sw-btn { font-size: 0.85rem !important; padding: 0.3rem 0.8rem !important; }
  .sw-dial { --d: max(6rem, min(calc((100cqh - 3.6rem) / 1.12), 100cqw)); }
}
.sw-orbit-star { transform-origin: 100px 14px; transform: scale(1.35); }
html.is-phone .sw-sophie { display: none !important; }

/* ---- v12.26 (Dad t2326 "can we swap sophie in the calc with the answers it would flow better") ----
   WHY: the tape is what you read right after pressing keys, so it now sits beside the keypad and Lyra with the answer bubble
   stands at the far right (DOM order is keypad, tape, Lyra; no CSS reordering). */
.calc-is-sci .calc-side { flex: 1 1 12rem; max-width: 18rem; }
.calc-is-sci .calc-lyra { margin-left: auto; }
