:root {
    --bg-color: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #8b5cf6;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

img {
    max-width: 100%;
    height: auto;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 4vh 20px;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

/* Visually hidden (for screen-reader-only labels) */
.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Background orbs */
.background-animations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.orb-1 {
    width: 40vw;
    height: 40vw;
    max-width: 400px;
    max-height: 400px;
    background: radial-gradient(circle, var(--primary), transparent 70%);
    top: -10%;
    left: -10%;
}

.orb-2 {
    width: 50vw;
    height: 50vw;
    max-width: 500px;
    max-height: 500px;
    background: radial-gradient(circle, var(--accent), transparent 70%);
    bottom: -15%;
    right: -10%;
    animation-delay: -5s;
}

.orb-3 {
    width: 30vw;
    height: 30vw;
    max-width: 300px;
    max-height: 300px;
    background: radial-gradient(circle, #ec4899, transparent 70%);
    top: 40%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(5vw, -5vw) scale(1.1); }
}

/* Glassmorphism */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.app-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    max-width: 1200px;
    z-index: 10;
}

/* Header */
.header {
    padding: 20px 32px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.header-title {
    text-align: left;
}

/* Title row: [Share button left] [H1 centered] [Hamburger right]
   Direct child of .app-container, sits above the header glass-panel. */
.title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.title-row .app-title {
    flex: 1;
    min-width: 0; /* allows ellipsis when title is long */
}

/* Icon-only buttons that flank the title (Share left, Hamburger right). */
.title-row-btn {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-main);
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, border-color 0.2s;
}

.title-row-btn:hover,
.title-row-btn:focus-visible {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--primary);
    outline: none;
}

.title-row-btn svg {
    width: 22px;
    height: 22px;
}

/* Page-title H1 sits in the title-row alongside Share + Hamburger. Centered,
   gradient text, scales with viewport, ellipsis if too long. */
.app-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1.15;
    text-wrap: balance;
    text-align: center;
    margin: 0;
}

/* Row of in-play controls (Auto Solve + Show Numbers + Peek) below the board
   inside .game-board-container. All equal width, single line. */
.game-controls-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.game-controls-row .btn {
    flex: 1;
    white-space: nowrap;
}

/* Empty top promo slot would otherwise count as a flex item in .app-container,
   doubling the visible gap between header and main-content. Hide while empty;
   it'll show automatically when content is added. */
.promo-slot:empty {
    display: none;
}

.header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.header-buttons {
    display: flex;
    gap: 8px;
}

/* Wrapper around the menu nav and (mobile-only) live stats display.
   On desktop it's display:contents — transparent, the nav inside is the direct
   flex item of the header. On mobile (see media query) it becomes a real flex
   container with the buttons left and live Moves/Time stats right. */
.header-bottom-row {
    display: contents;
}

/* Mobile-only mirror of the sidebar .stats-container. Hidden on desktop because
   the sidebar copy is the visible one there. JS writes to both copies via class
   selectors; whichever is hidden by media query is removed from the a11y tree. */
.header-stats {
    display: none;
}

.header-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    font-variant-numeric: tabular-nums;
}

.header-stat-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.header-stat .js-move-count,
.header-stat .js-timer {
    /* Tailwind blue-400 — passes WCAG AA (~6.1:1) on the glass-panel header bg.
       --primary (#3b82f6) only managed ~4.2:1, just below the 4.5 threshold. */
    color: #60a5fa;
    font-weight: 700;
    font-size: 0.95rem;
}

/* Click-to-pause affordance on the timer stat (sidebar .stat-box and mobile
   .header-stat). slidergame.js wires the click handler and adds this class. */
.timer-stat-clickable {
    cursor: pointer;
    user-select: none;
}

/* Replace the "Time" label text with a media-style pause/play icon — same
   affordance, far more discoverable than an unmarked clickable area. The
   "Time" text stays in DOM at font-size:0 so screen readers still hear it
   (and the container's aria-label="Pause or resume timer" gives context).
   The icon is also narrower than the word "TIME" (~14px vs ~22px), so this
   actually buys back a little width on cramped mobile rows. */
.timer-stat-clickable .header-stat-label,
.timer-stat-clickable .stat-label {
    font-size: 0;
    line-height: 1;
}

.timer-stat-clickable .header-stat-label::before,
.timer-stat-clickable .stat-label::before {
    content: "⏸";
    color: var(--text-muted);
    transition: color 0.15s, transform 0.15s;
    display: inline-block;
}

/* Header copy (mobile): match the value's ~0.95rem so the icon sits visually
   level with the digits. */
