/* ════════════════════════════════════════════════════════════════════════════
   guess.css — styling for the "guess" frontend (guess.html / guess.js).

   The guess mode reuses the whole soup shell (viewport + burger menu + optimize
   dock). It is a copy of soup.css so the two can drift independently; the only
   real difference is the prompt: instead of an editable prompt box, the dock
   shows a hidden ("masked") prompt display that is only unblurred once the user
   presses Reveal. The guess-specific rules live at the very end of the file.
   ════════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Fonts ─────────────────────────────────────────────────────────────── */
  --font-ui: 'Courier New', Courier, monospace;
  --font-mono: 'Courier New', Courier, monospace;

  /* ── Metrics ───────────────────────────────────────────────────────────── */
  --menu-bar-h: 30px;   /* top menu bar height (border-box) */

  /* ── Text colours ──────────────────────────────────────────────────────── */
  --c-label-text: #4b4b4b;         /* widget + field labels */
  --c-header-text: #000000;        /* headers */
  --c-text: #333333;               /* default body text */
  --c-text-muted: #777777;         /* values, readouts, counts */
  --c-editable-text: #000000;      /* text / number input content */

  /* ── Surfaces & borders ────────────────────────────────────────────────── */
  --c-panel-bg: #ffffff;           /* panels, toolbars, dialogs */
  --c-editable-bg: #ffffff3d;      /* text / number input background */
  --c-border: #000000;             /* hairline borders, dividers */

  /* ── General concepts ──────────────────────────────────────────────────── */
  --c-highlight: #cfe7e5;          /* hover */
  --c-selected: #ff7e15;           /* selection accent */
  --c-selected-entity: var(--c-selected); /* selected entity (read by guess.js) */
  --c-emphasis: #ff8c00;           /* transient op-group emphasis (read by guess.js) */

  /* ── Scrollbars ────────────────────────────────────────────────────────── */
  --c-scrollbar: rgba(0, 0, 0, 0.3);
  --c-scrollbar-hover: var(--c-highlight);

  /* ── Controls ──────────────────────────────────────────────────────────── */
  --c-checkbox-bg: #ffffff;
  --c-checkbox-checked: var(--c-selected);

  --c-button-bg: #ffffff;
  --c-button-bg-hover: var(--c-highlight);
  --c-button-bg-active: var(--c-highlight);

  --c-dropdown-bg: var(--c-editable-bg);

  --c-slider-track: #00000048;
  --c-slider-thumb: #ffffff;
  --c-slider-thumb-hover: var(--c-highlight);

  font-family: var(--font-ui);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0px;
  padding: 0;
  width: 100%;
  height: 100%;

  /* Firefox: always-visible thin scrollbar when content overflows. */
  scrollbar-width: thin;
  scrollbar-color: var(--c-scrollbar) transparent;

  overflow: hidden;
}

/* ── Top menu bar (reused by the burger menu) ─────────────────────────────── */
.menu-bar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  height: var(--menu-bar-h);
  background: var(--c-panel-bg);
  /* border-bottom: 1px solid var(--c-border); */
  user-select: none;
  font-size: 1.0rem;
}

.menu-bar__item {
  position: relative;
  display: flex;
}

.menu-bar__top {
  border: none;
  background: transparent;
  color: inherit;
  padding: 12px;
  cursor: pointer;
  font: inherit;
}

.menu-bar__top:hover,
.menu-bar__top--open {
  background: var(--c-highlight);
}

.menu-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 2000;
  min-width: 200px;
  padding: 4px 0;
  background: var(--c-panel-bg);
  border: none; /*1px solid var(--c-border);*/
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.menu-dropdown--sub {
  top: -5px;              /* align with the parent row, past the panel padding */
  left: 100%;
  max-height: 70vh;
  overflow-y: auto;
}

.menu-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 8px;
  cursor: pointer;
  white-space: nowrap;
}

.menu-row:hover {
  background: var(--c-highlight);
}

.menu-row--disabled {
  opacity: 0.4;
  cursor: default;
}
.menu-row--disabled:hover {
  background: transparent;
}

.menu-row__check {
  flex: 0 0 auto;
  width: 1em;
  text-align: center;
}

.menu-row__label {
  flex: 1 1 auto;
}

.menu-row__hint {
  flex: 0 0 auto;
  margin-left: 16px;
  opacity: 0.6;
}

.menu-sep {
  height: 1px;
  margin: 4px 0;
  background: var(--c-border);
}

/* ── Soup dialog chrome (reused by the Recipe dialog) ─────────────────────── */
.soup-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(255, 183, 183, 0.35);
}

