@import './reset.css';

* {
    box-sizing: border-box;
}

html,
body {
    height: 100dvh;
}

body {
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23e0e0e0' fill-opacity='0.35'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    font-family: "Afacad", sans-serif;
    color: #222;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
}

hr {
    border-top: 1px solid #ddd;
    border-bottom: none;
    border-right: none;
    border-left: none;
    width: 100%;
    margin: 10px 0;
}

a {
    text-decoration: none;
}

header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    width: 100%;
    border-bottom: solid 1px #aaa;
    font-weight: 700;
    text-align: left;
    background: #fff;
}

header div.header_logo {
    white-space: nowrap;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
    margin-right: 25px;
    text-align: center;
}

header div.header_logo a {
    color: #000;
    text-decoration: none;
}

@media (hover: hover) {
    header div.header_logo a:hover {
        color: #f58a00;
    }
}
header div.header_logo a:focus-visible { outline: 2px solid #46433f; outline-offset: 2px; }

/* Card editor: the way back to the gallery (/card/templates), beside the logo.
   Card page only — student, calendar and book still open their templates in a
   popup. */
.header_gallery_link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-height: 28px;
    color: #222;
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
}

.header_gallery_link_arrow {
    width: 14px;
    height: 14px;
    flex: none;
}

/* card.css fills every svg inside a hovered link orange; this one is a stroke. */
.header_gallery_link:hover .header_gallery_link_arrow {
    fill: none;
}

.header_gallery_link_narrow {
    display: none;
}

