/* Five-letter clue solver styles — the tile instrument (2026-10-08 rebuild). */

.clue-instrument { padding-bottom: 0.6rem; }

.wrows { display: flex; flex-direction: column; gap: 0.4rem; margin: 0 0 0.5rem; }
.wrow { display: flex; gap: 0.4rem; }

.tile {
  width: 3rem;
  height: 3rem;
  min-width: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.25rem;
  text-transform: uppercase;
  background: var(--mesh);
  border: 2px solid var(--line-strong);
  border-radius: 5px;
  box-shadow: inset 0 2px 4px rgba(60, 30, 10, 0.16);
  color: var(--ink);
  position: relative;
  padding: 0;
  cursor: default;
}
.tile[data-tappable="true"] { cursor: pointer; }
.tile[data-cursor="true"] { border-color: var(--brass); }
/* A typed letter is a maple tile set in its square until you colour it. */
.tile:not(:empty):not([data-state]), .tile[data-state=""] {
  background: linear-gradient(180deg, #fff0c9, var(--tile-face) 35%, var(--tile-face-2));
  border-color: var(--tile-edge);
  box-shadow: 0 2px 0 var(--tile-edge);
  color: var(--tile-ink);
}
.tile[data-state] { box-shadow: 0 2px 0 rgba(30, 15, 5, 0.35); }
.tile[data-state="fit"] { background: var(--fit); border-color: var(--fit); color: #000; }
.tile[data-state="near"] { background: var(--near); border-color: var(--near); color: #241a00; }
.tile[data-state="out"] { background: var(--out); border-color: var(--out); color: #fff; }

html.hc-mode .tile[data-state]::after {
  position: absolute;
  right: 2px;
  bottom: 0;
  font-size: 0.6rem;
  line-height: 1;
}
html.hc-mode .tile[data-state="fit"]::after { content: "\2713"; }
html.hc-mode .tile[data-state="near"]::after { content: "\25C6"; }
html.hc-mode .tile[data-state="out"]::after { content: "\2715"; }

.keyboard { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.6rem 0; }
.kbrow { display: flex; gap: 0.22rem; justify-content: center; }
.kbrow button {
  appearance: none;
  font: inherit;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  min-height: var(--tap);
  min-width: 0;
  flex: 1;
  max-width: 2.4rem;
  padding: 0;
  border: 1px solid var(--tile-edge);
  border-radius: 5px;
  margin-bottom: 2px;
  background: linear-gradient(180deg, #fff0c9, var(--tile-face) 35%, var(--tile-face-2));
  box-shadow: 0 2px 0 var(--tile-edge);
  color: var(--tile-ink);
  cursor: default;
}
.kbrow button[data-state="fit"] { background: var(--fit); border-color: var(--fit); color: #000; }
.kbrow button[data-state="near"] { background: var(--near); border-color: var(--near); color: #241a00; }
.kbrow button[data-state="out"] { background: var(--out); border-color: var(--out); color: #fff; }

/* The funnel holds its full seven steps (0 rows to the sixth) from the start. */
.funnel { display: flex; flex-direction: column; gap: 0.3rem; margin: 0.6rem 0 0.8rem; height: calc(7 * 1.25rem + 6 * 0.3rem); }
.funnel-step { display: flex; align-items: center; gap: 0.5rem; height: 1.25rem; font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); }
.funnel-bar-track { flex: 1; height: 8px; background: var(--line); border-radius: 3px; overflow: hidden; }
.funnel-bar { height: 100%; background: linear-gradient(90deg, var(--tile-edge), var(--tile-face-2)); border-radius: 3px; }
.funnel-n { font-weight: 700; color: var(--ink); min-width: 4.5ch; text-align: right; }

.best-guess {
  border: 1px solid var(--brass);
  border-left-width: 5px;
  background: var(--brass-soft);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  margin: 0 0 0.7rem;
}
.best-guess .bg-word { font-family: var(--display); font-weight: 800; text-transform: uppercase; color: var(--ink); }
.best-guess .bg-stats { color: var(--ink-soft); font-size: 0.88rem; }
.best-guess .bg-actions { margin-top: 0.4rem; display: flex; gap: 0.5rem; align-items: flex-start; }
.best-guess details { flex: 1; min-width: 0; font-size: 0.84rem; color: var(--ink-soft); }
.best-guess details summary { line-height: var(--tap); cursor: pointer; color: var(--brass-text); }

.best-guess .bg-metrics-detail { display: none; }

.wl-tray-head {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--felt-soft);
  margin: 0.3rem 0 0.4rem;
}
.wl-tray-head .len-count { color: var(--felt-ink); }
/* On this route each answer is one long maple tile, so a screenful still fits. */
.results[data-tiles="chip"] .word-list { gap: 0.45rem 0.4rem; }
/* The chip style itself lives in sieve.css. */
.word.pts::after {
  content: attr(data-pts);
  color: #5a3c1e;
  letter-spacing: 0;
  font-variant-caps: normal;
  font-size: 0.5em; /* the old 0.72em of a 0.88rem chip, now that chips are 1.26rem small caps */
  margin-left: 0.11em;
  vertical-align: super;
}

.clue-instrument .controls { font-size: 0.86rem; }
.clue-instrument .controls input[type="checkbox"] { width: 1.1rem; height: 1.1rem; }
.clue-instrument .controls label.inline { min-height: var(--tap); }

#r-rows, #r-likely, #r-rare, #r-count { display: inline-block; }
#r-rows { min-width: 1ch; }
#r-likely, #r-rare, #r-count { min-width: 5ch; }

.results { height: 16rem; }
#notes{position:static}
/* A best guess that hides keeps its space, and a note takes that space. */
.best-guess[hidden]:not(:empty) { display: block; visibility: hidden; }
.clue-instrument:has(> .best-guess[hidden]:not(:empty)) > #notes { position: absolute; left: 0.32rem; right: 0.32rem; z-index: 1; }

/* The first row and three keyboard rows occupy their populated size even
   when the page script arrives after paint. Print and no-script stay natural. */
@media screen and (scripting: enabled) {
  .clue-instrument > .wrows { min-height: 3rem; }
  .clue-instrument > .keyboard { min-height: calc(3 * (var(--tap) + 2px) + 2 * 0.3rem); }
}
@media (scripting: none) {
  #best-guess[data-boot] { display: none; }
}

/* Keep a short phone's answers near the input, without dropping a clue or action. */
@media screen and (max-width: 360px) and (max-height: 700px) {
  .clue-instrument > .rack-form {
    display: grid;
    grid-template-columns: minmax(6.5rem, 1fr) max-content max-content;
    gap: 0.3rem;
  }
  .clue-instrument > .rack-form .rack-input { width: 100%; min-width: 0; }
  .clue-instrument > .rack-form .btn { padding-inline: 0.5rem; min-width: var(--tap); white-space: nowrap; }
  .clue-instrument .wrow-empty-next { display: none; }
  .clue-instrument > .controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clue-instrument > .controls label.inline { min-width: 0; }
  .clue-instrument > .controls input[type="checkbox"] { flex-shrink: 0; }
  .clue-instrument > .keyboard, .clue-instrument > .controls { margin-block: 0.4rem; }
  .clue-instrument > .best-guess:is(:not([hidden]), [data-boot]) { padding: 0.125rem 0.5rem; margin-bottom: 0.4rem; column-gap: 0.4rem; }
  .clue-instrument > .best-guess:is(:not([hidden]), [data-boot]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: start;
  }
  .clue-instrument .best-guess:is(:not([hidden]), [data-boot]) .bg-stats { margin: 0; min-height: var(--tap); display: flex; align-items: center; }
  .clue-instrument .best-guess:is(:not([hidden]), [data-boot]) .bg-metrics { display: none; }
  .clue-instrument .best-guess:is(:not([hidden]), [data-boot]) .bg-metrics-detail { display: block; }
  .clue-instrument .best-guess:is(:not([hidden]), [data-boot]) .bg-actions { display: contents; }
  .clue-instrument .best-guess:is(:not([hidden]), [data-boot]) .bg-actions > .btn { grid-column: 2; grid-row: 1; }
  .clue-instrument .best-guess:is(:not([hidden]), [data-boot]) details { grid-column: 3; grid-row: 1; margin: 0; }
  .clue-instrument .best-guess:is(:not([hidden]), [data-boot]) details > summary { min-width: var(--tap); white-space: nowrap; }
  .clue-instrument .best-guess:is(:not([hidden]), [data-boot]) details[open] { grid-column: 1 / -1; grid-row: 2; }
}

/* Keep the existing clue meanings without relying on printed color fills. */
@media print {
  #best-guess[data-boot] { display: none; }
  .tile[data-state], .kbrow button[data-state] {
    color: #111;
    background: #fff;
    border-color: #333;
    box-shadow: none;
    position: relative;
  }
  .tile[data-state]::after, .kbrow button[data-state]::after {
    position: absolute;
    right: 2px;
    bottom: 0;
    font-size: 0.6rem;
    line-height: 1;
    color: #111;
  }
  .tile[data-state="fit"]::after, .kbrow button[data-state="fit"]::after { content: "\2713"; }
  .tile[data-state="near"]::after, .kbrow button[data-state="near"]::after { content: "\25C6"; }
  .tile[data-state="out"]::after, .kbrow button[data-state="out"]::after { content: "\2715"; }
  .funnel-bar { background: #fff; border-top: 2px solid #333; }
  .clue-instrument #notes { position: static !important; }
}
