/* The editor page (E06, E07). Layout and the parts that only the editor has.
   The look of buttons, inputs, tabs, dialogs and the rest comes from shadcn.css (shadcn/ui components) and tokens.css. */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
.brand { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -48px; z-index: 50; background: var(--primary); color: var(--primary-foreground); padding: 8px 12px; border-radius: var(--radius-md); }
.skip:focus { top: 8px; }
/* A fallback ring for anything that has no ring of its own. Components in shadcn.css have their own. */
:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.noscript { padding: 16px; text-align: center; }

/* The editor fills the window. The footer is below it: scroll down to reach it. */
.shell { display: flex; flex-direction: column; height: 100dvh; min-height: 520px; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--background); flex: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.2px; font-size: 16px; white-space: nowrap; color: inherit; text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, #667eea, #ec4899); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
/* above the dimming layer of an open menu (shadcn.css, .menu-scrim): the top bar and the avatar stay lit */
.topbar { position: relative; z-index: 25; }
.ico { width: 18px; height: 18px; flex: none; }
.lock { width: 15px; height: 15px; opacity: .7; }
/* A Premium user sees no lock icon anywhere (app.js sets data-plan). An SVG ignores the hidden attribute, so this is done in CSS. */
[data-plan="premium"] .lock { display: none; }
.file-btn { cursor: pointer; position: relative; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

/* layout: the whole area under the top bar is one dotted board. The preview sits on it, and the settings are a card that floats
   on it with a gap on every side (not fixed to the edge). The board and the card take their colours from the theme. */
.app { --board: var(--muted); --board-dot: color-mix(in oklab, var(--foreground) 22%, transparent); --float: var(--background);
  flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 372px;
  background-color: var(--board); background-image: radial-gradient(circle, var(--board-dot) 1px, transparent 1.6px); background-size: 18px 18px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .app { --board: var(--background); --board-dot: color-mix(in oklab, var(--foreground) 17%, transparent); --float: var(--card); } }
.stage { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; padding: 24px; overflow: hidden; outline: none; }
/* The card is as high as its groups need. When they need more than the window has, the groups scroll inside it. */
.panel { display: flex; flex-direction: column; align-self: start; max-height: calc(100% - 24px); min-height: 0; margin: 12px 12px 12px 0; border: 1px solid var(--border); border-radius: 20px; background: var(--float); box-shadow: var(--shadow-lg); overflow: hidden; }

/* drop area */
.drop { width: 100%; height: 100%; display: grid; place-items: center; border: 2px dashed var(--border); border-radius: 24px; transition: background .15s, border-color .15s; }
.drop.over { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.drop-card { text-align: center; max-width: 460px; padding: 24px; display: grid; gap: 12px; justify-items: center; }
.drop-card h2 { font-size: 28px; line-height: 1.15; letter-spacing: -0.8px; font-weight: 600; text-wrap: balance; }
.drop-card p { color: var(--muted-foreground); }
.drop-ico { width: 44px; height: 44px; color: var(--muted-foreground); }
.drop-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

/* preview */
.view { position: relative; line-height: 0; }
.view[hidden], .drop[hidden] { display: none; }
#preview { display: block; border-radius: 4px; box-shadow: var(--shadow-lg); background: repeating-conic-gradient(#8883 0 25%, transparent 0 50%) 0 0 / 14px 14px; }
.overlay { position: absolute; inset: 0; touch-action: none; }
.overlay.pan { cursor: grab; }
.overlay.panning { cursor: grabbing; }
.overlay.drawing { cursor: crosshair; }
/* With a drawing tool chosen, existing items must not catch the pointer: a new item can start on top of them. */
.overlay.drawing .ann, .overlay.drawing .handle, .overlay.drawing svg * { pointer-events: none !important; }
.ann { position: absolute; border: 2px solid transparent; border-radius: 3px; cursor: move; pointer-events: auto; }
.ann.sel { border-color: #3b82f6; }
.ann.redact { background: rgba(59,130,246,.0); }
.ann.draft { border: 2px dashed #3b82f6; background: rgba(17,24,39,.55); }
.ann:focus-visible { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3b82f6; }
.handle { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: #fff; border: 2px solid #3b82f6; cursor: nwse-resize; pointer-events: auto; touch-action: none; }
.arrow-line { position: absolute; height: 0; transform-origin: 0 0; border-top: 2px dashed #3b82f6; pointer-events: none; }
/* The inline editor of a text label. The selector is stronger on purpose than the shadcn text input rules (width 100%, height 36px,
   a clear dark background): without it the box fills the whole image width and runs past the image. The width is set in annotate-ui.js. */
:root .overlay input.label-edit[type="text"] { position: absolute; z-index: 5; width: auto; min-width: 96px; height: auto; padding: 2px 8px; font: 600 16px/1.3 var(--font-sans); background: #fff; color: #111; border: 2px solid #3b82f6; border-radius: 6px; }
/* The floating bar above the selected item (copy, delete) and the round handle that turns it. Both sit on top of the preview.
   .view has line-height 0, so the bar sets its own. Colours come from the theme tokens, so dark mode follows. */
.sel-bar { position: absolute; z-index: 6; display: flex; align-items: center; gap: 2px; padding: 4px; line-height: 1; border-radius: 999px; background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border); box-shadow: var(--shadow-lg); touch-action: none; }
.sel-bar button { appearance: none; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: inherit; cursor: pointer; }
.sel-bar button:hover { background: var(--accent); }
.sel-bar button:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.sel-bar button.danger:hover { color: var(--destructive); }
.sel-bar .ico { width: 18px; height: 18px; }
.rot-handle { position: absolute; z-index: 5; width: 28px; height: 28px; margin: -14px 0 0 -14px; padding: 0; display: grid; place-items: center; border-radius: 50%; background: var(--popover); color: var(--popover-foreground); border: 1px solid var(--border); box-shadow: var(--shadow-lg); cursor: grab; touch-action: none; }
.rot-handle:active { cursor: grabbing; }
.rot-handle .ico { width: 16px; height: 16px; pointer-events: none; }
.notes { position: absolute; left: 12px; right: 12px; bottom: 10px; text-align: center; font-size: 12.5px; color: var(--muted-foreground); pointer-events: none; }

/* The settings are groups that open and close (an accordion): Frame, Background, Layout, Annotate, Export.
   Each group is a heading with one button. The button has aria-expanded, and the pane under it is hidden while it is closed.
   Any number of groups can be open at once. */
.panes { flex: 1 1 auto; min-height: 0; overflow: auto; scrollbar-width: thin; }
.group + .group { border-top: 1px solid var(--border); }
.group-head { margin: 0; font: inherit; }
.group-btn { appearance: none; display: flex; align-items: center; gap: 12px; width: 100%; height: 52px; padding: 0 16px; border: 0; border-radius: 0; background: transparent; color: var(--foreground);
  font: 600 13px/1 var(--font-sans); letter-spacing: .05em; text-transform: uppercase; text-align: left; cursor: pointer; outline: none; transition: background-color .15s, color .15s; }
.group-btn > span { flex: 1 1 auto; }
.group-btn .ico { color: var(--muted-foreground); }
.group-btn .chev { width: 18px; height: 18px; transition: transform .2s ease; }
.group-btn[aria-expanded="true"] .chev { transform: rotate(180deg); }
.group-btn[aria-expanded="false"] { color: var(--muted-foreground); background: color-mix(in oklab, var(--muted) 55%, transparent); }
.group-btn:hover { color: var(--foreground); background: color-mix(in oklab, var(--accent) 80%, transparent); }
/* inside the button: the scroll area around it would cut a ring that sits outside */
.group-btn:focus-visible { box-shadow: inset 0 0 0 2px var(--ring); }
.pane { padding: 8px 16px 20px; display: grid; gap: 14px; align-content: start; }
.pane[hidden] { display: none; }
.sub { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-foreground); font-weight: 600; margin-top: 6px; display: flex; justify-content: space-between; align-items: baseline; }
.count { text-transform: none; letter-spacing: 0; font-weight: 500; }

.grid { display: grid; gap: 10px; }
.frames { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.frame-btn { position: relative; display: grid; gap: 6px; min-width: 0; width: 100%; padding: 6px; cursor: pointer; text-align: left; }
.frame-btn canvas { width: 100%; max-width: 100%; height: auto; display: block; border-radius: var(--radius-md); }
.frame-btn span { font-size: 12.5px; font-weight: 500; padding: 0 2px 2px; }
.badge { position: absolute; top: 10px; right: 10px; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; }
.badge .ico { width: 13px; height: 13px; }

.sw-group { display: grid; gap: 8px; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.sw { aspect-ratio: 1; padding: 0; overflow: hidden; background: var(--muted); cursor: pointer; }
.sw canvas { width: 100%; height: 100%; display: block; }

.row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: center; gap: 10px; }
.row.stack { grid-template-columns: 1fr; }
.row label, .row > span:first-child { font-weight: 500; }
.range { display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 8px; align-items: center; }
.range output { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted-foreground); font-size: 12.5px; }
.colors { display: flex; gap: 8px; }
.tools button span { font-size: 13px; }

.premium-box { border: 1px dashed var(--border); border-radius: var(--radius-lg); padding: 12px; display: grid; gap: 8px; }
.premium-head { display: flex; justify-content: space-between; align-items: center; }
.palette { display: flex; flex-wrap: wrap; gap: 8px; }
.palette button { width: 44px; height: 44px; border-radius: var(--radius-md); border: 1px solid var(--border); cursor: pointer; position: relative; padding: 0; }
.palette.locked button { filter: grayscale(.9) blur(1.5px); }

/* the format tiles in the Frame tab: a small picture of the shape, the name and the pixel size. Two columns, like the frames. */
.sizes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.size-btn { display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-areas: "shape name" "shape dim"; column-gap: 10px; row-gap: 0; align-items: center; padding: 8px 10px; cursor: pointer; text-align: left; }
.size-btn .shape { grid-area: shape; width: 26px; margin: 0 auto; border: 2px solid currentColor; border-radius: 3px; opacity: .75; }
.size-btn .size-name { grid-area: name; font-weight: 500; }
.size-btn small { grid-area: dim; color: var(--muted-foreground); font-weight: 500; font-size: 12px; }
.export-actions { display: grid; gap: 8px; margin-top: 4px; }
.fine-link { font-size: 12.5px; }

.props { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.props[hidden], [data-prop][hidden] { display: none; }
.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.items button { width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--card); cursor: pointer; font-weight: 500; }
.items button[aria-current="true"] { border-color: #3b82f6; }

/* dialogs of the editor (the dialog itself is in shadcn.css) */
.dev-form { display: grid; gap: 8px; padding: 12px; border: 1px dashed var(--border); border-radius: var(--radius-md); }
.dev-form[hidden] { display: none; }
.dev-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-line { font-weight: 600; margin: 0; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* The account icon (the avatar look is in shadcn.css): after sign-in it replaces the person icon and the words.
   The word "Account" stays for screen readers. */
.account-btn.signed { padding: 0; width: 40px; height: 40px; border-radius: 50%; border-color: transparent; background: transparent; box-shadow: none; }
.account-btn[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--ring); }
.account-btn.signed .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- the avatar menu, the settings dialog and the brand library (E11, E15) ---- */
.account-menu { position: relative; display: flex; align-items: center; }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 14px 14px 12px; border-bottom: 1px solid var(--border); }
.menu-who { display: grid; gap: 2px; min-width: 0; justify-items: start; }
.menu-who strong { font-size: 14px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-who .fine { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-who .badge-pill { margin-top: 4px; }
.menu-upgrade { margin-bottom: 0; background: color-mix(in oklab, #be185d 7%, transparent); }
.menu-upgrade .ico { color: #be185d; }
.menu-upgrade .menu-text > span { font-weight: 500; }

/* ---- Settings: a full-screen page in the look of a profile page (Roman, 2026-11-14) ----
   A round picture with the name and the email, four tabs with an underline (Profile, Brand, Plan, Billing), and soft round cards. */
.settings { --s-card: var(--muted); --rose: #f43f5e; --violet: #7c3aed; --indigo: #6366f1; --cyan: #06b6d4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .settings { --s-card: var(--card); } }
:root[data-theme="dark"] .settings { --s-card: var(--card); }
.settings-shell { position: relative; height: 100%; background: var(--background); }
.settings-x { position: absolute; z-index: 3; top: max(16px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); }
.settings-scroll { height: 100%; overflow-y: auto; padding: 64px 24px calc(72px + env(safe-area-inset-bottom)); }
.settings-page { max-width: 56rem; margin: 0 auto; display: grid; gap: 20px; align-content: start; }
.settings.solo .s-who, .settings.solo .s-tabs { display: none; }
.s-who { display: flex; align-items: center; gap: 16px; }
.s-who-text { display: grid; gap: 2px; min-width: 0; }
.s-who-text strong { font-size: 15px; font-weight: 500; }
.s-who-text span { color: var(--muted-foreground); font-size: 15px; overflow-wrap: anywhere; }
.s-tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.s-tabs::-webkit-scrollbar { display: none; }
.s-tabs [role="tab"] { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 10px 0 14px; border: 0; background: none; color: var(--muted-foreground);
  font: 500 17px/1.2 var(--font-sans); cursor: pointer; white-space: nowrap; }
.s-tabs [role="tab"]:hover, .s-tabs [role="tab"][aria-selected="true"] { color: var(--foreground); }
.s-tabs [role="tab"][aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--foreground); }
.s-tabs [role="tab"]:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.s-tabs .ico { width: 14px; height: 14px; }
.s-lead { margin: 0; color: var(--muted-foreground); }
.spane { display: grid; gap: 16px; align-content: start; }
.spane[hidden] { display: none; }
.s-card { display: grid; gap: 18px; padding: 28px 32px; border-radius: 28px; background: var(--s-card); }
.s-card.danger { background: color-mix(in oklab, var(--destructive) 9%, var(--s-card)); }
.s-label { margin: 0; font-size: 14px; font-weight: 400; color: var(--muted-foreground); }
.s-dl { margin: 0; display: grid; gap: 20px; }
.s-dl dt { font-size: 15px; font-weight: 500; }
.s-dl dd { margin: 2px 0 0; color: var(--muted-foreground); font-size: 15px; overflow-wrap: anywhere; }
.s-muted { color: var(--muted-foreground); }
.s-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.s-row > .btn { flex: none; }
.s-grow { flex: 1 1 auto; min-width: 0; }
.s-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn.pill { height: 44px; padding: 0 22px; border-radius: 9999px; }
.settings .s-card .btn:not(.primary):not(.danger) { background: var(--background); border-color: transparent; }
.settings .s-card .btn:not(.primary):not(.danger):hover { border-color: var(--border); }
.s-links { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 0 4px; }
.s-links a, .s-links button { appearance: none; border: 0; background: none; padding: 0; color: var(--muted-foreground); font: inherit; font-size: 15px; cursor: pointer; text-decoration: none; border-radius: var(--radius-sm); }
.s-links a:hover, .s-links button:hover { color: var(--foreground); text-decoration: underline; text-underline-offset: 4px; }
.s-links a:focus-visible, .s-links button:focus-visible { outline: none; box-shadow: var(--focus-ring); color: var(--foreground); }
#delete-form { display: grid; gap: 14px; }
#delete-form p, #delete-form ul { margin: 0; }
#delete-form ul { padding-left: 20px; display: grid; gap: 4px; }
.s-notice { margin: 0; padding: 14px 20px; border: 1px solid color-mix(in oklab, #be185d 30%, var(--border)); border-radius: 20px; background: color-mix(in oklab, #be185d 7%, transparent); font-weight: 500; }
.s-block { display: grid; gap: 14px; }
.s-block > p { margin: 0; }
.s-heading { margin: 8px 0 0; font-size: 20px; font-weight: 600; letter-spacing: -0.3px; }
.plan-line { font-weight: 600; margin: 0; }

/* The plans: three cards. Paid cards have a stroke in colour; the flag on top says what the user should know about that card. */
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; padding-top: 14px; }
/* With the Yearly card there are four cards, and the settings page is 56rem wide: they sit two by two (Free, Monthly / Yearly, Lifetime). */
.plans.has-yearly { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.plan-card[hidden] { display: none; }
.plans-tax { margin: 6px 0 0; text-align: center; }
.plans-tax[hidden] { display: none; }
.plan-card { --tick: var(--success); position: relative; display: flex; flex-direction: column; gap: 10px; padding: 26px 22px 22px; border: 1px solid var(--border); border-radius: 24px; background: var(--s-card); }
.plan-card[data-card="monthly"], .plan-card[data-card="yearly"], .plan-card[data-card="lifetime"] { border: 1.5px solid transparent; }
.plan-card[data-card="monthly"], .plan-card[data-card="yearly"] { --tick: var(--cyan); background: linear-gradient(var(--s-card), var(--s-card)) padding-box, linear-gradient(135deg, var(--indigo), var(--cyan)) border-box; }
.plan-card[data-card="lifetime"] { --tick: var(--rose); background: linear-gradient(color-mix(in oklab, var(--violet) 7%, var(--s-card)), color-mix(in oklab, var(--violet) 7%, var(--s-card))) padding-box, linear-gradient(135deg, var(--rose), var(--violet)) border-box;
  box-shadow: 0 10px 36px -14px color-mix(in oklab, var(--rose) 55%, transparent); }
.plan-card.is-current:not([data-card="free"]) { box-shadow: none; }
.plan-flag { position: absolute; top: -13px; left: 20px; padding: 4px 12px; border-radius: 9999px; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: #fff; background: linear-gradient(135deg, var(--rose), var(--violet)); }
.plan-flag.is-you { color: var(--background); background: var(--foreground); }
.plan-flag[hidden] { display: none; }
.plan-card h4 { margin: 0; font-size: 16px; font-weight: 600; }
.plan-card p { margin: 0; }
.plan-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.plan-amount { font-size: 36px; font-weight: 700; letter-spacing: -1px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.plan-unit { font-size: 14px; color: var(--muted-foreground); }
.plan-sub { font-size: 13px; color: var(--muted-foreground); }
.plan-sub s { text-decoration: line-through; }
.plan-lead { min-height: 2.8em; font-size: 14px; }
.plan-points { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 9px; font-size: 14px; }
.plan-points li { display: flex; align-items: flex-start; gap: 10px; line-height: 1.4; }
.plan-points li::before { content: ""; flex: none; width: 16px; height: 16px; margin-top: 2px; background: var(--tick);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat; }
.plan-note { margin-top: 2px; }
.plan-cta { margin-top: auto; padding-top: 14px; }
.plan-cta .btn, .plan-current { width: 100%; height: 44px; border-radius: 12px; }
.plan-card[data-card="lifetime"] .btn.primary { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--rose), var(--violet)); }
.plan-card[data-card="lifetime"] .btn.primary:hover { filter: brightness(1.08); }
.plan-current { display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px dashed var(--border); color: var(--muted-foreground); font-weight: 600; }
.plan-current[hidden], .plan-cta .btn[hidden] { display: none; }

/* "Pay securely through Stripe": the wordmark is Stripe's own file, unchanged, in the colour for the background (slate on light, white on dark). */
.stripe-trust { display: grid; justify-items: center; gap: 2px; padding-top: 6px; text-align: center; }
.stripe-trust[hidden] { display: none; }
.stripe-line { display: flex; align-items: center; gap: 4px; margin: 0; color: var(--muted-foreground); font-size: 16px; }
.stripe-logo { display: block; width: 72px; height: 30px; }
.stripe-on-dark { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stripe-on-light { display: none; } :root:not([data-theme="light"]) .stripe-on-dark { display: block; } }
:root[data-theme="dark"] .stripe-on-light { display: none; }
:root[data-theme="dark"] .stripe-on-dark { display: block; }

/* The comparison table: groups (Frames, Backgrounds, ...) with a heading row */
.cmp-wrap { border-radius: 24px; background: var(--s-card); overflow-x: auto; }
.cmp-wrap:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.cmp { width: 100%; border-collapse: collapse; font-size: 14px; }
.cmp th, .cmp td { padding: 12px 18px; text-align: left; vertical-align: top; border-top: 1px solid var(--border); }
.cmp thead th { border-top: 0; font-weight: 600; white-space: nowrap; padding-top: 18px; }
.cmp tbody th[scope="row"] { width: 46%; font-weight: 500; }
.cmp .cmp-group th { padding: 18px 18px 8px; border-top: 0; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); }
.cmp .cmp-group + tr > * { border-top: 0; }
.cmp-note { display: block; margin-top: 2px; font-size: 13px; font-weight: 400; line-height: 1.45; color: var(--muted-foreground); }
.cmp thead .badge-pill { margin-left: 6px; font-size: 11px; font-weight: 500; vertical-align: 1px; }
.cmp .yes { width: 16px; height: 16px; color: var(--success); vertical-align: -3px; }
.cmp .no { color: var(--muted-foreground); }
.cmp[data-plan="free"] [data-label="Free"], .cmp[data-plan="premium"] [data-label="Premium"] { background: color-mix(in oklab, var(--foreground) 4%, transparent); }

/* The payment history (Billing tab) */
.history { list-style: none; margin: 0; padding: 0; display: grid; }
.h-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; align-items: center; padding: 16px 0; border-top: 1px solid var(--border); }
.h-row:first-child { border-top: 0; padding-top: 0; }
.h-title { font-weight: 500; overflow-wrap: anywhere; }
.h-meta { grid-column: 1; color: var(--muted-foreground); font-size: 14px; }
.h-side { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 12px; }
.h-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.h-links { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 6px; font-size: 14px; }
.h-links a { color: var(--foreground); text-underline-offset: 3px; border-radius: var(--radius-sm); }
.h-links a:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.badge-pill.st-paid { background: color-mix(in oklab, var(--success) 16%, transparent); color: var(--success); border-color: transparent; }
.badge-pill.st-failed, .badge-pill.st-void { background: color-mix(in oklab, var(--destructive) 14%, transparent); color: var(--destructive); border-color: transparent; }

.badge-pill { text-transform: none; letter-spacing: 0; }
.badge-pill .ico { width: 12px; height: 12px; opacity: 1; }
.badge-pill.premium { background: #be185d; color: #fff; }

/* My backgrounds in the Background tab */
.my-bg, .bg-pos { display: grid; gap: 8px; }
.my-bg-body { display: grid; gap: 8px; }
.sw img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sw.add { display: grid; place-items: center; border-style: dashed; color: var(--muted-foreground); }
.sw.add:hover { color: var(--foreground); }
.sw.add .ico { width: 20px; height: 20px; }
.sw.busy { opacity: .6; cursor: progress; }
.lock-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.lock-tiles span { aspect-ratio: 16 / 10; border-radius: var(--radius-md); border: 1px solid var(--border); background: linear-gradient(135deg, color-mix(in oklab, var(--muted-foreground) 25%, transparent), color-mix(in oklab, var(--muted-foreground) 8%, transparent)); display: grid; place-items: center; color: var(--muted-foreground); }
.lock-tiles .ico { width: 16px; height: 16px; }
.my-bg-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.linklike { appearance: none; border: 0; background: none; padding: 0; color: var(--foreground); font: 500 12.5px/1.4 var(--font-sans); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linklike:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--radius-sm); outline: none; }

/* the brand library in the settings dialog */
#brand-manager { display: grid; gap: 16px; }
.brand-usage { display: grid; gap: 6px; }
.brand-usage-line { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand-upload { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 20px 16px; border: 2px dashed var(--border); border-radius: var(--radius-xl); transition: background .15s, border-color .15s; }
.brand-upload.over { border-color: var(--primary); background: color-mix(in oklab, var(--primary) 6%, transparent); }
.brand-upload .ico { width: 24px; height: 24px; color: var(--muted-foreground); }
.brand-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.brand-card { display: grid; grid-template-rows: auto 1fr auto; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--card); box-shadow: var(--shadow-xs); }
.brand-thumb { aspect-ratio: 16 / 10; background: var(--muted); }
.brand-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-meta { display: grid; gap: 2px; padding: 8px 10px 4px; min-width: 0; }
.brand-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-actions { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 6px 8px; }
.brand-actions .btn { height: 30px; padding: 0 10px; font-size: 13px; }
.brand-confirm { display: grid; gap: 6px; padding: 4px 10px 10px; }
.brand-rename { display: grid; gap: 6px; padding: 8px 10px 4px; }
.brand-rename input { height: 32px; }
.brand-empty { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 24px 16px; border: 1px dashed var(--border); border-radius: var(--radius-xl); }

@media (max-width: 720px) {
  .settings-scroll { padding: 60px 16px calc(40px + env(safe-area-inset-bottom)); }
  .s-card { padding: 22px 20px; border-radius: 22px; }
  /* Six tabs (Feedback and Support were added 2026-11-14) must still sit in one row at 390 px. At 17 px and a 22 px gap the row is
     457 px wide, so the text is smaller and the gap tighter here. A narrower screen still scrolls the row sideways (overflow-x on .s-tabs). */
  .s-tabs { gap: 10px; }
  .s-tabs [role="tab"] { font-size: 14px; }
  .s-row.stack { flex-direction: column; align-items: stretch; }
  .s-row.stack > .btn { width: 100%; }
  .plan-lead { min-height: 0; }
  .plans, .plans.has-yearly { grid-template-columns: minmax(0, 1fr); }
  .h-row { grid-template-columns: minmax(0, 1fr); }
  .h-side { grid-column: 1; grid-row: auto; }
  .cmp-wrap { overflow-x: visible; }
  .cmp thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cmp, .cmp tbody, .cmp tr, .cmp th, .cmp td { display: block; }
  .cmp tr { padding: 10px 18px; border-top: 1px solid var(--border); }
  .cmp tbody tr:first-child, .cmp .cmp-group + tr { border-top: 0; }
  .cmp .cmp-group { padding: 18px 18px 4px; }
  .cmp .cmp-group th { padding: 0; }
  .cmp th, .cmp td { padding: 2px 0; border: 0; }
  .cmp tbody th[scope="row"] { width: auto; font-weight: 600; }
  .cmp td { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 8px; padding: 3px 6px; margin: 0 -6px; border-radius: var(--radius-sm); }
  .cmp td::before { content: attr(data-label); color: var(--muted-foreground); font-weight: 500; }
  .cmp[data-plan="free"] [data-label="Free"]::before, .cmp[data-plan="premium"] [data-label="Premium"]::before { color: var(--foreground); font-weight: 600; }
}

/* tablet and phone: the settings become a sheet at the bottom; controls are 40 px high for the thumb */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .stage { padding: 12px; }
  /* On a small screen the card is a sheet at the bottom with a fixed height, so the preview does not jump when a group opens. */
  .panel { align-self: stretch; max-height: none; margin: 0 8px calc(8px + env(safe-area-inset-bottom)); height: 46dvh; border-radius: 16px; }
  .drop-card h2 { font-size: 22px; }
  .topbar { padding: 8px 12px; }
  #export-top span, #new { display: none; }
  #export-top { padding: 0 12px; }
  .frames { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sizes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .toast { bottom: calc(46dvh + 20px); }
  .btn, .icon-btn, .seg button, input[type="text"], input[type="email"], select { height: 40px; }
  .icon-btn { width: 40px; }
}
@media (max-width: 480px) {
  .account-btn .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .account-btn { padding: 0; width: 40px; }
  .brand { font-size: 15px; }
  .frames { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sizes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .swatches { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
