/*-----------------------------------------------------------------------------
 * Project : ai4good - CFP Arts
 * File    : frontend/css/components.css
 * Stylesheet : UI components
 * Author  : Johann Sievering
 * AI Support : Claude AI
 * Date    : 2026-06-11 (start of the project)
 * Rev     : 2026-07-03 Full code review: bug fixes, hardening, cartridge headers (Claude AI)
 * Rev     : 2026-07-06 Everyday-life analogy line style (.eco-analogy) (Claude AI)
 * Version : 0.9.0
 *-----------------------------------------------------------------------------
 * Cards, panels, scanner, slots, review, eco card, gallery, dialogs, toasts,
 * forms.
 *---------------------------------------------------------------------------*/

/* =====================================================================
 * components.css — reusable building blocks.
 *
 * Phase A: hero, section-card grid, panel, buttons, pills, stepper,
 *          more-menu, info-toggle, coming-soon, page-head, helpers.
 * Phase B: scanner viewport, slot rows, chips, warn-banner, dialogs,
 *          subject-banner, final prompt, dimension bars, review panel,
 *          generic toast.
 * ===================================================================== */

/* ── Hero (home page) ─────────────────────────────────────────────── */
.hero {
    text-align: center;
    margin: var(--space-md) 0 var(--space-xl);
}

/* ── Partner / supporter logos (home bottom + about top) ───────────── */
.partners {
    margin: var(--space-xl) 0 var(--space-sm);
    text-align: center;
}
.partners__label {
    font-size: var(--font-size-sm);
    color: var(--text-light);
    margin: 0 0 var(--space-sm);
}
.partners__logos {
    /* A white card so the logos (white-background JPG) sit cleanly on the
       cream page; width/height attributes reserve the ratio (no layout shift). */
    display: block;
    width: 100%;
    max-width: 900px;
    height: auto;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    box-shadow: var(--shadow-sm);
}
.hero__kicker {
    font-size: var(--font-size-xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--blue);
}
.hero__title {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    color: var(--blue-900);
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin: var(--space-xs) 0 var(--space-sm);
}
.hero__subtitle {
    font-size: var(--font-size-base);
    color: var(--text-light);
    margin: 0 0 var(--space-sm);
}
.hero__meta {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-light);
    margin-top: var(--space-sm);
}
.hero__meta span { display: inline-flex; align-items: center; gap: 4px; }
.hero__link { margin-top: var(--space-xs); font-size: var(--font-size-sm); }
.hero__link a { font-weight: 600; }

/* ── Section cards (home + Learn tile grids) ──────────────────────── */
.section-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}
@media (min-width: 1024px) {
    .section-cards { grid-template-columns: repeat(4, 1fr); }
}

.section-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text);
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    cursor: pointer;
}
.section-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.section-card__image {
    height: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    line-height: 1;
}
.section-card__body { padding: var(--space-md); }
.section-card__title {
    margin: 0 0 4px;
    font-size: var(--font-size-base);
    font-weight: 800;
    color: var(--blue-900);
}
.section-card__desc {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-light);
    line-height: 1.4;
}

.section-card--compose  .section-card__image { background: var(--blue-50);   color: var(--blue);   }
.section-card--create   .section-card__image { background: var(--green-50);  color: var(--green);  }
.section-card--learn    .section-card__image { background: var(--orange-50); color: var(--orange); }
.section-card--more     .section-card__image { background: var(--purple-50); color: var(--purple); }

/* ── Generic panel ────────────────────────────────────────────────── */
.panel {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
}
.panel__title {
    margin: 0 0 4px;
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: var(--blue-900);
}
.panel__desc {
    margin: 0 0 var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-light);
}
.panel--scan      { border-left: 4px solid var(--blue);   }
.panel--assemble  { border-left: 4px solid var(--green);  }
.panel--evaluate  { border-left: 4px solid var(--orange); }

/* ── Page header (small breadcrumb-y title above panels) ──────────── */
.page-head { margin: var(--space-sm) 0 var(--space-md); }
.page-head__title {
    margin: 0 0 4px;
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--blue-900);
    letter-spacing: -0.3px;
}
.page-head__subtitle {
    margin: 0;
    font-size: var(--font-size-sm);
    color: var(--text-light);
}

/* ── Stepper (3-step horizontal indicator) ───────────────────────── */
.stepper {
    display: flex;
    gap: var(--space-sm);
    margin: 0 0 var(--space-md);
    padding: var(--space-sm) 0;
    list-style: none;
    /* Sticky below the fixed header so it's reachable at all times. */
    position: sticky;
    top: var(--header-height);
    z-index: 900;                 /* under the header (--z-header: 1000) */
    background: var(--bg);
    box-shadow: 0 4px 6px -4px rgba(0, 0, 0, 0.15);
}
/* When jumping to a section, leave room for the fixed header + sticky stepper. */
.panel,
#send-container { scroll-margin-top: calc(var(--header-height) + 64px); }

