/* ==========================================================
   IELTS ทุกวัน — สไตล์ชีตเดียว เขียนเอง ไม่มี framework
   หน้าจอไทย = ตัวอักษรไม่มีหัว / เนื้อหาข้อสอบอังกฤษ = ตัวมีเชิง
   ========================================================== */

:root{
  --ink:#10231F;
  --ink-2:#4A5B54;
  --ink-3:#7C8C85;
  --bg:#EFF4F0;
  --card:#FFFFFF;
  --line:#DCE7E0;
  --brand:#14514B;
  --brand-2:#2A9D8F;
  --flame:#E8890C;
  --wrong:#B8483F;
  --radius:16px;
  --tap:58px;
}

*{box-sizing:border-box;}
html{-webkit-text-size-adjust:100%;}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:"Noto Sans Thai","IBM Plex Sans Thai","Sarabun",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  font-size:17px;
  line-height:1.7;
  padding-bottom:calc(72px + env(safe-area-inset-bottom));
}
.wrap{max-width:600px;margin:0 auto;padding:16px 14px 8px;}

h1,h2,h3{line-height:1.4;margin:0 0 10px;font-weight:800;letter-spacing:-.01em;}
h1{font-size:25px;}
h2{font-size:20px;}
h3{font-size:17px;}
p{margin:0 0 12px;}
a{color:var(--brand);}

/* ---------- หัวหน้าจอ ---------- */
.top{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:14px;}
.top .eyebrow{color:var(--ink-3);font-size:14px;font-weight:600;}
.gear{color:var(--ink-3);text-decoration:none;font-size:14px;font-weight:600;}

