/* =====================================================================
   style.css — 四字熟語の穴埋めクイズ ツール固有の微調整のみ。
   共通スタイルは /_shared/shirugear.css に任せる。
   ===================================================================== */

/* hidden 属性を共通CSSの display 指定（.sg-card / .sg-btn など）より優先させる */
#setup[hidden],
#quiz[hidden],
#result[hidden],
#next-btn[hidden],
#weak-btn[hidden],
#retry-wrong-btn[hidden],
#review[hidden],
#review-heading[hidden],
#blanks-field[hidden],
#choices[hidden],
#input-form[hidden] {
  display: none;
}

/* 設定 */
.yq-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 4px;
}
.yq-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}
.yq-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.yq-levels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.yq-level {
  position: relative;
  cursor: pointer;
}
.yq-level input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.yq-level span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 4px;
  border: 1.5px solid var(--sg-border);
  border-radius: var(--sg-radius, 10px);
  background: var(--sg-surface);
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}
.yq-level small {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--sg-muted);
}
.yq-level input:checked + span {
  background: var(--sg-primary-soft, rgba(59, 91, 219, 0.12));
  border-color: var(--sg-primary);
  color: var(--sg-primary);
}
.yq-level input:focus-visible + span {
  outline: 2px solid var(--sg-primary);
  outline-offset: 2px;
}
.yq-start {
  min-width: 180px;
}
.yq-link {
  background: none;
  border: 0;
  padding: 2px 0;
  color: var(--sg-primary);
  font: inherit;
  font-size: 0.875rem;
  text-decoration: underline;
  cursor: pointer;
}

/* 出題 */
.yq-status {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--sg-muted);
  font-variant-numeric: tabular-nums;
}
.yq-bar {
  height: 6px;
  margin-top: 6px;
  border-radius: 3px;
  background: var(--sg-surface-2, rgba(127, 127, 127, 0.15));
  overflow: hidden;
}
.yq-bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--sg-primary);
  transition: width 0.25s;
}
.yq-card {
  text-align: center;
  margin: 16px 0 12px;
}
.yq-ask {
  margin: 0;
  font-size: 0.95rem;
  color: var(--sg-muted);
}
.yq-big {
  margin: 6px 0;
  font-size: clamp(2.6rem, 15vw, 4.6rem);
  line-height: 1.2;
  font-weight: 500;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  color: var(--sg-fg);
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.yq-blank {
  color: var(--sg-primary);
}
.yq-tags {
  margin: 0;
}
.yq-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--sg-border);
  color: var(--sg-muted);
}

