/* The answer console: the enamel station plaque, the line diagram under it, the validator's
   violet print, the answer field and the per-line progress. */

/* ---------- line pictogram: a disc in the line colour, the number in white or black ---------- */
.roundel {
  --c: var(--ink);
  --on: #fff;
  display: inline-grid;
  grid-auto-flow: column;
  place-content: center;
  align-items: baseline;
  flex: none;
  width: 2.3rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--c);
  color: var(--on);
  font: 700 1.12rem/1 var(--font-sign);
  letter-spacing: -0.03em;
  font-variant-numeric: lining-nums;
}
.roundel i { font-style: normal; font-size: 0.48em; letter-spacing: 0; margin-left: 0.04em; }
.roundel.sm { width: 1.8rem; font-size: 0.9rem; }
.roundel.xs { width: 1.35rem; font-size: 0.68rem; }
.roundel.blank { --c: var(--rail-off); --on: var(--surface); }

/* RER: the letter in a ring of the line colour, on white. */
.roundel.ring { background: #fff; box-shadow: inset 0 0 0 0.2em var(--c); font-size: 1.05rem; letter-spacing: 0; }
.roundel.ring.xs { box-shadow: inset 0 0 0 0.17em var(--c); }

/* Tram: "T" and the number between two bars of the line colour. */
.roundel.tram {
  aspect-ratio: auto;
  height: auto;
  min-height: 0;
  padding: 0.16em 0.2em 0.1em;
  border-radius: 0;
  border-block: 0.2em solid var(--c);
  background: #fff;
  color: var(--ink);
  font-size: 0.92rem;
  letter-spacing: -0.02em;
}
.roundel.tram b { margin-right: 0.04em; font-weight: 700; }
.roundel.tram, .roundel.tram.sm, .roundel.tram.xs { width: auto; }
.roundel.tram.sm { font-size: 0.74rem; }
.roundel.tram.xs { font-size: 0.6rem; }

.roundel-btn {
  padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer;
  transition: transform 0.12s ease;
}
.roundel-btn:hover { transform: scale(1.07); }
.roundel-btn[aria-pressed="true"] .roundel { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--ink); }

/* ---------- the board: plaque émaillée over a plan de ligne ---------- */
.board {
  position: relative;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--rule), 0 12px 22px -16px rgb(24 34 63 / 0.55);
}

