/* Notion-style design tokens (the same as the other apps). Tailwind reads these through @theme in index.php. */
:root {
    color-scheme: light;

    --bg: #ffffff;
    --ink: #37352f;
    --ink-2: rgba(55, 53, 47, 0.65);
    --ink-3: rgba(55, 53, 47, 0.4);
    --line: rgba(55, 53, 47, 0.09);
    --hover: rgba(55, 53, 47, 0.06);
    --accent: #2383e2;
    --danger: #d44c47;
    --good: #448361;

    --menu-shadow: rgba(15, 15, 15, 0.05) 0 0 0 1px, rgba(15, 15, 15, 0.1) 0 3px 6px, rgba(15, 15, 15, 0.2) 0 9px 24px;

    /* the editor's own: the purple of picked things on the picture, the grey round the page */
    --pick: #8b3dff;
    --pick-soft: rgba(139, 61, 255, 0.1);
    --board: #ebecf0;
    --card: #f7f7f5;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;

        --bg: #191919;
        --ink: rgba(255, 255, 255, 0.81);
        --ink-2: rgba(255, 255, 255, 0.46);
        --ink-3: rgba(255, 255, 255, 0.28);
        --line: rgba(255, 255, 255, 0.094);
        --hover: rgba(255, 255, 255, 0.055);
        --danger: #ff7369;
        --good: #5bb37f;

        --menu-shadow: rgba(255, 255, 255, 0.094) 0 0 0 1px, rgba(0, 0, 0, 0.5) 0 9px 24px;

        --pick: #a370ff;
        --pick-soft: rgba(163, 112, 255, 0.16);
        --board: #0f0f10;
        --card: #222222;
    }
}

body {
    background: var(--bg);
    color: var(--ink);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    -webkit-tap-highlight-color: transparent;
}

/* Native dropdown lists: give the options solid colours (Windows dark mode leaves them invisible otherwise) */
select option,
select optgroup {
    background-color: var(--bg);
    color: var(--ink);
}


/* ---------- Photo ---------- */

button {
    cursor: pointer;
}

button:disabled {
    cursor: default;
    opacity: 0.35;
}

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

html,
body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}

.on-home .in-editor {
    display: none !important;
}

/* hidden from the scripts; Tailwind's own .hidden loses to these elements' id rules */
#home.hidden,
#editor.hidden,
#drop-hint.hidden,
#yours.hidden,
.menu.hidden {
    display: none !important;
}

.bar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: var(--ink-2);
    flex-shrink: 0;
}

.bar-btn:hover:not(:disabled) {
    background: var(--hover);
    color: var(--ink);
}

.primary-btn,
.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.danger-btn {
    background: var(--danger);
}

.primary-btn:hover,
.danger-btn:hover {
    filter: brightness(0.94);
}

.soft-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg);
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
}

.soft-btn:hover {
    background: var(--hover);
}

.soft-btn.wide {
    width: 100%;
    margin-top: 8px;
}

.mini {
    margin: 4px 4px 0 0;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: 5px;
    font-size: 12px;
    color: var(--ink-2);
}

.mini:hover {
    background: var(--hover);
    color: var(--ink);
}

.field {
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg);
    font-size: 13px;
    min-width: 0;
}

.name-input {
    min-width: 60px;
    max-width: 260px;
    height: 28px;
    padding: 0 6px;
    border-radius: 5px;
    background: transparent;
    text-overflow: ellipsis;
}

.name-input:hover,
.name-input:focus {
    background: var(--hover);
    outline: none;
}

.zoom {
    align-items: center;
    margin: 0 4px;
}

.zoom-label {
    min-width: 48px;
    height: 28px;
    border-radius: 5px;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--ink-2);
}

.zoom-label:hover {
    background: var(--hover);
}


/* ---------- Start screen ---------- */

.home-h {
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 600;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.preset {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    text-align: left;
}

.preset:hover {
    border-color: var(--pick);
    background: var(--pick-soft);
}

.preset-shape {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 6px;
}

.preset-shape span {
    border-radius: 3px;
    background: linear-gradient(135deg, #a18cd1, #fbc2eb);
}

.preset-name {
    font-size: 13px;
    font-weight: 500;
}

.preset-size {
    font-size: 12px;
    color: var(--ink-3);
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    align-items: start;
}

.template-grid.small {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.template {
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
}

.template-img {
    display: block;
    overflow: hidden;
    width: 100%;
    border-radius: 8px;
    background: var(--card);
    box-shadow: 0 0 0 1px var(--line);
}

.template:hover .template-img {
    box-shadow: 0 0 0 2px var(--pick);
}

.template-img canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.template-name {
    font-size: 13px;
    color: var(--ink-2);
}

.template {
    position: relative;
}

.template.tpl-off {
    display: none;
}

.tpl-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 1px 7px;
    border-radius: 9px;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 11px;
}

/* Templates: a search box and kinds over the grid */
.tpl-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.tpl-search {
    width: 100%;
    max-width: 360px;
}

.tpl-cats {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tpl-cats button {
    flex-shrink: 0;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 15px;
    background: var(--hover);
    color: var(--ink-2);
    font-size: 13px;
    white-space: nowrap;
}

.tpl-cats button.on {
    background: var(--pick-soft);
    color: var(--pick);
    font-weight: 600;
}

#add-templates + .tpl-none,
.tpl-none {
    margin: 4px 0 12px;
}

.psec .tpl-search {
    max-width: none;
}

/* the preview window: the template big, its pages and colours beside it */
.tpl-dlg {
    display: flex;
    gap: 16px;
    max-height: calc(100dvh - 48px);
    padding: 16px;
}

.tpl-view {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 12px;
    border-radius: 10px;
    background: var(--hover);
}

.tpl-view canvas {
    max-width: 100%;
    max-height: calc(100dvh - 120px);
    border-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.tpl-side {
    display: flex;
    flex-direction: column;
    width: 300px;
    flex-shrink: 0;
    overflow-y: auto;
}

.tpl-pages,
.tpl-vars {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    align-items: start;
}

.tpl-pages button,
.tpl-vars button {
    overflow: hidden;
    border-radius: 6px;
    box-shadow: 0 0 0 1px var(--line);
}

.tpl-pages button.on,
.tpl-vars button.on {
    box-shadow: 0 0 0 2px var(--pick);
}

.tpl-pages canvas,
.tpl-vars canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.tpl-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: auto;
    padding-top: 16px;
}

@media (max-width: 767px) {
    .tpl-dlg {
        flex-direction: column;
        overflow-y: auto;
    }

    .tpl-view canvas {
        max-height: 45dvh;
    }

    .tpl-side {
        width: auto;
        overflow: visible;
    }

    .tpl-pages,
    .tpl-vars {
        grid-template-columns: repeat(6, 1fr);
    }

    .tpl-cats button {
        min-height: 36px;
    }
}

.recent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.recent {
    position: relative;
}

.recent-open {
    display: block;
    width: 100%;
}

.recent-img {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    padding: 10px;
    border-radius: 10px;
    background: var(--card);
}

.recent-open:hover .recent-img {
    box-shadow: 0 0 0 2px var(--pick);
}

.recent-img img {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.recent-meta {
    display: flex;
    flex-direction: column;
    padding: 6px 32px 0 2px;
    min-width: 0;
}

.recent-name {
    overflow: hidden;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.recent-size {
    font-size: 12px;
    color: var(--ink-3);
}

.recent-more {
    position: absolute;
    right: 0;
    bottom: 4px;
}


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

#editor {
    display: flex;
    flex: 1;
    min-height: 0;
}

#tools {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 52px;
    padding: 8px 0;
    border-right: 1px solid var(--line);
    overflow-y: auto;
    flex-shrink: 0;
}

.tool {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 36px;
    border-radius: 8px;
    color: var(--ink-2);
    flex-shrink: 0;
}

.tool:hover {
    background: var(--hover);
    color: var(--ink);
}

.tool.on {
    background: var(--pick-soft);
    color: var(--pick);
}

.tool-more {
    position: absolute;
    right: 4px;
    bottom: 4px;
    border: 2.5px solid transparent;
    border-right-color: currentColor;
    border-bottom-color: currentColor;
    opacity: 0.6;
}

.colours {
    position: relative;
    width: 38px;
    height: 40px;
    margin-top: 8px;
    flex-shrink: 0;
}

.chip {
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 5px;
    box-shadow: 0 0 0 1px var(--line), 0 0 0 2px var(--bg), 0 1px 3px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.chip input {
    position: absolute;
    opacity: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.chip.fg {
    left: 2px;
    top: 2px;
    z-index: 1;
}

.chip.bg {
    left: 13px;
    top: 14px;
}

.swap {
    position: absolute;
    right: -4px;
    top: -2px;
    color: var(--ink-3);
}

#stage-col {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

#stage {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: var(--board);
    touch-action: none;
}

#view {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#text-edit {
    position: absolute;
    z-index: 2;
    margin: 0;
    border: 0;
    outline: 1px dashed var(--pick);
    resize: none;
    overflow: hidden;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    transform-origin: center;
    caret-color: var(--pick);
    box-sizing: border-box;
    -webkit-user-select: text;
    user-select: text;
}

#text-edit[hidden] {
    display: none;
}

#drop-hint {
    position: absolute;
    inset: 12px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--pick);
    border-radius: 12px;
    background: var(--pick-soft);
    color: var(--pick);
    font-weight: 600;
    pointer-events: none;
}

