/* ==========================================================================
   POCKETFUL — pocket notebook aesthetic
   ========================================================================== */

@import url('/static/fonts/fonts.css');

:root {
    --ink: #0e1424;
    --ink-cover: #1a2236;            /* notebook navy bookcloth */
    --ink-cover-2: #0c121f;
    --brass: #c2a268;                 /* tarnished foil */
    --brass-bright: #e6c98c;
    --elastic: #2a1414;               /* deep oxblood band */
    --paper: #f6efde;                  /* warm cream */
    --paper-2: #f0e7d0;
    --paper-edge: #d8c8a0;
    --rule: #c8b88c;                   /* light ruled line */
    --rule-faint: rgba(200, 184, 140, 0.5);
    --margin-line: #c4574b;           /* red margin line */
    --pen: #1d2a45;                    /* navy pen */
    --pen-soft: #4a5a78;
    --green: #2f6b3d;
    --danger: #a83232;
    --table: #c9b690;                 /* desk surface */
    --table-shadow: rgba(40, 24, 8, 0.35);

    --f-display: "Fraunces", Georgia, serif;
    --f-hand: "Caveat", "Comic Sans MS", cursive;
    --f-mono: "IBM Plex Mono", ui-monospace, monospace;
    --f-body: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { background: var(--table); }
body {
    background:
        radial-gradient(1200px 700px at 30% 20%, rgba(255, 235, 200, 0.45), transparent 55%),
        radial-gradient(1000px 500px at 80% 80%, rgba(80, 50, 20, 0.18), transparent 60%),
        var(--table);
    color: var(--ink);
    font-family: var(--f-body);
    font-size: 17px;
    line-height: 1.55;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    position: relative;
}
/* faint paper-grain on the desk */
body::before {
    content: "";
    position: fixed; inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.4  0 0 0 0 0.28  0 0 0 0 0.12  0 0 0 0.18 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    opacity: 0.5;
    z-index: 1;
}

main, .lobby-link, .toast { position: relative; z-index: 2; }

/* --- Lobby link ---- */
.lobby-link {
    position: fixed;
    top: 18px; left: 22px;
    z-index: 50;
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink);
    background: rgba(246, 239, 222, 0.7);
    padding: 8px 14px;
    border-radius: 999px;
    text-decoration: none;
    border: 1px solid rgba(30, 20, 10, 0.18);
    backdrop-filter: blur(4px);
    transition: background 0.2s;
}
.lobby-link:hover { background: var(--paper); }