@media (hover: hover) {
    .header_gallery_link:hover {
        color: #f58a00;
    }
}
.header_gallery_link:focus-visible { outline: 2px solid #46433f; outline-offset: 2px; }

@media (max-width: 420px) {
    header div.header_logo:has(+ .header_gallery_link) { margin-right: 14px; }
    .header_gallery_link_wide { display: none; }
    .header_gallery_link_narrow { display: inline; }
}

/* The gallery link took room the header was measured without: between 421 and
   520 px "Alla mallar" ran into the add button and the cart icon was pushed
   off the edge. From 520 px down the card header closes its gaps and uses the
   short "Mallar"; account and cart stay until the 420 px tier hides them. */
@media (max-width: 520px) {
    header:has(.header_gallery_link) { padding-left: 10px; padding-right: 10px; gap: 8px; }
    header:has(.header_gallery_link) div.header_logo { margin-right: 0; }
    .header_gallery_link_wide { display: none; }
    .header_gallery_link_narrow { display: inline; }
    header:has(.header_gallery_link) .summary_price.ac-pricebtn { margin-right: 0; padding-left: 8px; padding-right: 8px; }
    header:has(.header_gallery_link) .account-menu { margin-left: 0; margin-right: 0; flex-shrink: 0; }
    header:has(.header_gallery_link) .header_icon_cart { margin-left: 0; flex-shrink: 0; }
}

/* ============================================================
   STILLA — saved-designs UI (touch-first). Additive, book-only
   markup; does not modify the shared .workspace_control rules.
   ============================================================ */
:root {
    --qx-orange: #f58a00;
    --qx-orange-deep: #e07d00;
    --qx-orange-deeper: #d97900;
    --qx-orange-tint: #fff4e6;
    --qx-orange-tint-2: #fde9cf;
    --qx-orange-text: #a85f00;
    --qx-ink: #161513;
    --qx-ink-2: #46433f;
    --qx-muted: #675f54;
    --qx-muted-2: #7a7164;
    --qx-red: #c0392b;
    --qx-red-tint: #fdecea;
    --qx-line: #e4e1db;
    --qx-line-soft: #efece6;
    --qx-surface: #f5f3ef;
    --qx-surface-2: #faf8f4;
    --qx-tap: 44px;
    /* black & white action tokens (saved-designs UI is monochrome) */
    --bw-pri: #1b1a18;
    --bw-pri-deep: #000;
    --bw-state-bg: #f0eeea;
    --bw-state-line: #d8d4cd;
}

/* touch-sized buttons */
.qx-btn {
    font-family: "Afacad", sans-serif;
    font-weight: 700;
    font-size: 0.98rem;
    cursor: pointer;
    border-radius: 11px;
    min-height: var(--qx-tap);
    padding: 0 16px;
    border: 1.5px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.qx-btn svg { width: 18px; height: 18px; }
.qx-btn--pri { background: var(--bw-pri); color: #fff; border-color: var(--bw-pri-deep); }
.qx-btn--pri:active { background: #000; }
.qx-btn--ghost { background: #fff; border-color: var(--qx-line); color: var(--qx-ink); }
.qx-btn--ghost:active { background: var(--qx-surface); }
.qx-btn--quiet { background: var(--qx-surface); border-color: transparent; color: var(--qx-ink-2); }
/* destructive, monochrome: a grey-filled tier (tone, not red). The delete
   confirm dialog remains the real safety net. */
.qx-btn--danger { background: var(--qx-surface); border-color: var(--qx-line-soft); color: var(--qx-ink-2); }
.qx-btn--danger:active { background: #e8e4dd; }
/* no default blue focus ring; subtle ink ring for keyboard nav only */
.qx-btn:focus { outline: none; }
.qx-btn:focus-visible { outline: 2px solid var(--qx-ink-2); outline-offset: 2px; }

/* saved list — touch rows with always-visible actions */
.saved_header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: "Signika Negative", sans-serif;
    font-size: 1.12rem;
    font-weight: 600;
    padding: 4px 4px 0;
}
.saved_count {
    font-size: 0.78rem;
    color: var(--qx-muted);
    background: var(--qx-surface);
    border-radius: 999px;
    padding: 2px 9px;
    font-weight: 600;
}
.t-list { display: flex; flex-direction: column; gap: 10px; }
.t-row {
    border: 1px solid var(--qx-line);
    border-radius: 14px;
    background: #fff;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.t-row--open { background: var(--bw-state-bg); border-color: var(--bw-state-line); }
.t-row__main { display: flex; align-items: center; gap: 12px; }
.t-row .t-thumb {
    width: 58px;
    height: 74px;
    border-radius: 5px;
    flex-shrink: 0;
    background: #e9e5de;
    object-fit: cover;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.t-info { flex: 1; min-width: 0; }
.t-name {
    font-weight: 700;
    font-size: 1.08rem;
    color: var(--qx-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 8px;
}
.t-open-badge {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--qx-ink);
    background: #fff;
    border: 1px solid var(--bw-state-line);
    border-radius: 5px;
    padding: 1px 6px;
    flex-shrink: 0;
}
.t-sub { font-size: 0.86rem; color: var(--qx-muted); margin-top: 2px; }
.t-sub .sep { color: #cdc7be; margin: 0 6px; }
.t-actions { display: flex; gap: 8px; }
.t-actions .qx-btn { flex: 1; }
/* icon-only secondary actions (Byt namn / Ta bort) — fixed 44px square.
   Scoped to .t-actions so it overrides the flex:1 above. */
.t-actions .t-iconbtn { flex: 0 0 var(--qx-tap); width: var(--qx-tap); padding: 0; }
.t-iconbtn svg { width: 19px; height: 19px; }
.t-open-pri { flex: 1; }
.t-open-state {
    flex: 1;
    min-height: var(--qx-tap);
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: var(--bw-state-bg);
    border: 1.5px solid var(--bw-state-line);
    color: var(--qx-ink);
    font-weight: 700;
    font-size: 0.95rem;
}
.t-open-state svg { width: 16px; height: 16px; }
.t-rename {
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: #fff;
    border: 1.5px solid var(--qx-ink);
    border-radius: 12px;
    padding: 10px;
    box-shadow: 0 0 0 3px var(--bw-state-bg);
}
.t-rename__field {
    font-family: "Afacad", sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: #111;
    border: 1.5px solid var(--qx-line);
    border-radius: 10px;
    min-height: var(--qx-tap);
    padding: 0 12px;
    width: 100%;
    outline: none;
    background: var(--qx-surface-2);
}
.t-rename__field:focus { border-color: var(--qx-ink); background: #fff; }
.t-rename__row { display: flex; gap: 8px; }
.t-rename__row .qx-btn { flex: 1; }
.saved_empty { padding: 16px 10px; color: var(--qx-muted); text-align: center; }

/* workspace control — Stilla two-tier (book only) */
.ws {
    display: block;
    background: #fff;
    border: 1.5px solid #e0e0e0;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(40, 32, 20, 0.06);
    overflow: hidden;
    margin: 0 auto 10px;
    max-width: 420px;
    width: 100%;
}
.ws__title-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.ws__titlewrap { flex: 1; min-width: 0; text-align: left; }
.ws__title { font-size: 1rem; font-weight: 700; color: #111; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws__title .sz { font-weight: 400; color: #666; }
.ws__title.is-untitled { color: #666; font-weight: 600; }
.ws__sub { font-size: 0.74rem; font-weight: 500; color: var(--qx-muted-2); margin-top: 1px; }
.ws__rename {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--qx-tap);
    padding: 0 13px;
    border-radius: 12px;
    border: 1.5px solid var(--qx-line);
    background: var(--qx-surface-2);
    color: var(--qx-ink);
    font-family: "Afacad", sans-serif;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.ws__rename:active { background: var(--qx-surface); border-color: var(--qx-muted-2); }
.ws__rename svg { width: 17px; height: 17px; color: var(--qx-orange-deeper); }
.ws__pages {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 10px;
    border-top: 1px solid var(--qx-line-soft);
    background: var(--qx-surface-2);
}
.ws-pbtn {
    width: var(--qx-tap);
    height: var(--qx-tap);
    flex-shrink: 0;
    border-radius: 50%;
    border: 1.5px solid #e0e0e0;
    background: #fff;
    color: #555;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ws-pbtn:active { background: var(--qx-surface); color: #111; }
.ws-pbtn svg { width: 19px; height: 19px; }
.ws-pbtn--accent { color: var(--qx-orange-deeper); border-color: var(--qx-orange-tint-2); background: var(--qx-orange-tint); }
.ws-pbtn--accent:active { background: var(--qx-orange-tint-2); }
.ws-pbtn.disabled { opacity: 0.4; pointer-events: none; }
.ws__pageind { flex: 1; text-align: center; min-width: 0; }
.ws__pageind b { font-size: 0.92rem; font-weight: 700; color: #111; display: block; line-height: 1.15; }
.ws__pageind small { font-size: 0.68rem; color: var(--qx-muted-2); font-weight: 500; }
.ws__divider { width: 1px; height: 26px; background: #e8e3da; flex-shrink: 0; }
.ws__rename-edit { display: flex; flex-direction: column; gap: 9px; padding: 11px 12px; background: var(--qx-orange-tint); }
.ws__rename-edit .field {
    font-family: "Afacad", sans-serif;
    font-weight: 700;
    font-size: 1.02rem;
    color: #111;
    border: 1.5px solid var(--qx-orange);
    border-radius: 10px;
    min-height: var(--qx-tap);
    padding: 0 12px;
    width: 100%;
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(245, 138, 0, 0.14);
}
.ws__rename-edit .row { display: flex; gap: 8px; }
.ws__rename-edit .row .qx-btn { flex: 1; }

/* save-choice popup → two big tap targets */
#popup_design_save .t-save__opts { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
#popup_design_save .t-save__opts .qx-btn { width: 100%; min-height: 52px; font-size: 1.02rem; }

/* ============================================================
   TWEAK (revertible) — workspace bar: a touch smaller + buttons
   in black & white (no orange). To REVERT, delete this whole
   block; the original Stilla .ws* rules above are untouched.
   ============================================================ */
.ws { max-width: 390px; }
.ws__title-row { padding: 8px 11px; }
.ws__title { font-size: 0.95rem; }
.ws__pages { padding: 7px 9px; gap: 5px; }
.ws-pbtn { width: 40px; height: 40px; }
.ws-pbtn svg { width: 17px; height: 17px; }
.ws__pageind b { font-size: 0.88rem; }
.ws__rename { min-height: 40px; padding: 0 11px; font-size: 0.88rem; }
/* monochrome: drop orange from the page +/− buttons and the rename pen */
.ws-pbtn--accent { color: #333; border-color: #e0e0e0; background: #fff; }
.ws-pbtn--accent:active { background: #f0f0f0; }
.ws__rename svg { color: currentColor; }

.header_icon_cart {
    cursor: pointer;
    display: block;
    margin-left: auto;
    text-align: center;
    position: relative;
}

.header_icon_cart span {
    display: none;
    position: absolute;
    left: 75%;
    transform: translate(-50%, 0);
    margin-top: 2px;
    padding: 3px;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 0.9;
    color: #fff;
    background-color: #222;
    border-radius: 10px;
}

/* SAVED DESIGNS — open design shown as the document title (click to rename) */
.design_title {
    cursor: pointer;
    font-weight: 700;
    color: #111;
}

@media (hover: hover) {
    .design_title:hover {
        text-decoration: underline;
    }
}

.design_title::after {
    content: " ✎";
    font-size: 0.85em;
    opacity: 0.45;
    text-decoration: none;
}

@media (hover: hover) {
    .design_title:hover::after {
        opacity: 0.9;
    }
}

.code_target_design_sep {
    color: #bbb;
    font-weight: 400;
}

/* When a design is open the size becomes the secondary part of the title. */
.workspace_control_title .code_target_title {
    font-weight: 400;
    color: #666;
}

/* SAVED DESIGNS — header buttons */
.header_icon_action {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    /* 3px vertical keeps the chip at 28px like the header's other rows —
       4px made these the tallest child and grew book's header to 51px */
    padding: 3px 10px;
    color: #222;
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
}

/* match the cart icon hover exactly: only the SVG stroke goes orange.
   fill:none is required to cancel the global `a:hover svg { fill:#f58a00 }`
   rule (which would otherwise fill these icons solid orange). */
@media (hover: hover) {
    .header_icon_action:hover svg {
        stroke: #f58a00;
        fill: none;
    }
}

.header_icon_action_first {
    margin-left: auto;
}

/* The account menu also carries margin-left:auto; once our first action
   button has claimed the free space, neutralise the account menu's so the
   whole right-hand cluster stays together. */
.header_icon_action_first ~ .account-menu {
    margin-left: 0;
}

@media (max-width: 640px) {
    .header_icon_action_label {
        display: none;
    }
}

/* SAVED DESIGNS — list modal */
.saved_header {
    padding: 10px;
    font-weight: 700;
}

.saved_grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 320px;
}

.saved_item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border: solid 1px #ddd;
    border-radius: 4px;
    background: #fff;
}

@media (hover: hover) {
    .saved_item:hover {
        border-color: #aaa;
    }
}

.saved_thumb {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f3f3;
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
}

.saved_thumb img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.saved_meta {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.saved_name {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.saved_date {
    font-size: 0.8rem;
    color: #777;
}

.saved_delete {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: #999;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    padding: 6px;
}

@media (hover: hover) {
    .saved_delete:hover {
        color: #c0392b;
    }
}

.saved_empty {
    padding: 16px 10px;
    color: #777;
    text-align: center;
}

/* SAVED DESIGNS — name-input field in the save popup (login-popup style) */
.design_field {
    position: relative;
    margin: 0 0 20px;
    text-align: left;
}

.design_field input {
    width: 100%;
    box-sizing: border-box;
    padding: 18px 12px 7px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font: inherit;
    font-size: 0.95rem;
    color: #1a1a1a;
    background: #fff;
    transition: border-color 0.15s;
}

.design_field input:focus {
    outline: none;
    border-color: #f58a00;
}

.design_field label {
    position: absolute;
    left: 12px;
    top: 14px;
    font-size: 0.95rem;
    color: #999;
    pointer-events: none;
    transition: top 0.13s, font-size 0.13s, color 0.13s;
}

.design_field input:focus + label,
.design_field input:not(:placeholder-shown) + label {
    top: 5px;
    font-size: 0.7rem;
    color: #f58a00;
}

main {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: row;
    min-height: 0;
}

footer {
    box-sizing: border-box;
    width: 100%;
    border-top: solid 1px #ddd;
    background: #fff;
}

canvas {
    box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.25);
}


#base_left {
    background-color: #fff;
    display: flex;
    flex-direction: row;
    min-height: 0;
    border-right: 1px solid #ccc;
    color: #222;
}

#base_center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 15px;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.fabric-canvas-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    width: 100%;
}

@media screen and (orientation:portrait) {
    #base_left {
        display: none;
    }
}

@media screen and (orientation:landscape) {
    footer {
        display: none;
    }
}

/* SIDED CONTROL — Pill Toggle */
.sided_control {
    display: inline-flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 12px;
    border: 1.5px solid #e0e0e0;
    padding: 4px;
    gap: 4px;
    margin: 0 auto 10px;
}

.sided_option {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: #999;
    font-family: "Afacad", sans-serif;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

@media (hover: hover) {
    .sided_option:hover {
        color: #666;
    }
}

.sided_option.active {
    background: #fff;
    color: #111;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.sided_option svg {
    flex-shrink: 0;
}

.sided_divider {
    width: 1px;
    height: 24px;
    background: #ddd;
    margin: 0 2px;
}

.page_nav {
    display: flex;
    gap: 2px;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.3s ease, opacity 0.25s ease;
}

.page_nav.visible {
    max-width: 250px;
    opacity: 1;
}

.page_btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: #999;
    font-family: "Afacad", sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

@media (hover: hover) {
    .page_btn:hover {
        background: #fff;
        color: #555;
    }
}

.page_btn.active {
    background: #fff;
    color: #111;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

@media screen and (max-height: 900px) {
    .sided_option {
        padding: 6px 14px;
        font-size: 0.84rem;
    }
    .sided_option svg {
        width: 16px;
        height: 16px;
    }
    .page_btn {
        padding: 6px 10px;
        font-size: 0.82rem;
    }
}

/* WORKSPACE CONTROL — Elevated Tray (book/calendar page nav) */
.workspace_control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin: 0 auto 10px;
    background: #fff;
    border-radius: 16px;
    box-shadow: none;
    border: 1.5px solid #e0e0e0;
}

.workspace_control_title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #111;
    line-height: 1.2;
    text-align: center;
}

.workspace_control_page {
    font-size: 0.72rem;
    font-weight: 500;
    color: #999;
    margin-top: 1px;
    text-align: center;
}

.workspace_control_year {
    display: block;
    margin: 4px auto 0;
    padding: 2px 6px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: #111;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
}

.workspace_control_year[hidden] {
    display: none;
}

.workspace_control_center {
    padding: 0 10px;
    min-width: 110px;
    text-align: center;
}

.workspace_control_divider {
    width: 1px;
    height: 26px;
    background: #eee;
}

.workspace_button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1.5px solid #e0e0e0;
    border-radius: 50%;
    background: #f7f7f7;
    color: #555;
    font-family: "Afacad", sans-serif;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

@media (hover: hover) {
    .workspace_button:hover {
        background: #eee;
        border-color: #ccc;
        color: #333;
    }
}

.workspace_button:active {
    background: #ddd;
}

.workspace_button:disabled {
    opacity: 0.25;
    cursor: not-allowed;
}

@media (hover: hover) {
    .workspace_button:disabled:hover {
        background: #f7f7f7;
        border-color: #e0e0e0;
        color: #555;
    }
}

.workspace_button.disabled {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}

.workspace_button svg {
    flex-shrink: 0;
}

.code_page_nav_button {
    width: auto;
    height: auto;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    gap: 5px;
}

.code_page_nav_button.active {
    background: #e8e8e8;
}

@media (hover: hover) {
    .code_page_nav_button.active:hover {
        background: #ddd;
    }
}

.code_action_toggle_double_sided {
    width: auto;
    height: auto;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    gap: 5px;
}

@media screen and (max-height: 900px) {
    .workspace_button {
        width: 34px;
        height: 34px;
    }
    .workspace_button svg {
        width: 16px;
        height: 16px;
    }
    .code_page_nav_button,
    .code_action_toggle_double_sided {
        width: auto;
        height: auto;
    }
}


















/* BOTH LANDSCAPE AND PORTRAIT */
a div {
    color: #222;
    font-weight: 500;
    padding: 0 10px;
    font-size: 0.95em;
    margin-top: 2px;
}

span div {
    color: #777;
    font-weight: 500;
    padding: 0 10px;
    font-size: 0.95em;
    margin-top: 2px;
}

.landscape_image_control a,
.portrait_image_control a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    transition: all 0.15s ease;
}

.landscape_image_control a svg,
.portrait_image_control a svg {
    background: #fff;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px;
    box-sizing: content-box;
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .landscape_image_control a:hover svg,
    .portrait_image_control a:hover svg {
        background: #fff3e0;
        border-color: #f58a00;
        fill: none;
    }
}

.landscape_image_control a div,
.portrait_image_control a div {
    color: #46433f;
    font-weight: 600;
    padding: 0;
    font-size: 12px;
    line-height: 1.1;
    margin-top: 0;
}

@media (hover: hover) {
    .landscape_image_control a:hover div,
    .portrait_image_control a:hover div {
        color: #46433f;
    }
}

.landscape_image_control > div,
.portrait_image_control > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
}

.landscape_image_control > div svg,
.portrait_image_control > div svg {
    background: #f5f5f5;
    border: 1.5px solid #dedede;
    border-radius: 10px;
    padding: 10px;
    box-sizing: content-box;
}

.landscape_image_control > div div,
.portrait_image_control > div div {
    color: #767676;
    font-weight: 600;
    padding: 0;
    font-size: 12px;
    line-height: 1.1;
    margin-top: 0;
}

@media (hover: hover) {
    a:hover svg {
        fill: #f58a00;
    }
}

@media (hover: hover) {
    a:hover div {
        color: #f58a00;
    }
}

textarea {
    font-family: "Afacad", serif;
    font-weight: 500;
    text-align: center;
    width: 100%;
    border-radius: 3px;
    border: solid 2px #222;
    padding: 5px;
    resize: vertical;
}

button {
    cursor: pointer;
}

.template_tiny {
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.75);
}

/* BOTH LANDSCAPE AND PORTRAIT */










/* LANDSCAPE */
/* LANDSCAPE BASE MENU */
#landscape_base_menu {
    position: relative;
    z-index: 20;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' %3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' x2='0' y1='0' y2='1' gradientTransform='rotate(0,0.5,0.5)'%3E%3Cstop offset='0' stop-color='%23000000'/%3E%3Cstop offset='1' stop-color='%23000000'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpattern id='b' width='6' height='6' patternUnits='userSpaceOnUse'%3E%3Ccircle fill='%23FFFFFF' cx='3' cy='3' r='3'/%3E%3C/pattern%3E%3Crect width='100%25' height='100%25' fill='url(%23a)'/%3E%3Crect width='100%25' height='100%25' fill='url(%23b)' fill-opacity='0.07'/%3E%3C/svg%3E");
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
}

#landscape_base_menu a {
    padding: 10px;
    background-color: #333;
    border-radius: 5px;
    margin: 4px 4px;
}

#landscape_base_menu a+a {
    margin-top: 0px;
}

#landscape_base_menu a svg {
    fill: #ddd;
    color: #ddd;
}

#landscape_base_menu a.selected {
    background-color: #eee;
}

#landscape_base_menu a.selected svg {
    fill: #222;
    color: #222;
}

@media (hover: hover) {
    .color_button:hover {
        filter: brightness(1.2);
    }
}

.color_button {
    line-height: 40px;
    min-width: 35px;
    border-radius: 5px;
    text-align: center;
    cursor: pointer;
    box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.35),
        0 1px 3px rgba(0, 0, 0, 0.75);
}

@media (hover: hover) {
    .button_svg:hover {
        background: #eee;
    }
}

@media (hover: hover) {
    .button_svg:hover svg {
        fill: inherit;
    }
}

@media (hover: hover) {
    [data-option="none"] .button_svg:hover svg {
        fill: #aa0000;
    }
}

.button_svg {
    padding: 6px;
    line-height: 0;
    border-radius: 5px;
    border: solid 1px #ccc;
    background: #fff;
}

/* LANDSCAPE BASE MENU */


.landscape_control {
    width: 230px;
    display: flex;
    flex-direction: column;
    text-align: center;
    padding: 10px 10px 5px 10px;
    min-height: 0;
    height: 100%;
}

/* LANDSCAPE IMAGE */
.landscape_image_control {
    display: flex;
    flex-direction: row;
    gap: 6px;
    justify-content: center;
}

.code_action_free_position.active {
    background-color: transparent;
}

.code_action_free_position.active svg {
    stroke: #0066cc;
}

.image_upload {
    flex: 0 0 auto;
    margin-bottom: 10px;
}

.image_upload a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    color: #666;
    transition: all 0.2s;
}

@media (hover: hover) {
    .image_upload a:hover {
        border-color: #888;
        background: #f9f9f9;
    }
}

@media (hover: hover) {
    .image_upload a:hover svg {
        fill: none;
    }
}

@media (hover: hover) {
    .image_upload a:hover div {
        color: #666;
    }
}

.image_upload svg {
    margin-bottom: 8px;
}

.image_upload div {
    font-size: 0.85rem;
    font-weight: 500;
}

.landscape_images_container {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: stretch;
    padding: 5px;
    display: flex;
    flex-direction: column;
}

.landscape_images_container img {
    cursor: pointer;
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.75);
}

