      /* ---------- MODAL ---------- */
      .modal[hidden] {
        display: none;
      }
      .modal {
        position: fixed;
        inset: 0;
        z-index: 50;
        display: flex;
        align-items: flex-start;
        justify-content: center;
        padding: clamp(14px, 5vh, 60px) 16px;
        overflow-y: auto;
      }
      .scrim {
        position: fixed;
        inset: 0;
        background: rgba(6, 4, 2, 0.82);
        backdrop-filter: blur(3px);
      }
      #confirmModal {
        z-index: 60;
        align-items: center;
      }
      .confirm-panel {
        max-width: 380px;
        border-left: 6px solid var(--red);
      }
      .confirm-body {
        padding: 28px 26px 24px;
      }
      .confirm-title {
        font-family: var(--font-display);
        font-size: clamp(22px, 5vw, 30px);
        text-transform: uppercase;
        color: var(--paper-ink);
        line-height: 1.04;
        letter-spacing: 0.01em;
        margin-bottom: 11px;
      }
      .confirm-msg {
        font-family: var(--font-body);
        font-size: 14px;
        color: var(--paper-soft);
        line-height: 1.55;
        margin-bottom: 22px;
      }
      .confirm-msg b {
        color: var(--paper-ink);
        font-weight: 700;
      }
      .confirm-actions {
        display: flex;
        gap: 10px;
        justify-content: flex-end;
      }
      .panel {
        position: relative;
        width: 100%;
        max-width: 440px;
        background: var(--paper);
        color: var(--paper-ink);
        border-radius: 12px;
        border-left: 6px solid var(--accent, var(--gold));
        box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 1);
        animation: rise 0.26s cubic-bezier(0.2, 0.8, 0.25, 1);
      }
      .panel.wide {
        max-width: 960px;
      }
      @keyframes rise {
        from {
          opacity: 0;
          transform: translateY(18px) scale(0.985);
        }
        to {
          opacity: 1;
          transform: none;
        }
      }
      .sheet {
        padding: 30px clamp(22px, 4vw, 38px) 28px;
      }
      .x {
        position: absolute;
        top: 14px;
        right: 14px;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        border: 1px solid rgba(28, 22, 16, 0.2);
        background: var(--paper-2);
        color: var(--paper-ink);
        cursor: pointer;
        font-size: 18px;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 3;
      }
      .x:hover {
        background: var(--paper-ink);
        color: var(--paper);
      }
      .kicker {
        font-family: var(--font-mono);
        font-size: 11px;
        letter-spacing: 0.2em;
        text-transform: uppercase;
        color: var(--paper-soft);
        display: flex;
        align-items: center;
        gap: 8px;
      }
      .kicker .k-type {
        font-weight: 700;
      }
      .sheet-title {
        font-family: var(--font-display);
        font-size: clamp(34px, 6vw, 52px);
        line-height: 0.9;
        text-transform: uppercase;
        letter-spacing: 0.01em;
        color: var(--paper-ink);
        margin: 10px 0 12px;
        overflow-wrap: anywhere;
      }
      .sheet-sub {
        font-family: var(--font-mono);
        font-size: 11.5px;
        letter-spacing: 0.04em;
        color: var(--paper-soft);
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        align-items: center;
      }
      .sheet-sub .pill {
        background: var(--paper);
        border: 1px solid rgba(28, 22, 16, 0.14);
        border-radius: 4px;
        padding: 3px 8px;
        text-transform: uppercase;
        letter-spacing: 0.08em;
      }
      /* cover art header */
      .sheet-head {
        display: flex;
        gap: 20px;
        align-items: flex-start;
        margin-bottom: 4px;
      }
      .sheet-headtext {
        flex: 1;
        min-width: 0;
      }
      .cover-wrap {
        position: relative;
        flex: 0 0 auto;
        width: 122px;
        aspect-ratio: 2/3;
        border-radius: 6px;
        overflow: hidden;
        box-shadow: 0 12px 26px -14px rgba(0, 0, 0, 0.85);
        background: var(--ink-2);
      }
      .cover-ph {
        position: absolute;
        inset: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 12px;
        text-align: center;
        background:
          radial-gradient(
            120% 80% at 50% 0%,
            rgba(231, 163, 56, 0.28),
            transparent 62%
          ),
          linear-gradient(165deg, #26200f, #13100b);
      }
      .cover-wrap.tv .cover-ph {
        background:
          radial-gradient(
            120% 80% at 50% 0%,
            rgba(178, 58, 43, 0.32),
            transparent 62%
          ),
          linear-gradient(165deg, #261313, #13100b);
      }
      .cover-ph svg {
        width: 30px;
        height: 30px;
        color: var(--gold);
        opacity: 0.9;
        flex: 0 0 auto;
      }
      .cover-wrap.tv .cover-ph svg {
        color: var(--red);
      }
      .cover-ph-t {
        font-family: var(--font-display);
        text-transform: uppercase;
        font-size: 13px;
        line-height: 1.06;
        color: var(--cream);
        letter-spacing: 0.02em;
        display: -webkit-box;
        -webkit-line-clamp: 4;
        -webkit-box-orient: vertical;
        overflow: hidden;
      }
      .cover-img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        z-index: 1;
      }
      .detail-grid {
        display: grid;
        position: relative;
        gap: 16px 18px;
        padding: 18px;
        grid-template-columns: 1.4fr 1fr;
        grid-template-areas: "cover meta" "title title" "watch watch" "desc desc" "cast cast";
      }
      .edit-icon-btn {
        position: absolute;
        top: 18px;
        right: 18px;
        width: 32px;
        height: 32px;
        border: none;
        background: transparent;
        color: var(--paper-soft);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: background 0.15s, color 0.15s;
        z-index: 10;
      }
      .edit-icon-btn:hover {
        background: rgba(0,0,0,0.05);
        color: var(--paper-ink);
      }
      .dg-watch {
        grid-area: watch;
      }
      .dg-cover {
        grid-area: cover;
        position: relative;
        aspect-ratio: 2 / 3;
        align-self: start;
        border-radius: 10px;
        overflow: hidden;
        background:
          radial-gradient(
            120% 90% at 50% 0%,
            rgba(231, 163, 56, 0.28),
            transparent 62%
          ),
          linear-gradient(165deg, #26200f, #13100b);
      }
      .dg-cover.tv {
        background:
          radial-gradient(
            120% 90% at 50% 0%,
            rgba(178, 58, 43, 0.32),
            transparent 62%
          ),
          linear-gradient(165deg, #261313, #13100b);
      }
      .dg-cover .dc-img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
      }
      .dg-cover .dc-ph {
        position: absolute;
        inset: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--gold);
        opacity: 0.85;
      }
      .dg-cover.tv .dc-ph {
        color: var(--red);
      }
      .dg-cover .dc-ph svg {
        width: 48px;
        height: 48px;
      }
      .dg-meta {
        grid-area: meta;
        align-self: start;
        display: flex;
        flex-direction: column;
        gap: 15px;
        min-width: 0;
      }
      .dg-block {
        display: flex;
        flex-direction: column;
        gap: 6px;
        min-width: 0;
      }
      .dg-block .sec-label {
        margin-bottom: 0;
      }
      .dg-cell {
        display: flex;
        flex-direction: column;
        gap: 6px;
        justify-content: center;
        min-width: 0;
      }
      .dg-title {
        grid-area: title;
        padding-top: 2px;
      }
      .dg-desc {
        grid-area: desc;
      }
      .desc-expandable.expanded .desc-short { display: none; }
      .desc-expandable.expanded .desc-full { display: inline !important; }
      .dg-cast {
        grid-area: cast;
        justify-content: flex-start;
      }
      .dg-v {
        font-family: var(--font-body);
        font-size: 15px;
        font-weight: 600;
        color: var(--paper-ink);
        line-height: 1.2;
      }
      .dg-sub {
        font-family: var(--font-mono);
        font-size: 11px;
        letter-spacing: 0.04em;
        color: var(--paper-soft);
      }
      .dg-title .sheet-title {
        font-size: clamp(22px, 5vw, 32px);
        margin: 0;
        line-height: 1;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
      }
      .d-tags {
        display: flex;
        gap: 7px;
        flex-wrap: wrap;
      }
      .d-tags .pill {
        font-family: var(--font-mono);
        font-size: 11px;
        letter-spacing: 0.03em;
        text-transform: capitalize;
        color: var(--paper-ink);
        background: rgba(28, 22, 16, 0.05);
        border: 1px solid rgba(28, 22, 16, 0.18);
        border-radius: 6px;
        padding: 4px 10px;
        line-height: 1.3;
      }
      .cast-list {
        list-style: none;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px 16px;
        margin: 2px 0 0;
        padding: 0;
      }
      .cast-list li {
        display: flex;
        flex-direction: column;
        gap: 1px;
        min-width: 0;
      }
      .cast-name {
        font-family: var(--font-body);
        font-weight: 600;
        font-size: 13.5px;
        color: var(--paper-ink);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .cast-char {
        font-family: var(--font-mono);
        font-size: 10.5px;
        letter-spacing: 0.02em;
        color: var(--paper-soft);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      /* franchise (stack) view */
      .stackview {
        padding: 28px clamp(20px, 4vw, 30px) 26px;
      }
      .sv-title {
        font-family: var(--font-display);
        font-size: clamp(26px, 5vw, 38px);
        text-transform: uppercase;
        color: var(--paper-ink);
        line-height: 0.96;
        margin: 6px 0 4px;
      }
      .sv-sub {
        font-family: var(--font-mono);
        font-size: 11px;
        letter-spacing: 0.04em;
        color: var(--paper-soft);
        margin-bottom: 18px;
      }
      .sv-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
        align-items: start;
      }
      @media (max-width: 780px) {
        .sv-list {
          grid-template-columns: repeat(2, 1fr);
        }
      }
      @media (max-width: 520px) {
        .sv-list {
          grid-template-columns: 1fr;
        }
      }
      .d-rating .stars svg {
        width: 19px;
        height: 19px;
      }
      @media (max-width: 560px) {
        .detail-grid {
          grid-template-columns: 1fr;
          grid-template-areas: "cover" "meta" "title" "watch" "desc" "cast";
        }
        .dg-cover {
          aspect-ratio: 2 / 3;
          align-self: start;
        }
      }
      /* card hover tools (edit / delete) */
      .ticket-wrap {
        position: relative;
        filter: drop-shadow(0 9px 14px rgba(0, 0, 0, 0.5));
        transition: filter 0.18s ease;
      }
      .ticket-wrap:hover {
        filter: drop-shadow(0 16px 20px rgba(0, 0, 0, 0.62));
      }
      /* franchise stacks: overlapping pile that fans open on hover/focus */
      .stack {
        position: relative;
      }
      .stack.stacked {
        --peek: 30px;
        --ch: 196px;
        --banner: 28px;
        height: calc(var(--banner) + var(--ch) + (var(--n) - 1) * var(--peek));
        cursor: pointer;
      }
      .stack.stacked .ticket-wrap {
        position: absolute;
        left: 0;
        right: 0;
        top: calc(var(--banner) + var(--i) * var(--peek));
        z-index: calc(60 - var(--i));
      }
      /* accordion: hovering the stack pushes every card back & dims it; the one under the cursor lifts
   smoothly to the very front and follows the cursor as you scroll through the pile */
      .stack.stacked:hover .ticket-wrap {
        filter: drop-shadow(0 8px 13px rgba(0, 0, 0, 0.5)) brightness(0.72);
      }
      .stack.stacked .ticket-wrap:hover {
        z-index: 80;
        filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.72)) brightness(1);
      }
      .stack.stacked .ticket-wrap:hover .ticket {
        transform: translateY(-6px) scale(1.02);
      }
      @media (prefers-reduced-motion: reduce) {
        .stack.stacked .ticket-wrap:hover .ticket {
          transform: none;
        }
      }
      /* only the top card keeps the "N-film series" label */
      .stack.stacked .ticket-wrap:not(:first-child) .t-count {
        display: none;
      }
      /* lower cards only show their bottom ~30px peek — drop the stars so they sit centred in that strip */
      /* lower cards only show their bottom peek — nudge ONLY the stars down to centre them in that strip
   (the genre tags stay exactly where they are); on hover the stars glide back to normal */
      .stack.stacked .ticket-wrap:not(:first-child) .t-foot {
        transform: translateY(8px);
        transition: transform 0.25s ease;
      }
      .stack.stacked .ticket-wrap:not(:first-child):hover .t-foot {
        transform: none;
      }
      /* franchise RIBBON banner — a gently CURVED deep-red marquee (SVG) with darker folded swallowtail
   ends. Purely decorative: pointer-events:none so it never intercepts clicks. */
      /* band/folds stretch to fill width; the text rides a textPath in a 2nd (uniform-scaled) svg so it
   curves with the band without getting stretched. top:-5px nudges the whole banner up. */
      .stack-title {
        position: absolute;
        top: -5px;
        left: 0;
        right: 0;
        height: 48px;
        z-index: 85;
        pointer-events: none;
      }
      .stack-title .rib-bg {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        z-index: -1;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
      }
      .stack-title .rib-txt {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
      }
      .rib-band-p {
        fill: var(--accent, var(--red));
      }
      .rib-fold-p {
        fill: var(--accent-deep, var(--red-deep));
      }
      .rib-txt text {
        fill: var(--cream);
        font-family: var(--font-mono);
        font-size: 16px;
        font-weight: 700;
        letter-spacing: 1.3px;
        text-transform: uppercase;
        text-anchor: middle;
      }
      .stack.stacked:has(.ticket.sel) .stack-title {
        opacity: 0;
      }
      .ticket-wrap .ticket {
        width: 100%;
      }
      .rail-actions {
        display: flex;
        gap: 8px;
      }
      .sync-btn {
        padding: 11px 12px;
        display: flex;
        align-items: center;
        justify-content: center;
      }
      .sync-btn svg {
        width: 15px;
        height: 15px;
      }
      body.syncing .sync-btn {
        color: var(--gold);
        border-color: var(--gold-deep);
      }
      body.syncing .sync-btn svg {
        animation: spin 0.8s linear infinite;
      }
      /* shift-click selection / mass delete */
      .btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
      }
      /* floating multi-select action bar — slides up from the bottom instead of pushing the layout down */
      .select-bar {
        position: fixed;
        left: 50%;
        bottom: 24px;
        z-index: 70;
        transform: translate(-50%, 160%);
        display: flex;
        align-items: center;
        gap: 10px;
        max-width: calc(100vw - 24px);
        background: var(--ink-3);
        border: 1px solid var(--line);
        border-radius: 14px;
        padding: 9px 11px 9px 18px;
        box-shadow: 0 26px 54px -20px rgba(0, 0, 0, 1);
        opacity: 0;
        pointer-events: none;
        transition:
          transform 0.34s cubic-bezier(0.2, 0.85, 0.25, 1),
          opacity 0.26s ease;
      }
      .select-bar.show {
        transform: translate(-50%, 0);
        opacity: 1;
        pointer-events: auto;
      }
      .select-bar .btn {
        padding: 9px 14px;
      }
      .sb-div {
        width: 1px;
        height: 20px;
        background: var(--line);
        flex: 0 0 auto;
      }
      .select-count {
        font-family: var(--font-mono);
        font-size: 12px;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--accent);
        white-space: nowrap;
      }
      .card-check {
        display: none;
      }
      .ticket.sel .card-check {
        display: flex;
        position: absolute;
        top: 8px;
        right: 8px;
        z-index: 6;
        width: 26px;
        height: 26px;
        border-radius: 6px;
        align-items: center;
        justify-content: center;
        background: var(--gold);
        border: 1.5px solid var(--gold-deep);
        color: #241a08;
      }
      .card-check svg {
        width: 15px;
        height: 15px;
      }

      .rule {
        height: 1px;
        background: rgba(28, 22, 16, 0.16);
        margin: 22px 0;
      }
      .sec-label {
        font-family: var(--font-mono);
        font-size: 10px;
        letter-spacing: 0.24em;
        text-transform: uppercase;
        color: var(--paper-soft);
        margin-bottom: 10px;
      }
      /* billing block — the signature */
      .billing-block {
        font-family: var(--font-display);
        text-transform: uppercase;
        color: var(--paper-ink);
        font-size: clamp(15px, 2.7vw, 20px);
        line-height: 1.12;
        letter-spacing: 0.02em;
        overflow-wrap: anywhere;
      }
      .billing-block .sep {
        color: var(--gold);
        opacity: 0.55;
        padding: 0 6px;
        font-family: var(--font-body);
      }

      .facts {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 18px 24px;
      }
      .fact .f-l {
        font-family: var(--font-mono);
        font-size: 10px;
        letter-spacing: 0.18em;
        text-transform: uppercase;
        color: var(--paper-soft);
        margin-bottom: 6px;
      }
      .fact .f-v {
        font-family: var(--font-body);
        font-size: 15px;
        font-weight: 600;
        color: var(--paper-ink);
      }
      .meter {
        display: inline-flex;
        gap: 5px;
        align-items: center;
        flex-wrap: wrap;
      }
      .mark {
        width: 9px;
        height: 18px;
        border-radius: 2px;
        background: var(--accent, var(--gold));
        display: inline-block;
      }
      .mark.off {
        background: rgba(28, 22, 16, 0.16);
      }
      .meter .m-txt {
        font-family: var(--font-mono);
        font-size: 12px;
        letter-spacing: 0.04em;
        color: var(--paper-soft);
        margin-left: 4px;
      }
      .notes {
        font-size: 14.5px;
        line-height: 1.55;
        color: #3a3024;
        font-style: italic;
        overflow-wrap: anywhere;
        border-left: 3px solid var(--accent, var(--gold));
        padding-left: 14px;
        white-space: pre-wrap;
      }
      .sheet-actions {
        display: flex;
        gap: 10px;
        margin-top: 26px;
        flex-wrap: wrap;
        align-items: center;
      }
      .sheet-actions .spacer {
        flex: 1;
      }


      /* .panel repaints the left bar in the page accent further down the
         file, which quietly undid the red on the delete confirmation. The
         one dialog that destroys something keeps its red edge. */
      .modal .confirm-panel {
        border-left-color: var(--red);
      }