/* ── Collapsible cards (open/close shutters) ──────────────────────── */
.js-collapse-toggle { cursor: pointer; user-select: none; }
.panel--collapsible > .panel__title.js-collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: 0;
}
.panel--collapsible:not(.panel--collapsed) > .panel__title.js-collapse-toggle {
    margin-bottom: var(--space-md);    /* restore spacing above the body */
}
.panel__chevron {
    flex: 0 0 auto;
    color: var(--text-light);
    transition: transform var(--transition-fast);
}
.panel--collapsible:not(.panel--collapsed) .panel__chevron {
    transform: rotate(90deg);          /* ▸ → ▾ when open */
}
.panel--collapsed > :not(.js-collapse-keep) { display: none !important; }
.stepper__item {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-light);
    background: var(--gray-50);
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-xs);
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast),
                border-color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}
.stepper__item:hover {
    background: var(--blue-50);
    color: var(--blue);
}
.stepper__item--active {
    background: var(--blue-50);
    color: var(--blue);
    border-color: var(--blue);
}
.stepper__item--done {
    background: var(--green-50);
    color: var(--green);
}

/* ── Info toggle (collapsible "rules" block) ──────────────────────── */
.info-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-light);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    margin-bottom: var(--space-md);
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.info-toggle:hover {
    background: var(--blue-50);
    border-color: var(--blue);
    color: var(--blue);
}
.info-body {
    background: var(--blue-50);
    border: 1px solid var(--blue);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    color: var(--blue-900);
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: 700;
    padding: 11px 16px;
    border-radius: var(--radius-md);
    border: 2px solid var(--blue);
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    transition: filter var(--transition-fast), transform var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
.btn:hover   { filter: brightness(1.05); }
.btn:active  { transform: translateY(1px); }
.btn:disabled{ opacity: 0.4; cursor: not-allowed; }

.btn--secondary { background: var(--bg-card); color: var(--blue); }
.btn--ghost     { background: transparent; color: var(--text-light); border-color: var(--border); }
.btn--danger    { background: var(--red); border-color: var(--red); }

/* ── Pills ───────────────────────────────────────────────────────── */
.pill {
    display: inline-block;
    padding: 2px 9px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 700;
}
.pill--ok     { background: var(--green-50);  color: var(--green);  }
.pill--info   { background: var(--blue-50);   color: var(--blue);   }
.pill--warn   { background: var(--orange-50); color: var(--orange); }
.pill--accent { background: var(--purple-50); color: var(--purple); }

/* ── More menu (full-screen drawer from the footer "⋯" tab) ──────── */
.more-menu {
    position: fixed;
    inset: 0;
    /* Above the footer bar (--z-footer) so the sheet's lower items are
       never hidden behind it; still below toasts. */
    z-index: var(--z-drawer);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(15, 36, 56, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}
.more-menu.open { opacity: 1; pointer-events: auto; }
.more-menu__sheet {
    width: 100%;
    max-width: 760px;
    max-height: 88vh;
    overflow-y: auto;
    background: var(--bg-card);
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-md);
    transform: translateY(100%);
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-lg);
    padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
}
.more-menu.open .more-menu__sheet { transform: translateY(0); }
.more-menu__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}
.more-menu__title {
    margin: 0;
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: var(--blue-900);
}
.more-menu__close {
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: var(--font-size-base);
    font-weight: 700;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
}
.more-menu__close:hover { color: var(--blue-900); background: var(--gray-50); }
.more-menu__items {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-sm);
    list-style: none;
    margin: 0;
    padding: 0;
}
@media (min-width: 600px) { .more-menu__items { grid-template-columns: repeat(2, 1fr); } }
.more-menu__item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text);
    text-decoration: none;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
.more-menu__item:hover {
    background: var(--blue-50);
    border-color: var(--blue);
    text-decoration: none;
}
.more-menu__icon {
    flex: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--purple-50);
    color: var(--purple);
    font-size: 1.3rem;
}
.more-menu__text { display: flex; flex-direction: column; min-width: 0; }
.more-menu__label {
    font-weight: 800;
    color: var(--blue-900);
    font-size: var(--font-size-base);
}
.more-menu__desc {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    line-height: 1.3;
}

/* ── Coming-soon stub ─────────────────────────────────────────────── */
.coming-soon {
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
}
.coming-soon__icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.6;
}
.coming-soon__title {
    margin: 0 0 var(--space-sm);
    font-size: var(--font-size-xl);
    font-weight: 800;
    color: var(--blue-900);
}
.coming-soon__body {
    margin: 0 auto;
    max-width: 420px;
    color: var(--text-light);
}

/* =====================================================================
 * Phase B — Compose workshop UI
 * ===================================================================== */

/* ── Warn banner (locked 3-second warning above the scanner) ─────── */
.warn-banner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--red-50);
    color: var(--red);
    border: 2px solid var(--red);
    font-weight: 700;
    font-size: var(--font-size-sm);
}
.warn-banner__icon { font-size: 1.25rem; flex: none; }

