/* スマホ（iPhone）の縦画面を基本にした見た目 */
:root{
  --red:#e8384f; --red-d:#c42a3f; --green:#19b37a; --blue:#2f6fed;
  --bg:#f4f5f7; --card:#fff; --line:#e4e7eb; --text:#1f2329; --sub:#79818c;
  --safe-b:env(safe-area-inset-bottom,0px);
  --safe-t:env(safe-area-inset-top,0px);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent;}
html{-webkit-text-size-adjust:100%;}
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:-apple-system,"Hiragino Sans","Yu Gothic UI",system-ui,sans-serif;
  font-size:15px; line-height:1.6;
  overscroll-behavior-y:none;
}
button{font-family:inherit; font-size:inherit; color:inherit;}

#bar{
  position:fixed; top:0; left:0; right:0; z-index:20;
  padding:calc(var(--safe-t) + 10px) 16px 10px;
  background:var(--card); border-bottom:1px solid var(--line);
  font-weight:bold; color:var(--red);
}
#main{
  padding:calc(var(--safe-t) + 56px) 14px calc(var(--safe-b) + 76px);
  max-width:680px; margin:0 auto;
}

.card{background:var(--card); border-radius:14px; padding:14px 16px; margin-bottom:12px;}
.card.tap:active{background:#f0f1f3;}
.ttl{font-size:12px; color:var(--sub); font-weight:bold; margin-bottom:6px;}
.big{font-size:40px; font-weight:bold; line-height:1.1;}
.mid{font-size:22px; font-weight:bold;}
.note{font-size:12px; color:var(--sub); margin:8px 0 0;}
.row2{display:flex; gap:10px;}
.row2>div{flex:1;}

.barline{font-size:12px; color:var(--sub); margin-top:8px;}
.barline b{color:var(--text); margin-left:6px;}
.bar{height:7px; background:var(--bg); border-radius:4px; margin-top:3px; overflow:hidden;}
.bar i{display:block; height:100%; width:0; background:var(--green); transition:width .4s;}

.grades{display:flex; gap:6px;}
.grade{flex:1; text-align:center;}
.grade .g{width:38px;height:38px;line-height:36px;margin:0 auto 3px;border-radius:50%;
  border:2px solid var(--green); color:var(--green); font-weight:bold; font-size:13px;}
.grade .g.none{border-color:var(--line); color:var(--sub);}
.grade .n{font-size:10px; color:var(--sub);}

.btn{
  display:block; width:100%; padding:14px; margin-bottom:10px;
  border:2px solid transparent; border-radius:12px;
  font-size:16px; font-weight:bold; background:var(--card); cursor:pointer;
}
.btn.primary{background:var(--red); color:#fff;}
.btn.primary:active{background:var(--red-d);}
.btn.outline{background:var(--card); color:var(--red); border-color:var(--red);}
.btn.small{padding:9px; font-size:13px; font-weight:normal; border:1px solid var(--line);}
.btn.danger{color:var(--red);}
.btn.wide{width:100%;}

.chips{display:flex; gap:6px; flex-wrap:wrap;}
.chip{padding:7px 12px; border:1px solid var(--line); background:var(--card);
  border-radius:999px; font-size:12px; color:var(--sub); cursor:pointer;}
.chip.on{background:var(--red); border-color:var(--red); color:#fff; font-weight:bold;}

.phrase{font-size:17px; font-weight:bold;}
.phrase .hl{color:var(--red);}
.phrase-ja{color:var(--sub); font-size:13px; margin:4px 0 8px;}

.listrow{display:flex; gap:8px; align-items:center; padding:9px 0; border-bottom:1px solid var(--line); font-size:13px;}
.listrow:last-child{border:none;}
.tag{font-size:10px; padding:2px 7px; border-radius:999px; background:var(--bg); color:var(--sub); flex:none;}
.tag.wrong{background:#fdeef0; color:var(--red);}
.tag.done{background:#e8f7f1; color:var(--green);}
.grow{flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}

.statline{font-size:12px; margin-bottom:9px;}
.daychart{display:flex; gap:4px; align-items:flex-end; height:90px;}
.daybar{flex:1; text-align:center; font-size:9px; color:var(--sub);}
.daybar i{display:block; background:var(--red); border-radius:3px 3px 0 0; margin-bottom:3px;}

/* 下のタブ */
#tabs{
  position:fixed; left:0; right:0; bottom:0; z-index:20; display:flex;
  background:var(--card); border-top:1px solid var(--line);
  padding-bottom:var(--safe-b);
}
.tab{flex:1; border:none; background:none; padding:7px 0 5px; font-size:10px; color:var(--sub); cursor:pointer;}
.tab i{display:block; font-style:normal; font-size:19px; line-height:1.3;}
.tab.on{color:var(--red); font-weight:bold;}

/* ダイアログ */
.overlay{position:fixed; inset:0; z-index:70; background:rgba(0,0,0,.45);
  display:flex; align-items:flex-end; justify-content:center;}
.sheet{background:var(--card); width:100%; max-width:560px; max-height:90vh; overflow-y:auto;
  border-radius:18px 18px 0 0; padding:18px 16px calc(var(--safe-b) + 18px);}
.sheet h3{margin:0 0 14px; text-align:center; font-size:16px;}
.sheet .ttl{margin-top:14px;}
.sheet .chips{margin-top:6px;}
.sheet .btn{margin-top:16px;}

/* 学習中 */
.quiz{position:fixed; inset:0; z-index:80; background:var(--card); display:flex; flex-direction:column;}
.qhead{display:flex; align-items:center; gap:10px;
  padding:calc(var(--safe-t) + 8px) 14px 8px; border-bottom:1px solid var(--line);}
.qhead button{border:none; background:none; font-size:14px; color:var(--red); cursor:pointer; padding:4px;}
.qhead span{flex:1; text-align:center; color:var(--sub); font-size:13px;}
.qhead button:last-child{font-size:20px; color:var(--sub);}
.qhead button.on{color:#f5b50a;}

.qbody{flex:1; overflow-y:auto; padding:16px 16px 20px; -webkit-overflow-scrolling:touch;}
.qnum{font-size:11px; color:var(--sub); margin-bottom:8px;}
.qtext{font-size:17px; line-height:1.9; margin-bottom:14px;}
.qtext .blank{color:var(--red); font-weight:bold;}
.optline{font-size:14px; padding:3px 0; color:#39404a;}

.opt{display:block; width:100%; text-align:left; padding:11px 13px; margin-bottom:7px;
  border:1px solid var(--line); background:var(--card); border-radius:10px; font-size:14px;}
.opt.correct{border-color:var(--green); background:#e8f7f1; color:#0f7a52; font-weight:bold;}
.opt.wrong{border-color:var(--red); background:#fdeef0; color:var(--red-d);}
.opt .mk{font-weight:bold; margin-right:8px;}

.verdict{font-size:16px; font-weight:bold; margin:10px 0;}
.verdict.ok{color:var(--green);} .verdict.ng{color:var(--red);}
.history{font-size:11px; color:var(--sub); margin:10px 0;}
.explain{margin-top:14px; border-top:1px solid var(--line); padding-top:12px;}
.lbl{display:inline-block; background:var(--bg); color:var(--sub); font-size:10px;
  padding:2px 8px; border-radius:4px; margin-bottom:4px; font-weight:bold;}
.explain p{margin:0 0 12px; font-size:13px; line-height:1.8;}

.qfoot{padding:10px 14px calc(var(--safe-b) + 12px); border-top:1px solid var(--line);}
.timer{margin-bottom:8px;}
.tbar{height:4px; background:var(--bg); border-radius:3px; overflow:hidden;}
.tbar i{display:block; height:100%; width:100%; background:var(--red); transition:width 1s linear;}
.choices{display:flex; gap:7px;}
.choices>button{flex:1; padding:15px 0; border:1px solid var(--line); background:var(--card);
  border-radius:10px; font-size:16px; font-weight:bold; cursor:pointer;}
.choices>button:active{background:#f0f1f3;}
.qfoot .btn{margin:0;}

/* 単語カード */
.wtabs{display:flex; gap:5px; margin-bottom:14px;}
.wtab{flex:1; padding:7px 0; border:1px solid var(--line); background:var(--card);
  border-radius:8px; font-size:11px; color:var(--sub); cursor:pointer;}
.wtab.on{background:var(--red); border-color:var(--red); color:#fff;}
.wmain{font-size:23px; font-weight:bold; line-height:1.6; min-height:90px;}
.wmain .hl{color:var(--red);}
.wsub{display:block; font-size:14px; color:var(--sub); font-weight:normal; margin-top:8px;}
.speak{border:none; background:var(--red); color:#fff; width:42px; height:42px;
  border-radius:50%; font-size:17px; cursor:pointer;}
.know{display:flex; gap:10px; width:100%;}
.know button{flex:1; padding:16px 0; border:none; border-radius:10px;
  font-size:15px; font-weight:bold; cursor:pointer; color:#fff;}
.know .no{background:#99a0aa; color:#fff;}
.know .yes{background:var(--green); color:#fff;}

.hidden{display:none !important;}
.loading{text-align:center; color:var(--sub); padding:40px 0; font-size:13px;}

/* ===== Part6・Part7（文書を読んで答える形式） ===== */
/* 文書の見出し。メール・お知らせなどの種類を右に小さく出す */
.doctitle{display:flex; gap:8px; align-items:baseline; font-size:13px; font-weight:bold;
  line-height:1.6; margin-bottom:8px;}
.dockind{flex:none; font-size:10px; font-weight:normal; color:var(--sub);
  background:var(--bg); border-radius:999px; padding:2px 7px;}
/* 本文。改行をそのまま見せたいので pre-wrap にする */
.doc{white-space:pre-wrap; font-size:14px; line-height:1.9; color:#39404a;
  background:var(--bg); border-radius:10px; padding:12px 13px; margin-bottom:14px;}
/* いま解いている空所は赤。ほかの空所は番号だけ薄く出す */
.doc .blank{color:var(--red); font-weight:bold;}
.doc .blank.off{color:var(--sub); font-weight:normal;}
/* 本文の和訳は、押したときだけ開く */
.docja summary{font-size:12px; color:var(--blue); cursor:pointer; margin-bottom:8px;}
.docja .doc{margin-top:8px; margin-bottom:0;}