.timer-stat-clickable .header-stat-label::before {
    font-size: 0.95rem;
}

/* Sidebar copy (desktop): the value is 1.5rem so the icon needs to scale up
   to read as a balanced label-row. */
.timer-stat-clickable .stat-label::before {
    font-size: 1.15rem;
    margin-bottom: 2px;
}

/* Hover / focus: brighten the icon so it feels button-like under the cursor. */
.timer-stat-clickable:hover .header-stat-label::before,
.timer-stat-clickable:hover .stat-label::before,
.timer-stat-clickable:focus-visible .header-stat-label::before,
.timer-stat-clickable:focus-visible .stat-label::before {
    color: #60a5fa;
    transform: scale(1.1);
}

/* Paused state: icon flips to play (▶), value goes amber, and the icon
   gently pulses so a returning player sees "click here to resume". The
   existing @media (prefers-reduced-motion) block neutralises the pulse
   for users who opt out. */
@keyframes timer-resume-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.55; }
}

body.timer-paused .js-timer {
    color: #fbbf24;
}

body.timer-paused .timer-stat-clickable .header-stat-label::before,
body.timer-paused .timer-stat-clickable .stat-label::before {
    content: "▶";
    color: #fbbf24;
    animation: timer-resume-pulse 1.6s ease-in-out infinite;
}

.small-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Main layout */
.main-content {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* Sidebar */
.controls-sidebar {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 320px;
    flex-shrink: 0;
    position: sticky;
    top: 24px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.start-group {
    gap: 12px;
    margin-top: 8px;
}

.status-message {
    min-height: 1.2em;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-muted);
}

.status-success { color: #86efac; }
.status-warning { color: #fcd34d; }
.status-error   { color: #fca5a5; }

label,
.control-label {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: block;
}

/* Grid-size: three buttons in one row, fully visible (no dropdown). */
.grid-size-buttons {
    display: flex;
    gap: 8px;
}

.grid-size-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 6px;
    line-height: 1.2;
}

.grid-size-num {
    font-size: 1rem;
    font-weight: 600;
}

.grid-size-tag {
    font-size: 0.7rem;
    /* slate-300 — passes WCAG AA (~8:1) on the .btn background.
       --text-muted (~slate-400) only managed ~4.3:1, just under threshold. */
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

.grid-size-btn.active .grid-size-tag,
.grid-size-btn[aria-checked="true"] .grid-size-tag {
    /* On the lightened active background, brand blue gave only ~2.0:1.
       White hits ~7:1 and still reads as a clear "selected" highlight
       because of the matching primary border above it. */
    color: #ffffff;
    font-weight: 600;
}

select, input[type="file"] {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    cursor: pointer;
}

select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

select:focus { border-color: var(--primary); }
select option { background: var(--bg-color); }

.image-selector {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Wrapper for Grid Size + Puzzle Image control-groups. Transparent on desktop
   so the existing column layout is unchanged; switches to a grid container on
   mobile (see the @media block) to lay out both rows of buttons in one card. */
.sidebar-top-controls {
    display: contents;
}

/* GRID SIZE label is redundant — the 3×3 / 4×4 / 5×5 buttons are self-explanatory.
   Visually hide on both desktop and mobile; kept in DOM for screen readers. */
#grid-size-label {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Inline icons inside buttons. Hidden by default; opted in per button below
   (or in the mobile @media for the camera icon, which is mobile-only). */
.btn-icon {
    display: none;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.btn-icon-display {
    display: inline-block;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Random buttons are dice-icon-only on both desktop and mobile. The aria-label
   and title attributes carry the meaning for screen readers and tooltips. */
#btn-random-img .btn-icon,
#btn-random-gallery .btn-icon {
    display: inline-flex;
}

#btn-random-img .btn-label,
#btn-random-gallery .btn-label {
    display: none;
}

#btn-random-img,
#btn-random-gallery {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Disabled state — used by the placeholder Random-from-your-pictures button
   until the feature is wired up. Universal so it shows on desktop too. */
.btn:disabled,
.btn[disabled] {
    opacity: 0.45;
    cursor: not-allowed;
}

.assist-buttons {
    display: flex;
    gap: 8px;
}

.assist-buttons .btn {
    flex: 1;
}

/* Buttons */
.btn {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    text-align: center;
    font-family: inherit;
}

.btn:hover { background: rgba(255, 255, 255, 0.1); }

.btn.active {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary);
}

.btn[aria-pressed="true"] {
    background: rgba(59, 130, 246, 0.25);
    border-color: var(--primary);
}

.btn-solving {
    background-color: #ef4444 !important;
    border-color: #ef4444 !important;
    color: white !important;
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.39) !important;
}

.primary-btn {
    /* Darker than --primary so white text passes WCAG AA (~5:1 contrast). */
    background: var(--primary-hover);
    border: none;
    padding: 14px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.42);
    width: 100%;
}

.primary-btn:hover {
    background: #1d4ed8;
    box-shadow: 0 6px 20px rgba(29, 78, 216, 0.45);
    transform: translateY(-2px);
}

/* Auto Solve sits in the .game-controls-row flex row alongside Show Numbers /
   Peek. The opacity tweaks below distinguish disabled (0.5), ready (0.8), and
   actively solving (1.0). No layout properties — the row's flex:1 gives equal
   widths and align-items:stretch gives equal heights. */
#btn-auto-solve {
    opacity: 0.5;
    transition: opacity 0.3s;
}

#btn-auto-solve:not(:disabled) { opacity: 0.8; }
#btn-auto-solve.btn-solving { opacity: 1; }

/* Image preview */
.preview-container {
    width: 100%;
    /* Square so 1:1 puzzle images (the common case for this game) fill the
       preview without letterboxing. With sidebar internal width ~272 px,
       this gives ~272 px height — about +119 px taller than the previous
       16:9 ratio. Landscape source images stay letterboxed via the inner
       img's object-fit: contain, same as before. */
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    background: #000;
}

#image-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Stats container */
.stats-container {
    display: flex;
    gap: 16px;
    margin-top: auto;
}

.stat-box {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    border: 1px solid var(--glass-border);
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

/* Game board */
.game-board-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 32px;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.game-board {
    /* Reserve a stable square *before* JS runs to eliminate CLS. JS later
       sets explicit inline width/height (which override these), so non-square
       images still get correct sizing — but the initial paint already fills
       the right space. The min() mirrors JS: min(container width, 70vh). */
    width: min(100%, 70vh);
    aspect-ratio: 1 / 1;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    position: relative;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--glass-border);
    touch-action: none;
}

.placeholder-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    font-size: 1.2rem;
    font-weight: 500;
    text-align: center;
    width: auto;
    max-width: 80%;
    white-space: nowrap;
}

