:root{
  --bg:#f6f7f9;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --primary:#2563eb;
  --danger:#ef4444;
  --shadow: 0 10px 30px rgba(17,24,39,.08);
  --radius:16px;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:var(--bg);
  color:var(--text);
}

.app{
  max-width: 720px;
  margin: 0 auto;
  padding: 18px 14px 40px;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom: 14px;
}

.brand{
  display:flex;
  gap:10px;
  align-items:center;
}
.logo{
  width:42px;height:42px;
  border-radius:12px;
  display:flex;align-items:center;justify-content:center;
  background:#eef2ff;
  box-shadow: var(--shadow);
}
.title{font-weight:800; letter-spacing:-0.3px}
.subtitle{font-size:12px;color:var(--muted);margin-top:2px}

.card{
  background:var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.hidden{display:none !important}

.muted{color:var(--muted)}
.small{font-size:12px}
.label{display:block; font-size:12px; color:var(--muted); margin-bottom:8px}

.progress-meta{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-size:12px;
  margin-bottom:8px;
}
.progress-bar{
  width:100%;
  height:10px;
  border-radius:999px;
  background:#f3f4f6;
  overflow:hidden;
}
.progress-fill{
  height:100%;
  background: var(--primary);
  border-radius:999px;
  transition: width .25s ease;
}

.question{
  display:flex;
  gap:10px;
  margin-top:14px;
}
.question-label{
  width:32px; height:32px;
  border-radius: 10px;
  display:flex; align-items:center; justify-content:center;
  background:#f0f9ff;
  border:1px solid #dbeafe;
  font-weight:800;
}
.question-text{
  font-size:16px;
  line-height:1.45;
  font-weight:700;
  letter-spacing:-0.2px;
  padding-top:4px;
}

.answer{ margin-top:14px; }
textarea{
  width:100%;
  border:1px solid var(--line);
  border-radius: 14px;
  padding:12px 12px;
  font-size:14px;
  outline:none;
  resize:vertical;
  min-height: 110px;
}
textarea:focus{
  border-color:#93c5fd;
  box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}
.hint{margin-top:8px; font-size:12px}

.nav{
  display:flex;
  gap:10px;
  margin-top: 14px;
}
.footer-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-top: 12px;
}

button{
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size:14px;
  cursor:pointer;
  background:#fff;
}
button:active{transform: translateY(1px)}
button.primary{
  background: var(--primary);
  color:#fff;
  border-color: transparent;
  font-weight:700;
}
button.ghost{
  background:#fff;
  color:var(--text);
}
button.danger{
  background: var(--danger);
  color:#fff;
  border-color: transparent;
  font-weight:700;
}

.result-head{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:14px;
  margin-bottom: 10px;
}
.result-title{font-size:18px; font-weight:900; letter-spacing:-0.3px}
.score-badge{
  min-width: 90px;
  text-align:center;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 10px;
  background:#f9fafb;
}
.score-num{font-size:24px;font-weight:900}
.score-label{font-size:12px;color:var(--muted);margin-top:2px}

.block{ margin-top: 14px; }
.block-title{font-weight:900; margin-bottom: 8px; letter-spacing:-0.2px}
.summary{margin:0; line-height:1.6}

.grid2{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
}
@media (min-width: 640px){
  .grid2{ grid-template-columns: 1fr 1fr; }
}

.panel{
  border: 1px solid var(--line);
  background:#fff;
  border-radius: 16px;
  padding: 12px;
}

.list{
  margin:0;
  padding-left: 18px;
  line-height:1.55;
}
.row-between{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
}

.cta-row{margin-top: 12px}
.cta-row button{width:100%}

#scoreTable{
  margin-top: 8px;
  display:grid;
  gap:8px;
}
.score-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:#f9fafb;
}
.score-row .q{flex:1; font-size:13px; color:#111827; line-height:1.4}
.score-row .s{
  width:56px;
  text-align:right;
  font-weight:900;
}

/* Modal */
.modal{ position:fixed; inset:0; display:flex; align-items:center; justify-content:center; padding: 16px; z-index: 50; }
.modal-backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.35); }
.modal-card{
  position:relative;
  width:min(520px, 100%);
  background:#fff;
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px;
}
.modal-title{font-weight:900}
.pay-summary{
  margin-top: 10px;
  border:1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background:#f9fafb;
}
.pay-box{
  margin-top: 10px;
  border:1px dashed #c7d2fe;
  border-radius: 16px;
  padding: 12px;
  background:#eef2ff;
}