#pages {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 84px;
    padding: 8px 12px;
    border-top: 1px solid var(--line);
    overflow-x: auto;
    flex-shrink: 0;
}

.pthumb {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 68px;
    border-radius: 8px;
    background: var(--card);
    cursor: pointer;
    flex-shrink: 0;
}

.pthumb.on {
    box-shadow: 0 0 0 2px var(--pick);
}

.pthumb-img canvas {
    display: block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.pnum {
    position: absolute;
    left: 5px;
    bottom: 3px;
    font-size: 10px;
    color: var(--ink-3);
}

.page-more {
    position: absolute;
    right: 2px;
    top: 2px;
    display: none;
    padding: 1px;
    border-radius: 4px;
    background: var(--bg);
}

.pthumb:hover .page-more,
.pthumb.on .page-more {
    display: block;
}

.add-page {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 68px;
    border: 1px dashed var(--ink-3);
    border-radius: 8px;
    color: var(--ink-2);
    flex-shrink: 0;
}

.add-page:hover {
    border-color: var(--pick);
    color: var(--pick);
}

#panel {
    display: flex;
    flex-direction: column;
    width: clamp(290px, 24vw, 360px);
    border-left: 1px solid var(--line);
    flex-shrink: 0;
    min-height: 0;
}

#panel-tabs {
    display: flex;
    gap: 2px;
    padding: 6px;
    border-bottom: 1px solid var(--line);
}

.ptab {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 5px 2px;
    border-radius: 6px;
    font-size: 11px;
    color: var(--ink-2);
}

.ptab:hover {
    background: var(--hover);
}

.ptab.on {
    background: var(--pick-soft);
    color: var(--pick);
}

#panel-body {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 24px;
    font-size: 13px;
}

.psec {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}

.psec:empty {
    display: none;
}

.psec-h {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 32px;
}

.row .lbl {
    width: 86px;
    flex-shrink: 0;
    color: var(--ink-2);
}

.row select.field {
    flex: 1;
}

.slider input {
    flex: 1;
    min-width: 0;
    accent-color: var(--pick);
}

.slider output {
    width: 40px;
    text-align: right;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--ink-2);
}

.check {
    gap: 8px;
}

.check input {
    accent-color: var(--pick);
}

.colour-row {
    flex-wrap: wrap;
}

.swatch-btn {
    position: relative;
    display: block;
    width: 30px;
    height: 24px;
    border-radius: 5px;
    background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0 / 8px 8px;
    box-shadow: 0 0 0 1px var(--line);
    cursor: pointer;
    overflow: hidden;
}

.swatch-btn span {
    position: absolute;
    inset: 0;
}

.swatch-btn input {
    position: absolute;
    inset: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.quick {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 4px 0 6px;
}

.quick .q {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.quick .q.on {
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--pick);
}

.seg {
    display: flex;
    gap: 2px;
    margin: 4px 0;
    padding: 2px;
    border-radius: 7px;
    background: var(--hover);
}

.seg.grow {
    flex: 1;
    margin: 0;
}

.seg button {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0 6px;
    border-radius: 5px;
    font-size: 12px;
    color: var(--ink-2);
}

.seg button.on {
    background: var(--bg);
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.size-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
}

.numf {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 4px;
    min-width: 0;
    color: var(--ink-3);
    font-size: 12px;
}

.numf .field {
    width: 100%;
    padding: 0 4px;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.icon-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: 6px;
}

.hint {
    margin: 6px 0;
    font-size: 12px;
    color: var(--ink-3);
}

.font-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 6px;
    font-size: 15px;
}

.fx-grid,
.shape-grid,
.clip-grid,
.grad-grid,
.sticker-grid {
    display: grid;
    gap: 6px;
}

.fx-grid {
    grid-template-columns: repeat(4, 1fr);
}

.fx-grid button {
    padding: 8px 2px;
    border-radius: 6px;
    background: var(--hover);
    font-size: 11px;
}

.fx-grid button:hover {
    box-shadow: 0 0 0 1.5px var(--pick);
}

.shape-grid {
    grid-template-columns: repeat(6, 1fr);
}

.clip-grid {
    grid-template-columns: repeat(6, 1fr);
}

.shape-grid button,
.clip-grid button {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 6px;
}

.shape-grid button:hover,
.clip-grid button:hover,
.shape-grid button.on,
.clip-grid button.on {
    background: var(--pick-soft);
}

.shape-grid img,
.clip-grid img {
    width: 30px;
    height: 30px;
}

.grad-grid {
    grid-template-columns: repeat(6, 1fr);
    margin-top: 8px;
}

.grad-grid button {
    aspect-ratio: 1;
    border-radius: 6px;
}

.sticker-h {
    margin: 8px 0 4px;
    font-size: 12px;
    color: var(--ink-3);
}

.sticker-grid {
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}

.sticker-grid button {
    aspect-ratio: 1;
    border-radius: 6px;
    font-size: 22px;
    line-height: 1;
}

.sticker-grid button:hover {
    background: var(--hover);
}

.add-text {
    display: block;
    width: 100%;
    margin-bottom: 6px;
    padding: 9px 10px;
    border-radius: 6px;
    background: var(--hover);
    text-align: left;
}

.add-text:hover {
    box-shadow: 0 0 0 1.5px var(--pick);
}

.combo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 8px;
}

.combo-img canvas {
    display: block;
    width: 100%;
    border-radius: 6px;
}

.combo:hover canvas {
    box-shadow: 0 0 0 2px var(--pick);
}

.pics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 8px;
}

.pics img {
    width: 100%;
    border-radius: 5px;
}

.look-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.look {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 2px;
    border-radius: 6px;
    font-size: 11px;
    color: var(--ink-2);
}

.look:hover {
    background: var(--hover);
}

.look.on {
    background: var(--pick-soft);
    color: var(--pick);
}

.look-img {
    width: 52px;
    height: 52px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--card);
}

.look-img canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#histogram {
    display: block;
    width: 100%;
    height: 70px;
    border-radius: 6px;
    background: var(--hover);
}

#curves {
    display: block;
    width: 100%;
    max-width: 240px;
    aspect-ratio: 1;
    margin: 6px auto;
    border-radius: 6px;
    background: var(--hover);
    touch-action: none;
    cursor: crosshair;
}

.layers-bar {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 4px 8px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

.layers-bar .icon-row {
    margin: 0;
}

.lrow {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 46px;
    padding: 0 6px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    user-select: none;
}

.lrow:hover {
    background: var(--hover);
}

.lrow.on {
    background: var(--pick-soft);
}

.lrow.off .lname,
.lrow.off .lthumb {
    opacity: 0.45;
}

.lrow.in-group {
    padding-left: 22px;
}

.lrow.group .lname {
    font-weight: 600;
}

.lrow.drop-before::before,
.lrow.drop-after::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--pick);
}

