:root{
  --bg: #0b1020;
  --bg2:#0f1730;
  --card:#121b36;
  --text:#e8ecff;
  --muted:#a8b0d6;
  --border: rgba(255,255,255,.12);
  --shadow: 0 18px 40px rgba(0,0,0,.35);
  --accent:#6d28d9;
  --accent2:#2563eb;
  --danger:#ef4444;
  --ok:#22c55e;
  --radius: 18px;
}

[data-theme="light"]{
  --bg:#f6f7fb;
  --bg2:#ffffff;
  --card:#ffffff;
  --text:#0b1020;
  --muted:#4b5563;
  --border: rgba(2,6,23,.12);
  --shadow: 0 12px 30px rgba(2,6,23,.10);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1000px 600px at 10% -10%, rgba(109,40,217,.35), transparent 60%),
              radial-gradient(900px 600px at 95% 0%, rgba(37,99,235,.25), transparent 55%),
              linear-gradient(180deg, var(--bg), var(--bg));
  color:var(--text);
}

a{color:inherit;text-decoration:none}
.container{max-width:1080px;margin:0 auto;padding:22px 18px 56px}
header{
  position:sticky;top:0;z-index:50;
  backdrop-filter: blur(10px);
  background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,0));
  border-bottom:1px solid rgba(255,255,255,.06);
}
.header-inner{max-width:1080px;margin:0 auto;display:flex;align-items:center;gap:14px;padding:14px 18px}
.brand{display:flex;align-items:center;gap:10px;min-width:180px}
.brand img{height:34px;width:auto}
.brand .title{font-weight:800;letter-spacing:.2px}
.pills{margin-left:auto;display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.pill{
  display:inline-flex;align-items:center;gap:8px;
  padding:10px 12px;border-radius:999px;
  background: rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.12);
  color:var(--text);
  box-shadow:none;
  user-select:none;
}
[data-theme="light"] .pill{background: rgba(2,6,23,.05);border-color: rgba(2,6,23,.10)}
.pill:hover{transform: translateY(-1px)}
.pill:active{transform: translateY(0)}
.pill button{all:unset;cursor:pointer;display:inline-flex;align-items:center;gap:8px}

.hero{
  margin:26px 0 18px;
  padding:26px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(109,40,217,.22), rgba(37,99,235,.14));
  border:1px solid rgba(255,255,255,.14);
  box-shadow: var(--shadow);
}
[data-theme="light"] .hero{background: linear-gradient(135deg, rgba(109,40,217,.10), rgba(37,99,235,.08));border-color: rgba(2,6,23,.10)}
.hero h1{margin:0 0 8px;font-size:34px;line-height:1.15;letter-spacing:-.3px}
.hero p{margin:0;color:var(--muted);font-size:16px;max-width:72ch}

.grid{display:grid;grid-template-columns: repeat(12,1fr);gap:16px;margin-top:18px}
.card{
  grid-column: span 6;
  padding:18px 18px 16px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  box-shadow: var(--shadow);
  position:relative;
  overflow:hidden;
}
[data-theme="light"] .card{background: rgba(255,255,255,.85)}
.card::before{
  content:"";
  position:absolute;inset:-2px;
  background: radial-gradient(900px 240px at 0% 0%, rgba(109,40,217,.22), transparent 55%),
              radial-gradient(700px 240px at 100% 0%, rgba(37,99,235,.18), transparent 55%);
  pointer-events:none;
}
.card > *{position:relative}
.card h2{margin:0 0 8px;font-size:20px}
.card p{margin:0 0 14px;color:var(--muted);min-height:44px}
.actions{display:flex;gap:10px;flex-wrap:wrap}
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:12px 14px;border-radius: 12px;
  border:1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.10);
  color:var(--text);
  cursor:pointer;
  transition: transform .12s ease, background .12s ease;
}
[data-theme="light"] .btn{border-color: rgba(2,6,23,.12);background: rgba(2,6,23,.04)}
.btn.primary{
  border:none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color:#fff;
}
.btn:hover{transform: translateY(-1px)}
.btn:active{transform: translateY(0px)}
.btn.danger{background: rgba(239,68,68,.14);border-color: rgba(239,68,68,.35)}

