:root{
  --primary:#6EC6FF;
  --accent:#FFD54F;
  --bg:#FDFDFD;
  --text:#212121;
  --muted:#616161;
  --border:#E6E6E6;
  --shadow: 0 10px 30px rgba(0,0,0,.08);
  --radius: 18px;
}
*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  background:
    radial-gradient(800px 300px at 10% 0%, rgba(110,198,255,.25), transparent 60%),
    radial-gradient(900px 360px at 90% 0%, rgba(255,213,79,.22), transparent 65%),
    var(--bg);
  color:var(--text);
  font-family: "Nunito", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height:1.4;
}
.app{
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display:grid;
  grid-template-columns: 390px 1fr;
  gap: 16px;
  align-items:start;
}
@media (max-width: 1000px){ .app{ grid-template-columns: 1fr; } }

.topbar{
  grid-column: 1 / -1;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.brand{ display:flex; align-items:center; gap:12px; }
.mascot{
  width:54px; height:54px; border-radius:16px;
  background: linear-gradient(180deg, rgba(110,198,255,.35), rgba(110,198,255,.12));
  border:1px solid rgba(110,198,255,.55);
  display:grid; place-items:center; font-size:26px;
}
.brand h1{ margin:0; font-family:"Poppins","Nunito",sans-serif; font-size:20px; line-height:1.1; }
.brand .subtitle{ color:var(--muted); font-size:13px; margin-top:2px; }
.badge{
  font-size:12px; font-weight:900; padding:4px 10px; border-radius:999px;
  border:1px solid rgba(110,198,255,.65); background:rgba(110,198,255,.18);
}
.quick-actions{ display:flex; gap:10px; flex-wrap:wrap; justify-content:flex-end; }
.btn{
  cursor:pointer; border:1px solid var(--border); background:#fff; color:var(--text);
  border-radius:14px; padding:10px 14px; font-weight:800; font-size:15px;
  display:inline-flex; align-items:center; gap:8px;
  box-shadow:0 4px 14px rgba(0,0,0,.06);
  transition: transform .12s ease, filter .12s ease;
  user-select:none;
}
.btn:hover{ filter:brightness(1.02); transform:translateY(-1px); }
.btn:active{ transform:translateY(0); }
.btn.primary{ border-color:rgba(110,198,255,.7); background:linear-gradient(180deg, rgba(110,198,255,.35), rgba(110,198,255,.15)); }
.btn.accent{ border-color:rgba(255,213,79,.85); background:linear-gradient(180deg, rgba(255,213,79,.45), rgba(255,213,79,.18)); }

.panel{
  border:1px solid var(--border); border-radius:var(--radius);
  background:rgba(255,255,255,.9); backdrop-filter:blur(8px);
  box-shadow:var(--shadow); overflow:hidden;
}
.panel .hd{
  padding:14px 14px 10px; border-bottom:1px solid rgba(0,0,0,.06);
  display:flex; align-items:flex-start; justify-content:space-between; gap:10px;
}
.panel .hd h2{ margin:0; font-size:17px; font-weight:900; }
.panel .hd p{ margin:4px 0 0; color:var(--muted); font-size:13px; }
.panel .bd{ padding:14px; }

.controls{ display:flex; flex-direction:column; gap:14px; }
.group-title{ margin:0 0 8px; font-size:13px; font-weight:900; color:#333; letter-spacing:.2px; }
.chips{ display:flex; flex-wrap:wrap; gap:8px; }
.chip{
  border:1px solid var(--border); border-radius:14px; padding:8px 12px;
  display:flex; align-items:center; gap:8px; background:#fff;
  cursor:pointer; user-select:none;
  transition: transform .12s ease, border-color .12s ease;
}
.chip:hover{ transform:translateY(-1px); }
.chip input{ width:16px; height:16px; }
.chip .ico{
  width:26px; height:26px; border-radius:8px;
  display:grid; place-items:center; font-size:14px;
}
.ico.blue{ background:rgba(110,198,255,.25); border:1px solid rgba(110,198,255,.45); }
.ico.yellow{ background:rgba(255,213,79,.3); border:1px solid rgba(255,213,79,.55); }
.ico.green{ background:rgba(98,220,170,.22); border:1px solid rgba(98,220,170,.45); }
.ico.pink{ background:rgba(244,143,177,.2); border:1px solid rgba(244,143,177,.45); }
.ico.orange{ background:rgba(255,171,64,.25); border:1px solid rgba(255,171,64,.5); }

.row{ display:flex; gap:10px; flex-wrap:wrap; }
.seg{ flex:1 1 150px; border:1px solid var(--border); border-radius:14px; padding:10px; background:#fff; }
.seg label{ display:flex; align-items:center; gap:8px; cursor:pointer; padding:4px 6px; border-radius:10px; }
.seg input{ width:16px; height:16px; }
.seg small{ color:var(--muted); display:block; margin-top:6px; font-size:12px; }

.toggle{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:10px 12px; border-radius:14px; border:1px solid var(--border); background:#fff;
}
.toggle strong{ font-size:14px; }
.toggle span{ color:var(--muted); font-size:12px; display:block; margin-top:2px; }
.switch{
  position:relative; width:50px; height:30px; border-radius:999px;
  background:rgba(0,0,0,.08); border:1px solid rgba(0,0,0,.1);
  cursor:pointer; flex:0 0 auto;
}
.switch::after{
  content:""; position:absolute; top:3px; left:3px;
  width:24px; height:24px; border-radius:999px;
  background:#fff; box-shadow:0 4px 10px rgba(0,0,0,.14);
  transition:transform .18s ease;
}
.switch.on{ background:rgba(110,198,255,.35); border-color:rgba(110,198,255,.6); }
.switch.on::after{ transform:translateX(20px); }

/* Sheet */
.sheet{
  background:#fff; border:1px solid var(--border); border-radius:var(--radius);
  box-shadow:var(--shadow); overflow:hidden; animation:fadeIn .25s ease;
}
@keyframes fadeIn{ from{opacity:.5;transform:translateY(4px)} to{opacity:1;transform:translateY(0)} }
.sheet-header{
  padding:18px 18px 14px; border-bottom:1px solid rgba(0,0,0,.08);
  display:flex; justify-content:space-between; gap:12px; align-items:flex-start;
}
.sheet-title{ font-family:"Poppins","Nunito",sans-serif; font-weight:800; font-size:20px; }
.sheet-sub{ margin-top:4px; color:#555; font-size:13px; font-weight:700; }
.student-lines{ display:grid; grid-template-columns:1fr 1fr; gap:8px 12px; min-width:280px; }
.line{ display:flex; gap:6px; align-items:flex-end; font-size:13px; color:var(--muted); white-space:nowrap; }
.line b{ color:#333; }
.blank{ flex:1; border-bottom:2px dotted rgba(0,0,0,.22); height:16px; }
.sheet-body{ padding:18px; }
.sheet-intro{ margin:0 0 14px; font-size:15px; color:#2b2b2b; }
.hint{
  display:flex; gap:10px; padding:10px 12px; border-radius:14px;
  background:rgba(255,213,79,.18); border:1px solid rgba(255,213,79,.45); margin-bottom:14px;
}
.hint .dot{
  width:32px; height:32px; border-radius:10px;
  background:rgba(255,213,79,.45); display:grid; place-items:center; font-size:16px;
}
.hint p{ margin:0; color:#3a3a3a; font-size:14px; }

.q{
  border:1px solid rgba(0,0,0,.08); border-radius:16px;
  padding:14px 14px 12px; margin-bottom:12px;
  background:linear-gradient(180deg, rgba(110,198,255,.05), rgba(255,255,255,0));
  page-break-inside:avoid;
}
.q.cat-bio{ background:linear-gradient(180deg, rgba(98,220,170,.07), rgba(255,255,255,0)); }
.q.cat-chem{ background:linear-gradient(180deg, rgba(255,171,64,.07), rgba(255,255,255,0)); }
.q.cat-phys{ background:linear-gradient(180deg, rgba(186,104,200,.08), rgba(255,255,255,0)); }
.q.cat-geo{ background:linear-gradient(180deg, rgba(255,213,79,.08), rgba(255,255,255,0)); }

.q .q-top{ display:flex; gap:12px; align-items:flex-start; }
.q-num{
  width:34px; height:34px; border-radius:12px;
  background:rgba(110,198,255,.25); border:1px solid rgba(110,198,255,.45);
  display:grid; place-items:center; font-weight:900; font-size:15px; flex:0 0 auto;
}
.q-num.bio{ background:rgba(98,220,170,.25); border-color:rgba(98,220,170,.45); }
.q-num.chem{ background:rgba(255,171,64,.25); border-color:rgba(255,171,64,.5); }
.q-num.phys{ background:rgba(186,104,200,.2); border-color:rgba(186,104,200,.4); }
.q-num.geo{ background:rgba(255,213,79,.35); border-color:rgba(255,213,79,.6); }
.q-prompt{ flex:1; font-size:16px; font-weight:700; margin:0; line-height:1.5; }
.q-meta{ color:var(--muted); font-size:11px; font-weight:800; letter-spacing:.2px; white-space:nowrap; margin-left:8px; padding-top:4px; }

.q-figure{
  margin-top:10px; padding:12px; border-radius:14px;
  border:1px dashed rgba(0,0,0,.15); background:rgba(255,255,255,.8);
}
.q-table{ width:100%; border-collapse:collapse; font-size:14px; margin-top:8px; }
.q-table th{ background:rgba(0,0,0,.05); padding:8px 10px; border:1px solid rgba(0,0,0,.12); font-weight:900; text-align:center; }
.q-table td{ padding:7px 10px; border:1px solid rgba(0,0,0,.10); text-align:center; }
.q-table tr:nth-child(even) td{ background:rgba(0,0,0,.02); }

.opts{ margin-top:10px; display:grid; grid-template-columns:1fr; gap:7px; }
.opt{
  display:flex; gap:10px; align-items:center; padding:9px 10px; border-radius:14px;
  border:1px solid rgba(0,0,0,.10); background:#fff; cursor:pointer; user-select:none;
  transition:transform .1s ease, border-color .12s ease, background .12s ease;
}
.opt:hover{ transform:translateY(-1px); }
.opt[aria-pressed="true"]{ border-color:rgba(110,198,255,.65); background:rgba(110,198,255,.12); }
.letter{
  width:32px; height:32px; border-radius:999px; border:2px solid rgba(0,0,0,.2);
  display:grid; place-items:center; font-weight:900; background:#fff; flex:0 0 auto; font-size:14px;
}
.opt-text{ font-size:16px; font-weight:700; }

.answer-box{
  margin-top:10px; border-radius:14px; border:2px solid rgba(0,0,0,.16);
  background:repeating-linear-gradient(180deg, #fff 0px, #fff 27px, rgba(0,0,0,.06) 28px);
  height:90px;
  padding: 10px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
  color: #212121;
  outline: none;
  transition: border-color 0.2s ease;
}
.answer-box:focus {
  border-color: #6EC6FF;
  border-width: 2px;
}
.answer-box.small{ height:56px; }
.answer-box:empty:before {
  content: attr(data-placeholder);
  color: #999;
  pointer-events: none;
}

.key{
  margin-top:14px; border-top:2px solid rgba(0,0,0,.12); padding-top:12px; page-break-inside:avoid;
}
.key h3{ margin:0 0 8px; font-size:15px; font-weight:900; }
.key-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(170px, 1fr)); gap:7px 12px; font-size:13px; }
.key-item{ border:1px solid rgba(0,0,0,.10); border-radius:12px; padding:7px 10px; background:rgba(98,220,170,.10); }
.key-item b{ font-weight:900; }

.muted-note{ margin-top:10px; font-size:12px; color:var(--muted); }

@page{ size:A4; margin:8mm; }
@media print{
  body{ background:#fff !important; }
  .app{ display:block; padding:0; margin:0; max-width:none; }
  .topbar, .panel.controls-panel{ display:none !important; }
  .sheet{ box-shadow:none !important; border:none !important; border-radius:0 !important; }
  .sheet-header{ padding:0 0 4px; gap:8px; }
  .sheet-title{ font-size:15px; }
  .sheet-sub{ margin-top:1px; font-size:11px; }
  .sheet-body{ padding:0; }
  .sheet-intro{ margin:0 0 6px; font-size:12px; line-height:1.3; }
  .student-lines{ min-width:220px; gap:4px 8px; }
  .line{ font-size:11px; }
  .blank{ height:12px; }
  .q{
    break-inside:auto;
    page-break-inside:auto;
    padding:6px 8px 5px;
    margin:0 0 5px;
    border-radius:8px;
  }
  .q-top{ gap:6px; }
  .q-num{ width:24px; height:24px; border-radius:7px; font-size:12px; }
  .q-prompt{ font-size:12.5px; line-height:1.28; font-weight:700; }
  .q-meta{ font-size:9px; padding-top:1px; }
  .q-figure{ margin-top:4px; padding:6px 8px; font-size:12px; line-height:1.32; border-radius:8px; }
  .q-figure p{ margin:0 0 4px; }
  .opts{ margin-top:4px; grid-template-columns:1fr 1fr; gap:3px 8px; }
  .opt{ padding:2px 6px; gap:6px; border-radius:8px; break-inside:avoid; }
  .letter{ width:20px; height:20px; font-size:11px; border-width:1px; }
  .opt-text{ font-size:12px; font-weight:700; line-height:1.25; }
  .answer-box{
    margin-top:4px !important;
    height:44px !important;
    min-height:0 !important;
    padding:4px 6px !important;
    border-width:1px !important;
    border-radius:8px;
    font-size:12px;
    line-height:18px;
    background:repeating-linear-gradient(180deg, #fff 0px, #fff 17px, rgba(0,0,0,.08) 18px) !important;
  }
  .answer-box.lines-2{ height:40px !important; }
  .answer-box.lines-3{ height:58px !important; }
  .answer-box.lines-5{ height:96px !important; }
  .q-table{ font-size:11px; margin-top:4px; }
  .q-table th, .q-table td{ padding:3px 5px; }
  .key{ margin-top:8px; padding-top:6px; break-inside:auto; }
  .key h3{ font-size:12px; margin-bottom:4px; }
  .key-grid{ gap:3px 8px; font-size:10.5px; }
  .key-item{ padding:3px 6px; border-radius:6px; }
  .opt{ cursor:default; }
  .opt:hover{ transform:none; }
}
