/* DoughMaster — new interface */

/* Roboto Serif, the font of the notes in the classic app: only the regular and italic 400 with the Latin letters
   (the full variable font weighs 8 MB) */
@font-face {
    font-family: "Roboto Serif";
    src: url("res/fonts/RobotoSerif.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Roboto Serif";
    src: url("res/fonts/RobotoSerif-Italic.woff2") format("woff2");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "Manrope";
    src: url("res/fonts/Manrope.woff2") format("woff2");
    font-weight: 200 800;
    font-display: swap;
}

/* ---------- tokens ---------- */

:root {
    --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-serif: "Roboto Serif", Georgia, serif;
    --bg: #f7f3ec;
    --surface: #ffffff;
    --surface-2: #f2ece2;
    --surface-3: #e4dbcd;
    --text: #221c15;
    --text-2: #675d51;
    --text-3: #8f8475;
    --border: #e7dfd3;
    --primary: #b5532f;
    --on-primary: #ffffff;
    --primary-soft: #f7e4d9;
    --on-primary-soft: #7a3218;
    --danger: #b3261e;
    --on-danger: #ffffff;
    --danger-soft: #fbe5e3;
    --success: #2f7d4f;
    --toast-action: #f3a786;
    --shadow-1: 0 1px 2px rgb(60 40 20 / 0.05), 0 2px 10px rgb(60 40 20 / 0.05);
    --shadow-2: 0 10px 34px rgb(60 40 20 / 0.16);
    --scrim: rgb(25 16 8 / 0.45);
    --tint-mix: 55%;
    /* the top band painted by .edge-top: under the status bar and a bit more */
    --edge-top: calc(env(safe-area-inset-top) + 12px);
    --radius: 16px;
    --radius-l: 24px;
    --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
    /* the curve of the iOS sheets: quick start, long soft landing */
    --ease-sheet: cubic-bezier(0.32, 0.72, 0, 1);
    --sheet-in: 0.5s var(--ease-sheet);
    --sheet-out: 0.32s var(--ease-sheet);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #15120e;
        --surface: #1f1b16;
        --surface-2: #2a251f;
        --surface-3: #3a332a;
        --text: #f3ede5;
        --text-2: #b5ab9e;
        --text-3: #8a7f72;
        --border: #352e26;
        --primary: #ec9672;
        --on-primary: #2a130a;
        --primary-soft: #44271a;
        --on-primary-soft: #f8cdb9;
        --danger: #f2a49e;
        --on-danger: #3b0b08;
        --danger-soft: #45201d;
        --success: #8fd3a8;
        --toast-action: #a4461f;
        --shadow-1: 0 1px 2px rgb(0 0 0 / 0.3);
        --shadow-2: 0 12px 34px rgb(0 0 0 / 0.55);
        --scrim: rgb(0 0 0 / 0.6);
        --tint-mix: 15%;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #15120e;
    --surface: #1f1b16;
    --surface-2: #2a251f;
    --surface-3: #3a332a;
    --text: #f3ede5;
    --text-2: #b5ab9e;
    --text-3: #8a7f72;
    --border: #352e26;
    --primary: #ec9672;
    --on-primary: #2a130a;
    --primary-soft: #44271a;
    --on-primary-soft: #f8cdb9;
    --danger: #f2a49e;
    --on-danger: #3b0b08;
    --danger-soft: #45201d;
    --success: #8fd3a8;
    --toast-action: #a4461f;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-2: 0 12px 34px rgb(0 0 0 / 0.55);
    --scrim: rgb(0 0 0 / 0.6);
    --tint-mix: 15%;
    color-scheme: dark;
}

/* the recipe color (--tint, set inline) blended with the surface */
[style*="--tint"] {
    --tint-bg: color-mix(in srgb, var(--tint) var(--tint-mix), var(--surface));
}

/* ---------- base ---------- */

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

[hidden] {
    display: none !important;
}

html,
body {
    margin: 0;
    height: 100%;
}

/* fixed like the classic app (yeastUI "app shell"): the document never scrolls, only the pages do */
body {
    position: fixed;
    inset: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.4;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    overflow: hidden;
}

/* like a native app (and like the classic DoughMaster): no text selection, no callout on long press,
   no image dragging; the fields where the user writes stay selectable */
*,
*::before,
*::after {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* no double tap or pinch zoom: the fingers can only scroll (touch-action isn't inherited, so it goes on everything) */
* {
    touch-action: pan-x pan-y;
}

input,
textarea {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    user-select: text;
}

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

h1,
h2,
h3 {
    letter-spacing: -0.02em;
}

.muted {
    color: var(--text-2);
}

.eyebrow {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
}

.icon {
    width: 20px;
    height: 20px;
    flex: none;
}

.icon.inline {
    width: 1.15em;
    height: 1.15em;
    vertical-align: -0.22em;
}

.container {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 0 16px;
}

/* ---------- app shell and pages ---------- */

#app {
    position: fixed;
    inset: 0;
}

.splash {
    display: grid;
    place-items: center;
    height: 100%;
}

.splash img {
    width: 96px;
    height: 96px;
    animation: pulse 1.4s ease-in-out infinite;
}

.page {
    position: absolute;
    inset: 0;
    z-index: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    background: var(--bg);
}

.page-enter {
    animation: page-in 0.34s var(--ease-out);
    box-shadow: -24px 0 48px rgb(0 0 0 / 0.08);
}

.page-leave {
    animation: page-out 0.26s ease-in forwards;
    pointer-events: none;
}

.page-covered {
    visibility: hidden;
}

.fatal {
    display: grid;
    place-content: center;
    gap: 12px;
    height: 100%;
    padding: 24px;
    text-align: center;
}

.fatal .icon {
    width: 48px;
    height: 48px;
    margin: 0 auto;
    color: var(--danger);
}

/* the install screen: on iPhone/iPad and on Chrome for Android the app opens only installed */
.installer {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* safe: on a short screen the top stays visible and the page scrolls */
    justify-content: safe center;
    gap: 12px;
    height: 100%;
    max-width: 440px;
    margin: 0 auto;
    padding: calc(var(--edge-top) + 24px) 24px 32px;
    overflow-y: auto;
    text-align: center;
}

.installer > img {
    width: 96px;
    height: 96px;
}

.installer h1 {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 800;
}

.installer p {
    margin: 0;
}

.install-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin: 8px 0 0;
    padding: 16px 16px 16px 40px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-1);
    text-align: left;
}