/* LANDSCAPE IMAGE */

/* LANDSCAPE TEXT */
.landscape_text_menu {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    gap: 6px;
}

.landscape_text_menu>a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    background: none;
    border: none;
    transition: all 0.15s ease;
}

.landscape_text_menu>a svg {
    background: #fff;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px;
    box-sizing: content-box;
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .landscape_text_menu>a:hover svg {
        background: #fff3e0;
        border-color: #f58a00;
    }
}

.landscape_text_menu>span {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    background: none;
    border: none;
}

.landscape_text_menu>span svg {
    background: #f5f5f5;
    border: 1.5px solid #dedede;
    border-radius: 10px;
    padding: 10px;
    box-sizing: content-box;
}

.landscape_text_menu a div {
    color: #46433f;
    font-weight: 600;
    padding: 0;
    font-size: 12px;
    line-height: 1.1;
    margin-top: 0;
}

.landscape_text_menu span div {
    color: #767676;
    font-weight: 600;
    padding: 0;
    font-size: 12px;
    line-height: 1.1;
    margin-top: 0;
}

/* The text field is one tool among the others, so it rests in a thin grey
   border like them (the 2px black box outweighed everything around it) and
   takes the ink ring while it is being typed in. 16px keeps a phone from
   zooming the page when the field is tapped. */
