/* Net Toolbox - themeable dark/light */
:root {
  /* shared accent + type (theme-independent) */
  --violet: #8b5cf6;
  --accent: #6366f1;
  --accent2: #22d3ee;
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #06b6d4 100%);
  --btn-text: #ffffff;
  --red: #f87171;
  --green: #34d399;
  --ring: rgba(99,102,241,0.20);
  --mono: ui-monospace, SFMono-Regular, 'Cascadia Code', Menlo, Consolas, monospace;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display: 'Space Grotesk', 'Inter', sans-serif;
}
html[data-theme="dark"] {
  --bg: #0a0b0f;
  --bg2: #0f1117;
  --surface: #15171f;
  --surface2: #1c1f29;
  --border: #242833;
  --border2: #353b49;
  --text: #f1f2f7;
  --dim: #969cad;
  --faint: #5a6072;
  --bar-bg: rgba(10,11,15,0.72);
  --hairline: rgba(255,255,255,0.06);
  --hi: #34d3ee;
  --mark: rgba(99,102,241,0.38);
  --tint: rgba(129,140,248,0.13);
  --shadow: rgba(0,0,0,0.8);
  --title: linear-gradient(180deg, #ffffff 0%, #b4b9cc 85%);
  --hero-bg: radial-gradient(95% 130% at 50% -25%, rgba(139,92,246,0.18), transparent 58%), #0f1117;
  --glow: radial-gradient(circle, rgba(139,92,246,0.42), rgba(34,211,238,0.10) 45%, transparent 70%);
}
html[data-theme="light"] {
  --bg: #f4f5fa;
  --bg2: #ffffff;
  --surface: #ffffff;
  --surface2: #eef0f7;
  --border: #e3e6f0;
  --border2: #ccd2e0;
  --text: #14161f;
  --dim: #5c6273;
  --faint: #98a0b3;
  --bar-bg: rgba(244,245,250,0.82);
  --hairline: rgba(17,20,30,0.08);
  --hi: #0e7490;
  --mark: rgba(99,102,241,0.20);
  --tint: rgba(99,102,241,0.09);
  --shadow: rgba(40,46,70,0.18);
  --title: linear-gradient(180deg, #14161f 0%, #4a5165 92%);
  --hero-bg: radial-gradient(95% 130% at 50% -25%, rgba(99,102,241,0.12), transparent 58%), linear-gradient(180deg, #ffffff, #f7f8fc);
  --glow: radial-gradient(circle, rgba(139,92,246,0.20), rgba(34,211,238,0.08) 45%, transparent 70%);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased; transition: background-color .3s ease, color .3s ease; }
html[data-theme="dark"] body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(60% 48% at 50% 0%, rgba(99,102,241,0.09), transparent 72%); }
.hidden { display: none !important; }

/* scroll reveal */
html.js .reveal { opacity: 0; transform: translateY(26px); }
html.js .reveal.in { opacity: 1; transform: none; transition: opacity .7s cubic-bezier(.16,1,.3,1), transform .7s cubic-bezier(.16,1,.3,1); }

/* top bar */
#top { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 12px; padding: 13px 26px; border-bottom: 1px solid var(--border); background: var(--bar-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
#brand { background: none; border: none; color: var(--text); font-weight: 700; font-size: 16px; font-family: var(--display); display: flex; align-items: center; gap: 9px; padding: 6px 8px; cursor: pointer; border-radius: 10px; letter-spacing: -0.2px; }
#brand:hover { background: var(--surface); }
.dot2 { width: 10px; height: 10px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 12px rgba(139,92,246,0.75); flex-shrink: 0; }
#back { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 8px 14px; border-radius: 9px; font-weight: 600; font-size: 13px; font-family: var(--font); cursor: pointer; }
#back:hover { border-color: var(--accent); filter: none; }
#filter { margin-left: auto; max-width: 300px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); padding: 9px 13px; font-size: 13px; outline: none; font-family: var(--font); transition: border-color .15s, box-shadow .15s; }
#filter:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
#filter.hidden ~ #theme { margin-left: auto; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; flex-shrink: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--dim); cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.iconbtn:hover { color: var(--text); border-color: var(--accent); }

/* main */
#main { max-width: 980px; margin: 0 auto; padding: 30px 24px 90px; }
.panel { display: none; animation: fade .25s ease-out; } .panel.on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
h2 { font-family: var(--display); font-size: 23px; font-weight: 700; margin-bottom: 20px; letter-spacing: -0.5px; }

/* hero */
.hero { position: relative; overflow: hidden; padding: clamp(34px, 6vw, 78px) 20px clamp(44px, 7vw, 86px); margin-bottom: 26px; text-align: center; background: transparent; }
.hero-inner { position: relative; max-width: 820px; margin: 0 auto; }
.hero-glow { position: absolute; left: 50%; top: 0; width: 740px; height: 560px; transform: translateX(-50%); background: var(--glow); filter: blur(58px); pointer-events: none; }
.eyebrow { position: relative; font-family: var(--display); font-size: 12px; letter-spacing: 3.5px; text-transform: uppercase; color: var(--violet); margin-bottom: 20px; font-weight: 500; }
.hero-title { position: relative; font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(38px, 7.4vw, 84px); line-height: 0.97; letter-spacing: -2px; background: var(--title); -webkit-background-clip: text; background-clip: text; color: transparent; margin: 0 auto; max-width: 14ch; }
html[data-theme="dark"] .hero-title { filter: drop-shadow(0 8px 34px rgba(139,92,246,0.4)); }
.hero-sub { position: relative; color: var(--dim); font-size: 16.5px; max-width: 580px; margin: 24px auto 34px; }
.hl-accent { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 500; }
.hero-cta { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-bottom: 46px; }
.cta { display: inline-flex; align-items: center; gap: 10px; background: var(--grad); color: var(--btn-text); border: none; border-radius: 32px; padding: 15px 28px; font-size: 14.5px; font-weight: 700; font-family: var(--font); cursor: pointer; box-shadow: 0 14px 44px -10px rgba(99,102,241,0.6); transition: transform .16s, box-shadow .16s; }
.cta:hover { transform: translateY(-2px); box-shadow: 0 20px 54px -10px rgba(99,102,241,0.78); }
.cta .arr { transition: transform .2s; } .cta:hover .arr { transform: translateY(3px); }
.cta-ghost { display: inline-flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--border2); color: var(--text); border-radius: 32px; padding: 15px 24px; font-size: 14.5px; font-weight: 700; font-family: var(--font); text-decoration: none; transition: border-color .16s, transform .16s, background .16s; }
.cta-ghost:hover { border-color: var(--accent); transform: translateY(-2px); background: var(--surface2); }
.hero-stats { position: relative; display: flex; justify-content: center; align-items: flex-start; gap: clamp(28px, 6vw, 60px); flex-wrap: wrap; }
.stat { text-align: center; }
.stat-n { display: block; font-family: var(--display); font-weight: 700; font-size: clamp(28px, 3.6vw, 36px); line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-l { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1.6px; color: var(--dim); margin-top: 7px; }

/* section heading */
.section-head { text-align: center; margin: 4px 0 34px; }
.section-title { font-family: var(--display); font-weight: 700; font-size: clamp(26px, 4vw, 40px); letter-spacing: -1px; }
.section-sub { color: var(--dim); margin-top: 10px; font-size: 15px; }

/* tool groups + cards */
.group { margin-bottom: 30px; } .group.hide { display: none; }
.cat { font-family: var(--display); font-size: 12px; text-transform: uppercase; letter-spacing: 2px; color: var(--faint); font-weight: 500; margin-bottom: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(284px, 1fr)); gap: 18px; }
.card { position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: left; white-space: normal; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px 24px 22px; cursor: pointer; font-family: var(--font); transition: transform .18s, background .18s, box-shadow .18s; overflow: hidden; }
.card.hide { display: none; }
.card-head { display: flex; align-items: center; gap: 14px; width: 100%; margin-bottom: 14px; }
.card-ic { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 46px; height: 46px; border-radius: 13px; background: var(--tint); border: 1px solid var(--border); color: var(--accent); transition: color .18s, background .18s, border-color .18s, box-shadow .18s; }
.card-ic svg { width: 22px; height: 22px; }
.card:hover .card-ic { color: #fff; background: var(--grad); border-color: transparent; box-shadow: 0 0 22px -3px rgba(99,102,241,0.7); }
.card::before { content: ''; position: absolute; inset: 0; border-radius: 18px; padding: 1px; background: var(--grad); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0; transition: opacity .18s; }
.card::after { content: "Open \2192"; margin-top: auto; padding-top: 16px; font-family: var(--display); font-size: 12.5px; font-weight: 600; letter-spacing: .3px; color: var(--faint); transition: color .18s; }
.card:hover { transform: translateY(-4px); background: var(--surface2); box-shadow: 0 18px 40px -16px var(--shadow); }
.card:hover::before { opacity: 1; }
.card:hover::after { color: var(--accent); }
.card-t { font-family: var(--display); font-size: 16px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }
.card-d { font-size: 13px; color: var(--dim); line-height: 1.5; }

/* inputs / buttons */
.row { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--dim); margin-bottom: 6px; }
input, textarea, select { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text); padding: 11px 13px; font-size: 14px; font-family: var(--mono); outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input.flags { max-width: 84px; } select { max-width: 150px; cursor: pointer; font-family: var(--font); }
input[type=color] { max-width: 54px; padding: 4px; height: 44px; cursor: pointer; }
input[type=range] { padding: 0; accent-color: var(--accent); }
textarea { resize: vertical; }
button { background: var(--grad); color: var(--btn-text); border: none; border-radius: 10px; padding: 11px 17px; font-size: 13px; font-weight: 700; font-family: var(--font); cursor: pointer; white-space: nowrap; transition: filter .15s, transform .05s; }
button:hover { filter: brightness(1.08); } button:active { transform: translateY(1px); }
button.copy { background: transparent; color: var(--dim); border: 1px solid var(--border); padding: 9px 13px; }
button.copy:hover { color: var(--text); border-color: var(--accent); filter: none; }
.mono { font-family: var(--mono); } .big { font-size: 16px; } .muted { color: var(--dim); font-weight: 400; }
.outwrap { position: relative; } .outwrap .copy { position: absolute; top: 8px; right: 8px; }

/* outputs */
.out { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 2px 16px; margin-top: 4px; }
.out:empty { display: none; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--hairline); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--dim); } .kv .v { font-family: var(--mono); text-align: right; word-break: break-all; }
.kv .v.hi { color: var(--hi); }
.err { color: var(--red); padding: 11px 0; }
.msg { font-size: 12.5px; color: var(--dim); align-self: center; min-height: 16px; }
.msg.ok { color: var(--green); } .msg.bad { color: var(--red); }
.code { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 13px 15px; font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; color: var(--hi); min-height: 40px; }
.hl { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; font-family: var(--mono); font-size: 13px; white-space: pre-wrap; word-break: break-word; min-height: 42px; }
.hl mark { background: var(--mark); color: var(--text); border-radius: 3px; padding: 0 1px; }
.swatch { height: 70px; border-radius: 12px; border: 1px solid var(--border); margin-bottom: 4px; }
.qrbox { display: flex; justify-content: center; padding: 20px; }
.qrbox img { background: #fff; padding: 14px; border-radius: 14px; box-shadow: 0 10px 30px -12px var(--shadow); }
input.short { max-width: 110px; }
.diff-cols { display: flex; gap: 10px; margin-bottom: 12px; }
.diff-cols textarea { flex: 1; min-width: 0; }
.di { font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word; padding: 1px 8px; border-radius: 4px; }
.di-ctx { color: var(--dim); }
.di-add { background: rgba(52,211,153,0.14); color: var(--green); }
.di-del { background: rgba(248,113,113,0.14); color: var(--red); }
@media (max-width: 640px) { .diff-cols { flex-direction: column; } }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }
.chmod { border-collapse: collapse; margin: 6px 0 14px; }
.chmod th, .chmod td { padding: 7px 18px; text-align: center; font-size: 13px; }
.chmod th { color: var(--faint); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; font-size: 11px; }
.chmod th:first-child, .chmod td:first-child { text-align: left; color: var(--dim); }
.ct-preview { display: flex; align-items: center; justify-content: center; min-height: 96px; border-radius: 12px; border: 1px solid var(--border); font-size: 22px; font-weight: 600; margin: 6px 0; }
.md-cols { display: flex; gap: 12px; align-items: stretch; }
.md-cols textarea { flex: 1; min-width: 0; }
.md-prev { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px 18px; overflow: auto; max-height: 440px; }
.md-prev h1, .md-prev h2, .md-prev h3, .md-prev h4 { font-family: var(--display); margin: 16px 0 8px; letter-spacing: -0.4px; }
.md-prev h1 { font-size: 25px; } .md-prev h2 { font-size: 20px; } .md-prev h3 { font-size: 17px; }
.md-prev p { margin: 9px 0; } .md-prev ul { margin: 9px 0 9px 20px; } .md-prev li { margin: 3px 0; }
.md-prev code { background: var(--surface2); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 12.5px; }
.md-prev pre { background: var(--surface2); padding: 12px 14px; border-radius: 8px; overflow: auto; margin: 9px 0; }
.md-prev pre code { background: none; padding: 0; }
.md-prev blockquote { border-left: 3px solid var(--accent); margin: 9px 0; padding: 2px 14px; color: var(--dim); }
.md-prev a { color: var(--accent); }
.md-prev hr { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
@media (max-width: 640px) { .md-cols { flex-direction: column; } }

#toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--grad); color: var(--btn-text); font-weight: 700; font-size: 13px; padding: 10px 20px; border-radius: 22px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 8px 24px -8px rgba(99,102,241,0.55); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 640px) {
  #top { padding: 10px 14px; } #filter { max-width: 130px; }
  #main { padding: 22px 14px 60px; }
  .hero { padding: 30px 12px 44px; }
}