.install-done {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--success);
    font-weight: 700;
    text-align: left;
}

.install-done .icon {
    width: 28px;
    height: 28px;
}

.installer .banner {
    text-align: left;
}

/* ---------- app bar ---------- */

/* iOS 26 (Liquid Glass) colours or blurs the edges of the screen from the position: fixed boxes touching them:
   a sticky bar inside the scrolling pages isn't seen, so this solid band covers the top edge (status bar included) */
.edge-top {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    height: var(--edge-top);
    background: var(--bg);
    pointer-events: none;
}

.appbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 56px;
    padding: var(--edge-top) 8px 6px;
    background: var(--bg);
    transition: box-shadow 0.2s, background 0.2s;
}

/* solid, not frosted: on the iPhone the blurred content under the bar looked out of focus */
.appbar.scrolled,
.scrolled > .appbar,
.calc-top.scrolled {
    background: var(--bg);
    box-shadow: 0 1px 0 var(--border);
}

.appbar-title {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 8px;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.icon-btn {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
}

.icon-btn:hover {
    background: var(--surface-2);
}

.icon-btn:active {
    transform: scale(0.92);
}

.icon-btn .icon {
    width: 24px;
    height: 24px;
}

.icon-btn-spacer {
    flex: none;
    width: 44px;
}

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 20px;
    border: 0;
    border-radius: 999px;
    font: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.12s, background 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.btn:active {
    transform: scale(0.97);
}

.btn:disabled {
    opacity: 0.35;
    pointer-events: none;
}

.btn img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 30%, transparent);
}

.btn-tonal {
    background: var(--primary-soft);
    color: var(--on-primary-soft);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
}

.btn-ghost:hover {
    background: var(--surface-2);
}

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

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

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

.btn-sm {
    min-height: 36px;
    padding: 0 14px;
    font-size: 0.85rem;
}

.pill-btn {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
}

/* ---------- chips ---------- */

.chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0 -16px 16px;
    padding: 2px 16px 4px;
}

.chips::-webkit-scrollbar {
    display: none;
}

.chips.wrap {
    flex-wrap: wrap;
    overflow: visible;
    margin: 0;
    padding: 0;
}

.chip {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font: inherit;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.chip .icon {
    width: 16px;
    height: 16px;
}

.chip.selected {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}

/* ---------- home ---------- */

.home .container {
    max-width: 1100px;
}

.home > .appbar {
    padding-inline: max(8px, calc((100% - 1100px) / 2 + 8px));
}

.home-main {
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
}

.toolbar {
    display: flex;
    gap: 8px;
    margin: 8px 0 12px;
}

.search {
    flex: 1;
    /* without it the box can't get narrower than the natural width of the input and pushes the sort button out */
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-3);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.search input {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font: inherit;
}

.search input::-webkit-search-cancel-button {
    filter: grayscale(1);
}

.dough-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
    gap: 12px;
}