/* Navy vitreous enamel, a fine white rule inset from the edge, white capitals-and-lowercase. */
.plaque {
  position: relative;
  overflow: hidden;
  display: grid;
  place-content: center;
  min-height: 92px;
  padding: 14px 18px 12px;
  border-radius: 6px 6px 0 0;
  background:
    radial-gradient(120% 90% at 30% 0%, rgb(255 255 255 / 0.13), transparent 55%),
    var(--enamel);
  box-shadow: inset 0 0 0 5px var(--enamel), inset 0 0 0 6.5px var(--enamel-edge);
  color: #fff;
  text-align: center;
  container-type: inline-size;
}
/* The gloss of fired enamel: one soft highlight sweeping across. */
.plaque::after {
  content: "";
  position: absolute;
  inset: -40% auto -40% -30%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgb(255 255 255 / 0.09), transparent);
  transform: skewX(-18deg);
  pointer-events: none;
}
.plaque-name {
  margin: 0;
  font: 600 min(2.35rem, calc(150cqi / var(--len, 8))) / 1.1 var(--font-sign);
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.plaque-name.narrow { font-family: var(--font-sign-narrow); font-size: min(2.2rem, calc(175cqi / var(--len, 8))); }
.plaque-ja { margin: 4px 0 0; font: 500 0.82rem/1.2 var(--font-ja); letter-spacing: 0.08em; color: rgb(255 255 255 / 0.78); }
.plaque-note { margin: 6px 0 0; font: 400 0.86rem/1.45 var(--font-body); color: rgb(255 255 255 / 0.8); white-space: normal; }
.plaque.empty .plaque-name { font-style: italic; font-weight: 500; color: rgb(255 255 255 / 0.9); }

/* The line diagram: the station between its neighbours on the line's coloured bar. */
.ligne { display: flex; align-items: center; gap: 12px; padding: 12px 14px 14px; }
.ligne-picks { display: flex; gap: 4px; flex: none; }

.diagram {
  --c: var(--rail-off);
  position: relative;
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  padding-top: 4px;
}
/* The bar runs between the outer ticks; at a terminus it stops at this station. */
.diagram::before {
  content: "";
  position: absolute;
  top: 9px;
  left: var(--from, 16.5%);
  right: var(--to, 16.5%);
  height: 6px;
  border-radius: 3px;
  background: var(--c);
}
.diagram.end-prev { --from: 50%; }
.diagram.end-next { --to: 50%; }

.stop { position: relative; display: grid; justify-items: center; gap: 6px; min-width: 0; text-align: center; }
.tick { width: 14px; height: 14px; border: 3px solid var(--ink); border-radius: 50%; background: #fff; }
.stop.here .tick { width: 18px; height: 18px; margin-top: -2px; border-width: 4px; box-shadow: 0 0 0 3px var(--surface); }
.stop-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 500 0.78rem/1.25 var(--font-sign-narrow);
  color: var(--ink-soft);
}
.stop.here .stop-name { font: 700 0.86rem/1.25 var(--font-sign); color: var(--ink); }
.stop.unknown .stop-name { letter-spacing: 0.15em; }
.stop.unknown .tick { border-color: var(--rail-off); }
.stop.end .tick { visibility: hidden; }
.stop.end .stop-name { font-style: italic; color: var(--ink-soft); }

/* ---------- the validator's print ---------- */
/* Violet ink, slightly askew, as a composteur stamped it on a ticket. */
.composte {
  --rot: -5deg;
  position: absolute;
  right: 12px;
  bottom: -11px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 8px 2px;
  white-space: nowrap;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  background: rgb(251 249 243 / 0.92);
  color: var(--violet);
  font: 800 0.64rem/1.15 var(--font-ink);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  filter: url(#ink);
  transform: rotate(var(--rot));
  pointer-events: none;
  animation: composte-in 0.36s var(--ease-stamp) both;
}
.composte b { font-size: 0.8rem; letter-spacing: 0.12em; }

@keyframes composte-in {
  from { transform: scale(1.7) rotate(calc(var(--rot) - 14deg)); opacity: 0; }
  55% { opacity: 1; }
  to { transform: scale(1) rotate(var(--rot)); opacity: 1; }
}

/* ---------- answer field ---------- */
.answer { margin-top: 26px; }

.answer input {
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  border: 2px solid var(--enamel);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: 600 1.25rem/1.2 var(--font-sign);
}
:lang(ja) .answer input { font-family: var(--font-sign), var(--font-ja); }
.answer input::placeholder { color: #6c7182; font: italic 400 1rem/1.2 var(--font-body); }
.answer input:focus { outline: none; box-shadow: 0 0 0 4px var(--amber); }
.answer input:disabled { background: var(--ground); border-color: var(--rule); }
.answer input.shake { animation: shake 0.28s ease; }

@keyframes shake {
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.hint { margin: 6px 0 0; font-size: 0.78rem; line-height: 1.5; color: var(--ink-soft); }
.hint-ask { margin: 4px 0 0; padding: 0; border: 0; background: none; font: 500 0.82rem/1.5 var(--font-body); color: var(--ink); text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.hint-ask:hover { color: var(--violet); }

.feedback { min-height: 1.6em; margin: 4px 0 0; font-weight: 600; font-size: 0.95rem; line-height: 1.5; }
.feedback[data-kind="found"] { color: var(--ok); }
.feedback[data-kind="miss"] { color: var(--rouge); }
.feedback[data-kind="hint"] { color: var(--violet); }
.feedback[data-kind="decoy"], .feedback[data-kind="dup"] { color: var(--warn); }

/* ---------- score line ---------- */
.scoreline { display: flex; align-items: center; gap: 18px; margin-top: 2px; }
.scoreline p { margin: 0; }
.score { display: flex; align-items: baseline; white-space: nowrap; }
.count { font: italic 700 2.7rem/1 var(--font-display); font-variant-numeric: lining-nums tabular-nums; }
.of { margin-left: 6px; color: var(--ink-soft); font-weight: 500; }
.clock { color: var(--ink-soft); font-size: 0.86rem; white-space: nowrap; }
.clock time { margin-left: 2px; font: 600 1.15rem var(--font-sign); font-variant-numeric: tabular-nums; color: var(--ink); }
.scoreline .btn { margin-left: auto; }

/* ---------- per-line progress ---------- */
.lines h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 0 8px; font: italic 600 1.25rem/1.2 var(--font-display); }
:lang(ja) .lines h2 { font: 700 1.05rem/1.3 var(--font-ja-display); }
.lines h2 small { font: 400 0.76rem/1.3 var(--font-body); color: var(--ink-soft); }

.line-group h3 { display: flex; align-items: center; gap: 8px; margin: 14px 0 6px; font: 700 0.7rem/1 var(--font-sign); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); }
.line-group h3::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.line-group:first-child h3 { margin-top: 4px; }
.linelist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; }
@media (max-width: 380px) { .linelist { grid-template-columns: minmax(0, 1fr); } }

.line-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 9px;
  row-gap: 4px;
  width: 100%;
  padding: 5px 6px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.line-row .roundel { grid-row: 1 / 3; }
.line-row:hover { background: var(--surface); }
.line-row[aria-pressed="true"] { background: var(--surface); box-shadow: inset 3px 0 0 var(--c); }
.line-name { font-weight: 600; font-size: 0.86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-count { font: 500 0.8rem var(--font-sign); font-variant-numeric: tabular-nums; color: var(--ink-soft); }

/* The unfilled part of a bar is a row of tiny tiles; the filled part is the line colour. */
.line-bar {
  grid-column: 2 / 4;
  height: 5px;
  overflow: hidden;
  border-radius: 3px;
  background: repeating-linear-gradient(90deg, var(--rule) 0 5px, transparent 5px 7px);
}
.line-bar span {
  display: block; height: 100%; background: var(--c);
  transform-origin: left; transform: scaleX(calc(var(--p, 0) / 100));
  transition: transform 0.3s ease;
}

/* A finished line: the terminus, stamped in validator violet. */
.line-row.done .line-count::after {
  content: "Terminus";
  display: inline-block;
  margin-left: 5px;
  padding: 0 4px;
  border: 1.5px solid var(--violet);
  border-radius: 2px;
  color: var(--violet);
  font: 800 0.6rem/1.5 var(--font-ink);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transform: rotate(-6deg);
}
:lang(ja) .line-row.done .line-count::after { content: "制覇"; font-family: var(--font-ja); font-weight: 700; }

@media (max-width: 420px) {
  .plaque { min-height: 80px; padding: 12px 14px 10px; }
  .ligne { gap: 8px; padding: 10px; }
  .count { font-size: 2.3rem; }
  .scoreline { gap: 12px; }
  .scoreline .btn { padding-inline: 0.7rem; font-size: 0.86rem; }
}