/* ── Subject banner (shown above the 7 slots once a subject is set) */
.subject-banner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    background: var(--green-50);
    color: var(--green-900);
    border: 1.5px solid var(--green);
    font-weight: 700;
    font-size: var(--font-size-sm);
}

/* ── Card-active banner (below the scanner, tinted by family colour) */
.card-active-banner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--blue);
    background: var(--blue-50);
    color: var(--blue-900);
    font-weight: 700;
    font-size: var(--font-size-sm);
}
.card-active-banner.hide                { display: none; }
.card-active-banner--blue   { border-color: var(--blue);   background: var(--blue-50);   color: var(--blue-900);   }
.card-active-banner--green  { border-color: var(--green);  background: var(--green-50);  color: var(--green-900);  }
.card-active-banner--orange { border-color: var(--orange); background: var(--orange-50); color: var(--orange-900); }
.card-active-banner--purple { border-color: var(--purple); background: var(--purple-50); color: var(--purple-900); }

/* ── Scanner ──────────────────────────────────────────────────────── */
.scanner__viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    max-height: 60vh;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #1a1a18;
}
.scanner__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}
.scanner__cam-off {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    color: #cfcdc4;
    font-size: var(--font-size-sm);
    font-weight: 700;
}
.scanner__cam-icon { font-size: 2rem; opacity: 0.7; }
.scanner__viewfinder {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.scanner__frame {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 90%;
    border: 2.5px solid rgba(255, 255, 255, 0.92);
    border-radius: var(--radius-md);
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.30);
}
.scanner__hint {
    /* Moved to the top so it clears the shutter button at the bottom centre. */
    position: absolute;
    left: 50%;
    top: 8px;
    transform: translateX(-50%);
    color: #fff;
    font-size: var(--font-size-xs);
    background: rgba(0, 0, 0, 0.5);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    max-width: 80%;
    text-align: center;
}

/* Manual-capture shutter button — overlaid on the live preview, bottom centre.
   One tap decodes a single frame (see QRScanner._captureAndScan). */