.dough-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 10px 14px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    background: var(--surface);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    box-shadow: var(--shadow-1);
    transition: transform 0.18s var(--ease-out), box-shadow 0.2s;
    animation: rise 0.4s var(--ease-out) both;
}

.dough-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
}

.dough-card:active {
    transform: scale(0.985);
}

.dough-card-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 20px;
    background: var(--tint-bg);
}

.dough-card-icon img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 8px;
}

.dough-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dough-card-title {
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dough-card-meta {
    color: var(--text-2);
    font-size: 0.85rem;
}

.dough-card-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.metric-chip {
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 0.75rem;
    white-space: nowrap;
}

.metric-chip b {
    color: var(--text);
}

.dough-card-arrow {
    color: var(--text-3);
}

/* the recipe just saved: its border pulses twice in the main colour, then the card goes back to normal */
.dough-card.just-saved {
    animation:
        rise 0.4s var(--ease-out) both,
        saved-glow 6s ease-out 0.35s both;
}

.new-badge {
    flex: none;
    align-self: flex-start;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--primary);
    color: var(--on-primary);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    animation: pop-in 0.4s var(--ease-out) 0.35s both;
}

@keyframes saved-glow {
    0% {
        border-color: var(--primary);
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 55%, transparent);
    }
    12% {
        box-shadow: 0 0 0 12px color-mix(in srgb, var(--primary) 0%, transparent);
    }
    13% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 55%, transparent);
    }
    25% {
        box-shadow: 0 0 0 12px color-mix(in srgb, var(--primary) 0%, transparent);
    }
    30%,
    75% {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-soft);
    }
    100% {
        border-color: var(--border);
        box-shadow: var(--shadow-1);
    }
}

.no-results {
    display: grid;
    justify-items: center;
    padding: 48px 0;
    color: var(--text-3);
}

.no-results .icon {
    width: 40px;
    height: 40px;
}

.empty {
    padding: 24px 0 40px;
    text-align: center;
}

.empty > img {
    animation: float 5s ease-in-out infinite;
}

.empty h2 {
    margin: 16px 0 4px;
    font-size: 1.5rem;
    font-weight: 800;
}

.empty p {
    margin: 0 auto;
    max-width: 380px;
}

.empty .recipe-list {
    max-width: 520px;
    margin: 28px auto 0;
    text-align: left;
}

.fab {
    position: fixed;
    z-index: 5;
    right: calc(20px + env(safe-area-inset-right));
    bottom: calc(20px + env(safe-area-inset-bottom));
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    padding: 0;
    border: 0;
    border-radius: 20px;
    background: var(--primary);
    color: var(--on-primary);
    cursor: pointer;
    box-shadow: 0 12px 30px color-mix(in srgb, var(--primary) 40%, transparent);
    transition: transform 0.12s;
    animation: pop-in 0.4s var(--ease-out) 0.15s both;
}

.fab:active {
    transform: scale(0.95);
}

.fab .icon {
    width: 28px;
    height: 28px;
}

/* ---------- banners ---------- */

.banner {
    display: flex;
    gap: 14px;
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--on-primary-soft);
    animation: rise 0.4s var(--ease-out) both;
}

.banner > .icon {
    width: 28px;
    height: 28px;
}

.banner > div {
    flex: 1;
}

.banner p {
    margin: 4px 0 0;
    font-size: 0.9rem;
}

.banner-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.banner .btn-ghost {
    color: inherit;
}

/* ---------- recipe cards ---------- */

.recipe-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.recipe-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 10px 14px 14px;
    border: 0;
    border-radius: var(--radius-l);
    background: var(--tint-bg);
    color: var(--text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s var(--ease-out);
}

.recipe-card:hover {
    transform: translateY(-1px);
}

.recipe-card:active {
    transform: scale(0.98);
}

.recipe-card > .icon {
    color: var(--text-2);
}

.recipe-card-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.recipe-card-icon img {
    width: 42px;
    height: 42px;
}

.recipe-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recipe-card-title {
    font-weight: 800;
    font-size: 1.05rem;
}

.recipe-card-desc {
    color: var(--text-2);
    font-size: 0.88rem;
}