.lrow.drop-before::before {
    top: -1px;
}

.lrow.drop-after::after {
    bottom: -1px;
}

.lgrip {
    color: var(--ink-3);
    cursor: grab;
    touch-action: none;
}

.lthumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 5px;
    background: repeating-conic-gradient(#e6e6e6 0 25%, #fff 0 50%) 0 0 / 8px 8px;
    color: var(--ink-2);
    flex-shrink: 0;
}

.lrow.group .lthumb,
.lthumb:has(svg) {
    background: var(--hover);
}

.lmask.editing {
    box-shadow: 0 0 0 2px var(--pick);
}

.lname {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.lbtns {
    display: flex;
    flex-shrink: 0;
}

.lbtns .bar-btn {
    width: 26px;
    height: 26px;
}

.lfold {
    color: var(--ink-3);
}

.bgrow {
    border-bottom: 0;
}

.rename {
    flex: 1;
    height: 26px;
}

/* Menus and pop-ups */
.menu {
    position: fixed;
    z-index: 40;
    min-width: 180px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 4px;
    border-radius: 8px;
    background: var(--bg);
    box-shadow: var(--menu-shadow);
    font-size: 14px;
}

#more-menu {
    position: absolute;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 8px;
    border-radius: 6px;
    text-align: left;
    white-space: nowrap;
}

.menu-item:hover,
.menu-item:focus-visible {
    background: var(--hover);
}

.menu-item img {
    width: 22px;
    height: 22px;
}

.menu-item .key {
    margin-left: auto;
    padding-left: 12px;
    font-size: 12px;
    color: var(--ink-3);
}

.pop.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    width: 320px;
}

.pop.font {
    width: 260px;
    padding: 8px;
}

.font-search {
    width: 100%;
    margin-bottom: 6px;
}

.font-list {
    max-height: 50vh;
    overflow-y: auto;
}

.font-item {
    display: block;
    width: 100%;
    padding: 6px 8px;
    border-radius: 5px;
    font-size: 17px;
    text-align: left;
}

.font-item:hover {
    background: var(--hover);
}

.font-item.on {
    color: var(--pick);
}

.dialog {
    width: min(420px, calc(100vw - 32px));
    max-height: calc(100dvh - 48px);
    /* the reset takes away the browser's own centring of a dialog */
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--bg);
    color: var(--ink);
    box-shadow: var(--menu-shadow);
    font-size: 14px;
}

.dialog::backdrop {
    background: rgba(0, 0, 0, 0.35);
}

.dialog .row .lbl {
    width: 90px;
}

.dialog .row .field {
    flex: 1;
}

.keys td {
    padding: 3px 12px 3px 0;
    vertical-align: top;
}

.keys kbd {
    font-family: inherit;
    font-size: 12px;
    color: var(--ink-2);
    white-space: nowrap;
}

#toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 50;
    max-width: calc(100vw - 32px);
    padding: 9px 14px;
    border-radius: 8px;
    background: #2f2f2f;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translate(-50%, 8px);
    transition: opacity 0.15s, transform 0.15s;
    pointer-events: none;
}

#toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.phone-only {
    display: none;
}


/* ---------- Phones: the picture, a sheet of settings, one bar of tools and tabs ---------- */

#quick-bar,
#text-done,
#text-fmt {
    display: none;
}

