:root {
    --bg: #f6f5f3;
    --surface: #ffffff;
    --surface-muted: #efede9;
    --text: #1d1b19;
    --text-muted: #6b6560;
    --border: #dcd8d2;
    --primary: #e2531c;
    --primary-hover: #c5440f;
    --primary-text: #ffffff;
    --focus: rgba(226, 83, 28, .35);
    --error-bg: #fdecea; --error-text: #9b1c12;
    --info-bg: #e8f1fb;  --info-text: #1b4b80;
    --warn-bg: #fff4e0;  --warn-text: #7a4a00;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #141210;
        --surface: #1f1c19;
        --surface-muted: #191714;
        --text: #f0ece7;
        --text-muted: #a39b93;
        --border: #36312c;
        --primary: #f0662f;
        --primary-hover: #ff7c47;
        --focus: rgba(240, 102, 47, .4);
        --error-bg: #3a1714; --error-text: #ffb4aa;
        --info-bg: #14273d;  --info-text: #a9cdf5;
        --warn-bg: #352409;  --warn-text: #f5cf8a;
        --shadow: none;
    }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

[hidden] { display: none !important; }

.site-header {
    padding: 20px 16px;
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
}

.brand {
    color: var(--text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: -.01em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.icon {
    width: 1.15em;
    height: 1.15em;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.icon-solid { fill: currentColor; stroke: none; }
.brand .icon { width: 1.35em; height: 1.35em; color: var(--primary); }

.container {
    flex: 1;
    max-width: 760px;
    width: 100%;
    margin: 0 auto;
    padding: 0 16px 32px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 20px;
}

.card-muted { background: var(--surface-muted); box-shadow: none; }

h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.02em; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }

.lead { color: var(--text-muted); margin: 0 0 22px; }

.how ol { margin: 0; padding-left: 20px; color: var(--text-muted); }
.how li + li { margin-top: 6px; }

code {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 4px;
    font-size: .9em;
}

.label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.optional { font-weight: 400; color: var(--text-muted); }

textarea, input[type="text"], input[type="password"], select {
    width: 100%;
    font: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    transition: border-color .15s, box-shadow .15s;
}

textarea {
    resize: vertical;
    min-height: 140px;
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    font-size: .95rem;
}

textarea:focus, input:focus, select:focus, .btn:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus);
}

.hint { color: var(--text-muted); font-size: .85rem; margin-top: 6px; }

.generator { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 12px; }
.gen-option { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: var(--text-muted); }
.gen-option select { width: auto; padding: 5px 8px; }
.gen-option input { accent-color: var(--primary); }
.btn-small { padding: 7px 12px; font-size: .9rem; }
.input-group { display: flex; gap: 6px; }
.input-group input { flex: 1; min-width: 0; }
.btn-icon { padding: 0 11px; flex: none; }
.btn-icon[aria-pressed="true"] { background: var(--surface-muted); border-color: var(--primary); }
.alert .copy-box { margin: 10px 0 0; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 18px 0; }
.field { min-width: 0; }
#password-field { margin-bottom: 16px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font: inherit;
    font-weight: 600;
    border-radius: 8px;
    padding: 11px 18px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
}

.btn:disabled { opacity: .65; cursor: progress; }

.btn-primary { background: var(--primary); color: var(--primary-text); width: 100%; padding: 13px 18px; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary { background: var(--text); color: var(--bg); }
.btn-secondary:hover { opacity: .88; }

.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-muted); }

.copy-box { display: flex; gap: 8px; margin-bottom: 10px; }
.copy-box input { font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }

.actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

#result-section .btn-ghost { margin-top: 16px; }

.alert { border-radius: 8px; padding: 12px 14px; margin: 14px 0; font-size: .95rem; }
.alert-error { background: var(--error-bg); color: var(--error-text); }
.alert-info  { background: var(--info-bg);  color: var(--info-text); }
.alert-warn  { background: var(--warn-bg);  color: var(--warn-text); }

.site-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: .85rem;
    padding: 20px 16px 32px;
}
.site-footer p { margin: 0; }
.footer-links { margin-top: 8px; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }


.noscript {
    position: fixed; inset: auto 0 0 0;
    background: var(--error-bg); color: var(--error-text);
    padding: 12px; text-align: center;
}

@media (max-width: 600px) {
    .card { padding: 20px; }
    h1 { font-size: 1.35rem; }
    .row { grid-template-columns: 1fr; }
    .copy-box { flex-direction: column; }
}