.landscape_textarea,
.portrait_textarea {
    border: 1px solid #aaa;
    border-radius: 4px;
    padding: 8px;
    font-size: 16px;
    line-height: 1.2;
}

.landscape_textarea:focus-visible,
.portrait_textarea:focus-visible {
    outline: 2px solid #1b1a18;
    outline-offset: 2px;
}

.landscape_textarea {
    margin-top: 10px;
    min-height: 58px;
}

.landscape_text_control {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.landscape_text_control .button_svg,
.landscape_border_control .button_svg,
.portrait_text_size_control .button_svg {
    border-radius: 8px;
    padding: 7px;
    border: 1.5px solid #e0e0e0;
    transition: all 0.15s ease;
}

.landscape_border_control .button_svg {
    height: 36px;
    padding: 0 7px;
    display: flex;
    align-items: center;
    margin: 0;
}

@media (hover: hover) {
    .landscape_text_control .button_svg:hover,
    .landscape_border_control .button_svg:hover,
    .portrait_text_size_control .button_svg:hover {
        background: #fff3e0;
        border-color: #f58a00;
    }
}

.landscape_text_control_grid,
.portrait_text_control_grid {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 6px;
    justify-content: center;
}

.portrait_text_control_grid {
    height: auto;
}

.landscape_font_control {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;

    margin-top: 12px;
    display: flex;
    flex-flow: wrap;
    flex-direction: row;
    justify-content: space-between;
    align-content: flex-start;
    row-gap: 5px;
    padding: 0px 5px;
}

.landscape_font_control:nth-child(3n) {
    page-break-after: always;
}

/* A sample is "Abc" in the font with the font's name under it (the list and
   the names: include/text-font-buttons.php). Forty-nine unnamed "Abc" were
   hard to tell apart and impossible to find again. */
.landscape_font_control button {
    width: 32%;
    min-height: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 2px;
    font-size: 1.1rem;
    font-weight: 600;
    background-color: #fff;
    border-radius: 3px;
    border: solid 1px #ddd;
}

.c-font-name {
    display: block;
    max-width: 100%;
    font-family: "Afacad", sans-serif;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: 0;
    text-transform: none;
    color: #595959;
    overflow-wrap: anywhere;
}

.landscape_color_control_wrapper {
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.landscape_font_control + .landscape_color_control_wrapper,
.landscape_color_control_wrapper + .landscape_color_control_wrapper {
    margin-top: 10px;
}

.landscape_color_control {
    display: flex;
    align-items: center;
    margin-top: 10px;
    padding: 0 10px;
}

.landscape_color_control input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 100%;
    height: 36px;
    padding: 0;
    border: 2px solid #ccc;
    border-radius: 8px;
    background: none;
    cursor: pointer;
}

.landscape_color_control input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 3px;
}