.scanner__capture {
    position: absolute;
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    width: 64px;
    height: 64px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    background: var(--primary, #185FA5);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    z-index: 4;
    transition: transform 0.08s ease, background 0.15s ease;
}
.scanner__capture:hover { background: var(--primary-dark, #042C53); }
.scanner__capture:active { transform: translateX(-50%) scale(0.93); }
.scanner__capture:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.85);
    outline-offset: 2px;
}
.scanner__capture--busy {
    opacity: 0.6;
    cursor: progress;
}
.scanner__capture-icon { display: block; }
.scanner__badge {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: #fff;
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.55);
}
.scanner__badge--ok { background: rgba(35, 80, 10, 0.7); }
.scanner__badge-icon { font-size: 0.95rem; color: #8a8a86; }
.scanner__badge--ok .scanner__badge-icon { color: #7ED957; }
.scanner__lang-pill {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: #fff;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    background: rgba(83, 74, 183, 0.85);
}
.scanner__toast {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: #fff;
    font-size: var(--font-size-xl);
    font-weight: 800;
    padding: 16px 28px;
    border-radius: var(--radius-md);
    opacity: 0;
    pointer-events: none;
    background: rgba(57, 109, 17, 0.94);
}
.scanner__toast--deja   { background: rgba(95, 94, 90, 0.92); }
.scanner__toast--alerte { background: rgba(163, 45, 45, 0.94); }
.scanner__toast--info   { background: rgba(57, 109, 17, 0.94); }
.scanner__toast-icon    { font-size: 1.4rem; }
@keyframes scanner-toast-pop {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
    7%   { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
    14%  {            transform: translate(-50%, -50%) scale(1); }
    88%  { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1); }
}
.scanner__toast.show { animation: scanner-toast-pop 2.5s ease-out forwards; }

.scanner__controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}
.scanner__controls .btn { flex: 1 1 auto; min-width: 120px; }
.scanner__status {
    margin: var(--space-sm) 0 0;
    font-size: var(--font-size-xs);
    color: var(--text-light);
    font-style: italic;
}

/* ── Slots & chips ────────────────────────────────────────────────── */
.slots {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.slot {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 2px dashed var(--border);
    background: var(--gray-50);
}
.slot--filled { border-style: solid; }
.slot__letter {
    flex: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: var(--font-size-xl);
}
.slot__body { flex: 1; min-width: 0; }
.slot__name {
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.slot__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.slot__empty {
    font-size: var(--font-size-sm);
    color: var(--text-light);
    font-style: italic;
    margin-top: 2px;
}
.slot__hint {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
    font-size: var(--font-size-xs);
    color: var(--text-light);
    margin-top: 1px;
}
.slot__hint-ex { font-style: italic; opacity: 0.85; }   /* short example, to the right */
.slot__touch {
    width: 100%;
    font: inherit;
    font-size: var(--font-size-sm);
    color: var(--text);
    background: var(--bg-card);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 9px;
    margin-top: 6px;
    resize: vertical;          /* it's a <textarea> now */
    min-height: 2.6em;
    line-height: 1.4;
}
.slot__touch:focus {
    outline: none;
    border-style: solid;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-50);
}
.slot__touch::placeholder { color: var(--text-light); font-style: italic; }

/* Family colour variants */
.slot--blue   .slot__letter { background: var(--blue-50);   color: var(--blue);   }
.slot--blue.slot--filled    { border-color: var(--blue);   }
.slot--blue   .slot__name   { color: var(--blue);   }

.slot--green  .slot__letter { background: var(--green-50);  color: var(--green);  }
.slot--green.slot--filled   { border-color: var(--green);  }
.slot--green  .slot__name   { color: var(--green);  }

.slot--orange .slot__letter { background: var(--orange-50); color: var(--orange); }
.slot--orange.slot--filled  { border-color: var(--orange); }
.slot--orange .slot__name   { color: var(--orange); }

.slot--purple .slot__letter { background: var(--purple-50); color: var(--purple); }
.slot--purple.slot--filled  { border-color: var(--purple); }
.slot--purple .slot__name   { color: var(--purple); }

/* Flash animation when a fresh strip lands. */
@keyframes slot-flash-pulse {
    0%   { box-shadow: 0 0 0 0   rgba(24, 95, 165, 0.5); }
    70%  { box-shadow: 0 0 0 12px rgba(24, 95, 165, 0); }
    100% { box-shadow: 0 0 0 0   rgba(24, 95, 165, 0); }
}
.slot--flash { animation: slot-flash-pulse 1.1s ease-out 2; }

/* Chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    padding: 3px 4px 3px 11px;
    font-size: var(--font-size-sm);
}
.chip__text { color: var(--text); }
.chip__remove {
    flex: none;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: var(--gray-50);
    color: var(--text-light);
    font-size: var(--font-size-base);
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-width: 0;
}
.chip__remove:hover { background: var(--red-50); color: var(--red); }

/* ── Per-card personal touch (typed or dictated) ──────────────────── */
/* A discreet complement to the scanned strips: the dashed input signals
   "optional add-on", the small mic offers voice dictation. */
.slot__touch-wrap { margin-top: 6px; }
.slot__touch-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
}
.slot__touch-row .slot__touch { flex: 1; margin-top: 0; }   /* override stand-alone margin */

/* Small, low-emphasis mic so the strips stay the visual focus. */
.slot__mic {
    flex: 0 0 auto;
    width: 34px;
    border: 1.5px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 0.95rem;
    line-height: 1;
    color: var(--text-light);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.slot__mic:hover { border-color: var(--blue); color: var(--text); }
.slot__mic--on {
    background: var(--red);
    border-color: var(--red);
    border-style: solid;
    color: #fff;
    animation: mic-pulse 1.1s ease-in-out infinite;
}
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.5); }
    50%      { box-shadow: 0 0 0 5px rgba(220, 53, 69, 0); }
}
.slot__touch-hint {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    min-height: 0;
}
.slot__touch-hint--on:not(:empty),
.slot__touch-hint--err:not(:empty) { margin-top: 3px; }
.slot__touch-hint--on  { color: var(--red); }
.slot__touch-hint--err { color: var(--red); }

/* ── Final prompt block ───────────────────────────────────────────── */
.final-prompt {
    margin-top: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--blue-50);
    border: 1.5px solid var(--blue);
    font-size: var(--font-size-base);
    color: var(--blue-900);
    min-height: 48px;
    line-height: 1.6;
}
.final-prompt__placeholder { color: var(--text-light); font-style: italic; }

/* Structured, sectioned layout — one tinted heading + text per component. */
.final-prompt--structured { padding: var(--space-sm) var(--space-md); }
.final-prompt__section {
    padding: 6px 0 8px var(--space-md);
    border-left: 3px solid var(--gray-border, var(--border));
}
.final-prompt__section + .final-prompt__section { margin-top: var(--space-sm); }
.final-prompt__section--blue   { border-left-color: var(--blue);   }
.final-prompt__section--green  { border-left-color: var(--green);  }
.final-prompt__section--orange { border-left-color: var(--orange); }
.final-prompt__section--purple { border-left-color: var(--purple); }
.final-prompt__h {
    font-size: var(--font-size-sm);
    font-weight: 700;
    letter-spacing: 0.01em;
    margin-bottom: 2px;
    color: var(--blue-900);
}
.final-prompt__section--green  .final-prompt__h { color: var(--green); }
.final-prompt__section--orange .final-prompt__h { color: var(--orange); }
.final-prompt__section--purple .final-prompt__h { color: var(--purple); }
.final-prompt__t {
    color: var(--text);
    line-height: 1.5;
    white-space: pre-wrap;
}

/* "Reset all" row */
.reset-row { margin-top: var(--space-sm); }
.reset-row .btn { width: 100%; }