.soup-dialog {
  min-width: 320px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: var(--c-panel-bg);
  border: none; /*1px solid var(--c-border); */
  border-radius: 6px;
  color: var(--c-text);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.soup-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--c-header-text);
}

.soup-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--c-label-text);
}

.soup-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.soup-btn {
  padding: 5px 16px;
  background: var(--c-button-bg);
  border: none; /* 1px solid var(--c-border); */
  border-radius: 3px;
  cursor: pointer;
  color: var(--c-text);
}

.soup-btn:hover {
  background: var(--c-button-bg-hover);
}

.soup-btn--primary {
  font-weight: 700;
}

/* ── Recipe dialog (tabbed: Soup / Grid / Pixels / Shape / Curve) ─────────────
   Its .recipe-* rules live with the component, in
   modules/graph/ui/recipe_dialog.css, which recipe_dialog.js injects on open.
   Only the .soup-* chrome it borrows (above) and the design tokens are ours. */

/* ════════════════════════════════════════════════════════════════════════════
   INPUT CONTROLS — styled by element type (shared by the dialogs above)
   ════════════════════════════════════════════════════════════════════════════ */

button {
  margin : 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: none;
  border-radius: 0px;
  background: var(--c-button-bg);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-ui);
  user-select: none;
  transition: background 0.1s;
}
button:hover { background: var(--c-button-bg-hover); }
button:active { background: var(--c-button-bg-active); }

/* select elements / dropdowns */
select {
  margin : 4px;
  width: 100%;
  padding: 2px 4px;
  border: none;
  border-radius: 3px;
  background: var(--c-dropdown-bg);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-ui);
}

input {
  margin : 4px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
}

input[type="range"] {
  width: 100%;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;  /* hide the default track */
  height: 20px;           /* control height — track will fill this */
}

/* ── Chromium / Safari ── */
input[type="range"]::-webkit-slider-runnable-track {
  height: 100%;
  border: none;
  border-radius: 6px;
  background: var(--c-slider-track);
  padding: 4px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: 0px;        /* centre thumb: (track 20px - thumb 12px) / 2 */
  border: none;
  border-radius: 6px;
  background: var(--c-slider-thumb);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb:hover { background: var(--c-slider-thumb-hover); }

/* ── Firefox ── */
input[type="range"]::-moz-range-track {
  height: 100%;
  border: none;
  border-radius: 6px;
  background: var(--c-slider-track);
}
input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: none;
  border-radius: 6px;
  background: var(--c-slider-thumb);
  cursor: pointer;
}

input[type="text"],
input[type="number"],
textarea {
  width: 100%;
  padding: 2px 5px;
  border: none;
  border-radius: 3px;
  font-size: 0.8rem;
  background: var(--c-editable-bg);
  color: var(--c-editable-text);
}
input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus { outline: none; }

/* Fully custom checkbox: native rendering ignores background on the unchecked
   box (accent-color only tints the checked fill), so we opt out with
   appearance:none and draw the box + checkmark ourselves. */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  width: 14px;
  height: 14px;
  cursor: pointer;
  border: 1px solid var(--c-border);
  border-radius: 3px;
  background: var(--c-checkbox-bg);
  display: inline-grid;
  place-content: center;
}
input[type="checkbox"]:checked {
  background: var(--c-checkbox-checked);
  border-color: var(--c-checkbox-checked);
}
/* Checkmark (shown only while checked). */
input[type="checkbox"]::after {
  content: "";
  width: 4px;
  height: 8px;
  border: solid var(--c-editable-text);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
  opacity: 0;
}
input[type="checkbox"]:checked::after { opacity: 1; }

/* Chromium / Safari: visible thumb whenever a panel is scrollable. */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
  background: transparent;
}
::-webkit-scrollbar-button { display: none; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--c-scrollbar);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--c-scrollbar-hover);
  background-clip: padding-box;
}

/* ════════════════════════════════════════════════════════════════════════════
   SOUP SHELL — full-window viewport + floating chrome (formerly inline in the
   page): a burger menu (top-left) and the optimize dock (bottom-center).
   ════════════════════════════════════════════════════════════════════════════ */
#viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Floating burger-menu host, overlaid on the top-left of the viewport. */
#burger-host {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 20;
}
/* Collapse the reused MenuBar from a full-width bar to a compact,
   rounded floating control. */
#burger-host .menu-bar {
  height: auto;
  width: auto;
  border: none; /*1px solid var(--c-border); */
  border-radius: 10px;
  /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); */
  overflow: visible;
}
#burger-host .menu-bar__top {
  font-size: 1.5rem;
  line-height: 1;
}