/* --- Stage ---- */
.stage {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}
.view {
    width: 100%;
    max-width: 1100px;
    animation: enter 0.5s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes enter {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   LANDING
   ============================================================ */
.view-landing {
    display: grid;
    grid-template-columns: minmax(280px, 420px) 1fr;
    gap: 70px;
    align-items: center;
}
.desk {
    position: relative;
    width: 100%;
    perspective: 1400px;
}
.desk-shadow {
    position: absolute;
    bottom: -28px; left: 8%; right: 8%;
    height: 30px;
    background: radial-gradient(ellipse at center, var(--table-shadow), transparent 70%);
    filter: blur(8px);
    z-index: -1;
}

/* The notebook itself */
.notebook {
    position: relative;
    width: 100%;
    aspect-ratio: 5 / 7;
    transform-style: preserve-3d;
    transform: rotateX(8deg) rotateZ(-2deg);
    transition: transform 0.4s ease;
}
.notebook:hover { transform: rotateX(6deg) rotateZ(-1deg) translateY(-4px); }

.cover {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, var(--ink-cover) 0%, var(--ink-cover-2) 100%);
    border-radius: 4px 10px 10px 4px;
    box-shadow:
        inset 0 0 0 1px rgba(255, 230, 180, 0.06),
        inset -3px 0 0 rgba(0,0,0,0.3),                 /* spine shadow */
        inset 6px 0 12px rgba(0,0,0,0.35),                /* spine inner */
        0 24px 50px rgba(0,0,0,0.4),
        0 4px 8px rgba(0,0,0,0.3);
    overflow: hidden;
}
/* bookcloth weave texture */
.cover::before {
    content: "";
    position: absolute; inset: 0;
    background-image:
        repeating-linear-gradient(45deg, rgba(255,230,180,0.025) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(-45deg, rgba(0,0,0,0.08) 0 1px, transparent 1px 3px);
    pointer-events: none;
}
/* spine seam */
.cover::after {
    content: "";
    position: absolute;
    left: 14px; top: 14px; bottom: 14px;
    width: 2px;
    background: linear-gradient(180deg, transparent, rgba(255,230,180,0.18), transparent);
    border-radius: 2px;
}

.cover-inner {
    position: absolute; inset: 28px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
    border: 1px solid rgba(226, 201, 140, 0.18);
    border-radius: 2px;
    padding: 30px 20px;
}
.cover-corners {
    position: absolute;
    inset: -1px;
    border: 1px solid rgba(226, 201, 140, 0.12);
    border-radius: 2px;
    pointer-events: none;
}
.cover-corners::before,
.cover-corners::after {
    content: "";
    position: absolute;
    width: 18px; height: 18px;
    border: 1px solid rgba(226, 201, 140, 0.4);
}
.cover-corners::before { top: -2px; left: -2px; border-right: none; border-bottom: none; }
.cover-corners::after { bottom: -2px; right: -2px; border-left: none; border-top: none; }

.wordmark { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: 10%; }
.wordmark .amp {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 300;
    font-size: 1.2rem;
    color: var(--brass);
    opacity: 0.7;
    letter-spacing: 0.04em;
}
.wordmark .title {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.8rem, 4.2vw, 2.8rem);
    color: var(--brass-bright);
    letter-spacing: -0.01em;
    line-height: 1;
    text-shadow:
        0 1px 0 rgba(255, 240, 200, 0.35),
        0 -1px 0 rgba(0, 0, 0, 0.4);
    /* foil shimmer */
    background: linear-gradient(160deg, var(--brass) 20%, var(--brass-bright) 50%, var(--brass) 80%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.wordmark .sub {
    font-family: var(--f-mono);
    font-size: 9px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--brass);
    opacity: 0.65;
    margin-top: 12px;
}
.cover-foot {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 300;
    font-size: 0.78rem;
    color: var(--brass);
    opacity: 0.55;
    letter-spacing: 0.02em;
}

/* The elastic band */
.band {
    position: absolute;
    top: -8px; bottom: -8px;
    right: 14%;
    width: 12px;
    background:
        linear-gradient(90deg, rgba(0,0,0,0.4), transparent 30%, transparent 70%, rgba(0,0,0,0.4)),
        var(--elastic);
    border-radius: 1px;
    box-shadow: 0 0 6px rgba(0,0,0,0.4);
    z-index: 3;
}
.band::before, .band::after {
    content: "";
    position: absolute;
    left: 0; right: 0;
    height: 8px;
    background: inherit;
    border-radius: 1px;
}
.band::before { top: 0; }
.band::after { bottom: 0; }

/* --- Hero copy ---- */
.copy { padding-right: 20px; }
.hero-title {
    font-family: var(--f-display);
    font-weight: 300;
    font-size: clamp(2.2rem, 4.8vw, 3.5rem);
    line-height: 1.05;
    letter-spacing: -0.025em;
    color: var(--ink);
    margin-bottom: 24px;
    font-variation-settings: "opsz" 144;
}
.hero-title em {
    font-style: italic;
    font-weight: 400;
    color: var(--margin-line);
}
.hero-sub {
    font-family: var(--f-display);
    font-weight: 300;
    font-size: 1.1rem;
    line-height: 1.55;
    color: var(--pen);
    max-width: 50ch;
    margin-bottom: 32px;
}
.cta-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 32px; }

.btn {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: 1rem;
    letter-spacing: 0.005em;
    padding: 14px 22px;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: var(--ink);
}
.btn-primary {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}
.btn-primary:hover:not(:disabled) {
    background: var(--ink-cover);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(14, 20, 36, 0.25);
}
.btn-primary:disabled {
    background: rgba(14, 20, 36, 0.25);
    border-color: transparent;
    cursor: not-allowed;
}
.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: rgba(14, 20, 36, 0.25);
}
.btn-ghost:hover { background: rgba(14, 20, 36, 0.06); }
.btn-secondary {
    background: var(--paper);
    color: var(--ink);
    border-color: rgba(14, 20, 36, 0.25);
}
.btn-secondary:hover { background: #fff; transform: translateY(-1px); }
.btn-danger {
    background: var(--danger);
    color: var(--paper);
    border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #c44141; }
.btn-danger:disabled {
    background: rgba(168, 50, 50, 0.25);
    border-color: transparent;
    cursor: not-allowed;
}

.footnote {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 300;
    font-size: 0.92rem;
    color: var(--pen-soft);
    max-width: 45ch;
}

/* ============================================================
   PAPER (generate / unlock / settings views)
   ============================================================ */
.paper {
    background: var(--paper);
    border-radius: 4px;
    padding: 50px 60px 40px;
    max-width: 720px;
    margin: 0 auto;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.5),
        0 30px 50px rgba(40, 24, 8, 0.25),
        0 4px 12px rgba(40, 24, 8, 0.15);
    position: relative;
    background-image:
        linear-gradient(180deg, rgba(216, 200, 160, 0.15) 0, transparent 60px),
        repeating-linear-gradient(180deg, transparent 0 31px, var(--rule-faint) 31px 32px);
    background-position: 0 56px;
}
.paper::before {
    /* margin line */
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 38px;
    width: 1px;
    background: var(--margin-line);
    opacity: 0.6;
}
.paper-tall { padding-top: 56px; }
.paper-head { margin-bottom: 28px; }
.paper-step {
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--margin-line);
    margin-bottom: 8px;
}
.paper-title {
    font-family: var(--f-display);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
    line-height: 1.1;
    color: var(--ink);
    margin-bottom: 12px;
    letter-spacing: -0.015em;
}
.paper-lede {
    font-family: var(--f-display);
    font-weight: 300;
    font-size: 1rem;
    color: var(--pen);
    max-width: 56ch;
}
.paper-foot {
    margin-top: 36px;
    padding-top: 24px;
    border-top: 1px dashed rgba(196, 87, 75, 0.35);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* --- Passphrase generator --- */
.passphrase-display {
    margin: 32px 0 14px;
    padding: 24px 18px;
    background: #fffdf3;
    border: 1px dashed rgba(14, 20, 36, 0.2);
    border-radius: 3px;
    display: flex;
    flex-wrap: wrap;
    gap: 22px 32px;
    justify-content: center;
    font-family: var(--f-hand);
    font-size: clamp(1.6rem, 3.6vw, 2.4rem);
    color: var(--pen);
    line-height: 1.1;
    text-align: center;
    word-break: break-all;
}
.passphrase-display .word {
    display: inline-block;
    animation: wordin 0.4s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes wordin {
    from { opacity: 0; transform: translateY(6px) rotate(-1deg); }
    to   { opacity: 1; transform: translateY(0) rotate(0); }
}
.word-skeleton {
    color: rgba(14, 20, 36, 0.18);
    letter-spacing: 0.12em;
}
.entropy-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.entropy-meter {
    flex: 1;
    height: 6px;
    background: rgba(14, 20, 36, 0.08);
    border-radius: 999px;
    overflow: hidden;
}
.entropy-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--margin-line), var(--brass), var(--green));
    transition: width 0.4s ease;
    border-radius: 999px;
}
.entropy-label {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--pen-soft);
    min-width: 90px;
    text-align: right;
}
.entropy-detail {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 300;
    font-size: 0.85rem;
    color: var(--pen-soft);
    margin-top: 6px;
    margin-bottom: 18px;
    line-height: 1.4;
}