@media (max-width: 767px) {
    #editor {
        flex-direction: column;
    }

    #tools,
    #panel-tabs {
        display: none;
    }

    .phone-only {
        display: flex;
    }

    #stage-col {
        order: 1;
        flex: 1;
        min-height: 0;
    }

    /* the strip of pages only when there is more than one */
    #editor.one-page #pages {
        display: none;
    }

    #pages {
        height: 60px;
        padding: 6px 8px;
    }

    .pthumb {
        width: 56px;
        height: 48px;
    }

    .page-more {
        display: block;
    }

    .add-page {
        width: 36px;
        height: 48px;
    }

    /* the sheet */
    #panel {
        order: 2;
        width: auto;
        height: 42dvh;
        border-left: 0;
        border-top: 1px solid var(--line);
        border-radius: 14px 14px 0 0;
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
        background: var(--bg);
    }

    #panel.half {
        height: 42dvh;
    }

    /* full still leaves the picture about 200px (top bar 44, the bar 58) */
    #panel.full {
        height: min(62dvh, calc(100dvh - 330px));
    }

    /* the drawing tools' strip: the chips and one row */
    #panel.mini {
        height: auto;
    }

    #panel.mini #panel-body {
        padding-bottom: 4px;
    }

    #panel.mini #panel-body > :not(.tool-chips):not(.mini-row) {
        display: none;
    }

    #panel:not(.mini) .mini-row {
        display: none;
    }

    .mini-row {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 4px 8px 4px 14px;
    }

    .mini-row > .slider,
    .mini-row > .seg {
        flex: 1;
        min-width: 0;
        margin: 0;
    }

    .mini-row .lbl {
        width: auto;
        min-width: 0;
        margin-right: 6px;
    }

    .mini-more {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1px;
        min-width: 48px;
        min-height: 44px;
        justify-content: center;
        border-radius: 10px;
        color: var(--ink-2);
        font-size: 10.5px;
    }

    .mini-more:active {
        background: var(--hover);
    }

    /* the chip rows fade at the edges, so it shows there is more to swipe to */
    .tool-chips,
    .cat-chips,
    .ratio-chips {
        mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 24px), transparent);
    }

    /* Add and Adjust: one category at a time */
    .cat-chips {
        position: sticky;
        top: 0;
        z-index: 2;
        display: flex;
        gap: 6px;
        padding: 4px 14px 10px;
        overflow-x: auto;
        scrollbar-width: none;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
    }

    .cat-chips button,
    .ratio-chips button,
    .tparts button {
        flex-shrink: 0;
        min-height: 36px;
        padding: 0 14px;
        border-radius: 18px;
        background: var(--hover);
        color: var(--ink-2);
        font-size: 13px;
        white-space: nowrap;
    }

    .cat-chips button.on,
    .ratio-chips button.on,
    .tparts button.on {
        background: var(--pick-soft);
        color: var(--pick);
        font-weight: 600;
    }

    .psec.cat-off {
        display: none;
    }

    #histogram {
        height: 48px;
    }

    /* looks as one row to swipe through */
    .look-grid {
        display: flex;
        gap: 4px;
        margin: 0 -14px;
        padding: 0 14px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .look {
        flex-shrink: 0;
        width: 72px;
    }

    .look-img {
        width: 60px;
        height: 60px;
    }

    /* a picture's buttons as tiles */
    .tile-h {
        margin: 4px 0 6px;
        color: var(--ink-3);
        font-size: 11px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .tile-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px;
        margin-bottom: 10px;
    }

    .tile {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        gap: 5px;
        min-height: 70px;
        padding: 10px 2px 6px;
        border-radius: 12px;
        background: var(--hover);
        color: var(--ink);
        font-size: 11px;
        line-height: 1.2;
        text-align: center;
    }

    .tile svg {
        flex-shrink: 0;
        color: var(--pick);
    }

    .tile:active {
        background: var(--pick-soft);
    }

    /* the text section's parts */
    .tparts {
        display: flex;
        gap: 6px;
        margin-bottom: 10px;
    }

    .tpart.hidden {
        display: none;
    }

    /* crop: the sheet's own header, shape chips */
    .sheet-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: -8px -6px 6px;
        font-weight: 600;
    }

    #panel .sheet-head .bar-btn {
        width: 44px;
        height: 44px;
    }

    .sheet-head .apply {
        color: var(--pick);
    }

    .ratio-chips {
        display: flex;
        gap: 6px;
        margin: 0 -14px 6px;
        padding: 0 14px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    /* hold to compare */
    #compare {
        position: absolute;
        right: 10px;
        bottom: 10px;
        z-index: 2;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 20px;
        background: var(--bg);
        box-shadow: var(--menu-shadow);
        color: var(--ink-2);
        touch-action: none;
        user-select: none;
        -webkit-user-select: none;
        -webkit-touch-callout: none;
    }

    #compare.hidden {
        display: none;
    }

    #compare.on {
        background: var(--pick);
        color: #fff;
    }

    /* bigger things to press */
    .btn-grid .soft-btn,
    .btn-row .soft-btn,
    .btn-row .primary-btn {
        min-height: 44px;
    }

    #pop .menu-head {
        padding: 12px 12px 4px;
    }

    #panel.closed {
        display: none;
    }

    #sheet-grip {
        justify-content: center;
        align-items: center;
        height: 22px;
        flex-shrink: 0;
        touch-action: none;
        cursor: grab;
    }

    #sheet-grip span {
        width: 40px;
        height: 5px;
        border-radius: 3px;
        background: var(--ink-3);
    }

    /* the bar */
    #phone-bar {
        order: 3;
        justify-content: space-around;
        height: 58px;
        padding: 0 2px;
        border-top: 1px solid var(--line);
        background: var(--bg);
        flex-shrink: 0;
    }

    .pbar {
        display: flex;
        flex: 1;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        min-width: 0;
        margin: 4px 1px;
        border-radius: 10px;
        color: var(--ink-2);
        font-size: 10.5px;
        line-height: 1.1;
    }

    .pbar.on {
        background: var(--pick-soft);
        color: var(--pick);
    }

    /* the tools of Draw and Area as chips, with the colours */
    .tool-chips {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 6px 14px 10px;
        border-bottom: 1px solid var(--line);
        overflow-x: auto;
        scrollbar-width: none;
    }

    .tool-chip {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        min-width: 52px;
        padding: 6px 4px;
        border-radius: 10px;
        color: var(--ink-2);
        font-size: 11px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .tool-chip.on {
        background: var(--pick-soft);
        color: var(--pick);
    }

    .tool-chips .colours {
        width: 46px;
        height: 46px;
        margin: 0 6px 0 0;
    }

    .tool-chips .chip {
        width: 28px;
        height: 28px;
    }

    .tool-chips .chip.bg {
        left: 16px;
        top: 16px;
    }

    /* folding sections */
    .psec.foldable > .psec-h {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 32px;
        margin: -6px 0 2px;
        cursor: pointer;
    }

    .psec.foldable > .psec-h::after {
        content: "";
        width: 7px;
        height: 7px;
        margin-right: 4px;
        border-right: 1.5px solid currentColor;
        border-bottom: 1.5px solid currentColor;
        transform: rotate(45deg);
    }

    .psec.folded > .psec-h {
        margin-bottom: -6px;
    }

    .psec.folded > .psec-h::after {
        transform: rotate(-45deg);
    }

    .psec.folded > :not(.psec-h) {
        display: none !important;
    }

    /* bigger things to press */
    #panel .bar-btn {
        width: 40px;
        height: 40px;
    }

    .quick {
        gap: 6px;
    }

    .quick .q {
        width: 30px;
        height: 30px;
    }

    .swatch-btn {
        width: 40px;
        height: 32px;
    }

    .row {
        min-height: 40px;
    }

    .slider input {
        height: 32px;
    }

    .slider output {
        width: 48px;
        min-height: 32px;
        line-height: 32px;
    }

    .seg button {
        min-height: 36px;
    }

    #panel .field {
        min-height: 38px;
        font-size: 16px;
    }

    /* the layers: labels under the bar's icons, larger rows */
    .layers-bar .icon-row {
        flex-wrap: nowrap;
        justify-content: space-between;
        overflow-x: auto;
    }

    .layers-bar .bar-btn {
        flex-direction: column;
        width: auto;
        min-width: 44px;
        height: 48px;
        gap: 2px;
        font-size: 10px;
    }

    .layers-bar .bar-btn::after {
        content: attr(data-label);
    }

    .lrow {
        height: 54px;
        touch-action: pan-y;
        transition: background 0.15s;
    }

    .lrow.swipe-del {
        background: rgba(212, 76, 71, 0.16);
    }

    .lgrip {
        padding: 10px 4px;
    }

    .lbtns .bar-btn {
        width: 40px;
        height: 40px;
    }

    /* the picked layer's bar and the zoom button, on the picture */
    #quick-bar {
        position: absolute;
        z-index: 3;
        display: flex;
        gap: 2px;
        padding: 4px;
        border-radius: 12px;
        background: var(--bg);
        box-shadow: var(--menu-shadow);
    }

    #quick-bar.hidden {
        display: none;
    }

    #quick-bar button {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1px;
        min-width: 48px;
        padding: 5px 4px 4px;
        border-radius: 8px;
        color: var(--ink);
        font-size: 10px;
    }

    #quick-bar button:active {
        background: var(--hover);
    }

    #quick-bar [data-quick=q-del] {
        color: var(--danger);
    }

    #zoom-fit {
        position: absolute;
        left: 10px;
        bottom: 10px;
        z-index: 2;
        align-items: center;
        height: 32px;
        padding: 0 12px;
        border-radius: 16px;
        background: var(--bg);
        box-shadow: var(--menu-shadow);
        color: var(--ink-2);
        font-size: 12px;
        font-variant-numeric: tabular-nums;
    }

    #zoom-fit.fitted {
        opacity: 0.7;
    }

    #text-done {
        position: fixed;
        right: 12px;
        z-index: 45;
        display: block;
        height: 40px;
        padding: 0 18px;
        border-radius: 20px;
        background: var(--pick);
        color: #fff;
        font-weight: 600;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    }

    #editor.typing #phone-bar {
        display: none;
    }

    #text-done.hidden,
    #text-fmt.hidden {
        display: none;
    }

    /* letters picked while typing: bold, italic, underline, size, highlight, colour (richtext.js) */
    #text-fmt {
        position: fixed;
        left: 8px;
        right: 92px;
        z-index: 45;
        display: flex;
        gap: 2px;
        height: 40px;
        padding: 0 4px;
        overflow-x: auto;
        border-radius: 20px;
        background: var(--bg);
        color: var(--ink);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    }

    #text-fmt button,
    #text-fmt label {
        position: relative;
        flex: 0 0 auto;
        min-width: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 15px;
    }

    #text-fmt input {
        position: absolute;
        inset: 0;
        opacity: 0;
    }

    #text-fmt .hl-mark {
        background: #fff176;
        color: #222;
        padding: 0 3px;
    }

    #text-fmt .fmt-c {
        font-weight: 700;
        border-bottom: 3px solid #ff3b30;
    }

    #toast {
        bottom: calc(76px + env(safe-area-inset-bottom));
    }

    /* menus and dialogs rise from the bottom */
    #pop.pop {
        left: 0 !important;
        right: 0;
        top: auto !important;
        bottom: 0;
        width: auto;
        max-height: 70dvh;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
        border-radius: 16px 16px 0 0;
        box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.35);
        animation: rise 0.18s ease-out;
    }

    #pop .menu-item {
        padding: 12px;
        font-size: 15px;
    }

    .pop.grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .font-list {
        max-height: 52dvh;
    }

    .font-item {
        padding: 10px;
        font-size: 19px;
    }

    .dialog {
        width: 100%;
        max-width: 100%;
        max-height: 88dvh;
        margin: auto 0 0;
        padding-bottom: env(safe-area-inset-bottom);
        border-radius: 16px 16px 0 0;
    }

    .dialog[open] {
        animation: rise 0.2s ease-out;
    }

    .dialog .field {
        min-height: 40px;
        font-size: 16px;
    }

    .dialog .primary-btn,
    .dialog .soft-btn {
        min-height: 42px;
    }

    .name-input {
        max-width: 120px;
    }
}

@keyframes rise {
    from {
        transform: translateY(100%);
    }
}