footer{margin-top:26px;color:var(--muted);font-size:13px}

/* Test Layout */
.panel{
  margin-top:18px;
  padding:18px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  box-shadow: var(--shadow);
}
[data-theme="light"] .panel{background: rgba(255,255,255,.9)}
.row{display:flex;gap:14px;flex-wrap:wrap}
.field{flex:1;min-width:220px}
label{display:block;font-size:13px;color:var(--muted);margin:0 0 8px}
input, select{
  width:100%;
  padding:12px 12px;
  border-radius: 12px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.16);
  color:var(--text);
  outline:none;
}
[data-theme="light"] input, [data-theme="light"] select{
  background: rgba(2,6,23,.03);
  border-color: rgba(2,6,23,.12);
  color:var(--text);
}

.topbar{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:14px}
.badge{
  display:inline-flex;align-items:center;gap:8px;
  padding:10px 12px;border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  color:var(--text);
}
.progress{
  height:10px;border-radius:999px;overflow:hidden;
  background: rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.12);
}
.progress > div{height:100%;width:0%;background: linear-gradient(135deg, var(--accent), var(--accent2))}

.qwrap{margin-top:14px}
.question{
  font-size:18px;line-height:1.6;margin:0 0 14px
}
.options{display:grid;gap:10px}
.option{
  display:flex;align-items:flex-start;gap:12px;
  padding:12px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  cursor:pointer;
}
[data-theme="light"] .option{background: rgba(2,6,23,.02);border-color: rgba(2,6,23,.12)}
.option input{width:auto;margin-top:4px}
.option:hover{transform: translateY(-1px)}
.option.active{border-color: rgba(109,40,217,.65);background: rgba(109,40,217,.14)}

.nav{display:flex;gap:10px;justify-content:space-between;margin-top:16px;flex-wrap:wrap}

.scale{
  display:grid;
  grid-template-columns: repeat(6,1fr);
  gap:8px;
}
.scale button{
  padding:10px 0;border-radius: 12px;border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color:var(--text);
  cursor:pointer;
}
[data-theme="light"] .scale button{background: rgba(2,6,23,.02);border-color: rgba(2,6,23,.12)}
.scale button.active{
  border:none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color:#fff;
}
.scale-legend{display:flex;justify-content:space-between;color:var(--muted);font-size:12px;margin-top:8px}

/* Modal */
.modal-backdrop{
  position:fixed;inset:0;background: rgba(0,0,0,.55);
  display:none;align-items:center;justify-content:center;padding:18px;z-index:1000;
}
.modal{
  width:min(860px, 100%);
  border-radius: 20px;
  background: var(--bg2);
  border:1px solid rgba(255,255,255,.14);
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
  padding:18px;
}
[data-theme="light"] .modal{background:#fff;border-color: rgba(2,6,23,.12)}
.modal h3{margin:0 0 8px}
.table{width:100%;border-collapse:collapse;font-size:14px}
.table th,.table td{padding:10px;border-bottom:1px solid rgba(255,255,255,.10);text-align:start;vertical-align:top}
[data-theme="light"] .table th,[data-theme="light"] .table td{border-bottom:1px solid rgba(2,6,23,.10)}
.table th{color:var(--muted);font-weight:600}
.toolbar{display:flex;gap:10px;flex-wrap:wrap;margin:10px 0 14px}
.chip{
  padding:10px 12px;border-radius:999px;cursor:pointer;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.06);
  color:var(--text);
}
[data-theme="light"] .chip{border-color: rgba(2,6,23,.12);background: rgba(2,6,23,.03)}
.chip.active{border:none;background: linear-gradient(135deg, var(--accent), var(--accent2));color:#fff}

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

/* RTL */
[dir="rtl"]{direction:rtl}
[dir="rtl"] .pills{margin-left:0;margin-right:auto}
[dir="rtl"] .table th,[dir="rtl"] .table td{text-align:right}
@media (max-width:820px){
  .card{grid-column: span 12;}
  .hero h1{font-size:28px}
}
