:root {
  --bg: #0f0f0f; --surface: #171717; --surface-2: #212121;
  --border: #2e2e2e; --border-hover: #444;
  --text: #e5e5e5; --text-dim: #888;
  --accent: #3b82f6; --accent-glow: rgba(59,130,246,0.1); --accent-2: #3b82f6;
  --success: #22c55e; --error: #ef4444; --warning: #eab308;
  --radius: 8px;
  --font-body: "Outfit", sans-serif; --font-mono: "JetBrains Mono", monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6; }

header { border-bottom: 1px solid var(--border); padding: 1rem 2rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: rgba(15,15,15,0.9); backdrop-filter: blur(12px); z-index: 100; }
.logo { font-size: 1.4rem; font-weight: 700; color: var(--text); letter-spacing: -0.5px; cursor: pointer; text-decoration: none; }
.logo span { opacity: 0.5; font-weight: 400; }
header nav { display: flex; gap: 0.5rem; }
header nav a { color: var(--text-dim); text-decoration: none; font-size: 0.85rem; padding: 0.4rem 0.8rem; border-radius: 8px; transition: all 0.2s; cursor: pointer; }
header nav a:hover { background: var(--surface-2); color: var(--text); }

.hero { text-align: center; padding: 3rem 2rem 1.5rem; }
.hero h1 { font-size: 2.4rem; font-weight: 700; letter-spacing: -1px; margin-bottom: 0.5rem; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { color: var(--text-dim); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }
.hero-features { display: flex; justify-content: center; gap: 2rem; margin-top: 1.5rem; flex-wrap: wrap; }
.hero-feature { display: flex; align-items: center; gap: 0.4rem; color: var(--text-dim); font-size: 0.9rem; }
.hero-feature .icon { color: var(--success); }

.tool-nav { display: flex; gap: 0.5rem; padding: 1.5rem 2rem; overflow-x: auto; justify-content: center; flex-wrap: wrap; }
.tool-nav button { font-family: var(--font-body); padding: 0.5rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 100px; color: var(--text-dim); cursor: pointer; font-size: 0.85rem; font-weight: 500; transition: all 0.2s; white-space: nowrap; display: flex; align-items: center; gap: 0.4rem; }
.tool-nav button:hover { border-color: var(--border-hover); color: var(--text); }
.tool-nav button.active { background: var(--accent); border-color: var(--accent); color: white; }
.tool-nav button.new-badge::after { content: "NEW"; font-size: 0.6rem; background: var(--success); color: #000; padding: 0.1rem 0.4rem; border-radius: 4px; font-weight: 700; }

main { max-width: 960px; margin: 0 auto; padding: 1rem 2rem 4rem; }
.tool-panel { display: none; animation: fadeIn 0.3s ease; }
.tool-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.tool-header { margin-bottom: 1.5rem; }
.tool-header h1, .tool-header h2 { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.3rem; }
.tool-header p { color: var(--text-dim); font-size: 0.9rem; }

.tool-article { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.tool-article h3 { font-size: 1.2rem; font-weight: 600; margin-bottom: 0.8rem; }
.tool-article h4 { font-size: 1rem; font-weight: 600; margin-top: 1.2rem; margin-bottom: 0.5rem; }
.tool-article p { color: var(--text-dim); font-size: 0.92rem; line-height: 1.8; margin-bottom: 0.8rem; }
.tool-article ul, .tool-article ol { color: var(--text-dim); font-size: 0.92rem; line-height: 1.8; margin-bottom: 1rem; padding-left: 1.5rem; }
.tool-article li { margin-bottom: 0.3rem; }
.tool-article code { font-family: var(--font-mono); font-size: 0.82rem; background: var(--surface-2); padding: 0.15rem 0.4rem; border-radius: 4px; color: var(--accent); }
.tip-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; margin: 1rem 0; font-size: 0.88rem; color: var(--text-dim); line-height: 1.7; }
.tip-box strong { color: var(--text); }

textarea, input[type="text"], input[type="number"] { font-family: var(--font-mono); font-size: 0.85rem; width: 100%; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); resize: vertical; outline: none; transition: border-color 0.2s; line-height: 1.6; }
textarea:focus, input:focus { border-color: var(--accent); }
textarea { min-height: 160px; }
select { font-family: var(--font-body); font-size: 0.85rem; padding: 0.6rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; color: var(--text); outline: none; cursor: pointer; }
select:focus { border-color: var(--accent); }

.btn-row { display: flex; gap: 0.5rem; margin: 1rem 0; flex-wrap: wrap; align-items: center; }
button.action-btn { font-family: var(--font-body); padding: 0.6rem 1.2rem; border-radius: 8px; border: none; cursor: pointer; font-size: 0.85rem; font-weight: 500; transition: all 0.2s; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { filter: brightness(1.15); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border) !important; }
.btn-secondary:hover { border-color: var(--border-hover) !important; }
.btn-share { background: var(--surface-2); color: var(--text); border: 1px solid var(--border) !important; }
.btn-share:hover { border-color: var(--border-hover) !important; }

.output-box { font-family: var(--font-mono); font-size: 0.85rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; min-height: 100px; white-space: pre-wrap; word-break: break-all; color: var(--success); position: relative; line-height: 1.6; }
.output-box.error { color: var(--error); }
.status-msg { font-size: 0.8rem; padding: 0.4rem 0.8rem; border-radius: 6px; display: inline-block; margin-bottom: 0.5rem; }
.status-msg.ok { background: rgba(52,211,153,0.1); color: var(--success); }
.status-msg.err { background: rgba(248,113,113,0.1); color: var(--error); }
label { font-size: 0.8rem; color: var(--text-dim); display: block; margin-bottom: 0.4rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

.stat-grid { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.5rem; flex: 1; min-width: 120px; text-align: center; }
.stat-card .num { font-size: 2rem; font-weight: 700; color: var(--accent); font-family: var(--font-mono); }
.stat-card .lbl { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; margin-top: 0.2rem; }

.color-preview { width: 100%; height: 120px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 1rem; transition: background 0.3s; }
.color-inputs { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.color-inputs input[type="color"] { width: 50px; height: 50px; border: none; border-radius: 8px; cursor: pointer; background: transparent; }
.color-values { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.5rem; margin-top: 1rem; }
.color-val { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 1rem; font-family: var(--font-mono); font-size: 0.85rem; cursor: pointer; transition: border-color 0.2s; }
.color-val:hover { border-color: var(--accent); }
.color-val span { color: var(--text-dim); font-size: 0.7rem; display: block; font-family: var(--font-body); text-transform: uppercase; letter-spacing: 0.5px; }

.uuid-list { display: flex; flex-direction: column; gap: 0.3rem; }
.uuid-item { font-family: var(--font-mono); font-size: 0.85rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 1rem; cursor: pointer; transition: all 0.2s; display: flex; justify-content: space-between; align-items: center; }
.uuid-item:hover { border-color: var(--accent); }
.uuid-item .click-hint { font-size: 0.7rem; color: var(--text-dim); font-family: var(--font-body); }

.regex-match { background: rgba(59,130,246,0.2); border-radius: 3px; padding: 0 2px; }
.hash-result { margin-top: 0.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 1rem; font-family: var(--font-mono); font-size: 0.8rem; word-break: break-all; cursor: pointer; }
.hash-result:hover { border-color: var(--accent); }
.hash-label { font-size: 0.7rem; color: var(--text-dim); font-family: var(--font-body); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* Regex Visualizer */
.regex-tokens { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1rem 0; }
.regex-token { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 0.4rem 0.7rem; font-family: var(--font-mono); font-size: 0.82rem; display: flex; flex-direction: column; align-items: center; gap: 0.2rem; }
.regex-token .tok-char { color: var(--accent); font-weight: 600; }
.regex-token .tok-desc { font-family: var(--font-body); font-size: 0.68rem; color: var(--text-dim); white-space: nowrap; }
.regex-explain-list { list-style: none; padding: 0; margin: 1rem 0; }
.regex-explain-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 1rem; margin-bottom: 0.4rem; display: flex; gap: 1rem; align-items: baseline; }
.regex-explain-list .rx-pat { font-family: var(--font-mono); color: var(--accent); font-weight: 600; min-width: 80px; font-size: 0.85rem; }
.regex-explain-list .rx-desc { color: var(--text-dim); font-size: 0.85rem; }

/* Cron */
.cron-fields { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.cron-field { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.cron-field input { width: 60px; text-align: center; padding: 0.5rem; font-family: var(--font-mono); }
.cron-field .cf-label { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; }
.cron-schedule { list-style: none; padding: 0; }
.cron-schedule li { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 0.6rem 1rem; margin-bottom: 0.3rem; font-family: var(--font-mono); font-size: 0.85rem; display: flex; justify-content: space-between; }
.cron-schedule .cron-idx { color: var(--text-dim); font-size: 0.75rem; }
.cron-human { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: 1rem 0; font-size: 0.92rem; color: var(--text); }

/* SQL Converter */
.schema-output { font-family: var(--font-mono); font-size: 0.82rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; min-height: 150px; white-space: pre-wrap; color: var(--text); line-height: 1.7; position: relative; overflow-x: auto; }

/* SVG Converter */
.svg-preview { width: 100%; min-height: 120px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; padding: 1rem; margin-bottom: 1rem; }
.svg-preview svg { max-width: 200px; max-height: 200px; }

/* FAQ */
.faq-section { max-width: 960px; margin: 0 auto; padding: 3rem 2rem; border-top: 1px solid var(--border); }
.faq-section h2 { font-size: 1.8rem; font-weight: 700; text-align: center; margin-bottom: 2rem; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 0.8rem; overflow: hidden; }
.faq-question { padding: 1.2rem 1.5rem; cursor: pointer; display: flex; justify-content: space-between; align-items: center; font-weight: 500; font-size: 0.95rem; transition: background 0.2s; }
.faq-question:hover { background: var(--surface-2); }
.faq-question .arrow { transition: transform 0.3s; color: var(--text-dim); }
.faq-item.open .faq-question .arrow { transform: rotate(180deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.faq-item.open .faq-answer { max-height: 1000px; }
.faq-answer-inner { padding: 0 1.5rem 1.2rem; color: var(--text-dim); font-size: 0.9rem; line-height: 1.8; }

/* Pages */
.page-section { max-width: 960px; margin: 0 auto; padding: 2rem; padding-top: 2.5rem; animation: fadeIn 0.3s ease; }
.page-section h2 { font-size: 1.8rem; font-weight: 700; margin-bottom: 1.5rem; }
.page-section h3 { font-size: 1.1rem; font-weight: 600; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.page-section p { color: var(--text-dim); font-size: 0.92rem; line-height: 1.8; margin-bottom: 0.8rem; }
.page-section ul { color: var(--text-dim); font-size: 0.92rem; line-height: 1.8; padding-left: 1.5rem; margin-bottom: 1rem; }
.page-section a { color: var(--accent); text-decoration: none; }
.page-section a:hover { text-decoration: underline; }
.back-link { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--accent); text-decoration: none; font-size: 0.9rem; margin-bottom: 1.5rem; }

footer { text-align: center; padding: 3rem 2rem; border-top: 1px solid var(--border); color: var(--text-dim); font-size: 0.8rem; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* Cookie Consent Banner */
.cookie-banner { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 1.2rem 2rem; z-index: 10000; display: none; animation: slideUp 0.4s ease; }
.cookie-banner.show { display: block; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.cookie-inner { max-width: 960px; margin: 0 auto; display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.cookie-text { flex: 1; min-width: 280px; font-size: 0.85rem; color: var(--text-dim); line-height: 1.6; }
.cookie-text a { color: var(--accent); text-decoration: none; }
.cookie-text a:hover { text-decoration: underline; }
.cookie-btns { display: flex; gap: 0.5rem; flex-shrink: 0; }
.cookie-btns button { font-family: var(--font-body); padding: 0.55rem 1.2rem; border-radius: 8px; border: none; cursor: pointer; font-size: 0.82rem; font-weight: 600; transition: all 0.2s; }
.cookie-accept { background: var(--accent); color: white; }
.cookie-accept:hover { filter: brightness(1.15); }
.cookie-reject { background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border) !important; }
.cookie-reject:hover { border-color: var(--border-hover) !important; color: var(--text); }
.cookie-toggles { display: flex; gap: 1.2rem; margin: 0.8rem 0; flex-wrap: wrap; }
.cookie-toggle { display: flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; color: var(--text-dim); }
.cookie-toggle input[type="checkbox"] { display: none; }
.toggle-track { width: 36px; height: 20px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.toggle-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: var(--text-dim); border-radius: 50%; transition: all 0.2s; }
.cookie-toggle input:checked + .toggle-track { background: var(--accent); border-color: var(--accent); }
.cookie-toggle input:checked + .toggle-track::after { left: 18px; background: white; }

/* Tool cards for hub page */
.tool-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; max-width: 960px; margin: 0 auto; padding: 1.5rem 2rem; }
.tool-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; text-decoration: none; color: var(--text); transition: all 0.2s; display: block; }
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-card .tool-card-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.tool-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.3rem; }
.tool-card p { color: var(--text-dim); font-size: 0.85rem; line-height: 1.5; margin: 0; }
.tool-card .new-label { font-size: 0.6rem; background: var(--success); color: #000; padding: 0.1rem 0.4rem; border-radius: 4px; font-weight: 700; vertical-align: middle; margin-left: 0.3rem; }

/* Related tools section for tool pages */
.related-tools { margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.related-tools h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }
.related-tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.8rem; }
.related-tools-grid a { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; text-decoration: none; color: var(--text); font-size: 0.9rem; transition: all 0.2s; display: block; }
.related-tools-grid a:hover { border-color: var(--accent); }

/* Tablet */
@media (max-width: 768px) {
  .hero h1 { font-size: 2.2rem; }
  .hero p { font-size: 1rem; }
  .stat-grid { gap: 0.5rem; }
  .stat-card { padding: 0.8rem 1rem; min-width: 100px; }
  .stat-card .num { font-size: 1.5rem; }
}
/* Mobile */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.8rem; }
  header { padding: 0.8rem 1rem; }
  header nav a { padding: 0.5rem 0.6rem; font-size: 0.8rem; }
  main { padding: 1rem; }
  .tool-nav { padding: 1rem; justify-content: flex-start; }
  .tool-nav button { padding: 0.6rem 1rem; font-size: 0.85rem; min-height: 44px; }
  .grid-2 { grid-template-columns: 1fr; }
  .cron-fields { justify-content: center; }
  button.action-btn { padding: 0.7rem 1.2rem; min-height: 44px; }
  textarea, input[type="text"], input[type="number"] { font-size: 1rem; }
  select { font-size: 1rem; min-height: 44px; }
  .cookie-inner { flex-direction: column; gap: 1rem; }
  .cookie-btns { width: 100%; justify-content: stretch; }
  .cookie-btns button { flex: 1; min-height: 44px; }
  .cookie-toggles { flex-direction: column; gap: 0.6rem; }
  footer p:last-child { line-height: 2.2; }
  .page-section table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; font-size: 0.78rem; }
  .page-section { padding: 1.5rem 1rem; }
  .stat-grid { gap: 0.4rem; }
  .stat-card { min-width: 80px; padding: 0.6rem 0.5rem; }
  .stat-card .num { font-size: 1.3rem; }
  .stat-card .lbl { font-size: 0.65rem; }
  .tool-cards { grid-template-columns: 1fr; padding: 1rem; }
}