.landscape_color_control input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 5px;
}

.landscape_color_control input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 5px;
}

.landscape_template_colors_title {
    margin: 10px 0 10px 0;
    padding-left: 10px;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-align: left;
}

.landscape_template_colors {
    display: flex;
    flex-flow: wrap;
    flex-direction: row;
    gap: 2px;
    margin-top: 5px;
    padding-left: 12px;
}

.landscape_template_colors div {
    height: 40px;
}

.landscape_template_colors:nth-child(6n) {
    page-break-after: always;
}

.landscape_border_color_row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 0 10px;
}

.landscape_border_color_row input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    flex: 1;
    height: 36px;
    padding: 0;
    border: 2px solid #ccc;
    border-radius: 8px;
    background: none;
    cursor: pointer;
}

.landscape_border_color_row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 3px;
}

.landscape_border_color_row input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 5px;
}

.landscape_border_color_row input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 5px;
}

.landscape_border_control {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* LANDSCAPE TEXT */

.landscape_layout_control {
    margin-top: 10px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    row-gap: 10px;
    column-gap: 6px;
    align-items: center;
    overflow: auto;
    justify-content: space-around;
}


/* LANDSCAPE */










/* PORTRAIT */
.portrait_base {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.portrait_base_layout {
    min-height: 220px;
    display: flex;
    flex-direction: row;
}

.portrait_image_control {
    display: flex;
    flex-direction: row;
    gap: 6px;
    justify-content: flex-start;
    padding: 10px 5px;
    margin: 0 5px;
}

.code_target_image_control_disabled {
    margin: 0 5px;
}
.portrait_images_base {
    display: flex;
}

.portrait_image_upload {
    flex: 0 0 auto;
    margin-bottom: 0px;
    align-self: center;
    display: flex;
}

.portrait_image_upload a {
    display: flex;
    flex-direction: column;
    margin-left: 10px;
    padding: 10px 20px;
    flex: 1;
    align-items: center;
    justify-content: center;
    border: 2px dashed #ccc;
    border-radius: 8px;
    color: #666;
    transition: all 0.2s;
}

@media (hover: hover) {
    .portrait_image_upload a:hover {
        border-color: #888;
        background: #f9f9f9;
    }
}

@media (hover: hover) {
    .portrait_image_upload a:hover svg {
        fill: none;
    }
}

@media (hover: hover) {
    .portrait_image_upload a:hover div {
        color: #666;
    }
}

.portrait_image_upload svg {
    margin-bottom: 8px;
}

.portrait_images_container {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    height: 120px;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: stretch;
    padding: 5px;
    display: flex;
    flex-direction: row;
}

.portrait_images_container img {
    max-height: 100%;
    cursor: pointer;
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.75);
}

.portrait_text_options_base {
    display: flex;
    flex-direction: row;
}

.portrait_text_font_options {
    overflow-x: scroll;
    padding: 5px;
}

.portrait_text_font_options button {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 92px;
    min-height: 64px;
    padding: 5px 6px;
    vertical-align: top;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 2px 3px;
    background-color: #fff;
    border-radius: 3px;
    border: solid 1px #ddd;
}



.portrait_text_color_border_options {
    max-width: 100%;
    display: flex;
    gap: 5px;
    padding: 10px 5px 0 5px;
}

.portrait_border_color_row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.portrait_border_color_label {
    font-size: 12px;
    line-height: 1.1;
    color: #888;
    flex-shrink: 0;
    text-align: left;
    text-transform: uppercase;
    margin-left: 4px;
    font-weight: 600;
}

.portrait_border_color_row input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    flex: 1;
    height: 36px;
    padding: 0;
    border: 2px solid #ccc;
    border-radius: 8px;
    background: none;
    cursor: pointer;
}

.portrait_border_color_row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 3px;
}

.portrait_border_color_row input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 5px;
}

.portrait_border_color_row input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 5px;
}

.portrait_border_control {
    display: flex;
    flex-direction: row;
    gap: 6px;
    flex-shrink: 0;
    align-items: center;
}


.portrait_template_colors {
    overflow-x: auto;
    display: flex;
    flex-direction: row;
    padding: 5px;
}

.portrait_template_colors div {
    max-height: 40px;
    margin: 0 3px;
}

.portrait_text_control {
    background-color: #fff;
    margin-top: auto;
    display: flex;
    padding: 0px 5px 5px 5px;
    margin-bottom: 6px;
}

.portrait_text_control_content {
    width: 100%;
    display: flex;
    gap: 5px;
}

.portrait_textarea {
    min-height: 100%;
}

.portrait_text_size_control_wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-left: 5px;
}

.portrait_text_size_control {
    display: grid;
    grid-template-columns: repeat(4, auto);
    gap: 6px;
    justify-content: center;
    margin-left: 5px;
    width: 100%;
}

.portrait_text_menu {
    display: flex;
    flex-direction: row;
    gap: 6px;
    justify-content: flex-start;
    margin-left: 10px;
    margin-bottom: 6px;
}

.portrait_text_menu>a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    transition: all 0.15s ease;
}

.portrait_text_menu>a svg {
    background: #fff;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px;
    box-sizing: content-box;
    transition: all 0.15s ease;
}

@media (hover: hover) {
    .portrait_text_menu>a:hover svg {
        background: #fff3e0;
        border-color: #f58a00;
    }
}

.portrait_text_menu>span {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
}

.portrait_text_menu>span svg {
    background: #f5f5f5;
    border: 1.5px solid #dedede;
    border-radius: 10px;
    padding: 10px;
    box-sizing: content-box;
}

.portrait_text_menu a div {
    color: #46433f;
    font-weight: 600;
    padding: 0;
    font-size: 12px;
    line-height: 1.1;
    margin-top: 0;
}

.portrait_text_menu span div {
    color: #767676;
    font-weight: 600;
    padding: 0;
    font-size: 12px;
    line-height: 1.1;
    margin-top: 0;
}

/* A tool that is waiting (nothing selected yet) is grey at full strength, not
   faded: its icon is drawn in light grey in the markup, and a 40% fade on top
   of that made the row look broken rather than not yet in use. The icons'
   colours are attributes in the page; this is where they are darkened. */
:is(.landscape_image_control, .portrait_image_control) > div > svg[stroke]:not([stroke="none"]),
:is(.landscape_image_control, .portrait_image_control) > div > svg [stroke]:not([stroke="none"]),
:is(.landscape_text_menu, .portrait_text_menu) > span > svg [stroke]:not([stroke="none"]) {
    stroke: #858585;
}

