  :root {
    --card-ratio: 0.584;
    --cw: 27cqw;
    --ch: calc(var(--cw) / var(--card-ratio));
    --dw: 40cqw;
    --dh: calc(var(--dw) * var(--card-ratio));
    --bg: #0b0b0c;
    --line: rgba(255,255,255,0.22);
    --label: rgba(255,255,255,0.5);
    --serif: Georgia, "Times New Roman", serif;
    --serif-book: "Minion Pro", "Minion 3", "EB Garamond", Georgia, serif;
    --bg-image: url("img/background.webp");
  }

  * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

  html, body {
    background: var(--bg);
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    user-select: none;
  }

  body {
    background: var(--bg);
  }

  /* Minion-like serif for the About page. Real Minion is used first for anyone
     who has it installed; otherwise the bundled EB Garamond stands in. */
  @font-face {
    font-family: "EB Garamond";
    src: url("fonts/EBGaramond.woff2") format("woff2");
    font-weight: 400 800; font-style: normal; font-display: swap;
  }

  #dust {
    position: fixed; inset: 0;
    display: block;
    z-index: 120;
    pointer-events: none;
  }

  /* deter casual saving/copying of artwork (not real protection: screenshots,
     devtools and the network tab can still reach displayed images) */
  img, canvas {
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
    user-select: none;
  }
  /* the share image is the reading people compose to spread; keep it saveable */
  #shareImg {
    -webkit-touch-callout: default;
    -webkit-user-drag: auto;
    -webkit-user-select: auto;
    user-select: auto;
  }

  /* ---- global hamburger ---- */
  .hamburger {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 14px);
    left: 14px;
    width: 46px; height: 40px;
    display: flex; flex-direction: column; justify-content: center; gap: 6px;
    padding: 0 8px;
    background: none; border: none; cursor: pointer;
    z-index: 85;
    transition: opacity 0.3s ease;
  }
  .hamburger span { display: block; height: 2.5px; width: 28px; background: #fff; border-radius: 2px; }
  .hamburger.hidden { opacity: 0; pointer-events: none; }
  .hamburger.gold span { background: #a68653; }

  .sound-toggle {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 14px);
    left: 60px;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer; padding: 0;
    color: #a68653; z-index: 86;
    filter: drop-shadow(0 1px 1.5px rgba(0,0,0,0.28));
    transition: opacity 0.4s ease;
  }
  .sound-toggle.hidden { opacity: 0; pointer-events: none; }
  .sound-toggle svg { width: 30px; height: 30px; display: block; }
  .sound-toggle:active { transform: scale(0.94); }

  /* ---- stage ---- */
  .stage {
    position: relative;
    width: 100%;
    height: 100vh; height: 100dvh;
    background: var(--bg);
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  .stage.hidden { display: none; }
  .stage-bg {
    position: absolute; inset: 0; z-index: 0;
    background: var(--bg-image) right center / cover no-repeat;
  }

  .overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.7);
    opacity: 0; pointer-events: none;
    transition: opacity 0.35s ease;
    z-index: 50;
  }
  .overlay.show { opacity: 1; pointer-events: auto; }

  .close-btn {
    position: absolute;
    top: calc(env(safe-area-inset-top) + 12px);
    right: 16px;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; line-height: 1;
    color: rgba(255,255,255,0.75);
    background: none; border: none; cursor: pointer;
    z-index: 70;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease, color 0.2s;
  }
  .close-btn.show { opacity: 1; pointer-events: auto; }
  .close-btn:active { color: #fff; }

  .flip-hint {
    position: absolute;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom) + 28px);
    transform: translateX(-50%);
    padding: 8px 6px;
    font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    z-index: 70;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease, color 0.2s;
    cursor: pointer;
  }
  .flip-hint.show { opacity: 1; pointer-events: auto; }
  .flip-hint:active { color: #fff; }

  .tap-hint {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
    color: rgba(255,255,255,0.7);
    opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 40; white-space: nowrap;
  }
  .tap-hint.show { opacity: 1; }

  /* reading field: a fixed board centred on the stage. Its width and height
     are capped, and it acts as the sizing container (cqw) for the cards and
     deck, so the whole reading holds its proportions and never stretches with
     the screen; it only scales down to fit a smaller viewport. The stage,
     background and menu button still span the viewport and adjust freely. */
  .field {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 430px;
    height: 100%;
    max-height: 850px;
    container-type: inline-size;
  }

  .slot {
    position: absolute;
    width: var(--cw); height: var(--ch);
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 10px;
    background: rgba(255,255,255,0.02);
  }
  .slot .lbl {
    position: absolute; left: 50%; bottom: -24px;
    transform: translateX(-50%);
    font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
    color: #fff; white-space: nowrap;
  }
  .slot.filled { border-color: transparent; background: none; }
  .slot[data-i="0"] { left: 50%; top: 24%; }
  .slot[data-i="1"] { left: 27%; top: 54%; }
  .slot[data-i="2"] { left: 73%; top: 54%; }

  .deck-wrap {
    position: absolute; left: 50%; top: 86%;
    transform: translate(-50%, -50%);
    display: flex; flex-direction: column; align-items: center; gap: 16px;
    cursor: pointer; z-index: 10;
  }
  .deck-wrap.hidden { display: none; }
  .deck { position: relative; width: var(--dw); }
  .deck-img {
    display: block; width: 100%; height: auto;
    filter: drop-shadow(0 6px 16px rgba(0,0,0,0.45));
  }
  .deck-hint {
    font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
    color: rgba(255,255,255,0.6);
  }
  .deck-wrap:active .deck-img { transform: translateY(-4px); transition: transform 0.12s; }

  .glyph-btn {
    background: none; border: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    color: rgba(255,255,255,0.85);
  }
  .glyph-ico { height: 50px; width: auto; display: block; opacity: 0.9; }
  .glyph-label {
    font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
    color: rgba(255,255,255,0.82); text-align: center; line-height: 1.4;
  }
  .glyph-btn:active { color: #fff; }

  #summaryBtn {
    position: absolute; left: 50%; top: 85%;
    transform: translate(-50%, -50%) translateY(8px);
    opacity: 0; pointer-events: none;
    transition: opacity 1s ease, transform 1s ease;
    z-index: 15;
  }
  #summaryBtn.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%); }

  .intro-title {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 76%; max-width: 340px; height: auto;
    opacity: 0; pointer-events: none; z-index: 30;
  }

  .drawncard {
    position: absolute; transform: translate(-50%, -50%);
    z-index: 20; cursor: pointer; will-change: transform;
  }
  .card-inner {
    position: absolute; inset: 0;
    transform: perspective(900px) rotateY(0deg);
    transform-style: preserve-3d; will-change: transform;
  }
  .face {
    position: absolute; inset: 0; border-radius: 10px;
    backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden;
  }
  .face.front {
    background: linear-gradient(160deg, #2b2b30, #141416);
    border: 1px solid rgba(255,255,255,0.3);
  }
  .face.front::after {
    content: ""; position: absolute; inset: 8px;
    border: 1px solid rgba(255,255,255,0.12); border-radius: 5px;
  }
  .face.back {
    background: linear-gradient(160deg, #211d26, #100d14);
    border: 1px solid rgba(255,255,255,0.28);
    transform: rotateY(180deg);
    padding: 13px; display: flex; flex-direction: column; gap: 7px;
  }
  .b-title { height: 9px; width: 62%; border-radius: 3px; background: rgba(255,255,255,0.55); margin-bottom: 5px; }
  .b-line { height: 5px; border-radius: 3px; background: rgba(255,255,255,0.18); }
  .b-line.w1 { width: 100%; } .b-line.w2 { width: 93%; }
  .b-line.w3 { width: 97%; } .b-line.w4 { width: 78%; }

  .cardimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
  .face.art { background: #fff; border: 1px solid rgba(0,0,0,0.12); padding: 0; }
  .face.art::after { display: none; }

  /* ---- scrollable pages (summary + about) ---- */
  .page {
    position: fixed; inset: 0; background: var(--bg);
    z-index: 80; overflow-y: auto; -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
    opacity: 0; pointer-events: none; transform: translateY(14px);
    transition: opacity 0.4s ease, transform 0.4s ease;
  }
  .page.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
  .page-inner {
    max-width: 520px; margin: 0 auto;
    padding: calc(env(safe-area-inset-top) + 78px) 26px calc(env(safe-area-inset-bottom) + 46px);
  }
  .block { margin-bottom: 40px; }
  .block h2 {
    font-size: 22px; letter-spacing: 0.1em; text-transform: uppercase;
    color: #fff; font-weight: 600; margin-bottom: 14px;
  }
  .block .rule { height: 1px; background: rgba(255,255,255,0.32); margin-bottom: 18px; }
  .block p { font-size: 15px; line-height: 1.65; color: rgba(255,255,255,0.7); margin-bottom: 16px; }
  .block p:last-child { margin-bottom: 0; }
  .deck-title { display: block; width: 100%; height: auto; margin-bottom: 16px; }
  #deckPage .deck-intro {
    font-family: var(--serif-book);
    font-size: 18px; line-height: 1.45; color: rgba(255,255,255,0.85);
    margin-bottom: 28px;
  }
  /* ---- About (light page) ---- */
  .about-page { background: #ffffff; }
  .about-inner {
    max-width: 460px;
    padding: calc(env(safe-area-inset-top) + 74px) 24px calc(env(safe-area-inset-bottom) + 40px);
  }
  .about-title {
    display: block; width: 100%; height: auto;
    margin: 2px 0 24px;
  }
  .about-title.discover { margin-top: 44px; }
  .about-shot {
    display: block; width: 100%; height: auto;
    margin: 0 0 26px;
  }
  .about-shot.coin { margin-bottom: 30px; }
  .about-lead,
  .about-body {
    font-family: var(--serif-book);
    color: #241f18; margin: 0 0 22px;
  }
  .about-lead { font-size: 18.5px; line-height: 1.62; }
  .about-body { font-size: 17px; line-height: 1.68; }
  .about-lead strong,
  .about-body strong { font-weight: 700; color: #0f0d08; }

  .about-form {
    display: flex; flex-direction: column; gap: 13px;
    margin: 6px 0 30px;
  }
  .about-input {
    width: 100%; box-sizing: border-box;
    font-family: var(--serif-book); font-size: 15px; letter-spacing: 0.04em;
    color: #2a2416; background: #fff;
    border: 1.5px solid #a68653; border-radius: 999px;
    padding: 15px 24px; outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
  }
  .about-input::placeholder {
    color: #bd9a5f; letter-spacing: 0.16em; opacity: 1;
  }
  .about-input:focus {
    border-color: #8a6d3f; box-shadow: 0 0 0 3px rgba(166, 134, 83, 0.16);
  }
  .about-submit {
    width: 100%; box-sizing: border-box; cursor: pointer;
    font-family: var(--serif-book); font-size: 15px; font-weight: 600;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: #ffffff;
    background: #a68653;
    border: none; border-radius: 999px; padding: 16px 24px;
    transition: background 0.15s ease, transform 0.12s ease;
  }
  .about-submit:active {
    transform: translateY(1px);
    background: #977748;
  }
  .about-submit:disabled { opacity: 0.75; cursor: default; transform: none; }
  .about-status {
    font-family: var(--serif-book); font-size: 15px; line-height: 1.5;
    text-align: center; margin: 12px 2px 0;
  }
  .about-status:empty { display: none; }
  .about-status[data-kind="ok"] { color: #6b5426; }
  .about-status[data-kind="error"] { color: #9c3a2c; }
  .about-form.done .about-input,
  .about-form.done .about-submit { display: none; }
  .about-form.done .about-status {
    font-size: 17px; line-height: 1.55; margin: 4px 0 0;
    padding: 14px 16px; border: 1.5px solid #a68653; border-radius: 14px;
  }

  .follow-lead,
  .follow-sub {
    text-align: left; font-family: var(--serif-book); font-weight: 700;
    text-transform: uppercase; color: #181510;
    font-size: 17px; letter-spacing: 0.04em; line-height: 1.25;
  }
  .follow-lead { margin: 34px 0 14px; }
  .about-kickstarter-link { display: block; margin: 0 0 14px; }
  .about-kickstarter {
    display: block; width: 100%; height: auto;
  }
  .follow-sub { margin: 0 0 24px; }
  .about-end {
    display: block; width: 100%; height: auto;
    margin: 10px auto 0;
  }
  .page-actions {
    display: flex; justify-content: center; align-items: flex-start;
    gap: 46px; margin-top: 60px;
  }
  .page-actions .glyph-btn { margin: 0; }

  /* ---- summary page: the drawn trio, read back as a mirror ---- */
  #summary {
    background:
      var(--bg-image) right center / cover no-repeat,
      var(--bg);
  }
  .sum-title { display: block; width: 100%; height: auto; margin-bottom: 26px; }
  .sum-block { margin-bottom: 42px; }
  .sum-block:last-of-type { margin-bottom: 8px; }
  .sum-block h2 {
    font-family: var(--serif-book);
    font-size: 23px; letter-spacing: 0.14em; text-transform: uppercase;
    color: #fff; font-weight: 600; margin-bottom: 12px;
  }
  .sum-block .rule { height: 1px; background: rgba(255,255,255,0.28); margin-bottom: 20px; }
  .sum-row { display: flex; align-items: flex-start; gap: 18px; }
  .sum-card {
    flex: 0 0 auto; width: 78px; aspect-ratio: var(--card-ratio);
    position: relative; border-radius: 8px; overflow: hidden; cursor: pointer;
    background: #fff; border: 1px solid rgba(255,255,255,0.18);
    box-shadow: 0 6px 16px rgba(0,0,0,0.45);
  }
  .sum-card.reversed { transform: rotate(180deg); }
  .sum-card .sum-face {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; display: block;
  }
  .sum-card .ph-num { font-size: 30px; }
  .sum-text { flex: 1 1 auto; min-width: 0; font-family: var(--serif-book); }
  .sum-id { font-size: 18px; font-weight: 700; color: #fff; line-height: 1.25; }
  .sum-orient {
    font-size: 14.5px; color: rgba(255,255,255,0.55);
    margin-bottom: 15px; letter-spacing: 0.02em;
  }
  .sum-text p {
    font-size: 15.5px; line-height: 1.56; color: rgba(255,255,255,0.82);
    margin-bottom: 13px;
  }
  .sum-text p:last-child { margin-bottom: 0; }
  .sum-text p.sum-q { font-weight: 700; color: rgba(255,255,255,0.92); }

  /* ---- share preview ---- */
  .share-view {
    position: fixed; inset: 0; z-index: 130;
    background: rgba(6,6,8,0.92);
    display: none; flex-direction: column; align-items: center;
    padding: 20px 16px 18px;
  }
  .share-view.active { display: flex; }
  .share-scroll {
    flex: 1 1 auto; width: 100%; display: flex; align-items: center;
    justify-content: center; overflow: hidden; min-height: 0;
  }
  .share-scroll img {
    max-width: 100%; max-height: 100%; height: auto; width: auto;
    border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  }
  .share-scroll img:not([src]) { visibility: hidden; box-shadow: none; }
  .share-actions {
    flex: 0 0 auto; display: flex; gap: 12px; margin-top: 16px;
  }
  .share-actions button {
    font-family: var(--serif-book); font-size: 14px; letter-spacing: 0.1em;
    text-transform: uppercase; cursor: pointer; border-radius: 999px;
    padding: 12px 26px; transition: opacity 0.15s;
  }
  .share-btn-do { background: #a68653; color: #fff; border: none; }
  .share-actions button:active { opacity: 0.7; }
  .share-close {
    position: absolute; top: 14px; right: 16px; z-index: 2;
    width: 40px; height: 40px;
    background: none; color: #fff; border: none;
    font-size: 26px; line-height: 1; cursor: pointer;
  }
  .share-loader {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 46px; z-index: 1;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .share-view.building .share-loader { opacity: 1; }
  .share-loader svg {
    width: 100%; height: auto; display: block;
    transform-origin: 50% 50%;
    animation: menu-spin 1.5s linear infinite;
  }

  /* instructions: full-bleed transparent slides on a white ground, in a
     swipeable, dot-navigated carousel. The menu button turns gold on this page
     so it stays visible against the light background. */
  #instructions { background: #fff; overflow: hidden; }
  #instructions .carousel { position: absolute; inset: 0; overflow: hidden; }
  #instructions .slides {
    position: absolute; inset: 0;
    display: flex;
    will-change: transform;
    touch-action: pan-y;
  }
  #instructions .slide {
    flex: 0 0 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
  }
  #instructions .slide img {
    max-width: 100%; max-height: 100%;
    object-fit: contain; display: block;
    -webkit-user-drag: none; user-select: none;
  }
  #instructions .dots {
    position: absolute; left: 0; right: 0;
    bottom: calc(env(safe-area-inset-bottom) + 22px);
    display: flex; justify-content: center; gap: 12px; z-index: 2;
  }
  #instructions .dot {
    width: 9px; height: 9px; border-radius: 50%;
    padding: 0; border: none; cursor: pointer;
    background: rgba(0,0,0,0.22);
    transition: background 0.25s ease, transform 0.25s ease;
  }
  #instructions .dot.active { background: #a68653; transform: scale(1.25); }

  /* ---- the deck (collection grid) ---- */
  #deckPage {
    background:
      var(--bg-image) right center / cover no-repeat,
      var(--bg);
  }
  .deck-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 13px;
  }
  .deck-card {
    position: relative;
    aspect-ratio: var(--card-ratio);
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.6);
    background: transparent;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
    transition: border-color 0.35s ease, background 0.35s ease;
  }
  .deck-card .card-name {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px; padding: 8px;
    text-align: center;
    font-family: var(--serif);
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 1;
  }
  .cn-deity {
    font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase;
    color: #fff; line-height: 1.2;
  }
  .cn-tarot {
    font-size: 9.5px; letter-spacing: 0.11em; text-transform: uppercase;
    color: rgba(255,255,255,0.68); line-height: 1.2;
  }
  /* a drawn card fills its cell with its front art, covering the name */
  .deck-card img.deck-face {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    z-index: 2;
  }
  .deck-card.has-art { background: #fff; }
  .deck-card.has-art .card-name { opacity: 0; }
  .deck-card.has-art::after { display: none; }

  /* ---- library card viewer (lift + flip) ---- */
  .lib-viewer { position: fixed; inset: 0; z-index: 95; pointer-events: none; }
  .lib-viewer.active { pointer-events: auto; }
  .lib-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.72);
    opacity: 0; transition: opacity 0.35s ease;
  }
  .lib-viewer.active .lib-overlay { opacity: 1; }
  .lib-close {
    position: absolute;
    top: calc(env(safe-area-inset-top) + 12px); right: 16px;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px; line-height: 1; color: rgba(255,255,255,0.75);
    background: none; border: none; cursor: pointer; z-index: 3;
    opacity: 0; transition: opacity 0.3s ease, color 0.2s;
  }
  .lib-viewer.active .lib-close { opacity: 1; }
  .lib-close:active { color: #fff; }
  .lib-flip-hint {
    position: absolute; left: 50%;
    bottom: calc(env(safe-area-inset-bottom) + 28px);
    transform: translateX(-50%); padding: 8px 6px;
    font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
    color: rgba(255,255,255,0.6); z-index: 3;
    opacity: 0; transition: opacity 0.3s ease, color 0.2s; cursor: pointer;
  }
  .lib-viewer.active .lib-flip-hint { opacity: 1; }
  .lib-flip-hint:active { color: #fff; }
  .lib-viewer .drawncard { z-index: 2; }
  .ph-num {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--serif); font-size: 42px; letter-spacing: 0.05em;
    color: rgba(255,255,255,0.85);
  }

  /* ---- landing / image menu ---- */
  .landing {
    position: fixed; inset: 0;
    z-index: 100;
    background: #c2bdba;
    opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease;
    overflow: hidden;
  }
  .landing.show { opacity: 1; pointer-events: auto; }

  /* sand fills the whole screen and crops rather than leaving side bars */
  .menu-sand {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover; object-position: center;
    display: block; z-index: 0;
  }

  /* the board matches the sand's portrait framing so the overlays land on it;
     each overlay is placed on its own and can be nudged independently */
  .menu-board {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    aspect-ratio: 1265 / 1844;
    height: 100%; width: auto;
    z-index: 1;
  }

  .menu-logo {
    position: absolute; left: 50%; top: 19%;
    transform: translate(-50%, -50%);
    width: 42%; height: auto; display: block;
    z-index: 2;
  }

  .menu-menu {
    position: absolute; left: 50%; top: 67%;
    transform: translate(-50%, -50%);
    width: 46%;
    z-index: 1;
  }
  .menu-menu img { width: 100%; display: block; }
  .menu-hot {
    position: absolute; left: 0; width: 100%;
    background: transparent; border: none; padding: 0; margin: 0;
    cursor: pointer; opacity: 0; pointer-events: none;
  }
  #landing.show[data-state="open"] .menu-hot { pointer-events: auto; }

  .menu-cards {
    position: absolute;
    left: -12%; bottom: -6%;
    width: 120%;
    transform: translate(0, 0) rotate(0deg);
    transform-origin: 35% 55%;
    transition: transform 1.05s cubic-bezier(.5,.02,.2,1);
    pointer-events: none; will-change: transform; z-index: 3;
  }
  #landing[data-state="open"] .menu-cards { transform: translate(calc(-46% + 20px), calc(52% + 20px)) rotate(-11deg); }

  .menu-loader {
    position: absolute; left: 50%; top: 40%;
    transform: translate(-50%, -50%);
    width: 8%; max-width: 46px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.4s ease; z-index: 4;
  }
  #landing[data-state="loading"] .menu-loader { opacity: 1; }
  .menu-loader svg {
    width: 100%; height: auto; display: block;
    transform-origin: 50% 50%;
    animation: menu-spin 1.5s linear infinite;
  }
  @keyframes menu-spin { to { transform: rotate(360deg); } }

  .menu-button {
    position: absolute; left: 50%; top: 40%;
    transform: translate(-50%, -50%) scale(0.96);
    width: 32%;
    background: none; border: none; padding: 0; cursor: pointer;
    opacity: 0; pointer-events: none;
    transition: opacity 0.5s ease, transform 0.5s ease; z-index: 4;
  }
  .menu-button img { width: 100%; display: block; }
  #landing.show[data-state="ready"] .menu-button {
    opacity: 1; pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
  }
  #landing.show[data-state="ready"] .menu-button:active { transform: translate(-50%, -50%) scale(0.97); }

  .landing.instant .menu-cards,
  .landing.instant .menu-button,
  .landing.instant .menu-loader { transition: none; }

  /* Add to Home Screen badge: sits on the board below the cards (z2 < cards z3),
     so it is hidden under the cards at start and revealed when they slide, like
     the menu. No behaviour wired yet (pointer-events off). */
  .menu-a2hs {
    position: absolute;
    left: 66%; top: 87%;
    transform: translate(-50%, calc(-50% + 25px));
    width: 19.8%; aspect-ratio: 1 / 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    border: none; border-radius: 50%;
    background: rgba(112, 80, 34, 0.82);
    color: #f5f2ef;
    padding: 0; margin: 0;
    z-index: 2; pointer-events: none;
  }
  .menu-a2hs .a2hs-glyph {
    width: 32%; height: auto; display: block; margin-bottom: 6%;
  }
  .menu-a2hs .a2hs-label {
    font-family: var(--serif-book);
    font-size: 9px; font-weight: 600; letter-spacing: 0.06em;
    line-height: 1.18; text-align: center; text-transform: uppercase;
  }
  #landing.show[data-state="open"] .menu-a2hs { pointer-events: auto; cursor: pointer; }
  #landing.show[data-state="open"] .menu-a2hs:active { transform: translate(-50%, calc(-50% + 25px)) scale(0.96); }
  .menu-a2hs.installed { display: none; }

  /* install-instructions panel: black box at 70%, white serif text */
  .a2hs-sheet {
    position: fixed; inset: 0; z-index: 140;
    display: none; align-items: center; justify-content: center;
    padding: 26px; background: rgba(0, 0, 0, 0.35);
  }
  .a2hs-sheet.show { display: flex; }
  .a2hs-panel {
    background: rgba(0, 0, 0, 0.7); color: #fff;
    max-width: 320px; width: 100%;
    border-radius: 14px; padding: 24px 22px 20px;
    text-align: center;
  }
  .a2hs-msg {
    font-family: var(--serif-book);
    font-size: 16.5px; line-height: 1.55; margin: 0; color: #fff;
  }
  .a2hs-msg .a2hs-share {
    display: inline-block; width: 0.9em; height: 0.9em;
    vertical-align: -0.12em; margin: 0 0.12em; fill: none;
    stroke: #fff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round;
  }
  .a2hs-got {
    margin-top: 18px; cursor: pointer;
    font-family: var(--serif-book); font-size: 13px; letter-spacing: 0.12em;
    text-transform: uppercase; color: #fff;
    background: #a68653; border: none; border-radius: 999px;
    padding: 11px 26px;
  }
  .a2hs-got:active { opacity: 0.7; }

  @media (prefers-reduced-motion: reduce) {
    .deck-wrap:active .deck-img { transform: none; }
  }

  /* ---------- Daily Rite page (light, scoped to #ritePage) ---------- */
  .rite-page { background: #ffffff; }
  .rite-inner {
    max-width: 520px; margin: 0 auto;
    padding: calc(env(safe-area-inset-top) + 30px) 30px calc(env(safe-area-inset-bottom) + 40px);
    font-family: var(--serif-book);
  }
  .rite-top { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
  .rite-date { display: flex; flex-direction: column; align-items: flex-end; line-height: .8; }
  .rite-date .rite-d { font-size: 62px; font-weight: 700; color: #1c1a17; letter-spacing: -.02em; }
  .rite-date .rite-m { font-size: 12px; font-weight: 700; letter-spacing: .10em; color: #1c1a17; margin-top: 1px; }
  .rite-moon-img { width: 46px; height: 46px; display: block; }
  .rite-phase { font-size: 12px; font-weight: 700; letter-spacing: .12em; line-height: 1.25;
    color: #1c1a17; text-transform: uppercase; text-align: right; }
  .rite-page .rite-title { display: block; width: 100%; margin: 14px 0 10px; }
  .rite-q { font-size: 20px; line-height: 1.35; color: #1c1a17; margin: 0 2px 22px; font-weight: 400; }
  .rite-q b { font-weight: 700; }
  .rite-frame { border: 2px solid #a9884f; border-radius: 16px; overflow: hidden;
    aspect-ratio: .584; width: 100%; background: #0d0d0f; position: relative; }
  .rite-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .rite-loader {
    position: absolute; top: 50%; left: 50%; width: 38px; height: 38px;
    margin: -19px 0 0 -19px; border-radius: 50%;
    border: 3px solid rgba(201,162,74,0.28); border-top-color: #c9a24a;
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
    animation: rite-spin 0.8s linear infinite;
  }
  .rite-frame.loading .rite-loader { opacity: 1; }
  @keyframes rite-spin { to { transform: rotate(360deg); } }
  .rite-guide { margin: 18px 6px 0; text-align: center; font-style: italic;
    font-size: 16px; line-height: 1.45; color: #8f7a4e; }

  /* ---------- deck-complete wallpaper reward ---------- */
  .deck-reward {
    display: block; margin: 22px auto 0; padding: 13px 30px;
    background: #a68653; color: #fff; border: none; border-radius: 999px;
    font-family: var(--serif-book); font-size: 14px; letter-spacing: 0.1em;
    text-transform: uppercase; cursor: pointer; transition: opacity 0.15s;
  }
  .deck-reward:active { opacity: 0.7; }
  .deck-reward.hidden { display: none; }

  .reward-view {
    position: fixed; inset: 0; z-index: 130;
    background: rgba(255,255,255,0.9);
    display: flex; flex-direction: column; align-items: center;
    overflow-y: auto; overscroll-behavior: none;
    padding: calc(env(safe-area-inset-top) + 20px) 20px calc(env(safe-area-inset-bottom) + 24px);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.45s ease, visibility 0s linear 0.45s;
  }
  .reward-view.active {
    opacity: 1; visibility: visible; pointer-events: auto;
    transition: opacity 0.45s ease, visibility 0s;
  }
  .reward-inner {
    margin: auto; width: 100%; max-width: 360px;
    display: flex; flex-direction: column; align-items: center; text-align: center;
    font-family: var(--serif-book);
  }
  .reward-leadin {
    margin: 0 0 6px; color: #1c1a17; font-size: 13px; letter-spacing: 0.24em;
    text-transform: uppercase; font-weight: 700;
  }
  .reward-title { width: 74%; max-width: 250px; display: block; margin: 0 0 18px; }
  .reward-frame {
    width: max-content; max-width: 100%; max-height: 44vh;
    border-radius: 14px; overflow: hidden;
    box-shadow: 0 22px 60px rgba(0,0,0,0.35); border: 1px solid rgba(201,162,74,0.55);
  }
  .reward-frame img { display: block; height: 44vh; max-height: 44vh; width: auto; max-width: 100%; }
  .reward-logo { width: 62%; max-width: 210px; display: block; margin: 20px 0 0; }
  .reward-note {
    margin: 14px 4px 0; color: #1c1a17;
    font-size: 16.5px; line-height: 1.45; font-style: italic; font-weight: 700;
  }
  .reward-save {
    margin-top: 18px; padding: 13px 30px;
    background: #a68653; color: #fff; border: none; border-radius: 999px;
    font-family: var(--serif-book); font-size: 14px; letter-spacing: 0.1em;
    text-transform: uppercase; cursor: pointer; transition: opacity 0.15s;
  }
  .reward-save:active { opacity: 0.7; }
  .reward-close {
    position: absolute; top: calc(env(safe-area-inset-top) + 10px); right: 16px; z-index: 2;
    width: 40px; height: 40px; background: none; color: #1c1a17; border: none;
    font-size: 26px; line-height: 1; cursor: pointer;
  }