/* the number typed in place of a slider's value */
.out-edit {
    width: 100%;
    border: 1px solid var(--pick);
    border-radius: 4px;
    background: var(--bg);
    color: var(--ink);
    font-size: 16px;
    text-align: right;
}

.slider output {
    cursor: text;
}

@media (max-width: 639px) {
    /* the start: your designs first, the sizes as a row to swipe */
    #home-inner {
        display: flex;
        flex-direction: column;
    }

    #yours {
        order: 1;
    }

    #new-design {
        order: 2;
    }

    #home-tpl {
        order: 3;
    }

    .home-open-wrap {
        width: 100%;
    }

    #home-open {
        width: 100%;
        min-height: 44px;
        border-color: transparent;
        background: var(--accent);
        color: #fff;
        font-weight: 500;
    }

    .preset-grid {
        display: flex;
        gap: 8px;
        margin: 0 -16px;
        padding: 0 16px 4px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding: 0 16px;
        scrollbar-width: none;
    }

    .preset {
        flex: 0 0 118px;
        padding: 10px;
        scroll-snap-align: start;
    }

    .preset-shape {
        width: 40px;
        height: 40px;
        margin-bottom: 4px;
    }

    .preset-shape span {
        transform: scale(0.8);
    }

    .preset-name {
        font-size: 12.5px;
        line-height: 1.25;
    }

    .preset-size {
        font-size: 11px;
    }

    .template-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .recent-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ---------- Layer styles and clipping (styles.js) ---------- */

.style-item {
    border-radius: 8px;
}

.style-item.on {
    background: var(--card);
    padding-bottom: 6px;
    margin-bottom: 4px;
}

.style-item > .row.check {
    padding-left: 6px;
}

.style-body {
    padding: 0 8px;
}

.lclip {
    color: var(--ink-2);
    font-size: 14px;
    margin-right: -4px;
    flex-shrink: 0;
}

.lfx {
    flex-shrink: 0;
    font: italic 600 11px/1 Georgia, serif;
    color: var(--ink-2);
    padding: 2px 4px;
    border-radius: 4px;
    background: var(--hover);
}


/* ---------- History (guides.js) ---------- */

.pop.history {
    width: 260px;
    padding: 6px;
}

.hist-h {
    padding: 4px 8px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-2);
}

.hist-list {
    max-height: min(60vh, 420px);
    overflow-y: auto;
}

.hist-row {
    display: flex;
    width: 100%;
    gap: 8px;
    align-items: baseline;
    padding: 5px 8px;
    border-radius: 6px;
    text-align: left;
    font-size: 13px;
}

.hist-row:hover {
    background: var(--hover);
}

.hist-row.on {
    background: var(--pick-soft);
    color: var(--pick);
    font-weight: 600;
}

.hist-row.after {
    color: var(--ink-3);
}

.hist-n {
    min-width: 18px;
    font-size: 11px;
    color: var(--ink-3);
    font-variant-numeric: tabular-nums;
}

@media (max-width: 639px) {
    #history-btn {
        display: none;
    }
}


/* ---------- Retouching (retouch.js) ---------- */

.mix-dots {
    display: flex;
    gap: 6px;
    margin: 4px 0 8px;
}

.mix-dots button {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--dot);
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.mix-dots button.on {
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--pick);
}

/* a hue slider shows the colours it picks */
.hue-row input {
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f00, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00);
}

.hue-row input::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.hue-row input::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.3);
}

.sub-h {
    margin: 8px 0 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
}


/* ---------- Design (design.js) ---------- */

.icon-search {
    width: 100%;
    margin-bottom: 4px;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.icon-grid button {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border-radius: 6px;
    color: var(--ink);
}

.icon-grid button:hover {
    background: var(--hover);
}

.grid-pick,
.style-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.style-pick {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-align: left;
}

.style-pick:hover,
.style-pick.on {
    box-shadow: 0 0 0 1.5px var(--pick);
}

.style-cols {
    display: flex;
    height: 18px;
    overflow: hidden;
    border-radius: 4px;
}

.style-cols i {
    flex: 1;
}

.style-name {
    overflow: hidden;
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

#present {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    cursor: pointer;
    outline: none;
}

.present-n {
    position: absolute;
    right: 16px;
    bottom: 12px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
    pointer-events: none;
}

.comps {
    margin-top: 14px;
    padding: 10px 8px 0;
    border-top: 1px solid var(--line);
}

.comps-h {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
}

.comp-row {
    display: flex;
    align-items: center;
    gap: 2px;
}

.comp-name {
    flex: 1;
    min-width: 0;
    padding: 5px 8px;
    border-radius: 6px;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comp-name:hover {
    background: var(--hover);
}

.actions-form .steps {
    margin: 6px 0 10px;
}

.actions-form .row.check {
    flex-wrap: wrap;
    gap: 6px;
}

.actions-form .mini-field {
    width: 76px;
    flex: none;
}

.actions-form input[type=color] {
    width: 30px;
    height: 26px;
    padding: 0;
    border: 0;
    background: none;
}

.sky-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.sky-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 8px;
    font-size: 12px;
    color: var(--ink-2);
}

.sky-pick:hover {
    box-shadow: 0 0 0 1.5px var(--pick);
    color: var(--ink);
}

.sky-img canvas {
    display: block;
    width: 96px;
    height: 64px;
    border-radius: 6px;
}

.tip-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.tip-grid button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 2px;
    border-radius: 6px;
    color: var(--ink-2);
    font-size: 11px;
}

.tip-grid button:hover,
.tip-grid button.on {
    box-shadow: 0 0 0 1.5px var(--pick);
    color: var(--ink);
}

.tip-img canvas {
    display: block;
    width: 56px;
    height: 28px;
}

.pattern-pic canvas {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
}

.pattern-grid,
.duo-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.grid-pick button,
.pattern-grid button {
    padding: 3px;
    border-radius: 6px;
}

.grid-pick button:hover,
.pattern-grid button:hover,
.pattern-grid button.on {
    box-shadow: 0 0 0 1.5px var(--pick);
}

.grid-icon {
    position: relative;
    display: block;
    aspect-ratio: 1;
}

.grid-icon i {
    position: absolute;
    box-sizing: border-box;
    border: 1.5px solid var(--bg);
    border-radius: 3px;
    background: var(--ink-3);
}

.pattern-img canvas {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
}

.duo-grid button {
    aspect-ratio: 1;
    border-radius: 6px;
}

.duo-grid button:hover {
    box-shadow: 0 0 0 2px var(--pick);
}

.data-rows {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 8px 0 4px;
}

.data-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.data-row .field {
    flex: 1;
    min-width: 0;
}

.data-row .field.num {
    flex: 0 0 76px;
}

.palette-pick {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 4px;
}

.palette-pick button {
    display: flex;
    height: 22px;
    overflow: hidden;
    border-radius: 5px;
}

.palette-pick button.on {
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--pick);
}

.palette-pick i {
    flex: 1;
}

.cell-grid {
    display: grid;
    gap: 3px;
    margin: 8px 0;
}

.cell-grid .field {
    min-width: 0;
    padding: 4px 6px;
    font-size: 12px;
}

.palette-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 4px 6px;
}

.palette-chip {
    display: flex;
    align-items: flex-end;
    height: 54px;
    padding: 4px;
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.palette-chip span {
    padding: 1px 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.85);
    color: #333;
    font-size: 10px;
}

.pop.palette {
    width: 280px;
}