.recipe-card-steps {
    margin-top: 4px;
    color: var(--text-3);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.recipe-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 4px 0;
    color: var(--text-3);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.recipe-group-title .icon {
    width: 16px;
    height: 16px;
}

.recipe-group-title:not(:first-child) {
    margin-top: 14px;
}

/* ---------- sheets and dialogs ---------- */

dialog.sheet {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text);
    /* clip, not hidden: the dialog must not be scrollable, otherwise focusing the panel
       scrolls it into view at once and the slide-up animation is lost (the "jump") */
    overflow: clip;
}

dialog.sheet[open] {
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

dialog.sheet::backdrop {
    background: var(--scrim);
    animation: fade-in var(--sheet-in) both;
}

dialog.sheet.closing::backdrop {
    animation: fade-out var(--sheet-out) both;
}

.sheet-panel {
    width: 100%;
    max-width: 560px;
    max-height: 88dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
    border-radius: 28px 28px 0 0;
    background: var(--surface);
    box-shadow: var(--shadow-2);
    will-change: transform;
    animation: sheet-up var(--sheet-in) both;
}

.sheet-panel:focus {
    outline: none;
}

.closing .sheet-panel {
    animation: sheet-down var(--sheet-out) forwards;
}

.sheet-grabber {
    width: 36px;
    height: 4px;
    margin: 4px auto 14px;
    border-radius: 2px;
    background: var(--surface-3);
}

.sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.sheet-header h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.sheet-header p {
    margin: 4px 0 0;
    color: var(--text-2);
    font-size: 0.92rem;
}

.sheet-header .icon-btn {
    width: 38px;
    height: 38px;
    margin: -4px -6px 0 0;
    background: var(--surface-2);
}

.sheet-header .icon-btn .icon {
    width: 20px;
    height: 20px;
}

/* iOS paints the area under the page (home indicator) with the colour of the fixed box it finds on the bottom edge,
   looked up when the sheet opens: the panel is still out of the screen then, so this white foot is already there */
.sheet-foot {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 16px;
    background: var(--surface);
}

@media (min-width: 700px) {
    .sheet-foot {
        display: none;
    }
}

/* on phones the panel is a fixed box on the bottom edge too */
@media (max-width: 699px) {
    .sheet-panel {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0 auto;
    }
}

@media (min-width: 700px) {
    dialog.sheet[open] {
        align-items: center;
    }

    .sheet-panel {
        padding-bottom: 24px;
        border-radius: 28px;
        animation: pop-in var(--sheet-in) both;
    }

    .closing .sheet-panel {
        animation: pop-out var(--sheet-out) forwards;
    }

    .sheet-grabber {
        visibility: hidden;
        height: 0;
        margin: 6px 0;
    }
}

.sheet-dialog .sheet-panel {
    max-width: 440px;
}

.dialog-message {
    margin: -6px 0 22px;
    color: var(--text-2);
    line-height: 1.5;
}

.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.dialog-actions .btn {
    flex: 1 1 auto;
}

.text-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 22px;
}

.text-field span {
    color: var(--text-2);
    font-size: 0.85rem;
    font-weight: 700;
}

.text-field input {
    height: 52px;
    padding: 0 16px;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    outline: none;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 1.05rem;
    transition: border-color 0.2s, background 0.2s;
}

.text-field input:focus {
    border-color: var(--primary);
    background: var(--surface);
}

.text-field.invalid input {
    border-color: var(--danger);
    animation: shake 0.4s;
}

.action-list {
    display: flex;
    flex-direction: column;
    margin: 0 -8px;
}

.action-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 12px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.action-item:hover {
    background: var(--surface-2);
}

.action-item .icon {
    width: 22px;
    height: 22px;
    color: var(--text-2);
}

.action-item.danger,
.action-item.danger .icon {
    color: var(--danger);
}

.action-list hr {
    margin: 6px 12px;
    border: 0;
    border-top: 1px solid var(--border);
}

.chip-group + .chip-group {
    margin-top: 18px;
}

.chip-group-title {
    display: block;
    margin-bottom: 8px;
    color: var(--text-3);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.icon-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 8px;
}

.icon-choice {
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    padding: 10px;
    border: 2px solid transparent;
    border-radius: 16px;
    background: var(--surface-2);
    cursor: pointer;
    transition: transform 0.12s;
}

.icon-choice:active {
    transform: scale(0.94);
}

.icon-choice img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.icon-choice.selected {
    border-color: var(--primary);
    background: var(--primary-soft);
}

/* ---------- toasts ---------- */