/* Static placeholder (e.g. before any image is loaded) — non-interactive. */
div.placeholder-text {
    pointer-events: none;
}

/* Pre-game preview: show the selected puzzle image so the player sees what
   they'll be solving before they hit Start. */
.game-board.preview {
    /* When --puzzle-img is set (the user picked an image, or Start Game
       loaded the full default), show that. Otherwise, paint a CSS-only
       gradient — no network image, no LCP penalty for synthetic audits. */
    background-image: var(--puzzle-img,
        radial-gradient(circle at 30% 25%, rgba(59, 130, 246, 0.22), transparent 55%),
        radial-gradient(circle at 70% 75%, rgba(139, 92, 246, 0.22), transparent 55%),
        linear-gradient(135deg, rgba(15, 23, 42, 0.6), rgba(30, 41, 59, 0.4)));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.game-board.preview .placeholder-text {
    color: var(--text-main);
    background: rgba(15, 23, 42, 0.82);
    padding: 14px 28px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* When the preview placeholder is rendered as a <button>, make it look and
   feel like a primary CTA so the player has an obvious place to click. */
button.placeholder-text {
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 1.3rem;
    transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

button.placeholder-text:hover,
button.placeholder-text:focus-visible {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 8px 28px rgba(37, 99, 235, 0.55);
    outline: none;
}

button.placeholder-text:active {
    transform: translate(-50%, -50%) scale(0.98);
}

.tile {
    position: absolute;
    border-radius: 4px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 4px 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.2s, filter 0.2s;
    user-select: none;
    background-image: var(--puzzle-img);
    background-repeat: no-repeat;
}

@media (hover: hover) {
    .tile:hover {
        filter: brightness(1.1);
        z-index: 5;
        box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4), 0 8px 15px rgba(0, 0, 0, 0.5);
    }
}

.tile:active {
    filter: brightness(1.2);
    z-index: 5;
    transform: scale(0.98);
}

.tile.empty {
    opacity: 0;
    pointer-events: none;
    background-image: none;
}

.tile.correct {
    box-shadow: inset 0 0 0 2px var(--accent), 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Win overlay */
.win-overlay {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    text-align: center;
    padding-top: 16px;
    width: 100%;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.win-overlay.hidden { display: none; }

.win-overlay h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--primary);
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    margin-bottom: 0;
}

.win-overlay p {
    margin: 0;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.win-overlay .actions {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.win-overlay .actions .btn {
    width: auto;
    flex: 0 0 auto;
}

/* Info blocks and footer */
.info-blocks {
    display: flex;
    gap: 24px;
    width: 100%;
}

.info-block {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-block h2 {
    color: var(--primary);
    font-size: 1.2rem;
}

.info-block p {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}


.info-blocks-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, min(100%, 380px));
    gap: 24px;
    justify-content: center;
    width: 100%;
}

.info-block-cards {
    flex: 1;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-block-cards h2 {
    color: var(--primary);
    font-size: 1.2rem;
}

.info-block-cards p {
    color: var(--text-muted);
    line-height: 1.6;
    font-size: 0.95rem;
}

.main-footer {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    width: 100%;
    margin-top: 8px;
}

/* Empty spacer below the main footer. Keeps Google's floating Privacy Options
   shield (position:fixed, bottom-left of viewport) over blank space when the
   user scrolls all the way down — not over content. Applied at all viewport
   widths so it works on phones and tablets too. */
.footer {
    height: 110px;
	text-align:center;
}


/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden,
.modal-overlay[inert] {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 32px;
}

.modal-content--wide {
    max-width: 800px;
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
    padding: 4px 10px;
    border-radius: 4px;
}

.close-btn:hover { color: var(--primary); }

.modal-content h2 {
    color: var(--primary);
    margin-bottom: 24px;
    font-size: 1.8rem;
    padding-right: 30px;
}

.modal-body {
    overflow-y: auto;
    padding-right: 12px;
    flex: 1;
    min-height: 0;
}

.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

.modal-body h3 {
    color: var(--text-main);
    margin-top: 24px;
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.modal-body h3:first-child { margin-top: 0; }

.modal-body p, .modal-body li {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 12px;
}

.modal-body ol {
    padding-left: 24px;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.modal-actions .btn {
    width: auto;
    flex: 0 0 auto;
}

/* Game assists */
.tile-number {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 800;
    color: white;
    text-shadow: 0 0 8px rgba(0,0,0,0.8), 2px 2px 4px rgba(0,0,0,0.9);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.game-board.show-numbers .tile-number { opacity: 1; }
.game-board.peeking .tile { opacity: 0.1 !important; }
.game-board.peeking {
    background-image: var(--peek-img);
    background-size: 100% 100%;
}

/* ====================================================================
   Site navigation drawer (right slide-in, opened by the hamburger button
   in the title row). Backdrop overlay dims the rest of the page.
   Animation: emphasized-decelerate cubic-bezier for a smooth, modern feel;
   list items cascade-fade in via @keyframes after the panel arrives.
   ==================================================================== */

/* Shared easing token — Material 3 "emphasized-decelerate" feel. */
:root {
    --drawer-ease: cubic-bezier(0.32, 0.72, 0, 1);
    --drawer-duration: 0.4s;
}

.site-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 199;
    opacity: 1;
    transition: opacity var(--drawer-duration) var(--drawer-ease),
                backdrop-filter var(--drawer-duration) var(--drawer-ease);
}

.site-nav-overlay.hidden {
    opacity: 0;
    backdrop-filter: blur(0);
    -webkit-backdrop-filter: blur(0);
    pointer-events: none;
}

.site-nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(450px, 82vw);
    z-index: 200;
    background: linear-gradient(180deg,
        rgba(30, 41, 59, 0.96) 0%,
        rgba(15, 23, 42, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: -16px 0 48px -12px rgba(0, 0, 0, 0.7),
                -1px 0 0 rgba(255, 255, 255, 0.04) inset;
    transform: translateX(100%);
    transition: transform var(--drawer-duration) var(--drawer-ease);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    will-change: transform;
}

.site-nav-drawer.open {
    transform: translateX(0);
}

.site-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
}

.site-nav-title {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.site-nav-close {
    width: 36px;
    height: 36px;
    padding: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.site-nav-close:hover,
.site-nav-close:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    outline: none;
}

.site-nav-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

.site-nav-list li { margin: 0; }

.site-nav-list a {
    display: block;
    padding: 14px 22px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 1rem;
	text-align: left !important;
    border-left: 3px solid transparent;
    position: relative;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.site-nav-list a:hover,
.site-nav-list a:focus-visible {
    background: rgba(255, 255, 255, 0.06);
    color: var(--primary);
    padding-left: 26px;
    outline: none;
}

.site-nav-list a[aria-current="page"] {
    background: rgba(59, 130, 246, 0.15);
    border-left-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* Staggered cascade for menu items when the drawer opens. The drawer panel
   itself slides in via transform; the items fade + slide-in slightly behind it
   with a sub-100ms stagger so the eye reads the list arriving in sequence
   rather than all at once.

   Implemented as a one-shot @keyframes (not a transition) so closing the
   drawer doesn't reverse the stagger — items just slide off with the panel.
   `backwards` fill keeps each item invisible during its own animation-delay. */
@keyframes drawer-item-enter {
    from { opacity: 0; transform: translateX(28px); }
    to   { opacity: 1; transform: translateX(0); }
}

.site-nav-drawer.open .site-nav-list li {
    animation: drawer-item-enter 0.45s var(--drawer-ease) backwards;
}
.site-nav-drawer.open .site-nav-list li:nth-child(1)  { animation-delay: 0.12s; }
.site-nav-drawer.open .site-nav-list li:nth-child(2)  { animation-delay: 0.16s; }
.site-nav-drawer.open .site-nav-list li:nth-child(3)  { animation-delay: 0.20s; }
.site-nav-drawer.open .site-nav-list li:nth-child(4)  { animation-delay: 0.24s; }
.site-nav-drawer.open .site-nav-list li:nth-child(5)  { animation-delay: 0.28s; }
.site-nav-drawer.open .site-nav-list li:nth-child(6)  { animation-delay: 0.32s; }
.site-nav-drawer.open .site-nav-list li:nth-child(7)  { animation-delay: 0.36s; }
.site-nav-drawer.open .site-nav-list li:nth-child(n+8) { animation-delay: 0.40s; }

/* Header bar inside the drawer also fades in subtly — a touch behind the
   panel arrival, ahead of the first list item. */
@keyframes drawer-header-enter {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.site-nav-drawer.open .site-nav-header {
    animation: drawer-header-enter 0.36s var(--drawer-ease) backwards;
    animation-delay: 0.06s;
}

/* ====================================================================
   Share modal: grid of platform buttons. Reuses .modal-overlay shell.
   ==================================================================== */
.share-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.share-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-main);
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    font-size: 0.85rem;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.share-item:hover,
.share-item:focus-visible {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    transform: translateY(-2px);
    outline: none;
}

.share-item svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.share-item--full {
    grid-column: 1 / -1;
    flex-direction: row;
    background: var(--primary-hover);
    border-color: var(--primary);
    font-size: 0.95rem;
    font-weight: 600;
}

.share-item--full:hover,
.share-item--full:focus-visible {
    background: #1d4ed8;
}

.share-copy-label.copied { color: #86efac; }

/* Stats table */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 0.9rem;
}

.stats-table th, .stats-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-table th {
    color: var(--primary);
    font-weight: 600;
}

.stats-table tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

.rank-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
}

.rank-legend {
    background: linear-gradient(45deg, #fbbf24, #f59e0b);
    color: #000;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}
.rank-master   { background: var(--primary); color: #fff; }
.rank-novice   { background: var(--text-muted); color: #fff; }
.rank-assisted {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--text-muted);
}

.no-content-msg {
    text-align: center;
    color: var(--text-muted);
    display: none;
}

/* Empty-state inside the Your Pics modal: message + a primary "Add Pictures"
   CTA so an empty gallery offers a one-click corrective action instead of just
   instructions. The wrapper still uses .no-content-msg's display:none default;
   game.js flips it to block when the gallery is empty. */
.gallery-empty-state {
    padding: 16px 0 8px;
}

.gallery-empty-state p {
    margin: 0 auto 20px;
    max-width: 32ch;
    line-height: 1.5;
}

.gallery-empty-state .btn {
    flex: 0 0 auto;
    width: auto;
    padding: 12px 28px;
    background: var(--primary-hover);
    border-color: var(--primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.42);
}

.gallery-empty-state .btn:hover,
.gallery-empty-state .btn:focus-visible {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

/* Gallery (Your Pics modal). Thumb cell size driven by --gallery-thumb-size,
   set on :root by game.js from cfg.thumbSize (default 140 px). */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--gallery-thumb-size, 140px), 1fr));
    gap: 16px;
}

.gallery-item {
    position: relative;
}

.gallery-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 8px;
    cursor: pointer;
    background-size: cover;
    background-position: center;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0;
}

.gallery-thumb:hover,
.gallery-thumb:focus-visible {
    transform: scale(1.05);
    box-shadow: 0 0 0 2px var(--primary), 0 8px 15px rgba(0, 0, 0, 0.4);
    outline: none;
}

.gallery-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 26px;
    height: 26px;
    padding: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    font-family: inherit;
}

.gallery-remove:hover {
    background: #ef4444;
    border-color: #ef4444;
}

/* Select Picture gallery (single page, no tabs). Thumb cell size driven by
   --gallery-thumb-size, set on :root by game.js from cfg.thumbSize. */
.pictures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--gallery-thumb-size, 140px), 1fr));
    gap: 12px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 4px;
}

.pictures-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    padding: 0;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    position: relative;
    display: block;
}

.pictures-thumb:hover,
.pictures-thumb:focus-visible {
    transform: scale(1.05);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary), 0 8px 15px rgba(0, 0, 0, 0.4);
    outline: none;
    z-index: 2;
}