.brand-colours {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.brand-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    color: transparent;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.brand-chip:hover {
    color: #fff;
    filter: brightness(0.9);
}

.brand-logo img {
    background: repeating-conic-gradient(#e6e6e6 0 25%, #fff 0 50%) 0 0 / 8px 8px;
}

.resize-list {
    max-height: min(52vh, 420px);
    overflow-y: auto;
}

.resize-list .row.check {
    gap: 8px;
}

.font-item.brand .key {
    margin-left: 6px;
    font-size: 10px;
    color: var(--pick);
}

/* Effects (snap.js / picsart.js): categories, chips, the picked effect's settings */
.fx-cats {
    margin-bottom: 8px;
}

.fx-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 4px 0 6px;
}

.fx-chip {
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    color: var(--ink-2);
}

.fx-chip:hover {
    background: var(--hover);
}

.fx-chip.used {
    border-color: var(--pick);
    color: var(--pick);
}

.fx-chip.on {
    background: var(--pick);
    border-color: var(--pick);
    color: #fff;
}

.fx-body {
    margin: 4px 0 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.fx-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 13px;
}

.look-qr {
    display: flex;
    justify-content: center;
}

.look-qr canvas {
    border-radius: 6px;
}

/* My stickers (picsart.js) */
.my-sticker {
    position: relative;
}

.my-sticker > button:first-child {
    display: block;
    width: 100%;
    padding: 4px;
    border-radius: 6px;
    background: var(--hover);
}

.my-sticker img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
}

.mini-x {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--line);
    font-size: 12px;
    line-height: 15px;
    color: var(--ink-2);
}

/* headings in menus (the ⋯ menu's groups) */
.menu-head {
    padding: 8px 8px 2px;
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.menu-head:first-child {
    padding-top: 2px;
}

.menu-item svg {
    flex-shrink: 0;
    color: var(--ink-2);
}

.text-danger.menu-item svg {
    color: inherit;
}

/* crop: turn and flip the page */
.crop-turn {
    display: flex;
    gap: 4px;
    margin: 4px 0;
}

.flip-x svg {
    transform: scaleX(-1);
}

/* the Mockup window: a big preview with the choices under it, the kinds beside it */
@media (min-width: 768px) {
    .dialog.wide {
        width: min(1120px, calc(100vw - 32px));
    }
}

.mockup-dlg {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 48px);
}

.mockup-head,
.mockup-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
}

.mockup-foot {
    border-top: 1px solid var(--line);
}

.mockup-body {
    display: flex;
    gap: 16px;
    min-height: 0;
    padding: 0 16px;
    overflow: hidden;
}

.mockup-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
    padding-bottom: 12px;
}

.mockup-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 10px;
    background: repeating-conic-gradient(var(--hover) 0 25%, transparent 0 50%) 0 0 / 16px 16px;
}

.mockup-preview canvas {
    max-width: 100%;
    max-height: 52dvh;
    border-radius: 6px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

/* each choice: its name, then its chips */
.mk-opt-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px 14px;
    margin-top: 12px;
}

.mk-opt-grid .mk-h {
    margin: 0;
}

.mockup-side {
    width: 320px;
    flex-shrink: 0;
    overflow-y: auto;
    padding-bottom: 12px;
}

.mk-h {
    margin: 12px 0 6px;
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.mk-cat:first-child .mk-h {
    margin-top: 0;
}

.mk-kinds {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.mk-kind {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 4px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--ink-2);
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
}

.mk-kind:hover {
    background: var(--hover);
}

.mk-kind.on {
    border-color: var(--pick);
    background: var(--pick-soft);
    color: var(--pick);
}

.mk-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 5px;
    background: var(--hover);
}

.mk-thumb canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.mk-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.mk-chip {
    min-height: 30px;
    padding: 0 10px;
    border-radius: 15px;
    background: var(--hover);
    color: var(--ink-2);
    font-size: 12px;
}

.mk-chip.on {
    background: var(--pick-soft);
    color: var(--pick);
    font-weight: 600;
}

.mk-swatch {
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: 50%;
}

.mk-swatch.on {
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--pick);
}

.mk-pages button {
    padding: 0 12px;
    white-space: nowrap;
}

/* phones: the preview, one row of kinds to swipe, then the choices */
@media (max-width: 767px) {
    .mockup-dlg {
        max-height: 90dvh;
    }

    .mockup-body {
        flex-direction: column;
        gap: 10px;
        overflow-y: auto;
    }

    .mockup-main {
        display: contents;
    }

    .mockup-preview {
        order: 1;
    }

    .mockup-preview canvas {
        max-height: 30dvh;
    }

    .mockup-side {
        order: 2;
        display: flex;
        gap: 14px;
        width: auto;
        margin: 0 -16px;
        padding: 0 16px;
        overflow-x: auto;
        overflow-y: visible;
        scrollbar-width: none;
    }

    .mk-cat .mk-h {
        margin-top: 0;
    }

    .mk-kinds {
        display: flex;
    }

    .mk-kind {
        flex: 0 0 84px;
    }

    #mk-opts {
        order: 3;
    }

    .mk-opt-grid {
        grid-template-columns: 1fr;
        gap: 4px;
        margin-top: 0;
    }

    .mk-opt-grid .mk-h {
        margin-top: 8px;
    }

    .mk-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .mk-chip {
        flex-shrink: 0;
        min-height: 36px;
    }

    .mk-swatch {
        flex-shrink: 0;
        width: 34px;
        height: 34px;
        margin: 4px 2px;
    }
}


/* ---------- Layers: Blend If, locks, links, search (layers2.js) ---------- */

.lbadge {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    font: 600 10px/1 system-ui, sans-serif;
    color: var(--ink-3);
    padding: 2px 3px;
}

.lrow.filtered {
    display: none;
}

.layer-search {
    display: flex;
    gap: 6px;
    margin: 8px 10px;
}

.layer-search input {
    flex: 1;
    min-width: 0;
}

.layer-search select {
    width: auto;
}

.blend-more {
    margin: 6px 0 2px;
}

.blend-more > summary {
    cursor: pointer;
    font-size: 13px;
    color: var(--ink-2);
    padding: 6px 0;
    list-style: none;
}

.blend-more > summary::before {
    content: '▸ ';
}

.blend-more[open] > summary::before {
    content: '▾ ';
}

.form-dlg .row {
    margin-bottom: 8px;
}


/* ---------- Gradient editor (paint2.js) ---------- */

.grad-edit {
    --checker: repeating-conic-gradient(#ccc 0 25%, #fff 0 50%);
    margin: 6px 0;
}

.grad-bar {
    position: relative;
    height: 26px;
    margin: 4px 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background-size: 100% 100%, 12px 12px;
    touch-action: none;
    cursor: copy;
}

.grad-bar.plain {
    cursor: default;
}

.grad-stop {
    position: absolute;
    bottom: -10px;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    border-radius: 50% 50% 3px 3px;
    background: var(--c);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.45);
    cursor: ew-resize;
    touch-action: none;
}

.grad-stop.on {
    box-shadow: 0 0 0 2px var(--accent);
}

@media (pointer: coarse) {
    .grad-stop {
        width: 24px;
        height: 24px;
        margin-left: -12px;
        bottom: -14px;
    }
}

.grad-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(34px, 1fr));
    gap: 6px;
    margin: 8px 0;
}

.grad-sw {
    height: 26px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background-size: 100% 100%, 12px 12px;
}


/* ---------- Filters (filters2.js) ---------- */

.kernel-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin: 6px 0;
}

.kernel-grid input {
    min-width: 0;
    text-align: center;
    padding-left: 2px;
    padding-right: 2px;
}


/* ---------- Panels window (panels.js) ---------- */

#ps-panels {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 15;
    width: 284px;
    max-height: calc(100% - 24px);
    overflow: auto;
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    font-size: 12px;
}

#ps-panels.hidden {
    display: none;
}

.psp-head {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    padding: 6px 6px 0;
    border-bottom: 1px solid var(--line);
    cursor: move;
}

.psp-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    flex: 1;
}

.psp-tabs button {
    padding: 4px 6px 6px;
    border-bottom: 2px solid transparent;
    color: var(--ink-2);
    font-size: 12px;
    cursor: pointer;
}

.psp-tabs button.on {
    color: var(--ink);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.psp-close {
    padding: 4px;
    color: var(--ink-2);
}

.psp-body {
    padding: 8px 10px 10px;
}

.psp-body canvas#psp-hist,
.psp-body canvas#psp-nav {
    display: block;
    width: 100%;
    height: auto;
    background: var(--hover);
    border-radius: 6px;
}

.psp-seg {
    margin: 6px 0;
}

.psp-seg button {
    font-size: 11px;
    padding: 4px 2px;
}