.toast-host {
    position: fixed;
    inset: auto 0 calc(24px + env(safe-area-inset-bottom)) 0;
    z-index: 1000;
    width: auto;
    height: auto;
    margin: 0;
    padding: 0 16px;
    border: 0;
    background: transparent;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 520px;
    padding: 12px 18px;
    border-radius: 14px;
    background: var(--text);
    color: var(--bg);
    font-weight: 600;
    font-size: 0.92rem;
    box-shadow: var(--shadow-2);
    pointer-events: auto;
    animation: toast-in 0.32s var(--ease-out);
}

.toast.leaving {
    animation: toast-out 0.25s forwards;
}

.toast-action {
    margin: -6px -8px -6px 0;
    padding: 6px 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--toast-action);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

/* ---------- calculator ---------- */

.calc-top {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg);
    transition: box-shadow 0.2s, background 0.2s;
}

.calc-top .appbar {
    position: static;
    background: transparent;
}

.calc-appbar .appbar-title {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.steps-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px 16px 10px;
}

.steps-nav::-webkit-scrollbar {
    display: none;
}

@media (min-width: 900px) {
    .steps-nav {
        justify-content: center;
    }
}

.step-pill {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 14px 0 6px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-2);
    font: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.25s, color 0.25s, border-color 0.25s;
}

.step-dot {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-2);
    font-size: 0.8rem;
    transition: background 0.25s, color 0.25s;
}

.step-pill.done .step-dot {
    background: var(--primary-soft);
    color: var(--on-primary-soft);
}

.step-pill.active {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}

.step-pill.active .step-dot {
    background: var(--primary);
    color: var(--on-primary);
}

.progress {
    height: 3px;
    background: var(--surface-2);
}

.progress-fill {
    height: 100%;
    width: 0;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
    transition: width 0.4s var(--ease-out);
}

.calc-layout {
    display: grid;
    gap: 16px;
    padding-top: 16px;
    padding-bottom: calc(110px + env(safe-area-inset-bottom));
}

@media (min-width: 900px) {
    .calc .container {
        max-width: 1060px;
    }

    .calc-layout {
        grid-template-columns: minmax(0, 1fr) 320px;
        align-items: start;
    }

    .live {
        position: sticky;
        top: 140px;
    }
}

@media (max-width: 899px) {
    .on-result .live {
        display: none;
    }
}

.panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    background: var(--surface);
    box-shadow: var(--shadow-1);
}

.panel.enter-forward {
    animation: slide-from-right 0.34s var(--ease-out);
}

.panel.enter-back {
    animation: slide-from-left 0.34s var(--ease-out);
}

.panel-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--tint-bg);
}

.panel-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 72px;
    height: 72px;
    border-radius: 22px;
    background: color-mix(in srgb, var(--surface) 65%, transparent);
}

.panel-icon img {
    width: 52px;
    height: 52px;
}

.panel-head h2 {
    margin: 2px 0 0;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.15;
}

.panel-head p {
    margin: 4px 0 0;
    font-size: 0.9rem;
}

.fields,
.result-list {
    display: flex;
    flex-direction: column;
    padding: 4px 20px 12px;
}

.field {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px 12px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.field:last-child {
    border-bottom: 0;
}

@media (max-width: 359px) {
    .field {
        grid-template-columns: 1fr;
    }
}

.field-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.field-label label,
.field-label > span {
    font-weight: 700;
}

.field-hint {
    color: var(--text-3);
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
}

.field-error {
    grid-column: 1 / -1;
    color: var(--danger);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: right;
}

.field-error:empty {
    display: none;
}

.field-switch {
    cursor: pointer;
}

/* a text of the recipe shown in the step (field of type "note") */
.field-note {
    margin: 0;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-2);
    white-space: pre-wrap;
}

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

.num-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    touch-action: manipulation;
    transition: background 0.15s, transform 0.1s;
}

.num-btn:active {
    background: var(--primary-soft);
    color: var(--on-primary-soft);
    transform: scale(0.92);
}

