:root{
  --brand:#37a16f;
  --brand2:#2a7bc1;
  --bg:#f7faf8;
  --card:#ffffff;
  --ink:#1b1f23;
  --good:#22c55e;
  --bad:#ef4444;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, "Helvetica Neue", Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color:var(--ink);
}
.header{display:flex;align-items:center;gap:12px;padding:16px 20px;background:linear-gradient(135deg,#e7f6ee,#e6f1fb);border-bottom:1px solid #e4e4e7;position:sticky;top:0;z-index:10}
.header img{height:58px;border-radius:12px;object-fit:contain}
.header .title{font-weight:700;font-size:22px}
.header .subtitle{font-size:12px;color:#475569}
.container{max-width:1120px;margin:10px auto;padding:16px;display:grid;grid-template-columns:340px 1fr;gap:16px}
.card{background:var(--card);border:1px solid #e4e4e7;border-radius:16px;box-shadow:0 4px 10px rgba(0,0,0,.04);padding:16px}
.controls .row{display:flex;gap:10px;align-items:center;margin-bottom:10px;flex-wrap:wrap}
.controls select,.controls input[type="number"],.controls input[type="text"]{padding:10px 12px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;min-width:120px}
.controls button{padding:10px 14px;border-radius:12px;border:0;cursor:pointer;font-weight:600}
.btn-primary{background:var(--brand);color:#fff}
.btn-secondary{background:#e6f1fb;color:#0b4e94}
.btn-ghost{background:#f3f4f6;color:#111827}
.btn-wide{min-width:160px}
.grid-wrap{display:flex;align-items:center;justify-content:center;padding:10px}
.grid{width:min(86vmin,720px);aspect-ratio:1;border-radius:18px;background:#fff;display:grid;grid-template-columns:repeat(10,1fr);grid-template-rows:repeat(10,1fr);overflow:hidden;border:1px solid #e5e7eb;position:relative}
.cell{border:1px dashed #eef2f7;display:flex;align-items:center;justify-content:center;position:relative}
.dot{width:70%;aspect-ratio:1;border-radius:999px;background:var(--brand2);box-shadow:inset 0 -6px 10px rgba(0,0,0,.15);transform:scale(.7);opacity:0;transition:transform .22s ease,opacity .22s ease}
.dot.show{opacity:1;transform:scale(1)}
.panel{display:flex;gap:10px;flex-wrap:wrap;align-items:center;justify-content:center;margin-top:10px}
#answerInput{font-size:22px;padding:14px 16px;border-radius:12px;border:1px solid #e5e7eb;width:140px;text-align:center}
.mc{display:flex;gap:10px;justify-content:center;flex-wrap:wrap}
.mc button{padding:12px 16px;border-radius:12px;border:1px solid #e5e7eb;background:#fff;cursor:pointer;font-weight:700;min-width:90px}
.badge{display:inline-block;padding:6px 10px;border-radius:999px;background:#eef2ff;color:#1e3a8a;font-weight:700;font-size:12px}
.stats{display:flex;gap:12px;flex-wrap:wrap}
.stat{background:#f3f4f6;border-radius:10px;padding:8px 10px;font-size:12px}
footer{margin:24px auto 40px;max-width:1100px;padding:0 16px;color:#6b7280;font-size:12px;text-align:center}
.feedback{min-height:26px;text-align:center;font-weight:700;margin-top:6px}
.feedback.good{color:var(--good)} .feedback.bad{color:var(--bad)}
.toggle{display:flex;align-items:center;gap:6px}
hr.soft{border:none;border-top:1px solid #e5e7eb;margin:12px 0}
.confetti{pointer-events:none;position:fixed;inset:0;overflow:hidden;background:transparent}
.confetti span{position:absolute;animation:fly 2s ease-out forwards}
@keyframes fly{to{transform:translateY(60vh) rotate(340deg);opacity:0}}
kbd{background:#eef2ff;border:1px solid #c7d2fe;border-bottom-width:3px;border-radius:6px;padding:2px 6px;font-weight:700;font-size:12px}
.small{font-size:12px;color:#475569}

/* Overlay */
.overlay{position:fixed;inset:0;background:rgba(0,0,0,.35);display:none;align-items:center;justify-content:center;z-index:50;padding:16px}
.overlay.show{display:flex}
.overlay-card{background:#fff;border:1px solid #e5e7eb;border-radius:18px;box-shadow:0 10px 30px rgba(0,0,0,.18);max-width:min(92vw,900px);width:100%;padding:18px}
.overlay-card h3{margin:0 0 8px 0}
.explain-grid{display:grid;grid-template-columns:repeat(10,1fr);grid-template-rows:repeat(10,1fr);aspect-ratio:1;border:1px solid #e5e7eb;border-radius:12px;overflow:hidden;margin:8px 0 12px}
.explain-grid .cell{border:1px dashed #eef2f7}
.explain-grid .dot{width:70%;aspect-ratio:1;border-radius:999px;background:var(--brand2);opacity:1;transform:scale(1)}
.explain-grid .ten{background:var(--brand);opacity:.88}
.explain-grid .one{outline:3px solid #0b4e94}

/* Big UI */
.big-ui .controls select,
.big-ui .controls input[type="number"],
.big-ui .controls input[type="text"]{font-size:20px;padding:16px 18px;min-width:180px}
.big-ui .controls button, .big-ui .mc button, .big-ui #submitBtn{font-size:20px;padding:18px 22px;min-width:160px;border-radius:16px}
.big-ui #answerInput{font-size:28px;padding:18px 22px;width:200px}
.big-ui .title{font-size:26px}
.big-ui .subtitle{font-size:14px}
.big-ui .badge{font-size:14px}
.big-ui .grid{width:min(92vmin,820px)}

@media (max-width: 920px){
  .container{grid-template-columns:1fr}
}

.overlay-card{position:relative}
.overlay-x{position:absolute;top:10px;right:10px;border:0;background:#f3f4f6;border-radius:10px;padding:6px 10px;cursor:pointer;font-weight:700}