/* Inline confirmation — replaces a native confirm() popup, in place. */
.confirm-inline {
    padding: var(--space-sm) var(--space-md);
    border: 1.5px solid var(--red);
    border-radius: var(--radius-md);
    background: var(--red-50);
}
.confirm-inline__q {
    margin: 0 0 var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text);
    white-space: pre-line;       /* honour the line break in the warning */
}
.confirm-inline__actions {
    display: flex;
    gap: var(--space-sm);
}
.confirm-inline__actions .btn {
    flex: 1 1 auto;
    width: auto;                 /* override .reset-row .btn { width: 100% } */
}

/* ── Dialogs (Consent + Resume + future) ─────────────────────────── */
.dialog {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    background: rgba(0, 0, 0, 0.45);
}
.dialog__card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}
.dialog__title {
    margin: 0 0 var(--space-sm);
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: var(--blue-900);
}
.dialog__question {
    margin: 0 0 var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text);
    line-height: 1.5;
}
.dialog__buttons {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}
.dialog__buttons .btn { flex: 1 1 auto; }

/* ── Dimension bars (review panel) ────────────────────────────────── */
.dims { display: flex; flex-direction: column; gap: var(--space-sm); margin-top: var(--space-md); }
.dim-row__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: var(--font-size-xs);
    margin-bottom: 4px;
}
.dim-row__name { font-weight: 700; }
.dim-row__val  { font-weight: 800; }
.dim-row__bar {
    height: 13px;
    background: var(--border);
    border-radius: 7px;
    overflow: hidden;
}
.dim-row__bar > div {
    height: 100%;
    width: 0%;
    border-radius: 7px;
    transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ── Global score number ──────────────────────────────────────────── */
.score-global {
    text-align: center;
    margin-bottom: var(--space-md);
}
.score-global__value {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1;
}
.score-global__label {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Review block ─────────────────────────────────────────────────── */
.review {
    margin-top: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--blue-50);
    border: 1.5px solid var(--blue);
}
.review__head {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 800;
    color: var(--blue-900);
    margin-bottom: var(--space-sm);
}
.review__title { font-weight: 800; }
.review__source { margin-left: auto; }
.review__body { font-size: var(--font-size-sm); color: var(--text); line-height: 1.6; }
.review__body ul { margin: var(--space-sm) 0 0 var(--space-md); }
.review__body li { margin-bottom: 4px; }
.review__placeholder { color: var(--text-light); font-style: italic; }

/* Model "ideal prompt" example at the end of the analysis. */
.review__example {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-left: 3px solid var(--purple);
    background: var(--gray-50);
    border-radius: var(--radius-sm);
}
.review__example-title {
    font-weight: 700;
    color: var(--purple);
    margin-bottom: 4px;
}
.review__example-body {
    white-space: pre-wrap;
    line-height: 1.5;
    color: var(--text);
}

/* ── Generic top-of-screen toast (Toast.js — non-scanner contexts) ─ */
.toast {
    position: fixed;
    top: calc(var(--header-height) + var(--space-sm));
    left: 50%;
    transform: translateX(-50%) translateY(-150%);
    z-index: var(--z-toast);
    padding: 10px 16px;
    border-radius: var(--radius-pill);
    background: var(--blue-900);
    color: #fff;
    font-size: var(--font-size-sm);
    font-weight: 700;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal);
    pointer-events: none;
}
.toast.show     { transform: translateX(-50%) translateY(0); }
.toast--ok      { background: var(--green-900); }
.toast--error   { background: var(--red); }
.toast--info    { background: var(--blue-900); }

/* ── Forms (Contact page) ─────────────────────────────────────────── */
.contact-form { display: flex; flex-direction: column; gap: var(--space-sm); }
.form-label {
    margin-top: var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--blue-900);
}
.form-input, .form-textarea {
    font: inherit;
    font-size: var(--font-size-sm);
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    width: 100%;
    box-sizing: border-box;
}
.form-input:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-50);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-hint {
    margin: 4px 0 0;
    font-size: var(--font-size-xs);
    color: var(--text-light);
}
.form-counter {
    text-align: right;
    font-size: var(--font-size-xs);
    color: var(--text-light);
    margin-top: 2px;
}
.form-banner {
    margin-top: var(--space-md);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 600;
}
.form-banner.hide    { display: none; }
.form-banner--ok     { background: var(--green-50); color: var(--green-900); border: 1.5px solid var(--green); }
.form-banner--error  { background: var(--red-50);   color: var(--red);       border: 1.5px solid var(--red);   }

/* Pill button group (radio-group look) */
.pill-group { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-btn {
    font: inherit;
    font-size: var(--font-size-sm);
    font-weight: 600;
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--bg-card);
    color: var(--text-light);
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast),
                color var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}
