/* app-words.css: the Words hub (a three-station path) and the vocab drill
   (ABCD → typed → summary). Rides on app.css's tokens and card/button/pill
   classes; only the shapes app.css has no form for live here. */

/* ── Hub ─────────────────────────────────────────────────────────────────── */

.words-shell {
  gap: 0;
}

.words-title {
  margin-top: 2px;
  font-size: 29px;
}

.words-error {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  margin-top: 14px;
  padding: 14px 16px;
}

.words-error-text {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.words-path {
  display: flex;
  flex-direction: column;
  flex: none;
  margin-top: 18px;
}

/* One station: the puck floats above-left, overlapping its white tile
   (MiraiHubView.stepRow's negative-spacing layout). */
.words-step {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0;
  text-align: left;
  transition: transform 120ms ease;
}

.words-step:active {
  transform: scale(0.985);
}

.words-step.is-dimmed .words-step-tile {
  opacity: 0.55;
}

.words-step[disabled] {
  cursor: default;
}

/* The station puck: a white disc carrying one solid rim, filled to this
   step's progress over a pale track of the same hue. */
.words-step-node {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  z-index: 1;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 9px 13px rgba(61, 56, 53, 0.13);
  --words-step-progress: 0;
  --words-step-rim: #b49fe3;
  --words-step-track: rgba(180, 159, 227, 0.25);
}

/* One rich pastel per step — MiraiHubView.stepRims, hex for hex. */
.words-step-node[data-step="1"] {
  --words-step-rim: #f2ce45;
  --words-step-track: rgba(242, 206, 69, 0.25);
}

.words-step-node[data-step="2"] {
  --words-step-rim: #8fc9a3;
  --words-step-track: rgba(143, 201, 163, 0.25);
}

.words-step-node[data-step="3"] {
  --words-step-rim: #b49fe3;
  --words-step-track: rgba(180, 159, 227, 0.25);
}

.words-step-rim {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: conic-gradient(
    from -90deg,
    var(--words-step-rim) calc(var(--words-step-progress) * 1%),
    var(--words-step-track) 0
  );
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 9px), #000 calc(100% - 9px));
  mask: radial-gradient(closest-side, transparent calc(100% - 9px), #000 calc(100% - 9px));
  transition: background 240ms ease;
}

.words-step-mark {
  position: relative;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
}

.words-step-tick {
  position: absolute;
  right: 2px;
  bottom: 2px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--surface), 0 4px 6px rgba(61, 56, 53, 0.18);
}

.words-step-tick svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.words-step-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  margin-left: -26px;
  padding: 19px 18px 19px 46px;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-feather);
}

.words-step-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.words-step-title {
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
}

.words-step-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.words-step-resume {
  flex: none;
}

.words-step-chevron svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: rgba(61, 56, 53, 0.42);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The short dashed segment joining two pucks, lit once the step above is done. */
.words-connector {
  display: block;
  flex: none;
  width: 5px;
  height: 24px;
  margin-left: 42px;
  border-radius: 999px;
  background: repeating-linear-gradient(180deg, #e0d7f2 0 7px, transparent 7px 18px);
}

.words-connector.is-lit {
  background: repeating-linear-gradient(180deg, #c9bbef 0 7px, transparent 7px 18px);
}

/* ── Drill chrome ────────────────────────────────────────────────────────── */

.words-drill-shell {
  gap: 16px;
}

.words-chrome {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: none;
}

.words-chrome-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
}

.words-drill-title {
  position: absolute;
  left: 52px;
  right: 52px;
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  text-align: center;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The stage's countdown, in a puck that matches the close button's 38 px
   footprint on the other end of the row and sits pinned on at a tilt. */
.words-counter,
.words-counter-spacer {
  display: inline-flex;
  flex: none;
  width: 38px;
  height: 38px;
  margin-left: auto;
}

.words-counter {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--butter);
  box-shadow: var(--shadow-feather);
  transform: rotate(8deg);
}

.words-counter strong {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.05;
  color: var(--ink);
}

.words-counter em {
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  color: rgba(61, 56, 53, 0.55);
}

.words-stage-track {
  display: flex;
  gap: 5px;
}

.words-stage-capsule {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: rgba(61, 56, 53, 0.08);
  transition: background 200ms ease;
}

.words-stage-capsule.is-lit {
  background: rgba(61, 56, 53, 0.75);
}

.words-stage-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink-soft);
}

.words-rotated {
  align-self: center;
  flex: none;
  gap: 7px;
  padding: 7px 14px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: normal;
  text-align: left;
}

