:root{
  --brand1: linear-gradient(90deg,#7b2ff7,#ff6ec7);
  --accent: #6c63ff;
  --muted: #7b7b8a;
  --paper: #fff;
  --maxw: 1100px;
  --mobileGap: 14px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  color-scheme: light;
}

/* Global layout */
body{margin:0;background:linear-gradient(180deg,#0f0724 0%, #09041a 40%); min-height:100vh; color:#111;}
.topbar{background:var(--brand1); padding:18px 16px; color:white; box-shadow:0 6px 20px rgba(0,0,0,.35);}
.brand h1{margin:0;font-size:20px;letter-spacing:.3px}
.tag{margin:4px 0 0;font-size:12px;opacity:.95}
#app{max-width:var(--maxw);margin:18px auto;padding:0 16px;}

.card{background:rgba(255,255,255,.98);border-radius:12px;padding:18px;box-shadow:0 10px 30px rgba(2,6,23,.6);}

/* Chooser layout */
.row{margin:12px 0}
.label{display:block;font-weight:600;margin-bottom:8px}
.btn-grid{display:flex;gap:8px;flex-wrap:wrap}
.btn{background:#f3f4f6;padding:10px 12px;border-radius:10px;border:1px solid #e6e7eb;min-width:56px;text-align:center;cursor:pointer;user-select:none}
.btn.selected{background:var(--accent);color:white;box-shadow:0 6px 18px rgba(108,99,255,.18)}
.primary{background:var(--accent);color:white;border:none;padding:12px 16px;border-radius:10px;cursor:pointer}
.secondary{background:transparent;border:1px solid #ddd;padding:8px 10px;border-radius:8px;cursor:pointer}
.actions{margin-top:14px}

/* Generator layout */
.hidden{display:none}
.generator-header{display:flex;justify-content:space-between;align-items:center;margin:6px 0 14px;color:white}
.generator-header h2{margin:0}
.muted{color:var(--muted)}
.tiny-controls{display:flex;gap:8px;align-items:center}
.content-area{display:flex;gap:16px}
.sidepanel{width:260px;background:#fff;padding:12px;border-radius:10px;box-shadow:0 8px 20px rgba(2,6,23,.15)}
.preview-wrap{flex:1;min-width:0}

/* Worksheet */
.worksheet{background:var(--paper);padding:22px;border-radius:8px;min-height:600px;box-shadow:0 10px 30px rgba(2,6,23,.12)}
.ws-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px}
.ws-title{font-family:"Patrick Hand", serif;font-size:20px}
.meta{font-size:12px;color:var(--muted)}
.problem{display:flex;justify-content:space-between;padding:10px 0;border-bottom:1px dashed #eee}
.problem .q{font-size:16px}
.answer-key{margin-top:14px;padding-top:10px;border-top:2px solid #f2f2f2}
.theme-deco{font-size:20px;opacity:.9;margin-left:8px}

/* Print rules */
@media print{
  body{background:white}
  header, .sidepanel, .tiny-controls, .actions, .footer{display:none}
  .worksheet{box-shadow:none;border-radius:0}
  .page-break{page-break-after:always}
}

/* Mobile responsiveness */
@media (max-width:880px){
  .content-area{flex-direction:column}
  .sidepanel{width:100%}
  .btn{min-width:48px;padding:10px}
  .generator-header{flex-direction:column;align-items:flex-start;gap:8px}
}

/* Theme decorations (small) */
.theme-nature .worksheet{background-image:linear-gradient(white, #fbfff7);}
.theme-space .worksheet{background-image:linear-gradient(#fff,#f3f6ff)}
.theme-animals .worksheet{background-image:linear-gradient(#fff,#fffaf6)}
.theme-ocean .worksheet{background-image:linear-gradient(#f8ffff,#fff)}