.passphrase-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}
.word-count {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--f-display);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--pen);
}
.word-count select {
    font-family: var(--f-mono);
    font-size: 12px;
    padding: 8px 10px;
    border: 1px solid rgba(14, 20, 36, 0.2);
    border-radius: 3px;
    background: #fffdf3;
    color: var(--ink);
    cursor: pointer;
}

.confirmations {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 0;
    border-top: 1px dashed rgba(196, 87, 75, 0.35);
    border-bottom: 1px dashed rgba(196, 87, 75, 0.35);
}
.confirm {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-family: var(--f-display);
    font-size: 0.97rem;
    color: var(--ink);
    line-height: 1.45;
}
.confirm input { margin-top: 5px; cursor: pointer; accent-color: var(--margin-line); }

/* --- Unlock --- */
.unlock-form {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 28px 0 12px;
}
.passphrase-input {
    flex: 1;
    font-family: var(--f-hand);
    font-size: 1.8rem;
    background: transparent;
    border: none;
    border-bottom: 1.5px solid var(--pen);
    padding: 12px 6px 8px;
    color: var(--pen);
    outline: none;
    letter-spacing: 0.01em;
}
.passphrase-input.small {
    font-family: var(--f-mono);
    font-size: 0.95rem;
    border-bottom-width: 1px;
}
.passphrase-input::placeholder { color: rgba(14, 20, 36, 0.3); font-style: italic; }
.passphrase-input:focus { border-bottom-color: var(--margin-line); }
.show-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--pen-soft);
    cursor: pointer;
}
.show-toggle input { accent-color: var(--margin-line); }