.psp-seg button.on {
    background: var(--bg);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.psp-stats {
    color: var(--ink-2);
    line-height: 1.5;
}

.psp-info {
    display: flex;
    gap: 10px;
    min-height: 64px;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
}

.psp-col {
    flex: 1;
}

.psp-chip {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-right: 4px;
    vertical-align: -2px;
    border-radius: 3px;
    border: 1px solid var(--line);
}

.psp-sampler {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    border-top: 1px solid var(--line);
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
}

.psp-n {
    font-weight: 700;
    color: var(--ink-2);
}

.psp-chans {
    display: grid;
    gap: 2px;
}

.psp-chan {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px;
    border-radius: 6px;
    text-align: left;
}

.psp-chan.on,
.psp-chan:hover {
    background: var(--hover);
}

.psp-chan canvas {
    border: 1px solid var(--line);
    background: #fff;
}

.psp-sw {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(22px, 1fr));
    gap: 4px;
}

.psp-sw button {
    aspect-ratio: 1;
    border-radius: 4px;
    border: 1px solid var(--line);
}

.psp-sw-add {
    display: grid;
    place-items: center;
    color: var(--ink-2);
}

.psp-glyphs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    gap: 2px;
    max-height: 180px;
    overflow: auto;
}

.psp-glyphs button {
    height: 30px;
    font-size: 17px;
    border-radius: 4px;
}

.psp-glyphs button:hover {
    background: var(--hover);
}

.tstyle-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 6px;
}

.tstyle {
    padding: 5px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    font-size: 13px;
}

@media (max-width: 767px) {
    #ps-panels {
        left: 8px;
        right: 8px;
        top: 8px;
        width: auto;
        max-height: 55%;
    }

    .psp-head {
        cursor: default;
    }

    .psp-tabs button {
        padding: 8px 6px;
    }
}


/* ---------- Export and animation (output.js) ---------- */

.xa-sizes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
}

.xa-sizes label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.ex-more {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
}

.frame-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 8px;
}

.frame-cell {
    flex: 0 0 auto;
    width: 76px;
    display: grid;
    gap: 4px;
}

.frame-thumb {
    position: relative;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 4px;
    background: var(--hover);
}

.frame-thumb span {
    position: absolute;
    left: 4px;
    top: 2px;
    font-size: 10px;
    font-weight: 700;
    color: var(--ink-2);
}

.frame-delay {
    font-size: 11px;
    padding: 2px 4px;
}

.frame-btns {
    display: flex;
    justify-content: center;
}

.anim-view {
    max-width: 100%;
    height: auto;
    background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0 / 16px 16px;
}

.anim .comps-h > span {
    display: flex;
    align-items: center;
    gap: 5px;
}


/* ---------- Animate (motion.js, 2026-10-24) ---------- */

.anim-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 8px 0;
}

.anim-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 2px 5px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 11px;
    color: var(--ink-2);
    overflow: hidden;
}

.anim-chip:hover,
.anim-chip.on {
    box-shadow: 0 0 0 1.5px var(--pick);
    color: var(--ink);
}

.anim-demo {
    display: block;
    font-size: 17px;
    font-weight: 700;
    line-height: 24px;
    color: var(--ink);
}

.anim-chip:hover .anim-demo { animation: 0.9s ease-out infinite; }
.anim-chip:hover .a-fade { animation-name: ad-fade; }
.anim-chip:hover .a-rise { animation-name: ad-rise; }
.anim-chip:hover .a-drop { animation-name: ad-drop; }
.anim-chip:hover .a-pan { animation-name: ad-pan; }
.anim-chip:hover .a-pop,
.anim-chip:hover .a-zoom { animation-name: ad-pop; }
.anim-chip:hover .a-wipe,
.anim-chip:hover .a-typewriter { animation-name: ad-wipe; }
.anim-chip:hover .a-tumble { animation-name: ad-tumble; }
.anim-chip:hover .a-bounce { animation-name: ad-bounce; }
.anim-chip:hover .a-breathe { animation: ad-breathe 1.6s ease-in-out infinite; }
.anim-chip:hover .a-drift { animation: ad-drift 1.6s linear infinite alternate; }

@keyframes ad-fade { from { opacity: 0; } }
@keyframes ad-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes ad-drop { from { opacity: 0; transform: translateY(-8px); } }
@keyframes ad-pan { from { opacity: 0; transform: translateX(-10px); } }
@keyframes ad-pop { from { opacity: 0; transform: scale(0.5); } 70% { transform: scale(1.1); } }
@keyframes ad-wipe { from { clip-path: inset(0 100% 0 0); } }
@keyframes ad-tumble { from { opacity: 0; transform: rotate(-90deg) scale(0.6); } }
@keyframes ad-bounce { from { transform: translateY(-12px); } 40% { transform: translateY(0); } 60% { transform: translateY(-4px); } 80% { transform: translateY(0); } }
@keyframes ad-breathe { 50% { transform: scale(1.12); } }
@keyframes ad-drift { from { transform: translateX(-4px); } to { transform: translateX(4px); } }

@media (prefers-reduced-motion: reduce) {
    .anim-chip:hover .anim-demo { animation: none !important; }
}

.pdur {
    position: absolute;
    right: 5px;
    bottom: 3px;
    font-size: 10px;
    color: var(--ink-3);
}

.motion-player canvas {
    display: block;
    margin: 0 auto;
    max-height: 62dvh;
    width: auto;
    background: #000;
    border-radius: 6px;
}

.mp-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.mp-bar input[type="range"] {
    flex: 1;
    min-width: 0;
}

