*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface2: #334155;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #334155;
    --success: #10b981;
    --error: #ef4444;
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ─────────────────────────────────────── */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text);
}

.logo-icon {
    font-size: 1.3rem;
    font-weight: 900;
    color: var(--accent);
    font-family: monospace;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
}

.nav-home {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-home:hover { color: var(--accent); }

/* ── Ad Banners ─────────────────────────────────── */
.ad-banner {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    text-align: center;
    padding: 0.5rem 1rem;
}

.ad-placeholder {
    background: var(--surface2);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 1rem;
    max-width: 728px;
    margin: 0 auto;
    border-radius: var(--radius);
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border);
}

.ad-sidebar .ad-placeholder {
    max-width: 300px;
    min-height: 250px;
}

/* ── Main ───────────────────────────────────────── */
main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem 1rem;
}

/* ── Hero ───────────────────────────────────────── */
.hero {
    text-align: center;
    padding: 2.5rem 0 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text) 30%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.75rem;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* ── Tools Grid ─────────────────────────────────── */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.tool-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    display: block;
}

.tool-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.15);
}

.tool-icon {
    font-size: 1.5rem;
    font-weight: 900;
    font-family: monospace;
    color: var(--accent);
    margin-bottom: 0.75rem;
    height: 2rem;
    display: flex;
    align-items: center;
}

.tool-card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.tool-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.tag {
    display: inline-block;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-weight: 500;
}

/* ── Tool Page Layout ───────────────────────────── */
.tool-page-wrap {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.tool-main { flex: 1; min-width: 0; }

.sidebar { width: 300px; flex-shrink: 0; }

.tool-page-header { margin-bottom: 1.5rem; }

.tool-page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.tool-page-header p { color: var(--text-muted); }

.tool-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ── Inputs ─────────────────────────────────────── */
textarea, input[type="text"], input[type="number"], select {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    padding: 0.75rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    width: 100%;
    resize: vertical;
    transition: border-color 0.2s;
    outline: none;
}

textarea:focus, input:focus, select:focus { border-color: var(--accent); }
textarea { min-height: 180px; }

/* ── Buttons ─────────────────────────────────────── */
.btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn:hover { background: var(--accent-hover); }

.btn-ghost {
    background: var(--surface2);
    color: var(--text);
}

.btn-ghost:hover { background: var(--border); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.75rem 0;
}

/* ── Labels ─────────────────────────────────────── */
label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Output ─────────────────────────────────────── */
.output-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    min-height: 80px;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text);
    line-height: 1.6;
}

.output-box.ok { border-color: var(--success); }
.output-box.err { border-color: var(--error); color: var(--error); }

/* ── Status ─────────────────────────────────────── */
.status {
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: none;
}

.status.ok { background: rgba(16,185,129,.1); color: var(--success); display: block; }
.status.err { background: rgba(239,68,68,.1); color: var(--error); display: block; }

/* ── Stats Row ───────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.stat-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.2rem;
}

/* ── Password Strength ───────────────────────────── */
.strength-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--surface2);
    margin-top: 0.5rem;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s, background 0.3s;
}

/* ── Color Tool ──────────────────────────────────── */
.color-swatch {
    width: 100%;
    height: 100px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.color-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

input[type="color"] {
    width: 100%;
    height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    cursor: pointer;
    padding: 0.25rem;
}

/* ── Range ───────────────────────────────────────── */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: var(--surface2);
    height: 6px;
    border-radius: 3px;
    border: none;
    padding: 0;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

/* ── Checkbox ────────────────────────────────────── */
.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-group label {
    font-size: 0.9rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text);
    cursor: pointer;
    margin: 0;
}

/* ── Tabs ────────────────────────────────────────── */
.tab-bar {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    gap: 0;
}

.tab {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: none;
    border-left: none;
    border-right: none;
    border-top: none;
    transition: color 0.2s;
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab:hover { color: var(--text); }

/* ── Timestamp ───────────────────────────────────── */
.now-display {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    font-family: monospace;
    margin-bottom: 1rem;
}

.now-display .ts-value {
    font-size: 1.5rem;
    color: var(--accent);
    font-weight: 700;
}

.now-display .ts-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Footer ──────────────────────────────────────── */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: auto;
}

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

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 900px) {
    .tool-page-wrap { flex-direction: column; }
    .sidebar { width: 100%; }
}

@media (max-width: 600px) {
    .hero h1 { font-size: 1.75rem; }
    .tools-grid { grid-template-columns: 1fr 1fr; }
    .color-inputs { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
    .tools-grid { grid-template-columns: 1fr; }
}

/* ── FAQ / Rich Content ──────────────────────────── */
.faq-item { margin-bottom: 1.25rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.faq-item h3 { font-size: 0.95rem; font-weight: 600; color: var(--text); margin-bottom: 0.4rem; }
.faq-item p { color: var(--text-muted); font-size: 0.875rem; line-height: 1.75; }

.use-cases { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.use-case-item { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; }
.use-case-item strong { display: block; font-size: 0.875rem; color: var(--text); margin-bottom: 0.2rem; }
.use-case-item span { font-size: 0.8rem; color: var(--text-muted); }

.how-to-steps { counter-reset: steps; display: flex; flex-direction: column; gap: 0.6rem; }
.step { display: flex; gap: 0.75rem; align-items: flex-start; }
.step::before { counter-increment: steps; content: counter(steps); background: var(--accent); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; flex-shrink: 0; margin-top: 0.1rem; }
.step p { color: var(--text-muted); font-size: 0.875rem; line-height: 1.6; margin: 0; }
.step strong { color: var(--text); }

@media (max-width: 600px) { .use-cases { grid-template-columns: 1fr; } }
