/* Alloy — kiosk UI (same design language as Tiny Concepts), Apple Intelligence aesthetic.
   Scales proportionally on all 16:9 resolutions: 1rem = 16px at 1920px wide,
   everything is sized in rem/vh so 720p, 1080p, 1440p and 4K render identically. */

:root {
    --bg:         #f5f5f7;
    --surface:    #ffffff;
    --border:     rgba(0,0,0,0.08);
    --border-med: rgba(0,0,0,0.14);
    --ink:        #1d1d1f;
    --ink-2:      #48484a;
    --ink-3:      #86868b;
    --accent:     #6e3df3;
    --accent-2:   #5a2fd4;
    --accent-bg:  #f2eefe;
    --green:      #34c759;
    --red:        #ff3b30;
    --radius-sm:  0.75rem;
    --radius:     1.125rem;
    --radius-lg:  1.625rem;
    --shadow-sm:  0 0.125rem 0.5rem rgba(0,0,0,0.07);
    --shadow:     0 0.5rem 2rem rgba(0,0,0,0.10);
    --shadow-lg:  0 1.25rem 3.75rem rgba(0,0,0,0.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

/* Vloeiende cross-fade tussen pagina's (Chrome view transitions) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation-duration: 0.4s; }
::view-transition-new(root) { animation-duration: 0.55s; }

html {
    /* 16px on a 1920x1080 kiosk. Scales with whichever is tighter — width or
       height — so the 16:9 layout always fits, on a short laptop window too.
       Portrait screens and phones get their own layout (end of this file). */
    font-size: clamp(7px, min(0.83333vw, 1.48148vh), 36px);
}

html, body {
    height: 100%;
    font-family: -apple-system, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* ---- Shell ------------------------------------------------------------ */

.kiosk {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* ---- Top bar ---------------------------------------------------------- */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 3.75rem;
    height: 5.5rem;
    background: rgba(245,245,247,0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.brand {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.brand-icon {
    width: 2.25rem;
    height: 2.25rem;
    background: var(--ink);
    border-radius: 0.625rem;
    display: grid;
    place-items: center;
}
.brand-icon svg { width: 1.375rem; height: 1.375rem; color: #fff; }

.home-btn {
    width: 3.25rem; height: 3.25rem;
    border-radius: 50%;
    background: var(--surface);
    color: var(--ink-2);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: transform 0.15s, background 0.15s;
}
.home-btn svg { width: 1.375rem; height: 1.375rem; }
.home-btn:active { transform: scale(0.9); background: var(--bg); }

.lang-switch { display: flex; gap: 0.5rem; }
.lang-btn {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.625rem 1.125rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--ink-2);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.lang-btn .flag { width: 1.625rem; height: 1.0625rem; border-radius: 0.25rem; overflow: hidden; }
.lang-btn.active { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.lang-btn:active { transform: scale(0.95); }

/* ---- Stage ------------------------------------------------------------ */

.stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    padding: 3rem 4.5rem 0;
    min-height: 0;
    /* If content still does not fit, scroll instead of overlapping. */
    overflow-y: auto;
    overflow-x: hidden;
}

.page-heading {
    font-size: 3.25rem;
    font-weight: 700;
    letter-spacing: -0.028em;
    text-align: center;
    line-height: 1.1;
    margin-bottom: 0.625rem;
}

.page-sub {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--ink-3);
    text-align: center;
    margin-bottom: 2rem;
    letter-spacing: -0.01em;
}

.page-text {
    font-size: 1.25rem;
    color: var(--ink-3);
    text-align: center;
    line-height: 1.6;
    max-width: 47.5rem;
    letter-spacing: -0.01em;
}

/* ---- Buttons ---------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    border: none;
    border-radius: 999px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    letter-spacing: -0.01em;
    transition: transform 0.15s, opacity 0.15s, background 0.15s;
}

.btn-big {
    font-size: 1.125rem;
    padding: 0 2.25rem;
    height: 3.75rem;
    min-width: 10rem;
}

.btn .icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }

.btn-primary {
    background: var(--ink);
    color: #fff;
}
.btn-primary:active { transform: scale(0.96); opacity: 0.9; }

.btn-secondary {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border-med);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:active { transform: scale(0.96); }

.btn:disabled { opacity: 0.35; cursor: default; pointer-events: none; }

/* ---- Bottom bar ------------------------------------------------------- */

.bottombar {
    padding: 2.25rem 4.5rem 2.5rem;
    flex-shrink: 0;
}

.nav-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.nav-center { justify-content: center; }

/* ---- Start page ------------------------------------------------------- */

.start-page {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fade-up 0.5s ease both;
}

.start-page .page-heading { font-size: 4.5rem; letter-spacing: -0.005em; word-spacing: 0.08em; margin-bottom: 2rem; }
.start-heading { font-size: 2rem; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 0.75rem; }

.start-eyebrow {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.11em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
}

.start-text { margin: 0 auto; max-width: 42.5rem; }

@keyframes fade-up {
    from { opacity: 0; transform: translateY(1.25rem); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Choice cards ----------------------------------------------------- */

#choice-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    flex: 1;
    min-height: 0;
}

.card-grid {
    display: grid;
    gap: 1rem;
    width: 100%;
    flex: 1;
    min-height: 0;
    grid-auto-rows: min-content;
    justify-content: center;
    align-content: center;
    margin-bottom: 1.25rem;
    animation: fade-up 0.4s ease both;
}

/* Square image frames. The cell side is the column width and the image height,
   so the picture area is always a perfect square. It is bounded by viewport
   height (vh) so every row — plus its label — fits on a widescreen kiosk, and
   by rem so the cards never grow absurdly large on tall screens. The grid only
   gets ~62vh of height (heading, sub and nav take the rest), so for the 3-row
   style grid each cell stays ~15vh. */
.grid-4 {
    grid-template-columns: repeat(4, var(--cell));
    --cell: min(18rem, 15vh);
}
.grid-3 {
    grid-template-columns: repeat(3, var(--cell));
    --cell: min(24rem, 32vh);
}

.choice-card {
    position: relative;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: inherit;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.choice-card img {
    width: var(--cell);
    height: var(--cell);
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.card-label { flex-shrink: 0; }

.card-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink);
    padding: 0.75rem 0.875rem;
    text-align: center;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.choice-card:active { transform: scale(0.97); }

.choice-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.1875rem var(--accent-bg), var(--shadow);
    transform: translateY(-0.1875rem);
}

.card-check {
    position: absolute;
    top: 0.75rem; right: 0.75rem;
    width: 2.125rem; height: 2.125rem;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.card-check svg { width: 1.125rem; height: 1.125rem; }
.choice-card.selected .card-check { opacity: 1; transform: scale(1); }

/* ---- Toast ------------------------------------------------------------ */

.toast {
    position: fixed;
    left: 50%;
    bottom: 8.75rem;
    transform: translate(-50%, 1rem);
    background: var(--ink);
    color: #fff;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.875rem 1.75rem;
    border-radius: 999px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
    z-index: 100;
    white-space: nowrap;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* Capture-waarschuwing ("nog geen foto") in het verticale midden, zodat hij
   de cameraknop onderin niet blokkeert. */
#capture-toast {
    top: 50%;
    bottom: auto;
    transform: translate(-50%, calc(-50% + 1rem));
}
#capture-toast.visible { transform: translate(-50%, -50%); }

/* ---- Capture page ----------------------------------------------------- */

.capture-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
}

.camera-frame {
    position: relative;
    height: min(40rem, 54vh);
    aspect-ratio: 2 / 3;
    border-radius: var(--radius-lg);
    background: #0a0a0a;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255,255,255,0.08);
}

.camera-frame video,
.camera-frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-message {
    color: rgba(255,255,255,0.6);
    font-size: 1rem;
    font-weight: 400;
    text-align: center;
    padding: 0 3rem;
    line-height: 1.5;
    position: relative;
}

@keyframes check-pop {
    from { transform: scale(0.3); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.capture-controls {
    display: flex;
    gap: 0.75rem;
}

.upload-label { cursor: pointer; }

/* ---- Generate page ---------------------------------------------------- */

.generate-page { text-align: center; }

/* Kunst-loader: een gradiënt-lichtspoor tekent doorlopend een portretlijst */
.art-loader {
    width: 12rem; height: 12rem;
    margin: 0 auto 2.5rem;
    animation: orb-breathe 3.4s ease-in-out infinite;
}

.art-loader svg { width: 100%; height: 100%; overflow: visible; }

.art-base, .art-figure {
    fill: none;
    stroke: rgba(0,0,0,0.09);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.art-figure {
    stroke-dasharray: 100;
    stroke-dashoffset: 0;
    animation: figure-pulse 4.2s ease-in-out infinite;
}

.art-trace {
    fill: none;
    stroke: url(#art-grad);
    stroke-width: 3.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 32 68;
    animation: art-trace 2.4s linear infinite;
}

.art-trace-glow {
    stroke-width: 7;
    filter: blur(0.4rem);
    opacity: 0.65;
}

@keyframes art-trace {
    from { stroke-dashoffset: 100; }
    to   { stroke-dashoffset: 0; }
}

@keyframes figure-pulse {
    0%, 100% { stroke: rgba(0,0,0,0.09); }
    50%      { stroke: rgba(177,109,255,0.45); }
}

@keyframes orb-breathe {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.04); }
}

.generate-text {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--ink-2);
    letter-spacing: -0.02em;
}

.generate-status {
    margin-top: 0.875rem;
    font-size: 1.0625rem;
    font-weight: 400;
    color: var(--ink-3);
    letter-spacing: -0.01em;
    min-height: 1.6em;
    opacity: 0;
    transform: translateY(0.25rem);
    transition: opacity 0.35s ease, transform 0.35s ease;
}
.generate-status.status-visible {
    opacity: 1;
    transform: translateY(0);
}

.dots span { animation: blink 1.4s infinite both; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0; } 40% { opacity: 1; } }

.error-badge {
    width: 4.5rem; height: 4.5rem;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    background: #fff0ef;
    color: var(--red);
    display: grid;
    place-items: center;
}
.error-badge svg { width: 2.25rem; height: 2.25rem; }
#generate-error .page-heading { font-size: 2.25rem; }
#generate-error .page-text { font-size: 1.125rem; }
#generate-error .nav-buttons { margin-top: 1.75rem; }

/* ---- Result page ------------------------------------------------------ */

.result-page {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5rem;
    width: 100%;
    max-width: 87.5rem;
    animation: fade-up 0.45s ease both;
}

.result-text-col {
    flex: 0 0 20rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
}
.result-text-col .page-heading { text-align: left; font-size: 2.75rem; }
.result-text-col .page-sub { text-align: left; margin-bottom: 0; font-size: 1.125rem; }

.result-image-col { flex: 0 0 auto; }

.result-image {
    height: min(52rem, 70vh);
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: block;
    background: var(--surface);
}

/* ---- Login -------------------------------------------------------------- */

.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
}

.login-form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 26rem;
    margin-top: 2.5rem;
    padding: 2.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    text-align: left;
}

.login-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink-2);
    margin: 0 0 0.5rem 0.25rem;
}

.login-input {
    font: inherit;
    font-size: 1.125rem;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--border-med);
    border-radius: var(--radius-sm);
    padding: 0.875rem 1rem;
    margin-bottom: 1.5rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.25rem var(--accent-bg);
}

.login-error {
    color: var(--red);
    font-size: 1rem;
    font-weight: 600;
    margin: -0.5rem 0 1rem;
    text-align: center;
}

.login-submit {
    justify-content: center;
    margin-top: 0.25rem;
}

/* ======================================================================
   Alloy additions — same tokens, radii and shadows as above.
   ====================================================================== */

/* Emotion colours: one hue per emotion, used by faces, bars and chips. */
[data-e="happy"]     { --emo: #ff9f0a; }
[data-e="surprised"] { --emo: #ff5fa2; }
[data-e="neutral"]   { --emo: #8e8e93; }
[data-e="sad"]       { --emo: #4d9dff; }
[data-e="angry"]     { --emo: #ff3b30; }
[data-e="fearful"]   { --emo: #8e5cff; }
[data-e="disgusted"] { --emo: #30c48d; }

.btn:disabled, .btn.disabled { opacity: 0.35; cursor: default; pointer-events: none; }

/* Primary call-to-action on the slider page gets the AI gradient glow. */
.btn-glow {
    position: relative;
    background: linear-gradient(120deg, #ff5fa2, #b16dff 35%, #4d9dff 70%, #3fd8d4);
    background-size: 200% 100%;
    animation: glow-shift 6s ease-in-out infinite;
    box-shadow: 0 0.5rem 1.75rem rgba(177,109,255,0.35);
}
@keyframes glow-shift { 0%, 100% { background-position: 0% 0; } 50% { background-position: 100% 0; } }

/* ---- Stepper in the top bar --------------------------------------------- */

.stepper {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}
.step {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--ink-3);
    letter-spacing: -0.01em;
}
.step + .step::before {
    content: "";
    width: 2.25rem;
    height: 2px;
    border-radius: 2px;
    background: var(--border-med);
    margin-right: 0.25rem;
}
.step.done + .step::before { background: var(--accent); }
.step-dot {
    width: 1.875rem; height: 1.875rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    background: var(--surface);
    border: 1.5px solid var(--border-med);
    color: var(--ink-3);
}
.step-dot svg { width: 0.9375rem; height: 0.9375rem; }
.step.done .step-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.current { color: var(--ink); font-weight: 600; }
.step.current .step-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 0.25rem var(--accent-bg); }

/* ---- Start: consent toggle ------------------------------------------- */

.start-page .start-text { margin-bottom: 3rem; }

.consent-card {
    width: min(50rem, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.75rem 2rem;
    text-align: left;
    animation: fade-up 0.5s 0.1s ease both;
}
.consent-row { display: flex; align-items: center; gap: 1.5rem; cursor: pointer; }
.consent-icon {
    flex-shrink: 0;
    width: 3.5rem; height: 3.5rem;
    border-radius: 1rem;
    background: var(--accent-bg);
    color: var(--accent);
    display: grid;
    place-items: center;
}
.consent-icon svg { width: 1.875rem; height: 1.875rem; }
.consent-text { flex: 1; display: flex; flex-direction: column; gap: 0.3rem; }
.consent-text strong { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.015em; }
.consent-text span { font-size: 1rem; color: var(--ink-3); line-height: 1.5; }

/* iOS-style switch, sized for touch */
.toggle { position: relative; flex-shrink: 0; }
.toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.toggle-track {
    display: block;
    width: 5rem; height: 3rem;
    border-radius: 999px;
    background: #e3e3e8;
    transition: background 0.25s ease;
    position: relative;
}
.toggle-thumb {
    position: absolute;
    top: 0.25rem; left: 0.25rem;
    width: 2.5rem; height: 2.5rem;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0.1875rem 0.5rem rgba(0,0,0,0.18);
    transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.toggle input:checked + .toggle-track { background: var(--green); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(2rem); }

/* ---- Style cards: portrait artwork frames ---------------------------- */

.grid-4.portrait {
    /* Two rows of four portrait cards must fit next to heading and nav. */
    --cell: min(14rem, 17vh);
    grid-template-columns: repeat(4, var(--cell));
    gap: 1rem 1.5rem;
}
.portrait .choice-card img { height: calc(var(--cell) * 1.333); }
.choice-card .card-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.625rem 0.75rem 0.75rem;
    font-size: 1rem;
}
.choice-card .card-label small {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--ink-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Capture: camera + AI panel side by side -------------------------- */

.stage:has(.capture-layout) .page-sub { margin-bottom: 1.5rem; }

.capture-layout {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 2.5rem;
    width: 100%;
    animation: fade-up 0.4s ease both;
}
.capture-col { display: flex; flex-direction: column; align-items: center; gap: 1.25rem; }

.camera-frame.mirror video { transform: scaleX(-1); }

.scan-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.scan-line {
    position: absolute;
    left: 0; right: 0;
    height: 18%;
    background: linear-gradient(180deg, rgba(177,109,255,0) 0%, rgba(177,109,255,0.28) 70%, rgba(63,216,212,0.9) 100%);
    border-bottom: 2px solid rgba(255,255,255,0.85);
    box-shadow: 0 0.5rem 1.5rem rgba(77,157,255,0.45);
    animation: scan 1.6s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
    pointer-events: none;
}
@keyframes scan { from { top: -18%; } to { top: 100%; } }

.countdown {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(0,0,0,0.22);
}
.countdown svg { position: absolute; width: 11rem; height: 11rem; transform: rotate(-90deg); }
.countdown-track { fill: rgba(0,0,0,0.25); stroke: rgba(255,255,255,0.25); stroke-width: 4; }
.countdown-ring {
    fill: none;
    stroke: #fff;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 0;
}
.countdown-ring.run { animation: ring 1s linear both; }
@keyframes ring { from { stroke-dashoffset: 0; } to { stroke-dashoffset: 100; } }
#countdown-number {
    position: relative;
    font-size: 6rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.04em;
    text-shadow: 0 0.25rem 1.5rem rgba(0,0,0,0.35);
}
#countdown-number.tick { animation: tick 1s ease both; }
@keyframes tick {
    0%   { transform: scale(1.6); opacity: 0; }
    20%  { transform: scale(1); opacity: 1; }
    85%  { opacity: 1; }
    100% { transform: scale(0.85); opacity: 0; }
}

.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.go { animation: flash 0.6s ease-out; }
@keyframes flash { from { opacity: 0.95; } to { opacity: 0; } }

/* AI panel */
.ai-panel {
    width: 34rem;
    height: calc(min(40rem, 54vh) + 5rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.75rem 2rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}
/* Gradient hairline at the top while the AI is working */
.ai-panel::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 0.25rem;
    background: linear-gradient(90deg, #ff5fa2, #b16dff, #4d9dff, #3fd8d4, #ff5fa2);
    background-size: 200% 100%;
    opacity: 0;
    transition: opacity 0.3s;
}
.ai-panel[data-state="analyze"]::before { opacity: 1; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 0 0; } to { background-position: -200% 0; } }

.ai-panel-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; flex-shrink: 0; }
.ai-spark {
    width: 2.5rem; height: 2.5rem;
    border-radius: 0.75rem;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(135deg, #ff5fa2, #b16dff 45%, #4d9dff);
}
.ai-spark svg { width: 1.5rem; height: 1.5rem; }
.ai-panel-title { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.015em; flex: 1; }
.ai-status {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-3);
    background: var(--bg);
    border-radius: 999px;
    padding: 0.375rem 0.875rem;
}
.ai-status:empty { display: none; }
.ai-panel[data-state="analyze"] .ai-status { color: var(--accent); background: var(--accent-bg); }
.ai-panel[data-state="noface"] .ai-status { color: var(--red); background: #fff0ef; }

.ai-view { display: none; flex: 1; min-height: 0; flex-direction: column; animation: fade-up 0.35s ease both; }
.ai-panel[data-state="loading"] .ai-view-idle,
.ai-panel[data-state="idle"] .ai-view-idle,
.ai-panel[data-state="countdown"] .ai-view-countdown,
.ai-panel[data-state="captured"] .ai-view-captured,
.ai-panel[data-state="analyze"] .ai-view-analyze,
.ai-panel[data-state="noface"] .ai-view-noface { display: flex; }

.ai-lead { font-size: 1.25rem; line-height: 1.55; color: var(--ink-2); letter-spacing: -0.01em; }
.ai-lead-big { font-size: 2rem; font-weight: 600; color: var(--ink); margin: auto 0; text-align: center; }
.ai-view-noface,
.ai-view-captured { align-items: center; justify-content: center; text-align: center; gap: 1.25rem; }
.captured-badge {
    width: 4.5rem; height: 4.5rem;
    border-radius: 50%;
    background: var(--green);
    color: #fff;
    display: grid;
    place-items: center;
    animation: check-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.captured-badge svg { width: 2.25rem; height: 2.25rem; }
.ai-view-captured .ai-lead-big { margin: 0; }
.ai-view-captured .ai-lead:not(.ai-lead-big) { margin-top: -0.75rem; }
.ai-view-noface .ai-lead { max-width: 24rem; }

.emotion-row {
    margin-top: auto;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}
.emotion-face { color: var(--emo); opacity: 0.85; animation: bob 3s ease-in-out infinite; }
.emotion-face:nth-child(2n) { animation-delay: -1.5s; }
.emotion-face svg { width: 100%; height: auto; display: block; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-0.375rem); } }

.ai-steps { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.25rem; }
.ai-steps li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    color: var(--ink-3);
    opacity: 0.45;
    transition: opacity 0.3s, color 0.3s;
}
.ai-step-icon {
    width: 1.5rem; height: 1.5rem;
    border-radius: 50%;
    border: 2px solid var(--border-med);
    display: grid;
    place-items: center;
    color: transparent;
    flex-shrink: 0;
    transition: background 0.25s, border-color 0.25s, color 0.25s;
}
.ai-step-icon svg { width: 0.875rem; height: 0.875rem; }
.ai-steps li.active { opacity: 1; color: var(--ink); font-weight: 500; }
.ai-steps li.active .ai-step-icon { border-color: var(--accent); border-right-color: transparent; animation: spin 0.8s linear infinite; }
.ai-steps li.done { opacity: 1; color: var(--ink-2); }
.ai-steps li.done .ai-step-icon { background: var(--accent); border-color: var(--accent); color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* When the verdict is in, the step list collapses to make room. */
.ai-verdict.visible ~ .emotion-bars { margin-top: 0; }
.ai-panel:has(.ai-verdict.visible) .ai-steps { display: none; }

.ai-verdict {
    display: none;
    align-items: center;
    gap: 1.125rem;
    margin-bottom: 1.25rem;
}
.ai-verdict.visible { display: flex; animation: check-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.verdict-face { width: 4.5rem; height: 4.5rem; color: var(--emo); flex-shrink: 0; }
.verdict-face svg { width: 100%; height: 100%; }
.verdict-text { display: flex; flex-direction: column; }
.verdict-text small { font-size: 0.875rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.verdict-text strong { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.verdict-conf { font-size: 1rem; color: var(--ink-3); }

.emotion-bars { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.emotion-bars li {
    display: grid;
    grid-template-columns: 1.5rem 7.5rem 1fr 3rem;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9375rem;
    color: var(--ink-2);
}
.bar-face { color: var(--emo); }
.bar-face svg { width: 1.5rem; height: 1.5rem; display: block; }
.bar-track { height: 0.5rem; border-radius: 999px; background: var(--bg); overflow: hidden; }
.bar-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--emo);
    opacity: 0.55;
    transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-value { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.emotion-bars li.top { font-weight: 600; color: var(--ink); }
.emotion-bars li.top .bar-fill { opacity: 1; }
.emotion-bars li.top .bar-value { color: var(--ink); }

.emotion-adjust { display: none; margin-top: auto; padding-top: 1rem; }
.emotion-adjust.visible { display: block; animation: fade-up 0.35s ease both; }
.emotion-adjust p { font-size: 0.9375rem; color: var(--ink-3); margin-bottom: 0.625rem; }
.emotion-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.emotion-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    height: 2.75rem;
    padding: 0 1rem 0 0.625rem;
    border-radius: 999px;
    border: 1.5px solid var(--border-med);
    background: var(--surface);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--ink-2);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.emotion-chip svg { width: 1.5rem; height: 1.5rem; color: var(--emo); }
.emotion-chip:active { transform: scale(0.95); }
.emotion-chip.selected {
    border-color: var(--emo);
    background: color-mix(in srgb, var(--emo) 12%, white);
    color: var(--ink);
    font-weight: 600;
}

/* ---- Sliders ---------------------------------------------------------- */

.choice-summary { display: flex; gap: 0.625rem; justify-content: center; flex-wrap: wrap; margin-bottom: 2rem; }
.choice-summary.left { justify-content: flex-start; margin-bottom: 0; }
.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    height: 2.5rem;
    padding: 0 1rem 0 0.375rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--ink-2);
}
.summary-pill:not(:has(img, .pill-face)) { padding-left: 1rem; }
.summary-pill img { width: 1.875rem; height: 1.875rem; border-radius: 50%; object-fit: cover; }
.pill-face { width: 1.875rem; height: 1.875rem; color: var(--emo); }
.pill-face svg { width: 100%; height: 100%; display: block; }

.tune-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    width: min(92rem, 100%);
    animation: fade-up 0.4s ease both;
}

.slider-card {
    --val: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 2rem 2.25rem 1.75rem;
}
.slider-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.slider-head h2 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.025em; }
.slider-badge {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-bg);
    border-radius: 999px;
    padding: 0.5rem 1.125rem;
}
.slider-badge.pop { animation: check-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

.slider-ends {
    display: flex;
    justify-content: space-between;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 0.75rem;
}

.range-wrap { position: relative; height: 4.5rem; }

/* Three stages divided in the background; the slider itself is gradual.
   The gradient fill runs up to the thumb; two notches split the track in thirds. */
.range-zones {
    position: absolute;
    left: 0; right: 0;
    top: 50%;
    height: 1rem;
    transform: translateY(-50%);
    border-radius: 999px;
    background:
        linear-gradient(90deg, #4d9dff, #b16dff 55%, #ff5fa2) 0 0 / var(--val) 100% no-repeat,
        var(--bg);
    box-shadow: inset 0 0 0 1px var(--border);
    pointer-events: none;
}
[data-slider="bizarre"] .range-zones {
    background:
        linear-gradient(90deg, #3fd8d4, #4d9dff 45%, #b16dff) 0 0 / var(--val) 100% no-repeat,
        var(--bg);
}
.range-zones span { position: absolute; top: -1px; bottom: -1px; width: 0.375rem; background: var(--surface); transform: translateX(-50%); }
.range-zones span:nth-child(1) { display: none; }
.range-zones span:nth-child(2) { left: 33.333%; }
.range-zones span:nth-child(3) { left: 66.666%; }

.range {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    margin: 0;
    cursor: pointer;
    touch-action: none;
}
.range:focus { outline: none; }
.range::-webkit-slider-runnable-track { height: 100%; background: transparent; }
.range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 4rem; height: 4rem;
    margin-top: 0.25rem;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 0.25rem 1rem rgba(0,0,0,0.18), 0 0 0 0.375rem rgba(177,109,255,0.18);
    transition: transform 0.15s;
}
.range:active::-webkit-slider-thumb { transform: scale(1.08); }
.range::-moz-range-track { background: transparent; }
.range::-moz-range-thumb {
    width: 4rem; height: 4rem;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: 0 0.25rem 1rem rgba(0,0,0,0.18), 0 0 0 0.375rem rgba(177,109,255,0.18);
}

.zone-labels {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}
.zone-labels li {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    opacity: 0.5;
}
.zone-labels li:nth-child(2) { text-align: center; }
.zone-labels li:nth-child(3) { text-align: right; }
.zone-labels strong { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; }
.zone-labels span { font-size: 0.875rem; color: var(--ink-3); }
.zone-labels li.active { opacity: 1; background: var(--accent-bg); }
.zone-labels li.active strong { color: var(--accent); }

/* ---- Generate: portrait frame loader ------------------------------------ */

.art-figure { stroke-dasharray: none; }

/* ---- Result ------------------------------------------------------------- */

.result-page { gap: 4.5rem; }
.result-text-col { flex: 0 0 30rem; gap: 1.5rem; }
.result-text-col .start-eyebrow { margin-bottom: -0.75rem; }
.result-reset { font-size: 0.875rem; color: var(--ink-3); }

.qr-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
    padding: 1.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.qr-code { width: 9.5rem; height: 9.5rem; flex-shrink: 0; padding: 0.5rem; background: #fff; border-radius: var(--radius-sm); }
.qr-code svg { width: 100%; height: 100%; display: block; }
.qr-text { display: flex; flex-direction: column; gap: 0.375rem; }
.qr-text strong { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.015em; }
.qr-text span { font-size: 1rem; color: var(--ink-3); line-height: 1.5; }

/* Language switch sits next to the home button on every screen. */
.topbar-right { display: flex; align-items: center; gap: 1rem; }

/* ---- Round 2 feedback ---------------------------------------------------- */

.lang-switch-off { visibility: hidden; }

/* Square cards: styles (5 per row) and Philips objects (6 per row). */
.square-grid {
    --cell: min(16.5rem, 24vh);
    --gap: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 1.25rem var(--gap);
    max-width: calc(5 * var(--cell) + 4 * var(--gap) + 3rem);
    margin: 0 auto 1rem;
    flex: 1;
    min-height: 0;
    animation: fade-up 0.4s ease both;
}
.square-grid .choice-card img { width: var(--cell); height: var(--cell); object-fit: cover; }
.square-grid .choice-card .card-label { display: block; font-size: 1.0625rem; padding: 0.75rem 0.875rem; }
.objects-grid {
    --cell: min(14rem, 21vh);
    max-width: calc(6 * var(--cell) + 5 * var(--gap) + 3rem);
}
.objects-grid .choice-card img { background: #fff; }
.choice-card.dimmed { opacity: 0.45; }
#objects-form { display: flex; flex-direction: column; align-items: center; width: 100%; flex: 1; min-height: 0; }
.objects-count { font-size: 1rem; font-weight: 600; color: var(--accent); margin-bottom: 0.5rem; }

/* Earlier choices stay visible — bigger icons. */
.summary-pill { height: 3.25rem; padding: 0 1.25rem 0 0.375rem; font-size: 1.0625rem; gap: 0.625rem; }
.summary-pill img { width: 2.5rem; height: 2.5rem; }
.pill-face { width: 2.5rem; height: 2.5rem; }

/* Sliders without the zone labels: a little more air. */
.slider-card { padding: 2rem 2.25rem 2.25rem; }

/* Generation: the AI thinks out loud about the visitor's choices. */
.generate-layout { display: flex; align-items: center; gap: 4.5rem; text-align: left; }
.generate-layout .art-loader { margin: 0; flex-shrink: 0; width: 13rem; height: 13rem; }
.gen-story { width: 44rem; }
.gen-story .generate-text { font-size: 2rem; font-weight: 700; color: var(--ink); letter-spacing: -0.025em; margin-bottom: 1.5rem; }
.gen-lines { list-style: none; display: flex; flex-direction: column; gap: 0.875rem; }
.gen-lines li {
    display: flex; align-items: flex-start; gap: 0.875rem;
    font-size: 1.25rem; line-height: 1.45; color: var(--ink-2);
    opacity: 0; transform: translateY(0.375rem);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.gen-lines li .ai-step-icon { margin-top: 0.125rem; }
.gen-lines li.active, .gen-lines li.done { opacity: 1; transform: none; }
.gen-lines li.active { color: var(--ink); font-weight: 600; }
.gen-lines li.active .ai-step-icon { border-color: var(--accent); border-right-color: transparent; animation: spin 0.8s linear infinite; }
.gen-lines li.done .ai-step-icon { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Result: artwork left (seen first), choices and QR right. */
.result-page { gap: 5rem; }
.result-text-col { flex: 0 0 32rem; gap: 1.75rem; }
.result-text-col .page-heading { font-size: 2.75rem; line-height: 1.12; margin: 0; }
.result-choices-title { font-size: 1.125rem; font-weight: 600; color: var(--ink-2); margin-bottom: 0.75rem; }
.result-choices ul { list-style: none; display: flex; flex-direction: column; gap: 0.625rem; }
.result-choices li { display: flex; align-items: center; gap: 0.75rem; font-size: 1.125rem; color: var(--ink-2); }
.result-choices li strong { color: var(--ink); font-weight: 600; margin-right: 0.25rem; }
.result-check {
    width: 1.75rem; height: 1.75rem; border-radius: 0.5rem; flex-shrink: 0;
    background: var(--accent); color: #fff; display: grid; place-items: center;
}
.result-check svg { width: 1.0625rem; height: 1.0625rem; }
.qr-card { flex-direction: column; align-items: flex-start; gap: 0.875rem; width: auto; padding: 1.25rem 1.5rem 1.5rem; }
.qr-title { font-size: 1.0625rem; font-weight: 600; line-height: 1.4; max-width: 20rem; }

/* ---- Round 3: no squeezing ---------------------------------------------- */

/* Grids keep their natural size; the stage scrolls if a screen is too small. */
.card-grid.square-grid, #choice-form, #objects-form { flex: 0 0 auto; min-height: auto; }

/* Selection slots on the objects page: you see that three can be chosen. */
.object-slots { display: flex; align-items: center; gap: 0.75rem; margin: -0.75rem 0 1.5rem; }
.object-slot {
    width: 3.75rem; height: 3.75rem;
    border-radius: 0.875rem;
    border: 2px dashed var(--border-med);
    background: rgba(255,255,255,0.6);
    display: grid; place-items: center;
    overflow: hidden;
    padding: 0;
    cursor: default;
    transition: border-color 0.2s, transform 0.2s;
}
.object-slot span { font-size: 1rem; font-weight: 600; color: var(--ink-3); }
.object-slot.filled { border: 2px solid var(--accent); cursor: pointer; animation: check-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.object-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.object-slots .objects-count { margin: 0 0 0 0.5rem; }

/* Choice pill for the objects: stacked thumbnails + a count. */
.pill-stack { display: flex; }
.pill-stack img { border: 2px solid #fff; }
.pill-stack img + img { margin-left: -1rem; }

/* ---- Portrait screens and phones ------------------------------------------ */

@media (max-aspect-ratio: 4/5) {
    html { font-size: clamp(9px, 2.6vw, 13.5px); }
    html, body { height: auto; }
    .kiosk { height: auto; min-height: 100dvh; }

    .topbar { flex-wrap: wrap; height: auto; padding: 1rem 1.5rem; row-gap: 0.75rem; position: sticky; top: 0; }
    .brand { font-size: 1.5rem; }
    .brand-icon { width: 2.75rem; height: 2.75rem; }
    .brand-icon svg { width: 1.75rem; height: 1.75rem; }
    .topbar-right { gap: 0.625rem; }
    .lang-btn { padding: 0.5rem 0.75rem; font-size: 1.125rem; }
    .lang-btn .flag { display: none; }
    .home-btn { width: 3.5rem; height: 3.5rem; }
    .stepper { position: static; transform: none; order: 3; width: 100%; justify-content: center; }
    .step-label { display: none; }
    .step + .step::before { width: 1.75rem; }

    .stage { padding: 2rem 1.5rem 1.5rem; overflow: visible; justify-content: flex-start; }
    .page-heading { font-size: 2.75rem; }
    .page-sub { font-size: 1.5rem; margin-bottom: 1.75rem; }
    .page-text { font-size: 1.5rem; }

    .start-page { padding-top: 3rem; }
    .start-page .page-heading { font-size: 3.5rem; }
    .start-heading { font-size: 2.25rem; }
    .consent-card { padding: 1.5rem; }
    .consent-row { gap: 1rem; }
    .consent-text strong { font-size: 1.5rem; }
    .consent-text span { font-size: 1.3rem; }

    .square-grid, .objects-grid {
        --gap: 1rem;
        --cell: calc((100vw - 3rem - 2 * var(--gap) - 1.5rem) / 3);
        max-width: none;
        gap: 1rem var(--gap);
    }
    .square-grid .choice-card .card-label { font-size: 1.25rem; padding: 0.625rem 0.5rem; white-space: normal; }
    .card-check { width: 2.5rem; height: 2.5rem; }
    .object-slot { width: 4.5rem; height: 4.5rem; }

    .capture-layout { flex-direction: column; align-items: center; gap: 1.5rem; }
    .capture-col { width: 100%; }
    .camera-frame { height: auto; width: min(100%, 42vh); }
    .ai-panel { width: 100%; height: auto; min-height: 22rem; padding: 1.5rem; }
    .ai-lead { font-size: 1.4rem; }
    .emotion-bars li { grid-template-columns: 2rem 9rem 1fr 3.5rem; font-size: 1.25rem; }
    .emotion-chip { height: 3.5rem; font-size: 1.25rem; }

    .choice-summary { gap: 0.5rem; }
    .tune-form { grid-template-columns: 1fr; gap: 1.25rem; }
    .slider-card { padding: 1.5rem; }
    .slider-ends, .slider-badge { font-size: 1.3rem; }

    .generate-layout { flex-direction: column; gap: 2rem; text-align: left; }
    .gen-story { width: 100%; }
    .gen-lines li { font-size: 1.4rem; }

    .result-page { flex-direction: column; gap: 2rem; }
    .result-image { height: auto; width: min(100%, 48vh); }
    .result-text-col { flex: none; width: 100%; align-items: stretch; }
    .result-text-col .page-heading { font-size: 2.5rem; text-align: left; }
    .result-choices li { font-size: 1.35rem; }
    .qr-card { align-items: center; }
    .qr-code { width: 12rem; height: 12rem; }

    .bottombar {
        position: sticky; bottom: 0; z-index: 10;
        padding: 1rem 1.5rem calc(1rem + env(safe-area-inset-bottom));
        background: rgba(245,245,247,0.92);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
        border-top: 1px solid var(--border);
    }
    .nav-buttons .btn-big { flex: 1; height: 4.75rem; font-size: 1.4rem; min-width: 0; padding: 0 1.25rem; }
    .toast { bottom: 9rem; font-size: 1.3rem; white-space: normal; text-align: center; max-width: 90vw; }
}

/* A card is exactly as wide as its square image; long names hyphenate
   instead of stretching the card (otherwise a row of three breaks). */
.square-grid .choice-card { width: calc(var(--cell) + 3px); }
.square-grid .choice-card .card-label { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
@media (max-aspect-ratio: 4/5) {
    .square-grid .choice-card .card-label { font-size: 1.15rem; line-height: 1.25; }
}
