/* ================================================================
   style.css  ― ROM テスト学習アプリ
   モバイルファースト、Netlify 静的配信対応
   ================================================================ */

:root {
  --blue:    #2563eb;
  --blue-dk: #1d4ed8;
  --blue-lt: #eff6ff;
  --green:   #16a34a;
  --orange:  #d97706;
  --red:     #dc2626;
  --gray:    #64748b;
  --border:  #e2e8f0;
  --bg:      #f1f5f9;
  --white:   #ffffff;
  --text:    #1e293b;
  --r:       12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ---- PTCore サイト共通ヘッダー ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.site-header-inner {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-back-link {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--blue);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background .15s;
}
.site-back-link:hover { background: #eff6ff; }
.site-back-link svg   { flex-shrink: 0; }
.site-header-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
}
.site-logo-link {
  font-size: .9rem;
  font-weight: 900;
  text-decoration: none;
  letter-spacing: -.5px;
}
.site-logo-pt   { color: var(--blue); }
.site-logo-core { color: var(--text); }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 620px;
  margin: 0 auto;
  padding: 1rem 0.875rem 3rem;
}

.screen  { display: block; }
.hidden  { display: none !important; }

/* ---- タイトル ---- */
h1 {
  font-size: 1.75rem;
  text-align: center;
  margin-bottom: 0.2rem;
}
.subtitle {
  text-align: center;
  color: var(--gray);
  font-size: 0.9rem;
  margin-bottom: 1.4rem;
}

/* ---- ボタン類 ---- */
.btn-primary {
  display: block;
  width: 100%;
  padding: 0.85rem;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: var(--r);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 0.9rem;
  transition: background .15s;
}
.btn-primary:hover:not(:disabled) { background: var(--blue-dk); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }

.btn-secondary {
  display: block;
  width: 100%;
  padding: 0.75rem;
  background: var(--white);
  color: var(--blue);
  border: 2px solid var(--blue);
  border-radius: var(--r);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: background .15s;
}
.btn-secondary:hover { background: var(--blue-lt); }

.btn-quit {
  display: block;
  width: 100%;
  padding: 0.55rem;
  background: transparent;
  color: var(--gray);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 0.88rem;
  cursor: pointer;
  margin-top: 0.5rem;
  transition: color .15s, border-color .15s;
}
.btn-quit:hover { color: var(--red); border-color: var(--red); }

/* クイックセレクトタグ */
.select-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }
.btn-tag {
  padding: 0.35rem 0.8rem;
  background: var(--white);
  color: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 99px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background .15s;
}
.btn-tag:hover { background: var(--blue-lt); }

/* ---- 部位グリッド ---- */
.lead { color: var(--gray); font-size: 0.9rem; margin-bottom: 0.6rem; }

#part-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}
@media (min-width: 480px) {
  #part-grid { grid-template-columns: repeat(4, 1fr); }
}

.part-btn {
  padding: 0.6rem 0.3rem;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
  line-height: 1.3;
}
.part-btn:hover { border-color: var(--blue); color: var(--blue); }
.part-btn.on    { background: var(--blue); color: #fff; border-color: var(--blue); }

.selected-info {
  text-align: center;
  color: var(--gray);
  font-size: 0.88rem;
  margin-bottom: 0.2rem;
}

/* ---- プログレス ---- */
.progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--gray);
  margin-bottom: 0.4rem;
}
.prog-pts { font-weight: 600; }
.progress-bg {
  background: var(--border);
  border-radius: 99px;
  height: 6px;
  margin-bottom: 1rem;
  overflow: hidden;
}
.progress-fill {
  background: var(--blue);
  height: 100%;
  border-radius: 99px;
  transition: width .3s;
}

/* ---- カード ---- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 1.2rem;
}

/* ---- 問題ヘッダー ---- */
.q-part     { font-size: 0.8rem; color: var(--gray); margin-bottom: 0.2rem; }
.q-movement {
  font-size: 1.25rem;
  font-weight: 700;
  border-left: 4px solid var(--blue);
  padding-left: 0.7rem;
  margin-bottom: 1.2rem;
  line-height: 1.4;
}

/* ---- セクションラベル ---- */
.sec-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: .04em;
  margin: 1rem 0 0.5rem;
}

/* ---- スライダー ---- */
.slider-val {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--blue);
  text-align: center;
  margin-bottom: 0.3rem;
}
input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
  height: 30px;
  cursor: pointer;
}
.slider-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--gray);
  margin-top: -0.2rem;
}

/* ---- ラジオ選択肢 ---- */
.choices { display: flex; flex-direction: column; gap: 0.45rem; }
.choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.7rem 0.9rem;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 9px;
  font-size: 0.93rem;
  cursor: pointer;
  text-align: left;
  line-height: 1.45;
  transition: border-color .12s, background .12s;
}
.choice-btn:hover { border-color: var(--blue); }
.choice-btn.on    { border-color: var(--blue); background: var(--blue-lt); color: var(--blue); font-weight: 600; }
.choice-num {
  min-width: 1.4rem;
  height: 1.4rem;
  background: var(--border);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 0.05rem;
}
.choice-btn.on .choice-num { background: var(--blue); color: #fff; }

/* ---- 採点結果 ---- */
.sc-headline {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.6rem;
  border-radius: 8px;
  margin: 0.75rem 0;
}
.sc-full    { background: #dcfce7; color: var(--green); }
.sc-partial { background: #fef9c3; color: #92400e; }
.sc-zero    { background: #fee2e2; color: var(--red); }

.sc-row {
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}
.sc-row .lbl  { font-weight: 700; margin-bottom: 0.3rem; }
.sc-row .usr  { color: var(--gray); margin-bottom: 0.15rem; }
.sc-row .ans  { font-weight: 600; margin-bottom: 0.25rem; }
.badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
}
.b-ok   { background: #dcfce7; color: var(--green); }
.b-half { background: #fef9c3; color: #92400e; }
.b-ng   { background: #fee2e2; color: var(--red); }

.note-box {
  background: #f0f9ff;
  border-left: 3px solid #7dd3fc;
  padding: 0.55rem 0.8rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  color: #0369a1;
  margin-top: 0.75rem;
  line-height: 1.5;
}

/* ---- 結果画面 ---- */
.result-title { text-align: center; margin-bottom: 1rem; font-size: 1.5rem; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}
.metric {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 0.9rem 0.4rem;
  text-align: center;
}
.metric .val { font-size: 1.6rem; font-weight: 700; color: var(--blue); }
.metric .lbl { font-size: 0.78rem; color: var(--gray); }

.all-correct {
  background: #dcfce7;
  border-radius: var(--r);
  padding: 1.4rem;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 1rem;
}

.wrong-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.6rem; }

.w-item { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 0.5rem; overflow: hidden; }
.w-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0.9rem;
  background: var(--white);
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
}
.w-head:hover { background: #f8fafc; }
.w-head .sc   { color: var(--red); font-weight: 700; white-space: nowrap; margin-left: 0.5rem; }
.w-body {
  display: none;
  padding: 0.7rem 0.9rem;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
}
.w-body.open { display: block; }
.w-body table { width: 100%; border-collapse: collapse; }
.w-body td    { padding: 0.2rem 0.3rem; vertical-align: top; }
.w-body td:first-child { color: var(--gray); white-space: nowrap; padding-right: 0.6rem; }

.result-btns { margin-top: 1.2rem; }
