/* =========================================================================
   howtocreateusermysql.com — design system
   Zero-dependency, light + dark, developer-focused.
   ========================================================================= */

:root {
  --bg:        #f6f7fb;
  --surface:   #ffffff;
  --surface-2: #f1f3f9;
  --border:    #e3e7ef;
  --text:      #0f172a;
  --muted:     #5b6472;
  --accent:    #4f46e5;
  --accent-2:  #6366f1;
  --accent-ink:#ffffff;
  --ring:      rgba(79, 70, 229, .35);
  --code-bg:   #0d1220;
  --code-2:    #161d31;
  --code-text: #e6eaf2;
  --code-key:  #7dd3fc;
  --code-str:  #86efac;
  --code-com:  #6b7488;
  --code-num:  #fca5a5;
  --good:      #16a34a;
  --shadow:    0 1px 2px rgba(16,24,40,.04), 0 8px 24px rgba(16,24,40,.06);
  --radius:    14px;
  --radius-sm: 9px;
  --maxw:      1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0b0f1a;
    --surface:   #111726;
    --surface-2: #0e1420;
    --border:    #1f2637;
    --text:      #e8ecf4;
    --muted:     #9aa4b6;
    --accent:    #818cf8;
    --accent-2:  #a5b4fc;
    --accent-ink:#0b0f1a;
    --ring:      rgba(129,140,248,.4);
    --code-bg:   #080b14;
    --code-2:    #0f1524;
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.45);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; }
h2 { font-size: 1.6rem; margin-top: 0; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }

code, pre, kbd, .mono {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 62px; gap: 16px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; letter-spacing: -.02em; color: var(--text);
  font-size: 1.02rem;
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; color: #fff; font-size: 15px;
  box-shadow: var(--shadow);
}
.site-nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.site-nav a {
  color: var(--muted); font-weight: 600; font-size: .92rem;
  padding: 7px 11px; border-radius: 8px;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }

/* ---------- Hero ---------- */
.hero { text-align: center; padding: 56px 0 28px; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); margin-bottom: .35em; }
.hero .sub { font-size: 1.12rem; color: var(--muted); max-width: 680px; margin: 0 auto; }
.badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.badge {
  font-size: .8rem; font-weight: 600; color: var(--muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 999px;
}

/* ---------- Card / tool ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.tool { padding: 20px; margin: 8px 0 12px; }

.engine-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.engine-tab {
  appearance: none; cursor: pointer; font: inherit; font-weight: 600;
  font-size: .92rem; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 9px 15px; border-radius: 999px; transition: .15s;
}
.engine-tab:hover { color: var(--text); }
.engine-tab[aria-selected="true"] {
  color: var(--accent-ink); background: var(--accent);
  border-color: var(--accent); box-shadow: 0 4px 12px var(--ring);
}

.tool-grid {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px;
}
@media (max-width: 760px) { .tool-grid { grid-template-columns: 1fr; gap: 18px; } }

.field { margin-bottom: 12px; }
.field label {
  display: block; font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin-bottom: 5px;
}
.input-row { display: flex; }
.input-row input {
  flex: 1; min-width: 0; font: inherit; font-size: .95rem;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; transition: border-color .15s, box-shadow .15s;
}
.input-row.has-btn input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.input-row input:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }

.mini-btn {
  font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer;
  color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--border); border-left: none;
  padding: 0 12px; transition: .15s; white-space: nowrap;
}
.mini-btn:last-child { border-top-right-radius: var(--radius-sm); border-bottom-right-radius: var(--radius-sm); }
.mini-btn:hover:not(:disabled) { color: var(--accent); background: var(--surface); }
.mini-btn:disabled { opacity: .5; cursor: not-allowed; }
.mini-btn + .mini-btn { border-left: 1px solid var(--border); }

fieldset.perms { border: none; margin: 0; padding: 0; }
fieldset.perms legend {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; padding: 0;
}
.perm {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  padding: 9px 11px; border-radius: var(--radius-sm);
  border: 1px solid transparent; transition: .12s; margin-bottom: 2px;
}
.perm:hover { background: var(--surface-2); }
.perm input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.perm .pt { font-weight: 600; font-size: .95rem; }
.perm .pd { display: block; font-size: .82rem; color: var(--muted); font-weight: 400; }
.perm.is-disabled { opacity: .4; cursor: not-allowed; }
.perm.is-disabled:hover { background: transparent; }

.engine-note {
  display: flex; gap: 9px; align-items: flex-start;
  font-size: .88rem; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; margin-top: 4px;
}
.engine-note .ic { flex: none; color: var(--accent); }

/* ---------- Output ---------- */
.output { margin-top: 18px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.output-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--code-2); padding: 9px 12px 9px 15px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.output-bar .lbl { color: #aab3c5; font-size: .82rem; font-weight: 600; }
.output-bar .dots { display: inline-flex; gap: 6px; margin-right: 10px; }
.output-bar .dots i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.output-bar .dots i:nth-child(1){ background:#ff5f57;}
.output-bar .dots i:nth-child(2){ background:#febc2e;}
.output-bar .dots i:nth-child(3){ background:#28c840;}
.output-bar .left { display: inline-flex; align-items: center; }
.copy-btn {
  font: inherit; font-weight: 600; font-size: .82rem; cursor: pointer;
  color: #cfd6e4; background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12); border-radius: 7px;
  padding: 5px 11px; display: inline-flex; align-items: center; gap: 6px; transition: .15s;
}
.copy-btn:hover { background: rgba(255,255,255,.13); color: #fff; }
.copy-btn.copied { color: #86efac; border-color: rgba(134,239,172,.4); }
pre.sql {
  margin: 0; padding: 16px 18px; background: var(--code-bg); color: var(--code-text);
  font-size: .9rem; line-height: 1.7; overflow-x: auto; tab-size: 2;
  white-space: pre; min-height: 96px;
}
pre.sql .k { color: var(--code-key); font-weight: 600; }
pre.sql .s { color: var(--code-str); }
pre.sql .c { color: var(--code-com); font-style: italic; }
pre.sql .n { color: var(--code-num); }

.pw-tip {
  margin: 14px 0 0; font-size: .9rem; color: var(--muted);
}
.pw-tip code {
  display: block; margin-top: 8px; background: var(--code-bg); color: var(--code-text);
  padding: 12px 14px; border-radius: var(--radius-sm); font-size: .84rem; overflow-x: auto;
  white-space: pre;
}

/* ---------- Content ---------- */
.content { padding: 40px 0 20px; }
.content h2 { margin-top: 2.2em; }
.content h2:first-child { margin-top: 0; }
.content h3 { margin-top: 1.6em; }
.lead { font-size: 1.1rem; color: var(--muted); }

.section-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 22px 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.tile h3 { margin-top: 0; font-size: 1.05rem; }
.tile p { margin-bottom: 0; font-size: .92rem; color: var(--muted); }

pre.block {
  background: var(--code-bg); color: var(--code-text); border-radius: var(--radius);
  padding: 16px 18px; overflow-x: auto; font-size: .88rem; line-height: 1.65;
  margin: 12px 0 20px; border: 1px solid var(--border);
}
pre.block .k { color: var(--code-key); font-weight: 600; }
pre.block .s { color: var(--code-str); }
pre.block .c { color: var(--code-com); font-style: italic; }
:not(pre) > code {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: .12em .4em; border-radius: 6px; font-size: .88em;
}

.table-scroll { overflow-x: auto; margin: 16px 0 24px; border: 1px solid var(--border); border-radius: var(--radius); }
table.ref { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 560px; }
table.ref th, table.ref td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); }
table.ref thead th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
table.ref tbody tr:last-child td { border-bottom: none; }
table.ref td code { font-size: .85em; }

details.faq {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); margin-bottom: 10px; padding: 0 18px; box-shadow: var(--shadow);
}
details.faq summary {
  cursor: pointer; font-weight: 600; padding: 15px 0; list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; color: var(--accent); font-size: 1.3rem; font-weight: 400; transition: transform .2s; }
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq .a { padding: 0 0 16px; color: var(--muted); }
details.faq .a p:last-child { margin-bottom: 0; }

.cta {
  text-align: center; background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; border-radius: var(--radius); padding: 34px 24px; margin: 40px 0;
}
.cta h2 { color: #fff; }
.cta p { color: rgba(255,255,255,.9); max-width: 560px; margin: 0 auto 18px; }
.cta .btn {
  display: inline-block; background: #fff; color: var(--accent); font-weight: 700;
  padding: 11px 22px; border-radius: 10px; text-decoration: none;
}
.cta .btn:hover { text-decoration: none; opacity: .92; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); margin-top: 30px; padding: 34px 0;
  color: var(--muted); font-size: .9rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.foot-links { display: flex; gap: 16px; flex-wrap: wrap; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
