/* ============================================================
   vocab-study.css — the /decks handwriting study session.
   The canvas overlays (.study-hint-overlay, .stroke-feedback,
   .trace-score) are styled globally by the kana-practice CSS; this
   file owns the session chrome (ds-* classes). Theme-token based.
   ============================================================ */

#decks-home[hidden], #decks-session[hidden], #decks-summary[hidden] { display: none; }

/* Crossword on /decks — the engine's .crossword-game is position:absolute;
   inset:0, so the wrapper needs a positioned box with a real height. */
#decks-crossword-view { position: relative; min-height: clamp(520px, 72vh, 820px); }
/* Desktop: pin the board to a true square. The legacy desktop layout is
   height-driven (board-wrap stretches to the clue-row height); in this
   taller container that over-stretches the square grid into tall cells. */
@media (min-width: 721px) {
  #decks-crossword-view .crossword-board-col { align-items: center; justify-content: flex-start; }
  #decks-crossword-view .crossword-board-wrap {
    flex: 0 0 auto;
    width: clamp(300px, 50vh, 540px);
    height: clamp(300px, 50vh, 540px);
    aspect-ratio: 1 / 1;
  }
}

/* ── Session top bar ────────────────────────────────────── */
.ds-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.ds-exit, .ds-skip {
  font-family: inherit;
  font-size: 14px;
  background: transparent;
  border: none;
  color: var(--text-muted, #54403a);
  cursor: pointer;
  padding: 6px 4px;
}
@media (hover: hover) { .ds-exit:hover, .ds-skip:hover { color: var(--accent, #b32a2a); } }
.ds-progress {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint, #7a6260);
}
.ds-top-right { display: flex; align-items: center; gap: 6px; }

/* ── Prompt (the meaning to recall) ─────────────────────── */
.ds-prompt {
  text-align: center;
  font-size: clamp(18px, 4.4vw, 24px);
  font-weight: 600;
  color: var(--text, #1f1a1a);
  margin: 10px auto 14px;
  max-width: 460px;
  line-height: 1.35;
}

/* ── Canvas stage ───────────────────────────────────────── */
.ds-stage { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ds-canvas-wrap {
  position: relative;
  width: 100%;
  max-width: 360px;
  aspect-ratio: 1 / 1;
  background: transparent;
  border: 1px solid var(--container-border, #d9cdb4);
  border-radius: 16px;
  overflow: hidden;
  touch-action: none;
}
/* Dashed centring guides (behind the writing canvas). */
.ds-canvas-wrap::before, .ds-canvas-wrap::after {
  content: ""; position: absolute; pointer-events: none; opacity: 0.3; z-index: 0;
}
.ds-canvas-wrap::before {
  left: 50%; top: 6%; bottom: 6%; width: 1px;
  background-image: linear-gradient(to bottom, var(--text-faint, #7a6260) 50%, transparent 50%);
  background-size: 1px 8px;
}
.ds-canvas-wrap::after {
  top: 50%; left: 6%; right: 6%; height: 1px;
  background-image: linear-gradient(to right, var(--text-faint, #7a6260) 50%, transparent 50%);
  background-size: 8px 1px;
}
.ds-canvas-wrap #draw-canvas { position: relative; z-index: 1; width: 100%; height: 100%; display: block; cursor: crosshair; }
.ds-canvas-wrap.miss-flash { animation: dsShake 0.4s ease-out; border-color: var(--red, #b1322a); }
@keyframes dsShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* Answer field — the reading spelled out slot-by-slot as you write (or Reveal). */
.ds-answer { display: flex; gap: 8px; justify-content: center; min-height: 42px; margin: 4px 0 10px; }
.ds-slot {
  min-width: 30px; height: 40px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Klee One', 'Noto Sans JP', serif; font-size: 24px; font-weight: 600;
  color: var(--text, #1f1a1a);
  border-bottom: 2px solid var(--line, rgba(31, 26, 26, 0.2));
  transition: border-color 0.2s, background 0.2s;
}
.ds-slot.filled { color: var(--accent, #b32a2a); }
.ds-slot.auto { color: var(--text-faint, #7a6260); }
.ds-slot.current {
  border-bottom-color: var(--accent, #b32a2a);
  background: var(--accent-bg, rgba(179, 42, 42, 0.07));
  border-radius: 6px 6px 0 0;
}

/* Reveal button. */
.ds-reveal-row { display: flex; justify-content: center; margin: 2px 0 14px; }
.ds-reveal-btn {
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 7px 20px; border-radius: 999px;
  background: transparent; color: var(--text-muted, #54403a);
  border: 1.5px solid var(--container-border, #d9cdb4);
}
@media (hover: hover) { .ds-reveal-btn:hover { border-color: var(--accent, #b32a2a); color: var(--accent, #b32a2a); } }

/* ── Rating buttons ─────────────────────────────────────── */
.ds-rating {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 460px;
  margin: 14px auto 4px;
}
.ds-rating[hidden] { display: none; }
.ds-rate {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-family: inherit; cursor: pointer;
  padding: 12px 8px; border-radius: 12px;
  border: 1.5px solid var(--container-border, #d9cdb4);
  background: var(--bg, #fbf6ea);
  color: var(--text, #1f1a1a);
}
.ds-rate-label { font-size: 15px; font-weight: 700; }
.ds-rate-int { font-size: 12px; color: var(--text-faint, #7a6260); }
.ds-rate-hard { border-color: rgba(179, 42, 42, 0.4); }
.ds-rate-hard .ds-rate-label { color: var(--red, #b1322a); }
.ds-rate-easy { border-color: rgba(47, 143, 91, 0.4); }
.ds-rate-easy .ds-rate-label { color: var(--green, #2f8f5b); }
@media (hover: hover) { .ds-rate:hover { transform: translateY(-1px); box-shadow: 0 4px 12px -4px rgba(40,30,20,.25); } }

/* ── Summary ────────────────────────────────────────────── */
.ds-summary-inner { text-align: center; padding: 40px 16px; max-width: 460px; margin: 0 auto; }
.ds-summary-check {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-content: center; font-size: 34px; color: #fff;
  background: var(--green, #2f8f5b);
}
.ds-summary-title { font-size: 24px; font-weight: 700; color: var(--text, #1f1a1a); margin: 0 0 8px; }
.ds-summary-stats { color: var(--text-muted, #54403a); font-size: 15px; margin: 0 0 20px; }
.ds-summary-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
