/* Andalusi web lobby. Design notes: .plans/2026-09-29-web-native-design.md
   The look follows the app (ThemeTokens.kt): white and #F9F9F9 surfaces, black labels, the
   coral red of the app's buttons and active tabs, grey fills, the saffron crown for Pro.
   Logical properties only: the layout mirrors for Arabic and Urdu. */

@font-face {
    font-family: "Rubik";
    src: url("/fonts/rubik-arabic.woff2") format("woff2");
    font-weight: 400 700;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: "Rubik";
    src: url("/fonts/rubik-latin.woff2") format("woff2");
    font-weight: 400 700;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --paper: #ffffff;          /* backgrounds.primary */
    --stage: #f9f9f9;          /* backgrounds.secondary */
    --mist: #eeeeef;           /* fills.secondary, search field */
    --soft: #f7f7f7;           /* grays.gray2: banners, placeholders */
    --ink: #000000;            /* labels.primary */
    --ink-muted: #8a8a8e;      /* labels.secondary */
    --tab: #5f676f;            /* tabs.unselected: nav items and icons */
    --line: #d4d4d4;           /* separators.opaque */
    --accent: #ff506d;         /* colors.red: primary buttons, active tab */
    --accent-tint: #ffdce2;    /* buttons.tintedFill: selected pill */
    --accent-soft: #ffeef1;    /* red100 */
    --saffron: #ffb743;        /* colors.yellow: the Pro crown */
    --gold: #f1b14d;           /* customColors.gold: the store crown of a Pro account */
    --tertiary: #ffffff;       /* backgrounds.tertiary: cards, menus, dialogs */
    --grouped: #f7f7f7;        /* backgroundsGrouped.secondary: banners, settings groups */
    --ink-faint: #a4a4a6;      /* labels.tertiary: placeholders */
    --hover: #eeeeef;          /* fills.quaternary: sidebar hover */
    --shimmer-base: #eeeeef;   /* loading placeholders, with a lighter sweep */
    --shimmer-shine: #f9f9fa;
    --chip-pill: #ee738966;    /* fills.pillFill at 0.4 (Compose's copy replaces the alpha): the selected tab */
    --scrim: #00000066;        /* overlays.default */
    --focus: #ff506d;
    --shadow: 0 4px 14px #0000001f;
    /* The web design's dialog surfaces (Figma Andalusi-Website, Settings). */
    --dialog-edge: #0000000d;
    --dialog-side: #f8f9fa;
    --dialog-side-line: #eceef1;
    --card: #f8f9fa;
    --card-line: #f0f2f4;
    --row-line: #eceef1cc;
    --ink-secondary: #464646;  /* labels.secondary in the web design */
    --ink-group: #8a94a2;      /* group titles */
    --ink-quiet: #9ca3af;      /* the version line */
    --pro-card: #faeedb;
    --button-light: #fcfcfc;   /* grays.gray: the light button on a tinted card */

    --radius-card: 10px;
    --radius-field: 12px;
    --radius-dialog: 20px;
    --nav-w: 220px;
    --top-h: 70px;
    --gutter: 16px;
    --row-h: 248px;
    --shelf-h: 236px;
    --font-ui: "Rubik", system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #000000;
        --stage: #000000;
        --mist: #2f2f2f;
        --soft: #1c1c1e;
        --ink: #ffffff;
        --ink-muted: #bcbcbc;
        --tab: #e7eaed;
        --line: #464646;
        --accent-tint: #66202c;
        --accent-soft: #3b1219;
        --scrim: #000000b3;
        --tertiary: #1c1c1e;
        --grouped: #2f2f2f;
        --ink-faint: #8f8f90;
        --hover: #464646;
    --shimmer-base: #262626;
    --shimmer-shine: #3a3a3a;
        --shimmer-base: #262626;
        --shimmer-shine: #3a3a3a;
        --shadow: 0 4px 14px #00000080;
        --dialog-edge: #ffffff14;
        --dialog-side: #141416;
        --dialog-side-line: #2c2c2e;
        --card: #2a2a2c;
        --card-line: #333336;
        --row-line: #ffffff14;
        --ink-secondary: #bcbcbc;
        --ink-group: #8e96a3;
        --ink-quiet: #8f8f90;
        --pro-card: #453825;
        --button-light: #3a3a3c;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --paper: #000000;
    --stage: #000000;
    --mist: #2f2f2f;
    --soft: #1c1c1e;
    --ink: #ffffff;
    --ink-muted: #bcbcbc;
    --tab: #e7eaed;
    --line: #464646;
    --accent-tint: #66202c;
    --accent-soft: #3b1219;
    --scrim: #000000b3;
    --tertiary: #1c1c1e;
    --grouped: #2f2f2f;
    --ink-faint: #8f8f90;
    --hover: #464646;
    --shadow: 0 4px 14px #00000080;
    --dialog-edge: #ffffff14;
    --dialog-side: #141416;
    --dialog-side-line: #2c2c2e;
    --card: #2a2a2c;
    --card-line: #333336;
    --row-line: #ffffff14;
    --ink-secondary: #bcbcbc;
    --ink-group: #8e96a3;
    --ink-quiet: #8f8f90;
    --pro-card: #453825;
    --button-light: #3a3a3c;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
:lang(ar), :lang(ur) { line-height: 1.65; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
/* LazyImg has no src until it nears the screen; Chrome would draw a broken-image icon and frame. */
img:not([src]) { visibility: hidden; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* ---------- Frame ---------- */

.frame {
    display: grid;
    grid-template-columns: var(--nav-w) minmax(0, 1fr);
    min-height: 100vh;
    /* A phone's 100vh is its height without the browser bars, taller than what shows while they are up. */
    min-height: 100dvh;
}

/* The app's expanded sidebar (RootNavigationRail.kt, SidebarDesignsSection.kt). */
.side-nav {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
    background: var(--paper);
}

.brand { display: flex; padding: 12px 16px; }
.brand img { width: 44px; height: 44px; border-radius: 50%; padding: 4px; background: var(--tertiary); }

.create-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 56px;
    margin: 8px 4px;
    padding-inline: 16px 20px;
    border: none;
    border-radius: 999px;
    background: var(--accent);
    color: #ffffff;
    font-size: 16px;
    line-height: 21px;
    font-weight: 600;
    box-shadow: 0 3px 6px #00000029;
    cursor: pointer;
}
.create-button svg { width: 24px; height: 24px; flex: none; }
.create-button:hover { box-shadow: 0 4px 8px #00000033; }

.side-scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.side-scroll nav { display: flex; flex-direction: column; gap: 4px; }
.side-section-title {
    display: block;
    /* The app's 16 / 4 with its column's 4 px gaps around the heading, less the text's own leading. */
    padding: 18px 16px 7px;
    color: var(--ink-muted);
    font-size: 13px;
    line-height: 18px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--tab);
    font-size: 17px;
    line-height: 22px;
}
.nav-item > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item svg { width: 25px; height: 25px; flex: none; }
.nav-item .icon { color: var(--icon-tint, currentColor); }
.nav-item:hover { background: var(--hover); }
.nav-item[aria-current="page"] { color: var(--accent); }
.nav-item[aria-current="page"] .icon { color: var(--accent); }

.side-footer { display: flex; gap: 4px; padding: 4px; }
.side-footer .icon-button { width: 48px; height: 48px; color: var(--ink); }
.side-footer .icon-button svg { width: 24px; height: 24px; }

/* ---------- Account ---------- */

.avatar {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 50%;
    background: var(--accent-tint);
    color: var(--accent);
    font-size: 15px;
    font-weight: 600;
}
.avatar > .icon svg { width: 32px; height: 32px; }
/* The design system's 16 px crown badge (icon-badges): the crown on fills.opacity, white or black by theme. */
.avatar-crown {
    position: absolute;
    inset-block-end: -3px;
    inset-inline-end: -3px;
    display: grid;
    place-items: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: light-dark(#ffffff66, #00000066);
    color: var(--saffron);
}
.avatar-crown.max { color: #e84dd8; }
.avatar-crown svg { width: 10px; height: 10px; }


/* The account's avatar on the top bar and its menu (the website's account menu, in the app's look). */
.account-menu-anchor { flex: none; margin-inline: 4px 12px; }
.account-menu-button {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}
.account-menu-button .avatar { width: 40px; height: 40px; font-size: 18px; }
.account-menu-button .avatar > .icon svg { width: 40px; height: 40px; }
.account-menu-button:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.menu.account-menu { top: calc(100% + 4px); width: 300px; max-width: calc(100vw - 32px); padding: 8px; }
/* The menu over the editor frame, under the editor's own avatar. */
.editor-account-layer { position: fixed; inset: 0; z-index: 1003; }
/* Fixed makes its own stacking context, so the menu's z-index only counts inside it: the anchor itself must clear the backdrop. */
.menu-anchor.editor-account-anchor { position: fixed; z-index: 30; }
/* The editor logo's menu over the editor frame and the pickers on it (Figma 2964-10275), as the frame's .logo-menu:
   a 240 px card under the logo, 16 px inside, groups 12 px apart around a hairline, 40 px rows 4 px apart with a
   20 px icon in its 28 px box and the 17 px label. */
.editor-logo-layer { position: fixed; inset: 0; z-index: 1003; }
.menu.logo-menu { position: fixed; inset-inline: 16px auto; width: 240px; max-width: none; gap: 12px; padding: 16px; border-radius: 28px; box-shadow: 0 16px 40px -6px #0000001f, 0 6px 16px -4px #0000000f; animation: logo-menu-in 120ms cubic-bezier(0.2, 0, 0, 1); }
.logo-menu-group { display: flex; flex-direction: column; gap: 4px; }
.logo-menu .menu-divider { height: 1px; margin-block: 0; background: var(--line); }
.logo-menu .menu-item { justify-content: flex-start; gap: 8px; min-height: 40px; height: 40px; margin-inline: -8px; padding: 0 8px; border-radius: 10px; font-size: 17px; line-height: 20px; letter-spacing: -0.43px; color: var(--ink); }
.logo-menu .menu-item:hover { background: var(--stage); }
.logo-menu .menu-item.danger { color: #de4646; }
.logo-menu .menu-item > .icon { width: 28px; height: 20px; padding-inline: 4px; }
@keyframes logo-menu-in { from { opacity: 0; transform: scale(0.92); } }
.account-menu-head { display: flex; align-items: center; gap: 12px; padding: 8px 8px 16px; }
.account-menu-head .avatar { width: 44px; height: 44px; font-size: 18px; }
.account-menu-who { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.account-menu-email { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--ink); }
.account-menu-credits { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; padding: 12px; border-radius: 14px; background: var(--grouped); }
.account-menu-credits-open { display: flex; flex-direction: column; padding: 0; border: none; background: none; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.account-menu-credits .credits-row.head { padding-top: 0; font-size: 15px; line-height: 20px; }
.account-menu-credits .credits-bar { margin-top: 10px; }
.account-menu-credits .credits-usage { margin: 8px 0 0; }
.account-menu-credits .bone { display: block; border-radius: 7px; }
.account-menu-credits .bone.percent { width: 40px; height: 14px; }
.account-menu-credits .bone.usage { width: 150px; height: 12px; margin-top: 10px; }
.account-menu-upgrade { width: 100%; height: 36px; font-size: 15px; }
.account-menu-sign-in { width: 100%; margin: 4px 0 8px; }
.account-menu .menu-item { min-height: 44px; border-radius: 10px; font-size: 15px; line-height: 20px; }
.account-menu .menu-item svg { width: 22px; height: 22px; }
.account-menu .menu-divider { margin: 4px 8px; }


.main-column { min-width: 0; display: flex; flex-direction: column; }

.top-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--top-h);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-inline-start: 16px;
    background: var(--paper);
}
/* Home and its tabs, Search and AI Tools: every other page has its own bar. */
.top-bar.home-only { display: none; }
.top-bar .search-box { width: 360px; max-width: 100%; align-self: flex-start; margin-top: 16px; }
/* A tab's title in the start Home leaves empty: the search field narrows first, the title only once it cannot. */
.top-bar-title { flex: 0 0.01 auto; min-width: 0; margin: 0; margin-inline-end: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 34px; line-height: 41px; font-weight: 700; }
.top-bar-title:not(.home-title) + .search-box { flex: 0 1 360px; min-width: 200px; margin-inline-start: 16px; }

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--tab);
    cursor: pointer;
}
.icon-button svg { width: 22px; height: 22px; }
.icon-button:hover, .icon-button[aria-current="page"] { background: var(--mist); color: var(--ink); }


.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    padding-inline: 20px;
    border-radius: 999px;
    border: none;
    background: var(--mist);
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}
.button:hover { filter: brightness(0.97); }
.button svg { width: 20px; height: 20px; }
.button.primary { color: #ffffff; background: var(--accent); }
.button.primary:hover { filter: brightness(1.05); }
.button:disabled { opacity: 0.45; cursor: default; }

.content {
    width: 100%;
    /* Fills the window, so a short page still keeps the phone tab bar at the bottom. */
    flex: 1 0 auto;
    padding: 0 var(--gutter) 80px;
    container-type: inline-size;
}

.page-title {
    font-weight: 600;
    font-size: 28px;
    line-height: 34px;
    margin: 8px 0 20px;
}

.bottom-tabs { display: none; }

/* ---------- Search ---------- */

.search-box { position: relative; }
.search-field {
    display: flex;
    align-items: center;
    height: 42px;
    padding-inline: 8px;
    border-radius: 999px;
    background: var(--mist);
}
.search-field svg { width: 24px; height: 24px; color: var(--ink-muted); flex: none; }
.search-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    padding-inline: 8px;
    background: transparent;
    color: var(--ink);
    caret-color: var(--accent);
    font: inherit;
    font-size: 16px;
    line-height: 21px;
}
.search-input::placeholder { color: var(--ink-faint); }
/* Chrome's own clear button is a fixed blue; redraw its × at the same size in the icon grey. */
input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 10px;
    height: 10px;
    background:
        linear-gradient(45deg, transparent calc(50% - 1px), var(--tab) 0 calc(50% + 1px), transparent 0) center / 7px 7px no-repeat,
        linear-gradient(-45deg, transparent calc(50% - 1px), var(--tab) 0 calc(50% + 1px), transparent 0) center / 7px 7px no-repeat;
    cursor: pointer;
}
.key-hint {
    flex: none;
    min-width: 24px;
    padding: 1px 7px;
    border-radius: 7px;
    border: 1px solid var(--line);
    color: var(--ink-muted);
    font-size: 12px;
    text-align: center;
}
.search-field:focus-within .key-hint { display: none; }

.search-popover {
    position: absolute;
    inset-inline: 0;
    top: calc(100% + 8px);
    z-index: 40;
    padding: 8px;
    border-radius: 16px;
    background: var(--paper);
    border: 1px solid var(--line);
    box-shadow: 0 18px 48px #0000002e;
    max-height: min(420px, 60vh);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.popover-heading { margin: 6px 10px; font-size: 13px; color: var(--ink-muted); }
.option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    cursor: pointer;
}
.option svg { width: 18px; height: 18px; color: var(--ink-muted); flex: none; }
.option[aria-selected="true"] { background: var(--mist); }
.option .remove {
    margin-inline-start: auto;
    border: none;
    background: none;
    color: var(--ink-muted);
    cursor: pointer;
    font-size: 16px;
}

/* ---------- Discover ---------- */

/* The app's home tabs: plain labels, the current one on the tinted pill. */
.home-tabs {
    display: flex;
    gap: 8px;
    margin: 0 calc(-1 * var(--gutter)) 16px;
    padding-inline: 16px;
    overflow-x: auto;
    scrollbar-width: none;
}
.home-tabs::-webkit-scrollbar { display: none; }
/* The tab row in its arrows' box (RowArrows): the box keeps the room under the row, so the arrows centre on it. */
.home-tabs-box { margin-bottom: 16px; }
.home-tabs-box > .home-tabs { margin-bottom: 0; }

/* A row that scrolls sideways (RowArrows): the shelves' arrows, smaller, over each end with more behind it, for a mouse. */
.row-box { position: relative; min-width: 0; }
.row-arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    width: 28px;
    height: 28px;
    display: none;
    place-items: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--tertiary);
    color: var(--ink);
    box-shadow: var(--shadow);
    transform: translateY(-50%);
    cursor: pointer;
}
.row-arrow svg { width: 16px; height: 16px; }
.row-arrow.prev { inset-inline-start: 4px; }
.row-arrow.next { inset-inline-end: 4px; }
[dir="rtl"] .row-arrow svg { transform: scaleX(-1); }
/* The row fades out under each arrow, as the editor's rows do. */
.row-box > :first-child { --fade-start: #000; --fade-end: #000; mask-image: linear-gradient(to right, var(--fade-start), #000 40px, #000 calc(100% - 40px), var(--fade-end)); }
[dir="rtl"] .row-box > :first-child { mask-image: linear-gradient(to left, var(--fade-start), #000 40px, #000 calc(100% - 40px), var(--fade-end)); }
/* RowArrows names the ends with more in data-more: a :has() over the arrows restyled the whole page on any change. */
.row-box > [data-more~="back"] { --fade-start: transparent; }
.row-box > [data-more~="forward"] { --fade-end: transparent; }
/* The Elements tabs keep 4 px over their chips and 8 under. */
.picker-tabs ~ .row-arrow { top: calc(50% - 2px); }
@media (hover: hover) and (pointer: fine) { .row-arrow { display: grid; } }
.home-tab {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 24px;
    height: 34px;
    padding-inline: 12px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 18px;
    font-weight: 500;
    white-space: nowrap;
}
.home-tab svg { width: 24px; height: 24px; }
.home-tab.heart-tab { width: 48px; padding: 0; }
.home-tab[aria-current="page"] { background: var(--chip-pill); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding-inline: 16px;
    border-radius: 999px;
    background: var(--mist);
    font-weight: 500;
    font-size: 15px;
}
.chip-icon {
    width: 20px;
    height: 20px;
    flex: none;
    object-fit: contain;
    filter: brightness(0);
}
:root[data-theme="dark"] .chip-icon { filter: brightness(0) invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip-icon { filter: brightness(0) invert(1); } }
.chip:hover { filter: brightness(0.97); }

/* Feed blocks bleed to the content edges and keep the app's own insets. */
.section { margin-inline: calc(-1 * var(--gutter)); }

/* The app's section header (HeaderComponentUI). */
.section-head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 12px 16px 0;
}
.section-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.section-caption { font-size: 12px; line-height: 16px; font-weight: 500; }
.section-title { margin: 0; font-size: 17px; line-height: 22px; font-weight: 700; }
.section-body { margin: 0; font-size: 17px; line-height: 22px; }
.section-more { display: inline-flex; color: var(--ink-muted); }
.section-more svg { width: 20px; height: 20px; }
[dir="rtl"] .section-more svg { transform: scaleX(-1); }

/* The app's preset screens: a 48 tall bar with the title centred. */
.screen-title {
    display: grid;
    place-items: center;
    height: 48px;
    margin: 0 0 8px;
    font-size: 17px;
    line-height: 22px;
    font-weight: 700;
}

/* The app's ScreenTopBar on a browse screen: a round back button, the title centred. */
.screen-bar { position: relative; }
.screen-bar .screen-title { margin-bottom: 0; }
.screen-back {
    position: absolute;
    inset-inline-start: calc(-1 * var(--gutter));
    top: 5px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: none;
    color: #5f676f;
    cursor: pointer;
}
.screen-back svg { width: 24px; height: 24px; }
[dir="rtl"] .screen-back svg { transform: scaleX(-1); }

/* The app's Search tab bar: the field on the start, Cancel next to it while searching. */
.search-bar { display: flex; align-items: center; padding: 16px 0 12px; }
.search-bar .search-box { width: 360px; max-width: 100%; }
.search-cancel { margin-inline-start: 4px; padding: 8px; border: none; border-radius: 8px; background: none; color: var(--accent); font: inherit; font-size: 17px; line-height: 22px; cursor: pointer; }
.search-cancel:hover { background: var(--hover); }

.feed-masonry { align-items: flex-start; }
/* TemplatesList: the masonry spans the column, 4 px in from each side. */
.browse-grid { margin-inline: calc(-1 * var(--gutter)); padding: 0 4px; }
.card.browse .card-clip, .card.browse .card-link { border-radius: 8px; }
.card.browse .badge-crown { top: 12px; }
.card.browse .badge-crown.trailing { inset-inline-end: 12px; }

/* The app's horizontal grid block: rows of the server's height, flowing column by column. */
.shelf-wrap { position: relative; }
.shelf {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    align-items: start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}
.shelf::-webkit-scrollbar { display: none; }
.shelf-arrow {
    position: absolute;
    top: 50%;
    z-index: 3;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: none;
    border-radius: 50%;
    background: var(--tertiary);
    color: var(--ink);
    box-shadow: var(--shadow);
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 150ms ease;
    cursor: pointer;
}
.shelf-arrow svg { width: 20px; height: 20px; }
.shelf-arrow.prev { inset-inline-start: 8px; }
.shelf-arrow.next { inset-inline-end: 8px; }
[dir="rtl"] .shelf-arrow svg { transform: scaleX(-1); }
.shelf-wrap:hover .shelf-arrow, .shelf-arrow:focus-visible { opacity: 1; }

/* The app's grid block with scrolling off: equal columns, the last row left short. */
.wrapped-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    align-items: start;
}
@container (max-width: 500px) { .wrapped-grid { grid-template-columns: repeat(var(--compact-cols), minmax(0, 1fr)); } }

.justified { display: flex; flex-wrap: wrap; gap: 14px; }
.justified::after { content: ""; flex-grow: 1000; }
.justified-cell { height: var(--row-h); }
.justified-cell > .card { width: 100%; height: 100%; aspect-ratio: auto !important; }

/* The app's calligraphy banner (AppToolBannerComponentUI, wide layout). */
.tool-banner {
    position: relative;
    display: block;
    height: 126px;
    margin-inline: 16px;
}
.tool-banner-card {
    position: absolute;
    inset: 16px 0 8px;
    border-radius: 24px;
    background: var(--grouped);
    overflow: hidden;
}
.banner-glyph { position: absolute; top: 0; height: 102px; color: #bcbcbc57; }
.banner-glyph svg { height: 102px; width: auto; }
.banner-glyph.start { inset-inline-start: 12px; width: 77px; }
.banner-glyph.end { inset-inline-end: -9px; width: 88px; }
.tool-banner-row {
    position: relative;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-inline: 16px;
}
.tool-banner-title {
    display: flex;
    align-items: center;
    height: 102px;
    margin-top: 16px;
    margin-inline-end: 56px;
    font-size: 17px;
    line-height: 22px;
    font-weight: 700;
}
.tool-banner-bubble { display: flex; flex-direction: column; align-items: center; margin-top: 1px; }
.tool-banner-chip {
    min-width: 60px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--tertiary);
    box-shadow: 0 3px 6px #0000001f;
    font-size: 12.7px;
    line-height: 17px;
    white-space: nowrap;
    text-align: center;
    animation: chip-pop 300ms ease-out;
}
.typing-rest { visibility: hidden; }
.tool-banner-arrow { margin-top: 8px; width: 35px; height: 22px; }
.tool-banner-arrow svg { width: 35px; height: 22px; }
[dir="rtl"] .tool-banner-arrow svg { transform: scaleX(-1); }
.tool-banner-image {
    width: 125px;
    height: 108px;
    object-fit: contain;
    animation: banner-in 600ms ease-out;
}
@keyframes chip-pop { from { transform: scale(0.92); } to { transform: none; } }
@keyframes banner-in { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }

/* The app's catalogue cards (CatalogueComponentUI): the artwork tilts out of the card's top. */
.catalogue {
    container-type: inline-size;
    display: grid;
    grid-auto-flow: column;
    /* CatalogueBlockLayout.cardSize: the percentage is the box less both insets. */
    grid-auto-columns: calc((100% + var(--end) - var(--cols) * var(--gap) - var(--peek)) / var(--cols));
    gap: var(--gap);
    padding-inline: var(--start) var(--end);
    overflow-x: auto;
    scrollbar-width: none;
}
.catalogue::-webkit-scrollbar { display: none; }
.catalogue.wrapped {
    grid-auto-flow: row;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    overflow: visible;
}
.catalogue-card {
    position: relative;
    container-type: inline-size;
    aspect-ratio: 177 / 106;
    border-radius: 16px;
    overflow: hidden;
}
.catalogue-art {
    position: absolute;
    width: 42.42cqw;
    height: calc(105.73cqw * 106 / 177);
    left: calc(70.02cqw - 21.21cqw);
    top: calc((18.16 - 105.73 / 2) * 1cqw * 106 / 177);
    object-fit: cover;
    border-radius: calc(100cqw * 6 / 177);
    border: max(1px, calc(100cqw * 2 / 177)) solid #ffffff33;
    box-shadow: 0 2px 6px #5c5c5c2e;
    transform: rotate(3.54deg);
}
[dir="rtl"] .catalogue-art { left: auto; right: calc(70.02cqw - 21.21cqw); transform: rotate(-3.54deg); }
.catalogue-title {
    position: absolute;
    inset-inline: 12px 14px;
    bottom: 8px;
    color: #fffffff2;
    font-size: 15px;
    line-height: 20px;
    letter-spacing: 0.23px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Template card (GridItemComponentUI) ---------- */

.card {
    position: relative;
    container-type: size;
    flex: none;
}
/* Corners at 8% of the card's shorter side, as the app's RoundedCornerShape(8). */
.card-clip {
    position: absolute;
    inset: 0;
    border-radius: 8cqmin;
    overflow: hidden;
    background: #cccccc1a;
}
.card .card-link { position: absolute; inset: 0; z-index: 1; border-radius: 8cqmin; }
.card img.cover-image, .card video, .card .cover-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.card .card-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card .wipe { position: absolute; inset: 0; animation: wipe 2400ms ease-in-out infinite alternate; }
/* A card-wide box whose end edge carries the 2 px line, slid in step with the wipe's edge. */
.card .wipe-line { position: absolute; inset: 0; pointer-events: none; animation: wipe-line 2400ms ease-in-out infinite alternate; }
.card .wipe-line::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    inset-inline-end: -1px;
    width: 2px;
    background: #ffffff;
}
@keyframes wipe-line { from { transform: translateX(-100%); } to { transform: translateX(0); } }
[dir="rtl"] .card .wipe-line { animation-name: wipe-line-rtl; }
@keyframes wipe-line-rtl { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
[dir="rtl"] .card .wipe { animation-name: wipe-rtl; }
@keyframes wipe-rtl { from { clip-path: inset(0 0 0 100%); } to { clip-path: inset(0 0 0 0); } }
.card img.cover-image.crop { object-fit: cover; }
.before-thumb {
    position: absolute;
    inset-inline-start: 4px;
    bottom: 4px;
    width: clamp(32px, 18cqmin, 140px);
    aspect-ratio: var(--aspect);
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #ffffff;
}
@container (min-aspect-ratio: 1 / 1) {
    .before-thumb { width: auto; height: clamp(32px, 18cqmin, 140px); }
}
.comparison-title {
    position: absolute;
    inset-inline: 4px;
    bottom: 8px;
    margin-inline: auto;
    width: fit-content;
    max-width: calc(100% - 8px);
    padding: 4px 2px;
    padding-inline: 6px;
    border-radius: 24px;
    background: #00000066;
    backdrop-filter: blur(12px);
    color: #ffffff;
    font-size: 10px;
    line-height: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* The app's TemplateBadge and AppBadge on the card's top corners. */
.badge-new { position: absolute; top: 8px; z-index: 2; width: 24px; height: 16px; object-fit: contain; pointer-events: none; }
.badge-new.leading { inset-inline-start: 8px; }
.badge-new.trailing { inset-inline-end: 8px; }
/* The app's VariableBadge: green on blend6. */
.badge-variable {
    position: absolute;
    top: 8px;
    inset-inline-start: 8px;
    z-index: 2;
    padding: 1px 4px;
    border-radius: 999px;
    background: #e5fce1;
    color: #0b7c27;
    font-size: 10px;
    line-height: 14px;
    pointer-events: none;
}
/* Figma pro-badge-24: the crown on miscellaneous.buttons.opacity. */
.badge-crown {
    position: absolute;
    top: 8px;
    z-index: 2;
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: light-dark(#ffffff66, #00000066);
    color: var(--saffron);
    pointer-events: none;
}
.badge-crown.max { color: #e84dd8; }
.badge-crown svg { width: 16px; height: 16px; }
.badge-crown.leading { inset-inline-start: 8px; }
.badge-crown.trailing { inset-inline-end: 8px; }
/* Element cells and tiles keep the app's small crown. */
.badge-crown.small { width: 18px; height: 18px; }
.badge-crown.small svg { width: 10px; height: 10px; }

/* The app's MultipageBadge. */
.pages-pill {
    position: absolute;
    inset-inline-start: 8px;
    bottom: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding-inline: 8px;
    border-radius: 999px;
    background: light-dark(#ffffff66, #00000066);
    color: var(--ink);
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
    pointer-events: none;
}
.pages-pill svg { width: 16px; height: 16px; }


.skeleton { background: var(--mist); animation: pulse 1.3s ease-in-out infinite; }

/* Loading: placeholders and images still on their way shimmer, a light sweep over the base. */
.shimmer:not(.loaded) {
    background: linear-gradient(100deg, var(--shimmer-base) 35%, var(--shimmer-shine) 50%, var(--shimmer-base) 65%) var(--shimmer-base);
    background-size: 300% 100%;
    animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
/* A picture far from the screen has no source yet (LazyImg) and its shimmer waits with it (.far): hundreds
   of them animating out of sight cost a style pass over each on every frame, under the editor too. A :has()
   over the image's src made each image that started loading restyle the whole page. */
.shimmer.far:not(.loaded) { animation: none; }
@media (prefers-reduced-motion: reduce) { .shimmer:not(.loaded) { animation: none; } }
.feed-skeleton .section-head { height: 56px; padding-inline: 0; margin: 0; align-items: center; }
.skeleton-title { display: block; width: 180px; height: 18px; border-radius: 9px; }
.skeleton-shelf { display: flex; gap: 8px; height: var(--shelf-h); margin-bottom: 16px; overflow: hidden; }
.skeleton-shelf .skeleton-card { height: 100%; flex: none; }
.skeleton-card { display: block; border-radius: 8px; }
/* A feed page's last drawn outline while it loads (Skeletons.kt, index.html): each block at its own
   height, every bone where its card, tile, banner or title was. */
.skeleton-section { position: relative; display: block; overflow: hidden; }
.skeleton-bone { position: absolute; display: block; }
html.opening-link #shell .skeleton-section { display: none; }

/* The static frame in index.html, painted before the wasm runs. */
.skeleton-pill { opacity: 0.35; }
.skeleton-icon { display: block; flex: none; width: 24px; height: 24px; border-radius: 6px; background: var(--mist); }
.shell-title, .shell-store, .shell-avatar { display: none; flex: none; background: var(--mist); }
.skeleton-line { display: block; width: 70%; height: 14px; border-radius: 7px; background: var(--mist); }
.skeleton-tab { width: 96px; background: var(--mist); }
#shell .justified > .card { width: 190px; }
@keyframes pulse { 50% { opacity: 0.55; } }

.load-more { display: flex; justify-content: center; padding: 28px; }
.feed-error { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 16px; text-align: center; }
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
    max-width: 48ch;
    padding: 28px 0;
    color: var(--ink-muted);
}
.empty .empty-title { display: block; color: var(--ink); font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.empty .button { margin-top: 16px; }
.notice { color: var(--ink-muted); }
.inert { pointer-events: none; }
.hero-search-standalone { max-width: 620px; margin-bottom: 28px; }
.hero-search-standalone .search-field { height: 54px; }

/* ---------- Quick look ---------- */

.tags { display: flex; gap: 6px; }
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding-inline: 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}
.tag svg { width: 14px; height: 14px; }
.tag.pro svg { color: var(--saffron); }

.overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: var(--scrim);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
/* The app's PreviewTemplateScreen in its large-window dialog sheet (DialogSheetScene). */
.sheet-card.quick-look { display: flex; flex-direction: column; align-items: center; overflow: hidden; background: var(--tertiary); }
.quick-look-head { display: flex; justify-content: flex-end; width: 100%; flex: none; padding: 16px 16px 0; }
.quick-look-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; color: var(--ink-muted); }
.quick-look-stage { flex: 1; min-height: 0; width: 100%; padding: 16px; display: grid; place-items: center; container-type: size; }
.quick-look-cover { position: relative; width: min(100cqw, 100cqh * var(--aspect)); aspect-ratio: var(--aspect); }
.quick-look-pager {
    display: flex;
    gap: 12px;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.quick-look-pager::-webkit-scrollbar { display: none; }
.quick-look-page { position: relative; flex: none; width: 100%; height: 100%; border-radius: 12px; overflow: hidden; background: var(--stage); scroll-snap-align: center; scroll-snap-stop: always; }
.quick-look-page img, .quick-look-page video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.badge-crown.large { top: 12px; width: 32px; height: 32px; }
.badge-crown.large.trailing { inset-inline-end: 12px; }
.badge-crown.large svg { width: 21.33px; height: 21.33px; }
.quick-look-video-info { position: absolute; inset-inline-start: 12px; bottom: 12px; z-index: 1; display: flex; gap: 8px; }
.quick-look-video-info .pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding-inline: 8px;
    border-radius: 999px;
    background: light-dark(#ffffff66, #00000066);
    color: var(--ink);
    font-size: 12px;
    line-height: 16px;
    font-weight: 500;
}
.quick-look-video-info .pill svg { width: 16px; height: 16px; }
.quick-look-mute {
    position: absolute;
    inset-inline-end: 12px;
    bottom: 12px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: light-dark(#ffffff66, #00000066);
    color: var(--ink);
    cursor: pointer;
}
.quick-look-mute:disabled { opacity: 0.4; cursor: default; }
.quick-look-mute svg { width: 16px; height: 16px; }
/* The app's PreviewTemplatePagesStrip: cells 76 px on the long side, at least 48, the first and last able to reach the centre. */
.quick-look-strip {
    --cell-w: clamp(48px, 76px * var(--aspect), 76px);
    --cell-h: clamp(48px, 76px / var(--aspect), 76px);
    display: flex;
    align-items: flex-end;
    gap: 4px;
    width: 100%;
    height: 96px;
    flex: none;
    padding-block: 4px;
    padding-inline: max(0px, calc(50% - var(--cell-w) / 2));
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.quick-look-strip::-webkit-scrollbar { display: none; }
.quick-look-strip-cell { flex: none; width: var(--cell-w); height: var(--cell-h); padding: 2px; border: 1px solid transparent; border-radius: 12px; background: none; cursor: pointer; scroll-snap-align: center; }
.quick-look-strip-cell.active { border-color: var(--accent); }
.quick-look-strip-plate { width: 100%; height: 100%; border-radius: 9px; overflow: hidden; background: var(--stage); }
.quick-look-strip-plate img { display: block; width: 100%; height: 100%; object-fit: cover; }
.quick-look-actions { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 420px; flex: none; padding: 16px; }
.quick-look-actions .button.primary { flex: 1; height: 50px; font-size: 17px; font-weight: 400; }
.quick-look-actions .skeleton-button { display: block; flex: 1; height: 50px; border-radius: 25px; }
.quick-look-actions .skeleton-heart { display: block; flex: none; width: 50px; height: 50px; border-radius: 50%; }
/* A large window: the web design's preview card (Figma 2935:16452), 373 px wide, the template 341 px across at
   its own aspect under a 36 px close, then Start Editing and the heart; 16 px around and between, 24 under. */
@media (min-width: 840px) {
    .sheet-card.quick-look {
        width: 373px;
        height: auto;
        min-height: min(764px, calc(100dvh - 48px));
        max-height: calc(100dvh - 48px);
        gap: 16px;
        /* Figma draws the 1.5 px stroke inside its 16 px padding. */
        padding: 14.5px 14.5px 22.5px;
        border: 1.5px solid var(--line);
        border-radius: 32px;
    }
    .quick-look-head { padding: 0; }
    .quick-look-head .close-button { width: 36px; height: 36px; background: var(--grouped); }
    .quick-look-stage { padding: 0; container-type: normal; }
    /* 158 px: the card's padding, the close row, the buttons and the gaps between them. */
    .quick-look-cover { width: min(341px, calc((100dvh - 48px - 158px) * var(--aspect))); }
    .quick-look-actions { gap: 16px; max-width: none; padding: 0 0 0; }
    .quick-look-actions .favorite-heart.large { background: var(--grouped); }
}
.overlay .step {
    position: fixed;
    top: calc(50% - 24px);
    z-index: 61;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--paper);
    color: var(--ink);
    box-shadow: 0 8px 24px #00000033;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.overlay .step svg { width: 24px; height: 24px; }
.overlay .step.prev { inset-inline-start: 18px; }
.overlay .step.next { inset-inline-end: 18px; }
[dir="rtl"] .overlay .step svg { transform: scaleX(-1); }
.quick-look:focus { outline: none; }

/* ---------- Dialogs ---------- */

.dialog {
    width: min(720px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 26px;
    border-radius: var(--radius-dialog);
    background: var(--paper);
}
.dialog.small { width: min(440px, 100%); }
.dialog h2 { margin: 0 0 6px; font-size: 21px; }
.dialog p { margin: 0; color: var(--ink-muted); overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.dialog:focus { outline: none; }

/* ---------- My designs (ProjectsScreen) ---------- */

.designs-header, .selection-top-bar, .folder-top-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 64px;
}
/* Lined up with the top bar's title, plan and avatar, so moving between the tabs moves nothing. */
.designs-header { height: var(--top-h); }
.header-actions .account-menu-anchor { margin-inline-end: calc(24px - var(--gutter)); }
.large-title { margin: 0; font-size: 34px; line-height: 41px; font-weight: 700; }
.header-actions { display: flex; align-items: center; gap: 0; margin-inline-start: auto; margin-inline-end: -12px; }
.header-actions .icon-button { width: 48px; height: 48px; color: var(--tab); }
.header-actions .icon-button svg { width: 24px; height: 24px; }
.header-actions .icon-button:disabled { opacity: 0.4; cursor: default; }
.header-actions .icon-button[aria-busy="true"] { opacity: 1; }
.header-actions .icon-button .spinner { width: 20px; height: 20px; border-width: 2.5px; }
.icon-button.danger { color: var(--accent) !important; }
.icon-button:disabled { opacity: 0.4; cursor: default; }
.selection-count { margin-inline-start: 8px; font-size: 17px; line-height: 20px; font-weight: 500; }
.folder-top-bar .menu-anchor { margin-inline-end: -12px; }
.folder-top-bar .icon-button { width: 48px; height: 48px; }
.folder-top-bar .icon-button svg { width: 24px; height: 24px; }
.folder-title { flex: 1; min-width: 0; margin: 0; margin-inline-start: 9px; font-size: 22px; line-height: 28px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-button, .close-button {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: none;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--hover);
    color: var(--tab);
    cursor: pointer;
}
.back-button svg, .close-button svg { width: 20px; height: 20px; }
[dir="rtl"] .back-button svg { transform: scaleX(-1); }

/* The app's All / Folders / Library pills. */
.designs-tabs { display: flex; gap: 8px; padding: 8px 0; }
.designs-tab {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding-inline: 16px;
    border-radius: 999px;
    background: light-dark(#ffffff, #2f2f2f);
    box-shadow: 0 2px 6px light-dark(#adb2bf66, #000000);
    font-size: 15px;
    line-height: 20px;
    letter-spacing: 0.23px;
    font-weight: 600;
}
.designs-tab[aria-current="page"] { background: color-mix(in srgb, #ff506d 60%, light-dark(#ffffff, #2f2f2f)); }

.masonry { display: flex; align-items: flex-start; }
.masonry-lane { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.designs-grid { padding: 16px 0; }

/* The app's ProjectCard. */
.design { display: flex; flex-direction: column; gap: 8px; }
.design-cover {
    position: relative;
    display: block;
    border-radius: 8px;
    background: var(--paper);
    box-shadow: 0 0 8px #88888880;
    overflow: hidden;
}
.design-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.design.selected .design-cover { outline: 2px solid var(--accent); outline-offset: 2px; }
.pages-pill.end { inset-inline-start: auto; inset-inline-end: 4px; bottom: 4px; height: 16px; padding-inline: 4px; font-size: 10px; line-height: 12px; }
.pages-pill.end svg { width: 12px; height: 12px; }
.design-title {
    color: var(--tab);
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.design-title-rule { height: 0.5px; margin: -6px 4px 0; background: var(--tab); }
.selection-mark {
    position: absolute;
    inset-inline-start: 6px;
    bottom: 6px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid var(--ink-muted);
    color: #ffffff;
}
.selection-mark.checked { background: var(--accent); border-color: var(--accent); }
.selection-mark svg { width: 14px; height: 14px; }
.designs-empty { display: grid; place-items: center; min-height: calc(100dvh - 116px); margin: 0 auto; max-width: 80%; text-align: center; color: var(--ink-muted); font-size: 17px; line-height: 22px; font-weight: 500; }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: calc(100dvh - 116px); padding: 24px; text-align: center; }
.folder-top-bar ~ .empty-state { min-height: calc(100dvh - 64px); }
.empty-state h2 { margin: 0 0 6px; font-size: 17px; line-height: 22px; font-weight: 700; }
.empty-state p { margin: 0 0 28px; color: var(--ink-muted); font-size: 15px; line-height: 20px; }
.empty-state .button { height: 40px; padding-inline: 24px; font-size: 17px; font-weight: 400; }
.empty-icon { margin-bottom: 16px; color: var(--ink-faint); }
.empty-icon svg { width: 64px; height: 64px; }
.selection-hint { display: flex; justify-content: center; padding: 8px; }

/* The app's menus (ProjectContextMenu, the sort menu): a card with icon rows. */
.menu-anchor { position: relative; }
.menu {
    position: absolute;
    top: 100%;
    inset-inline-end: 0;
    z-index: 30;
    min-width: 112px;
    max-width: 280px;
    padding: 8px 0;
    border-radius: 16px;
    background: var(--tertiary);
    box-shadow: 0 8px 28px #00000033;
    display: flex;
    flex-direction: column;
}
.menu.floating { position: fixed; inset-inline-end: auto; }
.menu-header { padding: 8px 12px; color: var(--ink-faint); font-size: 13px; line-height: 18px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.menu-section { padding: 8px 16px; color: var(--ink-muted); font-size: 13px; line-height: 18px; font-weight: 500; }
.menu-divider { height: 0.5px; margin-block: 2px; background: light-dark(#bcbcbc57, #5e5e5e99); }
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding-inline: 12px;
    border: none;
    background: transparent;
    color: var(--ink);
    text-align: start;
    white-space: nowrap;
    cursor: pointer;
    font-size: 17px;
    line-height: 22px;
}
.menu-label { flex: 1; }
.menu-item > .icon { justify-content: center; width: 24px; flex: none; }
.menu-item svg { width: 20px; height: 20px; flex: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); }
.menu-item.danger { color: var(--accent); }
.menu-backdrop { position: fixed; inset: 0; z-index: 25; }

/* My Designs: the folders in a row over the designs, as the app's Designs page has them: the large
   120 px cards 12 apart on a wide window, the 84 px ones 8 apart on a phone. */
.folders-shelf-head { display: flex; align-items: center; justify-content: space-between; height: 44px; }
.folders-shelf-head .icon-button { margin-inline-end: -8px; color: var(--ink); }
.folders-shelf-title { display: inline-flex; align-items: center; gap: 2px; color: var(--ink); font-size: 17px; line-height: 22px; font-weight: 600; text-decoration: none; }
.folders-shelf-title svg { width: 20px; height: 20px; }
[dir="rtl"] .folders-shelf-title svg { transform: scaleX(-1); }
.folders-shelf-row { display: flex; gap: 12px; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); overflow-x: auto; scrollbar-width: none; }
.folders-shelf-row::-webkit-scrollbar { display: none; }
.folders-shelf-row .folder-tile { flex: none; width: 120px; }
.folders-shelf-all { margin: 12px 0 8px; font-size: 17px; line-height: 22px; font-weight: 600; }

/* The app's Folders page (FoldersPage, FolderTile). */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(var(--folder-cols, 5), minmax(0, 1fr));
    gap: 24px 16px;
    padding: 16px 0;
}
@media (max-width: 1500px) { .folder-grid { --folder-cols: 5; } }
@media (max-width: 1100px) { .folder-grid { --folder-cols: 4; } }
@media (max-width: 800px) { .folder-grid { --folder-cols: 3; } }
@media (max-width: 500px) { .folder-grid { --folder-cols: 2; } }
@media (min-width: 1501px) { .folder-grid { --folder-cols: 6; } }
.folder-grid.in-sheet { --folder-cols: 3 !important; padding: 16px; }
.folder-tile {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    cursor: pointer;
}
.folder-tile.selected .folder-shape { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 12px; }
.folder-shape { position: relative; container-type: size; aspect-ratio: 172 / 145; color: var(--body); }
.folder-shape > span { position: absolute; inset: 0; }
.folder-shape svg { display: block; width: 100%; height: 100%; }
[dir="rtl"] .folder-front svg { transform: scaleX(-1); }
.folder-cover {
    position: absolute;
    inset-inline-end: calc(100% * 16 / 172);
    bottom: 0;
    padding: 6px;
    border-radius: 12px;
    background: var(--frame);
    border: 1.5px solid #ffffff;
    box-sizing: border-box;
}
.folder-cover img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; border: 1px solid #ffffff; }
.folder-heart { position: absolute; inset: auto; inset-inline-start: calc(100% * 20 / 172); bottom: calc(100% * 8 / 145); width: calc(100% * 32 / 172); }
.folder-heart.centered { inset-inline-start: 50%; bottom: auto; top: calc(50% + 100% * 22 / 145 / 2); transform: translate(-50%, -50%); }
.folder-heart svg { width: 100%; height: auto; }
.folder-name { height: 16px; color: var(--ink-muted); font-size: 12px; line-height: 16px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-tile.create { justify-content: flex-start; container-type: inline-size; }
.create-folder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: calc(100cqw * 145 / 172 * 6 / 112);
    height: calc(100cqw * 145 / 172 * 106 / 112 + 16px);
    border-radius: 12px;
    background: light-dark(#f3f4f5, #424242);
    color: light-dark(#7e8b91, #8d8d93);
    font-size: 15px;
    line-height: 20px;
    font-weight: 500;
}
.create-folder svg { width: 32px; height: 32px; }

/* The app's bottom sheets on a wide window: a centred card, 640 at most. */
.sheet-overlay { align-items: flex-end; }
.sheet {
    width: min(640px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 28px 28px 0 0;
    background: var(--paper);
}
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 16px; }
.sheet-thumb { width: 44px; height: 44px; border-radius: 8px; overflow: hidden; background: var(--mist); }
.sheet-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sheet-title { flex: 1; font-size: 17px; line-height: 22px; font-weight: 600; }
.sheet-title.centered { text-align: center; }
.text-button { border: none; background: none; color: var(--accent); font-size: 17px; font-weight: 600; cursor: pointer; }
.text-button:disabled { color: var(--ink-faint); cursor: default; }
.pick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 16px; }
.pick-card { display: flex; flex-direction: column; gap: 8px; padding: 0; border: none; background: none; cursor: pointer; }
.pick-cover { position: relative; height: 195px; border-radius: 8px; overflow: hidden; }
.pick-cover img { width: 100%; height: 100%; object-fit: contain; }

/* The app's name dialog (FolderNameDialog). */
.dialog.name-dialog { position: relative; width: min(400px, calc(100% - 80px)); padding: 24px 24px 28px; border-radius: 16px; background: var(--tertiary); }
.name-dialog .close-button { position: absolute; top: 24px; inset-inline-end: 24px; }
.name-dialog h2 { margin: 38px 0 16px; font-size: 20px; line-height: 25px; font-weight: 700; }
.text-field {
    width: 100%;
    height: 48px;
    padding-inline: 16px;
    border: none;
    border-radius: 8px;
    background: var(--hover);
    color: var(--ink);
    caret-color: var(--accent);
    font: inherit;
    font-size: 15px;
    font-weight: 500;
}
.text-field::placeholder { color: var(--ink-faint); }
.text-field:focus { outline: none; }
.button.wide { width: 100%; margin-top: 24px; height: 40px; font-size: 17px; font-weight: 400; }
.name-dialog .text-field { height: 56px; }
.name-dialog .button.wide { margin-top: 28px; }
.name-dialog .button.wide:disabled { opacity: 1; background: var(--hover); color: var(--ink-faint); }

/* The app's snackbar: what a My designs action could not do. */
.snackbar {
    position: fixed;
    inset-inline: 0;
    bottom: 24px;
    z-index: 1006;
    display: flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    max-width: calc(100% - 32px);
    margin: 0 auto;
    padding-block: 10px;
    padding-inline: 18px 8px;
    border-radius: 14px;
    background: var(--ink);
    color: var(--paper);
    box-shadow: 0 12px 32px #00000040;
}
.snackbar-close { display: grid; place-items: center; width: 32px; height: 32px; border: none; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.snackbar-close svg { width: 16px; height: 16px; }
.snackbar-close:hover { background: color-mix(in srgb, var(--paper) 12%, transparent); }
.snackbar-action { height: 32px; padding-inline: 10px; border: none; border-radius: 8px; background: transparent; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.snackbar-action:hover { background: color-mix(in srgb, var(--paper) 12%, transparent); }

/* The app's own dialogs raised in the editor frame (AppMessages.kt): over every page and sheet. */
.app-message-overlay { z-index: 1005; }
/* The app's AppDialog (Material's AlertDialog): 28 px corners, the headline title, footnote text, 40 px buttons. */
.dialog.app-message { width: min(400px, 100%); padding: 24px; border-radius: 28px; background: var(--tertiary); }
.app-message-head { display: flex; align-items: center; gap: 8px; }
.app-message-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 17px; line-height: 22px; font-weight: 600; }
.app-message-head .close-button { flex: none; }
.app-message p { margin-top: 16px; font-size: 13px; line-height: 18px; }
.app-message .dialog-actions { align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.app-message .dialog-actions .button { height: 40px; padding-inline: 24px; font-size: 17px; font-weight: 400; }
.app-message-note { margin-inline-end: auto; color: var(--ink-muted); font-size: 15px; }
/* The designs a duplicate copies, as the app's dialog shows them. */
.duplicate-covers { display: flex; justify-content: safe center; gap: 12px; margin-top: 16px; padding: 8px 4px; overflow-x: auto; }
.duplicate-cover { display: flex; flex: none; flex-direction: column; gap: 6px; width: 88px; }
.duplicate-cover .design-cover { width: 88px; height: 88px; }
.app-message .button.outline { background: transparent; color: var(--ink); }
.app-message .button.text { background: transparent; color: var(--ink-muted); font-weight: 400; font-size: 15px; }
/* The over-quota choices stack, the upgrade first, as the app's. */
.app-message.stacked { text-align: center; }
.app-message.stacked .dialog-actions { flex-direction: column; align-items: stretch; gap: 8px; }
.app-message.stacked .button.outline { border: 1px solid var(--accent); }
.quota-meter { margin-top: 16px; }
.quota-meter-bar { height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--quota), #ff9500 var(--quota)); position: relative; }
.quota-meter-bar::after { content: ""; position: absolute; top: -2px; left: calc(var(--quota) - 2px); width: 4px; height: 12px; background: var(--ink); }
[dir="rtl"] .quota-meter-bar { background: linear-gradient(to left, var(--accent) var(--quota), #ff9500 var(--quota)); }
[dir="rtl"] .quota-meter-bar::after { left: auto; right: calc(var(--quota) - 2px); }
.quota-meter-labels { position: relative; height: 16px; margin-top: 6px; font-size: 11px; color: var(--ink-muted); }
.quota-meter-quota { position: absolute; inset-inline-start: 0; white-space: nowrap; }
.quota-meter-library { position: absolute; inset-inline-end: 0; white-space: nowrap; }

/* ---------- Create Design (CreateProjectScreen, CreateProjectSheet) ---------- */

.create-page .large-title { display: flex; align-items: center; height: 64px; }
.create-section { margin-bottom: 24px; }
.create-section-title { margin: 0 0 8px; font-size: 17px; line-height: 22px; font-weight: 600; }
/* Room above the row for the tiles' crowns, which an overflowing row would clip. */
.create-row { display: flex; justify-content: center; gap: 16px; margin-top: -6px; padding-top: 6px; }
.create-row.scrolls { justify-content: safe center; overflow-x: auto; scrollbar-width: none; }
.create-row.start { justify-content: flex-start; }
.create-row::-webkit-scrollbar { display: none; }
.action-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 76px; flex: none; padding: 0; border: none; background: none; color: inherit; cursor: pointer; }
.action-tile-card {
    position: relative;
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 16px;
    background: light-dark(#ffffff, #2f2f2f);
    box-shadow: 0 3px 6px light-dark(#adb2bf66, #000000);
    color: var(--ink);
}
.action-tile-card > .icon svg { width: 32px; height: 32px; }
.badge-crown.tile-crown { top: -6px; inset-inline-end: -6px; }
.action-tile-label { font-size: 12px; line-height: 16px; text-align: center; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.action-tile:hover .action-tile-card { filter: brightness(0.97); }

.size-tile { display: flex; flex-direction: column; align-items: center; width: 80px; flex: none; padding: 0; border: none; background: none; color: inherit; cursor: pointer; }
.size-tile:active .size-box { transform: scale(0.96); }
.size-box { display: flex; align-items: flex-end; justify-content: center; width: 80px; height: 80px; }
.size-shape {
    display: grid;
    place-items: center;
    padding: 5px;
    border-radius: 16px;
    background: var(--hover);
    color: var(--ink);
    font-size: 10px;
    line-height: 11.9px;
    white-space: pre-line;
    text-align: center;
    overflow: hidden;
}
.size-shape svg { width: var(--icon-size, 20px); height: var(--icon-size, 20px); }
.size-tile:hover .size-shape { background: color-mix(in srgb, var(--hover) 85%, var(--ink)); }
/* As the app: the label wraps in the 80 px column and only its first line shows. */
.size-label { width: 80px; max-height: 18px; padding-top: 5px; font-size: 11px; line-height: 13px; font-weight: 500; text-align: center; overflow: hidden; }

.create-page { --recent-w: 76px; --recent-h: 100px; }
.recent-tile { display: flex; flex-direction: column; gap: 8px; width: var(--recent-w); flex: none; }
.recent-cover { display: grid; place-items: center; width: var(--recent-w); height: var(--recent-h); }
/* The design's shape at the box's width or height, whichever it meets first. */
.recent-card {
    width: min(var(--recent-w), calc(var(--recent-h) * var(--aspect, 1)));
    height: min(var(--recent-h), calc(var(--recent-w) / var(--aspect, 1)));
    border-radius: 12px;
    background: var(--hover);
    overflow: hidden;
}
.recent-card img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Create's arrows sit level with the cards, below the 6 px the row keeps for their shadows. */
.create-row ~ .row-arrow { top: 46px; }
.create-row.start ~ .row-arrow { top: calc(6px + var(--recent-h) / 2); }
.recent-name { font-size: 12px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.custom-size-fields { display: flex; gap: 12px; }
.size-field { display: flex; flex-direction: column; gap: 6px; flex: 1; font-size: 13px; color: var(--ink-muted); }

/* ---------- Settings (SettingsScreen in the app's dialog sheet card) ---------- */

.sheet-card-overlay { align-items: center; padding: 16px; background: #00000099; }
.sheet-card {
    position: relative;
    width: min(488px, calc((100vh - 32px) * 9 / 16), 100%);
    height: min(868px, calc(100vh - 32px));
    overflow-y: auto;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: var(--paper);
    animation: sheet-up 300ms ease-out;
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-card-close { position: sticky; top: 0; z-index: 1; display: flex; justify-content: flex-end; height: 64px; padding: 15px 16px 0; pointer-events: none; }
.sheet-card-close .close-button { width: 32px; height: 32px; background: var(--tertiary); pointer-events: auto; }
.settings-group { margin: 0 16px 16px; border-radius: 24px; background: var(--grouped); overflow: hidden; }
.settings-row {
    display: flex;
    align-items: center;
    width: 100%;
    height: 52px;
    padding-inline: 16px;
    border: none;
    background: none;
    color: var(--ink);
    text-align: start;
    cursor: pointer;
}
.settings-row:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.settings-tile { display: grid; place-items: center; width: 32px; height: 32px; flex: none; margin-inline-end: 8px; border-radius: 8px; color: #ffffff; }
.settings-tile svg { width: 20px; height: 20px; }
.settings-label { flex: 1; padding-inline: 8px; font-size: 16px; line-height: 21px; }
.settings-value { padding-inline-end: 4px; color: var(--ink-muted); font-size: 16px; line-height: 21px; }
.settings-chevron { display: inline-flex; color: var(--tab); }
.settings-chevron svg { width: 20px; height: 20px; }
[dir="rtl"] .settings-chevron svg { transform: scaleX(-1); }
.settings-divider { height: 0.8px; margin-inline: 56px 16px; background: light-dark(#bcbcbc1e, #5e5e5e34); }
.spinner.small { width: 18px; height: 18px; border-width: 2px; }
.settings-version { margin: 24px 0 16px; text-align: center; color: var(--ink); font-size: 12px; line-height: 16px; }

/* The app's SettingsPickerDialog. */
.picker-overlay { z-index: 60; }
.dialog.picker-dialog { width: min(560px, calc(100% - 32px)); padding: 16px; border-radius: 24px; background: var(--tertiary); }
.picker-dialog h2 { margin: 0; padding: 8px; font-size: 17px; line-height: 22px; font-weight: 600; }
.picker-row { display: flex; align-items: center; gap: 8px; padding: 12px 8px; border-radius: 12px; font-size: 17px; line-height: 22px; cursor: pointer; }
.picker-row:hover { background: var(--hover); }
.picker-row input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }

/* ---------- Drop target ---------- */

.drop-overlay {
    position: fixed;
    inset: 12px;
    z-index: 1006;
    border: 3px dashed var(--accent);
    border-radius: 24px;
    background: color-mix(in srgb, var(--paper) 86%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    font-weight: 600;
    pointer-events: none;
}

/* ---------- Purpose of use ---------- */
.purpose-sheet, .purpose-picker { display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.purpose-picker { height: auto; max-height: min(868px, calc(100vh - 32px)); gap: 0; padding: 0; overflow: hidden; }
.purpose-skip-row { display: flex; justify-content: flex-end; }
.purpose-skip { padding: 8px 12px; border: none; border-radius: 8px; background: none; color: var(--ink-muted); font: inherit; cursor: pointer; }
.purpose-skip:hover { background: var(--hover); }
.purpose-title { margin: 0; }
.purpose-subtitle { margin: 0; color: var(--ink-muted); }
.purpose-options { display: flex; flex-direction: column; gap: 10px; }
.purpose-option { display: flex; align-items: center; gap: 8px; min-height: 72px; padding: 10px 16px; border: 2px solid transparent; border-radius: 24px; background: var(--grouped); color: var(--ink); font: inherit; text-align: start; cursor: pointer; transition: border-color 150ms ease-out; }
.purpose-option.selected { border-color: var(--accent); }
.purpose-option:focus-visible { outline: none; }
.purpose-option-icon { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: #ffffff; }
.purpose-option-svg, .purpose-option-svg svg { display: block; width: 20px; height: 20px; }
.purpose-option-text { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; }
.purpose-option-title { font-size: 16px; line-height: 21px; font-weight: 500; }
.purpose-option-subtitle { font-size: 13px; line-height: 18px; }
.purpose-mark { display: grid; flex: none; place-items: center; box-sizing: border-box; width: 20px; height: 20px; margin: 2px; border: 1.5px solid var(--ink-faint); border-radius: 50%; color: #ffffff; }
.purpose-mark.picked { border: none; background: var(--accent); animation: purpose-mark-in 150ms ease-out; }
@keyframes purpose-mark-in { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: none; } }
.purpose-mark-tick, .purpose-mark-tick svg { display: block; width: 20px; height: 20px; }
.purpose-footer { margin: 0; padding-inline: 16px; color: var(--ink-muted); font-size: 12px; }
.purpose-continue { align-self: stretch; }
.purpose-continue:disabled { opacity: 0.4; cursor: default; }
.purpose-picker-bar { flex: none; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 8px 16px; }
.purpose-picker-bar .close-button { width: 32px; height: 32px; }
.purpose-picker-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.purpose-picker-bar h2 { flex: 1; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin: 0; padding-inline: 8px; font-size: 17px; line-height: 22px; font-weight: 500; text-align: center; }
.purpose-apply { display: grid; flex: none; place-items: center; width: 32px; height: 32px; padding: 0; border: none; border-radius: 50%; background: var(--accent); color: #ffffff; cursor: pointer; }
.purpose-apply svg { width: 18px; height: 18px; }
.profile-row.purpose-row { background: var(--grouped); }
.purpose-row-icon { display: grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #a278f1; }
/* Over .profile-row svg, which tints the row's icons grey. */
.purpose-row .purpose-row-icon svg { width: 20px; height: 20px; color: #ffffff; }
.purpose-row > .icon svg { width: 20px; height: 20px; }
.purpose-row-value { overflow: hidden; color: var(--ink-muted); text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Responsive ---------- */

/* The app's compact rail (600 to 839): icons with small labels, My Designs as one destination. */
.compact-only { display: none !important; }
@media (max-width: 839px) {
    :root { --nav-w: 88px; }
    .top-bar.create-bar { display: none; }
    .side-nav { align-items: center; padding-inline: 8px; }
    .create-button span, .side-section-title, .side-scroll .designs-group { display: none; }
    .compact-only { display: flex !important; }
    .brand { padding-inline: 0; }
    .create-button { width: 56px; height: 56px; padding: 0; margin-inline: 0; }
    .nav-item { flex-direction: column; justify-content: center; gap: 4px; width: 72px; padding: 8px 0; font-size: 10px; line-height: 12px; }
    .nav-item > span:last-child { white-space: normal; text-align: center; }
    .side-footer { flex-direction: column; }
    .top-bar-title { font-size: 28px; line-height: 34px; }
    /* Too narrow for both: the title stays, Search is a tab beside it. */
    .top-bar-title:not(.home-title) + .search-box { display: none; }
}

@media (max-width: 599px) {
    :root { --top-h: 64px; --row-h: 188px; }
    .frame { grid-template-columns: minmax(0, 1fr); }
    .side-nav { display: none; }
    .top-bar { gap: 8px; justify-content: space-between; }
    .top-bar .search-box { display: none; }
    .top-bar .brand-mobile { display: flex; margin-inline-end: auto; }
    .top-bar .brand-mobile.titled { display: none; }
    .top-bar-title { font-size: 22px; line-height: 28px; }
    .brand-mobile img { width: 40px; height: 40px; border-radius: 50%; }
    /* Fixed, not sticky: a sticky bar in the page could sit under the browser's bar while that shows. */
    .bottom-tabs {
        position: fixed;
        inset-inline: 0;
        bottom: 0;
        padding-bottom: env(safe-area-inset-bottom, 0px);
        z-index: 20;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        align-items: center;
        background: color-mix(in srgb, var(--paper) 92%, transparent);
        backdrop-filter: blur(14px);
        border-top: 1px solid var(--line);
    }
    .bottom-tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 10px; font-size: 11px; color: var(--tab); }
    .bottom-tabs a svg { width: 22px; height: 22px; }
    .bottom-tabs a[aria-current="page"] { color: var(--accent); }
    .bottom-tabs .create-tab {
        grid-row: 1;
        grid-column: 3;
        display: grid;
        place-items: center;
        justify-self: center;
        width: 36px;
        height: 36px;
        border: none;
        border-radius: 50%;
        background: var(--accent);
        color: #ffffff;
        cursor: pointer;
    }
    .bottom-tabs .create-tab svg { width: 20px; height: 20px; }
    .large-title { font-size: 28px; line-height: 34px; }
}
.brand-mobile { display: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Large windows: the web design (Figma Andalusi-Website: Templates, Search, AI Tools) ---------- */

/* Upgrade, for a free account. */
.upgrade-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 40px;
    flex: none;
    padding-inline: 8px 12px;
    border: none;
    border-radius: 999px;
    background: var(--saffron);
    color: #000000;
    font-size: 17px;
    line-height: 22px;
    white-space: nowrap;
    cursor: pointer;
}
.upgrade-button:hover { filter: brightness(1.04); }
.upgrade-button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.upgrade-button svg { width: 24px; height: 24px; }
.top-bar-title.home-title, .tab-sizer, .design-more, .empty-art, .selection-radio { display: none; }

@media (min-width: 840px) {
    :root { --nav-w: 210px; }

    /* Sidebar: 16 px around and between its parts, 32 px rows. */
    .side-nav { gap: 16px; padding: 16px; }
    .brand { padding: 0; padding-inline-start: 12px; }
    .brand img { width: 44px; height: 44px; padding: 6px; border-radius: 12px; background: var(--tertiary); box-shadow: 0 0 4px #00000029; }
    .create-button { gap: 4px; height: 54px; margin: 0; padding-inline: 18px 20px; background: #f55772; box-shadow: -3px 2px 3.5px #00000030; font-size: 15px; line-height: 22px; font-weight: 600; }
    .side-scroll nav { gap: 16px; }
    .side-section-title { padding: 24px 0 16px; color: var(--ink); font-size: 11px; line-height: 13px; font-weight: 600; }
    .nav-item { height: 32px; padding: 0 12px; border-radius: 10px; color: var(--ink); font-size: 16px; line-height: 21px; }
    .nav-item svg { width: 24px; height: 24px; }
    /* The icons sit 16 px from the bottom edge; their 48 px buttons reach past it. */
    .side-footer { gap: 4px; padding: 0; margin-block-end: -12px; }

    /* Top bar: the page title, then search, Upgrade and the avatar 16 px apart, 14 px above and below. */
    .top-bar { height: 72px; gap: 16px; padding-inline: 16px; }
    .top-bar-title, .top-bar-title.home-title { display: block; font-size: 28px; line-height: 34px; }
    .top-bar .search-box, .top-bar-title + .search-box { flex: 0 1 343px; width: 343px; min-width: 200px; margin: 0; align-self: center; }
    .top-bar .search-field { height: 44px; }
    .top-bar .search-input { font-size: 14px; }
    .top-bar .key-hint { display: none; }
    .account-menu-anchor { margin: 0; }
    /* Search's field is the top bar's. */
    .search-bar { display: none; }

    /* Home's categories: 12 px labels 16 px apart, the current one 13 px on its 28 px pill. Each tab
       is as wide as its pill would be (the hidden 13 px copy), so changing tabs moves nothing. */
    .home-tabs { align-items: center; gap: 16px; margin-bottom: 12px; }
    .home-tabs-box { margin-bottom: 12px; }
    .home-tab:not(.heart-tab) { display: inline-grid; place-items: center; height: 32px; padding-inline: 8px; }
    .home-tab > .tab-label, .home-tab > .tab-sizer { grid-area: 1 / 1; }
    .home-tab .tab-label { font-size: 12px; line-height: 12px; font-weight: 500; }
    .home-tab .tab-sizer { display: block; visibility: hidden; font-size: 13px; line-height: 18px; font-weight: 400; }
    .home-tab[aria-current="page"] { height: 28px; }
    .home-tab[aria-current="page"] .tab-label { font-size: 13px; line-height: 18px; font-weight: 400; }
    .home-tab.heart-tab { width: 24px; height: 32px; padding: 0; }

    /* The calligraphy banner, 32 px in from the page's edges; a titled section opens 20 px above its title. */
    #content .tool-banner { margin-inline: 32px; }
    #content .tool-banner-title { font-weight: 600; }
    #content .section-head:has(.section-title) { padding-top: 20px; }
    /* A block with nothing to show would still leave its header's 12 px. */
    #content .section:has(> .section-head:only-child > .section-text:only-child:empty) { display: none; }
    #content .section-title { font-weight: 600; }

    /* Pages' cards (the editor's pickers keep the app's sheet): 12 px corners; a grid that does not scroll lays them
       out 120 px wide, 8 px apart. */
    #content .card .card-clip, #content .card .card-link, #content .card.browse .card-clip, #content .card.browse .card-link, .skeleton-card { border-radius: 12px; }
    #content .wrapped-grid { grid-template-columns: repeat(auto-fill, 120px); gap: 8px; }

    /* A feed's first loading, before it was ever drawn: the design's outline of it. */
    .feed-skeleton .section-head { height: 42px; padding: 20px 0 0; align-items: center; }
    .feed-skeleton .skeleton-title { height: 18px; }
    .feed-skeleton .skeleton-shelf { height: 214px; margin: 16px 0; }
    .feed-skeleton .skeleton-shelf .skeleton-card { aspect-ratio: 120 / 214 !important; }
    .feed-skeleton .skeleton-shelf.catalogue { height: 159px; gap: 16px; }
    .feed-skeleton .skeleton-shelf.catalogue .skeleton-card { aspect-ratio: 273 / 159 !important; border-radius: 16px; }
    .home-tabs .skeleton-tab { width: 56px; height: 14px; padding: 0; border-radius: 7px; }
    #shell .justified { gap: 8px; }
    #shell .justified > .card { width: 120px; height: 214px; border-radius: 12px; }
    #shell .shell-title { display: block; width: 160px; height: 28px; margin-inline-end: auto; border-radius: 14px; }
    #shell .shell-store { display: block; width: 104px; height: 40px; border-radius: 20px; }
    #shell .shell-avatar { display: block; width: 32px; height: 32px; border-radius: 50%; }
    #shell .side-section-title .skeleton-line { width: 72px; height: 11px; }
    #content .feed-masonry > .masonry-lane { flex: 0 0 120px; }

    /* My Designs (Figma 2978-9165, 2936-5024): the top bar's 72 px, "..." then the plan and the avatar 16 px apart. */
    .designs-header { height: 72px; }
    .designs-header .large-title { font-size: 28px; line-height: 34px; }
    .header-actions { gap: 16px; margin-inline-end: 0; }
    .header-actions .account-menu-anchor { margin-inline-end: 0; }
    .header-actions > .icon-button:not(.phone-only) { order: -2; }
    .header-actions > .menu-anchor:not(.account-menu-anchor) { order: -1; }
    .header-actions > .account-menu-anchor { order: 1; }
    .header-actions > .icon-button:not(.phone-only), .header-actions > .menu-anchor:not(.account-menu-anchor) > .icon-button { width: 44px; height: 44px; background: var(--mist); color: var(--ink); }
    /* All, Folders, Library: 34 px chips, the current one on the pill. */
    .designs-tab { padding-inline: 12px; background: var(--grouped); box-shadow: none; font-size: 13px; line-height: 18px; letter-spacing: 0; font-weight: 500; }
    .designs-tab[aria-current="page"] { background: var(--chip-pill); box-shadow: 0 0 2px #0000001a, 0 1px 8px #0000001f; }
    /* Cards: 120 px lanes 8 px apart (DesignsPage), the cover's 8 px corners, the name in 11 px under it. */
    .designs-grid { padding: 8px 0 16px; }
    .design { position: relative; }
    .design-cover { box-shadow: 0 0 0 1px var(--card-line); }
    .design-title { color: var(--ink-secondary); font-size: 11px; line-height: 13px; }
    .design-title-bone { display: block; width: 64px; height: 11px; margin: 1px auto; border-radius: 6px; }
    .design-more {
        position: absolute;
        inset-inline-end: 6px;
        bottom: 27px; /* 6 px above the cover's bottom: the 13 px name and the 8 px gap under it */
        z-index: 2;
        display: grid;
        place-items: center;
        width: 24px;
        height: 24px;
        padding: 0;
        border: none;
        border-radius: 50%;
        background: light-dark(#ffffff66, #00000066);
        backdrop-filter: blur(1.5px);
        color: var(--ink);
        cursor: pointer;
    }
    .design-more svg { width: 16px; height: 16px; }
    /* Selecting: the design's 24 px radio, 6 px in from the cover's bottom start. */
    .selection-mark, .selection-mark.checked { inset-inline-start: 6px; bottom: 6px; width: 24px; height: 24px; border: none; background: light-dark(#ffffff66, #00000066); color: var(--ink); }
    .selection-mark.checked { color: var(--accent); }
    /* The app's tick (IconView sets its display inline) gives way to the radio; the radio alone marks a chosen card. */
    .selection-mark > .icon { display: none !important; }
    .design.selected .design-cover { outline: none; }
    .selection-mark .selection-radio { display: inline-flex; }
    .selection-mark .selection-radio svg { width: 16px; height: 16px; }
    /* Create Design (Figma 2968-9801): the top bar carries the title; sections open like the feed's, rows from the start. */
    .create-page > .large-title, .top-bar.create-bar .search-box { display: none; }
    .create-section { margin-bottom: 16px; }
    .create-section-title { margin: 0; padding: 20px 0 12px; line-height: 26px; }
    .create-row, .create-row.scrolls { justify-content: flex-start; gap: 24px; }
    .create-section:nth-of-type(3) .create-row { gap: 16px; }
    .action-tile-card { background: var(--tertiary); box-shadow: 0 2px 12px #0000001f; }
    .action-tile-label { font-size: 12px; line-height: 12px; font-weight: 500; }
    /* A size is as wide as its shape or its name, 24 px from the next. */
    .size-tile, .size-box, .size-label { width: auto; min-width: 43px; }
    .size-label { white-space: nowrap; font-size: 12px; line-height: 12px; padding-top: 8px; max-height: none; }
    /* Recent Designs: a 64 x 113 box, the card in it in the design's shape. */
    .create-page { --recent-w: 64px; --recent-h: 113px; }
    /* The cards' 1 px line drawn inside: the row clips at its first card's edge. */
    .recent-card { border-radius: 8px; background: var(--card); outline: 1px solid var(--card-line); outline-offset: -1px; }
    .recent-name { color: var(--ink-secondary); font-size: 11px; line-height: 13px; text-align: center; }

    /* Folders (Figma 2936-7014): 172.5 px tiles 24 px apart; Create Folder on the grey fill with its 32 px plus. */
    .folder-grid:not(.in-sheet) { grid-template-columns: repeat(auto-fill, 172.5px); gap: 24px; }
    /* Level with the folders' art: the app's folder shape keeps its top 22 of 145 for a cover peeking out. */
    .folder-grid:not(.in-sheet) .create-folder { margin-top: calc(100cqw * 22 / 172); height: calc(100cqw * 123 / 172); border-radius: 12px; background: var(--mist); color: var(--ink-secondary); font-size: 15px; line-height: 20px; letter-spacing: 0.23px; font-weight: 400; }
    .folder-grid:not(.in-sheet) .create-folder svg { width: 32px; height: 32px; }
    .folder-grid:not(.in-sheet) .folder-name { color: var(--ink-secondary); }
    /* The empty folder, and All designs with none yet: the illustration, the nudge and Add Designs, centred under the tabs. */
    .empty-state { min-height: calc(100dvh - 122px); padding: 0; }
    .empty-state .empty-icon { display: none; }
    .empty-state .empty-art { display: block; margin-bottom: 24px; }
    .empty-state h2 { margin: 0 0 4px; font-size: 17px; line-height: 22px; font-weight: 600; }
    .empty-state p { max-width: 254px; margin: 0 0 24px; color: var(--ink-secondary); font-size: 15px; line-height: 20px; letter-spacing: 0.23px; }
    .empty-state .button { height: 38px; padding-inline: 12px; font-size: 17px; line-height: 22px; font-weight: 400; }
}

/* ---------- Editor frame ---------- */

/* Booted early and kept full size while hidden: a zero-size frame would not lay out or compose the
   app, and display:none would stop its frames. Opacity hides it; inert keeps focus out. */
.editor-frame {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    z-index: 1000;
    background: #f9f9f9;
}
:root[data-theme="dark"] .editor-frame { background: #000000; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .editor-frame { background: #000000; } }
html:not(.editor-open) .editor-frame { opacity: 0; pointer-events: none; z-index: -1; }
/* A design link: the editor's loading screen from the first paint, not the Home skeleton under it. */
html.editor-boot #shell { display: none; }
/* A calligraphy style's link: the AI editor's page until the editor is up, just under it. */
#ai-editor-cover { display: none; }
html.opening-ai-editor #ai-editor-cover {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--stage);
}
/* A link that opens a sheet or the plans over Home: the app's frame and a spinner, not Home's skeleton. */
#shell .shell-wait { display: none; }
html.opening-link #shell .home-tabs, html.opening-link #shell .home-tabs-box, html.opening-link #shell .justified { display: none; }
html.opening-link #shell .shell-wait { display: flex; justify-content: center; padding-top: 30vh; }
html.shell-page #shell .home-tabs, html.shell-page #shell .home-tabs-box { display: none; }
/* The page holds still under the editor, a popup or the plans: the wheel never reaches it, and its
   scrollbar does not show beside theirs. */
html.editor-open body, html:has(.overlay, .plans-screen, .ai-editor) body { overflow: hidden; }

/* ---------- My Designs: sync, card menu, export, cloud sheet, Library ---------- */

/* The app's ProjectCard extras: the duration pill and the sync badge (SyncStateBadge). */
.duration-pill { position: absolute; inset-inline-start: 4px; bottom: 4px; padding: 2px 4px; border-radius: 999px; background: #00000066; color: #ffffff; font-size: 9px; line-height: 11px; font-weight: 700; }
.sync-badge { position: absolute; top: 4px; inset-inline-end: 4px; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #00000066; color: #ffffff; }
.sync-badge.alert { background: var(--accent); }
.sync-badge > .icon svg { width: 12px; height: 12px; }
.sync-badge > * { grid-area: 1 / 1; }
.sync-badge-arrow svg { width: 8px; height: 8px; display: block; }
.sync-badge-mark { font-size: 12px; line-height: 16px; font-weight: 700; }

.progress-ring { display: inline-block; flex: none; }
.progress-ring > span { display: block; width: 100%; height: 100%; }
.progress-ring svg { display: block; width: 100%; height: 100%; }
.progress-ring circle { fill: none; stroke-width: 4; stroke-linecap: round; }
.progress-ring .track { stroke: #78788029; }
.progress-ring .arc { stroke: url(#progress-ring-gradient); stroke-dasharray: 100 100; stroke-dashoffset: calc(100 - var(--progress)); transition: stroke-dashoffset 300ms ease-out; }
.progress-ring .spinner { width: 100%; height: 100%; border-width: 4px; border-color: #78788029; border-top-color: var(--accent); }

/* The app's SyncRow above the designs grid. */
.sync-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    /* The app's 68dp: room for the storage line in every state and the placeholder, so a change never moves the grid. */
    min-height: 68px;
    margin-top: 16px;
    padding: 12px 16px;
    border: none;
    border-radius: 16px;
    background: var(--grouped);
    color: var(--ink);
    text-align: start;
    cursor: pointer;
}
.sync-row:hover { background: color-mix(in srgb, var(--grouped) 94%, var(--ink)); }
.sync-row-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.sync-row-title { font-size: 17px; line-height: 22px; font-weight: 600; }
.sync-row.failed .sync-row-title { color: var(--accent); }
.sync-row-storage { margin-top: 2px; color: var(--ink-muted); font-size: 13px; line-height: 18px; }
.sync-row-count { color: var(--ink-muted); font-size: 13px; line-height: 18px; white-space: nowrap; }
.sync-row-icon { display: grid; flex: none; place-items: center; width: 24px; height: 24px; color: var(--ink-muted); }
.sync-row-icon.alert { color: var(--accent); }
.sync-row-icon svg { width: 24px; height: 24px; display: block; }
.sync-row-icon svg path:not([fill="none"]) { fill: currentColor; }
.sync-row-icon svg path[stroke] { stroke: currentColor; }
.sync-row-chevron { display: grid; color: var(--ink-faint); }
.sync-row-chevron svg { width: 16px; height: 16px; }
[dir="rtl"] .sync-row-chevron svg { transform: scaleX(-1); }

/* The app's ProjectContextMenu: denser rows than the top bar menus, at least 210 px wide. */
.menu.context { min-width: 210px; }
.menu.context .menu-item { min-height: 44px; height: 44px; font-size: 16px; line-height: 21px; }
.menu.context .menu-item svg { width: 22px; height: 22px; }
.menu.context .menu-divider { margin-block: 0; }
.menu-item:disabled { opacity: 0.4; cursor: default; }
/* A large window: the web design's menus (Figma 2978-9194, 2980-10420), after the app's context menu rows above. */
@media (min-width: 840px) {
    /* A 240 px card, 16 px inside, 40 px rows 4 px apart. */
    .designs-header .menu:not(.account-menu), .menu.context { width: 240px; max-width: 240px; padding: 16px; gap: 4px; border-radius: 28px; box-shadow: 0 16px 40px -6px #0000001f, 0 6px 16px -4px #0000000f; }
    .designs-header .menu:not(.account-menu) .menu-item, .menu.context .menu-item { gap: 8px; min-height: 40px; height: 40px; margin-inline: -8px; padding-inline: 8px; border-radius: 10px; font-size: 17px; line-height: 20px; letter-spacing: -0.43px; }
    .designs-header .menu:not(.account-menu) .menu-item > .icon, .menu.context .menu-item > .icon { width: 28px; }
    .designs-header .menu:not(.account-menu) .menu-item svg, .menu.context .menu-item svg { width: 20px; height: 20px; }
    .designs-header .menu:not(.account-menu) .menu-divider, .menu.context .menu-divider { height: 1px; margin-block: 8px; background: var(--line); }
    .designs-header .menu:not(.account-menu) .menu-section { padding: 0; color: var(--tab); font-size: 13px; line-height: 18px; font-weight: 400; }
    /* The card menu as designed: no name over it, one divider, before Delete. */
    .menu.context .menu-header, .menu.context > .menu-divider:not(:last-of-type) { display: none; }
}
/* The app's SelectCheckIcon: Select Designs and the sort menu's current choice. */
.select-circle { display: grid; place-items: center; width: 20px; height: 20px; margin: 2px; flex: none; border-radius: 50%; background: var(--ink); color: var(--grouped); }
.menu-item .select-circle svg { width: 18px; height: 18px; }
.menu-item:disabled:hover { background: transparent; }

/* The app's ExportingDialog. */
.exporting-overlay { background: var(--scrim); }
.exporting-dialog { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px 32px; border-radius: 16px; background: var(--tertiary); color: var(--accent); }
.exporting-title { color: var(--ink); font-size: 16px; line-height: 21px; }
.button.quiet { background: var(--hover); color: var(--ink); }

/* The app's cloud sheet (CloudSheet) in the large-window dialog card, as tall as what it holds. */
.cloud-sheet { padding-bottom: 24px; }
@media (min-width: 600px) { .sheet-card.cloud-sheet { height: auto; max-height: min(868px, calc(100vh - 32px)); } }
.cloud-head { position: relative; display: flex; align-items: center; justify-content: center; padding: 16px; }
.cloud-title { font-size: 20px; line-height: 25px; font-weight: 700; }
.cloud-head .close-button { position: absolute; inset-inline-end: 16px; }
.cloud-body { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 16px; }
/* Settings' Sync shows the same content in its panel, which has its own margins. */
.settings-dialog .cloud-body { padding: 0; }
.cloud-status { display: flex; flex-direction: column; align-items: center; padding-top: 8px; text-align: center; }
.cloud-status-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--hover); color: var(--ink); }
.cloud-status-icon svg { width: 32px; height: 32px; display: block; }
.cloud-status-icon .progress-ring { color: var(--accent); }
.cloud-status-icon .progress-ring svg { width: 100%; height: 100%; }
.cloud-status h2 { margin: 12px 0 0; font-size: 17px; line-height: 22px; font-weight: 600; }
.cloud-status h2.failed { color: var(--accent); }
.cloud-status p { margin: 4px 0 0; color: var(--ink-muted); font-size: 15px; line-height: 20px; }
/* The glyphs carry their own black and red; dark mode draws them in one light colour, as the app. */
:root[data-theme="dark"] .cloud-status-icon svg path:not([fill="none"]) { fill: currentColor; }
:root[data-theme="dark"] .cloud-status-icon svg path[stroke] { stroke: currentColor; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .cloud-status-icon svg path:not([fill="none"]) { fill: currentColor; }
    :root:not([data-theme="light"]) .cloud-status-icon svg path[stroke] { stroke: currentColor; }
}
.cloud-storage { width: 100%; padding: 16px; border-radius: 24px; background: var(--grouped); }
.cloud-storage h2 { margin: 0; font-size: 17px; line-height: 22px; font-weight: 600; }
.cloud-storage .button.outlined { margin-top: 12px; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.storage-row { display: flex; align-items: center; margin-top: 12px; color: var(--ink-muted); font-size: 13px; line-height: 18px; }
.storage-row > span:first-child { flex: 1; }
.storage-bar { position: relative; height: 8px; margin-top: 8px; border-radius: 999px; background: #78788029; overflow: hidden; }
.storage-bar > span { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 999px; background: var(--accent); }
.linear-progress { position: relative; height: 2px; background: #78788029; overflow: hidden; }
.linear-progress.running::after { content: ""; position: absolute; inset-block: 0; width: 40%; background: var(--accent); animation: linear-run 1.2s ease-in-out infinite; }
.storage-bar.linear-progress { height: 8px; }
@keyframes linear-run { from { inset-inline-start: -40%; } to { inset-inline-start: 100%; } }
.plan-free { padding: 4px 10px; border-radius: 999px; background: var(--accent); color: #ffffff; font-size: 12px; line-height: 16px; font-weight: 600; }
.plan-wordmark svg { width: 60px; height: 24px; display: block; }
/* The app's plan badges: a crown on the plan's pill. Pro and Max are drawn wordmarks; Free is the same crown on gray. */
.plan-badge { position: relative; display: inline-flex; height: 24px; flex: none; }
.plan-badge > .icon svg { width: auto; height: 24px; display: block; }
.plan-badge.free { color: #a4a4a6; padding-inline-start: 12px; }
.plan-badge.free > .icon { position: absolute; inset-block-start: 0; inset-inline-start: 0; z-index: 1; }
.plan-badge.free > .icon svg { width: 26px; }
.plan-badge-label {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding-inline: 18px 10px;
    border-start-end-radius: 12px;
    border-end-end-radius: 12px;
    border-start-start-radius: 1px;
    background: #a4a4a6;
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.cloud-upgrade { width: 100%; height: 48px; margin-top: 16px; background: var(--paper); color: var(--accent); font-size: 17px; }
.cloud-enable { width: 100%; height: 48px; font-size: 17px; }
.cloud-not-synced { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-muted); font-size: 13px; line-height: 18px; }
.cloud-not-synced svg { width: 16px; height: 16px; }

/* The app's Library page (LibraryPage). */
.library-grid { padding: 16px 0; }
.library-tile { position: relative; display: block; border-radius: 8px; background: var(--hover); overflow: hidden; cursor: pointer; }
.library-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.library-tile.selected { outline: 2px solid var(--accent); outline-offset: 2px; }
.library-end { height: 1px; }
.library-message h2 { margin-bottom: 8px; }
.library-message p { margin-bottom: 24px; }
.sheet-empty { min-height: 320px; }

/* ---------- Favourites ---------- */

/* The app's FavoriteButton: a translucent circle at the card's bottom end; on, a red heart that bounces. */
.favorite-heart {
    position: absolute;
    bottom: 8px;
    inset-inline-end: 8px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: color-mix(in srgb, var(--paper) 40%, transparent);
    color: var(--ink);
    cursor: pointer;
    transition: color 200ms ease;
}
.favorite-heart svg { width: 16px; height: 16px; display: block; }
.favorite-heart.on { color: var(--accent); }
.card .favorite-heart { z-index: 4; }
.favorite-heart.on.bounce svg { animation: heart-bounce 320ms ease-out; }
.favorite-heart:hover { background: color-mix(in srgb, var(--paper) 65%, transparent); }
.favorite-heart.large { position: static; flex: none; width: 50px; height: 50px; background: var(--hover); }
.favorite-heart.large svg { width: 24px; height: 24px; }
@keyframes heart-bounce { 0% { transform: scale(1); } 35% { transform: scale(1.15); } 65% { transform: scale(0.92); } 100% { transform: scale(1); } }

/* The app's GridItemContextMenu: 220 px, body rows with 24 px icons. */
.menu.feed-menu { width: 220px; }
.menu.feed-menu .menu-item svg { width: 24px; height: 24px; }

/* The app's EmptyFavoriteContent. */
.favorites-empty h2 { margin: 32px 16px 12px; }
.favorites-empty p { margin: 0 16px; }
.favorites-illustration svg { width: 170px; height: 217px; display: block; }
.dark-only { display: none !important; }
:root[data-theme="dark"] .dark-only { display: inline-flex !important; }
:root[data-theme="dark"] .light-only { display: none !important; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .dark-only { display: inline-flex !important; }
    :root:not([data-theme="light"]) .light-only { display: none !important; }
}

/* ---------- Sign in: the app's LoginScreen in its dialog card, over the editor frame too ---------- */
/* Any sheet can ask for sign in, so it opens over all of them. */
.login-overlay { z-index: 1004; }

/* An action waiting for the app to load: the page stays as it is underneath. */
.frame-wait { position: fixed; inset-inline: 0; bottom: 32px; z-index: 1006; display: flex; justify-content: center; pointer-events: none; }
.login-sheet { display: flex; flex-direction: column; align-items: center; overflow: hidden; background: var(--tertiary); }
.login-art { position: relative; flex: 1 1 0; min-height: 0; width: 100%; padding-block-end: 24px; }
.login-art img { width: 100%; height: 100%; object-fit: contain; object-position: top center; }
.login-close { position: absolute; top: 16px; inset-inline-end: 16px; }
/* Only the logo overlaps the artwork (its height plus the art's bottom padding), so the title stays clear of it. */
.login-column { width: min(361px, 100%); margin-top: -84px; padding: 0 16px; position: relative; }
.login-logo { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 16px; background: #ffffff; }
.login-logo img { width: 48px; height: 48px; }
.login-title { margin: 12px 0 0; color: var(--ink); font-size: 20px; line-height: 25px; font-weight: 500; }
.login-body { margin: 8px 0 16px; color: var(--ink-muted); font-size: 15px; line-height: 20px; }
.login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
    height: 40px;
    margin-block-end: 16px;
    border-radius: 999px;
    font: inherit;
    font-size: 17px;
    cursor: pointer;
}
.login-button .icon { width: 24px; height: 24px; }
/* Apple allows a black or a white button: the text colour on the page colour follows the theme. */
.login-button.apple { border: none; background: var(--ink); color: var(--paper); }
.login-button.facebook { border: none; background: #1977f3; color: #ffffff; }
.login-button.google { margin-block-end: 24px; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.login-button:disabled { opacity: 0.6; cursor: default; }
.login-terms { margin: 0 0 16px; color: var(--ink-muted); font-size: 12px; line-height: 16px; text-align: center; }
.login-terms a { color: inherit; text-decoration: none; }
.login-terms a:hover { text-decoration: underline; }
.login-loading { position: absolute; inset: 0; display: grid; place-items: center; background: #00000066; }
.login-button .icon svg { width: 100%; height: 100%; }
.login-sheet:focus { outline: none; }

/* The sync row's place before the frame reports, and the card badge's ring and arrow centred on each other. */
.sync-row.placeholder { cursor: default; pointer-events: none; }
.sync-badge-arrow { display: grid; place-items: center; width: 8px; height: 8px; }
.sync-badge-arrow .icon { display: block !important; width: 8px; height: 8px; }
.sync-badge-arrow svg { width: 100%; height: 100%; }
.sync-badge .progress-ring { display: block; }

/* The editor's Elements and Calligraphy sheets, drawn over the editor frame at its side panel's box. */
.picker-panel {
    position: fixed;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    background: var(--tertiary);
    color: var(--ink);
    box-shadow: var(--shadow);
    overflow: hidden;
    outline: none;
    /* Feed sections bleed to the page gutter; the panel has none. */
    --gutter: 0px;
}
/* The editor frame's dialog scrim over the picker (PickerCover), fading in with it. */
.picker-dim { position: absolute; inset: 0; z-index: 10; border-radius: inherit; opacity: 0; pointer-events: none; transition: opacity 150ms ease-out; }
.picker-dim.on { opacity: 1; }
/* A closed picker kept for its next opening (Picker.kept): out of sight, its scroll intact. */
.picker-panel.closed { visibility: hidden; pointer-events: none; }
.picker-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.picker-page[hidden] { display: none; }
.picker-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 16px 16px 8px; }
.picker-head.titled { padding-block: 18px 6px; }
.picker-title { flex: 1; min-width: 0; margin: 0; font-size: 17px; line-height: 22px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The app's SearchComponentUI: a 42 dp pill, the 24 dp glass, the text, a round clear once typed; no focus ring. */
.picker-search {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding-inline: 8px;
    border-radius: 999px;
    background: var(--mist);
    color: var(--ink-muted);
}
.picker-search > .icon { flex: none; display: grid; width: 24px; height: 24px; }
.picker-search > .icon svg { width: 100%; height: 100%; }
.picker-search-input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--ink); caret-color: var(--accent); font: inherit; font-size: 16px; outline: none; }
.picker-search-input::placeholder { color: var(--ink-faint); }
.picker-search-clear { flex: none; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: var(--line); color: var(--ink); cursor: pointer; }
.picker-search-clear svg { width: 12px; height: 12px; }
.picker-tabs { flex: none; display: flex; gap: 6px; padding: 4px 16px 8px; overflow-x: auto; scrollbar-width: none; }
.picker-tabs::-webkit-scrollbar { display: none; }
.picker-tab {
    flex: none;
    height: 32px;
    min-width: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding-inline: 10px;
    border: 0;
    border-radius: 16px;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}
.picker-tab:hover { background: var(--hover); }
.picker-tab[aria-pressed="true"] { background: var(--chip-pill); }
.picker-tab svg { width: 18px; height: 18px; }
.picker-tab .chip-icon { width: 18px; height: 18px; }
.picker-body { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 16px; container-type: inline-size; }
/* The Elements feed holds a hundred shelves: those out of view skip painting, which every frame of a playing tile redid. */
.picker-body > .section { content-visibility: auto; contain-intrinsic-size: auto 320px; }
.picker-results { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 8px 16px; }
@container (max-width: 500px) { .picker-results { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.picker-result { position: relative; aspect-ratio: 1; padding: 8px; border-radius: 12px; }
/* The loading picker: its sections' own head, shelf and grid, holding still; a title bone on the 22 px title
   line; tiles square with a card's 8% corner (.card-clip's 8cqmin). */
.picker-skeleton .shelf { overflow: hidden; }
.picker-skeleton .skeleton-title { width: 120px; height: 16px; margin-block: 3px; }
.picker-skeleton .skeleton-card { aspect-ratio: 1; border-radius: 8%; }
.picker-result > .skeleton-card { width: 100%; height: 100%; }
.picker-result:hover { background: var(--hover); }
.picker-result img, .picker-result-lottie { display: block; width: 100%; height: 100%; object-fit: contain; }
.lottie-cell { position: relative; }
/* The still sits under the live canvas until the player has drawn its first frame. */
.lottie-cell > canvas, .lottie-cell > .lottie-still { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.picker-result .pick-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
/* The editor's sheets show no focus ring, even moving with the keyboard, as the app. */
.picker-panel :focus-visible { outline: none !important; }
.picker-result .badge-crown { z-index: 2; }
.picker-result .favorite-heart { z-index: 3; }
/* Icons drawn in the label colour, as the app tints them. */
.picker-result.black img { filter: brightness(0); }
:root[data-theme="dark"] .picker-result.black img { filter: brightness(0) invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .picker-result.black img { filter: brightness(0) invert(1); } }
.pick-progress { position: absolute; inset-block-start: 50%; inset-inline-start: 50%; z-index: 4; width: 30px; height: 30px; display: grid; place-items: center; transform: translate(-50%, -50%); pointer-events: none; }
[dir="rtl"] .pick-progress { transform: translate(50%, -50%); }
.pick-progress svg { width: 100%; height: 100%; display: block; }
.pick-progress path { fill: none; stroke-width: 4; stroke-linecap: round; }
.pick-progress .track { stroke: #78788029; }
.pick-progress .arc { stroke: url(#pick-progress-gradient); stroke-dasharray: 100 100; stroke-dashoffset: calc(100 - var(--progress)); transition: stroke-dashoffset 300ms ease-out; }
.pick-progress .spinner { width: 30px; height: 30px; }
.picker-empty { margin: 0; padding: 40px 16px; text-align: center; color: var(--ink-muted); }
/* Giphy's "Powered by GIPHY" mark over results that hold its stickers, in the theme's ink. */
.giphy-badge { display: flex; align-items: center; height: 30px; padding: 0 16px; }
.giphy-badge img { height: 12px; width: auto; }
.giphy-badge .on-dark { display: none; }
:root[data-theme="dark"] .giphy-badge .on-light { display: none; }
:root[data-theme="dark"] .giphy-badge .on-dark { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .giphy-badge .on-light { display: none; }
    :root:not([data-theme="light"]) .giphy-badge .on-dark { display: block; }
}
.pick-link { padding: 0; border: 0; background: transparent; cursor: pointer; }

/* ---------- The app's photos gallery: Library, Featured and Unsplash, or Stock ---------- */
.stock-search { flex: none; display: flex; padding: 4px 16px 12px; }
.stock-library { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px 16px; text-align: center; color: var(--ink-muted); }
.stock-library > .icon { display: grid; width: 48px; height: 48px; }
.stock-library > .icon svg { width: 100%; height: 100%; }
.stock-library p { margin: 0 0 8px; font-size: 16px; line-height: 21px; }
.stock-library .button { height: 40px; padding-inline: 24px; }
.unsplash-grid { padding: 0 16px; }
.unsplash-photo { display: flex; flex-direction: column; }
.unsplash-frame { position: relative; overflow: hidden; border-radius: 12px; background-color: var(--mist); background-size: cover; background-position: center; }
.unsplash-frame img { display: block; width: 100%; height: 100%; object-fit: cover; }
.unsplash-frame .pick-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.unsplash-frame:has(.pick-progress)::after { content: ""; position: absolute; inset: 0; z-index: 2; background: #00000059; }
.unsplash-author { align-self: flex-start; max-width: 100%; height: 20px; padding-top: 4px; overflow: hidden; color: var(--ink-muted); font-size: 12px; line-height: 16px; font-weight: 500; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) and (pointer: fine) { .unsplash-author:hover { color: var(--ink); text-decoration: underline; } }
.stock-message { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 24px; text-align: center; }
.stock-message h2 { margin: 0; font-size: 20px; line-height: 25px; font-weight: 700; }
.stock-message p { margin: 0; max-width: 320px; color: var(--ink-muted); font-size: 16px; line-height: 21px; }

/* ---------- The app's own screens as sheets: What's New, Redeem, AI Credits, Profile ---------- */
.app-screen-overlay { z-index: 1001; }
/* Dialogs a screen opens (Redeem's success, Profile's delete) sit above it. */
.app-screen-layer { position: relative; z-index: 1003; }
.app-screen { display: flex; flex-direction: column; background: var(--paper); outline: none; }
.app-screen-loading { flex: 1; display: grid; place-items: center; padding: 48px; }
.dimmed { opacity: 0.4; }
.spinner.on-accent { border-color: #ffffff55; border-top-color: #ffffff; }

.whats-new { align-items: center; padding: 16px 16px 16px; }
.whats-new-page { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; }
.whats-new-title { margin: 0 0 24px; text-align: center; font-size: 36px; line-height: 45px; font-weight: 400; }
.whats-new-media { flex: 1; min-height: 0; aspect-ratio: 0.5625; max-width: 100%; border-radius: 20px; overflow: hidden; background: var(--soft); }
.whats-new-media video, .whats-new-media img { display: block; width: 100%; height: 100%; object-fit: contain; }
.whats-new-dots { display: flex; gap: 8px; margin-top: 16px; }
.whats-new-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink); opacity: 0.5; }
.whats-new-dot.current { opacity: 1; }
.whats-new-next { width: min(360px, 100% - 48px); height: 40px; margin-top: 16px; font-size: 17px; }

.redeem-subtitle { margin: 0 0 16px; font-size: 13px; line-height: 18px; }
.redeem-field {
    width: 100%;
    height: 52px;
    padding-inline: 20px;
    border: 1px solid transparent;
    border-radius: 24px;
    background: var(--hover);
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    caret-color: var(--accent);
    outline: none;
}
.redeem-field::placeholder { color: var(--ink-faint); }
.redeem-field:focus-visible { box-shadow: 0 0 0 2px var(--focus); }
.redeem-field.error { border-color: var(--accent); }
.redeem-notes { padding: 12px 4px 0; }
.redeem-notes p { margin: 0 0 4px; font-size: 12px; line-height: 16px; }
.redeem-error { color: var(--accent); }
.redeem-example { color: var(--ink-faint); }
.redeem-submit { width: 100%; min-height: 48px; font-size: 17px; }
.redeem-submit:disabled { opacity: 1; background: var(--hover); color: var(--ink-faint); cursor: default; }
.redeem-success { display: flex; flex-direction: column; align-items: center; width: min(320px, 100%); padding: 24px; border-radius: 24px; background: var(--tertiary); text-align: center; }
.redeem-success-art { width: 150px; height: 150px; margin-bottom: 16px; }
.redeem-success h2 { margin: 0; font-size: 17px; line-height: 22px; font-weight: 700; }
.redeem-success p { margin-top: 8px; color: var(--ink); font-size: 15px; }
.redeem-success .button { width: 100%; min-height: 50px; margin-top: 24px; }

.credits-card { padding: 0 16px; border-radius: 24px; background: var(--grouped); }
.credits-card > .notice { padding: 40px 0 12px; text-align: center; }
.credits-card > .button { display: block; margin: 0 auto 24px; }
.credits-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--ink); }
.credits-row.head { padding-top: 16px; font-size: 17px; line-height: 22px; }
.credits-row.line { height: 52px; border-top: 1px solid var(--line); font-size: 15px; text-decoration: none; }
.credits-value { color: var(--ink-muted); }
.credits-bar { height: 8px; margin-top: 12px; border-radius: 4px; background: var(--hover); overflow: hidden; }
.credits-bar span { display: block; height: 100%; border-radius: 4px; background: #34c759; }
.credits-usage { margin: 8px 0 16px; font-size: 13px; color: var(--ink-muted); }
.credits-learn-more { color: var(--accent); font-size: 17px; }
.credits-learn-more:hover { text-decoration: underline; }
.credits-skeleton { display: flex; flex-direction: column; gap: 14px; padding: 16px 0; }
.credits-skeleton .bone { display: block; height: 16px; border-radius: 8px; background: var(--shimmer-base); }
.credits-skeleton .bone.wide { width: 60%; height: 20px; }
.credits-skeleton .bone.bar { height: 8px; }
.credits-skeleton .bone.short { width: 120px; height: 14px; }
.credits-skeleton .bone.line { width: 160px; margin-top: 18px; }
.upgrade-banner {
    position: relative;
    display: flex;
    height: 196px;
    padding: 0;
    border: 0;
    border-radius: 24px;
    overflow: hidden;
    background: #ffe8b9;
    text-align: start;
    font: inherit;
    cursor: pointer;
}
.upgrade-banner.max { background: #ffb9e3; }
.upgrade-banner-text { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 24px 0 0; padding-inline-start: 24px; }
.upgrade-banner-badge svg { height: 24px; width: auto; }
.upgrade-banner-title { max-width: 200px; color: #5b014a; font-size: 22px; line-height: 28px; font-weight: 700; }
.upgrade-banner-art { flex: 1.5; position: relative; }
.upgrade-banner-lottie { position: absolute; inset: 0; width: 100%; height: 100%; }
.upgrade-banner-art::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; z-index: 1; width: 30px; background: linear-gradient(to right, #ffe8b9, transparent); }
.upgrade-banner.max .upgrade-banner-art::before { background: linear-gradient(to right, #ffb9e3, transparent); }
[dir="rtl"] .upgrade-banner-art::before { background: linear-gradient(to left, #ffe8b9, transparent); }
[dir="rtl"] .upgrade-banner.max .upgrade-banner-art::before { background: linear-gradient(to left, #ffb9e3, transparent); }
.upgrade-banner-cta {
    position: absolute;
    inset-inline: 16px;
    bottom: 16px;
    z-index: 2;
    padding: 8px;
    border-radius: 999px;
    background: #ffffff;
    color: #000000;
    text-align: center;
    font-size: 17px;
}

.profile-description { margin: 0 16px 16px; font-size: 13px; line-height: 18px; }
.profile-error { padding: 24px 16px; text-align: center; }
.profile-row {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 52px;
    margin: 0 16px 16px;
    padding-inline: 16px;
    border: 0;
    border-radius: 24px;
    background: var(--soft);
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    text-align: start;
    cursor: pointer;
}
.profile-row:hover { filter: brightness(0.97); }
.profile-row-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-row svg { width: 24px; height: 24px; color: var(--tab); }
.profile-actions { display: flex; flex-direction: column; margin-top: auto; padding-top: 16px; }
.profile-row.action { background: var(--grouped); color: var(--accent); }
.profile-row.action:disabled { cursor: default; }
.profile-row.placeholder { cursor: default; filter: none; }
.profile-footer { margin: -6px 32px 16px; font-size: 12px; line-height: 16px; color: var(--ink-muted); }

/* Tool activation and tool comparison: the clip or the before and after on top, the text, the button. */
.tool-sheet { align-items: center; padding-bottom: 16px; background: var(--tertiary); }
.tool-media { position: relative; flex: 1; min-height: 0; width: 100%; overflow: hidden; background: var(--soft); }
/* The app shows the whole clip, the text centred in the room left and the button at the bottom; a short window shrinks the clip, never crops it. */
.tool-media.activation { flex: 0 1 auto; aspect-ratio: 640 / 896; background: none; }
.tool-media.activation video { object-fit: contain; }
.tool-media.activation ~ .tool-text { margin-block: auto; }
.tool-media video { display: block; width: 100%; height: 100%; object-fit: cover; }
.tool-close { position: absolute; top: 16px; inset-inline-end: 16px; z-index: 3; }
.tool-text { flex: none; padding: 16px 16px 32px; text-align: center; }
.tool-text h2 { margin: 0 0 8px; font-size: 22px; line-height: 28px; font-weight: 500; }
.tool-text p { margin: 0; font-size: 15px; line-height: 20px; }
.tool-cta { flex: none; width: min(328px, 100% - 32px); height: 50px; font-size: 17px; }
.tool-media.comparison { cursor: ew-resize; touch-action: none; user-select: none; }
.comparison-base, .comparison-top { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
/* The app's line: the second picture shows right of it, measured from the left in both directions. */
.comparison-top { clip-path: inset(0 0 0 calc(var(--progress) * 100%)); }
.tool-media.comparison::after {
    content: "";
    position: absolute;
    inset-block: 0;
    left: calc(var(--progress) * 100%);
    width: 2px;
    margin-left: -1px;
    background: #ffffff;
    pointer-events: none;
}
.comparison-caption {
    position: absolute;
    bottom: 16px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 63px;
    height: 36px;
    border-radius: 18px;
    background: #00000066;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
}
.comparison-caption.start { inset-inline-start: 16px; }
.comparison-caption.end { inset-inline-end: 16px; }
.comparison-handle {
    position: absolute;
    top: 50%;
    left: calc(var(--progress) * 100%);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border-radius: 50%;
    background: var(--tertiary);
    color: var(--ink);
    pointer-events: none;
}
[dir="rtl"] .comparison-handle { flex-direction: row-reverse; }
.comparison-handle svg { width: 16px; height: 16px; }

/* The element a site link asked for, in the Elements sheet. */
.card.highlighted { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 12px; animation: highlight-pulse 1.2s ease-out 2; }
@keyframes highlight-pulse { 0% { outline-color: var(--accent); } 50% { outline-color: transparent; } 100% { outline-color: var(--accent); } }
@media (prefers-reduced-motion: reduce) { .card.highlighted { animation: none; } }

/* ---------- Plans (/plans): the site's plans page, full screen over the page or the open design ---------- */
.plans-screen {
    --pro: #ffb743;
    --pro-band: #ffe8b9;
    --max: #ff50a7;
    --max-band: #ffb9e3;
    --save-fill: linear-gradient(to right, #fff1a7, #ffd855);
    --plans-bar: 64px;
    position: fixed;
    inset: 0;
    z-index: 1003;
    overflow-y: auto;
    background: var(--tertiary);
    color: var(--ink);
}
/* Phones and the rail: the page fills the screen and its overlay adds nothing. */
.plans-overlay { display: contents; }
/* A large window: the page as a dialog over the one under it, in the web design's dialog look. */
@media (min-width: 840px) {
    .plans-overlay { position: fixed; inset: 0; z-index: 1003; display: grid; place-items: center; padding: 24px; background: var(--scrim); }
    .plans-overlay > .plans-screen {
        position: relative;
        inset: auto;
        width: min(1120px, 100%);
        height: 100%;
        border: 1px solid var(--dialog-edge);
        border-radius: 32px;
        box-shadow: 0 25px 50px -12px #00000040;
        animation: sheet-up 300ms ease-out;
    }
    .plans-overlay .plans-close .close-button { width: 36px; height: 36px; background: var(--grouped); }
}
/* The close button's bar: the comparison's plan row sticks right under it. */
.plans-close { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: flex-end; height: var(--plans-bar); padding-inline: 16px; background: var(--tertiary); }
.plans-close .close-button { background: var(--mist); }
.plans-content { display: flex; flex-direction: column; width: min(1120px, 100%); margin: 0 auto; padding: 0 24px; }
.plans-title { margin: 0 0 12px; text-align: center; font-size: 36px; line-height: 44px; font-weight: 800; }
.plans-subtitle { max-width: 640px; margin: 0 auto 24px; text-align: center; color: var(--ink-muted); font-size: 16px; line-height: 24px; }
.store-state { min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; }
.store-period { align-self: center; display: flex; gap: 2px; margin-bottom: 32px; padding: 4px; border-radius: 999px; background: var(--mist); }
.store-period-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding-inline: 20px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ink-muted);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.store-period-tab[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px #0000001f; }
.store-period-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.store-period-save, .store-save { padding: 2px 8px; border-radius: 999px; background: var(--save-fill); color: #a14d00; font-size: 12px; line-height: 16px; font-weight: 600; }
.store-other-platform { align-self: center; margin-bottom: 16px; padding: 12px 16px; border-radius: 16px; background: var(--grouped); text-align: center; }
.store-other-platform p { margin: 0; color: var(--ink-muted); font-size: 13px; }
.store-other-platform .title { margin-bottom: 4px; color: var(--ink); font-size: 15px; font-weight: 600; }
.plans-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
/* One plan offered (a Max-only feature): a card of the usual width, in the middle. */
.plans-cards:has(> .plan-card:only-child) { width: min(420px, 100%); margin-inline: auto; }
.plan-card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); }
.plan-card.pro { border: 2px solid var(--pro); }
.plan-popular { position: absolute; top: -12px; left: 50%; z-index: 1; transform: translateX(-50%); padding: 2px 12px; border-radius: 999px; background: var(--pro); color: #5b014a; font-size: 12px; line-height: 20px; font-weight: 700; white-space: nowrap; }
.plan-card-band { display: flex; flex-direction: column; gap: 12px; min-height: 128px; padding: 20px; border-radius: 19px 19px 0 0; background: var(--grouped); }
.plan-card.pro .plan-card-band { border-radius: 18px 18px 0 0; background: var(--pro-band); }
.plan-card.max .plan-card-band { background: var(--max-band); }
.plan-tagline { margin: 0; color: var(--ink); font-size: 17px; line-height: 23px; font-weight: 700; }
.plan-card.pro .plan-tagline, .plan-card.max .plan-tagline { color: #5b014a; }
.plan-card-body { flex: 1; display: flex; flex-direction: column; gap: 8px; padding: 20px; }
.store-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.store-price .amount { font-size: 32px; line-height: 38px; font-weight: 800; }
.store-price .per, .store-price .struck { color: var(--ink-muted); font-size: 15px; }
.store-price .struck { text-decoration: line-through; }
.store-billed { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 24px; color: var(--ink-muted); font-size: 13px; }
.store-trial { margin: 0; color: var(--accent); font-size: 13px; font-weight: 500; }
.store-buy { width: 100%; height: 48px; margin: 8px 0 0; font-size: 16px; font-weight: 600; text-decoration: none; }
.store-buy.dark { background: var(--ink); color: var(--paper); }
.store-buy:disabled { opacity: 0.5; cursor: default; }
.store-buy.plan-held:disabled { opacity: 1; background: var(--mist); color: var(--ink-muted); }
.store-buy:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.plan-button-space { height: 48px; margin-top: 8px; }
.plan-manage { align-self: center; color: var(--ink-muted); font-size: 13px; }
.store-reassure { margin: 4px 0 8px; color: var(--ink-muted); font-size: 12px; text-align: center; }
.plan-features { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.plan-features-heading { margin: 0; font-size: 14px; font-weight: 700; }
.plan-feature { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 20px; }
.plan-feature-check { flex: none; display: inline-flex; width: 18px; height: 18px; margin-top: 1px; color: var(--accent); }
.plan-feature-check svg { width: 100%; height: 100%; }
.plans-section-title { margin: 56px 0 8px; text-align: center; font-size: 28px; line-height: 34px; font-weight: 800; }
.plans-section-subtitle { max-width: 640px; margin: 0 auto 24px; text-align: center; color: var(--ink-muted); font-size: 15px; line-height: 22px; }
.store-compare { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 16px; overflow: clip; background: var(--paper); }
.store-compare-row { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); align-items: stretch; border-top: 1px solid var(--line); font-size: 13px; line-height: 18px; }
.store-compare-row:first-child { border-top: 0; }
.store-compare-row > span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 12px; text-align: center; }
.store-compare-row > span:first-child { justify-content: flex-start; text-align: start; font-size: 14px; font-weight: 500; }
.store-compare-row > span:nth-child(3) { background: color-mix(in srgb, var(--pro) 10%, transparent); }
.store-compare-row.head { position: sticky; top: var(--plans-bar); z-index: 1; background: var(--grouped); font-weight: 600; }
.store-compare-row.group { background: var(--grouped); }
.store-compare-row.group > span { grid-column: 1 / -1; min-height: 40px; font-weight: 700; }
.store-included { display: inline-flex; color: var(--accent); }
.store-included svg { width: 18px; height: 18px; }
.store-excluded { width: 12px; height: 2px; border-radius: 1px; background: var(--ink-faint); }
.plans-credits { margin-top: 56px; padding: 0 24px 32px; border-radius: 24px; background: var(--grouped); }
.plans-credits .plans-section-title { margin-top: 0; padding-top: 32px; }
.plans-credit-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.plans-credit-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 20px; border-radius: 16px; background: var(--paper); }
.plans-credit-count { margin: 8px 0 0; font-size: 32px; line-height: 38px; font-weight: 800; }
.plans-credit-unit { margin: 0 0 8px; color: var(--ink-muted); font-size: 14px; }
.plans-credit-example-title { margin: 8px 0 4px; font-size: 13px; font-weight: 700; }
.plans-credit-example { margin: 0; font-size: 13px; line-height: 20px; }
.plans-credit-example .count { font-weight: 800; }
.plans-credit-link { display: block; margin-top: 20px; text-align: center; color: var(--accent); font-size: 14px; font-weight: 600; }
/* Loading stand-ins, sized like the parts they replace. */
.store-bone { display: block; border-radius: 8px; }
.store-bone.store-period { width: 300px; height: 48px; padding: 0; border-radius: 999px; }
.store-bone.price { width: 160px; height: 38px; }
.store-bone.billed { width: 200px; height: 16px; margin-block: 4px; }
.store-bone.buy { height: 48px; margin-top: 8px; border-radius: 999px; }
.store-footer { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 32px 0; }
.store-footer a { color: var(--ink-muted); font-size: 12px; text-decoration: none; }
.store-footer a:hover { text-decoration: underline; }
.store-footer-divider { width: 1px; height: 16px; background: var(--line); }
@media (max-width: 699px) {
    .plans-content { padding: 0 16px; }
    .plans-title { font-size: 26px; line-height: 32px; }
    .plans-section-title { font-size: 22px; line-height: 28px; }
    .plans-cards { grid-template-columns: minmax(0, 1fr); }
    .plans-credits { padding-inline: 16px; }
    .store-compare-row { grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); }
    .store-compare-row > span { padding: 8px 6px; }
    .store-compare-row > span:first-child { font-size: 13px; }
    /* The plan badges are fixed-size pictures: smaller here, or the Arabic ones overflow their columns. */
    .store-compare-row.head .plan-badge { zoom: 0.7; }
}

/* ---------- The AI editor (AiEditorScreen), over everything while the app has one open ---------- */
.ai-editor {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--stage);
    color: var(--ink);
}
.ai-icon { display: inline-flex; width: 24px; height: 24px; flex: none; }
.ai-icon svg { width: 100%; height: 100%; }
.mirrored .ai-icon { transform: scaleX(1); }
[dir="rtl"] .mirrored .ai-icon { transform: scaleX(-1); }
.ai-top-bar { flex: none; display: flex; align-items: center; gap: 8px; width: 100%; height: 56px; padding-inline: 12px; }
.ai-top-spacer { flex: 1; }
.ai-history { display: flex; gap: 4px; margin-inline-start: 8px; }
.ai-round, .ai-credits, .ai-apply {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--mist);
    color: var(--ink);
    cursor: pointer;
}
.ai-round:disabled { color: var(--ink-faint); cursor: default; }
.ai-round:not(:disabled):hover, .ai-credits:hover { filter: brightness(0.95); }
.ai-apply { background: var(--accent); color: #ffffff; box-shadow: 0 6px 12px #0000001a; }
.ai-apply:disabled { background: var(--mist); color: var(--tab); box-shadow: none; cursor: default; }
.ai-credits-ring, .ai-credits-ring svg { display: block; }
.ai-credits-ring svg circle { fill: none; stroke-width: 2.5; }
.ai-credits-ring .track { stroke: var(--line); }
.ai-credits-ring .fill { stroke: #34c759; stroke-linecap: round; }
.ai-image-area { position: relative; flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.ai-template { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.ai-template-art { position: relative; width: 80px; height: 80px; }
.ai-template-sample { width: 80px; height: 80px; border-radius: 16px; object-fit: cover; }
.ai-template-arrow { position: absolute; left: -58px; bottom: 18px; width: 35px; height: 22px; transform: scaleY(-1); color: var(--ink); }
.ai-template-arrow .icon, .ai-template-arrow svg { width: 100%; height: 100%; }
.ai-template-hint {
    position: absolute;
    left: -80px;
    top: calc(100% + 15px);
    transform: translateY(-100%);
    min-width: 76px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--tertiary);
    box-shadow: 0 6px 14px #0000001f;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.ai-template-art.top .ai-template-arrow { left: auto; right: -40px; bottom: auto; top: -2px; transform: scaleX(-1); }
.ai-template-art.top .ai-template-hint { left: auto; right: -110px; top: -34px; transform: none; min-width: 0; }
.ai-template-title { margin: 0; min-height: 22px; font-size: 17px; font-weight: 600; }
.ai-template-subtitle { margin: -8px 0 0; max-width: 270px; color: var(--ink-muted); font-size: 15px; }
.ai-gallery { display: flex; align-items: center; justify-content: center; gap: 16px; width: 100%; height: 100%; min-height: 0; }
.ai-full { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 0; }
.ai-picture { position: relative; max-width: min(100%, 900px); max-height: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.ai-picture.loading { height: min(100%, 520px); width: auto; border-radius: 16px; }
.ai-picture-image { display: block; max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 16px; }
.ai-picture.running .ai-picture-image { filter: brightness(0.85); }
.ai-running { position: absolute; inset: 0; border-radius: 16px; opacity: 0.35; pointer-events: none; }
.ai-picture-more { position: absolute; top: 10px; inset-inline-end: 10px; z-index: 2; display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #0000004d; color: #ffffff; cursor: pointer; }
.ai-picture-more .ai-icon { width: 20px; height: 20px; }
.ai-image-menu { top: 48px; inset-inline-end: 10px; min-width: 240px; }
.ai-image-menu .ai-icon { width: 20px; height: 20px; }
.ai-menu-prompt .menu-label { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; }
.ai-menu-rating { padding: 4px 12px 8px; }
.ai-page-arrow { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--mist); color: var(--ink); cursor: pointer; }
.ai-page-arrow:disabled { visibility: hidden; }
.ai-page-arrow svg { width: 20px; height: 20px; }
[dir="rtl"] .ai-page-arrow svg { transform: scaleX(-1); }
.ai-dots { display: flex; gap: 8px; margin-top: 12px; }
.ai-dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: var(--ink); opacity: 0.3; cursor: pointer; }
.ai-dot[aria-selected="true"] { opacity: 1; }
.ai-compare { position: absolute; bottom: 12px; inset-inline-end: 12px; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--tertiary); color: var(--ink); box-shadow: 0 4px 12px #00000026; cursor: pointer; touch-action: none; }
.ai-bottom { position: relative; flex: none; width: min(720px, 100% - 32px); display: flex; flex-direction: column; align-items: center; gap: 8px; padding-bottom: 8px; }
.ai-controls { display: flex; gap: 8px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ai-pill-anchor { position: relative; }
.ai-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding-inline: 14px;
    border: 0;
    border-radius: 18px;
    background: var(--mist);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}
.ai-pill:disabled { opacity: 0.5; cursor: default; }
.ai-pill .ai-icon, .ai-pill svg { width: 18px; height: 18px; }
.ai-pill-thumb { width: 24px; height: 24px; border-radius: 6px; object-fit: cover; }
.ai-pill-menu { position: fixed; top: auto; inset-inline-end: auto; overflow-y: auto; }
.ai-crown { width: 16px; height: 16px; color: var(--saffron); }
.ai-prompt { width: 100%; display: flex; flex-direction: column; gap: 8px; padding: 6px; border-radius: 24px; background: var(--tertiary); box-shadow: 0 6px 20px #0000001f; }
.ai-attachments { display: flex; gap: 8px; padding: 4px 6px 0; }
.ai-attachment { position: relative; width: 48px; height: 48px; }
.ai-attachment img { width: 100%; height: 100%; border-radius: 10px; object-fit: cover; }
.ai-attachment-remove { position: absolute; top: -6px; inset-inline-end: -6px; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: var(--ink); color: var(--paper); cursor: pointer; }
.ai-attachment-remove .ai-icon { width: 12px; height: 12px; }
.ai-prompt-row { display: flex; align-items: flex-end; gap: 8px; }
.ai-prompt-add, .ai-send { flex: none; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--mist); color: var(--ink); cursor: pointer; }
.ai-prompt-add:disabled { opacity: 0.4; cursor: default; }
.ai-send { background: var(--ink); color: var(--paper); }
.ai-send:disabled { background: var(--mist); color: var(--ink-faint); cursor: default; }
.ai-send.pause { background: var(--accent); color: #ffffff; }
.ai-prompt-field {
    flex: 1;
    min-width: 0;
    min-height: 36px;
    max-height: 160px;
    padding: 8px 4px;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 16px;
    line-height: 20px;
    resize: none;
    outline: none;
    field-sizing: content;
}
.ai-prompt-field::placeholder { color: var(--ink-faint); }
.ai-snack {
    position: absolute;
    bottom: calc(100% + 8px);
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    min-height: 48px;
    padding: 8px 12px;
    border-radius: 16px;
    background: var(--tertiary);
    box-shadow: 0 6px 20px #00000026;
    font-size: 15px;
}
.ai-snack.failed, .ai-snack.saveFailed { color: var(--accent); }
.ai-snack.saved, .ai-snack.added { color: #34c759; }
.ai-snack-text { color: var(--ink); }
.ai-snack .ai-round { width: 32px; height: 32px; }
.ai-rating { display: flex; gap: 6px; }
.ai-rate { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--mist); color: var(--ink); cursor: pointer; }
.ai-rate[aria-pressed="true"] { background: var(--accent-tint); color: var(--accent); }
.ai-rate:disabled { cursor: default; }
.ai-rate .ai-icon { width: 20px; height: 20px; }
.ai-styles-overlay { z-index: 1003; }
.ai-styles { display: flex; flex-direction: column; width: min(540px, 100%); height: min(760px, 100%); border-radius: 24px; background: var(--tertiary); overflow: hidden; --gutter: 0px; }

/* ---------- Settings as a large dialog: the sections down the side, the open one beside them ---------- */
/* Figma Andalusi-Website, Settings: a 930 x 736 card, a 268 px sidebar, 32 px around the open section. */
.sheet-card.settings-dialog { width: min(930px, 100%); height: min(736px, calc(100vh - 32px)); overflow: hidden; background: var(--tertiary); }
.settings-layout { display: grid; grid-template-columns: 268px minmax(0, 1fr); height: 100%; }
.settings-nav { display: flex; flex-direction: column; gap: 6px; padding: 28px 16px 24px; border-inline-end: 1px solid var(--dialog-side-line); background: var(--dialog-side); overflow-y: auto; }
.settings-nav-head { margin-block-end: 14px; padding-inline: 12px; }
.settings-nav-head h1 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; }
.settings-nav-item { display: flex; align-items: center; gap: 14px; padding: 10px 12px; border: none; border-radius: 16px; background: transparent; color: var(--ink); font: inherit; text-align: start; cursor: pointer; }
.settings-nav-item:hover { background: var(--hover); }
.settings-nav-item[aria-current="page"] { background: var(--accent-tint); }
.settings-nav-item .settings-tile { width: 32px; height: 32px; margin: 0; border-radius: 50%; box-shadow: 0 1px 2px #0000000d; }
.settings-nav-item .settings-label { padding: 0; font-size: 15px; line-height: 20px; letter-spacing: 0.23px; }
.settings-panel { display: flex; flex-direction: column; min-width: 0; padding: 0 32px 32px; overflow-y: auto; }
.settings-panel-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 12px; min-height: 76px; margin-inline: -32px; padding: 12px 20px 8px 32px; background: var(--tertiary); }
[dir="rtl"] .settings-panel-head { padding: 12px 32px 8px 20px; }
.settings-panel-head h2 { flex: 1; margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; }
.settings-panel-head .close-button { width: 32px; height: 32px; background: var(--mist); }
.settings-panel .settings-group { margin: 0 0 24px; border-radius: 16px; }
.settings-group-title { margin: 0 0 12px; color: var(--ink-group); font-size: 14px; line-height: 21px; font-weight: 600; }
.settings-row.choice .settings-label { padding-inline: 0; }
.settings-check { display: inline-flex; color: var(--accent); }
.settings-check svg { width: 20px; height: 20px; }
/* 36 px under the links card, which keeps its own 32 (a flex column does not collapse margins). */
.settings-panel .settings-version { margin: 4px 0 0; color: var(--ink-quiet); font-size: 14px; line-height: 21px; font-weight: 500; }
.settings-card { margin-bottom: 16px; padding: 20px; border-radius: 20px; background: var(--grouped); }
.settings-card h3 { margin: 0 0 6px; font-size: 17px; line-height: 22px; font-weight: 600; }
.settings-sign-in p { margin: 0 0 16px; color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.settings-plan { display: flex; flex-direction: column; align-items: flex-start; }
.settings-plan .plan-badge { margin-block-end: 16px; }
.settings-plan p { margin: 0 0 20px; font-size: 17px; line-height: 26px; font-weight: 700; letter-spacing: -0.425px; }
.settings-plan-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.settings-plan-actions .button { height: 38px; padding-inline: 24px; font-size: 17px; line-height: 22px; font-weight: 400; }
.settings-plan-actions .button.quiet { background: var(--button-light); }
.settings-plan.pro { background: var(--pro-card); }
.settings-plan.max { background: color-mix(in srgb, #ff50a7 16%, var(--grouped)); }
.redeem-card .redeem-subtitle { margin: 0 0 12px; color: var(--ink-muted); }
.redeem-row { display: flex; gap: 8px; }
.redeem-row .redeem-field { flex: 1; min-width: 0; height: 44px; background: var(--tertiary); }
.redeem-row .redeem-submit { width: auto; min-height: 0; height: 44px; font-size: 16px; }
.redeem-card .redeem-notes { padding: 8px 4px 0; }
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.profile-head .avatar { width: 56px; height: 56px; font-size: 22px; }
.profile-head .avatar > .icon svg { width: 56px; height: 56px; }
.profile-who { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.profile-email { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; line-height: 22px; font-weight: 600; }
.settings-panel .profile-description { margin: 0 0 12px; color: var(--ink-muted); }
.settings-panel .profile-row { margin: 0 0 12px; }
.settings-panel .profile-actions { margin-top: auto; padding-top: 24px; }
.settings-panel .profile-footer { margin: -4px 16px 0; }
.settings-panel .credits-card { margin-bottom: 16px; }

/* The large dialog only: a phone keeps the app's Settings below. */
@media (min-width: 700px) {
    .sheet-card-overlay:has(.settings-dialog) { background: var(--scrim); }
    .sheet-card.settings-dialog { border: 1px solid var(--dialog-edge); border-radius: 32px; box-shadow: 0 25px 50px -12px #00000040; }
    /* The title row is 37.5 px tall, as the design's. */
    .settings-panel-head { min-height: 89.5px; padding: 28px 32px 24px; }
    [dir="rtl"] .settings-panel-head { padding: 28px 32px 24px; }
    .settings-panel-head .close-button { width: 36px; height: 36px; background: var(--grouped); }
    /* A section's cards: the design's grey card with a hairline edge, 24 px corners, 28 px inside. */
    .settings-panel .settings-card { margin-bottom: 16px; padding: 28px; border: 1px solid var(--card-line); border-radius: 24px; background: var(--card); box-shadow: 0 2px 4px #00000005; }
    .settings-panel .settings-card h3 { margin: 0 0 8px; font-size: 20px; line-height: 25px; font-weight: 500; }
    .settings-panel .settings-sign-in p { max-width: 540px; margin: 0 0 30px; padding-top: 3px; color: var(--ink-secondary); font-size: 15px; line-height: 20px; letter-spacing: 0.23px; }
    .settings-panel .settings-sign-in .button { height: 38px; padding-inline: 24px; font-size: 17px; line-height: 22px; font-weight: 400; }
    .settings-panel .settings-plan { border: none; }
    .settings-panel .settings-plan.pro { background: var(--pro-card); }
    .settings-panel .settings-plan.max { background: color-mix(in srgb, #ff50a7 16%, var(--tertiary)); }
    /* Grouped rows: full-width hairlines, 24 px in from the card's edges. */
    .settings-panel .settings-group { margin: 0 0 32px; border-radius: 24px; background: var(--card); }
    .settings-panel .settings-group .settings-divider { height: 1px; margin-inline: 0; background: var(--row-line); }
    .settings-panel .settings-row { height: 56px; padding-inline: 24px; }
    .settings-panel .settings-row:not(.choice) { height: 68px; }
    .settings-panel .settings-label { padding-inline: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
    .settings-panel .settings-label[lang="ar"] { font-size: 17px; line-height: 25.5px; }
    .settings-panel .settings-row.choice:has(.settings-label[lang="ar"]) { height: 57px; }
    .settings-panel .settings-row .settings-tile { width: 36px; height: 36px; margin-inline-end: 16px; border-radius: 12px; box-shadow: 0 1px 2px #0000000d; }
    .settings-panel .settings-chevron svg { width: 16px; height: 16px; }

    /* Signed in (no Figma frames): the same cards, rows and type as the designed sections. */
    /* Profile: one card with the avatar, email and plan over the description. */
    .settings-panel .profile-head { gap: 16px; margin: 0; padding: 28px 28px 12px; border: 1px solid var(--card-line); border-bottom: 0; border-radius: 24px 24px 0 0; background: var(--card); }
    .settings-panel .profile-email { font-size: 20px; line-height: 25px; font-weight: 500; }
    .settings-panel .profile-description { margin: 0 0 32px; padding: 0 28px 28px; border: 1px solid var(--card-line); border-top: 0; border-radius: 0 0 24px 24px; background: var(--card); color: var(--ink-secondary); font-size: 15px; line-height: 20px; letter-spacing: 0.23px; }
    /* Its rows: the user id to copy, the design preference, then Sign Out and Delete My Account in one card. */
    .settings-panel .profile-row { gap: 16px; height: 56px; margin: 0 0 12px; padding-inline: 24px; border-radius: 24px; font-size: 16px; line-height: 24px; }
    .settings-panel .profile-row:not(.shimmer) { background: var(--card); }
    .settings-panel .profile-row:not(.shimmer):hover { filter: none; background: color-mix(in srgb, var(--ink) 4%, var(--card)); }
    .settings-panel .profile-row svg { width: 20px; height: 20px; }
    .settings-panel .profile-row.purpose-row { height: 68px; font-weight: 600; }
    /* The id and the design preference share one card, as the designed sections group their rows. */
    .settings-panel .profile-row:has(+ .purpose-row) { margin-bottom: 0; border-radius: 24px 24px 0 0; }
    .settings-panel .profile-row + .purpose-row { border-top: 1px solid var(--row-line); border-radius: 0 0 24px 24px; }
    .settings-panel .purpose-row-icon { width: 36px; height: 36px; border-radius: 12px; box-shadow: 0 1px 2px #0000000d; }
    .settings-panel .purpose-row-value { font-weight: 400; }
    .settings-panel .profile-actions { padding-top: 32px; }
    .settings-panel .profile-row.action { margin: 0; border-radius: 0; font-weight: 600; }
    .settings-panel .profile-row.action:first-child { border-radius: 24px 24px 0 0; }
    .settings-panel .profile-row.action + .profile-row.action { border-top: 1px solid var(--row-line); border-radius: 0 0 24px 24px; }
    .settings-panel .profile-footer { margin: 12px 4px 0; color: var(--ink-quiet); font-size: 14px; line-height: 21px; }

    /* AI Credits: the balance as a card, its lines as full-width rows. */
    .settings-panel .credits-card { margin-bottom: 16px; padding: 0 24px; border: 1px solid var(--card-line); box-shadow: 0 2px 4px #00000005; }
    .settings-panel .credits-card:not(.shimmer) { background: var(--card); }
    .settings-panel .credits-row.head { padding-top: 24px; font-size: 16px; line-height: 24px; font-weight: 600; }
    .settings-panel .credits-value { color: var(--ink-secondary); font-weight: 400; }
    .settings-panel .credits-bar { margin-top: 12px; background: var(--row-line); }
    .settings-panel .credits-usage { margin: 8px 0 16px; color: var(--ink-secondary); font-size: 14px; line-height: 21px; }
    .settings-panel .credits-row.line { height: 56px; margin-inline: -24px; padding-inline: 24px; border-top: 1px solid var(--row-line); font-size: 16px; line-height: 24px; }
    .settings-panel .credits-learn-more { font-weight: 600; }
    .settings-panel .upgrade-banner { border-radius: 24px; }
    /* Its loading card: bones where the head, bar, usage and two lines sit. */
    .settings-panel .credits-skeleton { gap: 0; padding: 24px 0 0; }
    .settings-panel .credits-skeleton .bone.wide { width: 60%; height: 20px; margin-block: 2px; }
    .settings-panel .credits-skeleton .bone.bar { height: 8px; margin-top: 12px; }
    .settings-panel .credits-skeleton .bone.short { width: 160px; height: 14px; margin: 11.5px 0 19.5px; }
    .settings-panel .credits-skeleton .bone.line { width: 160px; height: 16px; margin: 20px 0; }

    /* Redeem: the card's field and button as 44 px pills. */
    .settings-panel .redeem-card .redeem-subtitle { margin: 0 0 20px; color: var(--ink-secondary); font-size: 15px; line-height: 20px; letter-spacing: 0.23px; }
    .settings-panel .redeem-row { gap: 12px; }
    .settings-panel .redeem-row .redeem-field { height: 44px; padding-inline: 20px; border: 1px solid var(--card-line); border-radius: 22px; background: var(--tertiary); font-size: 16px; }
    .settings-panel .redeem-row .redeem-submit { height: 44px; padding-inline: 24px; font-size: 17px; line-height: 22px; font-weight: 400; }
}
.profile-row.phone-row { display: none; }

/* A phone: the app's Settings, one list of grouped rows; a row's screen opens over it with a back button. */
@media (max-width: 699px) {
    .sheet-card-overlay:has(.settings-dialog) { padding: 0; }
    .sheet-card.settings-dialog { width: 100%; height: 100%; border: 0; border-radius: 0; background: var(--paper); }
    .settings-layout { grid-template-columns: minmax(0, 1fr); }
    .settings-panel { padding: 0 16px 24px; }
    .settings-panel-head { min-height: 64px; margin-inline: -16px; padding: 8px 16px; background: var(--paper); }
    [dir="rtl"] .settings-panel-head { padding: 8px 16px; }
    .settings-panel-head .back-button { width: 32px; height: 32px; }
    /* A row's screen under the app's bar for it: a large title under the back button, or AI Credits' small one in the bar. */
    .settings-panel-head.centered { justify-content: center; }
    .settings-panel-head.centered .back-button { position: absolute; inset-inline-start: 16px; }
    .settings-panel-head.centered h2 { flex: none; font-size: 17px; line-height: 22px; font-weight: 600; }
    .settings-panel > .large-title { margin: 0 0 8px; font-size: 34px; line-height: 41px; }
    /* Profile: the email is a row to copy, as in the app. */
    .profile-head { display: none; }
    .profile-row.phone-row { display: flex; }
    .settings-panel .profile-description { color: var(--ink); }
    /* Redeem: the code field alone, with Redeem at the bottom. */
    .settings-panel > .redeem-card { display: flex; flex-direction: column; flex: 1; margin: 0; padding: 0; border-radius: 0; background: none; }
    .redeem-card h3 { display: none; }
    .redeem-card .redeem-subtitle { margin: 0 0 16px; color: var(--ink); font-size: 15px; line-height: 20px; }
    .redeem-row { display: contents; }
    .redeem-row .redeem-field { flex: none; height: 48px; background: var(--grouped); }
    .redeem-card .redeem-notes { order: 1; }
    .redeem-row .redeem-submit { order: 2; width: 100%; height: 48px; margin-top: auto; font-size: 17px; }
}
.settings-list { height: 100%; overflow-y: auto; }
/* The bar stays while the list scrolls; its small title shows once the large one is under it. */
.settings-list-bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: flex-end; height: 64px; padding-inline: 16px; background: var(--paper); }
.settings-list-bar .close-button { width: 32px; height: 32px; background: var(--mist); }
.settings-list-bar-title { position: absolute; inset-inline: 56px; text-align: center; font-size: 17px; line-height: 22px; font-weight: 600; opacity: 0; transition: opacity 150ms; }
.settings-list.scrolled .settings-list-bar-title { opacity: 1; }
.settings-list .large-title { margin: 0 16px 24px; font-size: 34px; line-height: 41px; }
.settings-sign-out {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 32px);
    height: 38px;
    margin-inline: 16px;
    border: none;
    border-radius: 999px;
    background: var(--grouped);
    color: var(--accent);
    font: inherit;
    font-size: 17px;
    line-height: 22px;
    cursor: pointer;
}
.settings-sign-out:disabled { cursor: default; }

/* ---------- Phones: the app's compact layout ---------- */

/* What only the compact layout shows. */
.phone-only, .create-fab { display: none; }

@media (max-width: 599px) {
    /* Home's bar is the search field and the plan; the account lives in Settings. */
    .top-bar { gap: 8px; padding-inline: 16px 8px; }
    .top-bar .brand-mobile, .top-bar .brand-mobile.titled, .top-bar .account-menu-anchor { display: none; }
    .top-bar:not(:has(.top-bar-title:not(.home-title))) .search-box { display: block; flex: 1; width: auto; margin: 0; align-self: center; }
    .key-hint { display: none; }
    /* A tab's title stands alone in the middle of its bar. */
    .top-bar:has(.top-bar-title:not(.home-title)) { justify-content: center; padding-inline: 16px; }
    .top-bar-title { flex: none; margin: 0; font-size: 17px; line-height: 22px; font-weight: 600; }
    /* Search is its field alone. */
    .main-column:has(.search-bar) > .top-bar { display: none; }
    .search-bar .search-box { flex: 1; width: auto; }

    /* The app's sheets fill the screen, with their title in the middle. */
    .sheet-card-overlay, .ai-styles-overlay { padding: 0; }
    .sheet-card, .sheet-card.settings-dialog, .ai-styles {
        width: 100%;
        height: 100%;
        border: none;
        border-radius: 0;
    }
    .picker-head.titled { position: relative; justify-content: flex-end; min-height: 56px; padding-block: 12px; }
    .picker-head.titled .picker-title { position: absolute; inset-inline: 56px; text-align: center; }
    .picker-head.titled .back-button { margin-inline-end: auto; }

    /* The calligraphy banner's compact layout: the title at the start, the picture at the end, the bubble between them. */
    .tool-banner-row { justify-content: space-between; padding-inline: 16px 8px; }
    .tool-banner-title { flex: none; margin-inline-end: 0; }
    .tool-banner-bubble { position: relative; z-index: 1; min-width: 0; margin-inline-start: -28px; }
    .tool-banner-chip { max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
    .tool-banner-image { flex: none; width: 106px; height: 102px; }

    /* Catalogue cards (Discover Lists) by the app's compact layout, whose values the element carries beside the regular ones. */
    .catalogue {
        grid-auto-flow: column;
        grid-template-columns: none;
        grid-auto-columns: calc((100% + var(--end) - var(--cols-compact, 2) * var(--gap-compact, 8px) - var(--peek)) / var(--cols-compact, 2));
        gap: var(--gap-compact, 8px);
        overflow-x: auto;
    }
    .catalogue.wrapped-compact {
        grid-auto-flow: row;
        grid-template-columns: repeat(var(--cols-compact, 2), minmax(0, 1fr));
        overflow: visible;
    }

    /* My Designs: Settings in the bar, the folders in a row over the designs. */
    .icon-button.phone-only { display: inline-flex; }
    .designs-header .account-menu-anchor { display: none; }
    .designs-tab[data-tab="Folders"] { display: none; }
    .folders-shelf-row { gap: 8px; }
    .folders-shelf-row .folder-tile { width: 84px; }

    /* The AI editor's pills start at the edge, as in the app. */
    .ai-controls { align-self: flex-start; }

    /* Create: every row starts at the edge and scrolls; the photo shortcut floats over the tab bar. */
    .create-row, .create-row.scrolls { justify-content: flex-start; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); overflow-x: auto; scrollbar-width: none; }
    .create-fab {
        display: block;
        position: fixed;
        inset-inline-end: 16px;
        bottom: 72px;
        z-index: 21;
        height: 44px;
        padding-inline: 20px;
        border: none;
        border-radius: 999px;
        background: var(--accent);
        color: #ffffff;
        font: inherit;
        font-size: 15px;
        font-weight: 600;
        box-shadow: 0 4px 12px #00000040;
        cursor: pointer;
    }
}

/* The editor's pickers on a wide window are its forms (Figma 2966-12807): the same card, a 20 px title and a 32 px
   close 24 px from the top. */
@media (min-width: 720px) {
    .picker-panel { border: 1px solid var(--dialog-edge); border-radius: 26px; box-shadow: 0 10px 36px #0000000f, 0 2px 8px #00000008; }
    .picker-head.titled { min-height: 32px; padding: 23px 16px 0; }
    .picker-head.titled .picker-title { font-size: 20px; line-height: 25px; font-weight: 700; }
    .picker-head .close-button { width: 32px; height: 32px; background: var(--soft); color: var(--ink); }
    /* An untitled block's head keeps 8 px, so the first tiles sit 24 under the title. */
    .picker-body .section-head:has(> .section-text:only-child:empty) { padding-top: 8px; }
}
