:root{
  --bg:#fbfbf6;
  --bg2:#f6f3ea;
  --card:#ffffff;
  --line:#e8e6dd;

  --text:#222;
  --muted:#666;

  --brand:#5bb8a5;
  --brand2:#4aa3df;
  --brand-soft:#e6f4f1;

  --accent:#4aa3df;

  --radius:16px;
  --shadow:0 10px 28px rgba(0,0,0,.06);

  --base:18px;
  --lh:1.85;

  --ok:#2e9b6b;
  --ng:#d05151;
  --warn:#b98900;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:"Noto Sans JP", system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  font-size:var(--base);
  line-height:var(--lh);
  color:var(--text);
  background:
    radial-gradient(1100px 700px at 20% -10%, #ffffff 0%, transparent 60%),
    radial-gradient(900px 600px at 110% 10%, #ffffff 0%, transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
}

.wrap{
  width:min(980px, 92vw);
  margin:28px auto 40px;
}

/* ===== ヘッダー ===== */
.hero{
  background:linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.75));
  border:1px solid var(--line);
  border-radius:calc(var(--radius) + 6px);
  box-shadow:var(--shadow);
  padding:18px 18px 14px;
}

.hero__top{
  display:flex;
  gap:12px;
  align-items:baseline;
  justify-content:space-between;
  flex-wrap:wrap;
}

/* ★ タイトルに色を入れる */
.hero h1{
  margin:0;
  font-size:1.45rem;
  font-weight:800;
  letter-spacing:.03em;
  background: linear-gradient(90deg, var(--brand2), var(--brand));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ===== ツールバー ===== */
.toolbar{
  margin-top:14px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.toolbar__row{
  display:flex;
  gap:12px;
  align-items:flex-end;
  flex-wrap:wrap;
}

.toolbar__row--tight{
  align-items:center;
  justify-content:space-between;
}

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:240px;
  flex:1;
}

.field__label{
  font-size:.85rem;
  color:var(--muted);
}

.input,.select{
  height:44px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  font-size:1rem;
  outline:none;
}
.input:focus,.select:focus{
  border-color:rgba(74,163,223,.7);
  box-shadow:0 0 0 3px rgba(74,163,223,.15);
}

.toolbar__btns{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.btn{
  border:1px solid var(--line);
  background:#fff;
  border-radius:12px;
  height:44px;
  padding:0 12px;
  font-size:0.95rem;
  cursor:pointer;
  box-shadow:0 6px 16px rgba(0,0,0,.05);
  transition:transform .15s ease, box-shadow .15s ease;
}
.btn:hover{transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn--ghost{
  background:transparent;
  box-shadow:none;
}
.btn--small{
  height:38px;
  padding:0 10px;
  font-size:.92rem;
}

.chips{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.meta{
  display:flex;
  gap:12px;
  align-items:center;
  color:var(--muted);
  margin-left:auto;
}
.status{font-size:.9rem}
.count{
  font-size:.9rem;
  padding:6px 10px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.7);
  border-radius:999px;
}

/* ===== エラー ===== */
.error{
  border:1px solid rgba(208,81,81,.35);
  background:rgba(208,81,81,.08);
  border-radius:14px;
  padding:12px;
}
.error__title{
  font-weight:700;
  color:#9d1f1f;
  margin-bottom:4px;
}
.error__msg{
  color:#6c1a1a;
  font-size:.95rem;
}

/* ===== リスト ===== */
.list{
  margin-top:16px;
  display:flex;
  flex-direction:column;
  gap:16px; /* ← 見やすさ重視 */
}

/* ===== カード ===== */
.card{
  border:1px solid var(--line);
  background:rgba(255,255,255,.92);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;
  transition:border-color .25s ease, box-shadow .25s ease;
}

/* ★ 学習カード感（控えめ） */
.card:hover{
  border-color:rgba(74,163,223,.4);
  box-shadow:0 12px 30px rgba(74,163,223,.12);
}

.card__head{
  display:flex;
  gap:12px;
  align-items:center;
  justify-content:space-between;
  padding:14px;
  cursor:pointer;
}

.qmeta{
  display:flex;
  gap:12px;
  align-items:flex-start;
  flex:1;
  min-width:0;
}

/* ★ 第◯問バッジを強化 */
/* ★ 第◯問バッジ（横書き固定・縦崩れ防止） */
.no{
  position:relative;
  display:inline-flex;
  align-items:center;

  padding:6px 14px 6px 18px;
  font-weight:800;
  font-size:.95rem;

  border-radius:999px;
  background:linear-gradient(
    180deg,
    rgba(91,184,165,.18),
    rgba(74,163,223,.18)
  );
  color:#1f5f55;

  white-space:nowrap;     /* ← 改行させない */
  min-width:4.5em;        /* ← 第10問くらいまで耐える */
  flex-shrink:0;          /* ← flexで潰されない */
}

/* 左アクセントライン */
.no::before{
  content:"";
  position:absolute;
  left:6px;
  top:50%;
  transform:translateY(-50%);
  width:4px;
  height:60%;
  border-radius:4px;
  background:var(--brand);
}


.qtext{
  margin:0;
  font-size:1.03rem;
  line-height:1.6;
  word-break:break-word;
}

.card__actions{
  display:flex;
  gap:8px;
  align-items:center;
}

.iconbtn{
  border:1px solid var(--line);
  background:#fff;
  border-radius:12px;
  height:44px;
  padding:0 10px;
  cursor:pointer;
  font-size:.95rem;
  transition:background .15s ease;
}

.iconbtn:hover{
  background:rgba(74,163,223,.08);
}

.star{
  width:44px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:1.1rem;
}
.star[aria-pressed="true"]{
  background:rgba(185,137,0,.15);
  border-color:rgba(185,137,0,.4);
}

.card__body{
  border-top:1px solid var(--line);
}

.card__inner{
  padding:16px 14px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

/* ===== 回答 ===== */
.answerRow{
  border:3px solid rgba(91,184,165,.35);
  background:rgba(91,184,165,.10);
  border-radius:14px;
  padding:10px 12px;
  display:flex;
  justify-content:space-between;
  align-items:center;
}

.answerLabel{
  font-weight:700;
  color:var(--muted);
}

.judge{
  font-weight:900;
  font-size:1.2rem;
}

.judgeColorOn .judge.is-ok{color:var(--ok)}
.judgeColorOn .judge.is-ng{color:var(--ng)}

/* ===== 解説・出典 ===== */
.note{
  margin:0;
  white-space:pre-wrap;
}

.kv{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.k{
  font-size:.9rem;
  font-weight:800;
  color:var(--muted);
}

.source{
  border:1px dashed rgba(0,0,0,.18);
  border-radius:14px;
  padding:10px 12px;
  background:rgba(255,255,255,.65);
}

details.sourceFold summary{
  cursor:pointer;
  font-weight:800;
  color:var(--muted);
}
details.sourceFold summary::after{
  content:" ▾";
}
details.sourceFold[open] summary::after{
  content:" ▴";
}

/* ===== フッター ===== */
.foot{
  margin-top:18px;
  text-align:center;
  color:var(--muted);
}

/* ===== 開閉ボタン文言 ===== */
.toggleBtn::before{content:"回答を見る"}
.card.is-open .toggleBtn::before{content:"閉じる"}

/* ===== スマホ ===== */
@media (max-width:720px){
  .wrap{margin:18px auto 30px}
  .card__head{
    flex-direction:column;
    align-items:stretch;
    gap:10px;
  }
  .qmeta{
    flex-direction:column;
    gap:8px;
  }
  .card__actions{
    justify-content:flex-end;
  }
}
