/* CardMira room v2 (stage B, 2026-10-17), ported from the approved room prototype
   (docs/website/prototypes/cardmira-room-v2): the table header lives inside the room, the whole
   room fits one desktop screen, Mira's words read as a chat on the cloth, the round's progress
   stands on the room's right edge and the story column sits beside the room. Loaded only on
   the home page and the two table pages; every rule is scoped to the room's own classes. */
.cm-layout { --cm-paper: #fffdf8; --cm-ink: #2b2520; --cm-muted: #6f6458; --cm-line: #e4d9c9; --navy: #2f3477; --navy-2: #252a68;
  --gold: #c9a227; --olive: #6b7a3d; --cloth: #cdad93; --cloth-2: #bb9d83;
  --serif: "Songti SC", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --page-max: 1352px; --header-h: 136px; --bar-h: 56px; --table-h: 258px; --side-w: 300px; --gap: 20px; --top-pad: 12px; --radius: 18px; --mini-w: 38px;
  display: flex; gap: var(--gap); justify-content: center; align-items: stretch; max-width: var(--page-max); margin: var(--top-pad) auto 0; padding: 0 16px; }
@media (min-width: 1600px) { .cm-layout { --page-max: 1640px; --side-w: 340px; } }
body:has(.cm-layout) > header { max-width: 1352px; padding-top: 10px; padding-bottom: 10px; }
/* four destinations fit beside the brand: keep the room page's header on one row */
@media (min-width: 900px) { body:has(.cm-layout) > header { flex-wrap: nowrap; } body:has(.cm-layout) > header .primary-nav { order: 0; flex: 1 1 auto; flex-basis: auto; justify-content: flex-start; } body:has(.cm-layout) > header .header-tools { flex: none; width: auto; } }
@media (min-width: 900px) and (max-width: 1100px) { body:has(.cm-layout) > header .brand-slogan { display: none; } }
.cm-title { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The room is sized from the viewport height so the scene and the near table fit under the
   header; the side column takes the room's height. */
.cm-room.room { position: relative; isolation: isolate; flex: none; min-width: 0; height: auto; margin: 0; display: flex; flex-direction: column;
  background: var(--cm-paper); border: 1px solid var(--cm-line); border-radius: var(--radius); overflow: clip; box-shadow: 0 16px 40px #2a31421a; container: room / inline-size;
  width: min(calc(100% - var(--side-w) - var(--gap)), max(600px, calc((100svh - var(--header-h) - var(--table-h) - var(--top-pad) - 34px) * 1.85))); }

/* ---------- the room bar: which table, one line, sound and settings ---------- */
.cm-bar { position: absolute; z-index: 8; left: 0; right: 0; top: 0; height: var(--bar-h); display: flex; align-items: center; gap: 16px; padding: 0 10px 0 9px;
  color: #f7efe2; background: linear-gradient(to bottom, #1a120cd9, #1a120c99 70%, #1a120c66); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid #ffffff14; }
.cm-room .cm-plaques { display: inline-flex; flex: none; gap: 8px; }
.cm-room .cm-plaque { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; border: 0; padding: 4px 13px 4px 6px; border-radius: 10px; text-align: left; text-decoration: none; font: inherit; cursor: pointer;
  background: linear-gradient(180deg, #ffffff1f, #ffffff0a); color: #f7efe2b3; box-shadow: inset 0 0 0 1px #ffffff24; transition: background .18s ease, color .18s ease, box-shadow .18s ease; }
.cm-room .cm-plaque:hover { background: linear-gradient(180deg, #ffffff33, #ffffff14); color: #fff; }
.cm-room .cm-plaque:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.cm-room .cm-plaque[aria-pressed="true"], .cm-room .cm-plaque[aria-current="page"] { background: linear-gradient(180deg, #f6ecd5, #dcc69a); color: #3d2f1f; box-shadow: 0 6px 14px #00000059, inset 0 1px 0 #fffaf0, inset 0 0 0 1px #b8963f66; }
.cm-room .cm-plaque .emblem { width: 28px; height: 28px; flex: none; }
.cm-room .cm-plaque[aria-pressed="false"] .emblem, .cm-room .cm-plaque:not([aria-pressed]):not([aria-current]) .emblem { opacity: .72; filter: saturate(.7); }
.plaque-text { display: grid; line-height: 1.12; }
.plaque-text b { font: 600 15px/1.2 var(--serif); letter-spacing: .02em; }
.plaque-text small { font-size: 9px; letter-spacing: .14em; color: #6f5a3a; }
.cm-room .cm-plaque[aria-pressed="false"] .plaque-text small, .cm-room .cm-plaque:not([aria-pressed]):not([aria-current]) .plaque-text small { color: #f7efe26b; }
.cm-value { margin: 0; flex: 1; min-width: 0; font-size: 13.5px; color: #f7efe2d0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-bar-controls { display: flex; gap: 6px; flex: none; margin-left: auto; }
.cm-room .cm-round { position: relative; border: 0; width: 34px; height: 34px; min-height: 0; padding: 0; border-radius: 50%; background: #ffffff1f; color: #f7efe2; display: grid; place-items: center; cursor: pointer; transition: background .15s ease; }
.cm-room .cm-round:hover { background: #ffffff33; }
.cm-room .cm-round:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.cm-room .cm-round .slash { opacity: 0; }
.cm-room .cm-round[aria-pressed="false"] .slash { opacity: 1; }
.cm-room .cm-round[aria-pressed="false"] { color: #f7efe299; }
.cm-room .voice-control[aria-pressed="false"] .wave { opacity: 0; }
.cm-room .music-control[data-state="loading"]::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; border: 1.5px solid #f7efe255; border-top-color: var(--gold); animation: cm-spin .9s linear infinite; }
.cm-room .music-control[data-state="error"] { box-shadow: inset 0 0 0 1.5px #e0866f; }
@keyframes cm-spin { to { transform: rotate(360deg); } }
@container room (max-width: 760px) { .cm-value { display: none; } }
.cm-settings { position: absolute; right: 10px; top: calc(var(--bar-h) + 8px); z-index: 12; width: max-content; max-width: calc(100% - 20px); background: var(--cm-paper); color: var(--cm-ink); border-radius: 12px; padding: 10px 14px; display: grid; gap: 6px; box-shadow: 0 8px 24px #1f160f33; font-size: 14px; }
.cm-settings[hidden] { display: none; }
.cm-settings-title { margin: 0; font-size: 12px; letter-spacing: .06em; color: var(--cm-muted); }
.cm-settings .motion-controls { display: grid; gap: 4px; }
.cm-settings .toggle { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.cm-music-credit { max-width: 260px; margin: 6px 0 0; padding-top: 10px; border-top: 1px solid #78664530; font-size: 12px; line-height: 1.6; color: var(--cm-muted); }
.cm-music-credit strong { display: block; font-weight: 500; color: var(--cm-ink); }
.cm-music-credit a { color: inherit; text-underline-offset: 3px; }

/* ---------- Mira's words as a chat, on the cloth to her left ---------- */
.cm-chat { position: absolute; z-index: 7; left: 14px; top: calc(100cqw / 1.85 - 14px); transform: translateY(-100%); width: min(310px, 31%); display: grid; gap: 6px; pointer-events: none; }
.cm-chat > * { pointer-events: auto; }
.mira-history { display: grid; gap: 6px; pointer-events: none; }
.mira-history:empty { display: none; }
.mira-history-line { justify-self: start; margin: 0 0 0 42px; padding: 7px 12px; background: #fffdf8d0; border-radius: 14px 14px 14px 4px; font-size: 13px; line-height: 1.45; color: var(--cm-ink); box-shadow: 0 6px 16px #1f160f26; opacity: .35; }
.mira-history-line:last-child { opacity: .62; }
.cm-chat .mira-message { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; align-items: end; margin: 0; padding: 0; background: none; border: 0; box-shadow: none; max-width: none; }
.cm-chat .mira-avatar-wrap { width: 34px; height: 34px; }
.cm-chat .mira-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px #fffdf8, 0 0 0 3.5px var(--gold), 0 4px 10px #1f160f55; }
.mira-bubble { position: relative; justify-self: start; max-width: 100%; padding: 8px 12px 9px; background: #fffdf8f0; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-radius: 14px 14px 14px 4px; box-shadow: 0 8px 20px #1f160f33, inset 0 0 0 1px #ffffff90; }
.msg-name { margin: 0 0 2px; font-size: 10.5px; letter-spacing: .05em; color: var(--olive); font-weight: 600; }
.cm-room .cm-chat .mira-message .mira-say, .cm-room .cm-chat .mira-message [data-status] { display: block; width: auto; max-width: none; min-height: 0; margin: 0; padding: 0; background: none; border: 0; border-radius: 0; box-shadow: none; text-align: left; font-size: 14px; line-height: 1.5; color: var(--cm-ink); }
.cm-room .cm-chat .mira-message .mira-say[hidden] { display: none; }
/* a short typing beat before each new line (visual only; the status text itself is immediate) */
.cm-chat .mira-message.is-typing .mira-bubble { animation: cm-msgin .32s cubic-bezier(.2, .7, .2, 1); }
@keyframes cm-msgin { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.motion-status { margin: 0 0 0 42px; padding: 6px 10px; font-size: 12.5px; color: var(--cm-ink); background: #f3ead2ee; border-radius: 10px; }
.motion-status[hidden] { display: none; }
.cm-room .cm-chat .chat-action { justify-self: start; margin-left: 42px; min-height: 0; padding: 4px 11px; border: 0; border-radius: 999px; background: #fffdf8d9; box-shadow: 0 2px 8px #1f160f26; color: var(--navy); font-size: 12.5px; cursor: pointer; }
.cm-room .cm-chat .chat-action:hover { background: #fff; text-decoration: underline; }

/* ---------- the round's progress, upright on the room's right edge ----------
   Mira never reaches past x≈760 of the source frame, so the rail never covers her. */
.cm-rail { --rail-w: 168px; position: absolute; z-index: 7; right: 0; top: var(--bar-h); height: calc(100cqw / 1.85 - var(--bar-h)); width: var(--rail-w); display: flex; flex-direction: column; padding: 16px 12px 18px 14px; color: #f7efe2;
  background: linear-gradient(to left, #1a120ce0, #1a120cb3 72%, #1a120c8c); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-left: 1px solid #ffffff14;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent); }
.cm-rail-title { margin: 0 0 14px; font-size: 11.5px; letter-spacing: .2em; color: #e3c45e; font-weight: 600; }
.cm-phases { --node: 30px; position: relative; flex: 1; min-height: 0; list-style: none; margin: 0; padding: 0 0 6px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; font-size: 14px; color: #f7efe2b0; }
.cm-phases::before, .cm-phases::after { content: ""; position: absolute; left: calc(var(--node) / 2 - 1.5px); width: 3px; border-radius: 2px; top: calc(var(--node) / 2); }
.cm-phases::before { height: var(--track-px, 0px); background: #f7efe22e; }
.cm-phases::after { height: var(--fill-px, 0px); background: linear-gradient(#f0d27a, var(--gold)); box-shadow: 0 0 10px #e3c45e99; transition: height .6s cubic-bezier(.2, .7, .2, 1); }
.cm-phases li { position: relative; z-index: 1; display: grid; grid-template-columns: var(--node) minmax(0, 1fr); gap: 9px; align-items: start; }
.cm-phases .step-number { display: inline-grid; place-items: center; width: var(--node); height: var(--node); border-radius: 50%; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; border: 1.5px solid #f7efe266; color: #f7efe2cc; background: #241a12; position: relative; }
.cm-phases .step-body { display: grid; gap: 3px; padding-top: 4px; }
.cm-phases .step-body b { font-weight: 600; letter-spacing: .02em; line-height: 1.3; }
.cm-phases li[data-state="now"] { color: #fff; }
.cm-phases li[data-state="now"] b { font: 600 16px/1.3 var(--serif); color: #f3d98a; }
.cm-phases li[data-state="now"] .step-number { background: var(--gold); border-color: #f3d98a; color: #2b2520; box-shadow: 0 0 0 5px #c9a22738, 0 0 16px #e3c45e99; animation: cm-stepglow 2.4s ease-in-out infinite; }
.cm-phases li[data-state="done"] { color: #cdd8a8; }
.cm-phases li[data-state="done"] .step-number { background: #2d3a1f; border-color: #cdd8a8; color: transparent; }
.cm-phases li[data-state="done"] .step-number::before { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #cdd8a8; font-size: 14px; }
@keyframes cm-stepglow { 50% { box-shadow: 0 0 0 8px #c9a2271a, 0 0 20px #e3c45ebb; } }
@container room (max-width: 860px) { .cm-rail { --rail-w: 150px; padding-left: 11px; } .cm-phases { font-size: 13px; } .cm-phases li[data-state="now"] b { font-size: 14.5px; } }

/* ---------- the scene: Mira's whole-scene takes over the approved poster ---------- */
.cm-scene { position: relative; z-index: 0; margin: 0; width: 100%; aspect-ratio: 1.85; overflow: hidden; background: #3a2c22; isolation: isolate; }
.cm-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; display: block; transition: opacity .3s ease; }
.cm-scene[data-video-state="ready"] .cm-poster { opacity: 0; }
.cm-stage { position: absolute; inset: 0; overflow: hidden; }
.cm-stage .mira-frame { position: absolute; }
.cm-stage .mira-poster, .cm-stage .mira-layer, .cm-stage .mira-layer video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cm-stage .mira-layer { opacity: 0; transition: opacity .24s linear; }
.cm-stage .mira-layer.on { opacity: 1; }
.cm-stage.mira-reduced .mira-layer { display: none; }
/* 16:9 takes sit in the 3:2 source frame; their top edge melts into the graded poster */
.cm-stage:not([data-mira-frame="full-scene"]) .mira-layer.cropped video { -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 3.5%); mask-image: linear-gradient(to bottom, transparent 0, #000 3.5%); }
.cm-stage .mira-patch { position: absolute; opacity: 0; }
.cm-stage .mira-patch.on { opacity: 1; }
.cm-scene-fade { position: absolute; left: 0; right: 0; bottom: 0; height: 26%; background: linear-gradient(to bottom, #cdad9300, var(--cloth)); pointer-events: none; z-index: 4; }

/* The CardMira mark hangs on the back wall as a small classical painting, placed by script on a
   stretch of wall Mira never crosses (gilt frame, aged canvas, blank brass plate, picture light). */
.cm-painting { --fw: 9px; position: absolute; z-index: 4; pointer-events: none; padding: var(--fw); border-radius: 2px;
  background:
    radial-gradient(circle at calc(var(--fw) * .5) calc(var(--fw) * .5), #fff1b8 0 calc(var(--fw) * .16), #9b6f24 calc(var(--fw) * .2) calc(var(--fw) * .3), transparent calc(var(--fw) * .34)),
    radial-gradient(circle at calc(100% - var(--fw) * .5) calc(var(--fw) * .5), #fff1b8 0 calc(var(--fw) * .16), #9b6f24 calc(var(--fw) * .2) calc(var(--fw) * .3), transparent calc(var(--fw) * .34)),
    radial-gradient(circle at calc(var(--fw) * .5) calc(100% - var(--fw) * .5), #fff1b8 0 calc(var(--fw) * .16), #9b6f24 calc(var(--fw) * .2) calc(var(--fw) * .3), transparent calc(var(--fw) * .34)),
    radial-gradient(circle at calc(100% - var(--fw) * .5) calc(100% - var(--fw) * .5), #fff1b8 0 calc(var(--fw) * .16), #9b6f24 calc(var(--fw) * .2) calc(var(--fw) * .3), transparent calc(var(--fw) * .34)),
    repeating-linear-gradient(90deg, #ffffff12 0 2px, #00000010 2px 4px),
    linear-gradient(135deg, #7a5418 0%, #e9c96f 18%, #a97a26 34%, #f6e0a0 50%, #9a6c22 66%, #dcb55e 82%, #6e4a14 100%);
  box-shadow: inset 0 0 0 1px #3d270c, inset 1.5px 1.5px 0 1px #fff2c470, inset -1.5px -1.5px 0 1px #4a300f90, 0 0 0 1px #2a1a0a,
    0 calc(var(--fw) * 1.3) calc(var(--fw) * 2.4) calc(var(--fw) * .4) #000000a0, 0 calc(var(--fw) * .3) calc(var(--fw) * .5) #00000080;
  filter: brightness(.9) saturate(.95); }
.cm-painting:not([data-placed]) { display: none; }
.cm-painting::after { content: ""; position: absolute; left: 50%; bottom: calc(var(--fw) * .24); width: 24%; height: calc(var(--fw) * .5); transform: translateX(-50%); border-radius: 1px;
  background: linear-gradient(#f3dc98, #b38a3c 60%, #8a6526); box-shadow: 0 0 0 .5px #4a300f, inset 0 .5px 0 #fff6d0; }
.cm-painting::before { content: ""; position: absolute; left: 24%; right: 24%; top: calc(var(--fw) * -1.9); height: calc(var(--fw) * .7); border-radius: 999px;
  background: linear-gradient(#ecd085, #8c6526); box-shadow: 0 1px 2px #00000080, 0 calc(var(--fw) * -.4) calc(var(--fw) * 3) calc(var(--fw) * 1.2) #ffcf8a2e; }
.cm-canvas { position: relative; display: grid; place-items: center; aspect-ratio: 3 / 2; padding: 0 8%; overflow: hidden;
  background: radial-gradient(80% 70% at 50% 28%, #f6e7c2 0%, #e2c993 40%, #b99560 75%, #7d5b33 100%);
  box-shadow: 0 0 0 1px #2a1a0a, 0 0 0 calc(var(--fw) * .14 + 1px) #5a3c14, inset 0 0 calc(var(--fw) * 1.2) #3b240c99; }
.cm-canvas::after { content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply; opacity: .55;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .24 0 0 0 0 .12 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(31deg, transparent 0 9px, #5a3c1a14 9px 10px), repeating-linear-gradient(-58deg, transparent 0 13px, #5a3c1a10 13px 14px);
  background-size: 100% 100%, auto, auto; }
.cm-canvas::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(70% 55% at 50% -5%, #fff4d455, transparent 70%), radial-gradient(130% 110% at 50% 50%, transparent 60%, #2e1b0866 100%); }
.cm-canvas img { position: relative; display: block; width: 100%; height: auto; mix-blend-mode: multiply; filter: sepia(.3) saturate(.85) contrast(.95); opacity: .9; }

/* ---------- the near table: the table's own controls, deck, ribbon, fan and laid cards ---------- */
.cm-table { position: relative; z-index: 2; min-height: var(--table-h); padding: 10px 16px 14px; display: grid; align-content: start; gap: 6px;
  background: linear-gradient(to right, #00000014, transparent 18%, transparent 82%, #00000014), linear-gradient(to bottom, var(--cloth), var(--cloth-2)); }
.cm-table::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35; background-image: repeating-linear-gradient(90deg, #ffffff10 0 1px, transparent 1px 3px), repeating-linear-gradient(0deg, #00000008 0 1px, transparent 1px 4px); }
.cm-table > * { position: relative; }
.cm-room [data-controls] { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; margin: 0; }
.cm-room [data-controls] label, .cm-room [data-controls] > p { margin: 0; padding: 3px 10px; border-radius: 999px; background: #fffdf8cc; color: #33291f; font-size: 13.5px; }
.cm-room [data-controls] select { margin-left: 6px; max-width: 16em; }
.cm-room [data-controls] [data-shuffle] { order: 10; width: 112px; height: 112px; min-height: 0; flex: none; border-radius: 50%; border: 0; padding: 0 10px; display: grid; place-content: center; text-align: center;
  background: radial-gradient(circle at 50% 40%, #3b42a0, var(--navy) 60%, var(--navy-2)); color: #fff; font: 600 17px/1.2 var(--serif);
  box-shadow: 0 10px 30px #1b1e4a66, 0 0 0 6px #ffffff2a; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; transition: transform .15s ease; animation: cm-pulse 2.4s ease-in-out infinite; }
.cm-room [data-controls] [data-shuffle]:hover { transform: scale(1.03); }
.cm-room [data-controls] [data-shuffle].is-holding { transform: scale(.96); animation: none; box-shadow: 0 10px 30px #1b1e4a66, 0 0 0 6px var(--gold); }
@keyframes cm-pulse { 0%, 100% { box-shadow: 0 10px 30px #1b1e4a66, 0 0 0 6px #ffffff2a; } 50% { box-shadow: 0 10px 30px #1b1e4a66, 0 0 0 14px #ffffff10; } }
.cm-room [data-stage] { min-height: 0; }
.cm-room [data-stage] > .muted { margin: 0; text-align: center; font-size: 13px; color: #4f4538; }
.cm-room .result-toolbar:empty { display: none; }

/* the deck spread as a ribbon of card edges: tap where it should be cut */
.cut-ribbon { --k: 18; position: relative; height: 70px; width: min(100%, 720px); margin: 4px auto 0; cursor: pointer; transition: opacity .36s ease, transform .36s cubic-bezier(.2, .7, .2, 1); }
.cut-ribbon.is-waiting { opacity: 0; transform: translateY(-14px) scale(.96); pointer-events: none; }
.cut-ribbon .cut-edge { position: absolute; top: 6px; width: var(--mini-w); height: auto; aspect-ratio: .6; border-radius: 5px; border-width: 2px;
  left: calc(var(--i) * (100% - var(--mini-w)) / max(1, var(--n) - 1)); z-index: var(--i); transform: translateX(calc(12px * clamp(0, var(--i) - var(--k) + 1, 1))); transition: transform .2s ease; }
.cut-ribbon .cut-mark { position: absolute; z-index: 100; top: 0; bottom: 0; width: 4px; border-radius: 2px; background: var(--gold); box-shadow: 0 0 0 3px #c9a22744; pointer-events: none;
  left: calc(var(--k) * (100% - var(--mini-w)) / max(1, var(--n) - 1) + 3px); transition: left .12s; animation: cm-blink 1.4s ease-in-out infinite; }
.cut-ribbon .cut-mark::after { content: ""; position: absolute; left: 50%; top: -10px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--gold); box-shadow: 0 1px 4px #2b252055; }
.cut-ribbon:hover .cut-mark { animation: none; }
@keyframes cm-blink { 50% { opacity: .35; } }

/* the fan of backs to pick from */
.cm-room .complete-fan { position: relative; display: block; height: 92px; width: min(100%, 720px); margin: 4px auto 0; padding: 0; transition: opacity .3s ease; }
.cm-room .complete-fan.is-waiting { opacity: 0; pointer-events: none; }
.cm-room .complete-fan .card-back { position: absolute; top: 10px; width: var(--mini-w); height: auto; min-height: 0; min-width: 0; aspect-ratio: .6; margin: 0; padding: 0; border-radius: 5px; border-width: 2px; font-size: 0; color: transparent; cursor: pointer;
  left: calc(var(--i) * (100% - var(--mini-w)) / max(1, var(--n) - 1)); transform-origin: 50% 160%;
  transform: rotate(calc((var(--i) - (var(--n) - 1) / 2) * 2.6deg * 22 / max(22, var(--n)))); transition: transform .25s ease; }
.cm-room .complete-fan .card-back:hover, .cm-room .complete-fan .card-back:focus-visible { transform: rotate(calc((var(--i) - (var(--n) - 1) / 2) * 2.6deg * 22 / max(22, var(--n)))) translateY(-12px); outline: 3px solid var(--gold); outline-offset: 2px; z-index: 200; }

/* laid cards: one row on the cloth; large layouts use smaller cards and wrap */
.cm-room .spread.complete-staging { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 14px; max-width: none; margin: 6px auto 0; }
.cm-room .spread.complete-staging figure { width: 64px; margin: 0; }
.cm-room .spread.complete-staging:has(figure:nth-child(8)) figure { width: 46px; }
.cm-room .spread.complete-staging:has(figure:nth-child(16)) figure { width: 34px; }
.cm-room .spread.complete-staging .card-back, .cm-room .spread.complete-staging img { width: 100%; height: auto; aspect-ratio: .6; border-radius: 7px; }
.cm-room [data-pending] > :first-child { visibility: hidden; }

/* ---------- the side column: story first, the reading while a round is read ---------- */
.cm-side { width: var(--side-w); flex: none; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cm-story { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; background: var(--cm-paper); border: 1px solid var(--cm-line); border-radius: var(--radius); overflow: hidden; }
.cm-story-cover { position: relative; flex: 0 1 auto; min-height: 96px; max-height: 210px; aspect-ratio: 16 / 9; overflow: hidden; }
.cm-story-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%; }
.cm-story-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 55%, var(--cm-paper) 100%); }
.cm-story-body { flex: 1 1 auto; min-height: 0; padding: 2px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.cm-story-kicker { margin: 0; font-size: 12px; letter-spacing: .12em; color: var(--olive); font-weight: 600; }
.cm-story-body h2 { margin: 0; font: 600 21px/1.25 var(--serif); }
.cm-story-intro { margin: 0 0 4px; font-size: 13.5px; color: var(--cm-muted); }
.cm-chapters { flex: 1 1 auto; min-height: 0; overflow: auto; margin: 0 -6px; }
.cm-chapters ol { list-style: none; margin: 0; padding: 0 6px; display: grid; gap: 2px; }
.cm-chapters a { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 36px; padding: 4px 8px; border-radius: 10px; text-decoration: none; color: var(--cm-ink); font-size: 14px; }
.cm-chapters a:hover, .cm-chapters a:focus-visible { background: #f3efe6; }
.cm-chapters a:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.cm-chapters .ch-no { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #efe7d6; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--cm-muted); }
.cm-chapters .ch-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-chapters .ch-tag { font-size: 11.5px; color: var(--olive); white-space: nowrap; }
.cm-chapters a[data-access="plus"] .ch-tag { color: #6b5aa6; }
.cm-chapters a[data-access="plus"] .ch-title { color: var(--cm-muted); }
.cm-story-cta { align-self: flex-start; margin-top: 4px; }
.cm-reading { flex: 1 1 0; min-height: 0; overflow: auto; background: var(--cm-paper); border: 1px solid var(--cm-line); border-radius: var(--radius); padding: 14px 16px 16px; }
.cm-reading:empty { display: none; }
.cm-side:has(.cm-reading:not(:empty)) .cm-story { display: none; }
.cm-layout:has(.cm-reading:not(:empty)) { --side-w: min(440px, 36vw); }

/* a free chapter opens as one full-width scene below the header */
.cm-story-scene { width: min(1200px, calc(100vw - 24px)); max-width: none; max-height: calc(100svh - 24px); margin: auto; padding: 14px 18px 22px; border: 0; border-radius: var(--radius, 18px); background: #fffdf8; overflow: auto; box-shadow: 0 30px 80px #1f160f66; }
.cm-story-scene::backdrop { background: #1a120ccc; }
.cm-story-close { position: sticky; top: 0; z-index: 5; float: right; }
html.cm-scene-open { overflow: hidden; }

/* reduced motion: every room transition is immediate */
.motion-off .cm-layout *, .motion-off .cm-layout *::before, .motion-off .cm-layout *::after { animation: none !important; transition-duration: 0s !important; }
@media (prefers-reduced-motion: reduce) { .cm-layout *, .cm-layout *::before, .cm-layout *::after { animation: none !important; transition-duration: 0s !important; } }

/* ---------- below 1100 px the side column moves under the room; progress joins the bar ---------- */
@media (max-width: 1100px) {
  .cm-layout { flex-direction: column; align-items: center; }
  .cm-room.room { width: min(100%, max(600px, calc((100svh - var(--header-h) - var(--table-h) - var(--top-pad) - 34px) * 1.85))); }
  .cm-side { width: min(100%, 880px); }
  .cm-layout:has(.cm-reading:not(:empty)) { --side-w: 100%; }
  .cm-story { flex-direction: row; flex: none; }
  .cm-story-cover { flex: 0 0 38%; max-height: none; aspect-ratio: auto; min-height: 220px; }
  .cm-story-cover::after { background: linear-gradient(to right, transparent 60%, var(--cm-paper) 100%); }
  .cm-story-body { padding: 16px 18px; }
  .cm-chapters { max-height: 260px; }
  .cm-reading { flex: none; max-height: 75svh; }
  .cm-rail { position: static; height: auto; width: auto; flex: none; padding: 0; background: none; border: 0; backdrop-filter: none; -webkit-backdrop-filter: none; -webkit-mask-image: none; mask-image: none; }
  .cm-bar .cm-rail, .cm-rail { order: 2; }
  .cm-rail-title { display: none; }
  .cm-phases { --node: 20px; flex-direction: row; gap: 14px; font-size: 12.5px; padding: 0; }
  .cm-phases::before, .cm-phases::after { display: none; }
  .cm-phases li { grid-template-columns: var(--node) auto; gap: 6px; align-items: center; }
  .cm-phases .step-body { padding: 0; }
  .cm-phases li[data-state="now"] b { font: 600 13.5px/1.3 inherit; }
  .cm-phases li[data-state="now"] .step-number { animation: none; box-shadow: none; }
}
/* in the narrower layout the rail sits in the bar row, between the plates and the controls */
@media (max-width: 1100px) and (min-width: 721px) {
  .cm-rail { position: absolute; z-index: 9; top: 0; height: var(--bar-h); right: 136px; display: flex; align-items: center; }
  .cm-value { display: none; }
  .cm-phases li:not([data-state="now"]) .step-body { display: none; }
}

/* ---------- phones ---------- */
@media (max-width: 720px) {
  /* The chapter list grows with the page; an inner scroller here traps a thumb that starts on it. */
  .cm-chapters { max-height: none; overflow: visible; }
  .cm-layout { --bar-h: auto; --table-h: 204px; --radius: 16px; padding: 0 10px; }
  body:has(.cm-layout) > header { padding-top: 6px; padding-bottom: 6px; }
  .cm-room.room { width: 100%; }
  .cm-bar { position: static; height: auto; flex-wrap: wrap; gap: 8px 10px; padding: 8px 10px; background: linear-gradient(to bottom, #241a13, #2e2219); }
  .cm-room .cm-plaque { min-height: 36px; padding: 3px 10px 3px 5px; }
  .cm-room .cm-plaque .emblem { width: 24px; height: 24px; }
  .plaque-text b { font-size: 14px; }
  .plaque-text small { display: none; }
  .cm-value { display: none; }
  .cm-rail { position: static; order: 1; height: auto; padding: 0 12px 8px; color: #f7efe2; background: #2e2219; }
  .cm-settings { position: static; order: 2; width: auto; max-width: none; margin: 6px 10px 0; }
  .cm-chat { position: static; transform: none; width: 100%; padding: 8px 12px; background: var(--cm-paper); border-bottom: 1px solid var(--cm-line); gap: 4px; order: 3; }
  .mira-history { display: none; }
  .mira-bubble { box-shadow: none; background: #f6f1e7; }
  .cm-room .cm-chat .mira-message .mira-say, .cm-room .cm-chat .mira-message [data-status] { font-size: 13px; }
  .cm-scene { aspect-ratio: 1.15; order: 4; }
  .cm-table { order: 5; padding: 8px 10px 12px; }
  .cm-room [data-controls] [data-shuffle] { width: 100px; height: 100px; font-size: 16px; }
  .cut-ribbon, .cm-room .complete-fan { --mini-w: 30px; }
  .cm-side { width: 100%; }
  .cm-story { flex-direction: column; }
  .cm-story-cover { flex: none; aspect-ratio: 16 / 9; min-height: 0; }
  .cm-story-cover::after { background: linear-gradient(to bottom, transparent 55%, var(--cm-paper) 100%); }
  .cm-story-body { padding: 2px 14px 14px; }
}

/* ---------- entrance door (ported from the prototype door.css; built by cardmira-room.js) ---------- */
/* Round 5 review (2026-10-16): the card room's entrance. On arrival the room is behind an old
   arched double door: carved walnut leaves, the two table emblems in brass medallions with
   their nameplates, two heavy brass ring knockers, candle sconces and warm light through the
   seam. Choosing a leaf knocks, swings both leaves in and walks through into the room, where
   Mira nods hello. Everything is drawn here (no new images); sizes follow the room box through
   container units, so it fits the room at every width. The doorway is a real opening: the wall
   and the arch carry an arch-shaped hole (--hole, the same 50% / 30% arch as the leaves), so
   the live room shows through as the leaves swing in, and zooming the entrance past the
   viewer (near things grow fast, the room stays put) is the walk inside. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.door { position: absolute; inset: 0; z-index: 40; overflow: hidden; border-radius: inherit; container: door / size; }
.door[hidden] { display: none; }
.door-stage { --floor: 80cqh; --ph: min(74cqh, 118cqw); --pw: calc(var(--ph) * .68); --arch-v: 30%;
  --hole: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 100V30A50 30 0 0 1 100 30V100Z'/%3E%3C/svg%3E");
  position: absolute; inset: 0; transform-origin: 50% calc(var(--floor) - var(--ph) * .46); will-change: transform; }

/* the wall: dark plaster with a faint gilt lattice, candle light, a vignette and the floor */
.door-wall { position: absolute; inset: 0;
  -webkit-mask: linear-gradient(#000 0 0), var(--hole) calc(50cqw - var(--pw) * .41) calc(var(--floor) - var(--ph) * .93) / calc(var(--pw) * .82) calc(var(--ph) * .93) no-repeat;
  -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0), var(--hole) calc(50cqw - var(--pw) * .41) calc(var(--floor) - var(--ph) * .93) / calc(var(--pw) * .82) calc(var(--ph) * .93) no-repeat; mask-composite: exclude;
  background:
    radial-gradient(26cqmin 24cqmin at calc(50% - var(--pw) / 2 - 9cqw) 31cqh, #ffb45a2e, transparent 72%),
    radial-gradient(26cqmin 24cqmin at calc(50% + var(--pw) / 2 + 9cqw) 31cqh, #ffb45a2e, transparent 72%),
    radial-gradient(calc(var(--pw) * .9) calc(var(--ph) * .7) at 50% 70%, #ff9f3a1c, transparent 70%),
    radial-gradient(130% 100% at 50% 42%, transparent 40%, #000000b8 100%),
    repeating-linear-gradient(45deg, #d6b0601a 0 1px, transparent 1px 42px),
    repeating-linear-gradient(-45deg, #d6b0601a 0 1px, transparent 1px 42px),
    linear-gradient(#22160f, #2a1a11 55%, #1a100a); }
.door-wall::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(100cqh - var(--floor));
  background: radial-gradient(calc(var(--pw) * .62) 9cqh at 50% 0, #ffbf6a33, transparent 72%), repeating-linear-gradient(90deg, #ffffff06 0 1px, transparent 1px 11cqw), linear-gradient(#130b06, #0b0603);
  box-shadow: 0 -1px 0 #4a2e18, 0 -6px 18px #00000080; }

/* candle sconces either side of the arch */
/* each sconce: an oval brass backplate on the wall, a curved arm, a drip pan and a candle */
.sconce { position: absolute; top: 22cqh; width: 3cqmin; height: 18cqmin; }
.sconce-l { left: calc(50% - var(--pw) / 2 - 9cqw - 1.5cqmin); }
.sconce-r { left: calc(50% + var(--pw) / 2 + 9cqw - 1.5cqmin); }
.sconce-plate { position: absolute; left: 50%; top: 44%; width: 170%; height: 54%; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(60% 50% at 42% 36%, #e9c873, #9a6e26 48%, #4a300f 86%); box-shadow: 0 4px 10px #000000b3, inset 0 0 0 1px #3f280c, inset 0 0 0 .5cqmin #f3d98a40; }
.sconce-arm { position: absolute; left: 50%; top: 52%; width: 40%; height: 26%; transform: translateX(-50%); border-radius: 0 0 50% 50% / 0 0 100% 100%; border: .55cqmin solid #b8892f; border-top: 0; }
.sconce::before { content: ""; position: absolute; z-index: 1; left: 50%; top: 40%; width: 210%; height: 7%; transform: translateX(-50%); border-radius: 50%;
  background: linear-gradient(#f6dd92, #8d6220); box-shadow: 0 2px 4px #000000a6; }
.sconce::after { content: ""; position: absolute; z-index: 1; left: 18%; right: 18%; top: 13%; height: 29%; border-radius: 2px 2px 1px 1px;
  background: linear-gradient(90deg, #cdbf9f, #fff7e6 45%, #bcae8c); box-shadow: 0 1px 2px #0000006b; }
.flame { z-index: 2; }
/* low mist drifting over the floor */
.door-fog { position: absolute; left: -10%; right: -10%; bottom: 4cqh; height: 14cqh; pointer-events: none; opacity: .55; filter: blur(6px);
  background: radial-gradient(40% 50% at 30% 60%, #d9c6a833, transparent 70%), radial-gradient(35% 45% at 70% 55%, #d9c6a82b, transparent 70%); animation: fog 18s ease-in-out infinite alternate; }
@keyframes fog { to { transform: translateX(6%); opacity: .8; } }
.flame { position: absolute; left: 50%; top: 0; width: 90%; height: 16%; margin-left: -45%; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; transform-origin: 50% 100%;
  background: radial-gradient(50% 60% at 50% 68%, #fffcee, #ffd56e 42%, #ff9c2c 72%, transparent 74%);
  box-shadow: 0 0 2cqmin 1cqmin #ffb3474d, 0 0 7cqmin 3.5cqmin #ff9d2e21; animation: flicker 2.3s ease-in-out infinite; }
.sconce-r .flame { animation-delay: -1.1s; animation-duration: 2.7s; }
@keyframes flicker { 0%, 100% { transform: scale(1, 1) rotate(-1deg); opacity: .96; } 22% { transform: scale(.94, 1.08) rotate(2deg); } 47% { transform: scale(1.04, .95) rotate(-2deg); opacity: 1; } 71% { transform: scale(.97, 1.05) rotate(1deg); opacity: .9; } }

/* the arch: carved frame with voussoir lines, gilt mouldings and a CardMira keystone */
.door-portal { position: absolute; left: 50%; top: calc(var(--floor) - var(--ph)); width: var(--pw); height: var(--ph); transform: translateX(-50%); }
.door-portal::after { content: ""; position: absolute; left: 14%; right: 14%; bottom: -2.5%; height: 5%; border-radius: 50%; background: radial-gradient(50% 50% at 50% 30%, #ffc56f73, transparent 72%); filter: blur(3px); pointer-events: none; }
.door-arch { position: absolute; inset: 0; border-radius: 50% 50% 0 0 / 34% 34% 0 0;
  -webkit-mask: linear-gradient(#000 0 0), var(--hole) 50% 100% / 82% 93% no-repeat; -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0), var(--hole) 50% 100% / 82% 93% no-repeat; mask-composite: exclude;
  background:
    repeating-conic-gradient(from -90deg at 50% 34%, #ffffff09 0 1.2deg, transparent 1.2deg 7.5deg),
    radial-gradient(120% 70% at 50% 0%, #ffcf8a1c, transparent 60%),
    linear-gradient(90deg, #1c110a, #3a2416 18%, #2b1a0f 50%, #3a2416 82%, #1c110a);
  box-shadow: 0 0 0 2px #120a04, 0 0 0 4px #b8923f, 0 0 0 5px #f3d98a80, 0 0 0 7px #2a1a0b, 0 22px 60px 12px #000000c0, inset 0 0 0 1px #f3d98a40, inset 0 10px 24px #00000080; }
.keystone { position: absolute; left: 50%; top: -2.2%; width: 17%; aspect-ratio: 1; transform: translateX(-50%); border-radius: 50%; padding: 2.4%; z-index: 3;
  background: conic-gradient(from 30deg, #8d6220, #f6dd92, #a87a2a, #f3d98a, #6e4a14, #e2bf68, #8d6220); box-shadow: 0 5px 12px #000000b3, inset 0 0 0 1px #3f280c; }
.keystone img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #1b1430; box-shadow: inset 0 0 0 2px #2a1a0b; filter: saturate(.9) brightness(.92); }

/* the doorway: a gilt moulding around the hole, and the warm light that floods out first as the
   leaves part (it fades and the room itself is there) */
.door-opening { position: absolute; left: 9%; right: 9%; top: 7%; bottom: 0; border-radius: 50% 50% 0 0 / var(--arch-v) var(--arch-v) 0 0; pointer-events: none;
  box-shadow: 0 0 0 2px #1a0f07, 0 0 0 4px #d8b25a, 0 0 0 5px #fff1b8b3, 0 0 0 7px #8d6220, 0 0 0 9px #1a0f07; }
.door-light { position: absolute; inset: 0; border-radius: inherit; opacity: 0; background: radial-gradient(75% 65% at 50% 55%, #fff1d0 0%, #ffd28a 38%, #d99a4c 75%, #8a5a2a 100%); }

/* the light that leaks through the closed seam and pulses slowly */
.seam-light { position: absolute; z-index: 2; left: 50%; top: 9%; bottom: 0; width: 2px; transform: translateX(-50%); pointer-events: none;
  background: linear-gradient(transparent, #ffe6b0 18%, #ffcf7a 78%, #ffb84d); box-shadow: 0 0 10px 2px #ffc8708c, 0 0 30px 7px #ffb34736; animation: seam 3.4s ease-in-out infinite; }
@keyframes seam { 50% { opacity: .55; box-shadow: 0 0 8px 1px #ffc8706b, 0 0 22px 5px #ffb3472b; } }

/* the two leaves; each is the button that chooses its table */
.door-leaves { position: absolute; left: 9%; right: 9%; top: 7%; bottom: 0; display: flex; perspective: 1700px; }
.leaf { position: relative; flex: 1; margin: 0; padding: 0; border: 0; background: none; cursor: pointer; container-type: inline-size; transform-style: preserve-3d; -webkit-tap-highlight-color: transparent; }
.leaf-l { transform-origin: 0 50%; }
.leaf-r { transform-origin: 100% 50%; }
.leaf:focus-visible { outline: none; }
.leaf-face { position: absolute; inset: 0; overflow: hidden; transition: filter .3s ease;
  background:
    radial-gradient(130% 55% at 50% 0%, #ffcf8a17, transparent 62%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='600'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55 .008' numOctaves='3' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 .1 0 0 0 0 .05 0 0 0 0 .02 0 0 0 1.1 -.35'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E") 0 0 / 100% 100%,
    linear-gradient(90deg, #22130a, #351f11 42%, #2c190d 68%, #1f1108);
  box-shadow: inset 0 0 0 1px #00000099, inset 0 0 0 3px #4a2e1a66, inset 0 0 18px #000000a6; }
.leaf-l .leaf-face { border-top-left-radius: 100% var(--arch-v); box-shadow: inset 0 0 0 1px #00000099, inset 0 0 0 3px #4a2e1a66, inset 0 0 18px #000000a6, inset -2px 0 0 #ffcf7a2e; }
.leaf-r .leaf-face { border-top-right-radius: 100% var(--arch-v); box-shadow: inset 0 0 0 1px #00000099, inset 0 0 0 3px #4a2e1a66, inset 0 0 18px #000000a6, inset 2px 0 0 #ffcf7a2e; }

/* raised, carved panels with a thin gilt bead */
.panel { position: absolute; left: 13%; right: 13%; border-radius: 3px;
  background: linear-gradient(180deg, #ffffff0a, #00000017), linear-gradient(90deg, #3e2617, #2c190e);
  box-shadow: 0 0 0 1px #00000073, inset 0 0 0 1.5px #c19a4566, inset 0 0 0 4px #1a0e0699, inset 3px 4px 8px #000000b3, inset -2px -2px 4px #ffffff12; }
.panel-top { top: 11%; height: 33%; }
.leaf-l .panel-top { border-top-left-radius: 100% 36%; }
.leaf-r .panel-top { border-top-right-radius: 100% 36%; }
.panel-mid { top: 48%; height: 22%; }
.panel-low { top: 74%; height: 21%; }

/* dark iron strap hinges on the outer edges, brass rivets; a column of studs along the seam */
.strap { position: absolute; width: 42%; height: 3cqw; min-height: 6px; background: linear-gradient(#4a3a2a, #1f160e); box-shadow: inset 0 1px 0 #ffffff1f, 0 2px 4px #000000b3;
  background-image: radial-gradient(circle at 18% 50%, #e9c873 0 1.1cqw, transparent 1.4cqw), radial-gradient(circle at 52% 50%, #e9c873 0 1.1cqw, transparent 1.4cqw), linear-gradient(#4a3a2a, #1f160e); }
.strap-a { top: 18%; } .strap-b { top: 86%; }
.leaf-l .strap { left: 0; border-radius: 0 50% 50% 0 / 0 50% 50% 0; }
.leaf-r .strap { right: 0; border-radius: 50% 0 0 50% / 50% 0 0 50%; transform: scaleX(-1); }
.studs { position: absolute; top: 26%; bottom: 4%; width: 4cqw; background: radial-gradient(circle, #d9b45e 0 .8cqw, #5a3a10 1.05cqw, transparent 1.3cqw) 50% 0 / 100% 9cqw repeat-y; opacity: .7; }
.leaf-l .studs { left: 3%; } .leaf-r .studs { right: 3%; }

/* brass medallion with the table's emblem in dark enamel */
.medallion { position: absolute; left: 50%; top: 27.5%; width: 66%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; padding: 8.5%; transition: box-shadow .3s ease;
  background: conic-gradient(from 20deg, #8d6220, #f6dd92, #a87a2a, #f3d98a, #6e4a14, #e2bf68, #8d6220);
  box-shadow: 0 6px 14px #000000b3, inset 0 0 0 1.5px #3f280c, inset 0 0 0 3.5px #fff2c04d; }
.medallion-face { position: relative; display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 40% 34%, #3c2818, #160c05 72%); box-shadow: inset 0 3px 9px #000000d9, inset 0 0 0 2px #2a1a0b, 0 0 0 1.5px #f3d98a80; }
.medallion .emblem { width: 60%; height: 60%; filter: drop-shadow(0 2px 3px #000000b3) saturate(.92); }
.medallion-face::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(60% 42% at 34% 24%, #ffffff2e, transparent 72%); }
/* a slow glint across the brass, so the eye finds the two choices */
.medallion::after { content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: linear-gradient(115deg, transparent 38%, #fff7d659 48%, transparent 58%) 0 0 / 300% 100% no-repeat; animation: glint 6s ease-in-out infinite; }
.leaf-r .medallion::after { animation-delay: 3s; }
@keyframes glint { 0%, 70% { background-position: 120% 0; } 92%, 100% { background-position: -40% 0; } }

/* the table's nameplate, the same look as the plates in the room bar */
.leaf-plate { position: absolute; left: 50%; top: 50.5%; width: 78%; transform: translateX(-50%); display: grid; justify-items: center; gap: .6cqw; padding: 3.2cqw 3cqw 2.8cqw; border-radius: 3cqw; text-align: center; color: #3d2f1f;
  background: linear-gradient(180deg, #f6ecd5, #d6bd8a); box-shadow: 0 4px 10px #000000b3, inset 0 1px 0 #fffaf0, inset 0 0 0 1px #9c7a3a; }
.leaf-plate b { font: 600 11.5cqw/1.15 var(--serif); letter-spacing: .05em; }
.leaf-plate small { font-size: 4.6cqw; letter-spacing: .16em; color: #6f5a3a; }
.leaf-plate::before, .leaf-plate::after { content: ""; position: absolute; top: 50%; width: 2.4cqw; height: 2.4cqw; margin-top: -1.2cqw; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3c4, #8d6220 70%); }
.leaf-plate::before { left: 3cqw; } .leaf-plate::after { right: 3cqw; }

/* the big brass ring knocker on each leaf, near the seam */
.knocker { position: absolute; top: 63%; width: 48%; aspect-ratio: 100 / 152; transform: translateX(-50%); pointer-events: none; }
.leaf-l .knocker { left: 60%; } .leaf-r .knocker { left: 40%; }
.knocker svg { position: absolute; left: 0; width: 100%; height: auto; overflow: visible; }
.knocker-mount { top: 0; z-index: 2; }
.knocker-ring { top: 34%; transform-origin: 50% 7%; }

/* hover and focus: the leaf warms, its medallion glows, its ring sways */
.leaf:hover .leaf-face, .leaf:focus-visible .leaf-face { filter: brightness(1.16) saturate(1.06); }
.leaf:hover .medallion, .leaf:focus-visible .medallion { box-shadow: 0 6px 14px #000000b3, inset 0 0 0 1.5px #3f280c, inset 0 0 0 3.5px #fff2c04d, 0 0 26px 6px #ffcf7a59; }
.leaf:hover .knocker-ring, .leaf:focus-visible .knocker-ring { animation: ring-sway 1.5s ease-in-out; }
.leaf:focus-visible .leaf-plate { box-shadow: 0 4px 10px #000000b3, inset 0 1px 0 #fffaf0, 0 0 0 3px var(--gold); }
@keyframes ring-sway { 25% { transform: rotate(6deg); } 55% { transform: rotate(-4deg); } 80% { transform: rotate(1.5deg); } }

.door-foot { position: absolute; left: 5%; right: 5%; bottom: 2.6cqh; display: grid; gap: 1.2cqh; justify-items: center; }
.door-hints { margin: 0; padding: 0; list-style: none; width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 3.5cqw; text-align: center; font: 400 clamp(11px, 1.55cqh, 13.5px)/1.45 var(--sans, system-ui); letter-spacing: .02em; color: #e3d2ad; text-shadow: 0 1px 6px #000; }
.door-hints li { margin: 0; text-wrap: balance; }
.door-caption { margin: 0; text-align: center; font: 500 clamp(12.5px, 2.1cqh, 17px)/1.5 var(--serif); letter-spacing: .14em; color: #f3e2bf; text-shadow: 0 2px 8px #000; }

.door[data-state="opening"] .leaf { cursor: default; }
.door[data-state="opening"] .medallion::after { animation: none; }
.motion-off .flame, .motion-off .door-fog, .motion-off .seam-light, .motion-off .medallion::after, .motion-off .leaf:hover .knocker-ring { animation: none; }
@media (prefers-reduced-motion: reduce) { .flame, .door-fog, .seam-light, .medallion::after, .leaf:hover .knocker-ring { animation: none; } }

/* phones: the room is tall and narrow; the arch takes the width */
@media (max-width: 720px) {
  .door-stage { --ph: min(70cqh, 128cqw); }
  .door-caption { letter-spacing: .06em; font-size: 13px; }
  .door-hints { font-size: 11.5px; gap: 3cqw; }
  .sconce { top: 18cqh; }
}

/* October 17 repair: separate the room chrome from Mira's image and give each
   decision one place. The media coordinates remain relative to the same scene. */
.cm-room[data-door-pending] > :not(.door) { visibility: hidden; }
.cm-room .cm-bar { position: relative; order: 0; flex: none; top: auto; left: auto; right: auto; background: #241d18; backdrop-filter: none; }
.cm-room .cm-scene { order: 1; }
.cm-room .cm-chat { position: relative; order: 2; left: auto; right: auto; top: auto; bottom: auto; transform: none; width: 100%; min-height: 70px; padding: 10px 20px; display: flex; align-items: center; gap: 12px; background: #f6f0e6; border-bottom: 1px solid #d9cebc; }
.cm-room .cm-chat .mira-history { display: none; }
.cm-room .cm-chat .mira-message { flex: 1; align-items: center; gap: 12px; }
.cm-room .cm-chat .mira-bubble { background: none; backdrop-filter: none; box-shadow: none; padding: 0; border-radius: 0; }
.cm-room .cm-chat .mira-avatar { box-shadow: none; width: 32px; height: 32px; }
.cm-room .cm-chat .msg-name { font-size: 10px; letter-spacing: .06em; }
.cm-room .cm-chat .chat-action { margin: 0; flex: none; padding: 8px 10px; min-height: 36px; background: transparent; border: 1px solid #d7ccba; border-radius: 8px; box-shadow: none; font-size: 12px; }
.cm-room .motion-status:not([hidden]) { position: absolute; bottom: 100%; left: 12px; max-width: calc(100% - 100px); margin: 0 0 8px; padding: 6px 10px; font-size: 12px; background: #fff8e8eb; }
.cm-room .cm-table { order: 3; min-height: 126px; padding: 16px 20px; background: #e6d7bf; gap: 12px; }
.cm-room .cm-table::before { opacity: .13; }
.cm-room [data-controls] { gap: 12px; }
.cm-room [data-controls] label { border-radius: 10px; background: transparent; padding: 0; }
.cm-room [data-controls] .cm-spread-picker { width: min(340px, 100%); min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 80px; align-items: center; gap: 2px 10px; padding: 10px 12px 10px 16px; border: 1px solid #cdbd9f; border-radius: 12px; background: #fffaf0; box-shadow: 0 2px 6px #3726190a; }
.cm-picker-label { font-size: 11px; color: #74634c; letter-spacing: .07em; }
.cm-room [data-controls] .cm-spread-picker select { grid-column: 1; width: 100%; min-width: 0; max-width: none; min-height: 32px; margin: 0; padding: 2px 22px 2px 0; border: 0; border-radius: 3px; color: #302b25; background-color: transparent; font-size: 15px; font-weight: 600; cursor: pointer; }
.cm-spread-diagram { position: relative; grid-column: 2; grid-row: 1 / 3; height: 48px; width: 80px; border-left: 1px solid #e3d8c3; }
.cm-spread-diagram i { position: absolute; width: min(14px, calc(65px / var(--cols))); height: min(24px, calc(43px / var(--rows))); left: calc(12px + var(--x) * 65px / var(--cols)); top: calc(3px + var(--y) * 43px / var(--rows)); border: 1px solid #b19865; border-radius: 2px; background: #3e466a; box-shadow: inset 0 0 0 2px #ede2c9; transform: rotate(var(--r)); }
.cm-room [data-controls] [data-shuffle] { width: 142px; height: 60px; min-height: 48px; border-radius: 12px; padding: 12px 24px; font-size: 17px; background: linear-gradient(150deg,#3d457b,#292f5b); box-shadow: 0 4px 12px #28254a22,inset 0 1px 0 #ffffff26; animation: none; }
.cm-room [data-controls] [data-shuffle]:hover { transform: translateY(-1px); }
.cm-room [data-controls] [data-shuffle].is-holding { transform: translateY(1px); box-shadow: inset 0 0 0 2px #d9bd77; }
.cm-room .music-control { width: auto; min-width: 40px; gap: 5px; display: inline-flex; padding: 0 10px; border-radius: 8px; }
.cm-room [data-music-state] { font-weight: 500; font-size: 11px; line-height: 1.2; white-space: nowrap; }
.cm-room .cm-round { min-width: 36px; height: 36px; }
.cm-room .cm-settings { top: calc(var(--bar-h) + 8px); }
.cm-return-links { flex: none; display: flex; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; font-size: 12px; }
.cm-return-links[hidden] { display: none; }
.cm-story-cta { width: 100%; border-radius: 10px; min-height: 44px; text-align: center; font-size: 14px; }
@media (min-width: 1101px) {
  .cm-room .cm-rail { --rail-w: 68px; top: calc(var(--bar-h) + 16px); right: 12px; height: calc(100cqw / 1.85 - 32px); padding: 12px 6px; border: 1px solid #ecd6a42b; border-radius: 14px; background: #21180dc2; backdrop-filter: blur(8px); -webkit-mask-image: none; mask-image: none; }
  .cm-room .cm-rail-title { text-align: center; font-size: 10px; letter-spacing: .02em; line-height: 1.5; margin-bottom: 12px; }
  .cm-room .cm-phases { --node: 26px; gap: 14px; font-size: 11px; align-items: center; padding: 0; }
  .cm-room .cm-phases li { display: flex; flex-direction: column; gap: 6px; align-items: center; width: 100%; text-align: center; }
  .cm-room .cm-phases .step-body { padding: 2px 0; background: #281e13; border-radius: 4px; }
  .cm-room .cm-phases .step-body b { font-weight: 500; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
  .cm-room .cm-phases::before,.cm-room .cm-phases::after { left: calc(50% - 1px); width: 2px; }
  .cm-room .cm-phases li[data-state="now"] .step-number { animation: none; box-shadow: 0 0 0 3px #c9a22725; }
}
/* Strong scope prevents generic button backgrounds from filling the arched corners. */
.cm-room .door .leaf { background: transparent; border: 0; border-radius: 0; padding: 0; min-height: 0; box-shadow: none; }
.cm-room .door .leaf:focus-visible { outline: none; }
.cm-room .door .leaf:focus-visible .leaf-plate { outline: 3px solid #fff1b0; outline-offset: 4px; }
@media (max-width: 1100px) and (min-width: 721px) {
  .cm-room .cm-rail { top: calc(var(--bar-h) + 12px); right: 12px; height: auto; padding: 8px 10px; border-radius: 12px; background: #21180dbd; }
}
@media (max-width: 720px) {
  .cm-room .cm-bar { order: 0; }
  .cm-room .cm-rail { order: 1; }
  .cm-room .cm-scene { order: 2; aspect-ratio: 1.5; }
  .cm-room .cm-chat { order: 3; min-height: 76px; padding: 10px 12px; flex-wrap: wrap; }
  .cm-room .cm-chat .chat-action { margin-left: 44px; padding: 2px 6px; min-height: 28px; }
  .cm-room .cm-table { order: 4; min-height: 158px; padding: 12px; }
  .cm-room [data-controls] .cm-spread-picker { width: 100%; }
  .cm-room [data-controls] [data-shuffle] { height: 48px; width: 100%; font-size: 16px; }
  .cm-room [data-music-state] { display: none; }
  .cm-room .music-control { padding: 0; width: 36px; justify-content: center; }
  .cm-room .cm-settings { order: 1; }
}

@media (max-width:720px) {
  .cm-room .cm-chat .mira-message { flex: 1 1 100%; }
  .cm-room .cm-chat .chat-action { margin-left: 44px; }
}
@media (min-width:361px) and (max-width:720px) {
  .cm-room .cm-bar { flex-wrap: nowrap; padding: 8px; gap: 6px; }
  .cm-room .cm-plaques { flex: 1; min-width: 0; gap: 5px; }
  .cm-room .cm-plaque { gap: 4px; padding: 5px; min-height: 40px; }
  .cm-room .cm-plaque .emblem { width: 20px; height: 20px; }
  .cm-room .plaque-text b { font-size: 12px; }
  .cm-room .cm-bar-controls { gap: 4px; }
  .cm-room .cm-round { width: 36px; min-width: 36px; height: 40px; }
}
@media (min-width:1101px) {
  .cm-room .cm-phases .step-body b { display:flex; flex-direction:column; font-size:10.5px; }
  .cm-room .cm-phases .phase-action { white-space:nowrap; }
  .cm-room .cm-phases .phase-divider { display:none; }
}

/* Round 6 is opt-in through the reviewed manifest frame. The scene keeps the room's own
   proportions so the table fits one screen; the player frames the native scene through the
   reviewed windows, top-anchored, so the crown, hands and shared coordinates never use poster
   pixels. A manifest without windows is fitted whole. On wide screens the native scene is a
   little shorter than the legacy crop so the cut ribbon below it stays on one 900px screen. */
@media (min-width: 1101px) { .cm-room .cm-scene[data-mira-frame="full-scene"] { aspect-ratio: 1.95; } }
.cm-stage[data-mira-frame="full-scene"] .mira-layer video,
.cm-stage[data-mira-frame="full-scene"] .mira-poster { object-fit: contain; -webkit-mask-image: none; mask-image: none; }
.cm-stage[data-mira-frame="full-scene"].mira-frame-ready .mira-poster { visibility: hidden; }

/* A quiet continuation after the reader explicitly finishes, with no new motion. */
.cm-reading-finish { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--cm-line); }
.cm-reading-finish button { width: 100%; min-height: 44px; white-space: normal; }
.cm-next-step { margin-top: 18px; padding: 16px 0 0; border-top: 1px solid var(--cm-line); }
.cm-next-step:focus-visible { outline: 2px solid var(--navy); outline-offset: 4px; border-radius: 8px; }
.cm-next-step .cm-next-kicker { margin: 0 0 4px; color: var(--navy); font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.cm-next-step h2 { margin: 0 0 8px; font-size: 19px; line-height: 1.4; }
.cm-next-step .cm-next-message { margin: 0 0 16px; font-size: 14px; line-height: 1.7; }
.cm-next-primary { display: flex; align-items: center; gap: 10px; min-height: 64px; padding: 13px; border: 1px solid #343f76; border-radius: 12px; background: #343f76; color: #fff; text-decoration: none; }
.cm-next-primary:hover { background: #28325f; color: #fff; }
.cm-next-primary img { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; }
.cm-next-copy { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.cm-next-copy strong { font-size: 15px; line-height: 1.5; }
.cm-next-copy > span { font-size: 12px; line-height: 1.5; color: #e5e8f5; }
.cm-next-arrow { flex: 0 0 auto; font-size: 20px; }
/* Reading prompts by position: local text only, so the list is always readable even when no AI is offered. */
.cm-synthesis { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--cm-line); }
.cm-synthesis h3 { margin: 0 0 6px; font-size: 14px; line-height: 1.4; }
.cm-synthesis-lead { margin: 0 0 6px; font-size: 13px; line-height: 1.55; }
.cm-synthesis-list { display: grid; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.cm-synthesis-prompt { display: block; }
.cm-synthesis [data-synthesis-cta] { min-height: 44px; }
.cm-next-alternatives { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cm-next-alternatives > .secondary { display: flex; flex: 1 1 125px; align-items: center; justify-content: center; min-width: 0; min-height: 44px; padding: 9px 10px; border: 1px solid var(--cm-line); border-radius: 9px; background: transparent; color: var(--cm-ink); font: inherit; font-size: 13px; line-height: 1.5; text-align: center; text-decoration: none; white-space: normal; overflow-wrap: anywhere; }
.cm-next-alternatives > .secondary:hover { background: #efeadf; }
.cm-next-step .cm-next-save-hint { margin: 10px 0 0; color: #6d675b; font-size: 12px; line-height: 1.6; }

/* Home brand first screen above the live room (Figma e8qVziFnmNkCj2aqKiVmSF 38:131 desktop, 38:163 mobile). */
.cm-hero { --cm-ink: #2b2520; --cm-muted: #6f6458; --serif: "Songti SC", "Noto Serif SC", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  position: relative; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; align-items: center;
  min-height: clamp(560px, calc(100svh - 150px), 800px); margin: -22px -28px 28px; padding: 48px 56px 56px; overflow: clip;
  background: radial-gradient(ellipse 46% 58% at 76% 50%, #e9ecf7 0%, #e9ecf700 72%), #faf8f3; }
.cm-hero-copy { min-width: 0; }
.cm-hero-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 34px; }
.cm-hero-brand img { width: 62px; height: 62px; flex: none; }
.cm-hero-brand > span { display: grid; gap: 2px; }
.cm-hero-name { font: 500 30px/1.2 var(--serif); color: #00268c; letter-spacing: .01em; }
.cm-hero-slogan { font-size: 15px; line-height: 1.4; color: var(--cm-muted); }
.cm-hero-title { margin: 0; font: 600 clamp(42px, 5vw, 72px)/1.14 var(--serif); letter-spacing: 0; color: var(--cm-ink); overflow-wrap: anywhere; }
.cm-hero-sub { margin: 10px 0 0; font: 500 clamp(22px, 2.2vw, 30px)/1.3 var(--serif); letter-spacing: .02em; color: #b8955a;
  background: linear-gradient(90deg, #dbbe84, #9e7c46); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; width: fit-content; max-width: 100%; }
.cm-hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }
.cm-hero-cta { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 26px; border: 1.5px solid #00268c;
  border-radius: 999px; font-weight: 650; font-size: 16px; line-height: 1.3; text-decoration: none; text-align: center; }
.cm-hero-cta-primary { background: #00268c; color: #fff; }
.cm-hero-cta-primary:hover { background: #001a66; }
.cm-hero-cta-outline { background: transparent; color: #00268c; }
.cm-hero-cta-outline:hover { background: #00268c0f; }
.cm-hero-art { position: relative; width: 100%; max-width: 640px; justify-self: end; aspect-ratio: 1.12; }
.cm-hero-card { position: absolute; width: 36%; aspect-ratio: .68; border: 2px solid #dbbe84; border-radius: 18px; box-shadow: 0 18px 40px #2b25202e; }
.cm-hero-card-gold { right: 17%; top: 0; transform: rotate(18deg); background: linear-gradient(150deg, #e6cf9c, #b8955a); }
.cm-hero-card-navy { right: -3%; top: 5%; transform: rotate(-14deg); background: linear-gradient(160deg, #2a4fc4, #001a66); }
.cm-hero-device { position: absolute; left: 4%; right: 0; top: 16%; padding: 30px 10px 10px; background: #2c2820; border-radius: 22px; box-shadow: 0 28px 60px #2b252038; }
.cm-hero-dots { position: absolute; left: 16px; top: 11px; display: flex; gap: 7px; }
.cm-hero-dots i { width: 9px; height: 9px; border-radius: 50%; background: #ef6a5e; }
.cm-hero-dots i:nth-child(2) { background: #f4bf4f; }
.cm-hero-dots i:nth-child(3) { background: #61c454; }
.cm-hero-screen { display: block; width: 100%; height: auto; border-radius: 12px; }
.cm-hero-mira { position: absolute; left: -4%; bottom: 4%; display: flex; align-items: center; gap: 12px; max-width: 72%; padding: 12px 20px 12px 12px;
  background: #fff; border-radius: 18px; box-shadow: 0 16px 36px #2b25202a; }
.cm-hero-mira img { width: 52px; height: 52px; flex: none; border-radius: 50%; object-fit: cover; object-position: 50% 18%; }
.cm-hero-mira span { display: grid; gap: 2px; min-width: 0; }
.cm-hero-mira b { font-size: 15px; color: var(--cm-ink); }
.cm-hero-mira small { font-size: 12.5px; line-height: 1.45; color: var(--cm-muted); }
#cardmira-room { scroll-margin-top: 12px; }
@media (prefers-reduced-motion: no-preference) { html:has(.cm-hero) { scroll-behavior: smooth; } }
@media (max-width: 900px) {
  .cm-hero { grid-template-columns: minmax(0, 1fr); gap: 36px; min-height: 0; padding: 40px 28px 44px; }
  .cm-hero-art { justify-self: stretch; max-width: 560px; }
}
@media (max-width: 600px) {
  .cm-hero { margin: -10px -12px 20px; padding: 30px 20px 32px; gap: 30px; }
  .cm-hero-brand { margin-bottom: 18px; gap: 12px; }
  .cm-hero-brand img { width: 48px; height: 48px; }
  .cm-hero-name { font-size: 24px; }
  .cm-hero-slogan { font-size: 13.5px; }
  .cm-hero-title { font-size: min(42px, 10.6vw); }
  .cm-hero-sub { font-size: 22px; margin-top: 6px; }
  .cm-hero-actions { margin-top: 24px; gap: 12px; }
  .cm-hero-cta { padding: 10px 22px; font-size: 15px; }
  .cm-hero-art { aspect-ratio: 1.02; }
  .cm-hero-device { left: 0; right: 6%; top: 8%; border-radius: 18px; padding: 26px 8px 8px; }
  .cm-hero-card { width: 44%; }
  .cm-hero-card-gold { right: -10%; top: 2%; }
  .cm-hero-card-navy { right: -22%; top: 12%; }
  .cm-hero-mira { left: 0; bottom: 0; max-width: 82%; padding: 10px 16px 10px 10px; }
  .cm-hero-mira img { width: 46px; height: 46px; }
}