.unlock-status {
    min-height: 24px;
    font-family: var(--f-display);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--margin-line);
    margin-bottom: 10px;
}
.unlock-status.success { color: var(--green); }
.unlock-status.working { color: var(--pen-soft); }

/* ============================================================
   INSIDE (the open notebook page)
   ============================================================ */
.view-inside { max-width: 760px; }
.page {
    background: var(--paper);
    border-radius: 2px;
    min-height: 70vh;
    padding: 50px 50px 30px 80px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.5),
        0 30px 50px rgba(40, 24, 8, 0.25),
        0 4px 12px rgba(40, 24, 8, 0.15),
        inset 18px 0 30px rgba(0,0,0,0.04);
    position: relative;
    background-image:
        repeating-linear-gradient(180deg, transparent 0 31px, var(--rule-faint) 31px 32px);
    background-position: 0 60px;
}
.page::before {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 56px;
    width: 1px;
    background: var(--margin-line);
    opacity: 0.55;
}
/* spine fold suggestion on the left */
.page::after {
    content: "";
    position: absolute;
    top: 8px; bottom: 8px; left: 0;
    width: 2px;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.18), transparent);
}

.page-margin {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 18px;
    margin-bottom: 12px;
}

.page-header {
    display: flex;
    align-items: baseline;
    gap: 22px;
    padding-bottom: 16px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    position: relative;
}
.list-pick {
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 500;
    font-size: 1.5rem;
    color: var(--ink);
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 0;
    letter-spacing: -0.01em;
    transition: color 0.2s;
}
.list-pick:hover { color: var(--margin-line); }
.list-pick-chev {
    font-size: 0.9rem;
    color: var(--pen-soft);
    transition: transform 0.2s;
}
.list-pick[aria-expanded="true"] .list-pick-chev {
    transform: rotate(180deg);
}
.list-menu {
    position: absolute;
    top: 40px;
    left: 0;
    z-index: 10;
    background: var(--paper);
    border: 1px solid rgba(14, 20, 36, 0.15);
    border-radius: 4px;
    box-shadow: 0 12px 30px rgba(40, 24, 8, 0.25);
    padding: 14px 16px 12px;
    min-width: 260px;
    animation: menuIn 0.18s cubic-bezier(.2,.8,.2,1);
}
@keyframes menuIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}
.list-menu-title {
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--pen-soft);
    margin-bottom: 8px;
}
.list-menu-list {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
    max-height: 240px;
    overflow-y: auto;
}
.list-menu-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 4px;
    cursor: pointer;
    border-radius: 3px;
    font-family: var(--f-display);
    font-size: 0.98rem;
    color: var(--ink);
}
.list-menu-list li:hover { background: rgba(14, 20, 36, 0.05); }
.list-menu-list li.active { color: var(--margin-line); font-style: italic; }
.list-menu-list li .count {
    margin-left: auto;
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.18em;
    color: var(--pen-soft);
}
.list-menu-foot {
    border-top: 1px dashed rgba(196, 87, 75, 0.3);
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}
.list-menu-foot .btn-link.danger:hover { color: var(--danger); }

.page-mark {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 400;
    font-size: 1.1rem;
    color: var(--margin-line);
}
.page-mark span { font-feature-settings: "lnum" 1; }
.page-status {
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--pen-soft);
    transition: color 0.2s;
}
.page-status.saving { color: var(--margin-line); }
.page-status.saved { color: var(--green); }
.page-status.error { color: var(--danger); }

.empty-state {
    padding: 18px 0 24px;
    margin-bottom: 4px;
    text-align: center;
    opacity: 0;
    animation: emptyFade 0.7s 0.2s cubic-bezier(.2,.8,.2,1) forwards;
}
.empty-mark {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 300;
    font-size: 2rem;
    color: var(--margin-line);
    opacity: 0.5;
    line-height: 1;
    margin-bottom: 10px;
}
.empty-state p {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.55;
    color: var(--pen-soft);
    max-width: 42ch;
    margin: 0 auto;
}
@keyframes emptyFade {
    to { opacity: 1; }
}

.todo-list { list-style: none; }
.todo-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 0;
    height: 32px;
    position: relative;
    animation: itemin 0.35s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes itemin {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}