.pill-btn:hover { background: var(--blue-50); color: var(--blue); border-color: var(--blue); }
.pill-btn--active {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
}
.pill-btn--active:hover { background: var(--blue-900); border-color: var(--blue-900); color: #fff; }

/* ── Create section (image generation) ───────────────────────────── */
.cmp-fields {
    display: grid;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.cmp-field {
    padding-left: var(--space-sm);
    border-left: 4px solid var(--gray-border);
}
.cmp-field--blue   { border-left-color: var(--blue);   }
.cmp-field--green  { border-left-color: var(--green);  }
.cmp-field--orange { border-left-color: var(--orange); }
.cmp-field--purple { border-left-color: var(--purple); }
.cmp-field__head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin-bottom: 4px;
}
.cmp-field__name {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text);
}
.cmp-field__row {
    display: flex;
    align-items: stretch;
    gap: 6px;
}
.cmp-field__input {
    flex: 1;
    width: 100%;
    font: inherit;
    font-size: var(--font-size-base);
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 9px;
    resize: vertical;
    min-height: 2.6em;
    line-height: 1.4;
}
.cmp-field__input:focus { outline: 2px solid var(--blue); border-color: var(--blue); }

.prompt-preview {
    background: var(--gray-50);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    font-style: italic;
    color: var(--text);
    min-height: 2.5em;
}
.prompt-preview--empty { color: var(--text-light); }

.gen-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
}
.gen-quota {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-light);
}
.gen-status {
    margin-top: var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text-light);
    min-height: 1.2em;
}
.gen-figure {
    margin: var(--space-md) 0 0;
    text-align: center;
}
.gen-image {
    width: 100%;
    max-width: 420px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    background: var(--gray-50);
}
.gen-caption {
    margin-top: var(--space-xs);
    font-size: var(--font-size-xs);
    color: var(--text-light);
}

/* Discreet facilitator-only quota reset. */
.gen-reset {
    margin-top: var(--space-md);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}
.gen-reset__link {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    text-decoration: none;
    opacity: 0.6;
}
.gen-reset__link:hover { opacity: 1; }
.gen-reset__form {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}
.gen-reset__input {
    width: 9em;
    letter-spacing: 0.3em;
    text-align: center;
}
.gen-reset__ok { padding: 4px 12px; font-size: var(--font-size-sm); }
.gen-reset__msg {
    font-size: var(--font-size-xs);
    color: var(--red);
}
.gen-reset__msg--ok { color: var(--green); }

/* ── Estimated environmental footprint card (Compose) ─────────────── */
.eco-card { border-left: 4px solid var(--green); }
.eco-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
}
.eco-card__title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--text);
}
.eco-help-btn {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--bg-card);
    color: var(--text-light);
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}
.eco-help-btn:hover { border-color: var(--green); color: var(--green); }

.eco-table {
    width: 100%;
    margin-top: var(--space-md);
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}
.eco-table th,
.eco-table td {
    padding: 6px 4px;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.eco-table thead th {
    font-size: var(--font-size-xs);
    color: var(--text-light);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.eco-table tbody th {
    text-align: left;
    font-weight: 600;
    color: var(--text);
}
.eco-table thead th:first-child,
.eco-table tbody th { white-space: normal; }
.eco-table__total th,
.eco-table__total td {
    border-top: 1.5px solid var(--border);
    font-weight: 700;
    color: var(--green);
}
.eco-caption {
    margin-top: 4px;
    font-size: var(--font-size-xs);
    font-style: italic;
    color: var(--text-light);
}
/* Everyday-life analogy — the last block of the eco card. Slightly more
   visible than the caption: these are the lines participants should
   remember. One example per line; the examples indent under the intro. */
.eco-analogy {
    margin: var(--space-sm) 0 0;
    font-size: var(--font-size-sm);
    color: var(--text);
}
.eco-analogy > div + div {
    margin-top: 2px;
    padding-left: var(--space-md);
}

/* ── Survey (workshop evaluation) ──────────────────────────────────── */
.rating-q { margin-bottom: var(--space-md); }
.rating-q__label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}
.rating-row {
    display: flex;
    gap: var(--space-sm);
}
.rating-btn {
    width: 52px;
    height: 52px;
    font-size: 1.55rem;
    line-height: 1;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast),
                background var(--transition-fast);
}
.rating-btn:hover { border-color: var(--primary); }
.rating-btn[aria-checked="true"] {
    border-color: var(--primary);
    background: var(--blue-50);
    transform: scale(1.12);
}
.rating-scale {
    margin: calc(-1 * var(--space-xs)) 0 var(--space-md);
    font-size: var(--font-size-xs);
    font-style: italic;
    color: var(--text-light);
}
.survey-workshop { max-width: 220px; }
.survey-thanks__msg {
    font-size: var(--font-size-lg);
    font-weight: 600;
    text-align: center;
}
@media (max-width: 380px) {
    .rating-btn { width: 44px; height: 44px; font-size: 1.3rem; }
}

/* ── Learn articles — small decorative illustrations ──────────────── */
/* Language-neutral inline SVGs (numbers, letters and symbols only), so
   one image serves FR/EN/DE/IT. Colors come from the design tokens. */
.learn-illu {
    margin: 0 auto var(--space-md);
    max-width: 420px;
}
.learn-illu--wide { max-width: 560px; }
.learn-illu svg   { display: block; width: 100%; height: auto; }