.words-rotated-mark {
  font-size: 13px;
}

/* ── Card front ──────────────────────────────────────────────────────────── */

.words-front {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  flex: none;
  padding: 20px;
  text-align: center;
}

.words-front-image {
  width: 100%;
  max-width: 320px;
  height: 150px;
  object-fit: contain;
  border-radius: 20px;
}

.words-front-image[data-solo="1"] {
  height: 190px;
}

.words-front-text {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

/* ── ABCD stage ──────────────────────────────────────────────────────────── */

.words-options {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.words-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 14px 20px;
  border-radius: var(--radius-tile);
  background: var(--surface);
  box-shadow: var(--shadow-feather);
  font-size: 15px;
  font-weight: 700;
  text-align: left;
  color: var(--ink);
  transition: transform 120ms ease, background 250ms ease;
}

.words-option:active {
  transform: scale(0.985);
}

.words-option-text {
  flex: 1;
  min-width: 0;
}

.words-option-mark svg {
  display: block;
  width: 20px;
  height: 20px;
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.words-option-mark.is-correct svg { stroke: var(--success); }
.words-option-mark.is-wrong svg { stroke: var(--danger); }

.words-option.is-correct {
  background: var(--mint);
}

.words-option.is-wrong {
  background: var(--pink);
}

.words-option.is-dimmed {
  opacity: 0.45;
  box-shadow: none;
}

.words-option[disabled] {
  cursor: default;
}

/* .btn is flex:1 by design (it shares an .action-bar row); a button standing
   alone in one of these column stacks must not grow into the spare height.
   The .action-bar's own buttons are left alone — they still share a row. */
.words-drill-shell > .btn,
.words-input-row .btn,
.words-verdict-card .btn {
  flex: none;
}

.words-advance {
  width: 100%;
}

/* ── Typed stage ─────────────────────────────────────────────────────────── */

.words-pass-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex: none;
}

.words-pass-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(61, 56, 53, 0.12);
  transition: background 180ms ease;
}

.words-pass-dot.is-on {
  background: var(--success);
}

.words-input-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.words-typed-input {
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
}

.words-input-row .btn {
  width: 100%;
}

.words-verdict {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  align-self: center;
  padding: 14px 22px;
  border-radius: var(--radius-pill);
  background: var(--mint);
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.words-verdict-mark svg {
  display: block;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--success);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.words-verdict-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: none;
  padding: 20px;
  text-align: center;
}

.words-verdict-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.words-expected {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
  color: var(--success);
}

.words-typed-wrong {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--danger);
  text-decoration: line-through;
  text-decoration-color: rgba(176, 82, 82, 0.55);
}

.words-verdict-card .btn {
  width: 100%;
}

.words-override {
  padding: 2px 4px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  background: transparent;
}

/* ── Summary ─────────────────────────────────────────────────────────────── */

.words-summary-shell {
  align-items: center;
  gap: 20px;
  padding-top: 26px;
  text-align: center;
}

.words-summary-title {
  font-size: 29px;
}

/* The aperture ring at full, with the trophy sticker pinned in the middle
   (iOS VocabSummaryView: ApertureRing(progress: 1) + StickerEmoji). */
.words-trophy {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 152px;
  height: 152px;
}

.words-trophy::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from -90deg,
    var(--butter) 0 19%,
    transparent 19% 25%,
    var(--mint) 25% 44%,
    transparent 44% 50%,
    var(--lilac) 50% 69%,
    transparent 69% 75%,
    var(--powder) 75% 94%,
    transparent 94% 100%
  );
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 11px), #000 calc(100% - 11px));
  mask: radial-gradient(closest-side, transparent calc(100% - 11px), #000 calc(100% - 11px));
}

.words-trophy span {
  position: relative;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sticker);
  font-size: 42px;
  transform: rotate(-6deg);
}

.words-stats {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: none;
  width: 100%;
  padding: 20px;
  text-align: left;
}

.words-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.words-stat-label {
  font-size: 14.5px;
  color: var(--ink);
}

.words-completion-note,
.words-completion-retry {
  margin: 0;
  flex: none;
  font-size: 12.5px;
  font-weight: 700;
}

.words-completion-retry {
  padding: 4px 6px;
  color: var(--danger);
  text-decoration: underline;
  background: transparent;
}

.words-summary-shell .action-bar {
  width: 100%;
}

@media (prefers-reduced-motion: reduce) {
  .words-step-rim,
  .words-option,
  .words-stage-capsule,
  .words-pass-dot {
    transition: none;
  }
}