:is(.landscape_image_control, .portrait_image_control) > div > svg [fill]:not([fill="none"]):not([fill="#fff"]):not(text),
:is(.landscape_text_menu, .portrait_text_menu) > span > svg [fill]:not([fill="none"]):not([fill="#fff"]):not(text) {
    fill: #858585;
}


.portrait_layout_control {
    margin-left: 10px;
    padding-top: 0px;
    display: flex;
    gap: 10px;
    align-items: center;
    text-align: center;
    display: flex;
    overflow-x: scroll;
    width: 100%;
    justify-content: space-around;

}

@media (hover: hover) {
    .layout_button:hover {
        filter: brightness(1.1);
    }
}

.layout_button {
    border: solid 1px #ccc;
}

/* PORTRAIT BASE MENU */
#portrait_base_menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25' %3E%3Cdefs%3E%3ClinearGradient id='a' x1='0' x2='0' y1='0' y2='1' gradientTransform='rotate(0,0.5,0.5)'%3E%3Cstop offset='0' stop-color='%23000000'/%3E%3Cstop offset='1' stop-color='%23000000'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpattern id='b' width='6' height='6' patternUnits='userSpaceOnUse'%3E%3Ccircle fill='%23FFFFFF' cx='3' cy='3' r='3'/%3E%3C/pattern%3E%3Crect width='100%25' height='100%25' fill='url(%23a)'/%3E%3Crect width='100%25' height='100%25' fill='url(%23b)' fill-opacity='0.07'/%3E%3C/svg%3E");
    background-attachment: fixed;
    display: flex;
    flex-direction: row;
}

#portrait_base_menu a {
    padding: 10px;
    background-color: #333;
    border-radius: 5px;
    margin: 4px 4px;
}

#portrait_base_menu a+a {
    margin-left: 0px;
}

#portrait_base_menu a svg {
    fill: #ddd;
    color: #ddd;
}

#portrait_base_menu a.selected {
    background-color: #eee;
}

#portrait_base_menu a.selected svg {
    fill: #222;
    color: #222;
}

/* PORTRAIT BASE MENU */
/* PORTRAIT */



/* POPUP TEMPLATES - Base styles (shared) */
.popup_templates {
    position: fixed;
    z-index: 100;
    background-color: #fff;
    height: 99%;
    width: 99%;
    margin: 0.5%;
    border-radius: 5px;
    display: flex;
    border: solid 1px #ccc;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23e0e0e0' fill-opacity='0.35'%3E%3Cpath opacity='.45' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.popup_templates_menu {
    padding: 15px 10px;
    display: flex;
    gap: 5px;
    background-color: #eee;
    align-items: center;
}

.popup_templates_menu hr {
    display: block;
}

.popup_templates_menu .code_action_select_size {
    padding: 6px 8px;
    font-size: 0.9rem;
}

.popup_templates_menu .code_action_select_size.selected {
    padding: 8px 8px;
    border: none;
    font-weight: 700;
    background-color: #f58b0063;
    color: #000;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.75),
        inset 0 0 2px rgba(0, 0, 0, 0.45);
}

.popup_templates_label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #999;
    letter-spacing: 0.08em;
    padding-left: 2px;
}

.popup_templates_menu button {
    padding: 8px 10px;
    border-radius: 5px;
    font-family: "Afacad", sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    text-transform: uppercase;
    border: solid 1px #ccc;
    background: #fff;
    color: #000;
    text-align: center;
    font-weight: 600;
}

@media (hover: hover) {
    .popup_templates_menu button:hover {
        background: #fcfcfc;
        color: #000;
    }
}
.popup_templates_menu button:focus-visible { outline: 2px solid #46433f; outline-offset: 2px; }

.popup_templates_menu button.selected {
    cursor: pointer;
    user-select: none;
    padding-top: 10px;
    border-radius: 5px;
    text-align: center;
    border: none;
    font-weight: 700;
    background-color: #f58b0063;
    color: #000;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.75),
        inset 0 0 2px rgba(0, 0, 0, 0.45);
}

.popup_templates_content {
    flex: 1;
    padding: 15px;
    text-align: center;
    overflow-y: auto;
}

.popup_templates_content_category {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 25px;
}

/* POPUP TEMPLATES - Portrait orientation */
@media screen and (orientation: portrait) {
    .popup_templates {
        flex-direction: column;
    }

    .popup_templates_menu {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        overflow: auto;
        border-radius: 5px 5px 0 0;
        border-bottom: solid 1px #ccc;
    }

    .popup_templates_menu .popup_templates_label {
        display: none;
    }

    .popup_templates_menu .code_action_select_category {
        order: 0;
    }

    .popup_templates_menu hr {
        order: 2;
        flex-basis: 100%;
        height: 0;
        width: auto;
        border: none;
        margin: 2px 0;
        background: none;
        display: block;
    }

    .popup_templates_menu .code_action_select_size {
        order: 3;
        border-radius: 20px;
        padding: 5px 12px;
        font-size: 0.82rem;
        border-color: #bbb;
    }

    .popup_templates_menu .code_action_select_size.selected {
        border-radius: 20px;
        background: rgba(245, 139, 0, 0.35);
        border-color: rgba(245, 139, 0, 0.6);
    }

    .popup_templates_menu .code_action_close_layout {
        order: 1;
        margin-left: auto;
    }

    .popup_templates_menu .code_action_close_templates {
        order: 1;
        margin-left: auto;
    }

    .popup_templates_content {
        width: 100%;
        border-radius: 0 0 5px 5px;
    }
}

/* POPUP TEMPLATES - Landscape orientation */
@media screen and (orientation: landscape) {
    .popup_templates {
        flex-direction: row;
    }

    .popup_templates_menu {
        flex-direction: column;
        width: auto;
        min-width: 120px;
        border-radius: 5px 0 0 5px;
        border-right: solid 1px #ccc;
        align-items: stretch;
    }

    .popup_templates_menu .code_action_close_layout {
        order: 1;
        margin-bottom: 10px;
    }

    .popup_templates_menu .code_action_close_templates {
        order: 1;
        margin-bottom: 10px;
    }

    .popup_templates_menu .popup_templates_label {
        display: block;
        margin-top: 10px;
    }

    .popup_templates_menu .label_category {
        order: 2;
    }

    .popup_templates_menu .code_action_select_category {
        order: 2;
    }

    .popup_templates_menu hr {
        order: 2;
    }

    .popup_templates_menu .label_size {
        order: 3;
    }

    .popup_templates_menu .code_action_select_size {
        order: 3;
    }

    .popup_templates_content {
        border-radius: 0 5px 5px 0;
    }
}

/* TEMPLATE GRID fullscreen overlay */
#code_popup_templates:not(.popup_templates) {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23e0e0e0' fill-opacity='0.35'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3Cpath d='M6 5V0H5v5H0v1h5v94h1V6h94V5H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

@media screen and (orientation:landscape) {
    #code_popup_templates:not(.popup_templates) {
        left: 60px;
    }
}

.layout_grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: 20px;
    padding: 20px;
    overflow-y: auto;
    width: 100%;
    height: 100%;
}

.layout_grid a {
    text-align: center;
}







.popup_cart {
    position: fixed;
    box-sizing: border-box;
    min-width: min(340px, calc(100vw - 16px));
    top: 60px;
    right: 0;
    padding: 10px;
    margin-right: 5px;
    overflow-y: auto;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.16);
    background-color: #fff;
    border: 1px solid #e2e2e2;
    color: #1a1a1a;
    z-index: 100;
}