.eco-help {
    margin-top: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    background: var(--gray-50);
    border: 1px solid var(--border);
    font-size: var(--font-size-sm);
    color: var(--text);
    line-height: 1.5;
}
.eco-help__intro { margin: 0 0 var(--space-sm); }
.eco-help__subtitle {
    font-weight: 700;
    margin-top: var(--space-sm);
    margin-bottom: 4px;
}
.eco-help__values,
.eco-help__sources {
    margin: 0;
    padding-left: 1.2em;
}
.eco-help__values li,
.eco-help__sources li { margin: 2px 0; }
.eco-help__sources a { color: var(--blue); word-break: break-word; }
.eco-help__caveat {
    margin: var(--space-sm) 0 0;
    font-size: var(--font-size-xs);
    font-style: italic;
    color: var(--text-light);
}

/* ── "Send your prompt to the AI" card (Compose) ──────────────────── */
.send-controls {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-top: var(--space-sm);
}
.send-answer {
    margin-top: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    overflow: hidden;
}
.send-answer__head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: var(--space-sm) var(--space-md);
    background: var(--blue-50);
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    color: var(--blue-900);
}
.send-answer__body {
    padding: var(--space-md);
    line-height: 1.55;
    color: var(--text);
    /* Was pre-wrap for raw text; the answer is now rendered Markdown, so the
       block elements handle spacing (code blocks keep their own pre-wrap). */
    max-height: 360px;
    overflow-y: auto;
    overflow-wrap: anywhere;
}

/* ── Rendered Markdown (AI answers) — safe vanilla renderer output ──── */
.md-p { margin: 0 0 var(--space-sm); }
.md-p:last-child { margin-bottom: 0; }
.md-h {
    margin: var(--space-md) 0 var(--space-xs);
    line-height: 1.25;
    color: var(--blue-900);
}
.md-h:first-child { margin-top: 0; }
.md-ul, .md-ol { margin: 0 0 var(--space-sm); padding-left: 1.4em; }
.md-ul li, .md-ol li { margin: 2px 0; }
.md-quote {
    margin: 0 0 var(--space-sm);
    padding: 2px 0 2px var(--space-md);
    border-left: 3px solid var(--gray-border);
    color: var(--text-light);
}
.md-hr { border: 0; border-top: 1px solid var(--gray-border); margin: var(--space-md) 0; }
.send-answer__body code {
    background: rgba(0, 0, 0, 0.06);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 0.92em;
}
.md-pre {
    margin: 0 0 var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--blue-900);
    color: #EDE9E1;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre;
}
.md-pre code { background: none; padding: 0; color: inherit; }
.send-answer__body a { color: var(--blue); }

/* Inline consent mini-form (replaces the modal) — appears by the trigger. */
.inline-consent {
    flex-basis: 100%;            /* take its own line inside a flex button row */
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border: 1.5px solid var(--blue);
    border-radius: var(--radius-md);
    background: var(--blue-50);
}
.inline-consent__q {
    margin: 0 0 var(--space-sm);
    font-size: var(--font-size-sm);
    color: var(--text);
}
.inline-consent__actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}
.inline-consent__actions .btn { flex: 1 1 auto; width: auto; }

/* ── Save image to gallery (Create) ──────────────────────────────── */
.gallery-save {
    margin-top: var(--space-md);
    padding: var(--space-md);
    border: 1.5px solid var(--green);
    border-radius: var(--radius-md);
    background: var(--green-50, var(--gray-50));
}
.gallery-save__title { margin: 0 0 4px; font-size: var(--font-size-base); color: var(--text); }
.gallery-save__desc  { margin: 0 0 var(--space-sm); font-size: var(--font-size-sm); color: var(--text-light); }
.gallery-save__row {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    flex-wrap: wrap;
    margin-top: var(--space-sm);
}
.gallery-save__row .form-input { flex: 1 1 12em; }
.gallery-save__select { flex: 0 0 auto; }
.gallery-save__msg { font-size: var(--font-size-sm); color: var(--text-light); }
.gallery-save__msg--ok  { color: var(--green); font-weight: 600; }
.gallery-save__msg--err { color: var(--red); }

/* ── Stage gallery page ──────────────────────────────────────────── */
.gallery-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}
.gallery-bar__group { display: inline-flex; align-items: center; gap: var(--space-sm); }
.gallery-bar__count { font-size: var(--font-size-sm); color: var(--text-light); margin-left: auto; }
.gallery-empty { color: var(--text-light); font-style: italic; }

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-md);
}
.gallery-card {
    position: relative;          /* anchor for the delete button + confirm overlay */
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-card);
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.12s;
}
.gallery-card:hover, .gallery-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    outline: none;
}
.gallery-card__img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.gallery-card__cap {
    padding: 6px 8px;
    font-size: var(--font-size-xs);
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Moderation: delete button + inline confirm overlay. */
.gallery-card__del {
    position: absolute;
    top: 6px; right: 6px;
    width: 30px; height: 30px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s;
}
.gallery-card:hover .gallery-card__del,
.gallery-card:focus-within .gallery-card__del { opacity: 1; }
.gallery-card__del:hover { background: var(--red); }
.gallery-card__confirm {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    text-align: center;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: var(--font-size-sm);
}
.gallery-card__confirm-actions { display: flex; gap: var(--space-sm); }
.gallery-card__confirm-actions .btn { width: auto; }

/* Full-screen slideshow overlay */
.slideshow {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-md);
}
.slideshow__figure { margin: 0; text-align: center; max-height: 80vh; }
.slideshow__img {
    max-width: 92vw;
    max-height: 74vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}