.num-box {
    display: flex;
    align-items: center;
    gap: 3px;
    width: 108px;
    height: 48px;
    padding: 0 12px;
    border: 1.5px solid var(--border);
    border-radius: 14px;
    background: var(--bg);
    cursor: text;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.num-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.num-box input {
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 1.15rem;
    font-weight: 800;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.num-box:not(:has(.num-unit)) input {
    text-align: center;
}

.num-unit {
    color: var(--text-3);
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.field.invalid .num-box,
.field.invalid .text-field input {
    border-color: var(--danger);
    background: var(--danger-soft);
}

.shake {
    animation: shake 0.4s;
}

.switch {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    width: 52px;
    height: 32px;
    margin: 0;
    border-radius: 999px;
    background: var(--surface-3);
    cursor: pointer;
    transition: background 0.2s;
}

.switch::before {
    content: "";
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
    transition: transform 0.22s var(--ease-out);
}

.switch:checked {
    background: var(--primary);
}

.switch:checked::before {
    transform: translateX(20px);
}

.result-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px dashed var(--border);
    font-weight: 700;
}

.result-row:last-child {
    border-bottom: 0;
}

.result-row strong {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

[data-value] {
    display: inline-block;
    transition: opacity 0.2s;
}

[data-value].bump {
    animation: bump 0.35s var(--ease-out);
}

[data-value].error {
    color: var(--danger);
}

.stale [data-value] {
    opacity: 0.3;
}

.live {
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    background: var(--surface);
    box-shadow: var(--shadow-1);
}

.live h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    color: var(--text-2);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.live h3 .icon {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

.live-group + .live-group {
    margin-top: 14px;
}

.live-title {
    color: var(--text-3);
    font-size: 0.8rem;
    font-weight: 700;
}

.live-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.live-item {
    display: flex;
    flex-direction: column;
    min-width: 78px;
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--tint-bg);
}

.live-item span {
    color: var(--text-2);
    font-size: 0.72rem;
    font-weight: 700;
}

.live-item b {
    font-size: 1.05rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.calc-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 8;
    padding: 20px 0 calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, transparent, var(--bg) 40%);
    pointer-events: none;
}

.calc-footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.calc-footer .btn {
    pointer-events: auto;
}

.calc-footer .btn-ghost {
    border: 1px solid var(--border);
    background: var(--surface);
}

.calc-footer .btn-primary {
    flex: 1;
    max-width: 320px;
}

@media (min-width: 900px) {
    .calc-footer .container {
        max-width: 1060px;
        padding-right: 352px;
    }
}

/* ---------- detail ---------- */

.detail .container {
    max-width: 960px;
}

.fade-title {
    opacity: 0;
    transition: opacity 0.2s;
}

.detail.scrolled .fade-title {
    opacity: 1;
}

.detail-main {
    padding-bottom: calc(32px + env(safe-area-inset-bottom));
}

.hero {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 4px;
    padding: 22px;
    border-radius: 28px;
    background: var(--tint-bg);
    animation: rise 0.45s var(--ease-out) both;
}

.hero-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 100px;
    height: 100px;
    padding: 0;
    border: 0;
    border-radius: 28px;
    background: color-mix(in srgb, var(--surface) 65%, transparent);
    cursor: pointer;
    transition: transform 0.15s;
}

.hero-icon:active {
    transform: scale(0.95);
}

.hero-icon img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 12px;
}

.hero-text {
    min-width: 0;
}

.hero h1 {
    margin: 2px 0 10px;
    font-size: clamp(1.6rem, 6vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    color: var(--text-2);
    font-size: 0.85rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface) 70%, transparent);
    color: var(--text);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.tag-chip .icon,
.hero-date .icon {
    width: 16px;
    height: 16px;
}

