:root {
    --background: #f8f9fa;
    --surface: #ffffff;
    --text: #1a1a1a;
    --muted: #6c757d;
    --line: #dee2e6;
    --accent: #d8242a;
    --accent-dark: #b41a1f;
    --success: #198754;
    --danger: #dc3545;
    --radius: 12px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--background); color: var(--text); font-family: var(--font); line-height: 1.5; overflow-y: scroll; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-size: 1.1rem; font-weight: 800; letter-spacing: -0.02em; }
.main-nav { display: flex; gap: 4px; }
.nav-link { color: var(--muted); padding: 6px 12px; border-radius: 8px; font-size: 0.9rem; font-weight: 600; transition: background 0.15s, color 0.15s; }
.nav-link:hover, .nav-link.is-active { color: var(--text); background: #e9ecef; }
.page-shell { padding: 32px 0 48px; }
.page-layout { display: flex; flex-direction: row; justify-content: center; align-items: flex-start; gap: 24px; width: 100%; max-width: 1100px; margin: 0 auto; }

/* Bannière pub avec ratio dynamique */
.ad-banner {
    width: 100%;
    max-width: 300px;
    aspect-ratio: 300 / 700;
    flex-shrink: 0;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    position: sticky;
    top: 76px;
    display: block;
}

.tool-card { flex: 1; max-width: 480px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); padding: 24px; box-shadow: 0 4px 12px rgba(0,0,0,0.03); }
h1 { font-size: 1.25rem; font-weight: 700; margin-bottom: 20px; text-align: center; }
.field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
input, textarea { width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 10px 12px; color: var(--text); outline: none; transition: border-color 0.15s; }
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }
.options-card { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; padding: 12px; background: #f8f9fa; border-radius: 8px; }
.option-item { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; font-weight: 500; color: var(--text); }
.option-item input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.primary-button, .secondary-button { width: 100%; display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border-radius: 8px; font-weight: 600; border: none; transition: background 0.15s; }
.primary-button { background: var(--accent); color: #fff; }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { background: #e9ecef; color: var(--text); }
.secondary-button:hover { background: #dee2e6; }
.action-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.action-row .primary-button, .action-row .secondary-button { min-height: 38px; font-size: 0.85rem; }
.results-panel, .qrcode-result-card, .result-card { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.results-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 0.9rem; font-weight: 600; }
.results-header .secondary-button { width: auto; min-height: 32px; padding: 0 12px; font-size: 0.8rem; }
.password-results { display: flex; flex-direction: column; gap: 8px; }
.password-item { background: #f8f9fa; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.password-item code { font-size: 0.9rem; font-weight: 600; word-break: break-all; flex: 1; }
.password-item .secondary-button { width: auto; min-height: 32px; padding: 0 12px; font-size: 0.8rem; }
.empty-state { margin: 0; color: var(--muted); font-size: 0.9rem; text-align: center; padding: 16px 0; }
.helper-message { min-height: 20px; margin-top: 12px; font-size: 0.85rem; font-weight: 600; text-align: center; }
.helper-message.is-success { color: var(--success); }
.helper-message.is-error { color: var(--danger); }
.qrcode-output { min-height: 200px; display: flex; align-items: center; justify-content: center; background: #f8f9fa; border: 1px dashed var(--line); border-radius: 8px; margin-bottom: 12px; }
.qrcode-output img { max-width: 100%; height: auto; display: block; }
.qrcode-result-card .secondary-button { text-align: center; display: block; }
.is-hidden { display: none !important; }
.site-footer { padding: 24px 0; text-align: center; color: var(--muted); font-size: 0.8rem; }

.ad-slider { width: 100%; height: 100%; position: relative; overflow: hidden; border-radius: var(--radius); }
.ad-slide { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 1s ease-in-out; }
.ad-slide.is-active { opacity: 1; }
.ad-slide img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: var(--radius); }

/* TABLETTE */
@media (max-width: 1100px) {
    .ad-banner { max-width: 240px; }
}

/* MOBILE ET TABLETTE VERTICALE */
@media (max-width: 850px) {
    .page-layout { flex-direction: column; align-items: center; }
    .tool-card { order: 1; width: 100%; max-width: 100%; }
    .ad-banner { order: 2; width: 100%; max-width: 360px; position: relative; top: auto; }
}

@media (max-width: 480px) {
    .ad-banner { max-width: 100%; }
    .options-card { grid-template-columns: 1fr; }
    .action-row { grid-template-columns: 1fr; }
}