.slideshow__cap { margin-top: var(--space-sm); color: #fff; font-size: var(--font-size-lg, 1.1rem); }
.slideshow__nav { display: flex; gap: var(--space-md); align-items: center; }
.slideshow__btn {
    font-size: 1.6rem;
    line-height: 1;
    width: 52px; height: 52px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
}
.slideshow__btn:hover { background: rgba(255, 255, 255, 0.22); }
.slideshow__close {
    position: absolute;
    top: var(--space-md); right: var(--space-md);
    width: 44px; height: 44px;
    font-size: 1.6rem; line-height: 1;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
}
/* Projection mode: a full-screen grid of all the workshop's images. */
.projection {
    position: fixed;
    inset: 0;
    z-index: 2100;
    background: #000;
    cursor: none;
    padding: 10px;
}
.projection__grid {
    display: grid;
    width: 100%;
    height: 100%;
    gap: 10px;
    grid-template-columns: repeat(var(--cols, 4), 1fr);
    grid-auto-rows: 1fr;
}
.proj-card {
    position: relative;
    min-width: 0;
    min-height: 0;
}
.proj-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}
.proj-card__cap {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 14px 8px 6px;
    border-radius: 0 0 6px 6px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: clamp(0.6rem, 1.3vw, 1.05rem);
    line-height: 1.25;
}
.proj-card__who {
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.proj-card__subj {
    opacity: 0.92;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Controls row (rules toggle + export button) ───────────────────── */
.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.controls-row .info-toggle {
    flex-shrink: 0;
}

.controls-row .btn {
    flex-shrink: 0;
}

/* ── Save indicator ─────────────────────────────────────────────────── */
.save-indicator {
    position: fixed;
    top: 72px;
    right: var(--space-lg);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: 500;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
    z-index: var(--z-toast);
}

.save-indicator--saving {
    opacity: 1;
    color: var(--blue);
}

.save-indicator--saved {
    opacity: 1;
    color: var(--green-900);
}

.save-indicator--idle {
    opacity: 0;
}

/* =====================================================================
 * Mobile responsiveness — small-screen polish (phones)
 *
 * The base styles above are mobile-first; these tweaks tighten spacing,
 * stop iOS Safari from zooming when a form control gains focus (any
 * control under 16px triggers it), and keep dense UI within the viewport.
 * ===================================================================== */
@media (max-width: 599px) {
    /* iOS focus-zoom guard: every text-entry control must be ≥16px. */
    input, select, textarea { font-size: 16px; }
    .form-input, .form-textarea, .slot__touch, .cmp-field__input,
    .gen-reset__input, .gallery-save__select { font-size: 16px; }

    /* Panels reclaim horizontal room on narrow screens. */
    .panel { padding: var(--space-md); }

    /* Hero spacing tightens; the title size is handled by the fluid 3xl token. */
    .hero { margin: var(--space-sm) 0 var(--space-lg); }

    /* Section-card tiles: keep two columns, but more compact. */
    .section-cards { gap: var(--space-sm); }
    .section-card__image { height: 84px; font-size: 2rem; }
    .section-card__body { padding: var(--space-sm) var(--space-md); }

    /* Eco footprint table shrinks so its numeric columns fit. */
    .eco-table { font-size: var(--font-size-xs); }
    .eco-table th, .eco-table td { padding: 5px 3px; }

    /* Gallery: two tiles per row on phones (was 1 at the 180px min). */
    .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }

    /* Modals use a little less padding so the card takes the width. */
    .dialog { padding: var(--space-md); }

    /* Slideshow controls stay comfortable on small screens. */
    .slideshow__btn { width: 46px; height: 46px; font-size: 1.4rem; }
    .slideshow__close { width: 40px; height: 40px; }
}

/* Very small phones (≤360px): keep the 6-tab footer + header legible. */
@media (max-width: 360px) {
    .app-footer__item  { padding: var(--space-xs) 0; gap: 1px; }
    .app-footer__icon  { font-size: 1.05rem; }
    .app-footer__label { font-size: 0.55rem; max-width: 52px; }
    /* Free a little header room for the brand. */
    .lang-pill { min-width: 32px; padding: 5px 7px; }
}

/* ── Generic helpers ─────────────────────────────────────────────── */
.hide { display: none !important; }
.center-text { text-align: center; }