.pictures-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: rgba(0, 0, 0, 0.3);
}

.pictures-thumb.thumb-missing {
    opacity: 0.25;
    pointer-events: none;
    background-image:
        linear-gradient(45deg,
            rgba(255, 255, 255, 0.04) 25%, transparent 25%,
            transparent 50%, rgba(255, 255, 255, 0.04) 50%,
            rgba(255, 255, 255, 0.04) 75%, transparent 75%);
    background-size: 18px 18px;
}

/* Confetti */
.confetti-piece {
    position: fixed;
    top: -10px;
    z-index: 9999;
    pointer-events: none;
}

/* Partner / monetisation zone */
.partner-zone {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

.partner-block {
    padding: 24px 32px;
    overflow: hidden; /* AdSense iframe can be sized to viewport — clip any spill */
}

.partner-block h2 {
    color: var(--primary);
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.partner-disclosure {
    color: var(--text-muted);
    line-height: 1.5;
    font-size: 0.85rem;
    margin-bottom: 16px;
    font-style: italic;
}

.partner-block a,
.promo-section a {
    color: #60a5fa;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
}

.partner-block a:hover,
.partner-block a:focus-visible,
.promo-section a:hover,
.promo-section a:focus-visible {
    color: #93c5fd;
    text-decoration-thickness: 2px;
    outline: none;
}

.amazon-search-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: stretch;
}

.amazon-search-form input[type="search"] {
    flex: 1 1 220px;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.amazon-search-form input[type="search"]::placeholder {
    color: var(--text-muted);
}

.amazon-search-form input[type="search"]:focus {
    border-color: var(--primary);
}

.amazon-search-btn {
    flex: 0 0 auto;
    width: auto;
    padding: 12px 24px;
}

.sponsor-label {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 10px;
    font-weight: 600;
}

/* Reserve vertical space so the deferred AdSense load doesn't cause CLS. */
.sponsor-slot {
    min-height: 100px;
    display: block;
    max-width: 100%;
    overflow: hidden;
}

/* AdSense rewrites inline width on the <ins>; force it back inside the slot. */
.sponsor-slot ins.adsbygoogle {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.sponsor-slot:empty::before {
    content: '';
    display: block;
    width: 100%;
    height: 100px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 6px;
}

/* ============================================================
   RESPONSIVE — MOBILE LAYOUT
   Single source of truth for ≤ 700 px. Desktop styles cascade
   down except where overridden here. Keep this block as the
   only place that changes mobile layout.
   ============================================================ */

/* Defensive: stop any decorative element (background orbs, oversized
   ads) from forcing a horizontal scrollbar on phones. Harmless on
   desktop where nothing overflows. */
html, body {
    overflow-x: hidden;
}

@media (max-width: 700px) {

    /* ---------- Frame ---------- */
    body            { padding: 2vh 10px; }
    .app-container  { gap: 16px; }

    /* ---------- Title row ---------- */
    /* Keep the desktop [share][H1][menu] flex row; just shrink + truncate
       the H1 so unusually long page titles don't break the row. */
    .app-title {
        font-size: clamp(1rem, 4.5vw, 1.6rem);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ---------- Header card ---------- */
    /* Stack the desktop subtitle area (hidden) and the buttons-row vertically. */
    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
    }

    /* Desktop subtitle adds noise on phones; H1 already says it. */
    .header-title { display: none; }

    /* On desktop .header-bottom-row is display:contents so the nav floats
       directly into the header flex row. On mobile we make it a real flex
       row holding [buttons (left)] [live Moves/Time mirror (right)]. */
    .header-bottom-row {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    .header-buttons {
        display: flex;
        gap: 6px;
        flex-shrink: 0;
    }

    /* Stats / Help / Learn — content-width with comfortable padding, never wrap. */
    .small-btn {
        flex: 0 0 auto;
        width: auto;
        padding: 6px 12px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Mobile-only Moves/Time mirror; pushed to the right end of the row.
       (The sidebar copy in .stats-container is hidden below.) */
    .header-stats {
        display: flex;
        gap: 12px;
        margin-left: auto;
        flex-shrink: 0;
    }

    /* ---------- Main layout: stack vertically ---------- */
    .main-content {
        flex-direction: column;
        gap: 12px;
    }

    /* Sidebar becomes a real full-width column container (NOT display:contents).
       Its desktop width:320px and sticky position are overridden here. */
    .controls-sidebar {
        position: static;
        width: 100%;
        padding: 0;
        gap: 12px;
    }

    /* Hide the sidebar bits that have mobile equivalents elsewhere. */
    .controls-sidebar > .stats-container { display: none; } /* shown in header */
    .controls-sidebar > .start-group     { display: none; } /* on-board pill instead */
    .preview-container                   { display: none; } /* saves vertical space */

    /* ---------- Single mobile card: Grid Size + Puzzle Image ---------- */
    /* Visual frame for both control-groups, children stack as a flex column. */
    .sidebar-top-controls {
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding: 12px;
        background: rgba(0, 0, 0, 0.18);
        border: 1px solid var(--glass-border);
        border-radius: 12px;
    }

    .sidebar-top-controls .control-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    /* Show GRID SIZE / PUZZLE IMAGE labels on mobile (desktop CSS visually-
       hides #grid-size-label; restore both here for context). */
    .sidebar-top-controls #grid-size-label,
    .sidebar-top-controls .control-label,
    .sidebar-top-controls > .control-group > label {
        position: static !important;
        width: auto;
        height: auto;
        margin: 0;
        clip: auto;
        white-space: normal;
        font-size: 0.7rem;
        color: var(--text-muted);
    }

    /* ---------- Grid Size: 3 columns ---------- */
    .grid-size-buttons {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .grid-size-btn { padding: 8px 4px; }
    .grid-size-num { white-space: nowrap; font-size: 0.92rem; }
    .grid-size-tag { display: none; }   /* hide Novice/Adept/Master sub-tag */

    /* ---------- Puzzle Image source: 2 columns ---------- */
    /* Random buttons stay icon-only — desktop default cascades, no override. */
    .image-selector {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    /* All sidebar-card buttons fill their grid cell, single line w/ ellipsis
       if the label is unexpectedly long. */
    .sidebar-top-controls .btn {
        flex: initial;
        width: 100%;
        min-width: 0;
        padding: 8px 6px;
        font-size: 0.85rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ---------- Game board card ---------- */
    .game-board-container { padding: 10px; }
    .game-board           { width: 100%; }

    /* In-play row: Auto Solve / Show Numbers / Peek (desktop is already
       flex with flex:1 children; just tighten padding for narrow widths). */
    .game-controls-row .btn {
        padding-left: 6px;
        padding-right: 6px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* ---------- Misc ---------- */
    .info-blocks  { flex-direction: column; }
    .partner-block { padding: 16px 12px; }
}

/* Modal grids on phones: keep two columns so thumbs don't get stretched
   past their source resolution. */
@media (max-width: 600px) {
    .modal-content { padding: 20px; }

    .pictures-grid,
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }
}

/* Very narrow phones (≤ 480 px): tighten further so Moves/Time fits. */
@media (max-width: 480px) {
    body                  { padding: 2vh 8px; }
    .header               { padding: 12px 10px; }
    .game-board-container { padding: 8px; }

    /* Smaller Stats/Help/Learn so the row fits Moves/Time alongside on
       narrow phones (Galaxy S8+ ~360 px viewport and similar) — without
       this the stats wrap to a second row. */
    .small-btn {
        padding: 4px 7px;
        font-size: 0.68rem;
    }

    /* Help button becomes a "?" glyph at narrow viewports — recognised
       help-affordance convention (Apple, Microsoft, GitHub, etc.) and
       saves the ~15–20 px needed to keep Stats / ? / Learn + Moves / Time
       on a single row. The original "Help" text stays in the DOM at
       font-size:0 so screen readers still announce the button correctly. */
    #btn-help {
        font-size: 0;
        padding: 4px 9px;
    }
    #btn-help::before {
        content: "?";
        font-size: 0.95rem;
        font-weight: 700;
        line-height: 1;
    }

    .header-bottom-row { gap: 6px; }
    .header-buttons    { gap: 3px; }
    .header-stats      { gap: 8px; }
    .header-stat       { gap: 3px; }

    .header-stat-label { font-size: 0.65rem; letter-spacing: 0.02em; }
    .header-stat .js-move-count,
    .header-stat .js-timer { font-size: 0.85rem; }
}

/* ============================================================
   LANDSCAPE ROTATION PROMPT
   Phones / small touch devices in landscape are too short for
   the desktop layout (which applies above 700 px wide) and the
   game does not display properly. Cover the page with a friendly
   "rotate to portrait" message; clears automatically when the
   device is rotated back. Pointer:coarse keeps this off resized
   desktop browser windows. The prefers-reduced-motion block
   below neutralises the icon animation for users who opt out.
   ============================================================ */
@keyframes rotate-portrait-hint {
    0%, 100% { transform: rotate(0deg); }
    50%      { transform: rotate(-90deg); }
}

@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
    /* Hide the underlying game UI so a squashed partial layout
       isn't visible behind the prompt. */
    .app-container,
    .background-animations,
    .modal-overlay,
    .site-nav-overlay,
    .site-nav-drawer {
        display: none !important;
    }

    /* Use body itself as the centered flex container for the prompt. */
    body {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 18px;
        padding: 24px;
        min-height: 100vh;
        text-align: center;
    }

    /* Rotation icon — animates 0 → -90° → 0 to hint at the gesture. */
    body::before {
        content: "🔄";
        font-size: 3rem;
        line-height: 1;
        animation: rotate-portrait-hint 2.4s ease-in-out infinite;
    }

    body::after {
        content: "Please rotate your device to portrait for the best experience";
        max-width: 32ch;
        font-size: 1.15rem;
        font-weight: 600;
        line-height: 1.5;
        color: var(--text-main);
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}


.breadcrumb {
  font-size: 0.85rem;
  color: #aeb8d0;
  margin-bottom: 8px;
  text-align: left;
}

.breadcrumb a {
  color: #aeb8d0;
  text-decoration: none;
}

.breadcrumb a:hover,
.breadcrumb a:focus {
  color: #ffffff;
  text-decoration: underline;
}

.breadcrumb span {
  margin: 0 0.35rem;
}

/* Promotional section styling */
      .promo-section {
        width: 99%;
        margin: 2rem 0;
        padding: 1rem;
        box-sizing: border-box;
      }
      .promo-section.with-border {
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 2rem 1rem;
      }
      .promo-placeholder {
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(168, 85, 247, 0.1));
        border: 2px dashed rgba(99, 102, 241, 0.3);
        border-radius: 12px;
        padding: 2rem;
        text-align: center;
        color: rgba(255, 255, 255, 0.6);
        font-size: 0.9rem;
      }
      .promo-placeholder code {
        background: rgba(0, 0, 0, 0.3);
        padding: 0.2em 0.5em;
        border-radius: 4px;
        font-family: monospace;
      }

.promo-section {
  max-width: 1200px;
  margin: 14px auto;
  padding: 16px 12px;
  background: linear-gradient(180deg, #2E3340 0%, #2B2F38 100%);
  border-radius: 14px;
  text-align: center;
  color: #fff;

  box-shadow:
    /* border */
    inset 0 0 0 1px rgba(255,255,255,0.35),
    inset 0 1px 0 rgba(255,255,255,0.06),

    /* ambient ï¿½liftï¿½ for dark page backgrounds */
    0 0 0 1px rgba(255,255,255,0.06),
    0 10px 28px rgba(0,0,0,0.32);
}


.promo-section .promo-note {
  font-size: 0.85rem;
  line-height: 1.5;
  text-align: left;
}

/* Promotional placeholders */
.promo-placeholder {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.1),
    rgba(168, 85, 247, 0.1)
  );
  border: 2px dashed rgba(99, 102, 241, 0.3);
  border-radius: var(--premier-radius);
  padding: 2rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}

.info-blocks, a:link {
        text-decoration: none; text-align:center;
      }
      a:visited {
        text-decoration: none;
      }
      a:hover {
        text-decoration: none;
      }
      a:active {
        text-decoration: none;
      }
	  
.info-block-cards a:link {
        text-decoration: none; text-align:center;
      }
      a:visited {
        text-decoration: none;
      }
      a:hover {
        text-decoration: none;
      }
      a:active {
        text-decoration: none;
      }
	  
@media screen and (max-width:600px) {  
	  #btn-random-gallery {
    display: none;
}
}