.todo-item.removing {
    animation: itemout 0.3s ease forwards;
}
.todo-item.dragging {
    opacity: 0.4;
    cursor: grabbing;
}
.todo-item:hover { cursor: grab; }
.todo-item:hover .todo-text,
.todo-item .todo-text:focus { cursor: text; }
@keyframes itemout {
    to { opacity: 0; transform: translateX(8px); height: 0; padding: 0; }
}

.todo-check {
    width: 22px; height: 22px;
    border: 1.5px solid var(--pen);
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.2s, background 0.2s;
}
.todo-check:hover { background: rgba(45, 90, 60, 0.05); }
.todo-check svg {
    position: absolute;
    inset: 1px;
    width: 18px; height: 18px;
    stroke: var(--green);
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 30;
    stroke-dashoffset: 30;
    transition: stroke-dashoffset 0.4s cubic-bezier(.5,1.6,.4,1);
    pointer-events: none;
}
.todo-item.done .todo-check svg { stroke-dashoffset: 0; }
.todo-item.done .todo-check { border-color: var(--green); }

.todo-text {
    flex: 1;
    font-family: var(--f-hand);
    font-size: 1.6rem;
    line-height: 1;
    color: var(--pen);
    background: transparent;
    border: none;
    outline: none;
    padding: 4px 0;
    transition: color 0.3s;
}
.todo-item.done .todo-text {
    color: var(--pen-soft);
    text-decoration: line-through;
    text-decoration-color: var(--green);
    text-decoration-thickness: 2px;
}
.todo-delete {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--pen-soft);
    cursor: pointer;
    font-family: var(--f-mono);
    font-size: 14px;
    padding: 4px 8px;
    transition: opacity 0.2s, color 0.2s;
}
.todo-item:hover .todo-delete,
.todo-item:focus-within .todo-delete { opacity: 0.7; }
.todo-delete:hover { color: var(--danger); opacity: 1; }

.add-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 6px 0;
    height: 32px;
    margin-top: 4px;
}
.add-bullet {
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    color: var(--pen-soft);
    font-family: var(--f-display);
    font-size: 1.5rem;
    line-height: 1;
}
.add-input {
    flex: 1;
    font-family: var(--f-hand);
    font-size: 1.6rem;
    line-height: 1;
    color: var(--pen);
    background: transparent;
    border: none;
    outline: none;
    padding: 4px 0;
}
.add-input::placeholder {
    color: rgba(14, 20, 36, 0.3);
    font-style: italic;
    font-family: var(--f-display);
    font-size: 1.05rem;
}

.page-footer {
    margin-top: 40px;
    padding-top: 18px;
    border-top: 1px dashed rgba(196, 87, 75, 0.3);
    display: flex;
    justify-content: space-between;
    gap: 16px;
}
.btn-link {
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: var(--f-display);
    font-style: italic;
    font-size: 0.9rem;
    color: var(--pen-soft);
    padding: 4px 0;
    transition: color 0.2s;
}
.btn-link:hover { color: var(--margin-line); }

/* ============================================================
   SETTINGS
   ============================================================ */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 22px 0;
    border-bottom: 1px dashed rgba(14, 20, 36, 0.15);
    flex-wrap: wrap;
}
.setting-row:last-of-type { border-bottom: none; }
.setting-name {
    font-family: var(--f-display);
    font-weight: 500;
    font-size: 1.05rem;
    color: var(--ink);
    margin-bottom: 4px;
}
.setting-desc {
    font-family: var(--f-display);
    font-weight: 300;
    font-size: 0.9rem;
    color: var(--pen);
    max-width: 50ch;
}
.setting-desc code {
    font-family: var(--f-mono);
    font-size: 0.82rem;
    background: rgba(14, 20, 36, 0.08);
    padding: 2px 6px;
    border-radius: 3px;
}
.setting-danger-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 240px;
    justify-content: flex-end;
}
.setting-danger-row .passphrase-input { flex: 1; max-width: 220px; }

.change-panel { display: block; padding: 22px 0; }
.change-inner { width: 100%; }
.change-panel .passphrase-display { margin: 8px 0 12px; }
.change-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }

/* ============================================================
   OPENING OVERLAY (cover-flip animation)
   ============================================================ */
.opening-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: radial-gradient(ellipse at center, rgba(30, 20, 10, 0.7), rgba(0, 0, 0, 0.88));
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayIn 0.25s ease forwards;
}
.opening-overlay.closing { animation: overlayOut 0.3s ease forwards; }
@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes overlayOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

.opening-scene {
    position: relative;
    width: min(320px, 70vw);
    aspect-ratio: 5 / 7;
    perspective: 1600px;
    transform-style: preserve-3d;
}