.hero-date {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

@media (max-width: 520px) {
    .hero {
        flex-direction: column;
        text-align: center;
    }

    .hero-meta {
        justify-content: center;
    }
}

.detail-actions {
    display: flex;
    gap: 10px;
    margin: 16px 0;
}

.detail-actions .btn {
    flex: 1;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    animation: rise 0.45s var(--ease-out) both;
}

.metric:nth-child(2) {
    animation-delay: 0.04s;
}

.metric:nth-child(3) {
    animation-delay: 0.08s;
}

.metric:nth-child(4) {
    animation-delay: 0.12s;
}

.metric-label {
    color: var(--text-2);
    font-size: 0.78rem;
    font-weight: 700;
}

.metric-value {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.meter {
    height: 6px;
    margin-top: 8px;
    overflow: hidden;
    border-radius: 3px;
    background: var(--surface-2);
}

.meter span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: var(--bar, var(--primary));
    transform-origin: left;
    animation: grow 0.7s var(--ease-out) 0.15s both;
}

.detail-grid {
    display: grid;
    gap: 16px;
}

@media (min-width: 760px) {
    .detail-grid {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

.card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    background: var(--surface);
    box-shadow: var(--shadow-1);
}

.card h2 {
    margin: 0 0 12px;
    font-size: 1.15rem;
    font-weight: 800;
}

.card h3 {
    margin: 18px 0 6px;
    color: var(--text-3);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.card > div > div:first-child > h3,
.card h3:first-child {
    margin-top: 0;
}

.ingredient {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 8px 0;
}

.ingredient > span:first-child {
    font-weight: 600;
}

.dots {
    flex: 1;
    border-bottom: 2px dotted var(--surface-3);
    transform: translateY(-4px);
}

.ingredient strong {
    font-size: 1.2rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.param-group + .param-group {
    margin-top: 4px;
}

dl {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    margin: 0;
}

dl > div {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-2);
}

dt {
    color: var(--text-2);
    font-size: 0.75rem;
    font-weight: 700;
}

dd {
    margin: 2px 0 0;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

/* always in its place, only faded in and out: it never moves the page */
.saved-hint {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--success);
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.25s;
}

.saved-hint.show {
    opacity: 1;
}

.saved-hint .icon {
    width: 16px;
    height: 16px;
}

/* ---------- free recipe: editor ---------- */

.notepad-main {
    max-width: 720px;
    padding-top: 4px;
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
}

.paper {
    padding: 22px 20px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-l);
    background: var(--surface);
    box-shadow: var(--shadow-1);
}

.paper textarea {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    outline: none;
    resize: none;
    overflow: hidden;
    background: transparent;
    color: var(--text);
    font: inherit;
    line-height: 1.45;
}

.paper textarea::placeholder {
    color: var(--text-3);
    opacity: 1;
}

.np-title {
    font-size: clamp(1.6rem, 6vw, 2.1rem) !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em;
    line-height: 1.15 !important;
}

.np-section {
    margin-top: 26px;
}

.np-section h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
    color: var(--text-2);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.np-section h2 .icon {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.np-list {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.np-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 -8px;
    padding: 7px 8px;
    border-radius: 12px;
    transition: background 0.15s;
}

.np-row:focus-within {
    background: var(--surface-2);
}

.np-marker {
    flex: none;
    display: grid;
    place-items: center;
    width: 24px;
    height: 23px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
}

.np-marker::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* the steps are numbered; a section title starts the numbering again */
.np-steps .np-row:not(.header) {
    counter-increment: step;
}

.np-steps .np-row.header {
    counter-reset: step;
}

.np-steps .np-marker::before {
    content: counter(step);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--on-primary-soft);
    line-height: 24px;
    text-align: center;
}

.np-row:last-child .np-marker {
    opacity: 0.35;
}

.np-steps .np-row:last-child .np-marker::before {
    content: "+";
}

.np-list:not(.np-steps) .np-row:last-child .np-marker::before {
    content: "+";
    width: auto;
    height: auto;
    background: none;
    font-size: 1rem;
}

.np-row.header {
    margin-top: 10px;
}

.np-row.header .np-marker {
    visibility: hidden;
}

.np-row.header textarea {
    font-weight: 800;
    font-size: 1.05rem;
}

.np-tools {
    flex: none;
    display: none;
    gap: 2px;
    margin: -5px -4px -5px 0;
}

.np-row:focus-within .np-tools {
    display: flex;
    animation: fade-in 0.15s;
}

@media (hover: hover) {
    .np-row:hover .np-tools {
        display: flex;
    }
}

.np-tool {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
}

.np-tool:hover {
    background: var(--surface-3);
}

.np-tool .icon {
    width: 18px;
    height: 18px;
}

.np-tool[aria-pressed="true"] {
    background: var(--primary-soft);
    color: var(--on-primary-soft);
}

.np-notes {
    min-height: 72px;
    padding: 4px 0 !important;
    font-family: var(--font-serif) !important;
    font-size: 1.15rem !important;
}

.paper .np-notes::placeholder {
    font-style: italic;
}

.np-help {
    display: flex;
    gap: 10px;
    margin: 14px 4px 0;
    color: var(--text-3);
    font-size: 0.82rem;
}

.np-help > .icon {
    width: 18px;
    height: 18px;
}

/* ---------- free recipe: view ---------- */

.np-view {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.np-view li {
    position: relative;
    padding: 7px 0 7px 20px;
    line-height: 1.45;
}

.np-view li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 15px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}

.np-view .np-view-header {
    margin-top: 12px;
    padding-left: 0;
    color: var(--text-3);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.np-view .np-view-header:first-child {
    margin-top: 0;
}

.np-view .np-view-header::before,
.np-view-steps li::before {
    display: none;
}

.np-view-steps li:not(.np-view-header) {
    display: flex;
    gap: 12px;
    padding-left: 0;
}

.step-num {
    flex: none;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--on-primary-soft);
    font-size: 0.8rem;
    font-weight: 800;
}

/* ---------- notes, like in the classic app: serif text written straight on the page ---------- */

.note-text {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text);
}

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

/* as tall as the text without scripts where supported (otherwise autosizeTextarea in ui.js) */
textarea.note-text,
.paper textarea {
    field-sizing: content;
}

textarea.note-text {
    display: block;
    width: 100%;
    min-height: 1.5em;
    margin: 0;
    padding: 0;
    border: 0;
    outline: none;
    resize: none;
    overflow: hidden;
    background: transparent;
}

textarea.note-text::placeholder {
    font-style: italic;
    color: var(--text-3);
    opacity: 1;
}

.note-paper {
    margin: 24px 4px 8px;
    padding: 16px 0 0;
    border-top: 1px dashed var(--surface-3);
}

.note-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.note-head h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
}

