/* Dot Dash (morse) */
.g-morse { position: relative; display: flex; flex-direction: column; gap: 10px; max-width: 520px; margin: 0 auto; padding-bottom: 16px; }

.g-morse-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.g-morse-chips { display: inline-flex; gap: 6px; }
.g-morse-chips .chip { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 13px; }
.g-morse-streak.is-hot { background: var(--accent); color: var(--accent-ink); }

/* ---------- stage: lamp + readout ---------- */
.g-morse-stage {
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; padding: 14px 16px; min-height: 128px;
}
.g-morse-lamp {
  width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--line); box-shadow: inset 0 2px 6px var(--grid);
}
.g-morse-bulb {
  width: 52px; height: 52px; border-radius: 50%; background: var(--line);
  transition: background-color .03s linear, box-shadow .03s linear, transform .03s linear;
}
.g-morse-lamp.is-on .g-morse-bulb {
  background: var(--gold); transform: scale(1.06);
  box-shadow: 0 0 0 8px var(--gold-soft), 0 0 28px 6px var(--gold);
}
.g-morse-readout { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.g-morse-glyph {
  font-family: var(--font-mono); font-weight: 800; font-size: clamp(44px, 14vw, 64px); line-height: 1; color: var(--ink);
  min-height: 1em; letter-spacing: .04em; overflow-wrap: anywhere; text-align: center;
}
.g-morse-glyph--wait { color: var(--ink-3); }
.g-morse-glyph--ok { color: var(--ok); }
.g-morse-glyph--bad { color: var(--bad); }
.g-morse-glyph--new { color: var(--accent); }
.g-morse-pat { min-height: 18px; display: flex; justify-content: center; }
.g-morse-mute { grid-column: 1 / -1; text-align: center; color: var(--warn); }

/* dit / dah shapes */
.g-morse-p { display: inline-flex; align-items: center; gap: 6px; }
.g-morse-p i { display: block; height: 12px; border-radius: 999px; background: currentColor; }
.g-morse-dit { width: 12px; }
.g-morse-dah { width: 34px; }
.g-morse-pat .g-morse-p { color: var(--ink-2); }
.g-morse-glyph--ok + .g-morse-pat .g-morse-p { color: var(--ok); }
.g-morse-glyph--bad + .g-morse-pat .g-morse-p { color: var(--bad); }
.g-morse-glyph--new + .g-morse-pat .g-morse-p { color: var(--accent); }
.g-morse-p--lg { gap: 8px; }
.g-morse-p--lg i { height: 16px; }
.g-morse-p--lg .g-morse-dit { width: 16px; }
.g-morse-p--lg .g-morse-dah { width: 46px; }
.g-morse-p--sm { gap: 3px; }
.g-morse-p--sm i { height: 7px; }
.g-morse-p--sm .g-morse-dit { width: 7px; }
.g-morse-p--sm .g-morse-dah { width: 20px; }
.g-morse-p--stagger i { animation: g-morse-elin .35s cubic-bezier(.2,.8,.2,1.4) both; animation-delay: calc(var(--i) * 140ms + 250ms); }
@keyframes g-morse-elin { from { transform: scaleX(0); opacity: 0; } to { transform: none; opacity: 1; } }

.g-morse-msg {
  margin: 0; min-height: 44px; display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: 14.5px; color: var(--ink-2); padding: 0 6px; line-height: 1.35;
}
.g-morse-msg--good { color: var(--ok); font-weight: 700; }
.g-morse-msg--bad { color: var(--bad); font-weight: 600; }

.g-morse-body { display: flex; flex-direction: column; gap: 10px; }

/* ---------- keypad ---------- */
.g-morse-pad { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 6px; }
.g-morse-k {
  position: relative; min-height: 52px; min-width: 48px; border-radius: 14px; border: 2px solid var(--card-border);
  background: var(--card); color: var(--ink); box-shadow: var(--shadow); cursor: pointer; padding: 0;
  font-family: var(--font-mono); font-weight: 800; font-size: 22px; line-height: 1;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none;
  transition: transform .1s ease, border-color .12s ease, background-color .12s ease, color .12s ease;
}
.g-morse-k--big { min-height: 84px; font-size: 36px; border-radius: 18px; }
.g-morse-k:hover { border-color: var(--ink-3); }
.g-morse-k:active { transform: scale(.94); }
.g-morse-k:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.g-morse-k.is-new::after {
  content: "NEW"; position: absolute; top: 3px; right: 4px; font-size: 8.5px; font-weight: 800; letter-spacing: .06em;
  color: var(--accent);
}
.g-morse-k.is-right { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.g-morse-k.is-wrong { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }
.g-morse-k.is-answer { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); animation: g-morse-pulse .8s ease-in-out infinite; }
.g-morse-k--back { color: var(--ink-2); font-size: 20px; }
@keyframes g-morse-pulse { 0%, 100% { box-shadow: 0 0 0 0 var(--ok-soft); } 50% { box-shadow: 0 0 0 7px var(--ok-soft); } }
.g-morse-again { align-self: center; min-height: 44px; }

/* ---------- intro ---------- */
.g-morse-intro { display: flex; flex-direction: column; gap: 12px; animation: g-morse-rise .35s ease both; }
.g-morse-meet { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.g-morse-meetcard {
  display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 128px; min-height: 120px; padding: 12px 14px;
  cursor: pointer; color: var(--accent); -webkit-tap-highlight-color: transparent; transition: transform .12s ease, border-color .15s ease;
}
.g-morse-meetcard:hover { border-color: var(--accent); }
.g-morse-meetcard:active { transform: scale(.97); }
.g-morse-meetch { font-family: var(--font-mono); font-weight: 800; font-size: 44px; line-height: 1; color: var(--ink); }
.g-morse-meethear { font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.g-morse-known { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.g-morse-knownrow { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.g-morse-kchip {
  min-width: 28px; height: 28px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: 8px;
  font-family: var(--font-mono); font-weight: 700; font-size: 14px; background: var(--surface); border: 1px solid var(--line);
}
.g-morse-kchip.is-new { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.g-morse-goal { align-self: center; font-size: 13.5px; }

/* ---------- reveal ---------- */
.g-morse-reveal {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 18px 16px;
  border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-lift);
  animation: g-morse-flip .6s cubic-bezier(.2,.8,.2,1.3) both;
}
.g-morse-reveal-title { font-family: var(--font-display); font-weight: 700; font-size: 22px; }
.g-morse-reveal-title b { color: var(--accent); font-family: var(--font-mono); }
.g-morse-reveal-big {
  font-family: var(--font-mono); font-weight: 800; font-size: 76px; line-height: 1; color: var(--accent);
  animation: g-morse-zoom .7s cubic-bezier(.2,.8,.2,1.5) .15s both;
}
.g-morse-reveal-pat { color: var(--accent); min-height: 20px; }
.g-morse-reveal-say { margin: 0; font-size: 13.5px; }
.g-morse-reveal-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.g-morse-reveal-btns .btn--sm { min-height: 48px; }
@keyframes g-morse-flip { from { transform: perspective(600px) rotateY(80deg) scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes g-morse-zoom { from { transform: scale(.2) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes g-morse-rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- round 2: send ---------- */
.g-morse-send { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.g-morse-word { display: flex; justify-content: center; gap: 8px; min-height: 76px; flex-wrap: wrap; }
.g-morse-in { animation: g-morse-rise .3s ease both; }
.g-morse-wl {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 50px; padding: 8px 6px 6px;
  border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--ink-2);
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.g-morse-wl b { font-family: var(--font-mono); font-size: 34px; line-height: 1; }
.g-morse-wh { min-height: 8px; color: var(--warn); display: flex; }
.g-morse-wl.is-cur { border-color: var(--blue); color: var(--ink); box-shadow: 0 0 0 4px var(--blue-soft); }
.g-morse-wl.is-hint { border-color: var(--warn); }
.g-morse-wl.is-ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.g-morse-decoder {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; row-gap: 4px; align-items: center;
  padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1.5px dashed var(--line); min-height: 60px;
}
.g-morse-decoder .label { grid-row: 1 / 3; }
.g-morse-live { min-height: 14px; color: var(--blue); display: flex; }
.g-morse-sent { font-family: var(--font-mono); font-weight: 700; font-size: 17px; letter-spacing: .08em; min-height: 22px; overflow: hidden; white-space: nowrap; }
.g-morse-sent .is-ok { color: var(--ok); }
.g-morse-sent .is-bad { color: var(--bad); text-decoration: line-through; }
.g-morse-timerbox { min-height: 32px; display: flex; flex-direction: column; justify-content: center; }
.g-morse-timerbox .timer { margin: 14px 0 6px; }
.g-morse-timerhint { text-align: center; font-size: 13px; }
.g-morse-key {
  align-self: center; width: min(78vw, 220px); height: min(78vw, 220px); border-radius: 50%; cursor: pointer;
  border: 0; padding: 0; background: var(--ink); color: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  box-shadow: 0 10px 0 var(--line), var(--shadow-lift);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; -webkit-tap-highlight-color: transparent;
  transition: transform .05s linear, box-shadow .05s linear, background-color .08s linear;
}
.g-morse-key:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.g-morse-keycap { font-family: var(--font-mono); font-weight: 800; font-size: 30px; letter-spacing: .2em; }
.g-morse-keyhint { font-size: 13px; opacity: .75; }
.g-morse-key.is-down { transform: translateY(8px); box-shadow: 0 2px 0 var(--line), var(--shadow); background: var(--accent); color: var(--accent-ink); }
.g-morse-key.is-dah { background: var(--gold); color: var(--ink); }
.g-morse-key.is-off { opacity: .35; cursor: default; }

/* ---------- round 3: decode ---------- */
.g-morse-decode { display: flex; flex-direction: column; gap: 10px; }
.g-morse-slots { display: flex; justify-content: center; gap: 8px; }
.g-morse-slot {
  width: 52px; height: 60px; display: grid; place-items: center; border-radius: 12px;
  border: 2px solid var(--line); background: var(--card); font-family: var(--font-mono); font-weight: 800; font-size: 30px;
}
.g-morse-slot.is-cur { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.g-morse-slot.is-ok { border-color: var(--ok); background: var(--ok-soft); color: var(--ok); }
.g-morse-slot.is-bad { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.g-morse-replay { align-self: center; min-height: 44px; }
.g-morse-replay:disabled { opacity: .45; cursor: not-allowed; }
.g-morse-answer { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; animation: g-morse-rise .3s ease both; }
.g-morse-arow { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); }
.g-morse-arow b { font-family: var(--font-mono); font-size: 18px; }
.g-morse-arow.is-miss { color: var(--bad); }

/* ---------- recap ---------- */
.g-morse-recap { display: flex; flex-direction: column; align-items: stretch; gap: 12px; animation: g-morse-rise .35s ease both; }
.g-morse-ringwrap { position: relative; width: 150px; height: 150px; align-self: center; }
.g-morse-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.g-morse-ring circle { fill: none; stroke-width: 9; }
.g-morse-ring-bg { stroke: var(--line); }
.g-morse-ring-fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2,.8,.2,1); }
.g-morse-ringnum { position: absolute; inset: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; align-items: baseline; }
.g-morse-ringnum b { font-size: 40px; line-height: 1; }
.g-morse-ringnum small { font-family: var(--font-mono); font-size: 16px; color: var(--ink-3); }
.g-morse-ringnum .label { flex-basis: 100%; text-align: center; margin-top: 2px; }
.g-morse-recapstats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.g-morse-recapstats .chip { font-size: 13.5px; }
.g-morse-endslot:empty { display: none; }
.g-morse-tip { margin: 0; text-align: center; font-size: 14px; }

@media (min-width: 560px) {
  .g-morse-k { min-height: 56px; }
}
@media (prefers-reduced-motion: reduce) {
  .g-morse-p--stagger i, .g-morse-reveal, .g-morse-reveal-big { animation: none; }
}