.mp-time {
    font-size: 12px;
    color: var(--ink-2);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mv-progress {
    height: 6px;
    margin-top: 10px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
}

.mv-progress > div {
    width: 0;
    height: 100%;
    background: var(--pick);
    transition: width 0.2s;
}

.music-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.music-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ---------- Bulk create (bulk.js) and whiteboards (board.js), 2026-10-24 ---------- */

.bk-text {
    width: 100%;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 12px;
    resize: vertical;
    margin-bottom: 6px;
}

.bk-table {
    max-width: 100%;
    overflow-x: auto;
    margin: 6px 0;
}

.bk-table table {
    border-collapse: collapse;
    font-size: 12px;
}

.bk-table th,
.bk-table td {
    padding: 3px 8px;
    border: 1px solid var(--line);
    text-align: left;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bk-table th {
    background: var(--card);
    font-weight: 600;
}

.bulk-dlg .sub-h {
    margin-top: 12px;
}

.bulk-dlg .row .lbl {
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.note-row {
    display: flex;
    gap: 8px;
    margin: 6px 0 10px;
}

.note-pick {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.note-pick:hover {
    box-shadow: 0 0 0 2px var(--pick);
}


/* ---------- Uploads, the start screen's folders, recently used, element search, copy style (workspace.js) ---------- */

.up-cell {
    position: relative;
}

.up-cell > button:first-child {
    display: block;
    width: 100%;
}

.up-del {
    position: absolute;
    top: 2px;
    right: 2px;
    display: none;
    width: 20px;
    height: 20px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
}

.up-cell:hover .up-del,
.up-cell:focus-within .up-del {
    display: flex;
}

@media (pointer: coarse) {
    .up-del { display: flex; }
}

.home-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.home-bar:empty {
    display: none;
}

.home-q {
    width: 240px;
    max-width: 100%;
}

.home-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.home-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    color: var(--ink-2);
}

.home-chip.on {
    border-color: var(--pick);
    background: var(--pick-soft);
    color: var(--ink);
}

.recent-star {
    display: inline-flex;
    margin-right: 3px;
    color: #e0a100;
    vertical-align: -1px;
}

.recent-star svg {
    fill: currentColor;
}

.recent-row,
.el-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

.recent-row > button,
.el-grid > button {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 6px;
    font-size: 20px;
    overflow: hidden;
}

.recent-row > button:hover,
.el-grid > button:hover {
    background: var(--hover);
}

.recent-row img,
.el-grid img {
    max-width: 40px;
    max-height: 40px;
}

.note-mini {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.el-search {
    width: 100%;
}

.el-results {
    margin-top: 8px;
}

.btn-row.wrap {
    flex-wrap: wrap;
}

#panel-body.el-searching > .psec:not(.el-search-sec) {
    display: none !important;
}

.psec.el-search-sec.cat-off {
    display: block !important;
}


/* ---------- Present: notes, shortcuts, recording (present2.js) ---------- */

.notes-field {
    width: 100%;
    resize: vertical;
}

#present-fx {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.present-blur {
    filter: blur(1.6vw);
}

.present-keys {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: grid;
    gap: 6px;
    padding: 18px 22px;
    border-radius: 10px;
    background: rgba(25, 25, 25, 0.92);
    color: #fff;
    font-size: 15px;
    cursor: default;
}

.present-keys div {
    display: flex;
    gap: 12px;
    align-items: center;
}

.present-keys kbd {
    min-width: 34px;
    padding: 2px 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    text-align: center;
    font: 600 13px system-ui, sans-serif;
}

.present-cam {
    position: absolute;
    left: 3vmin;
    bottom: 3vmin;
    width: 24vmin;
    height: 24vmin;
    border: 3px solid #fff;
    border-radius: 50%;
    object-fit: cover;
    transform: scaleX(-1);
    cursor: default;
}

.present-rec {
    position: absolute;
    top: 12px;
    left: 16px;
    color: #ff5a52;
    font: 600 13px system-ui, sans-serif;
    pointer-events: none;
}

/* Photo info (camera.js) */
.exif {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 10px;
    margin: 4px 0 6px;
    font-size: 12px;
}

.exif dt {
    color: var(--muted);
}

.exif dd {
    margin: 0;
    overflow-wrap: anywhere;
}

#stage.picking {
    cursor: crosshair;
}

.template-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Check design, versions and comments (review.js) */
.chk-list, .ver-list, .cm-list {
    max-height: min(60dvh, 560px);
    overflow-y: auto;
}

.chk-page {
    margin: 12px 0 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chk-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

.chk-dot {
    flex: none;
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--ink-3);
}

.chk-bad .chk-dot { background: var(--danger); }
.chk-warn .chk-dot { background: #e0a020; }
.chk-tip .chk-dot { background: var(--accent); }

.chk-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.chk-body span {
    color: var(--ink-2);
}

.chk-btns, .ver-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ver-item {
    display: flex;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.ver-item img {
    flex: none;
    width: 96px;
    height: 72px;
    object-fit: contain;
    border-radius: 6px;
    background: var(--card);
    box-shadow: 0 0 0 1px var(--line);
}

.ver-meta {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ver-meta > span {
    color: var(--ink-2);
    font-size: 13px;
}

.ver-btns {
    margin-top: 6px;
}

.cm-line {
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: var(--card);
}

.cm-who {
    font-size: 12px;
    font-weight: 600;
}

.cm-who span {
    font-weight: 400;
    color: var(--ink-2);
}

.cm-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.cm-row {
    display: flex;
    gap: 10px;
    width: 100%;
    padding: 8px 4px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

.cm-row:hover {
    background: var(--hover);
}

.cm-row.done {
    opacity: 0.6;
}

.cm-num {
    flex: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffb020;
    color: #1f1f1f;
    font-size: 11px;
    font-weight: 600;
    display: grid;
    place-items: center;
}

.cm-row-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cm-row-body > span {
    overflow-wrap: anywhere;
}

.cm-row-body i {
    font-style: normal;
    font-size: 12px;
    color: var(--ink-2);
}

#stage.placing-comment {
    cursor: crosshair;
}

@media (max-width: 767px) {
    .chk-item {
        flex-wrap: wrap;
    }

    .chk-btns {
        width: 100%;
        padding-left: 20px;
    }

    .ver-item img {
        width: 64px;
        height: 52px;
    }
}

/* More charts and diagrams (charts2.js) */
.data-grid {
    display: grid;
    gap: 4px;
    align-items: center;
    margin: 8px 0 4px;
}

.data-grid .field {
    min-width: 0;
    width: 100%;
}

.data-grid .data-h {
    font-size: 12px;
    color: var(--ink-2);
}

.data-grid input.data-h {
    font-weight: 600;
}

.chart-pick {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
    gap: 6px;
    margin-bottom: 8px;
}

.chart-pick button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px 6px;
    border-radius: 8px;
    background: var(--card);
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
}

.chart-pick button:hover {
    background: var(--hover);
}

.icon-pick {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.icon-pick button {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 7px;
}

.icon-pick button.on {
    background: var(--pick-soft);
    color: var(--pick);
}

/* Magic Animate and Timing (motion2.js) */
.magic-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin: 6px 0;
}

.magic-grid .soft-btn {
    justify-content: center;
}

.tm-top {
    display: flex;
    justify-content: center;
}

.tm-top canvas {
    max-width: 100%;
    max-height: 34dvh;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 0 0 1px var(--line);
}

.tm-wrap {
    --nm: 128px;
    position: relative;
    margin-top: 10px;
    max-height: 32dvh;
    overflow-y: auto;
}

.tm-row {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 30px;
}

.tm-name {
    flex: 0 0 120px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 13px;
}

.tm-name small {
    margin-left: 6px;
    color: var(--ink-3);
}

.tm-track {
    position: relative;
    flex: 1;
    height: 20px;
    border-radius: 5px;
    background: var(--card);
}

.tm-bar {
    position: absolute;
    top: 2px;
    bottom: 2px;
    min-width: 8px;
    border-radius: 4px;
    background: var(--pick);
    cursor: grab;
    touch-action: none;
}

.tm-bar.out {
    background: #f59e0b;
    cursor: default;
}

.tm-bar.loop {
    background: var(--pick-soft);
    cursor: default;
}

.tm-end {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 10px;
    border-radius: 0 4px 4px 0;
    background: rgba(255, 255, 255, 0.35);
    cursor: ew-resize;
}

.tm-head {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--nm) + (100% - var(--nm)) * var(--p, 0));
    width: 2px;
    background: var(--danger);
    pointer-events: none;
}

@media (max-width: 767px) {
    .tm-name {
        flex-basis: 84px;
    }

    .tm-wrap {
        --nm: 92px;
    }

    .tm-end {
        width: 16px;
    }
}

/* Brand kits, shadows, lines (elements2.js) */
.kit-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 8px;
}

.kit-row .field {
    flex: 1;
    min-width: 0;
}

.tpl-lock-hint {
    display: flex;
    gap: 6px;
    align-items: center;
    margin: 4px 16px 8px;
    font-size: 12px;
    color: var(--ink-2);
}

.shadow-pick {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 6px;
    margin-bottom: 6px;
}

.shadow-pick button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px 6px;
    border-radius: 8px;
    background: var(--card);
    font-size: 11px;
}

.shadow-pick button.on {
    box-shadow: 0 0 0 2px var(--pick);
}

.sh-demo {
    width: 30px;
    height: 22px;
    border-radius: 2px;
    background: #9cc3e8;
}

.sh-drop { box-shadow: 0 3px 5px rgba(0, 0, 0, 0.45); }
.sh-glow { box-shadow: 0 0 8px 2px rgba(255, 216, 77, 0.9); }
.sh-lift { box-shadow: -6px 6px 4px -4px rgba(0, 0, 0, 0.5), 6px 6px 4px -4px rgba(0, 0, 0, 0.5); }
.sh-curved { box-shadow: 0 7px 5px -4px rgba(0, 0, 0, 0.55); }
.sh-angled { box-shadow: 5px -2px 5px rgba(0, 0, 0, 0.35); }
.sh-backdrop { box-shadow: 4px 4px 0 #f4c430; }

.line-pick {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
    gap: 6px;
    margin-bottom: 6px;
}

.line-pick button {
    display: grid;
    place-items: center;
    height: 40px;
    border-radius: 8px;
    background: var(--card);
}

.line-pick button:hover,
.shadow-pick button:hover {
    background: var(--hover);
}