.yq-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.yq-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 12px;
  border: 1.5px solid var(--sg-border);
  border-radius: var(--sg-radius, 10px);
  background: var(--sg-surface);
  color: var(--sg-fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.yq-choice:hover:not(:disabled) {
  border-color: var(--sg-primary);
  background: var(--sg-primary-soft, rgba(59, 91, 219, 0.08));
}
.yq-choice:focus-visible {
  outline: 2px solid var(--sg-primary);
  outline-offset: 2px;
}
.yq-choice:disabled {
  cursor: default;
}
.yq-choice__no {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--sg-surface-2, rgba(127, 127, 127, 0.15));
  color: var(--sg-muted);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.yq-choice__body {
  font-size: 1.9rem;
  font-weight: 500;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  min-width: 0;
  overflow-wrap: anywhere;
}
.yq-choices--read .yq-choice__body {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
}
.yq-choice.is-correct {
  border-color: var(--sg-success, #16a34a);
  background: color-mix(in srgb, var(--sg-success, #16a34a) 14%, var(--sg-surface));
}
.yq-choice.is-wrong {
  border-color: var(--sg-danger, #dc2626);
  background: color-mix(in srgb, var(--sg-danger, #dc2626) 12%, var(--sg-surface));
}
.yq-choice.is-correct .yq-choice__no {
  background: var(--sg-success, #16a34a);
  color: #fff;
}
.yq-choice.is-wrong .yq-choice__no {
  background: var(--sg-danger, #dc2626);
  color: #fff;
}

/* 入力 */
.yq-inputrow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.yq-input {
  flex: 1 1 12em;
  max-width: 20em;
  min-width: 0;
  font-size: 1.25rem;
  text-align: center;
}

.yq-feedback {
  margin-top: 12px;
  min-height: 1.5em;
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.6;
}
.yq-feedback.is-ok,
.yq-feedback.is-ng {
  padding: 10px 12px;
  border-radius: var(--sg-radius, 10px);
}
.yq-feedback.is-ok {
  background: color-mix(in srgb, var(--sg-success, #16a34a) 12%, transparent);
}
.yq-feedback.is-ng {
  background: color-mix(in srgb, var(--sg-danger, #dc2626) 10%, transparent);
}
.yq-feedback__mark {
  font-size: 1.1rem;
}
.is-ok .yq-feedback__mark {
  color: var(--sg-success, #16a34a);
}
.is-ng .yq-feedback__mark {
  color: var(--sg-danger, #dc2626);
}
.yq-feedback__word {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}
.yq-feedback__kanji {
  font-size: 1.4rem;
  font-weight: 700;
}
.yq-feedback__yomi {
  color: var(--sg-muted);
  overflow-wrap: anywhere;
}
.yq-feedback__ans {
  font-weight: 700;
}
.yq-feedback__note,
.yq-feedback__grade {
  font-size: 0.85rem;
  color: var(--sg-muted);
  overflow-wrap: anywhere;
}
.yq-feedback__ng,
.yq-review__ng,
.yq-list__ng {
  font-size: 0.85rem;
  color: #b45309;
}
html.sg-dark .yq-feedback__ng,
html.sg-dark .yq-review__ng,
html.sg-dark .yq-list__ng {
  color: #fbbf24;
}
@media (prefers-color-scheme: dark) {
  html:not(.sg-light) .yq-feedback__ng,
  html:not(.sg-light) .yq-review__ng,
  html:not(.sg-light) .yq-list__ng {
    color: #fbbf24;
  }
}

.yq-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}
.yq-actions--start {
  justify-content: flex-start;
  margin-top: 8px;
}

/* 結果 */
.yq-final {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
}
.yq-comment {
  margin: 4px 0 12px;
  text-align: center;
  color: var(--sg-muted);
}
.yq-h3 {
  margin: 18px 0 6px;
  font-size: 1rem;
}
.yq-review {
  list-style: none;
  margin: 0;
  padding: 0;
}
.yq-review__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--sg-border);
  min-width: 0;
}
.yq-review__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}
.yq-review__kanji {
  font-size: 1.3rem;
  font-weight: 700;
}
.yq-review__yomi,
.yq-review__yours {
  font-size: 0.85rem;
  color: var(--sg-muted);
  overflow-wrap: anywhere;
}
.yq-review__mean {
  font-size: 0.92rem;
}

/* 表 */
.yq-table-wrap {
  overflow-x: auto;
}
.yq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.yq-table th,
.yq-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--sg-border);
  text-align: left;
  vertical-align: top;
}
.yq-table th {
  color: var(--sg-muted);
  font-weight: 600;
  font-size: 0.8rem;
  white-space: nowrap;
}
#record td {
  white-space: nowrap;
}

/* 苦手な熟語 */
.yq-weak-line {
  margin: 8px 0 4px;
  font-size: 0.9rem;
}
.yq-weak {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.yq-weak__item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--sg-border);
  border-radius: 8px;
  line-height: 1.3;
}
.yq-weak__kanji {
  font-weight: 700;
}
.yq-weak__yomi {
  font-size: 0.7rem;
  color: var(--sg-muted);
}

/* 一覧 */
.yq-listbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.yq-listbar .sg-input {
  flex: 1 1 14em;
  min-width: 0;
}
.yq-listbar .sg-select {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}
.yq-list-wrap {
  max-height: 70vh;
  overflow-y: auto;
}
.yq-list td {
  font-size: 0.88rem;
}
.yq-list__w {
  font-weight: 700;
  white-space: nowrap;
}
.yq-list__w small {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--sg-muted);
}
.yq-list td:nth-child(2) {
  min-width: 7em;
  overflow-wrap: anywhere;
}
.yq-list td:nth-child(3) {
  min-width: 12em;
}
.yq-list__ng,
.yq-list__src {
  display: block;
  margin-top: 2px;
}
.yq-list__src {
  font-size: 0.72rem;
  color: var(--sg-muted);
}

/* 答えの決め方（早見） */
.sg-chart {
  display: grid;
  gap: 2px;
}
.sg-chart-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--sg-border, #e5e7eb);
}
.sg-chart-row__key {
  flex: 0 0 6em;
  font-weight: 600;
}
.sg-chart-row__val {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--sg-muted, #555);
}

@media (max-width: 480px) {
  .yq-levels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .yq-choice__body {
    font-size: 1.6rem;
  }
  .yq-choices--read {
    grid-template-columns: 1fr;
  }
  .sg-chart-row {
    flex-direction: column;
    gap: 2px;
  }
}
@media (max-width: 340px) {
  .yq-choices {
    grid-template-columns: 1fr;
  }
}
