:root {
  --bg:#f9fafb;--surface:#fff;--text:#111827;--subtle:#6b7280;--muted:#e5e7eb;--muted-2:#d1d5db;
  --primary:#111827;--primary-hover:#2563eb;--code-bg:#f3f4f6;--code-text:#111827;
  --output-bg:#0b1020;--output-text:#e6edf3;--shadow:0 3px 10px rgba(0,0,0,.08);
  --ring:0 0 0 3px rgba(37,99,235,.3);--tab-bg:#eef2ff;--tab-text:#111827;
  --tab-active-bg:#111827;--tab-active-text:#fff;
}
[data-theme="dark"]{
  --bg:#0b0f19;--surface:#0f1526;--text:#e6edf3;--subtle:#9aa4b2;--muted:#1c2337;--muted-2:#2a3552;
  --primary:#2563eb;--primary-hover:#3b82f6;--code-bg:#111827;--code-text:#e6edf3;
  --output-bg:#0b1020;--output-text:#e6edf3;--shadow:0 6px 24px rgba(0,0,0,.5);
  --ring:0 0 0 3px rgba(59,130,246,.35);--tab-bg:#121a30;--tab-text:#cfd8e3;
  --tab-active-bg:#2563eb;--tab-active-text:#fff;
}
*{box-sizing:border-box}html,body{height:100%}
body{font-family:Inter,system-ui,Arial,sans-serif;background:var(--bg);color:var(--text);margin:0;transition:.2s}
header{background:linear-gradient(90deg,#111827,#1f2937);color:#fff;padding:18px 0;font-size:1.5rem;font-weight:600}
[data-theme="dark"] header{background:linear-gradient(90deg,#0f1526,#111a30)}
.header-inner{max-width:1100px;margin:0 auto;padding:0 16px;display:flex;align-items:center;justify-content:space-between;gap:12px}
.theme-toggle{display:inline-flex;align-items:center;gap:8px;border:1px solid rgba(255,255,255,.2);background:rgba(255,255,255,.08);color:#fff;border-radius:999px;padding:8px 12px;font-size:14px;cursor:pointer}
.container{max-width:1100px;margin:34px auto;background:var(--surface);border-radius:12px;box-shadow:var(--shadow);padding:22px 28px 28px}
.tabs{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:14px}
.tab{padding:8px 14px;border-radius:999px;cursor:pointer;background:var(--tab-bg);color:var(--tab-text);border:1px solid var(--muted-2);font-weight:600;font-size:14px}
.tab[aria-selected="true"]{background:var(--tab-active-bg);color:var(--tab-active-text);border-color:transparent}
textarea{width:100%;min-height:160px;height:260px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:14px;border-radius:10px;padding:12px;border:1px solid var(--muted-2);background:var(--code-bg);color:var(--code-text);resize:vertical;overflow-y:hidden}
textarea:focus-visible{outline:none;box-shadow:var(--ring);border-color:transparent}
.controls{display:flex;gap:12px;align-items:center;margin:14px 0;flex-wrap:wrap}
button{cursor:pointer;padding:10px 20px;font-size:15px;border:none;border-radius:10px;font-weight:600}
#run{background:var(--primary);color:#fff}#run:hover{background:var(--primary-hover)}
#clear,#copyOutput,#downloadCode,#resetTemplate{background:var(--muted);color:var(--text)}
#clear:hover,#copyOutput:hover,#downloadCode:hover,#resetTemplate:hover{background:var(--muted-2)}
#status{font-size:13px;color:var(--subtle)}
pre{background:var(--output-bg);color:var(--output-text);padding:12px;border-radius:10px;min-height:200px;font-size:14px;overflow-y:auto;white-space:pre-wrap;margin:0}
.hint{font-size:13px;color:var(--subtle);margin-top:6px}
footer{text-align:center;margin:36px 0 10px;font-size:13px;color:var(--subtle)}
.icon{width:16px;height:16px;display:inline-block}.icon svg{width:16px;height:16px;display:block}