.popup_cart_control {
    display: flex;
    width: 100%;
    padding: 10px;
}

.popup_cart_control a {
    width: 50%;
}

.popup_cart_content {
    padding: 10px;
    max-height: 60vh;
    overflow-y: auto;
}



.cart_svg_button {
    color: #333;
    text-align: center;
}

.cart_svg_button svg {
    margin: 0 auto;
    display: block;
    margin-top: 5px;
}

.cart_svg_button div {
    margin-top: 5px;
}



@media (hover: hover) {
    input[type="checkbox"]:hover {
        background-color: #fff;
        border: solid 2px #666;
    }
}

input[type="checkbox"] {
    appearance: none;
    cursor: pointer;
    background-color: #ffffff;
    margin: 0 auto;
    font: inherit;
    width: 24px;
    height: 24px;
    border: solid 2px #222;
    border-radius: 4px;
    transform: translateY(-0.075em);
    display: grid;
    place-content: center;

}

input[type="checkbox"]::before {
    content: "";
    width: 16px;
    height: 16px;
    opacity: 0;
    transition: 120ms opacity ease-in-out;
    box-shadow: inset 1em 1em #000;
    clip-path: polygon(40% 65%, 75% 15%, 90% 25%, 40% 90%, 10% 65%, 20% 55%);
}

input[type="checkbox"]:checked::before {
    opacity: 1;
}