.np-notes-card {
    margin-top: 16px;
}

/* ---------- settings ---------- */

.settings-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-top: 8px;
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

.settings-main .card > p {
    margin: 0;
    line-height: 1.5;
}

.segmented {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 4px;
    border-radius: 18px;
    background: var(--surface-2);
}

.segmented button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--text-2);
    font: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.segmented [aria-checked="true"] {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-1);
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
}

.setting-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-text > span {
    color: var(--text-2);
    font-size: 0.88rem;
    line-height: 1.45;
}

.switch {
    flex: none;
}

.data-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 16px 0;
}

.data-stats > div {
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--surface-2);
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 800;
}

.stat-label {
    color: var(--text-2);
    font-size: 0.78rem;
    font-weight: 600;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.settings-actions .btn {
    flex: 1 1 190px;
}

.settings-main .card > .fine-print,
.fine-print {
    margin: 14px 0 0;
    color: var(--text-3);
    font-size: 0.8rem;
}

.about {
    text-align: center;
}

.about h2 {
    margin: 8px 0 0;
    font-size: 1.4rem;
}

.about > p {
    margin: 4px 0;
}

.about-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 18px 0;
    padding: 0;
    list-style: none;
    text-align: left;
}

.about-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 0.9rem;
}

.about-list .icon {
    margin-top: 1px;
    color: var(--primary);
}

.about-list b {
    color: var(--text);
}

.credits {
    color: var(--text-2);
    font-size: 0.8rem;
}

/* ---------- animations ---------- */

@keyframes page-in {
    from {
        transform: translateX(28%);
        opacity: 0;
    }
}

@keyframes page-out {
    to {
        transform: translateX(28%);
        opacity: 0;
    }
}

@keyframes rise {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

@keyframes fade-out {
    to {
        opacity: 0;
    }
}

@keyframes sheet-up {
    from {
        transform: translate3d(0, 100%, 0);
    }
}

@keyframes sheet-down {
    to {
        transform: translate3d(0, 100%, 0);
    }
}

@keyframes pop-in {
    from {
        transform: translate3d(0, 24px, 0) scale(0.96);
        opacity: 0;
    }
}

@keyframes pop-out {
    to {
        transform: translate3d(0, 16px, 0) scale(0.97);
        opacity: 0;
    }
}

@keyframes toast-in {
    from {
        transform: translateY(16px) scale(0.96);
        opacity: 0;
    }
}

@keyframes toast-out {
    to {
        transform: translateY(8px);
        opacity: 0;
    }
}

@keyframes slide-from-right {
    from {
        transform: translateX(40px);
        opacity: 0;
    }
}

@keyframes slide-from-left {
    from {
        transform: translateX(-40px);
        opacity: 0;
    }
}

@keyframes shake {
    20%,
    60% {
        transform: translateX(-6px);
    }
    40%,
    80% {
        transform: translateX(6px);
    }
}

@keyframes bump {
    40% {
        transform: scale(1.08);
    }
}

@keyframes grow {
    from {
        transform: scaleX(0);
    }
}

@keyframes float {
    50% {
        transform: translateY(-8px) rotate(-2deg);
    }
}

@keyframes pulse {
    50% {
        transform: scale(0.92);
        opacity: 0.7;
    }
}

/* without animations the highlight stays still until the home is drawn again */
@media (prefers-reduced-motion: reduce) {
    .dough-card.just-saved {
        animation: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-soft);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after,
    ::backdrop {
        animation-duration: 0.01ms !important;
        animation-delay: 0s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
