:root {
    --bg: #0f172a;
    --panel: #111827;
    --panel-2: #1f2937;
    --text: #f9fafb;
    --muted: #cbd5e1;
    --accent: #22c55e;
    --accent-hover: #16a34a;
    --border: #334155;
    --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: var(--text);
    min-height: 100vh;
    padding: 24px;
}

.wrap {
    max-width: 900px;
    margin: 0 auto;
}

.card {
    width: 100%;
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    margin-bottom: 24px;
}

h1 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 2rem;
}

h2 {
    margin-top: 0;
    margin-bottom: 14px;
}

.sub {
    margin: 0 0 24px;
    color: var(--muted);
}

form {
    display: grid;
    gap: 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

label,
label.group-label,
.field-label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

input[type="number"],
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    font-size: 1rem;
}

input[type="text"],
input[type="password"],
select {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
    font-size: 1rem;
}

textarea {
    min-height: 240px;
    resize: vertical;
    font-family: Consolas, Monaco, monospace;
    line-height: 1.45;
}

.checks {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    align-items: stretch;
}

.check-item {
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 8px;
    flex: 1 1 0;
    min-width: 0;
}

.check-item label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    font-size: 0.86rem;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tooltip {
    position: relative;
}

.tooltip .tooltip-text {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translate(-50%, 4px);
    background: #020617;
    color: var(--text);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    border: 1px solid var(--border);
    z-index: 10;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tooltip:hover .tooltip-text,
.tooltip:focus-within .tooltip-text {
    opacity: 1;
    transform: translate(-50%, 0);
}
.tooltip.active:hover .tooltip-text,
.tooltip.active:focus-within .tooltip-text {
    opacity: 1;
}

button,
.button-link {
    outline: none;
    border: 0;
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.actions-right {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-left: auto;
}

.primary {
    background: var(--accent);
    color: #06220f;
}

.primary:hover {
    background: var(--accent-hover);
}

.secondary {
    background: #334155;
    color: var(--text);
}

.secondary:hover {
    background: #475569;
}

.errors {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fecaca;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
}

/* Password generator page */
.results {
    margin-top: 0;
}

.result-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    background: var(--panel-2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
}

.password-box {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
    font-family: Consolas, Monaco, monospace;
    outline: none;
    padding: 0;
}

.copy-btn,
.copy-all-btn {
    background: #2563eb;
    color: white;
    min-width: 96px;
}

.copy-btn:hover,
.copy-all-btn:hover {
    background: #1d4ed8;
}

.strength-wrap {
    margin-bottom: 20px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
}

.strength-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.strength-label {
    font-weight: 700;
}

.strength-bar {
    width: 100%;
    height: 12px;
    background: #334155;
    border-radius: 999px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    border-radius: 999px;
}

.strength-weak { background: #ef4444; }
.strength-fair { background: #f59e0b; }
.strength-strong { background: #22c55e; }
.strength-very-strong { background: #06b6d4; }

.footer-note,
.note {
    margin-top: 16px;
    color: var(--muted);
    font-size: 0.95rem;
}

/* GUID page */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.warning {
    margin-top: 16px;
    color: #fca5a5;
    font-size: 0.95rem;
}

.check-item input {
    width: auto;
}

/* Shared ad card */
.ad-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.ad-card-inner {
    display: grid;
    grid-template-columns: minmax(0, 220px) 1fr;
    gap: 20px;
    align-items: center;
    min-height: 220px;
}

.ad-image-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    overflow: hidden;
    background: #0b1220;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ad-copy {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ad-kicker {
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.ad-title {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
}

.ad-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    background: #2563eb;
    color: #fff;
    border-radius: 10px;
    padding: 12px 16px;
    font-weight: 700;
}

.code-output {
    font-family: Consolas, Monaco, monospace;
    line-height: 1.5;
    background-color: #020617;
}

/* Footer */
.site-footer {
    margin-top: 30px;
    padding: 24px 20px;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 6px;
}

.footer-tagline {
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
}

.footer-links a:hover {
    color: var(--text);
}

.footer-bottom {
    margin-top: 16px;
    font-size: 0.85rem;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.footer-sep {
    opacity: 0.6;
}

.affiliate-disclaimer {
    margin-top: 14px;
    font-size: 0.8rem;
    color: var(--muted);
    opacity: 0.8;
    line-height: 1.4;
}

/* Collapsible info block */
.info-block {
    margin-top: 20px;
    padding: 16px 18px;
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
}

.info-block summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--text);
    list-style: none;
}

.info-block summary::-webkit-details-marker {
    display: none;
}

.info-block summary::after {
    content: '＋';
    float: right;
    color: var(--muted);
    font-weight: 700;
}

.info-block[open] summary::after {
    content: '−';
}

.info-content {
    margin-top: 14px;
}

.info-content h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: var(--text);
}

.info-content p {
    margin: 0 0 12px;
    color: var(--muted);
    line-height: 1.5;
    font-size: 0.95rem;
}

.info-content code {
    background: #020617;
    padding: 3px 6px;
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--text);
}

@media (max-width: 640px) {
    body { padding: 16px; }
    .card { padding: 20px; }

    .result-row { grid-template-columns: 1fr; }
    .copy-btn,
    .copy-all-btn { width: 100%; }

    .ad-card-inner { grid-template-columns: 1fr; min-height: 0; }
    .ad-image-wrap { max-width: 100%; }
    .ad-title { font-size: 1.2rem; }

    .actions { align-items: stretch; }
    .actions-right {
        margin-left: 0;
        width: 100%;
    }
    .actions-right .button-link,
    .actions-right button {
        width: 100%;
    }

    .results-header {
        align-items: stretch;
    }
    .results-header button {
        width: 100%;
    }

    .checks {
        overflow-x: auto;
    }
}