/* POPUP CONFIRM */
.popup_confirm {
    position: fixed;
    z-index: 100;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.popup_confirm p {
    font-family: "Afacad", sans-serif;
    font-size: 1.05rem;
    font-weight: 500;
    color: #222;
    margin: 0 0 20px 0;
}

.popup_confirm_buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.popup_confirm_buttons button {
    flex: 1;
    padding: 10px 16px;
    border-radius: 5px;
    font-family: "Afacad", sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.popup_confirm_cancel {
    background: #f5f5f5;
    border: 1px solid #ccc;
    color: #333;
}

@media (hover: hover) {
    .popup_confirm_cancel:hover {
        background: #eee;
    }
}

.popup_confirm_ok {
    background: #1b1a18;
    border: 1px solid #000;
    color: #fff;
}

@media (hover: hover) {
    .popup_confirm_ok:hover {
        background: #000;
    }
}


/* CART ITEM (unified) */
.uni_item {
    background: #f7f7f7;
    border-radius: 7px;
    overflow: hidden;
}

.uni_item + .uni_item {
    margin-top: 10px;
}

.uni_item_body {
    padding: 10px 12px;
}

.uni_item_header {
    display: flex;
    gap: 10px;
}

.uni_item_preview {
    width: 76px;
    min-width: 76px;
    height: 76px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.uni_item_preview img {
    max-width: 76px;
    max-height: 76px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.uni_item_info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.uni_item_info_top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.uni_item_name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #111;
    text-transform: uppercase;
}

.uni_item_delete {
    color: #c44;
    font-size: 0.72rem;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    padding-left: 8px;
}

@media (hover: hover) {
    .uni_item_delete:hover {
        text-decoration: underline;
    }
}

.uni_item_template {
    font-size: 0.72rem;
    color: #888;
    margin-top: 1px;
}

.uni_item_price {
    font-size: 0.75rem;
    font-weight: 500;
    color: #888;
    margin-top: 3px;
}

.uni_item_options {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e8e8e8;
}

.uni_item_option {
    display: flex;
    align-items: center;
    gap: 6px;
}

.uni_item_option_label {
    font-size: 0.65rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: 75px;
    min-width: 75px;
}

.uni_item_option_buttons {
    display: flex;
    background: #e4e4e4;
    border-radius: 5px;
    padding: 2px;
    margin-left: auto;
}

.uni_item_option_buttons button {
    padding: 6px 14px;
    border: none;
    border-radius: 4px;
    background: transparent;
    font-size: 0.75rem;
    font-family: inherit;
    color: #888;
    cursor: pointer;
    transition: all 150ms ease;
}

.uni_item_option_buttons button.uni_selected {
    font-weight: 600;
    background: #fff;
    color: #111;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.uni_item_option_checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.uni_item_option_checkbox label {
    font-size: 0.75rem;
    color: #333;
    cursor: pointer;
}

.uni_item_footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #e8e8e8;
}

.uni_item_quantity {
    display: flex;
    align-items: center;
    gap: 6px;
}

.uni_item_quantity button {
    width: 30px;
    height: 30px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    color: #444;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

@media (hover: hover) {
    .uni_item_quantity button:hover {
        background: #eee;
    }
}

.uni_item_quantity_value {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 18px;
    text-align: center;
    color: #222;
}

.uni_item_quantity input {
    width: 36px;
    height: 30px;
    text-align: center;
    font-family: "Afacad", serif;
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: 3px;
    border: solid 2px #222;
    padding: 0;
    box-sizing: border-box;
}

.uni_item_total {
    font-size: 0.9rem;
    font-weight: 700;
    color: #111;
}

.uni_item_quantity_row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.uni_item_quantity_label {
    font-size: 0.72rem;
    color: #888;
    width: 48px;
    min-width: 48px;
}

.uni_item_quantities {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cart_empty {
    color: #999;
    font-size: 0.85rem;
    text-align: center;
    padding: 20px 0;
}

.cart_alert {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
    color: #4a4a4a;
    font-size: 0.82rem;
    line-height: 1.5;
    padding: 12px 14px;
    margin-bottom: 10px;
    background: #edf0f3;
    border: 1px solid #dde1e6;
    border-radius: 6px;
}

.cart_alert strong {
    color: #333;
}

.cart_alert span {
    color: #666;
    font-weight: 400;
}
/* CART ITEM */


#overlay {
    position: fixed;
    display: none;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.25);
    z-index: 90;
    cursor: pointer;
}











.font_Oregano {
    font-family: "Oregano", cursive;
}

.font_Boogaloo {
    font-family: "Boogaloo";
}

.font_CarterOne {
    font-family: "CarterOne";
}

.font_Majalla {
    font-family: "Majalla";
}

.font_PassionOne {
    font-family: "PassionOne";
}

.font_SourGummy {
    font-family: "SourGummy";
}

.font_VAGRounded {
    font-family: "VAGRounded";
}

.font_PlayfairDisplay {
    font-family: "PlayfairDisplay", serif;
}

.font_CormorantGaramond {
    font-family: "CormorantGaramond", serif;
}

.font_DMSerifDisplay {
    font-family: "DMSerifDisplay", serif;
}


.font_NotoSerifDisplay {
    font-family: "NotoSerifDisplay", serif;
}

.font_GreatVibes {
    font-family: "GreatVibes", cursive;
}

.font_DancingScript {
    font-family: "DancingScript", cursive;
}

.font_Parisienne {
    font-family: "Parisienne", cursive;
}

.font_Sacramento {
    font-family: "Sacramento", cursive;
}

.font_Satisfy {
    font-family: "Satisfy", cursive;
}

.font_Tangerine {
    font-family: "Tangerine", cursive;
}

.font_Allura {
    font-family: "Allura", cursive;
}

.font_Cookie {
    font-family: "Cookie", cursive;
}

.font_Italianno {
    font-family: "Italianno", cursive;
}

.font_Montserrat {
    font-family: "Montserrat", sans-serif;
}

.font_Raleway {
    font-family: "Raleway", sans-serif;
}

.font_Poppins {
    font-family: "Poppins", sans-serif;
}

.font_Quicksand {
    font-family: "Quicksand", sans-serif;
}

.font_Nunito {
    font-family: "Nunito", sans-serif;
}

.font_Lato {
    font-family: "Lato", sans-serif;
}

.font_OpenSans {
    font-family: "OpenSans", sans-serif;
}

.font_JosefinSans {
    font-family: "JosefinSans", sans-serif;
}

.font_Fredoka {
    font-family: "Fredoka", sans-serif;
}

.font_Baloo2 {
    font-family: "Baloo2", sans-serif;
}

.font_Chewy {
    font-family: "Chewy", cursive;
}

.font_ComicNeue {
    font-family: "ComicNeue", sans-serif;
}

.font_LuckiestGuy {
    font-family: "LuckiestGuy", cursive;
}

.font_RubikBubbles {
    font-family: "RubikBubbles", cursive;
}

.font_ConcertOne {
    font-family: "ConcertOne", sans-serif;
}

.font_Caveat {
    font-family: "Caveat", cursive;
}






.font_ShadowsIntoLight {
    font-family: "ShadowsIntoLight", cursive;
}

.font_IndieFlower {
    font-family: "IndieFlower", cursive;
}

.font_PatrickHand {
    font-family: "PatrickHand", cursive;
}

.font_Handlee {
    font-family: "Handlee", cursive;
}

.font_ComingSoon {
    font-family: "ComingSoon", cursive;
}

.font_PermanentMarker {
    font-family: "PermanentMarker", cursive;
}

.font_Lobster {
    font-family: "Lobster", cursive;
}

.font_Pacifico {
    font-family: "Pacifico", cursive;
}

.font_AbrilFatface {
    font-family: "AbrilFatface", cursive;
}

.font_GloriaHallelujah {
    font-family: "GloriaHallelujah", cursive;
}

.font_BebasNeue {
    font-family: "BebasNeue", sans-serif;
}

.font_Righteous {
    font-family: "Righteous", cursive;
}

.font_FugazOne {
    font-family: "FugazOne", cursive;
}


/* CODE */
.code_init_hidden {
    display: none;
}

/* CODE */

/* IMAGE CHECKMARK */
.image_thumb {
    position: relative;
    flex-shrink: 0;
    margin: 5px;
}
.portrait_images_container .image_thumb {
    max-height: 100%;
    align-self: center;
}
.portrait_images_container .image_thumb img {
    display: block;
    max-height: 90px;
    width: auto;
}
.image_check {
    display: none;
    background: #555;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    pointer-events: none;
    z-index: 1;
}
.image_thumb.used .image_check {
    display: block;
    position: absolute;
    bottom: -5px;
    right: -5px;
}
/* Filename caption under a thumbnail (calendar, book, card, student). The frame holds the image
   and its checkmark so the check stays on the photo, not on the caption. */
.image_frame {
    position: relative;
    display: block;
}
.image_name {
    display: block;
    /* never wider than the photo above it */
    width: 0;
    min-width: 100%;
    margin-top: 4px;
    font-size: 11px;
    line-height: 13px;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}
.portrait_images_container .image_thumb:has(.image_name) img {
    max-height: 80px;
}
/* IMAGE CHECKMARK */

/* VALIDATION MESSAGE */
.validation_message {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 24px 28px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 200;
    max-width: 360px;
    text-align: center;
}

.validation_message span {
    display: block;
    margin-bottom: 16px;
    font-size: 15px;
    line-height: 1.4;
}

.validation_button {
    padding: 8px 24px;
    background-color: #333;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: "Afacad", sans-serif;
    font-size: 14px;
    font-weight: 600;
}

@media (hover: hover) {
    .validation_button:hover {
        background-color: #444;
    }
}
/* VALIDATION MESSAGE */

/* ── header "Lägg till i kundvagn" price button (card / book / calendar) ────
   The header carries an add-to-cart button showing the current price (à-pris
   for card, exact for calendar, kr/sida × sidor for book). Wired by
   assets/code/header-addcart.js (forwards to #code_action_add_cart); each
   app's updateHeaderPrice() fills the value — until then only the label
   shows (.has-price reveals the price + separator). */
.summary_price.ac-pricebtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 5.5px 11px;
    margin-left: auto;
    margin-right: 15px; /* breathing room to the account icon */
    border: 1.5px solid #1b1a18;
    border-radius: 6px;
    background: #1b1a18;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.9rem;
    transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
@media (hover: hover) { .summary_price.ac-pricebtn:hover { background: #fff; color: #1b1a18; } }
.summary_price.ac-pricebtn:focus { outline: none; }
.summary_price.ac-pricebtn:focus-visible { outline: 2px solid #1b1a18; outline-offset: 2px; }
.summary_price.ac-pricebtn .ac-cart { width: 14px; height: 14px; flex-shrink: 0; display: block; }
.summary_price.ac-pricebtn .ac-lbl { font-weight: 700; }
.summary_price.ac-pricebtn .ac-sep { opacity: .45; font-weight: 400; margin: 0 -1px; }
.summary_price.ac-pricebtn .ac-sep,
.summary_price.ac-pricebtn .ac-price { display: none; }
.summary_price.ac-pricebtn.has-price .ac-sep,
.summary_price.ac-pricebtn.has-price .ac-price { display: inline; }
/* the button claims the header's free space; neutralise the account menu's */
.ac-pricebtn ~ .account-menu { margin-left: 0; }
/* book: the Spara chip already claims the free space */
.header_icon_action_first ~ .ac-pricebtn { margin-left: 8px; }
/* Narrow: drop the cart+account icons, shorten the logo to the linked
   app name, and the button shows the sum only (bag icon + price) at the
   freed right edge. Icon-hiding is
   scoped to headers WITH the add button: student has none, so it keeps
   its icons. Widths measured (book collides first, longest content). */
@media (max-width: 520px) {
    header:has(.ac-pricebtn--book) .header_icon_cart,
    header:has(.ac-pricebtn--book) .account-menu { display: none; }
    header:has(.ac-pricebtn--book) div.header_logo span { display: none; }
    header:has(.ac-pricebtn--book) .ac-pricebtn { margin-right: 0; }
    .ac-pricebtn--book .ac-lbl,
    .ac-pricebtn--book .ac-sep { display: none !important; }
}
@media (max-width: 420px) {
    header:has(.ac-pricebtn) .header_icon_cart,
    header:has(.ac-pricebtn) .account-menu { display: none; }
    header:has(.ac-pricebtn) .ac-pricebtn { margin-right: 0; }
    header div.header_logo span { display: none; }
    .summary_price.ac-pricebtn .ac-lbl,
    .summary_price.ac-pricebtn .ac-sep { display: none !important; }
}
/* tighter tier (measured: book — the longest content — collides again
   just under 350px) */
@media (max-width: 350px) {
    header:has(.ac-pricebtn) div.header_logo { margin-right: 8px; }
    header:has(.ac-pricebtn) .header_icon_action { padding: 4px !important; }
    header:has(.ac-pricebtn) .ac-pricebtn { padding: 7px 8px; }
}