.opening-pages {
    position: absolute;
    inset: 0;
    background: var(--paper);
    border-radius: 4px;
    padding: 18% 14% 10% 22%;
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.55),
        inset 12px 0 20px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 10%;
    background-image: repeating-linear-gradient(180deg, transparent 0 13%, var(--rule-faint) 13% calc(13% + 1px));
    opacity: 0;
    animation: pagesIn 0.5s 0.5s cubic-bezier(.2,.8,.2,1) forwards;
}
.opening-pages::before {
    content: "";
    position: absolute;
    top: 12%; bottom: 8%; left: 16%;
    width: 1px;
    background: var(--margin-line);
    opacity: 0.55;
}
.opening-rule {
    height: 1px;
    background: transparent;
}
@keyframes pagesIn {
    to { opacity: 1; }
}

.opening-cover {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--ink-cover) 0%, var(--ink-cover-2) 100%);
    border-radius: 4px 10px 10px 4px;
    box-shadow:
        inset 0 0 0 1px rgba(255, 230, 180, 0.06),
        inset -3px 0 0 rgba(0,0,0,0.3),
        inset 6px 0 12px rgba(0,0,0,0.35),
        0 24px 50px rgba(0, 0, 0, 0.5);
    transform-origin: left center;
    transform: rotateY(0deg);
    animation: coverFlip 1.1s 0.25s cubic-bezier(.5, 0, .3, 1) forwards;
    backface-visibility: hidden;
}
.opening-cover::before {
    content: "";
    position: absolute; inset: 0;
    background-image:
        repeating-linear-gradient(45deg, rgba(255,230,180,0.025) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(-45deg, rgba(0,0,0,0.08) 0 1px, transparent 1px 3px);
    pointer-events: none;
    border-radius: inherit;
}
.opening-cover-inner {
    position: absolute; inset: 22px 18px;
    border: 1px solid rgba(226, 201, 140, 0.25);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.opening-wordmark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.opening-wordmark .amp {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 300;
    font-size: 0.95rem;
    color: var(--brass);
    opacity: 0.7;
}
.opening-wordmark .title {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 400;
    font-size: 2rem;
    background: linear-gradient(160deg, var(--brass) 20%, var(--brass-bright) 50%, var(--brass) 80%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}
@keyframes coverFlip {
    0%   { transform: rotateY(0deg); }
    100% { transform: rotateY(-168deg); }
}

.opening-band {
    position: absolute;
    top: -4%; bottom: -4%; right: 14%;
    width: 7px;
    background: var(--elastic);
    border-radius: 1px;
    box-shadow: 0 0 6px rgba(0,0,0,0.4);
    transform-origin: 50% 50%;
    animation: bandSnap 0.35s cubic-bezier(.2,1.6,.4,1) forwards;
}
@keyframes bandSnap {
    0%   { transform: translateX(0) rotate(0); opacity: 1; }
    60%  { transform: translateX(40px) rotate(12deg); opacity: 1; }
    100% { transform: translateX(120px) rotate(45deg); opacity: 0; }
}

.opening-caption {
    position: absolute;
    left: 50%;
    bottom: -52px;
    transform: translateX(-50%);
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--cream-muted);
    opacity: 0;
    animation: captionIn 0.4s 0.6s ease forwards;
}
@keyframes captionIn {
    to { opacity: 0.7; }
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
    position: fixed;
    bottom: 30px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--ink);
    color: var(--paper);
    font-family: var(--f-display);
    font-style: italic;
    font-size: 0.95rem;
    padding: 12px 22px;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 100;
}
.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 820px) {
    .stage { padding: 70px 16px 40px; }
    .view-landing { grid-template-columns: 1fr; gap: 40px; }
    .desk { max-width: 280px; margin: 0 auto; }
    .copy { padding: 0; text-align: left; }
    .paper { padding: 38px 28px 30px; }
    .paper::before { left: 22px; }
    .page { padding: 36px 26px 24px 56px; }
    .page::before { left: 38px; }
    .passphrase-display { font-size: 1.6rem; gap: 14px 22px; padding: 20px 14px; }
    .passphrase-input { font-size: 1.5rem; }
    .todo-text, .add-input { font-size: 1.4rem; }
    .word-count { margin-left: 0; width: 100%; justify-content: space-between; }
    .lobby-link { top: 12px; left: 12px; padding: 6px 10px; font-size: 10px; }
}