/* ── Optimize dock (bottom-center) ──────────────────────────────────────
   A block 70% of the viewport wide and 10% tall (min 100px), laid out as
       [opt][........ prompt ........]
       [............ status .........]
*/
.optimize-dock {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 8px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 70%;
  height: 10%;
  min-height: 100px;
  max-width: calc(100vw - 16px);
}

/* Top row: button + prompt, filling the remaining block height. */
.optimize-dock__row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
}

.optimize-dock__status {
  flex: 0 0 auto;
  padding: 3px 10px;
  font-size: 0.78rem;
  color: var(--c-text);
  background: rgba(255, 255, 255, 0.384);
  border: none; /* 1px solid var(--c-border); */
  border-radius: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.optimize-dock__btn {
  flex: 0 0 auto;
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  padding: 6px 16px;
  border: none; /* 1px solid var(--c-border); */
  border-radius: 2px;
  box-shadow: 0 10px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}

/* Vertical stack of buttons occupying one dock-row slot (e.g. the three "Next"
   variants) — stretched to the row's full height by .optimize-dock__row, then
   split evenly among its buttons. */
.optimize-dock__stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 0 0 auto;
}

.optimize-dock__btn--stacked {
  flex: 1 1 0;
  min-height: 0;
  padding: 0 12px;
  font-size: 0.85rem;
}

/* Image-based button icon (e.g. the recipe button) sized to match the emoji
   glyphs used by the sibling dock buttons. */
.optimize-dock__btn-icon {
  display: block;
  width: 2.0rem;
  height: 2.0rem;
  /* PNG ships with a white fill; force it black while keeping transparency. */
  filter: brightness(0);
}

/* ════════════════════════════════════════════════════════════════════════════
   GUESS-SPECIFIC — the hidden ("masked") prompt display.

   Occupies the same central slot as soup's editable prompt box (so the dock
   looks identical), but the prompt text is blurred + unselectable until the
   player presses Reveal, at which point .prompt-box--revealed clears the mask.
   ════════════════════════════════════════════════════════════════════════════ */

/* Same tinted, shadowed frame as soup's .prompt-box so the dock reads the same. */
.prompt-box {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  background: rgba(213, 237, 240, 0.92);
  border: none;
  border-radius: 0px;
  box-shadow: 0 10px 8px rgba(0, 0, 0, 0.25);
  transition: background 0.15s ease;
}

/* The prompt text itself. Fills the box like soup's textarea would. */
.prompt-box__display {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 6px 8px;
  font-size: 1.2rem;
  font-weight: bold;
  line-height: 1.3;
  color: var(--c-editable-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Masked (default) state: blur the words and block selection/copy so the
   prompt can't be read off the screen or the DOM by casual inspection. */
.prompt-box:not(.prompt-box--revealed) .prompt-box__display {
  filter: blur(9px);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
  color: var(--c-text-muted);
}

/* A "hidden" hint sits on top of the blur until Reveal is pressed. */
.prompt-box__mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: #a9a9a9;
  font-size: 1.0rem;
  font-weight: bold;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-text);
  pointer-events: none;
}
.prompt-box--revealed .prompt-box__mask {
  display: none;
}

/* ════════════════════════════════════════════════════════════════════════════
   GUESS TIMER — top-right pie that fills with this round's optimizer step
   count and doubles as the buzz-in control (click, or press Space anywhere).
   Fill amount tracks steps (capped visually); color/points reflect whichever
   POINT_TIERS bracket the current step count falls into (see guess.js).
   ════════════════════════════════════════════════════════════════════════════ */
.guess-timer-wrap {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.guess-timer {
  --pie-pct: 0%;
  --pie-color: #2ecc71;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  cursor: pointer;
  user-select: none;
  background: conic-gradient(var(--pie-color) var(--pie-pct), rgba(0, 0, 0, 0.15) 0);
  box-shadow: 0 10px 8px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s linear;
}

/* Tier colors: green (best) → yellow → red (worst), keyed to POINT_TIERS order. */
.guess-timer[data-tier="0"] { --pie-color: #2ecc71; }
.guess-timer[data-tier="1"] { --pie-color: #f1c40f; }
.guess-timer[data-tier="2"] { --pie-color: #e74c3c; }

.guess-timer--resolved {
  cursor: default;
  opacity: 0.85;
}

.guess-timer__inner {
  width: 70%;
  height: 70%;
  border-radius: 50%;
  background: var(--c-panel-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.guess-timer__points {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  color: var(--c-header-text);
}

.guess-timer__hint {
  margin-top: 2px;
  font-size: 0.55rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--c-text-muted);
  white-space: nowrap;
}
