/* Morse Code Trainer's own look, after the shell every tool shares (../shell/shell.css: the brand, the name card, the
   score, the list down the left with its sub-rows, the settings and their "i", the windows, the result, the phone
   layout, and the wide middle column every trainer has). Only this tool's subject goes here: the round listen button on
   its plate, the box for a word, Explore's character beside every stage's chips, a new character's card, and the
   buttons under the board (the answer pad, and actions the same sizes as Dog Breeds' and Car Brands'). Colours and
   fonts are the shell's variables. */

/* the subject, in the middle column under the name card */
.board {
  flex: 1; min-height: 0; overflow: auto; box-sizing: border-box; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
  padding: clamp(14px, 2.6vh, 26px) clamp(14px, 2vw, 26px);
  background: radial-gradient(80% 60% at 50% 30%, #13222c 0%, #0c141b 72%);
  border: 1px solid var(--line-strong); border-radius: 18px;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
  container-type: inline-size;
}
.board > :first-child { margin-top: auto; }
.board > :last-child { margin-bottom: auto; }
.board .note { color: var(--muted); text-align: center; margin: 0; }
.rail .mono { font-family: var(--f-mono); letter-spacing: .04em; }

/* the listen button: tap to hear it (again); its ring pulses while the code plays */
.listen {
  position: relative; flex: none; width: clamp(104px, 18vh, 140px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; color: var(--bone);
  background: radial-gradient(circle at 50% 40%, #1b2a35 0%, #111b23 70%);
  border: 1px solid var(--line-strong); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  transition: border-color .15s, transform .1s;
}
.listen:hover { border-color: var(--scan); }
.listen:active { transform: scale(0.97); }
.listen .glyph svg { width: 38%; height: auto; display: block; margin: 0 auto; fill: currentColor; transform: translateX(6%); }
.listen .glyph { width: 100%; }
.listen .cap {
  position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.listen .ring { position: absolute; inset: -1px; border-radius: 50%; border: 2px solid var(--scan); opacity: 0; pointer-events: none; }
.listen.is-playing { border-color: var(--scan); color: var(--scan); }
.listen.is-playing .ring { animation: ring 1.1s ease-out infinite; }
@keyframes ring { from { opacity: .75; transform: scale(1); } to { opacity: 0; transform: scale(1.32); } }
@media (prefers-reduced-motion: reduce) { .listen.is-playing .ring { animation: none; opacity: .6; } }
/* room for the caption under the button */
.listen { margin-bottom: 24px; }

/* a question's plate: the listen button, and the box for a word; a new character's card: the character, big */
.plate { display: grid; justify-items: center; gap: 16px; width: min(100%, 560px); }
.glyph { font-family: var(--f-mono); font-weight: 700; font-size: clamp(64px, 14vh, 120px); line-height: 1; color: var(--bone); }
.glyph.word { font-size: clamp(36px, 8vh, 64px); letter-spacing: .04em; }
.meaning { margin: 0; color: var(--muted); font-size: 14.5px; text-align: center; }

/* Explore: the character (its dots and dashes only with the Preference on) and its sound, beside every stage's chips */
.pattern { font-family: var(--f-mono); font-size: clamp(26px, 5vh, 40px); letter-spacing: .08em; color: var(--bone); line-height: 1; min-height: 1em; }
.explore { display: grid; gap: 22px; width: min(100%, 1040px); align-items: start; }
@container (min-width: 600px) { .explore { grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1fr); } }
.detail { display: grid; justify-items: center; gap: 16px; padding: 26px 18px 40px; background: var(--bg-lift); border: 1px solid var(--line); border-radius: 16px; }
.chart { display: grid; gap: 14px 12px; min-width: 0; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); align-content: start; }
.chart:not(.words) .chips .chip { flex-basis: 34px; min-height: 40px; }
.explore.words .chart { grid-template-columns: 1fr; }
.explore.words .chart .chips .chip { flex-basis: auto; }
.lgroup { display: grid; gap: 7px; }
.lgroup.is-later { opacity: .5; }
.ghead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--scan); }
.ghead em { font-style: normal; color: var(--muted); letter-spacing: 0; }
.ghead em.done { color: var(--ok); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { flex: 0 0 46px; }
.chips.words .chip { flex: 0 0 auto; min-width: 58px; padding: 0 10px; }
.chip, .key {
  font-family: var(--f-mono); font-weight: 600; font-size: 16px; color: var(--fg); cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px; min-height: 42px; padding: 0 6px;
}
.chip:hover, .key:hover:not(:disabled) { border-color: var(--scan); }
.chip.is-on { border-color: var(--bone); box-shadow: 0 0 0 1px var(--bone); color: var(--bone); background: var(--bg-lift); }
.chip.is-known::after { content: "✓"; font-size: 10px; color: var(--ok); margin-inline-start: 3px; vertical-align: 2px; }
.chip.is-later { color: var(--line-strong); border-style: dashed; }

/* Learn and Test: the pad of characters in play, under the board (tap, or type on a keyboard), or the box for a word */
.pad { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; }
.key { flex: 0 0 56px; font-size: 19px; min-height: 52px; background: var(--panel); border-color: var(--line-strong); }
.pad.few .key { flex-basis: 76px; min-height: 76px; font-size: 28px; border-radius: 12px; }
.key:disabled { cursor: default; opacity: .4; }
.key.is-ok { opacity: 1; border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok); color: var(--ok); }
.key.is-bad { opacity: 1; border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); color: var(--bad); }
.type {
  width: min(100%, 420px); box-sizing: border-box; font-family: var(--f-mono); font-size: 22px; font-weight: 600; letter-spacing: .1em;
  text-align: center; text-transform: uppercase; color: var(--fg); background: var(--bg-lift);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; outline: none;
}
.type::placeholder { font-size: 14px; letter-spacing: .02em; text-transform: none; color: var(--muted); }
.type:focus { border-color: var(--scan); }
.type:disabled { opacity: .5; }

/* after a test, under its result: the answer time and the misses */
.summary { display: grid; gap: 12px; justify-items: center; width: min(100%, 620px); }
.summary .chips { justify-content: center; }
.summary .note { max-width: 46ch; line-height: 1.5; font-size: 13.5px; }

/* the buttons under the board: the answer pad, or a row of actions */
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; }
.actions:empty { display: none; }
.act {
  font: inherit; font-weight: 700; font-stretch: 102%; font-size: 15px; color: var(--fg); cursor: pointer; text-align: center;
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 9px; padding: 11px 14px; min-height: 46px;
  display: flex; align-items: center; justify-content: center; gap: 10px; position: relative; line-height: 1.2; flex: 0 1 auto; min-width: 120px;
}
.act kbd { font-family: var(--f-mono); font-weight: 500; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 4px; padding: 0 4px; flex: none; }
.act:hover:not(:disabled) { border-color: var(--scan); }
.act.primary { background: var(--bone); color: #1b1610; border-color: var(--bone); }
.act.primary kbd { color: #5d5345; border-color: #a99c84; }

@media (max-width: 900px) {
  .board { border-radius: 14px; gap: 14px; padding: 12px; }
  .pad { gap: 5px; }
  .key { flex-basis: 44px; min-height: 46px; font-size: 18px; }
  .pad.few .key { flex-basis: 72px; min-height: 72px; font-size: 26px; }
  .chips .chip { flex-basis: 42px; }
  .act { padding: 10px 11px; font-size: 14px; min-height: 44px; min-width: 0; flex: 1 1 0; }
  .act kbd { display: none; }
  .detail { padding: 18px 12px 34px; }
}