/* ---------- การ์ด ---------- */
.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:18px;
  margin-bottom:14px;
}
.card.tight{padding:14px;}
.card.brand{background:var(--brand);color:#fff;border-color:var(--brand);}
.card.brand .muted,.card.brand a{color:#BFE0DA;}

/* ---------- แถบไฟ ---------- */
.strip{display:flex;gap:6px;margin:4px 0 2px;}
.day{
  flex:1;text-align:center;border-radius:12px;padding:8px 0 5px;
  border:1px solid var(--line);background:#F7FAF8;
}
.day .mark{display:block;font-size:19px;line-height:1.2;}
.day .dow{display:block;font-size:11px;color:var(--ink-3);font-weight:700;}
.day.lit{background:#FFF3E0;border-color:#F3D3A3;}
.day.rest{background:#EEF1F6;border-color:#D9E0EA;}
.day.froze{background:#E9F4FA;border-color:#C6E1EE;}
.day.now{border-color:var(--brand-2);border-style:dashed;background:#fff;}
.day.off .mark{color:#C6D2CB;}

/* ---------- ตัวเลขใหญ่ ---------- */
.bignum{font-size:44px;font-weight:800;line-height:1;letter-spacing:-.03em;}
.bignum small{font-size:18px;font-weight:700;color:var(--ink-3);}
.muted{color:var(--ink-3);font-size:14px;}

.progress{height:12px;border-radius:99px;background:#E3EBE6;overflow:hidden;margin:12px 0 6px;}
.progress i{display:block;height:100%;background:var(--brand-2);border-radius:99px;transition:width .4s ease;}
.card.brand .progress{background:rgba(255,255,255,.22);}
.card.brand .progress i{background:#8FE3D5;}

/* ---------- ปุ่ม ---------- */
.btn{
  display:flex;align-items:center;justify-content:center;gap:8px;
  width:100%;min-height:var(--tap);
  border:0;border-radius:14px;
  background:var(--brand);color:#fff;
  font:inherit;font-weight:800;font-size:18px;
  text-decoration:none;cursor:pointer;padding:12px 18px;
  -webkit-tap-highlight-color:transparent;
}
.btn:active{transform:scale(.985);}
.btn[disabled]{opacity:.45;cursor:not-allowed;}
.btn.flame{background:var(--flame);}
.btn.ghost{background:#fff;color:var(--brand);border:2px solid var(--line);}
.btn.small{min-height:46px;font-size:16px;}
.btn+.btn{margin-top:10px;}
.btn-row{display:flex;gap:10px;}
.btn-row .btn{margin-top:0;}

/* ---------- เนื้อหาข้อสอบภาษาอังกฤษ ---------- */
.en{
  font-family:Georgia,"Times New Roman",serif;
  font-size:18px;line-height:1.85;
}
.passage{
  background:#FCFCF8;border:1px solid var(--line);border-radius:var(--radius);
  padding:18px;margin-bottom:14px;
}
.passage h3{font-family:Georgia,serif;font-size:19px;}
.passage p{margin:0 0 14px;}
.passage p:last-child{margin-bottom:0;}
details.passage-toggle summary{
  cursor:pointer;font-weight:700;color:var(--brand);padding:10px 0;list-style:none;
}
details.passage-toggle summary::-webkit-details-marker{display:none;}

/* ---------- ตัวเลือกคำตอบ ---------- */
.qnum{color:var(--ink-3);font-size:13px;font-weight:800;letter-spacing:.08em;text-transform:uppercase;}
.choices{display:flex;flex-direction:column;gap:10px;margin:14px 0 0;}
.choice{
  display:flex;align-items:flex-start;gap:12px;
  min-height:var(--tap);padding:14px 16px;
  background:#fff;border:2px solid var(--line);border-radius:14px;
  cursor:pointer;text-align:left;font:inherit;width:100%;
}
.choice .key{
  flex:none;width:28px;height:28px;border-radius:8px;background:#EDF3F0;
  color:var(--brand);font-weight:800;font-size:14px;
  display:flex;align-items:center;justify-content:center;
}
.choice .txt{font-family:Georgia,serif;font-size:17px;line-height:1.5;}
.choice.sel{border-color:var(--brand);background:#F0F7F5;}
.choice.sel .key{background:var(--brand);color:#fff;}

input[type=text],input[type=email],input[type=number],input[type=password],select,textarea{
  width:100%;min-height:52px;padding:13px 15px;
  border:2px solid var(--line);border-radius:12px;background:#fff;
  font:inherit;color:var(--ink);
}
textarea{min-height:220px;line-height:1.7;font-family:Georgia,serif;font-size:17px;}
input.gap{font-family:Georgia,serif;font-size:19px;text-align:center;}
input:focus,select:focus,textarea:focus,.choice:focus-visible,.btn:focus-visible{
  outline:3px solid #8FD6C9;outline-offset:2px;
}
label.field{display:block;margin-bottom:12px;}
label.field span{display:block;font-size:14px;font-weight:700;color:var(--ink-2);margin-bottom:5px;}

/* ---------- ผลตรวจ ---------- */
.verdict{padding:14px 16px;border-radius:14px;margin-bottom:12px;font-weight:700;}
.verdict.ok{background:#E6F5F1;color:#14514B;}
.verdict.no{background:#FBECEA;color:var(--wrong);}
.explain{background:#F7FAF8;border-left:4px solid var(--brand-2);padding:12px 14px;border-radius:0 12px 12px 0;margin-bottom:12px;}
.evidence{font-family:Georgia,serif;font-style:italic;color:var(--ink-2);font-size:16px;}

/* ---------- รายการ ---------- */
.list{list-style:none;margin:0;padding:0;}
.list li{
  display:flex;justify-content:space-between;align-items:center;gap:12px;
  padding:13px 0;border-bottom:1px solid var(--line);
}
.list li:last-child{border-bottom:0;}
.pill{
  font-size:13px;font-weight:800;padding:4px 11px;border-radius:99px;
  background:#EDF3F0;color:var(--brand);white-space:nowrap;
}
.pill.warn{background:#FFF1DC;color:#9A6209;}
.pill.bad{background:#FBECEA;color:var(--wrong);}

table.data{width:100%;border-collapse:collapse;font-size:16px;margin-bottom:14px;}
table.data th,table.data td{border:1px solid var(--line);padding:9px 11px;text-align:left;}
table.data th{background:#F2F7F4;font-weight:800;}

/* ---------- flash ---------- */
.flash{padding:13px 16px;border-radius:12px;margin-bottom:14px;font-weight:700;}
.flash-ok{background:#E6F5F1;color:#14514B;}
.flash-warn{background:#FFF1DC;color:#8A5800;}
.flash-err{background:#FBECEA;color:var(--wrong);}

/* ---------- นาฬิกา / ตัวนับ ---------- */
.meter{display:flex;gap:10px;align-items:center;justify-content:space-between;margin-bottom:12px;}
.timer{font-variant-numeric:tabular-nums;font-weight:800;color:var(--ink-2);}
.dots{display:flex;gap:5px;flex-wrap:wrap;}
.dots i{width:9px;height:9px;border-radius:50%;background:#D3DED8;display:block;}
.dots i.done{background:var(--brand-2);}
.dots i.miss{background:#E3B0AA;}
.dots i.here{background:var(--flame);transform:scale(1.35);}

/* ---------- แถบล่าง ---------- */
.tabbar{
  position:fixed;left:0;right:0;bottom:0;z-index:20;
  display:flex;background:#fff;border-top:1px solid var(--line);
  padding-bottom:env(safe-area-inset-bottom);
}
.tab{
  flex:1;display:flex;flex-direction:column;align-items:center;gap:2px;
  padding:9px 0 7px;text-decoration:none;color:var(--ink-3);font-size:12px;font-weight:700;
}
.tab svg{width:23px;height:23px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;}
.tab.is-active{color:var(--brand);}

/* ---------- เบ็ดเตล็ด ---------- */
.hr{height:1px;background:var(--line);margin:16px 0;border:0;}
.center{text-align:center;}
.stack>*+*{margin-top:10px;}
.badge-ai{font-size:12px;color:var(--ink-3);}
.audio-controls{display:flex;gap:10px;margin:12px 0;}
.audio-controls .btn{margin-top:0;}
.wordcount{font-weight:800;color:var(--ink-2);font-variant-numeric:tabular-nums;}
.wordcount.ok{color:var(--brand-2);}

@media (prefers-reduced-motion: reduce){
  *{transition:none !important;animation:none !important;}
}
