/* ドリル固有のスタイル。 */

/* ---------- 大きく見せるハングル ---------- */

.glyph {
  font-family: var(--font-ko);
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
}

.glyph--xl { font-size: clamp(4.5rem, 30vw, 8rem); }
.glyph--lg { font-size: clamp(2.75rem, 16vw, 4rem); }
.glyph--md { font-size: 1.75rem; }

/* ---------- 選択肢 ---------- */

.choices {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(2, 1fr);
}

.choices--single { grid-template-columns: 1fr; }
.choices--three { grid-template-columns: repeat(3, 1fr); }

.choice {
  display: grid;
  gap: var(--space-1);
  place-items: center;
  min-height: 84px;
  padding: var(--space-3);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
}

.choice:active { transform: scale(0.98); }

.choice__main { font-size: 1.5rem; font-weight: 600; }
.choice__main.ko { font-family: var(--font-ko); font-size: 2rem; }
.choice__sub { font-size: 0.8rem; color: var(--ink-muted); }

.choice--ok {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice--ng {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.choice--dim { opacity: 0.4; }

.choice[disabled] { cursor: default; }

/* ---------- 字母カード（道場の解説） ---------- */

.jamo-detail { display: grid; gap: var(--space-4); }

.jamo-detail__row {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: var(--space-3);
  font-size: 0.9rem;
  align-items: baseline;
}

.jamo-detail__key { color: var(--ink-faint); font-size: 0.8rem; letter-spacing: 0.06em; }

.chain {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.chain__link {
  display: grid;
  place-items: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: var(--space-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  font-family: var(--font-ko);
  font-size: 1.5rem;
}

.chain__link--current { border-color: var(--accent); background: var(--accent-soft); }

.chain__arrow { color: var(--ink-faint); font-size: 0.85rem; }

/* ---------- 音節ブロックの組み立て ---------- */

.block {
  display: grid;
  place-items: center;
  width: 8.5rem;
  height: 8.5rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-sunken);
}

.block__preview {
  font-family: var(--font-ko);
  font-size: 5rem;
  line-height: 1;
}

.block__empty { color: var(--ink-faint); font-size: 0.85rem; }

.slots {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
}

.slot {
  display: grid;
  gap: var(--space-1);
  place-items: center;
  min-width: 4rem;
  padding: var(--space-2);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.slot--filled { border-color: var(--accent); }
.slot--active { border-color: var(--ink-faint); border-style: dashed; }
.slot__label { font-size: 0.7rem; color: var(--ink-faint); letter-spacing: 0.06em; }
.slot__value { font-family: var(--font-ko); font-size: 1.6rem; min-height: 1.6em; }

.palette {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr));
}

.palette__key {
  min-height: 3.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: var(--font-ko);
  font-size: 1.4rem;
  cursor: pointer;
}

.palette__key:active { background: var(--accent-soft); }
.palette__key--used { opacity: 0.35; }

/* ---------- ソフトキーボード（두벌식） ---------- */

.compose {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 4rem;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-ko);
  font-size: 2.25rem;
  line-height: 1.2;
  word-break: break-all;
}

.compose__caret {
  display: inline-block;
  width: 2px;
  height: 1.6em;
  background: var(--accent);
  animation: blink 1.1s steps(2, start) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.compose__pending { color: var(--accent); }

.compose--placeholder { color: var(--ink-faint); font-family: var(--font-ui); font-size: 0.9rem; }

.keyboard {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 6px;
  padding: var(--space-2) var(--space-1);
  padding-bottom: calc(var(--space-2) + env(safe-area-inset-bottom));
  margin: 0 calc(var(--space-4) * -1) calc(var(--space-7) * -1);
  background: var(--surface-sunken);
  border-top: 1px solid var(--line);
}

.keyboard__row { display: flex; gap: 5px; justify-content: center; }

.keyboard__row--indent { padding-inline: 5%; }

.key {
  flex: 1 1 0;
  min-width: 0;
  min-height: 44px;
  border: none;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line);
  font-family: var(--font-ko);
  font-size: 1.15rem;
  cursor: pointer;
  user-select: none;
}

.key:active { background: var(--accent-soft); }
.key--wide { flex: 1.6 1 0; font-family: var(--font-ui); font-size: 0.8rem; font-weight: 600; }
.key--on { background: var(--accent); color: var(--on-accent); }

/* ---------- なぞり書き ---------- */

.trace {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin-inline: auto;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  touch-action: none;
}

.trace__svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.trace__guide { stroke: var(--surface-sunken); stroke-width: 26; stroke-linecap: round; fill: none; }
.trace__path { stroke: var(--line); stroke-width: 3; stroke-linecap: round; fill: none; stroke-dasharray: 6 8; }
.trace__path--done { stroke: var(--accent); stroke-dasharray: none; }
.trace__path--future { stroke: var(--line); opacity: 0.4; stroke-width: 2; }
.trace__start { fill: var(--accent); }
.trace__order { fill: var(--ink-faint); font-size: 14px; font-family: var(--font-ui); }
.trace__ink { stroke: var(--ink); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; fill: none; }

.trace-hint {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: 0.8rem;
  color: var(--ink-muted);
}

/* ---------- 音韻変化 ---------- */

.rule-flow {
  display: grid;
  gap: var(--space-2);
  justify-items: center;
}

.rule-flow__spelling { font-family: var(--font-ko); font-size: 2.25rem; }
.rule-flow__arrow { color: var(--ink-faint); }
.rule-flow__sound { font-family: var(--font-ko); font-size: 2.25rem; color: var(--accent); }
.rule-flow__name { font-size: 0.85rem; color: var(--ink-muted); }

/* ---------- 音声診断（設定） ---------- */

.voice-list { display: grid; gap: var(--space-2); }

.voice-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.9rem;
}

.voice-row--on { border-color: var(--accent); background: var(--accent-soft); }

.scope-list { display: grid; gap: var(--space-2); }

.scope-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.9rem;
}
