/* Modes: home, campaign, lessons, runner, arcade, learn, progress. */
.level-pill { font-family: var(--font-display); font-weight: 800; font-size: 0.85rem; }

/* ---------- mastery dots ---------- */
.mdot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--ring-track); border: 1px solid var(--line-strong); }

.mdot.m1 { background: var(--surface-3); }

.mdot.m2 { background: color-mix(in srgb, var(--ch) 45%, var(--surface)); border-color: transparent; }

.mdot.m3 { background: var(--ch); border-color: transparent; }

.mdot.m4 { background: var(--ch); border-color: transparent; box-shadow: 0 0 0 2px color-mix(in srgb, var(--ch) 35%, transparent), 0 0 10px var(--ch); }

/* ---------- THE SHELF (signature) ---------- */
.shelf-wrap { display: grid; gap: 1.1rem; }

.shelf { position: relative; padding: 0.25rem 0.5rem 0.75rem; }

.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.4rem; }

.shelf-title { font-family: var(--font-display); font-weight: 800; font-size: 0.98rem; display: flex; align-items: center; gap: 0.5rem; }

.shelf-title .num { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ch); letter-spacing: 0.1em; }

.shelf-items { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; padding: 0 6px 8px; min-height: 36px; }

.shelf-board { height: 7px; border-radius: 2px; background: linear-gradient(180deg, color-mix(in srgb, var(--text) 85%, var(--ch)), color-mix(in srgb, var(--text) 55%, var(--bg))); box-shadow: 0 6px 14px rgba(0,0,0,0.35); }

:root[data-theme="light"] .shelf-board { background: linear-gradient(180deg, #8C7351, #5E4A33); box-shadow: 0 6px 14px rgba(21,26,43,0.15); }

.tile {
  --w: 22px; width: var(--w); height: 26px; border-radius: 5px 5px 2px 2px; border: 1.5px solid color-mix(in srgb, var(--ch) 45%, transparent);
  background: transparent; position: relative; transition: transform 0.15s, box-shadow 0.15s; cursor: pointer; padding: 0;
}

.tile:hover { transform: translateY(-3px); z-index: 2; }

.tile.m0 { border-style: dashed; opacity: 0.55; }

.tile.m1 { background: var(--surface-3); border-color: var(--line-strong); }

.tile.m2 { height: 26px; background: linear-gradient(180deg, transparent 50%, color-mix(in srgb, var(--ch) 60%, var(--surface)) 50%); }

.tile.m3 { height: 30px; background: var(--ch); border-color: transparent; }

.tile.m4 { height: 34px; background: linear-gradient(160deg, color-mix(in srgb, var(--ch) 80%, white) 0%, var(--ch) 45%, color-mix(in srgb, var(--ch) 80%, black) 100%); border-color: transparent; box-shadow: 0 0 12px color-mix(in srgb, var(--ch) 60%, transparent); }

.tile.pursuit::after { content: ''; position: absolute; top: -5px; right: -5px; width: 9px; height: 9px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--surface); animation: pulse 1.2s ease-in-out infinite; }

.tile.due::before { content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--text); opacity: 0.7; }

.shelf-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.75rem; color: var(--muted); align-items: center; }

.shelf-legend .tile { cursor: default; --w: 14px; height: 16px; }

.shelf-legend .tile:hover { transform: none; }

/* ---------- readiness hero ---------- */
.hero { display: grid; grid-template-columns: auto 1fr; gap: 1.4rem; align-items: center; }

.hero .big { font-family: var(--font-display); font-size: 2.6rem; font-weight: 800; line-height: 1; }

@media (max-width: 640px) { .hero { grid-template-columns: 1fr; text-align: center; justify-items: center; } }

/* ---------- question runner ---------- */
.runner { max-width: 820px; margin: 0 auto; }

.runner-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; flex-wrap: wrap; }

.runner-head .bar { width: 100%; }

.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem 1.4rem; position: relative; overflow: hidden; }

.qcard::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--ch); }

.qmeta { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.8rem; }

.stem { font-size: 1.12rem; line-height: 1.55; font-weight: 500; }

.stem .blank { display: inline-block; min-width: 4.5rem; border-bottom: 2px solid var(--accent); transform: translateY(2px); }

.options { display: grid; gap: 0.55rem; margin-top: 1.1rem; }

.option {
  display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 0.7rem; text-align: left; padding: 0.75rem 0.9rem; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-weight: 500; line-height: 1.4; transition: background 0.12s, border-color 0.12s, transform 0.08s;
}

.option:hover:not(:disabled) { background: var(--surface-3); border-color: var(--line-strong); }

.option:disabled { cursor: default; }

.option .key { font-family: var(--font-mono); font-size: 0.75rem; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--bg-2); color: var(--muted); border: 1px solid var(--line); }

.option.correct { background: color-mix(in srgb, var(--good) 20%, var(--surface)); border-color: var(--good); }

.option.correct .key { background: var(--good); color: #052e16; border-color: transparent; }

.option.wrong { background: color-mix(in srgb, var(--bad) 20%, var(--surface)); border-color: var(--bad); animation: shake 0.3s; }

.option.wrong .key { background: var(--bad); color: #3f0a14; border-color: transparent; }

.option.dim { opacity: 0.5; }

.option.picked { outline: 2px solid var(--accent); }

.explain { margin-top: 1rem; padding: 0.95rem 1.05rem; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); animation: rise 0.25s ease-out; }

.explain .verdict { font-family: var(--font-display); font-weight: 800; font-size: 1.05rem; display: flex; align-items: center; gap: 0.5rem; }

.explain .verdict.ok { color: var(--good); }

.explain .verdict.no { color: var(--bad); }

.runner-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 1rem; flex-wrap: wrap; }

.combo { font-family: var(--font-mono); font-weight: 700; color: var(--accent); }

.hearts { font-size: 1.1rem; letter-spacing: 2px; }

.timer { font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem; padding: 0.3rem 0.7rem; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); }

.timer.low { color: var(--bad); border-color: var(--bad); animation: pulse 0.8s infinite; }

.reason { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; }

.pursuit-banner { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.8rem; border-radius: 10px; background: color-mix(in srgb, var(--bad) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bad) 45%, transparent); font-size: 0.85rem; margin-bottom: 0.8rem; }

.pursuit-banner .pips { display: flex; gap: 4px; margin-left: auto; }

.pursuit-banner .pip { width: 10px; height: 10px; border-radius: 50%; background: var(--ring-track); border: 1px solid var(--line-strong); }

.pursuit-banner .pip.on { background: var(--good); border-color: transparent; }

.xp-float { position: fixed; z-index: 95; font-family: var(--font-mono); font-weight: 700; color: var(--accent); pointer-events: none; animation: floatUp 1.1s ease-out forwards; transform: translateX(-50%); text-shadow: 0 2px 8px rgba(0,0,0,0.5); }

details.learn-more { margin-top: 0.8rem; }

details.learn-more summary { cursor: pointer; font-weight: 700; color: var(--info); list-style: none; }

details.learn-more summary::-webkit-details-marker { display: none; }

details.learn-more summary::before { content: '▸ '; }

details.learn-more[open] summary::before { content: '▾ '; }

/* ---------- concept card ---------- */
.concept { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 1rem 1.1rem; position: relative; overflow: hidden; }

.concept::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ch); }

.concept h3 { font-size: 1.15rem; margin-bottom: 0.2rem; }

.concept .def { font-size: 1rem; font-weight: 600; }

.concept .sec { margin-top: 0.6rem; font-size: 0.92rem; }

.concept .sec b { display: block; font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.1rem; }

.concept .trap { border-left: 3px solid var(--warn); padding-left: 0.6rem; }

.concept .contrast { border-left: 3px solid var(--info); padding-left: 0.6rem; }

.concept .mnemonic { background: var(--bg-2); border-radius: 8px; padding: 0.45rem 0.6rem; font-style: italic; }

.concept .mstate { position: absolute; right: 0.9rem; top: 0.9rem; display: flex; gap: 0.4rem; align-items: center; }

table.fig { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 0.5rem; }

table.fig th, table.fig td { border: 1px solid var(--line-strong); padding: 0.35rem 0.5rem; text-align: left; vertical-align: top; }

table.fig th { background: var(--surface-2); font-family: var(--font-display); font-weight: 700; }

table.fig td:first-child { font-weight: 700; }

ul.fig { margin: 0.4rem 0 0; padding-left: 1.2rem; font-size: 0.9rem; }

ul.fig li { margin: 0.15rem 0; }

/* ---------- flashcards ---------- */
.flash { perspective: 1200px; max-width: 640px; margin: 0 auto; }

.flash-inner { position: relative; min-height: 300px; transition: transform 0.5s cubic-bezier(.2,.8,.2,1); transform-style: preserve-3d; }

.flash.flipped .flash-inner { transform: rotateY(180deg); }

.flash-face { position: absolute; inset: 0; backface-visibility: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 0.6rem; cursor: pointer; }

.flash-face.back { transform: rotateY(180deg); text-align: left; align-items: stretch; justify-content: flex-start; overflow: auto; }

.flash-face .term { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.4rem, 3vw, 2rem); }

.flash-grade { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-top: 1rem; }

.flash-grade .btn { flex-direction: column; gap: 0; padding: 0.6rem 0.4rem; }

.flash-grade .btn small { font-weight: 500; color: var(--muted); font-size: 0.7rem; }

/* ---------- activities ---------- */
.order-list { display: grid; gap: 0.5rem; }

.order-item { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 0.6rem; padding: 0.65rem 0.8rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); text-align: left; }

.order-item .idx { font-family: var(--font-mono); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--line); font-size: 0.8rem; }

.order-item.placed .idx { background: var(--ch); color: #0B0F1A; border-color: transparent; }

.order-item.ok { border-color: var(--good); }

.order-item.bad { border-color: var(--bad); }

.order-item .mv { display: flex; gap: 0.25rem; }

.pool { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.7rem; border: 1px dashed var(--line-strong); border-radius: 12px; min-height: 56px; }

.token { padding: 0.45rem 0.75rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-strong); font-weight: 600; font-size: 0.9rem; text-align: left; }

.token.sel { outline: 2px solid var(--accent); }

.token.ok { border-color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--surface)); }

.token.bad { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 18%, var(--surface)); }

.buckets { display: grid; gap: 0.7rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-top: 0.8rem; }

.bucket { border: 1px solid var(--line-strong); border-radius: 12px; padding: 0.6rem; min-height: 120px; background: var(--surface); cursor: pointer; transition: border-color 0.15s, background 0.15s; }

.bucket:hover, .bucket.target { border-color: var(--ch); background: color-mix(in srgb, var(--ch) 8%, var(--surface)); }

.bucket h4 { font-size: 0.9rem; margin-bottom: 0.4rem; }

.bucket .items { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }

.match-grid .col { display: grid; gap: 0.5rem; align-content: start; }

.match-item { padding: 0.6rem 0.75rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); text-align: left; font-size: 0.9rem; min-height: 46px; display: flex; align-items: center; gap: 0.5rem; }

.match-item.sel { outline: 2px solid var(--accent); }

.match-item.paired { border-color: var(--ch); }

.match-item.ok { border-color: var(--good); }

.match-item.bad { border-color: var(--bad); }

.match-item .tag { font-family: var(--font-mono); font-size: 0.65rem; width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; background: var(--ch); color: #0B0F1A; flex-shrink: 0; }

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

/* ---------- campaign ---------- */
.world { display: grid; grid-template-columns: 56px 1fr auto; gap: 1rem; align-items: center; padding: 1rem 1.1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); transition: transform 0.15s, border-color 0.15s; }

.world:hover { transform: translateX(3px); border-color: color-mix(in srgb, var(--ch) 50%, var(--line)); }

.world .ico { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; font-size: 1.6rem; background: color-mix(in srgb, var(--ch) 18%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ch) 40%, transparent); }

.world .dots { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 0.35rem; }

.level { display: grid; grid-template-columns: 44px 1fr auto; gap: 0.9rem; align-items: center; padding: 0.9rem 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }

.level .n { font-family: var(--font-display); font-weight: 800; font-size: 1.1rem; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); }

.level.cleared .n { background: var(--ch); color: #0B0F1A; border-color: transparent; }

.level.boss { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), var(--surface)); }

.level.locked { opacity: 0.55; }

.level .acts { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 560px) { .level { grid-template-columns: 44px 1fr; } .level .acts { grid-column: 1 / -1; justify-content: flex-start; } .world { grid-template-columns: 48px 1fr; } .world > :last-child { grid-column: 1 / -1; } }

.carousel { display: grid; gap: 0.8rem; }

.carousel-nav { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }

.dots-nav { display: flex; gap: 5px; }

.dots-nav span { width: 8px; height: 8px; border-radius: 50%; background: var(--ring-track); }

.dots-nav span.on { background: var(--ch); }

/* ---------- results ---------- */
.score-big { font-family: var(--font-display); font-size: clamp(2.6rem, 7vw, 4rem); font-weight: 800; line-height: 1; }

.review-item { padding: 0.9rem 1rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }

.review-item.wrong { border-left: 4px solid var(--bad); }

.review-item.right { border-left: 4px solid var(--good); }

.review-item .opt { padding: 0.2rem 0; font-size: 0.9rem; }

.review-item .opt.correct { color: var(--good); font-weight: 700; }

.review-item .opt.chosen { color: var(--bad); text-decoration: line-through; }

/* ---------- plan ---------- */
.plan-day { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; background: var(--surface); }

.plan-day h3 { display: flex; align-items: center; gap: 0.5rem; }

.task { display: grid; grid-template-columns: 26px 1fr; gap: 0.6rem; align-items: start; padding: 0.45rem 0; border-top: 1px solid var(--line); }

.task:first-of-type { border-top: 0; }

.task input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }

.task.done .t { text-decoration: line-through; color: var(--muted); }

.task .t { font-weight: 600; }

.task .d { font-size: 0.82rem; color: var(--muted); }

.ach { display: grid; grid-template-columns: 44px 1fr; gap: 0.7rem; align-items: center; padding: 0.7rem 0.8rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }

.ach .ico { font-size: 1.6rem; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2); }

.ach.locked { opacity: 0.5; filter: grayscale(1); }

.ach .t { font-weight: 700; font-size: 0.92rem; }

.ach .s { font-size: 0.78rem; color: var(--muted); }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 48px; }

.spark span { flex: 1; background: var(--ch); border-radius: 3px 3px 0 0; min-height: 3px; opacity: 0.85; }

.heat { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }

.heat div { aspect-ratio: 1; border-radius: 4px; background: var(--ring-track); }

.option { border-radius: 14px; }

.option:hover:not(:disabled) { transform: translateX(4px); }

.qcard { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--ch) 25%, var(--line)); }

/* --- HQ hero --- */
.hq { display: grid; grid-template-columns: minmax(280px, 0.9fr) 1.4fr; gap: 1.4rem; align-items: center; }

.hq-side { display: flex; flex-direction: column; gap: 0.7rem; align-items: flex-start; }

.hq-side h1 { font-size: clamp(2rem, 4vw, 3rem); }

.hq-ring { margin: 0.3rem 0; }

.hq-stats { display: grid; grid-template-columns: repeat(3, auto); gap: 0.8rem 1.4rem; }

.hq-map { min-width: 0; }

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

/* --- cartridges --- */
.cartridges { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 0.9rem; }

.cart { position: relative; display: flex; flex-direction: column; gap: 0.3rem; padding: 0.9rem 0.95rem 1.2rem; border-radius: 16px 16px 10px 10px; background: linear-gradient(180deg, color-mix(in srgb, var(--ch) 22%, var(--surface)), var(--surface) 70%); border: 1px solid color-mix(in srgb, var(--ch) 35%, var(--line)); color: var(--text); text-decoration: none; overflow: hidden; transition: transform 0.18s, box-shadow 0.18s; }

.cart::before { content: ''; position: absolute; top: 0; left: 14px; right: 14px; height: 5px; border-radius: 0 0 6px 6px; background: var(--ch); }

.cart:hover { transform: translateY(-4px) rotate(-0.6deg); box-shadow: 0 16px 30px rgba(0,0,0,0.25), 0 0 0 1px color-mix(in srgb, var(--ch) 50%, transparent); }

.cart-top { display: flex; justify-content: space-between; align-items: center; margin-top: 0.3rem; }

.cart-ico { font-size: 1.7rem; }

.cart-meta { font-family: var(--font-mono); font-size: 0.65rem; color: var(--muted); background: var(--bg-2); padding: 0.15rem 0.45rem; border-radius: 999px; }

.cart h3 { font-size: 1.05rem; }

.cart p { margin: 0; font-size: 0.82rem; color: var(--muted); }

.cart-ridge { position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: repeating-linear-gradient(90deg, transparent 0 10px, color-mix(in srgb, var(--ch) 30%, transparent) 10px 13px); opacity: 0.6; }

.funnel-step { cursor: pointer; }

.funnel-step path { transition: fill-opacity 0.2s; }

.funnel-step.on path, .funnel-step:hover path { fill-opacity: 0.85 !important; }

.funnel-step:focus-visible { outline: none; }

.level-sheet { margin-top: 1rem; }

.sheet-card { background: color-mix(in srgb, var(--ch) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ch) 35%, var(--line)); border-radius: 20px; padding: 1.1rem 1.3rem; animation: rise 0.3s ease-out; }

.quest { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; padding: 1rem 1.2rem; border-radius: 20px; background: linear-gradient(135deg, color-mix(in srgb, var(--ch) 20%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--ch) 40%, var(--line)); flex-wrap: wrap; }

.quest-ico { font-size: 2.2rem; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 18px; background: color-mix(in srgb, var(--ch) 25%, var(--bg-2)); }

/* --- claim overlay --- */
.claim { display: flex; align-items: center; gap: 1.2rem; padding: 1.2rem 1.4rem; border-radius: 22px; margin-bottom: 1rem; background: linear-gradient(135deg, color-mix(in srgb, var(--ch) 30%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--ch) 55%, transparent); box-shadow: 0 0 40px color-mix(in srgb, var(--ch) 30%, transparent); animation: rise 0.4s ease-out; }

.claim-flag { position: relative; width: 56px; height: 90px; flex-shrink: 0; }

.claim-pole { position: absolute; left: 8px; bottom: 0; width: 4px; height: 90px; background: var(--text); border-radius: 2px; }

.claim-cloth { position: absolute; left: 12px; top: 6px; width: 42px; height: 28px; background: var(--ch); clip-path: polygon(0 0, 100% 20%, 100% 80%, 0 100%); transform-origin: left center; animation: raise 0.9s cubic-bezier(.2,.8,.2,1) both, flutter 1.8s ease-in-out 0.9s infinite; }

.claim-crown { font-size: 3.4rem; animation: bounce 0.9s cubic-bezier(.2,.8,.2,1) both; }

/* --- lesson deck --- */
.lesson { max-width: 820px; margin: 0 auto; }

.lesson-top { display: grid; gap: 0.6rem; margin-bottom: 1rem; }

.lesson-dots { display: flex; gap: 6px; flex-wrap: wrap; }

.lesson-stage { position: relative; min-height: 380px; }

.slide { background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid color-mix(in srgb, var(--ch) 25%, var(--line)); border-radius: 24px; padding: 1.6rem 1.8rem 1.8rem; box-shadow: var(--shadow); position: relative; overflow: hidden; opacity: 0; transition: opacity 0.26s ease, transform 0.26s cubic-bezier(.2,.8,.2,1); }

.slide::before { content: ''; position: absolute; inset: 0 auto auto 0; width: 100%; height: 6px; background: linear-gradient(90deg, var(--ch), transparent); }

.slide.in-right { transform: translateX(40px); }

.slide.in-left { transform: translateX(-40px); }

.slide.show { opacity: 1; transform: none; }

.slide.out-left, .slide.out-right { position: absolute; inset: 0; opacity: 0 !important; pointer-events: none; }

.slide.out-left { transform: translateX(-40px) !important; }

.slide.out-right { transform: translateX(40px) !important; }

.slide-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.1rem; }

.slide-title { font-size: clamp(1.4rem, 2.6vw, 1.9rem); }

.slide-def { font-size: clamp(1.15rem, 2vw, 1.45rem); line-height: 1.55; font-weight: 600; max-width: 62ch; animation: fadeUp 0.5s 0.1s cubic-bezier(.2,.8,.2,1) both; }

.slide.hook { min-height: 360px; display: flex; flex-direction: column; justify-content: center; }

.lesson-foot { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; margin-top: 1rem; }

.mini-q .options { margin-top: 0.8rem; }

.mini-q .stem { font-size: 1.05rem; }

/* --- learn layout --- */
.learn-layout { display: grid; grid-template-columns: 250px 1fr; gap: 1.4rem; align-items: start; }

.learn-side { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; padding-right: 0.4rem; }

.learn-toc { display: grid; gap: 2px; }

.toc-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.5rem; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 0.85rem; }

.toc-item:hover { background: var(--surface-2); color: var(--text); }

.toc-item.on { background: color-mix(in srgb, var(--ch) 18%, var(--surface-2)); color: var(--text); font-weight: 700; }

@media (max-width: 900px) { .learn-layout { grid-template-columns: 1fr; } .learn-side { position: static; max-height: none; } .learn-toc { display: flex; flex-wrap: wrap; gap: 0.3rem; } .learn-toc > div { display: contents; } .learn-toc .tiny { display: none; } }

/* --- visuals --- */
.vizwrap { margin: 0.8rem 0 0; padding: 1rem; border-radius: 18px; background: var(--bg-2); border: 1px solid var(--line); }

.vizcap { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; margin-bottom: 0.5rem; }

.vizhint { font-size: 0.8rem; color: var(--muted); margin-top: 0.5rem; }

.vizlabel { margin-top: 0.6rem; font-size: 0.92rem; line-height: 1.5; min-height: 1.4em; padding: 0.5rem 0.7rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); }

.viz { display: block; width: 100%; height: auto; color: var(--text); overflow: visible; }

.vt { fill: currentColor; font-family: var(--font-body); font-size: 15px; }

.vt.small { font-size: 13px; }

.vt.tiny { font-size: 11.5px; }

.vt.bold { font-weight: 700; }

.vt.muted { fill: var(--muted); }

.draw { stroke-dasharray: 2200; stroke-dashoffset: 2200; animation: draw 1.6s cubic-bezier(.2,.8,.2,1) forwards; }

.draw.delay { animation-delay: 0.6s; }

.pop { transform-box: fill-box; transform-origin: center; animation: popIn 0.45s cubic-bezier(.2,.8,.2,1) both; }

.ring-pop { transform-box: fill-box; transform-origin: center; animation: popIn 0.5s cubic-bezier(.2,.8,.2,1) both; cursor: pointer; transition: fill-opacity 0.2s; }

.ring-pop:hover { fill-opacity: 0.75 !important; }

.flow { animation: routeFlow 1.2s linear infinite; }

.spin { transform-box: fill-box; transform-origin: center; animation: spinSlow 18s linear infinite; }

.plc-stage { cursor: pointer; }

.plc-stage rect { transition: fill-opacity 0.2s; }

.plc-stage.on rect, .plc-stage:hover rect { fill-opacity: 0.3 !important; }

.plc-stage:focus-visible { outline: none; }

table.fig.reveal td.hid { cursor: pointer; position: relative; }

table.fig.reveal td.hid .cell-text { opacity: 0; filter: blur(6px); transition: opacity 0.25s, filter 0.25s; }

table.fig.reveal td.hid::after { content: 'tap'; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-mono); font-size: 0.65rem; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; transition: opacity 0.2s; }

table.fig.reveal td.hid.shown .cell-text { opacity: 1; filter: none; }

table.fig.reveal td.hid.shown::after { opacity: 0; }

table.fig.reveal td.hid:hover { background: color-mix(in srgb, var(--ch) 10%, transparent); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; position: relative; }

.steps::before { content: ''; position: absolute; left: 19px; top: 20px; bottom: 20px; width: 3px; background: color-mix(in srgb, var(--ch) 40%, transparent); border-radius: 2px; }

.step { display: grid; grid-template-columns: 40px 1fr; gap: 0.8rem; align-items: center; padding: 0.55rem 0.7rem 0.55rem 0; border-radius: 12px; cursor: pointer; animation: fadeUp 0.4s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 110ms); transition: background 0.15s; }

.step:hover, .step.on { background: color-mix(in srgb, var(--ch) 12%, transparent); }

.step-n { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--ch); color: #0B0F1A; font-family: var(--font-display); font-weight: 800; position: relative; z-index: 1; box-shadow: 0 0 0 4px var(--bg-2); }

.step-t { font-size: 1rem; line-height: 1.5; }

.step.on .step-t { font-weight: 700; }

.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.pill { padding: 0.5rem 0.85rem; border-radius: 999px; background: color-mix(in srgb, var(--ch) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ch) 40%, transparent); font-weight: 600; font-size: 0.95rem; animation: popIn 0.4s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i) * 70ms); }

.m22 { display: grid; grid-template-columns: 120px 1fr 1fr; gap: 0.5rem; }

.m22-corner { display: grid; place-items: center; }

.m22-h { font-family: var(--font-display); font-weight: 700; font-size: 0.9rem; display: grid; place-items: center; text-align: center; padding: 0.4rem; }

.m22-c { text-align: left; padding: 0.9rem 1rem; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--ch) 40%, transparent); background: color-mix(in srgb, var(--ch) 14%, var(--surface)); color: var(--text); display: grid; gap: 0.3rem; animation: popIn 0.4s both; animation-delay: calc(var(--i) * 90ms); min-height: 72px; }

.m22-c b { font-family: var(--font-display); font-size: 1rem; }

.m22-c .hid-desc { display: none; font-size: 0.85rem; color: var(--muted); }

.m22-c.open .hid-desc { display: block; }

.m22-c.open { background: color-mix(in srgb, var(--ch) 28%, var(--surface)); }

@media (max-width: 560px) { .m22 { grid-template-columns: 70px 1fr 1fr; } .m22-h { font-size: 0.75rem; } }

.icard { padding: 1rem; border-radius: 16px; background: color-mix(in srgb, var(--ch) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ch) 35%, transparent); display: grid; gap: 0.3rem; animation: popIn 0.4s both; animation-delay: calc(var(--i) * 100ms); }

.icard-e { font-size: 2rem; }

.mkbar { display: flex; height: 54px; border-radius: 12px; overflow: hidden; font-weight: 700; font-size: 0.9rem; }

.mk-cost { background: var(--surface-3); display: grid; place-items: center; }

.mk-mk { background: var(--ch); color: #0B0F1A; display: grid; place-items: center; }

.elbars { display: flex; gap: 1.2rem; align-items: flex-end; height: 110px; padding: 0 0.5rem; }

.elbar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 0.3rem; height: 100%; }

.elfill { width: 70px; border-radius: 8px 8px 0 0; transition: height 0.3s; }

/* --- plan as details --- */
details.plan summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }

details.plan summary::-webkit-details-marker { display: none; }

details.plan summary::after { content: '▸'; margin-left: auto; color: var(--muted); transition: transform 0.2s; }

details.plan[open] summary::after { transform: rotate(90deg); }

/* --- misc polish --- */
.world { border-radius: 20px; }

.shelf-board { box-shadow: 0 8px 18px rgba(0,0,0,0.3); }

.tile { animation: popIn 0.35s cubic-bezier(.2,.8,.2,1) both; }

p, .stem, .line, .slide-def, .callout, .vs-side, .concept .def, .option span:last-child, .explain p, .def { font-family: var(--font-body); }

.stem { font-size: 1.22rem; }

.slide-def { font-size: clamp(1.25rem, 2vw, 1.55rem); }

/* rivets */
.card::after, .qcard::after, .slide::after, .sheet-card::after, .quest::after, .modal::after, .flash-face::after, .vizwrap::after {
  content: ''; position: absolute; inset: 7px; pointer-events: none; border-radius: calc(var(--radius) - 4px);
  background:
    radial-gradient(circle at 0 0, var(--iron) 0 3px, rgba(0,0,0,0.5) 3.5px, transparent 4.5px),
    radial-gradient(circle at 100% 0, var(--iron) 0 3px, rgba(0,0,0,0.5) 3.5px, transparent 4.5px),
    radial-gradient(circle at 0 100%, var(--iron) 0 3px, rgba(0,0,0,0.5) 3.5px, transparent 4.5px),
    radial-gradient(circle at 100% 100%, var(--iron) 0 3px, rgba(0,0,0,0.5) 3.5px, transparent 4.5px);
  background-repeat: no-repeat;
}

.qcard::before, .slide::before, .concept::before, .mode-tile::before { background: linear-gradient(180deg, var(--gold-2), var(--ch, var(--gold)) 60%, #6b4b12); width: 6px; }

.slide::before { height: 100%; width: 6px; background: linear-gradient(180deg, var(--gold-2), var(--ch, var(--gold)) 60%, #6b4b12); }

.mdot { border-radius: 50%; }

.level-pill { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.72rem; }

/* ---------- answer options as stone tablets ---------- */
.option { background: linear-gradient(180deg, rgba(74,64,56,0.9), rgba(51,43,36,0.9)); border: 1px solid rgba(0,0,0,0.6); box-shadow: inset 0 1px 0 rgba(234,219,192,0.1), 0 3px 8px rgba(0,0,0,0.35); border-radius: 6px; font-size: 1.08rem; }

.option:hover:not(:disabled) { background: linear-gradient(180deg, rgba(90,78,68,0.95), rgba(60,50,42,0.95)); border-color: var(--gold); transform: translateX(3px); }

.option .key { font-family: var(--font-display); background: radial-gradient(circle at 40% 35%, #6b6b70, #3a3a3e 70%); color: #EADBC0; border: 1px solid #111; border-radius: 50%; }

.option.correct { background: linear-gradient(180deg, #4F6A3F, #3A4F2E); border-color: var(--good); }

.option.correct .key { background: var(--good); color: #10200c; }

.option.wrong { background: linear-gradient(180deg, #7A2A22, #5A1E18); border-color: var(--bad); }

.option.wrong .key { background: var(--bad); color: #2a0b08; }

.explain { background: rgba(14, 11, 8, 0.7); border: 1px solid rgba(0,0,0,0.6); }

.explain .verdict { font-family: var(--font-display); letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.95rem; }

.explain .verdict.ok { color: var(--good); }

.explain .verdict.no { color: var(--bad); }

.pursuit-banner { background: linear-gradient(90deg, rgba(139,30,30,0.5), rgba(139,30,30,0.15)); border: 1px solid rgba(139,30,30,0.7); border-left: 4px solid var(--gold); border-radius: 4px; }

.pursuit-banner .pip.on { background: var(--gold); }

.combo { color: var(--gold-2); font-family: var(--font-display); }

.timer { font-family: var(--font-display); background: linear-gradient(180deg, #3A322A, #2A241D); border: 1px solid rgba(0,0,0,0.6); }

.hearts { filter: sepia(0.3); }

.runner { position: relative; z-index: 1; }

/* glass panel between text and the field */
.runner .qcard, .runner .runner-head, .runner .runner-foot, .runner .card, .runner .explain, .runner .review-item {
  background: rgba(12, 9, 6, 0.74) !important; backdrop-filter: blur(10px) saturate(0.8); -webkit-backdrop-filter: blur(10px) saturate(0.8);
}

.runner .runner-head, .runner .runner-foot { border-radius: 8px; padding: 0.6rem 0.9rem; }

.runner .qcard { border: 1px solid rgba(201,162,39,0.35); box-shadow: 0 0 0 1px rgba(0,0,0,0.7), var(--shadow); }

.runner .option { background: linear-gradient(180deg, rgba(74,64,56,0.75), rgba(51,43,36,0.75)); backdrop-filter: blur(6px); }

:root[data-theme="light"] .runner .qcard, :root[data-theme="light"] .runner .runner-head, :root[data-theme="light"] .runner .runner-foot, :root[data-theme="light"] .runner .card, :root[data-theme="light"] .runner .explain, :root[data-theme="light"] .runner .review-item { background: rgba(241, 228, 196, 0.86) !important; }

/* ---------- lesson slides as scrolls ---------- */
.slide { background: var(--stone-grad); }

.lesson-top .bar-fill { background: linear-gradient(90deg, #8B1E1E, var(--gold)) !important; }

/* ---------- home / castra ---------- */
.hq-side h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }

.cartridges { gap: 1rem; }

.cart { background: var(--stone-grad); border: 1px solid rgba(0,0,0,0.6); border-radius: 8px; box-shadow: inset 0 1px 0 rgba(234,219,192,0.08), var(--shadow); }

.cart::before { background: linear-gradient(90deg, var(--crimson), var(--ch)); height: 6px; left: 0; right: 0; border-radius: 0; }

.cart h3 { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.95rem; }

.cart p { font-family: var(--font-body); font-size: 0.95rem; }

.cart-ridge { background: repeating-linear-gradient(90deg, transparent 0 14px, rgba(0,0,0,0.35) 14px 16px); }

.cart-meta { background: rgba(0,0,0,0.45); border: 1px solid rgba(0,0,0,0.6); border-radius: 3px; }

.cart:hover { transform: translateY(-4px); box-shadow: 0 18px 30px rgba(0,0,0,0.5), 0 0 0 1px var(--gold); }

.quest { background: linear-gradient(90deg, rgba(139,30,30,0.35), transparent 60%), var(--stone-grad); border-left: 6px solid var(--gold); }

.quest-ico { background: radial-gradient(circle at 40% 35%, #4A3C2C, #2A241D 70%); border: 1px solid rgba(0,0,0,0.6); border-radius: 50%; }

/* ---------- shelf -> armoury racks ---------- */
.shelf-board { background: linear-gradient(180deg, #6B4B2A, #3B2A17); box-shadow: 0 8px 18px rgba(0,0,0,0.55); height: 8px; border-radius: 1px; }

.shelf-title { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.85rem; }

.tile { border-radius: 2px 2px 6px 6px; }

.tile.m4 { box-shadow: 0 0 10px var(--ch), inset 0 0 0 1px rgba(255,255,255,0.3); }

.xp-float { color: var(--gold-2); font-family: var(--font-display); }

details.learn-more summary { color: var(--gold-2); font-family: var(--font-display); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; }

table.fig th { font-family: var(--font-display); letter-spacing: 0.04em; font-size: 0.75rem; text-transform: uppercase; background: rgba(0,0,0,0.35); }

table.fig th, table.fig td { border-color: rgba(234,219,192,0.15); }

table.fig.reveal td.hid::after { font-family: var(--font-display); }

.step-n { background: radial-gradient(circle at 40% 35%, var(--gold-2), #8B6B1A 70%); color: #1A1206; box-shadow: 0 0 0 4px var(--surface); }

.steps::before { background: var(--gold); opacity: 0.5; }

.pill { background: linear-gradient(180deg, #4A3C2C, #3A2E21); border: 1px solid rgba(0,0,0,0.6); font-family: var(--font-body); }

.m22-c { background: var(--stone-grad); border: 1px solid rgba(0,0,0,0.6); }

.m22-c b { font-family: var(--font-display); font-size: 0.85rem; letter-spacing: 0.04em; }

.vizcap { font-family: var(--font-display); letter-spacing: 0.04em; font-size: 0.85rem; text-transform: uppercase; }

.vizlabel { background: rgba(0,0,0,0.35); border: 1px solid rgba(0,0,0,0.6); font-family: var(--font-body); font-size: 1rem; }

.claim { background: linear-gradient(135deg, rgba(139,30,30,0.5), transparent 70%), var(--stone-grad); border: 1px solid var(--gold); }

.claim-pole { background: #B9B2A5; }

.claim-cloth { background: #8B1E1E; }

.ach .ico, .world .ico { background: radial-gradient(circle at 40% 35%, #4A3C2C, #2A241D 70%); border: 1px solid rgba(0,0,0,0.6); border-radius: 50%; }

.plan-day h3 { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.9rem; }

.task .t { font-family: var(--font-body); font-size: 1.05rem; }

.score-big { text-shadow: 0 2px 10px rgba(0,0,0,0.5); }

.flash-face .term { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; }

.token, .match-item, .order-item { background: linear-gradient(180deg, rgba(74,64,56,0.9), rgba(51,43,36,0.9)); border: 1px solid rgba(0,0,0,0.6); border-radius: 6px; font-family: var(--font-body); font-size: 1rem; }

.token.sel, .match-item.sel { outline-color: var(--gold); }

.match-item .tag, .order-item .idx { font-family: var(--font-display); background: radial-gradient(circle at 40% 35%, #6b6b70, #3a3a3e 70%); color: #EADBC0; border-radius: 50%; }

.order-item.placed .idx { background: var(--crimson); }

.bucket h4 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.75rem; }

.bucket:hover, .bucket.target { border-color: var(--gold); }

.pool { border-color: rgba(234,219,192,0.3); }

:root[data-theme="light"] .xpbar, :root[data-theme="light"] .timer, :root[data-theme="light"] .icon-btn { background: linear-gradient(180deg, #F3E6C8, #DCC89C); border-color: rgba(59,42,23,0.45); }

:root[data-theme="light"] .cart-meta { background: rgba(59,42,23,0.1); color: var(--muted); border-color: rgba(59,42,23,0.25); }

:root[data-theme="light"] .explain, :root[data-theme="light"] .callout, :root[data-theme="light"] .vizlabel, :root[data-theme="light"] .seg, :root[data-theme="light"] input[type="text"], :root[data-theme="light"] input[type="number"], :root[data-theme="light"] input[type="datetime-local"], :root[data-theme="light"] select { background: rgba(59,42,23,0.08); border-color: rgba(59,42,23,0.3); box-shadow: none; color: var(--text); }

:root[data-theme="light"] .option { background: linear-gradient(180deg, rgba(246,234,208,0.95), rgba(228,212,170,0.95)); border-color: rgba(59,42,23,0.4); }

:root[data-theme="light"] .option:hover:not(:disabled) { background: linear-gradient(180deg, #FBF2DC, #EBDCB8); border-color: var(--crimson); }

:root[data-theme="light"] .option .key { background: radial-gradient(circle at 40% 35%, #8C8C90, #4A4A4E 70%); color: #F6E7C8; }

:root[data-theme="light"] .option.correct { background: linear-gradient(180deg, #CFE0B8, #B7CC9C); }

:root[data-theme="light"] .option.wrong { background: linear-gradient(180deg, #E8B8AE, #D59A8E); }

:root[data-theme="light"] .pursuit-banner { background: linear-gradient(90deg, rgba(139,30,30,0.22), rgba(139,30,30,0.06)); }

:root[data-theme="light"] .token, :root[data-theme="light"] .match-item, :root[data-theme="light"] .order-item, :root[data-theme="light"] .pill, :root[data-theme="light"] .m22-c { background: linear-gradient(180deg, rgba(246,234,208,0.95), rgba(228,212,170,0.95)); border-color: rgba(59,42,23,0.4); }

:root[data-theme="light"] .glyph, :root[data-theme="light"] .quest-ico, :root[data-theme="light"] .ach .ico, :root[data-theme="light"] .world .ico { background: radial-gradient(circle at 40% 35%, #F3E6C8, #CDB47C 70%); border-color: rgba(59,42,23,0.4); }

:root[data-theme="light"] .runner .option { background: linear-gradient(180deg, rgba(246,234,208,0.85), rgba(228,212,170,0.85)); }

:root[data-theme="light"] table.fig th { background: rgba(59,42,23,0.1); }

:root[data-theme="light"] table.fig th, :root[data-theme="light"] table.fig td { border-color: rgba(59,42,23,0.25); }

/* ---------- parchment scroll (lesson container) ---------- */
.scroll { position: relative; margin: 0.6rem 0; filter: drop-shadow(0 26px 30px rgba(0, 0, 0, 0.55)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4)); }

.scroll-roller { position: relative; height: 34px; margin: 0 -22px; border-radius: 17px; z-index: 2;
  background: linear-gradient(180deg, #7A5230 0%, #A8743F 18%, #5C3A1E 50%, #3B2412 82%, #241508 100%);
  box-shadow: inset 0 2px 0 rgba(255, 220, 160, 0.25), inset 0 -3px 0 rgba(0, 0, 0, 0.6); }

.scroll-roller::before, .scroll-roller::after { content: ''; position: absolute; top: -4px; width: 42px; height: 42px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #C9A227, #8B6B1A 45%, #3E2D0C 100%); box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6), inset 0 0 0 3px rgba(0, 0, 0, 0.35); }

.scroll-roller::before { left: -14px; }

.scroll-roller::after { right: -14px; }

.scroll-roller.top { margin-bottom: -14px; }

.scroll-roller.bottom { margin-top: -14px; }

.scroll-paper { position: relative; z-index: 1; padding: 22px 6px 24px; margin: 0 10px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.25 0 0 0 0 0.1 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% 0%, rgba(120, 80, 30, 0.35), transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(120, 80, 30, 0.35), transparent 55%),
    linear-gradient(90deg, #CDB47C 0%, #E6D3A8 6%, #F0E1BC 50%, #E6D3A8 94%, #CDB47C 100%);
  clip-path: polygon(0.6% 0, 2% 1.2%, 1% 4%, 2.2% 7%, 0.8% 10%, 1.8% 14%, 0.4% 18%, 1.6% 23%, 0.6% 28%, 2% 33%, 0.8% 38%, 1.6% 44%, 0.5% 50%, 1.9% 56%, 0.7% 62%, 1.7% 68%, 0.5% 74%, 2% 80%, 0.9% 86%, 1.8% 92%, 0.6% 97%, 1.5% 100%,
    98.5% 100%, 99.4% 97%, 98.2% 92%, 99.1% 86%, 98% 80%, 99.5% 74%, 98.3% 68%, 99.3% 62%, 98.1% 56%, 99.5% 50%, 98.4% 44%, 99.2% 38%, 98% 33%, 99.4% 28%, 98.4% 23%, 99.6% 18%, 98.2% 14%, 99.2% 10%, 97.8% 7%, 99% 4%, 98% 1.2%, 99.4% 0); }

.scroll-paper::before { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 4%, transparent 96%, rgba(0, 0, 0, 0.18)); }

.scroll-paper .lesson-stage { min-height: 380px; }

/* the slide becomes the ink on the parchment: scoped tokens so nested components adapt */
.scroll .slide, .scroll .slide.show {
  --text: #2E2114; --muted: #6E5A3E; --faint: #9A8565; --surface: #F3E6C8; --surface-2: #E8D8B2; --surface-3: #DCC89C; --bg: #E6D3A8; --bg-2: #EADBB5;
  --line: rgba(59, 42, 23, 0.18); --line-strong: rgba(59, 42, 23, 0.35); --ring-track: rgba(59, 42, 23, 0.12); --accent: #8B1E1E; --accent-ink: #F6EAD0; --info: #2E6FA8; --warn: #9A6A12; --good: #4F6A3F; --bad: #8B1E1E;
  color: var(--text); background: transparent; border: 0; box-shadow: none; border-radius: 0; padding: 1.4rem 2.2rem 1.6rem; backdrop-filter: none; }

.scroll .slide::before, .scroll .slide::after { display: none; }

.scroll .slide-title { color: #3B2A17; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35); }

.scroll .eyebrow { color: #8B1E1E; }

.scroll .glyph { background: radial-gradient(circle at 40% 35%, #F6EAD0, #CDB47C 70%); border: 2px solid #8B6B3A; box-shadow: 0 3px 6px rgba(59, 42, 23, 0.35); }

.scroll .line { border-left: 3px solid #8B1E1E; color: #2E2114; }

.scroll .slide-def { color: #2E2114; }

.scroll .callout { background: rgba(59, 42, 23, 0.07); border: 1px solid rgba(59, 42, 23, 0.25); color: #2E2114; }

.scroll .callout.example { border-left: 4px solid #8B1E1E; }

.scroll .callout.hint { background: rgba(201, 162, 39, 0.18); }

.scroll .vs-side { background: rgba(46, 111, 168, 0.1); border: 1px solid rgba(59, 42, 23, 0.25); border-left: 4px solid #2E6FA8; color: #2E2114; }

.scroll .vs-side.trap { background: rgba(154, 106, 18, 0.14); border-left-color: #9A6A12; }

.scroll .vs-badge { background: radial-gradient(circle at 40% 35%, #C9A227, #8B6B1A 70%); color: #1A1206; border-color: #3E2D0C; }

.scroll .vizwrap { background: rgba(255, 250, 235, 0.45); border: 1px solid rgba(59, 42, 23, 0.3); box-shadow: inset 0 0 20px rgba(59, 42, 23, 0.08); }

.scroll .vizwrap::after { display: none; }

.scroll .vizlabel { background: rgba(255, 250, 235, 0.7); border: 1px solid rgba(59, 42, 23, 0.25); color: #2E2114; }

.scroll table.fig th { background: rgba(59, 42, 23, 0.12); color: #2E2114; }

.scroll table.fig th, .scroll table.fig td { border-color: rgba(59, 42, 23, 0.3); }

.scroll table.fig.reveal td.hid::after { color: #6E5A3E; }

.scroll .step-n { box-shadow: 0 0 0 4px #EADBB5; }

.scroll .steps::before { background: #8B1E1E; }

.scroll .pill, .scroll .m22-c, .scroll .icard { background: rgba(255, 250, 235, 0.6); border: 1px solid rgba(59, 42, 23, 0.3); color: #2E2114; }

.scroll .m22-c.open { background: rgba(201, 162, 39, 0.25); }

.scroll .chip { background: linear-gradient(180deg, #F6EAD0, #DCC89C); color: #2E2114; border-color: rgba(59, 42, 23, 0.4); }

.scroll .chip.good { background: linear-gradient(180deg, #CFE0B8, #B7CC9C); color: #1F2A14; }

.scroll .btn:not(.primary):not(.ch) { background: linear-gradient(180deg, #F3E6C8, #DCC89C); color: #2E2114; border-color: rgba(59, 42, 23, 0.45); }

.scroll .option { background: linear-gradient(180deg, #F6EAD0, #E4D4AA); border-color: rgba(59, 42, 23, 0.45); color: #2E2114; }

.scroll .option:hover:not(:disabled) { background: linear-gradient(180deg, #FBF2DC, #EBDCB8); }

.scroll .explain { background: rgba(59, 42, 23, 0.08); border: 1px solid rgba(59, 42, 23, 0.25); color: #2E2114; }

.scroll .explain::after { display: none; }

.scroll input[type=range] { accent-color: #8B1E1E; }

.scroll .mkbar .mk-cost { background: #CDB47C; color: #2E2114; }

.scroll .tiny.muted, .scroll .small.muted, .scroll .muted { color: #6E5A3E; }

.scroll .kw-ico { color: #8B1E1E; }

.lesson-top, .lesson-foot { background: rgba(12, 9, 6, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(201, 162, 39, 0.25); border-radius: 10px; padding: 0.7rem 0.9rem; }

:root[data-theme="light"] .lesson-top, :root[data-theme="light"] .lesson-foot { background: rgba(241, 228, 196, 0.8); }

@media (max-width: 640px) { .scroll-roller { margin: 0 -8px; } .scroll-paper { margin: 0 4px; padding: 16px 2px 18px; } .scroll .slide { padding: 1rem 1rem 1.2rem; } }

/* flashcards as scrolls over the library */
.flash-host .flash-face { background: linear-gradient(90deg, #CDB47C 0%, #E6D3A8 6%, #F0E1BC 50%, #E6D3A8 94%, #CDB47C 100%); color: #2E2114; border: 0; border-top: 10px solid #5C3A1E; border-bottom: 10px solid #5C3A1E; border-radius: 14px; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  --text: #2E2114; --muted: #6E5A3E; --surface: #F3E6C8; --surface-2: #E8D8B2; --bg-2: #EADBB5; --line: rgba(59,42,23,0.18); --line-strong: rgba(59,42,23,0.35); --accent: #8B1E1E; }

.flash-host .flash-face::after { display: none; }

.flash-host .flash-face .term { color: #3B2A17; }

.flash-host .flash-face .eyebrow { color: #8B1E1E; }

.flash-host .flash-face .concept { background: transparent; border: 0; box-shadow: none; color: #2E2114; }

.flash-host .flash-face .concept .sec b { color: #6E5A3E; }

.flash-host .flash-grade .btn { backdrop-filter: blur(8px); }

.flash-host .runner-head { background: rgba(12, 9, 6, 0.6); backdrop-filter: blur(8px); border-radius: 10px; padding: 0.6rem 0.9rem; }

/* ---------- containers: chipped marble tablets with layered ribbon tags ---------- */
.card, .sheet-card, .quest, .concept, .plan-day, .li, .ach, .review-item, .world, .level, .vizwrap, .mode-tile {
  border-radius: 18px 7px 16px 9px / 9px 16px 7px 18px;
  background: radial-gradient(ellipse at 20% 0%, rgba(234, 219, 192, 0.06), transparent 50%), radial-gradient(ellipse at 80% 100%, rgba(234, 219, 192, 0.05), transparent 45%), var(--stone-grad);
  border: 1px solid rgba(0, 0, 0, 0.6);
  box-shadow: inset 0 1px 0 rgba(234, 219, 192, 0.1), inset 0 -3px 0 rgba(0, 0, 0, 0.4), 0 2px 0 #1a140e, 0 18px 34px rgba(0, 0, 0, 0.5); }

.card::after, .sheet-card::after, .quest::after { border-radius: 14px 5px 12px 6px / 6px 12px 5px 14px; }

.quest { border-radius: 6px 24px 6px 24px / 24px 6px 24px 6px; }

.sheet-card { border-radius: 22px 8px 22px 8px / 8px 22px 8px 22px; }

.world, .level { border-radius: 40px 12px 40px 12px / 12px 40px 12px 40px; }

/* question card: chipped tablet with glass */
.runner .qcard { background: transparent !important; backdrop-filter: none !important; border: 0; box-shadow: none; filter: drop-shadow(0 20px 28px rgba(0, 0, 0, 0.6)); border-radius: 0; isolation: isolate; }

.runner .qcard::before { content: ''; position: absolute; inset: 0; z-index: -1; width: auto; background: rgba(12, 9, 6, 0.76); backdrop-filter: blur(10px) saturate(0.85); -webkit-backdrop-filter: blur(10px) saturate(0.85);
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.35), inset 0 1px 0 rgba(234, 219, 192, 0.1);
  clip-path: polygon(1.2% 0, 98.5% 0, 100% 2.5%, 99.6% 60%, 100% 97%, 98% 100%, 1.5% 100%, 0 97.5%, 0.5% 40%, 0 3%); }

.runner .qcard::after { display: none; }

.runner .qcard .qmeta::before { content: ''; position: absolute; left: 0; top: 0; width: 7px; height: 100%; background: linear-gradient(180deg, var(--gold-2), var(--ch, var(--gold)) 60%, #6b4b12); clip-path: polygon(0 0, 100% 2%, 100% 98%, 0 100%); }

.runner .qcard .qmeta { position: static; }

.runner .qcard { overflow: visible; }

:root[data-theme="light"] .runner .qcard::before { background: rgba(241, 228, 196, 0.86); }

/* ---------- options: iron buttons with wax-seal keys ---------- */
.option { position: relative; border-radius: 8px; padding: 0.8rem 1rem 0.8rem 0.85rem; border: 1px solid #1a1410;
  background: linear-gradient(180deg, #4E4A47 0%, #3A3633 50%, #2A2724 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08), inset 0 -3px 0 rgba(0, 0, 0, 0.55), 0 4px 8px rgba(0, 0, 0, 0.45);
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s; }

.option::after { content: ''; position: absolute; inset: 4px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, 0.05); pointer-events: none; }

.option .key { width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: radial-gradient(circle at 38% 32%, #D45A4E, #8B1E1E 55%, #4E0F0F 100%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), inset 0 0 0 2px rgba(0, 0, 0, 0.25), inset 0 0 0 4px rgba(255, 200, 160, 0.12); transition: transform 0.15s, box-shadow 0.15s; }

.option .key-n { font-family: var(--font-display); font-weight: 900; font-size: 0.78rem; color: #E3C76A; text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.15); }

.option:hover:not(:disabled) { transform: translateY(-2px); background: linear-gradient(180deg, #5A5552 0%, #433F3B 50%, #2F2B28 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.1), inset 0 -3px 0 rgba(0, 0, 0, 0.55), 0 0 0 1.5px rgba(201, 162, 39, 0.75), 0 0 22px rgba(201, 162, 39, 0.35), 0 8px 14px rgba(0, 0, 0, 0.5); }

.option:hover:not(:disabled) .key { transform: scale(1.1) rotate(-6deg); box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.9), 0 0 16px rgba(201, 162, 39, 0.7), inset 0 0 0 2px rgba(0, 0, 0, 0.25); }

.option:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(201, 162, 39, 0.5); }

.option.correct { background: linear-gradient(180deg, #5E7A4C, #3F5733 60%, #2C3E23); border-color: #1a2410; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.1), 0 0 0 1.5px #7FA86A, 0 0 22px rgba(127, 168, 106, 0.5); }

.option.correct .key { background: radial-gradient(circle at 38% 32%, #9DC487, #4F6A3F 55%, #263418 100%); }

.option.wrong { background: linear-gradient(180deg, #5A3B36, #40282A 60%, #2A1A1A); box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.6), 0 0 0 1.5px #C94A3A; }

.option.wrong .key { background: radial-gradient(circle at 38% 32%, #8A8A8E, #4A4A4E 55%, #202022 100%); position: relative; }

.option.wrong .key::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(135deg, transparent 46%, rgba(0, 0, 0, 0.7) 47%, rgba(0, 0, 0, 0.7) 50%, transparent 51%), linear-gradient(60deg, transparent 56%, rgba(0, 0, 0, 0.6) 57%, rgba(0, 0, 0, 0.6) 59%, transparent 60%); }

.option.dim { opacity: 0.45; }

.option .opt-text { line-height: 1.45; }

:root[data-theme="light"] .option { background: linear-gradient(180deg, #8C8C90, #6A6A6E 50%, #4E4E52); color: #F6EAD0; border-color: #2a2a2e; }

:root[data-theme="light"] .option:hover:not(:disabled) { background: linear-gradient(180deg, #9A9A9E, #76767A 50%, #58585C); }

:root[data-theme="light"] .option.correct { background: linear-gradient(180deg, #6E8A5C, #4F6A3F 60%, #3A4F2E); }

:root[data-theme="light"] .option.wrong { background: linear-gradient(180deg, #7A4B46, #5A3236 60%, #40262A); }

.scroll .option, .flash-host .option { color: #2E2114; }

/* ---------- concept icons ---------- */
.kw-ico { display: inline-block; width: 1em; height: 1em; vertical-align: -0.12em; margin-left: 0.18em; color: var(--gold-2); opacity: 0.9; }

.kw-ico svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5)); }

:root[data-theme="light"] .kw-ico { color: #8B1E1E; }

.option .kw-ico { color: #E3C76A; }

:root[data-theme="light"] .option .kw-ico { color: #FFE4A8; }

/* ---------- mode cartridges as iron-trimmed wooden shields ---------- */
.cartridges { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.4rem 1.1rem; }

.cart { min-height: 230px; padding: 1.6rem 1.2rem 2.4rem; text-align: center; align-items: center; justify-content: flex-start;
  border-radius: 46% 46% 50% 50% / 26% 26% 74% 74%; border: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 220, 160, 0.12), transparent 60%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 9px, rgba(0, 0, 0, 0.08) 9px 11px, transparent 11px 22px),
    linear-gradient(180deg, color-mix(in srgb, var(--ch) 35%, #5A3F22), color-mix(in srgb, var(--ch) 18%, #3B2A17) 60%, #241508);
  box-shadow: inset 0 0 0 7px #4a4a4e, inset 0 0 0 9px #1c1c1f, inset 0 0 0 11px rgba(201, 162, 39, 0.5), inset 0 -16px 24px rgba(0, 0, 0, 0.5), 0 18px 30px rgba(0, 0, 0, 0.55); overflow: visible; }

.cart::before { display: none; }

.cart-ridge { display: none; }

.cart::after { content: ''; position: absolute; left: 50%; bottom: 14%; width: 22px; height: 22px; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #E3C76A, #8B6B1A 55%, #3E2D0C 100%); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.6), 0 0 0 3px #1c1c1f, 0 0 0 5px #4a4a4e; }

.cart-top { flex-direction: column; gap: 0.35rem; margin-top: 0; }

.cart-ico { font-size: 2rem; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.6)); }

.cart-meta { background: rgba(0, 0, 0, 0.45); border: 1px solid rgba(201, 162, 39, 0.35); color: #E3C76A; border-radius: 999px; padding: 0.15rem 0.6rem; }

.cart h3 { font-size: 0.9rem; letter-spacing: 0.1em; color: #F6EAD0; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.7); }

.cart p { color: #D9C9A8; font-size: 0.9rem; line-height: 1.4; padding: 0 0.3rem; }

.cart:hover { transform: translateY(-6px) rotate(-1.5deg); box-shadow: inset 0 0 0 7px #5a5a5e, inset 0 0 0 9px #1c1c1f, inset 0 0 0 11px rgba(201, 162, 39, 0.9), inset 0 -16px 24px rgba(0, 0, 0, 0.5), 0 26px 36px rgba(0, 0, 0, 0.6), 0 0 30px rgba(201, 162, 39, 0.25); }

:root[data-theme="light"] .cart h3 { color: #F6EAD0; }

:root[data-theme="light"] .cart p { color: #EADBC0; }

.hq-ring .ring circle:last-child { filter: drop-shadow(0 0 6px rgba(201, 162, 39, 0.6)); }

/* ---------- glass side panels & overlapping ribbon tabs ---------- */
.learn-side { background: rgba(12, 9, 6, 0.62); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(201, 162, 39, 0.25); border-radius: 12px; padding: 0.9rem 0.8rem; }

:root[data-theme="light"] .learn-side { background: rgba(241, 228, 196, 0.82); }

.sheet-card, .quest, .plan-day { overflow: visible; }

.sheet-card::before, .quest::before, .plan-day::before { content: ''; position: absolute; top: -11px; left: 26px; width: 118px; height: 24px; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, #C43A33, #8B1E1E 60%, #5E1313); clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 50%, 100% 100%, 0 100%, 10px 50%);
  box-shadow: none; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5)); }

.sheet-card::before { width: 150px; }

.sheet-card > .row.between, .quest > .quest-ico, .plan-day > h3 { margin-top: 0.4rem; }

/* mobile: scroll rollers and shields */
@media (max-width: 640px) {
  .cartridges { grid-template-columns: repeat(2, 1fr); gap: 1rem 0.7rem; }
  .cart { min-height: 200px; padding: 1.3rem 0.8rem 2.2rem; }
  .cart p { font-size: 0.82rem; }
  .scroll-roller::before, .scroll-roller::after { width: 30px; height: 30px; top: 2px; }
  .scroll-roller::before { left: -8px; } .scroll-roller::after { right: -8px; }
  .scene-static { filter: blur(calc(var(--scene-blur, 8px) * 0.8)); }
}

/* Phase 0 overflow fixes: rollers stay inside the main gutter; chips wrap on narrow screens. */
.main { overflow-x: clip; }
.scroll-roller { margin: 0 -12px; }
.scroll-roller::before { left: -10px; } .scroll-roller::after { right: -10px; }
@media (max-width: 640px) {
  .scroll-roller { margin: 0 -6px; }
  .scroll-roller::before { left: -6px; } .scroll-roller::after { right: -6px; }
  .sheet-card .chip, .quest .chip, .row.wrap .chip { white-space: normal; max-width: 100%; text-align: left; line-height: 1.3; }
}

/* ===================================================================
   PHASE 1 — the question dispatch, answer tablets, feedback seals,
   the Archives tablet as a scroll, Siege Works blocks and carts.
   =================================================================== */
.runner { max-width: 860px; }
.runner .qcard { padding: 1.3rem 1.5rem 1.4rem; }
.runner .qcard::before { clip-path: polygon(0 2%, 2% 0, 25% 0.5%, 50% 0, 75% 0.6%, 98.5% 0, 100% 1.5%, 99.5% 35%, 100% 65%, 99.4% 98%, 98% 100%, 72% 99.4%, 45% 100%, 20% 99.5%, 1.5% 100%, 0 98%, 0.5% 60%, 0 30%); background: rgba(14, 10, 7, 0.8); border: 0; }
.runner .qcard .qmeta::before { display: none; }
.qhead { display: flex; align-items: flex-start; gap: 0.9rem; margin-bottom: 0.9rem; }
.qicon { width: 50px; height: 50px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 38% 32%, #3A322A, #1C1612 70%); border: 2px solid var(--gold-leaf-dark); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 240, 200, 0.12), 0 4px 10px rgba(0, 0, 0, 0.5); position: relative; }
.qicon::after { content: ''; position: absolute; inset: 4px; border-radius: 50%; border: 1px solid rgba(201, 162, 39, 0.35); }
.qhead .qmeta { margin-bottom: 0; flex: 1; min-width: 0; }
.runner .stem { font-size: 1.25rem; line-height: 1.5; font-family: var(--font-body); color: #F6EEDC; }
.runner .stem .blank { border-bottom-color: var(--gold-leaf); }
.pursuit-banner { background: rgba(139, 30, 30, 0.25); border: 1px solid rgba(201, 162, 39, 0.45); color: #F6E7C8; border-radius: 6px; }
.pursuit-banner .pip.on { background: var(--gold-leaf); }

/* answer tablets: carved travertine with a bronze coin key */
.runner .options { gap: 0.65rem; margin-top: 1.2rem; }
.option.tablet { background: linear-gradient(180deg, #DCC89C 0%, #CDB47C 55%, #B99E66 100%); color: var(--vellum-ink); border: 1px solid #5A4330; border-radius: 10px 4px 9px 5px / 5px 9px 4px 10px; box-shadow: var(--bevel-stone-light); padding: 0.8rem 1rem 0.8rem 0.8rem; font-family: var(--font-body); font-size: 1.1rem; position: relative; overflow: hidden; backdrop-filter: none; transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast), background var(--dur-fast); }
.option.tablet::before { content: ''; position: absolute; inset: 0; background: var(--parch-grain); opacity: 0.55; mix-blend-mode: multiply; pointer-events: none; }
.option.tablet::after { content: ''; position: absolute; inset: 3px; border: 1px solid rgba(255, 255, 255, 0.35); border-radius: inherit; pointer-events: none; }
.option.tablet .opt-text { position: relative; line-height: 1.4; }
.option.tablet .key.coin { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 38% 32%, #D9B45A, #8E6B1C 60%, #3E2D0C 100%); border: 1px solid #2B1C08; box-shadow: var(--bevel-bronze); flex-shrink: 0; transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast); position: relative; }
.option.tablet .key.coin .key-n { color: #F6E7C8; font-size: 0.82rem; }
.option.tablet:hover:not(:disabled) { transform: scale(1.012); background: linear-gradient(180deg, #E6D3A8 0%, #D6BF86 55%, #C2A86E 100%); box-shadow: var(--bevel-stone-light), 0 0 0 1.5px rgba(201, 162, 39, 0.8), 0 0 18px rgba(201, 162, 39, 0.45); }
.option.tablet:hover:not(:disabled) .key.coin { transform: scale(1.1) rotate(-8deg); box-shadow: var(--bevel-bronze), 0 0 12px rgba(227, 199, 106, 0.8); }
.option.tablet:active:not(:disabled), .option.tablet.sealed { transform: translateY(2px); box-shadow: inset 0 3px 6px rgba(59, 42, 23, 0.45), 0 0 0 1px rgba(0, 0, 0, 0.3); }
.option.tablet:focus-visible { outline: 2px solid var(--gold-leaf); outline-offset: 2px; }
.option.tablet .laurel-mark { position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%) scale(0); opacity: 0; transition: transform var(--dur) var(--ease-spring), opacity var(--dur); }
.option.tablet.correct { background: linear-gradient(180deg, #E7D7A0 0%, #D9C48A 55%, #C7AE6E 100%); box-shadow: var(--bevel-stone-light), 0 0 0 2px var(--gold-leaf), 0 0 24px rgba(201, 162, 39, 0.55); color: #2E2114; padding-right: 2.6rem; }
.option.tablet.correct::after { border-color: rgba(227, 199, 106, 0.9); animation: leafGlow 0.9s ease-out; }
@keyframes leafGlow { 0% { box-shadow: inset 0 0 0 0 rgba(227, 199, 106, 0); } 40% { box-shadow: inset 0 0 0 40px rgba(227, 199, 106, 0.35); } 100% { box-shadow: inset 0 0 0 0 rgba(227, 199, 106, 0); } }
.option.tablet.correct .laurel-mark { transform: translateY(-50%) scale(1); opacity: 1; }
.option.tablet.correct .key.coin { background: radial-gradient(circle at 38% 32%, #F0D98A, #C9A227 55%, #6B4B12 100%); }
.option.tablet.wrong { background: linear-gradient(180deg, #B9A27A 0%, #A58C62 55%, #8F7850 100%); color: #2E2114; box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.35), 0 0 0 1.5px #8B1E1E; animation: shake 0.3s; }
.option.tablet.wrong::before { opacity: 0.8; mix-blend-mode: normal; background: var(--parch-grain), linear-gradient(118deg, transparent 44%, rgba(40, 24, 10, 0.9) 45%, rgba(40, 24, 10, 0.9) 46.2%, transparent 47.2%), linear-gradient(62deg, transparent 58%, rgba(40, 24, 10, 0.85) 59%, rgba(40, 24, 10, 0.85) 60%, transparent 61%), linear-gradient(150deg, transparent 20%, rgba(40, 24, 10, 0.8) 21%, rgba(40, 24, 10, 0.8) 21.8%, transparent 22.8%); }
.option.tablet.wrong .key.coin { background: radial-gradient(circle at 38% 32%, #8A8A8E, #4A4A4E 55%, #202022 100%); }
.option.tablet.wrong .key.coin::after { content: ''; position: absolute; inset: 0; border-radius: 50%; background: linear-gradient(135deg, transparent 46%, rgba(0, 0, 0, 0.7) 47%, rgba(0, 0, 0, 0.7) 50%, transparent 51%); }
.option.tablet.dim { opacity: 0.5; filter: saturate(0.6); }
.option.tablet.picked { box-shadow: var(--bevel-stone-light), 0 0 0 2px var(--gold-leaf); }
.option.tablet:disabled { cursor: default; }
:root[data-motion="off"] .option.tablet, :root[data-motion="off"] .option.tablet .key.coin, :root[data-motion="off"] .option.tablet .laurel-mark { transition: none; }
:root[data-motion="off"] .option.thumb, :root[data-motion="off"] .option.thumb .key.coin, :root[data-motion="off"] .option.thumb .thumb-ico, :root[data-motion="off"] .option.thumb .laurel-mark { transition: none; }
:root[data-motion="off"] .option.tablet.wrong, :root[data-motion="off"] .option.tablet.correct::after { animation: none; }

/* layered feedback: verdict and explanation on parchment, wax seals for the rest, diagram beside */
.feedback { margin-top: 1.1rem; position: relative; isolation: isolate; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.45)); animation: rise 0.3s ease-out; color: var(--vellum-ink); padding: 1rem 1.15rem 1.1rem; }
.feedback::before { content: ''; position: absolute; inset: 0; z-index: -1; background: var(--parch-grain), linear-gradient(180deg, #F2E4C2, #E6D3A8 70%, #D9C391); clip-path: polygon(0 3%, 1.5% 0, 35% 1%, 60% 0, 98% 1.2%, 100% 3%, 99.4% 50%, 100% 97%, 98.5% 100%, 65% 99%, 30% 100%, 1% 99%, 0 96%, 0.8% 50%); }
.feedback.no::before { background: var(--parch-grain), linear-gradient(180deg, #E9D2B4, #DCC19C 70%, #CDB08A); }
.feedback-grid { display: grid; gap: 1rem; }
.feedback-grid.with-vis { grid-template-columns: minmax(0, 1.4fr) minmax(220px, 1fr); }
@media (max-width: 760px) { .feedback-grid.with-vis { grid-template-columns: 1fr; } }
.feedback-main { min-width: 0; }
.feedback-vis { align-self: start; min-width: 0; }
.feedback-vis > * { max-width: 100%; }
.feedback .verdict { font-family: var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.95rem; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.feedback .verdict.ok { color: #3F5733; }
.feedback .verdict.no { color: var(--pompeian); }
.feedback .xp-gain { margin-left: auto; display: inline-flex; align-items: center; gap: 0.3rem; color: var(--gold-leaf-dark); font-size: 0.85rem; letter-spacing: 0.06em; }
.feedback .explanation { margin: 0.5rem 0 0.3rem; font-size: 1.05rem; line-height: 1.55; }
.feedback .muted, .feedback .small.muted { color: var(--vellum-ink-soft); }
.seals { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.7rem; }
.seal { display: inline-flex; align-items: center; gap: 0.45rem; background: transparent; border: 0; padding: 0.25rem 0.5rem 0.25rem 0.25rem; border-radius: 999px; cursor: pointer; font-family: var(--font-display); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--vellum-ink-soft); transition: color var(--dur-fast); }
.seal:hover { color: var(--vellum-ink); }
.seal:focus-visible { outline: 2px solid var(--pompeian); outline-offset: 2px; }
.seal-wax { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 38% 32%, #C0392B, #8B1E1E 55%, #4A0F0F 100%); box-shadow: inset 0 1px 0 rgba(255, 200, 180, 0.35), inset 0 -2px 3px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.45); border: 1px solid #3A0C0C; position: relative; transition: transform var(--dur) var(--ease-spring); }
.seal-wax::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; border: 1px dashed rgba(255, 220, 200, 0.35); }
.seal:hover .seal-wax { transform: scale(1.08) rotate(-6deg); }
.seal.broken .seal-wax { background: radial-gradient(circle at 38% 32%, #D9B45A, #8E6B1C 60%, #3E2D0C 100%); border-color: #2B1C08; clip-path: polygon(0 0, 100% 0, 100% 100%, 55% 100%, 40% 70%, 30% 100%, 0 100%); }
.seal.broken { color: var(--vellum-ink); }
.seal-body { display: grid; gap: 0.6rem; margin-top: 0.6rem; }
.seal-body:empty { display: none; }
.seal-text { padding: 0.6rem 0.8rem; border-left: 3px solid var(--pompeian); background: rgba(139, 30, 30, 0.07); animation: rise 0.25s ease-out; }
.seal-text .eyebrow { display: flex; align-items: center; gap: 0.35rem; color: var(--pompeian); margin-bottom: 0.2rem; }
.seal-text p { margin: 0; font-size: 1rem; line-height: 1.5; }
.intro-note { margin-bottom: 0.9rem; padding: 0.7rem 1rem; }
.result.panel.stone { padding: 1.6rem; }
.runner .runner-foot { background: transparent; border: 0; box-shadow: none; padding: 0.6rem 0; }
.runner .runner-head { background: rgba(14, 10, 7, 0.55); border: 1px solid rgba(0, 0, 0, 0.5); backdrop-filter: blur(8px); }
.runner .review-item { background: rgba(14, 10, 7, 0.7); backdrop-filter: blur(8px); }

/* ---------- Archives tablet as an unrolled scroll with a sticky table of contents ---------- */
.sheet-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.4rem; align-items: start; }
@media (max-width: 900px) { .sheet-layout { grid-template-columns: 1fr; } .sheet-toc { position: static; } }
.sheet-toc { position: sticky; top: 1rem; display: grid; gap: 0.3rem; padding: 0.9rem 1rem; background: linear-gradient(180deg, #3A322A, #2A241D); border: 1px solid rgba(0, 0, 0, 0.6); border-radius: var(--radius-stone); box-shadow: var(--bevel-stone); }
.sheet-toc .toc-item { display: flex; gap: 0.6rem; align-items: baseline; padding: 0.3rem 0.4rem; border-radius: 4px; color: #D9CDB4; text-decoration: none; font-size: 0.92rem; }
.sheet-toc .toc-item:hover { background: rgba(234, 219, 192, 0.08); color: #F6E7C8; }
.sheet-toc .toc-n { font-family: var(--font-display); font-size: 0.7rem; color: var(--gold-leaf); min-width: 2ch; }
.sheet-scroll { position: relative; min-width: 0; }
.sheet-scroll .scroll-roller { margin: 0; width: 100%; }
.sheet-paper { background: linear-gradient(180deg, #F2E4C2, #E6D3A8 50%, #E9D7AE); color: var(--vellum-ink); padding: 1.4rem clamp(1rem, 3vw, 2.2rem) 1.6rem; margin: 0 10px; position: relative; box-shadow: inset 0 0 60px rgba(120, 90, 40, 0.18); }
.sheet-paper::before { content: ''; position: absolute; inset: 0; background: var(--parch-grain); opacity: 0.5; mix-blend-mode: multiply; pointer-events: none; }
.sheet-section { position: relative; padding: 1rem 0 1.2rem; border-bottom: 1px solid rgba(110, 90, 62, 0.35); scroll-margin-top: 1rem; }
.sheet-section:last-child { border-bottom: 0; }
.sheet-section-head { display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.sheet-section-head h3 { margin: 0; color: var(--vellum-ink); font-size: 1.25rem; }
.sheet-section .muted { color: var(--vellum-ink-soft); }
.sheet-n { font-family: var(--font-display); color: var(--pompeian); font-weight: 700; font-size: 1.1rem; }
.sheet-terms { display: grid; gap: 0.55rem; margin: 0; }
.sheet-term { display: grid; grid-template-columns: minmax(140px, 0.38fr) minmax(0, 1fr); gap: 0.2rem 0.9rem; align-items: baseline; }
@media (max-width: 640px) { .sheet-term { grid-template-columns: 1fr; } }
.sheet-term dt { font-family: var(--font-display); font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; gap: 0.4rem; }
.sheet-term dt a { color: var(--vellum-ink); text-decoration: none; border-bottom: 1px dotted rgba(110, 90, 62, 0.6); }
.sheet-term dt a:hover { color: var(--pompeian); }
.sheet-term dd { margin: 0; font-size: 1rem; line-height: 1.5; }
.sheet-mn { display: inline-flex; align-items: center; gap: 0.3rem; margin-left: 0.4rem; color: var(--vellum-ink-soft); font-style: italic; font-size: 0.92rem; }
.sheet-figure { margin-top: 0.9rem; }
.sheet-paper .fig, .sheet-paper .fig th, .sheet-paper .fig td, .sheet-paper .fig caption, .sheet-paper .figure, .sheet-paper table, .sheet-paper th, .sheet-paper td { color: var(--vellum-ink); border-color: rgba(110, 90, 62, 0.4); }
.sheet-paper .figure, .sheet-paper .vizwrap { background: rgba(255, 250, 235, 0.45); border-color: rgba(110, 90, 62, 0.4); box-shadow: none; }

/* ---------- Siege Works: stone blocks you drag into carts ---------- */
.token.block { padding: 0; background: transparent; border: 0; border-radius: 0; font-weight: 600; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.token.block .block-face { display: block; padding: 0.5rem 0.8rem; background: linear-gradient(180deg, #DCC89C, #CDB47C 60%, #B99E66); color: var(--vellum-ink); border: 1px solid #5A4330; border-radius: 6px 3px 5px 3px / 3px 5px 3px 6px; box-shadow: var(--bevel-stone-light); font-size: 0.92rem; font-family: var(--font-body); }
.token.block:hover .block-face { box-shadow: var(--bevel-stone-light), 0 0 0 1.5px rgba(201, 162, 39, 0.7); }
.token.block.sel .block-face { box-shadow: var(--bevel-stone-light), 0 0 0 2px var(--gold-leaf), 0 0 14px rgba(201, 162, 39, 0.5); }
.token.block.lifted { opacity: 0.35; }
.token.block.ok .block-face { box-shadow: var(--bevel-stone-light), 0 0 0 2px var(--laurel); }
.token.block.bad .block-face { box-shadow: var(--bevel-stone-light), 0 0 0 2px var(--pompeian); background: linear-gradient(180deg, #B9A27A, #A58C62); }
.token.block.sel, .token.block.ok, .token.block.bad { outline: none; background: transparent; border: 0; }
.token.block:focus-visible { outline: 2px solid var(--gold-leaf); outline-offset: 2px; }
.drag-ghost { position: fixed; z-index: 140; pointer-events: none; margin: 0; filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.55)); transform-origin: center; }
.drag-ghost .block-face { transform: scale(1.04); }
.bucket.cart { position: relative; padding: 0.7rem 0.8rem 1.3rem; background: linear-gradient(180deg, #6B4B2A, #4A3418 70%, #3B2A17); border: 2px solid #2A1C0E; border-radius: 6px 6px 10px 10px; box-shadow: var(--bevel-stone); min-height: 140px; transition: transform var(--dur-fast), box-shadow var(--dur-fast), border-color var(--dur-fast); }
.bucket.cart::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.14) 0 4px, transparent 4px 26px); pointer-events: none; border-radius: inherit; }
.bucket.cart h4 { display: flex; align-items: center; gap: 0.4rem; color: #F6E7C8; font-family: var(--font-display); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; position: relative; margin-bottom: 0.5rem; }
.bucket.cart .items { position: relative; min-height: 44px; }
.bucket.cart:hover { background: linear-gradient(180deg, #7A5A33, #4A3418 70%, #3B2A17); }
.bucket.cart.target, .bucket.cart.over { border-color: var(--gold-leaf); box-shadow: var(--bevel-stone), 0 0 18px rgba(201, 162, 39, 0.5); }
.bucket.cart.over { transform: translateY(-2px); }
.cart-wheels { position: absolute; left: 10%; right: 10%; bottom: -12px; height: 22px; background: radial-gradient(circle at 10% 50%, #2A1C0E 0 9px, #5A4330 9px 11px, transparent 11.5px), radial-gradient(circle at 90% 50%, #2A1C0E 0 9px, #5A4330 9px 11px, transparent 11.5px); pointer-events: none; }
.buckets { padding-bottom: 14px; }
.pool { border: 1px dashed rgba(201, 162, 39, 0.4); background: rgba(0, 0, 0, 0.25); border-radius: 8px; }

/* ===================================================================
   PHASE 4a — richer question interactions
   =================================================================== */
/* scenario vignette beside the stem */
.stem-row { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 1rem; align-items: start; }
.vignette { border-radius: 8px; overflow: hidden; border: 1px solid rgba(201, 162, 39, 0.4); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35); }
.vignette-svg { display: block; width: 100%; height: auto; }
@media (max-width: 760px) { .stem-row { grid-template-columns: 1fr; } .vignette { max-width: 220px; } }
/* wax tablet slots for blanks */
.runner .stem .wax-slot { display: inline-block; min-width: 5.5rem; padding: 0 0.45rem; margin: 0 0.1rem; border-bottom: 0; background: linear-gradient(180deg, #2A241D, #1C1612); border: 1px solid rgba(201, 162, 39, 0.55); border-radius: 3px; box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7); color: var(--gold-leaf-light); font-style: italic; line-height: 1.35; transform: none; vertical-align: baseline; transition: background var(--dur), box-shadow var(--dur); }
.runner .stem.slot-target .wax-slot { box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7), 0 0 0 2px var(--gold-leaf), 0 0 14px rgba(201, 162, 39, 0.6); }
.runner .stem .wax-slot.filled { font-style: normal; color: #F6EEDC; background: linear-gradient(180deg, #4A3C2C, #2A241D); animation: stylus 0.3s ease-out; }
@keyframes stylus { 0% { transform: translateY(-3px); opacity: 0.4; } 100% { transform: none; opacity: 1; } }
.slot-ghost { position: fixed; left: 0; top: 0; z-index: 140; pointer-events: none; padding: 0.3rem 0.6rem; background: #E6D3A8; color: var(--vellum-ink); border: 1px solid #5A4330; border-radius: 4px; font-family: var(--font-body); font-size: 0.95rem; box-shadow: 0 10px 18px rgba(0, 0, 0, 0.5); max-width: 280px; }
.option.tablet.draggable { cursor: grab; touch-action: none; }
/* the emperor's thumbs for true / false */
.options.thumbs { grid-template-columns: 1fr 1fr; gap: 1rem; }
.option.thumb { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 1rem 0.8rem 0.9rem; background: radial-gradient(circle at 50% 30%, #4A3C2C, #2A241D 70%); border: 1px solid #1a1410; border-radius: 12px; color: #F6EEDC; position: relative; box-shadow: var(--bevel-stone); transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast); font-family: var(--font-display); }
.option.thumb .key.coin { position: absolute; left: 0.6rem; top: 0.6rem; width: 30px; height: 30px; border-radius: 50%; background: radial-gradient(circle at 38% 32%, #D9B45A, #8E6B1C 60%, #3E2D0C 100%); border: 1px solid #2B1C08; box-shadow: var(--bevel-bronze); display: grid; place-items: center; }
.option.thumb .key.coin .key-n { color: #F6E7C8; font-size: 0.78rem; }
.thumb-ico { width: 56px; height: 56px; display: grid; place-items: center; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5)); }
.option.thumb .opt-text { font-size: 1.1rem; letter-spacing: 0.08em; text-transform: uppercase; }
.thumb-sub { font-size: 0.58rem; letter-spacing: 0.18em; text-transform: uppercase; color: #B4A58A; }
.option.thumb:hover:not(:disabled) { transform: scale(1.02); box-shadow: var(--bevel-stone), 0 0 0 1.5px rgba(201, 162, 39, 0.8), 0 0 18px rgba(201, 162, 39, 0.45); }
.option.thumb.up:hover:not(:disabled) .thumb-ico { transform: translateY(-4px); } .option.thumb.down:hover:not(:disabled) .thumb-ico { transform: translateY(4px); }
.option.thumb.correct { background: radial-gradient(circle at 50% 30%, #6A5A2C, #3A2E14 70%); box-shadow: var(--bevel-stone), 0 0 0 2px var(--gold-leaf), 0 0 24px rgba(201, 162, 39, 0.55); }
.option.thumb.correct .laurel-mark { position: absolute; right: 0.6rem; top: 0.6rem; }
.option.thumb.wrong { background: radial-gradient(circle at 50% 30%, #5A2A22, #2A1414 70%); box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.5), 0 0 0 1.5px #8B1E1E; animation: shake 0.3s; }
.option.thumb.dim { opacity: 0.45; }
.option.thumb .laurel-mark { position: absolute; right: 0.6rem; top: 0.6rem; opacity: 0; transform: scale(0); transition: transform var(--dur) var(--ease-spring), opacity var(--dur); }
.option.thumb.correct .laurel-mark { opacity: 1; transform: scale(1); }
.qcard.crowd-cheer::after, .qcard.crowd-boo::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3; animation: crowd 0.9s ease-out forwards; border-radius: inherit; }
.qcard.crowd-cheer::after { background: radial-gradient(ellipse at 50% 100%, rgba(227, 199, 106, 0.35), transparent 60%); }
.qcard.crowd-boo::after { background: radial-gradient(ellipse at 50% 100%, rgba(139, 30, 30, 0.4), transparent 60%); }
@keyframes crowd { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }
@media (max-width: 640px) { .options.thumbs { grid-template-columns: 1fr; } }
/* the confidence wager */
.wager { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.9rem; padding: 0.4rem 0.7rem; background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(201, 162, 39, 0.3); border-radius: 999px; width: fit-content; }
.wager-label { display: inline-flex; align-items: center; gap: 0.3rem; font-family: var(--font-display); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: #D9CDB4; }
.wager-coin { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.15rem 0.55rem 0.15rem 0.3rem; border-radius: 999px; border: 1px solid #2B1C08; background: radial-gradient(circle at 38% 32%, #8A7A5A, #4A4038 70%); color: #F6E7C8; cursor: pointer; font-family: var(--font-display); font-size: 0.8rem; transition: transform var(--dur-fast) var(--ease-spring), background var(--dur-fast); }
.wager-coin .wager-key { font-size: 0.55rem; letter-spacing: 0.1em; padding: 0 0.3rem; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 3px; color: #D9CDB4; }
.wager-coin:hover { transform: scale(1.06); }
.wager-coin.on { background: radial-gradient(circle at 38% 32%, #F0D98A, #C9A227 55%, #6B4B12 100%); color: #2E2114; box-shadow: 0 0 0 1.5px var(--gold-leaf), 0 0 12px rgba(201, 162, 39, 0.6); }
.wager-coin.on .wager-key { color: #2E2114; border-color: rgba(46, 33, 20, 0.4); }
.wager.settled { opacity: 0.55; pointer-events: none; }
.dn-gain { margin-left: 0.6rem; font-family: var(--font-display); font-size: 0.78rem; letter-spacing: 0.06em; }
.dn-gain.win { color: var(--gold-leaf-dark); } .dn-gain.loss { color: var(--pompeian); }
.chip.denarii.bump { animation: dnBump 0.5s var(--ease-spring); }
@keyframes dnBump { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 100% { transform: scale(1); } }
/* the abacus drawer */
.abacus { margin-top: 0.6rem; }
.abacus-body { display: none; margin-top: 0.5rem; padding: 0.7rem 0.8rem; background: linear-gradient(180deg, #4A3C2C, #2A241D); border: 1px solid rgba(0, 0, 0, 0.6); border-radius: 8px; box-shadow: var(--bevel-stone); max-width: 420px; }
.abacus.open .abacus-body { display: block; animation: rise 0.25s ease-out; }
.abacus-in { flex: 1; min-width: 0; padding: 0.4rem 0.6rem; background: #1C1612; color: var(--gold-leaf-light); border: 1px solid rgba(201, 162, 39, 0.5); border-radius: 4px; font-family: var(--font-body); font-size: 1rem; }
.abacus-out { font-family: var(--font-display); color: var(--gold-leaf-light); min-width: 5ch; text-align: right; }
.abacus-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.3rem; margin-top: 0.5rem; }
.abacus-key { padding: 0.35rem 0; background: radial-gradient(circle at 40% 30%, #6B5A3E, #3B2A17 80%); color: #F6E7C8; border: 1px solid #1a1410; border-radius: 50%; width: 38px; height: 38px; justify-self: center; font-family: var(--font-display); cursor: pointer; box-shadow: var(--bevel-bronze); }
.abacus-key.clear { background: radial-gradient(circle at 40% 30%, #8B1E1E, #4A0F0F 80%); grid-column: span 1; }
.abacus-hist { margin-top: 0.4rem; max-height: 80px; overflow: auto; font-size: 0.85rem; color: #D9CDB4; }
.abacus-line { padding: 0.1rem 0; border-bottom: 1px dotted rgba(255, 255, 255, 0.12); }
/* the arch (order) */
.arch { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 0.45rem; align-items: end; padding: 2.2rem 0.2rem 0.6rem; }
.arch-block { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.6rem 0.4rem 0.5rem; min-height: 96px; background: linear-gradient(180deg, #DCC89C, #CDB47C 60%, #B99E66); color: var(--vellum-ink); border: 1px solid #5A4330; border-radius: 6px 6px 3px 3px; box-shadow: var(--bevel-stone-light); text-align: center; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; transform: translateY(calc(var(--lift, 0) * 1px)); transition: transform var(--dur), box-shadow var(--dur); }
.arch-block::before { content: ''; position: absolute; inset: 0; background: var(--parch-grain); opacity: 0.5; mix-blend-mode: multiply; border-radius: inherit; pointer-events: none; }
.arch-block .ab-idx { font-family: var(--font-display); font-weight: 700; font-size: 0.8rem; color: var(--pompeian); }
.arch-block .ab-text { font-size: 0.86rem; line-height: 1.25; position: relative; }
.arch-block .ab-mv { display: flex; gap: 0.2rem; margin-top: auto; }
.arch-block .icon-btn { width: 24px; height: 24px; }
.arch-block.lifted { opacity: 0.35; }
.arch-block.over { box-shadow: var(--bevel-stone-light), 0 0 0 2px var(--gold-leaf); }
.arch-block.ok { box-shadow: var(--bevel-stone-light), 0 0 0 2px var(--laurel); }
.arch-block.bad { box-shadow: var(--bevel-stone-light), 0 0 0 2px var(--pompeian); background: linear-gradient(180deg, #B9A27A, #A58C62); }
.arch-ghost { opacity: 0.95; }
.keystone { position: absolute; left: 50%; top: -30px; transform: translate(-50%, -40px); width: 54px; height: 40px; background: linear-gradient(180deg, #F0D98A, #C9A227 60%, #8E6B1C); border: 1px solid #3E2D0C; clip-path: polygon(15% 0, 85% 0, 100% 100%, 0 100%); display: grid; place-items: center; opacity: 0; transition: transform 0.6s var(--ease-spring), opacity 0.3s; }
.arch.locked .keystone { opacity: 1; transform: translate(-50%, 0); }
.arch.locked .arch-block { box-shadow: var(--bevel-stone-light), 0 0 0 2px var(--gold-leaf), 0 0 18px rgba(201, 162, 39, 0.5); }
/* arch curvature: lift the blocks toward the middle */
.arch-block { --mid: calc((var(--n) - 1) / 2); --d: calc(var(--i) - var(--mid)); }
.arch-block:nth-child(1), .arch-block:nth-last-child(2) { --lift: 0; }
.arch-block:nth-child(2), .arch-block:nth-last-child(3) { --lift: -14; }
.arch-block:nth-child(3), .arch-block:nth-last-child(4) { --lift: -24; }
.arch-block:nth-child(4), .arch-block:nth-last-child(5) { --lift: -30; }
.arch-block:nth-child(5):nth-last-child(n+5) { --lift: -34; }
@media (max-width: 640px) { .arch { grid-template-columns: 1fr; gap: 0.35rem; padding-top: 1rem; } .arch-block { min-height: 0; flex-direction: row; justify-content: space-between; text-align: left; --lift: 0 !important; } .keystone { display: none; } .arch.locked .arch-block { box-shadow: var(--bevel-stone-light), 0 0 0 2px var(--gold-leaf); } }
/* the ropes (match) */
.ropes-wrap { position: relative; }
.rope-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 2; }
.rope { fill: none; stroke: #8B6B3A; stroke-width: 4; stroke-linecap: round; stroke-dasharray: 6 3; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }
.rope.live { stroke: var(--gold-leaf); stroke-dasharray: 4 4; }
.rope.ok { stroke: var(--laurel); } .rope.bad { stroke: var(--pompeian); }
.match-grid.ropes { gap: 0.6rem 3rem; }
.match-item { position: relative; }
.match-item .knot { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #B48C5E, #5A4330 70%); border: 1px solid #2B1C08; transform: translateY(-50%); }
.match-grid .col:first-child .match-item .knot { right: -7px; } .match-grid .col:last-child .match-item .knot { left: -7px; }
.match-item.paired .knot { background: radial-gradient(circle at 40% 35%, #E3C76A, #8E6B1C 70%); }
.match-grid .col:first-child .match-item { cursor: grab; touch-action: none; }
/* mnemonic as a wax seal callout */
.callout.seal-callout { background: rgba(139, 30, 30, 0.06); border: 1px dashed rgba(139, 30, 30, 0.45); font-style: normal; align-items: flex-start; }
.callout-ico.wax { width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 38% 32%, #C0392B, #8B1E1E 55%, #4A0F0F 100%); box-shadow: inset 0 1px 0 rgba(255, 200, 180, 0.35), inset 0 -2px 3px rgba(0, 0, 0, 0.5), 0 2px 4px rgba(0, 0, 0, 0.45); border: 1px solid #3A0C0C; display: grid; place-items: center; }
.seal-title { font-family: var(--font-display); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--pompeian); display: block; margin-bottom: 0.15rem; }
/* parchment page turn between slides */
.lesson-stage { perspective: 1400px; }
.slide.in-right { transform-origin: left center; transform: rotateY(-70deg) translateX(40px); opacity: 0; }
.slide.in-left { transform-origin: right center; transform: rotateY(70deg) translateX(-40px); opacity: 0; }
.slide.in-right.show, .slide.in-left.show { transform: none; opacity: 1; transition: transform 0.42s var(--ease-out), opacity 0.3s; }
.slide.out-left { transform-origin: left center; transform: rotateY(60deg) translateX(-30px); opacity: 0; transition: transform 0.26s ease-in, opacity 0.22s; }
.slide.out-right { transform-origin: right center; transform: rotateY(-60deg) translateX(30px); opacity: 0; transition: transform 0.26s ease-in, opacity 0.22s; }
:root[data-motion="off"] .slide.in-right, :root[data-motion="off"] .slide.in-left { transform: none; opacity: 1; transition: none; }
:root[data-motion="off"] .slide.out-left, :root[data-motion="off"] .slide.out-right { display: none; }
/* bronze tablets in the Archives with the quiz mode */
.sheet-figure.bronze { margin-top: 1rem; padding: 0.7rem 0.9rem 0.9rem; background: linear-gradient(180deg, #B48C5E, #8C6B4A 60%, #6B4B2A); border: 2px solid #3E2D0C; border-radius: 4px; box-shadow: var(--bevel-bronze), inset 0 0 40px rgba(0, 0, 0, 0.25); color: #F6E7C8; }
.sheet-figure.bronze .eyebrow { color: #F6E7C8; }
.sheet-figure.bronze table.fig { background: rgba(0, 0, 0, 0.18); color: #F6EEDC; border-color: rgba(62, 45, 12, 0.6); }
.sheet-figure.bronze table.fig th { color: #F0D98A; background: rgba(0, 0, 0, 0.25); }
.sheet-figure.bronze table.fig td, .sheet-figure.bronze table.fig th { color: #F6EEDC; border-color: rgba(62, 45, 12, 0.6); }
.sheet-figure.bronze ul.fig li { color: #F6EEDC; }
.bronze-quiz { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.bronze-quiz .eyebrow { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0; }
.bq-col { padding: 0.15rem 0.55rem; border-radius: 999px; border: 1px solid #3E2D0C; background: rgba(0, 0, 0, 0.25); color: #F6E7C8; font-family: var(--font-display); font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; }
.bq-col.on { background: #2E2114; color: var(--gold-leaf-light); box-shadow: 0 0 0 1px var(--gold-leaf); }
td.cell-hidden { color: transparent !important; position: relative; cursor: pointer; background: repeating-linear-gradient(135deg, rgba(0, 0, 0, 0.35) 0 6px, rgba(0, 0, 0, 0.2) 6px 12px) !important; }
td.cell-hidden::after { content: '?'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--gold-leaf-light); font-family: var(--font-display); font-size: 1rem; }
td.revealed { background: rgba(201, 162, 39, 0.18) !important; }

/* ===================================================================
   PHASE 4b/4c — the game layer and the Castra rebuild
   =================================================================== */
/* top bar: your legionary, the brazier, the clepsydra */
.avatar { display: inline-grid; place-items: center; width: var(--sz, 40px); height: var(--sz, 40px); line-height: 0; flex-shrink: 0; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5)); }
.btn.you { gap: 0.4rem; padding-left: 0.4rem; }
.brazier { gap: 0.4rem; }
.braz-bowl { position: relative; width: 16px; height: 14px; display: inline-block; }
.braz-bowl::before { content: ''; position: absolute; left: 1px; right: 1px; bottom: 0; height: 6px; border-radius: 0 0 7px 7px; background: linear-gradient(180deg, #8E6B1C, #3E2D0C); }
.braz-flame { position: absolute; left: 50%; bottom: 5px; width: 9px; height: 10px; transform: translateX(-50%) scale(var(--flame, 1)); transform-origin: bottom center; border-radius: 50% 50% 45% 45%; background: radial-gradient(ellipse at 50% 75%, #FFF1B0 0 20%, #FFB347 45%, #E2581E 75%, transparent 85%); animation: flameLick 0.9s ease-in-out infinite alternate; filter: blur(0.3px); }
.brazier.grow .braz-flame { animation: flameGrow 1.2s var(--ease-spring) both, flameLick 0.9s ease-in-out 1.2s infinite alternate; }
@keyframes flameGrow { 0% { transform: translateX(-50%) scale(0.3); } 100% { transform: translateX(-50%) scale(var(--flame, 1)); } }
:root[data-motion="off"] .braz-flame { animation: none; }
.clepsydra { gap: 0.4rem; text-decoration: none; }
.clep-glass { position: relative; width: 12px; height: 16px; border: 1.5px solid #C9A227; border-radius: 3px 3px 5px 5px; overflow: hidden; background: rgba(0, 0, 0, 0.3); display: inline-block; }
.clep-water { position: absolute; left: 0; right: 0; bottom: 0; height: 60%; background: linear-gradient(180deg, #7FB4C9, #3F7F99); transition: height 0.6s; }
.clepsydra.urgent { border-color: var(--pompeian-light); color: #FFB3A7; }
.clepsydra.urgent .clep-glass { border-color: var(--pompeian-light); }
.clepsydra.urgent .clep-water { background: linear-gradient(180deg, #E26B5A, #8B1E1E); animation: pulse 1.6s ease-in-out infinite; }
[data-motion="off"] .clepsydra.urgent .clep-water { animation: none; }
/* fury meter and the Imperator's Favor */
.fury { display: inline-flex; align-items: center; gap: 0.3rem; }
.fury-track { width: 64px; height: 8px; border-radius: 4px; background: #1C1612; border: 1px solid rgba(0, 0, 0, 0.6); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.6); }
.fury-fill { display: block; height: 100%; background: linear-gradient(90deg, #8B1E1E, #E26B5A, #FFB347); transition: width 0.4s var(--ease-out); }
.fury.ready .fury-track { box-shadow: 0 0 0 1px var(--gold-leaf), 0 0 12px rgba(201, 162, 39, 0.7); }
.fury.ready .fury-fill { background: linear-gradient(90deg, #C9A227, #FFF1B0, #C9A227); animation: furyShine 1s linear infinite; background-size: 200% 100%; }
@keyframes furyShine { to { background-position: 200% 0; } }
.favor { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); z-index: 135; display: flex; align-items: center; gap: 0.8rem; padding: 0.8rem 1.4rem; background: linear-gradient(180deg, rgba(28, 22, 18, 0.95), rgba(14, 10, 7, 0.95)); border: 1px solid var(--gold-leaf); border-radius: 8px; color: #F6E7C8; box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.5), 0 0 40px rgba(201, 162, 39, 0.5); animation: favorIn 2.2s ease-out both; pointer-events: none; }
.favor-title { font-family: var(--font-display); font-size: 1.2rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-leaf-light); }
@keyframes favorIn { 0% { opacity: 0; transform: translate(-50%, -20px) scale(0.8); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.04); } 25% { transform: translate(-50%, 0) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
/* duel crowd favour and the emperor's verdict */
.favour { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.8rem; padding: 0.5rem 0.9rem; background: rgba(14, 10, 7, 0.6); border: 1px solid rgba(201, 162, 39, 0.35); border-radius: 999px; backdrop-filter: blur(6px); }
.favour .eyebrow { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0; }
.favour-track { flex: 1; min-width: 120px; height: 10px; border-radius: 5px; background: #1C1612; border: 1px solid rgba(0, 0, 0, 0.6); overflow: hidden; }
.favour-fill { display: block; height: 100%; background: linear-gradient(90deg, #8B1E1E, #C9A227); transition: width 0.4s var(--ease-out); }
.verdict-box { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; margin-bottom: 1rem; border-radius: var(--radius-stone); background: linear-gradient(180deg, #3A322A, #2A241D); border: 1px solid rgba(0, 0, 0, 0.6); box-shadow: var(--bevel-stone); animation: rise 0.4s ease-out; }
.emperor-thumb { width: 64px; height: 64px; flex-shrink: 0; background: radial-gradient(circle at 50% 30%, #4A3C2C, #1C1612 70%); border-radius: 50%; border: 2px solid var(--gold-leaf-dark); display: grid; place-items: center; position: relative; }
.emperor-thumb::after { content: '👍'; font-size: 1.8rem; filter: sepia(1) saturate(0.6); }
.verdict-box.down .emperor-thumb::after { content: '👎'; }
.verdict-box.up { border-color: var(--gold-leaf); } .verdict-box.down { border-color: var(--pompeian); }
/* battle report scroll and the casualty map */
.report .report-scroll .scroll-paper { padding: 1.4rem clamp(1rem, 3vw, 2.2rem) 1.6rem; color: var(--vellum-ink); }
.report .scroll-paper .eyebrow { color: var(--pompeian); }
.report .scroll-paper .muted { color: var(--vellum-ink-soft); }
.report .scroll-paper h3 { color: var(--vellum-ink); }
.casualty { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 0.8rem; border-radius: 8px; background: rgba(255, 250, 235, 0.35); border: 1px solid rgba(110, 90, 62, 0.35); border-left: 5px solid var(--ch); }
.casualty .cas-state { font-family: var(--font-display); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; }
.casualty.held .cas-state { color: #3F5733; } .casualty.broke .cas-state { color: var(--pompeian); }
.casualty.broke { background: rgba(139, 30, 30, 0.08); }
.cas-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #2E2114; border: 1px solid var(--gold-leaf-dark); flex-shrink: 0; }
/* rank ladder */
.ladder { display: flex; align-items: flex-end; gap: 0.3rem; overflow-x: auto; padding: 0.4rem 0.2rem 0.6rem; scrollbar-width: thin; }
.rung { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; min-width: 74px; padding: 0.45rem 0.3rem; border-radius: 6px; border: 1px solid rgba(0, 0, 0, 0.5); background: linear-gradient(180deg, #2A241D, #1C1612); color: #8C8070; font-family: var(--font-display); font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; text-align: center; position: relative; }
.rung-dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #1C1612; border: 1px solid #3A3A3E; }
.rung.done { color: #D9CDB4; background: linear-gradient(180deg, #4A3C2C, #2A241D); } .rung.done .rung-dot { background: #3E2D0C; border-color: var(--gold-leaf-dark); }
.rung.now { color: #F6E7C8; background: linear-gradient(180deg, #8B1E1E, #5E1313); border-color: var(--gold-leaf); box-shadow: 0 0 0 1px var(--gold-leaf), 0 0 14px rgba(201, 162, 39, 0.5); transform: translateY(-4px); } .rung.now .rung-dot { background: #C9A227; border-color: #3E2D0C; }
.rung-xp { font-size: 0.55rem; color: #B4A58A; }
.ladder.compact { padding: 0.2rem 0 0.3rem; gap: 0.2rem; margin-top: 0.8rem; }
.ladder.compact .rung { min-width: 54px; padding: 0.3rem 0.2rem; font-size: 0.5rem; }
.ladder.compact .rung-dot { width: 16px; height: 16px; }
.ladder-next { width: 100%; text-align: right; }
/* phalerae on a cuirass */
.cuirass { position: relative; padding: 1.4rem 1rem 1rem; }
.cuirass-shape { position: absolute; left: 50%; top: 0; width: min(560px, 96%); height: 100%; transform: translateX(-50%); background: linear-gradient(180deg, #5A5A5E, #3A3A3E 60%, #2B2B2E); clip-path: polygon(8% 4%, 30% 0, 50% 6%, 70% 0, 92% 4%, 100% 30%, 94% 100%, 6% 100%, 0 30%); border-radius: 20px; opacity: 0.9; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.12); z-index: 0; }
.cuirass-shape::before { content: ''; position: absolute; inset: 12% 18%; border: 2px solid rgba(201, 162, 39, 0.35); border-radius: 40% 40% 50% 50% / 30% 30% 60% 60%; }
.phalerae { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 0.6rem 0.4rem; max-width: 620px; margin: 0 auto; }
.phalera { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; text-align: center; }
.ph-disc { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 38% 32%, #4A4A4E, #202022 70%); border: 2px solid #3A3A3E; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 3px 6px rgba(0, 0, 0, 0.5); transition: transform var(--dur) var(--ease-spring); }
.phalera.on .ph-disc { background: radial-gradient(circle at 38% 32%, #F0D98A, #C9A227 55%, #6B4B12 100%); border-color: #3E2D0C; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 0 0 2px rgba(0, 0, 0, 0.4), 0 4px 10px rgba(0, 0, 0, 0.5); }
.phalera:hover .ph-disc, .phalera:focus-visible .ph-disc { transform: scale(1.1); }
.ph-name { font-family: var(--font-display); font-size: 0.55rem; letter-spacing: 0.08em; text-transform: uppercase; color: #8C8070; line-height: 1.2; }
.phalera.on .ph-name { color: #F6E7C8; }
.phalera.fresh .ph-disc { animation: medalPop 0.9s var(--ease-spring) both; animation-delay: var(--d, 0ms); }
@keyframes medalPop { 0% { transform: scale(0.2) rotate(-30deg); box-shadow: 0 0 0 0 rgba(201, 162, 39, 0); } 60% { transform: scale(1.25) rotate(6deg); box-shadow: 0 0 0 10px rgba(201, 162, 39, 0.35); } 100% { transform: scale(1); } }
/* daily orders */
.orders { display: grid; gap: 0.5rem; padding: 0.9rem 1rem; background: linear-gradient(180deg, #2A241D, #1C1612); border: 1px solid rgba(0, 0, 0, 0.6); border-radius: 6px; box-shadow: var(--bevel-stone); }
.orders-head { display: flex; justify-content: space-between; align-items: center; }
.orders-head .eyebrow { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--gold-leaf-light); }
.order { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.6rem; background: rgba(240, 225, 188, 0.06); border: 1px solid rgba(201, 162, 39, 0.2); border-radius: 4px; }
.order-title { font-weight: 700; font-size: 0.9rem; }
.order.done { border-color: rgba(201, 162, 39, 0.6); }
.order.claimed { opacity: 0.7; }
/* the shop */
.shop-avatar { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.shop-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.shop-item { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.7rem 0.35rem 0.4rem; border-radius: 999px; background: linear-gradient(180deg, #3A322A, #2A241D); border: 1px solid rgba(0, 0, 0, 0.6); color: #D9CDB4; cursor: pointer; font-family: var(--font-body); font-size: 0.9rem; }
.shop-item .swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.5); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.shop-item .shop-price { font-family: var(--font-display); font-size: 0.6rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-leaf-light); display: inline-flex; align-items: center; gap: 0.2rem; }
.shop-item.on { border-color: var(--gold-leaf); box-shadow: 0 0 0 1px var(--gold-leaf), 0 0 10px rgba(201, 162, 39, 0.4); color: #F6E7C8; }
.shop-item.owned:not(.on) .shop-price { color: #B4A58A; }
/* Castra */
.castra { position: relative; display: grid; grid-template-columns: 220px minmax(0, 1fr) 300px; gap: 1.4rem; align-items: start; padding: 1.4rem; border-radius: var(--radius-stone); background: linear-gradient(180deg, rgba(28, 22, 18, 0.82), rgba(14, 10, 7, 0.9)); border: 1px solid rgba(0, 0, 0, 0.6); box-shadow: var(--bevel-stone); overflow: hidden; }
.castra-fire { position: absolute; left: 110px; bottom: -40px; width: 320px; height: 220px; background: radial-gradient(ellipse at 50% 100%, rgba(255, 179, 71, 0.35), rgba(226, 88, 30, 0.12) 40%, transparent 70%); pointer-events: none; animation: glowPulse 2.4s ease-in-out infinite; }
.castra-you { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.6rem; }
.you-avatar { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #4A3C2C, #1C1612 72%); border: 3px solid var(--gold-leaf-dark); box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.5), 0 10px 24px rgba(0, 0, 0, 0.5); }
.you-name { font-family: var(--font-display); font-size: 1.2rem; color: #F6E7C8; }
.castra-main .castra-stats { gap: 1.2rem; margin: 0.8rem 0 1rem; }
.castra-cta { margin-top: 0.2rem; }
.castra-side { display: grid; gap: 0.9rem; }
.peek { display: block; position: relative; text-decoration: none; color: inherit; perspective: 900px; }
.peek-tilt { transform: rotateX(28deg) rotateZ(-4deg); transform-origin: 50% 100%; border: 6px solid #3B2A17; box-shadow: 0 18px 30px rgba(0, 0, 0, 0.55); transition: transform 0.4s var(--ease-out); background: #BFAD86; }
.peek:hover .peek-tilt { transform: rotateX(18deg) rotateZ(-2deg) translateY(-4px); }
.peek .map25.compact { height: 150px; aspect-ratio: auto; }
.peek-label { position: absolute; left: 50%; bottom: 0.6rem; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.8rem; background: #8B1E1E; color: #F6E7C8; border: 1px solid var(--gold-leaf); font-family: var(--font-display); font-size: 0.66rem; letter-spacing: 0.16em; text-transform: uppercase; clip-path: polygon(6% 0, 94% 0, 100% 50%, 94% 100%, 6% 100%, 0 50%); }
@media (max-width: 1100px) { .castra { grid-template-columns: 180px minmax(0, 1fr); } .castra-side { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { .castra { grid-template-columns: 1fr; padding: 1rem; } .castra-side { grid-template-columns: 1fr; } .you-avatar { width: 120px; height: 120px; } }
/* shields on the palisade */
.palisade-wrap { position: relative; }
.palisade { height: 22px; margin: 0 0 -10px; background: repeating-linear-gradient(90deg, #5A3F22 0 16px, #3B2A17 16px 22px); clip-path: polygon(0 100%, 0 30%, 2% 0, 4% 30%, 6% 0, 8% 30%, 10% 0, 12% 30%, 14% 0, 16% 30%, 18% 0, 20% 30%, 22% 0, 24% 30%, 26% 0, 28% 30%, 30% 0, 32% 30%, 34% 0, 36% 30%, 38% 0, 40% 30%, 42% 0, 44% 30%, 46% 0, 48% 30%, 50% 0, 52% 30%, 54% 0, 56% 30%, 58% 0, 60% 30%, 62% 0, 64% 30%, 66% 0, 68% 30%, 70% 0, 72% 30%, 74% 0, 76% 30%, 78% 0, 80% 30%, 82% 0, 84% 30%, 86% 0, 88% 30%, 90% 0, 92% 30%, 94% 0, 96% 30%, 98% 0, 100% 30%, 100% 100%); border-radius: 2px; }
.palisade-wrap .cart { transform-origin: 50% 0; transition: transform 0.35s var(--ease-spring), filter 0.2s; }
.palisade-wrap .cart:hover { transform: translateY(-6px) rotate(-2.5deg); filter: brightness(1.08); }
:root[data-motion="off"] .palisade-wrap .cart:hover { transform: none; }
/* your legion: the parade ground */
.legion { display: grid; gap: 0.9rem; }
.cohort { padding: 0.7rem 0.9rem 0.6rem; background: linear-gradient(180deg, rgba(42, 36, 29, 0.85), rgba(28, 22, 18, 0.9)); border: 1px solid rgba(0, 0, 0, 0.6); border-left: 5px solid var(--ch); border-radius: 6px; box-shadow: var(--bevel-stone); }
.cohort-head { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.cohort-title { display: inline-flex; align-items: center; gap: 0.45rem; font-family: var(--font-display); font-size: 0.86rem; letter-spacing: 0.04em; color: #F6E7C8; text-decoration: none; }
.cohort-title .num { font-size: 0.6rem; letter-spacing: 0.16em; color: var(--gold-leaf-light); }
.ranks { display: flex; flex-wrap: wrap; gap: 2px 4px; padding: 0.3rem 0.2rem 0; background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.25)); border-radius: 4px; }
.soldier { width: 26px; height: 42px; padding: 0; border: 0; background: transparent; cursor: pointer; line-height: 0; transition: transform var(--dur-fast); }
.soldier:hover, .soldier:focus-visible { transform: translateY(-4px) scale(1.15); outline: none; filter: drop-shadow(0 0 4px rgba(201, 162, 39, 0.8)); z-index: 1; position: relative; }
.soldier.due svg { animation: bob 1.6s ease-in-out infinite; }
.soldier.small { width: 20px; height: 32px; pointer-events: none; }
.soldier.small svg { width: 20px; height: 32px; }
.legion-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.78rem; color: var(--muted); }
/* the marching route (campaign plan) */
.march-route { list-style: none; margin: 0.8rem 0 0; padding: 0 0 0 1.2rem; position: relative; display: grid; gap: 0.4rem; }
.march-route::before { content: ''; position: absolute; left: 1.95rem; top: 0.5rem; bottom: 0.5rem; width: 4px; background: repeating-linear-gradient(180deg, #8B6B3A 0 8px, transparent 8px 14px); border-radius: 2px; }
.march-day { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.3rem 0 0.1rem 2.2rem; }
.waypoint { position: relative; }
.waypoint .task { display: grid; grid-template-columns: 34px auto 1fr; gap: 0.6rem; align-items: center; padding: 0.4rem 0.6rem; border-radius: 6px; background: rgba(0, 0, 0, 0.2); border: 1px solid rgba(201, 162, 39, 0.15); cursor: pointer; }
.wp-castrum { position: relative; width: 34px; height: 34px; border-radius: 4px; display: grid; place-items: center; background: linear-gradient(180deg, #5A3F22, #3B2A17); border: 1px solid #2A1C0E; box-shadow: var(--bevel-bronze); }
.wp-n { position: absolute; right: -6px; bottom: -6px; width: 16px; height: 16px; border-radius: 50%; background: #2E2114; color: var(--gold-leaf-light); font-family: var(--font-display); font-size: 0.55rem; display: grid; place-items: center; border: 1px solid var(--gold-leaf-dark); }
.waypoint.done .task { border-color: rgba(139, 30, 30, 0.6); background: rgba(139, 30, 30, 0.12); }
.waypoint.done .t { text-decoration: line-through; opacity: 0.7; }
/* the promotion ceremony */
.cer-cuirass { position: absolute; right: 8%; top: 12%; width: 150px; height: 170px; }
.cer-plate { position: absolute; inset: 0; background: linear-gradient(180deg, #5A5A5E, #3A3A3E 60%, #2B2B2E); clip-path: polygon(10% 4%, 32% 0, 50% 6%, 68% 0, 90% 4%, 100% 36%, 92% 100%, 8% 100%, 0 36%); border-radius: 14px; box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.15); }
.cer-medal { position: absolute; left: 50%; top: 40%; width: 56px; height: 56px; border-radius: 50%; transform: translate(-50%, -260px) scale(0.4); opacity: 0; display: grid; place-items: center; background: radial-gradient(circle at 38% 32%, #F0D98A, #C9A227 55%, #6B4B12 100%); border: 2px solid #3E2D0C; box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.4), 0 6px 14px rgba(0, 0, 0, 0.5); transition: transform 0.9s var(--ease-spring), opacity 0.3s; }
.cer-cuirass.pinned .cer-medal { transform: translate(-50%, -50%) scale(1); opacity: 1; }
@media (max-width: 900px) { .cer-cuirass { right: 6%; top: 30%; width: 100px; height: 112px; } .cer-medal { width: 40px; height: 40px; } }

.you-avatar { overflow: hidden; }
.you-avatar .avatar { transform: translateY(-4%) scale(1.12); transform-origin: 50% 50%; }

.ladder.compact .rung { min-width: 44px; padding: 0.25rem 0.15rem; font-size: 0.44rem; letter-spacing: 0.04em; }
.ladder.compact .rung.now { min-width: 56px; font-size: 0.5rem; }

/* ---------- plain names first, Roman flavour second ---------- */
.nav-link { align-items: center; }
.nav-text { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.nav-main { font-family: var(--font-display); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.nav-sub { font-family: var(--font-body); font-size: 0.66rem; letter-spacing: 0.02em; text-transform: none; color: #8C8070; font-style: italic; }
.nav-link.active .nav-sub { color: #D9CDB4; }
/* ---------- lessons that make you do something ---------- */
.hook-row { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 1.2rem; align-items: start; }
.hook-art { border: 1px solid rgba(110, 90, 62, 0.5); border-radius: 8px; overflow: hidden; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25); }
.hook-art .vignette-svg { display: block; width: 100%; height: auto; }
@media (max-width: 760px) { .hook-row { grid-template-columns: 1fr; } .hook-art { max-width: 240px; } }
.recall-card { padding: 1.2rem 1.3rem; border: 1px dashed rgba(139, 30, 30, 0.5); border-radius: 12px; background: rgba(139, 30, 30, 0.05); text-align: center; }
.recall-card .eyebrow { color: var(--pompeian); }
.recall-prompt { font-family: var(--font-display); font-size: 1.3rem; margin: 0.4rem 0 0.3rem; }
.recall-btn { margin-top: 0.6rem; }
.recall-answer { animation: rise 0.3s ease-out; text-align: left; }
.recall-marks { margin-top: 0.6rem; justify-content: center; }
.lines .line { opacity: 0; transform: translateY(8px); transition: opacity 0.35s, transform 0.35s; max-height: 0; overflow: hidden; margin: 0; }
.lines .line.shown { opacity: 1; transform: none; max-height: 20em; margin: 0 0 0.6rem; }
.callout.hidden-line { display: none; }
.reveal-line { margin-top: 0.4rem; }
:root[data-motion="off"] .lines .line { transition: none; }
/* the concept map */
.cmap-wrap { display: grid; gap: 0.9rem; }
.cmap { position: relative; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.6rem; padding: 0.8rem 0.4rem; }
.cmap-hub { flex: 0 0 100%; display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.6rem 1rem; }
.cmap-hub .glyph { font-size: 1.6rem; }
.cmap-term { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--vellum-ink); text-align: center; }
.cmap-stone { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.55rem 0.9rem; min-width: 150px; justify-content: center; background: linear-gradient(180deg, #DCC89C, #CDB47C 60%, #B99E66); color: var(--vellum-ink); border: 1px solid #5A4330; border-radius: 10px 4px 9px 5px / 5px 9px 4px 10px; box-shadow: var(--bevel-stone-light); font-family: var(--font-display); font-size: 0.74rem; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; transition: transform var(--dur-fast) var(--ease-spring), box-shadow var(--dur-fast); }
.cmap-stone:hover { transform: translateY(-2px); }
.cmap-stone.turned { background: linear-gradient(180deg, #E7D7A0, #D9C48A 60%, #C7AE6E); }
.cmap-stone.on { box-shadow: var(--bevel-stone-light), 0 0 0 2px var(--gold-leaf), 0 0 14px rgba(201, 162, 39, 0.5); }
.cmap.complete .cmap-hub .cmap-term::after { content: ' ✓'; color: #3F5733; }
.cmap-detail { padding: 0.9rem 1.05rem; border-left: 4px solid var(--ch, var(--gold-leaf)); background: rgba(255, 250, 235, 0.45); border-radius: 0 10px 10px 0; min-height: 70px; animation: rise 0.25s ease-out; }
.cmap-detail .eyebrow { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--pompeian); margin-bottom: 0.2rem; }
.cmap-detail p { margin: 0; line-height: 1.55; }

/* radial concept map */
.cmap.radial { position: relative; display: block; height: 350px; padding: 0; }
.cmap.radial .cmap-wires { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cmap.radial .cmap-wire { stroke: rgba(90, 67, 48, 0.4); stroke-width: 1.5; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; transition: stroke 0.3s; }
.cmap.radial .cmap-wire.lit { stroke: var(--ch, var(--gold-leaf)); stroke-width: 2.5; stroke-dasharray: none; }
.cmap.radial .cmap-hub { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 160px; height: 160px; border-radius: 50%; justify-content: center; padding: 0.6rem; background: radial-gradient(circle at 50% 35%, #F1E4C0, #D9C48A 70%, #C7AE6E); border: 2px solid #5A4330; box-shadow: var(--bevel-stone-light), 0 10px 22px rgba(0, 0, 0, 0.25); }
.cmap.radial .cmap-term { font-size: 0.95rem; line-height: 1.15; }
.cmap.radial .cmap-stone { position: absolute; transform: translate(-50%, -50%); min-width: 0; white-space: nowrap; }
.cmap.radial .cmap-stone:hover { transform: translate(-50%, calc(-50% - 2px)); }
.cmap.radial.complete .cmap-hub { box-shadow: var(--bevel-stone-light), 0 0 0 3px var(--gold-leaf), 0 0 24px rgba(201, 162, 39, 0.5); }
@media (max-width: 760px) {
  .cmap.radial { height: auto; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; padding: 0.6rem 0; }
  .cmap.radial .cmap-wires { display: none; }
  .cmap.radial .cmap-hub { position: static; transform: none; width: auto; height: auto; border-radius: 14px; flex: 0 0 100%; }
  .cmap.radial .cmap-stone { position: static; transform: none; white-space: normal; min-width: 140px; }
  .cmap.radial .cmap-stone:hover { transform: translateY(-2px); }
}

/* ---------- typed answers (numeric / multistep) ---------- */
.numeric-work { margin-top: 0.9rem; display: grid; gap: 0.5rem; }
.num-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.num-unit { font-family: var(--font-display); font-weight: 700; color: var(--gold-leaf); letter-spacing: 0.04em; }
.num-in { flex: 1 1 160px; min-width: 120px; font-size: 1.25rem; font-family: var(--font-mono); padding: 0.6rem 0.8rem; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(0, 0, 0, 0.25); color: var(--text); }
[data-theme="light"] .num-in { background: rgba(255, 250, 240, 0.9); }
.num-in:focus { outline: 2px solid var(--gold-leaf); outline-offset: 1px; }
.num-in.shake { animation: shake 0.3s; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
:root[data-motion="off"] .num-in.shake { animation: none; }
.num-hint { margin-top: -0.2rem; }
.num-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.num-step { padding: 0.55rem 0.7rem; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.14); display: grid; gap: 0.35rem; }
[data-theme="light"] .num-step { background: rgba(90, 67, 48, 0.07); }
.num-step.now { border-color: var(--gold-leaf); box-shadow: 0 0 0 1px color-mix(in srgb, var(--gold-leaf) 40%, transparent); }
.num-step.ok { border-color: color-mix(in srgb, var(--laurel) 60%, transparent); }
.num-step.no { border-color: color-mix(in srgb, var(--pompeian-light) 70%, transparent); }
.num-step.ahead { opacity: 0.55; }
.num-step-label { font-weight: 700; display: flex; align-items: center; gap: 0.5rem; }
.num-step-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--gold-leaf); color: #1A1206; font-family: var(--font-display); font-size: 0.75rem; font-weight: 800; }
.num-step-val { font-family: var(--font-mono); font-size: 0.92rem; display: flex; align-items: center; gap: 0.35rem; }
.num-compare { display: flex; gap: 1.2rem; flex-wrap: wrap; margin: 0.4rem 0 0.6rem; font-size: 0.95rem; }
.num-you.no b { color: var(--pompeian-light); } .num-you.ok b { color: var(--laurel); }
.diagnosis { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.6rem 0.8rem; border-radius: 10px; background: color-mix(in srgb, var(--pompeian) 18%, transparent); border: 1px solid color-mix(in srgb, var(--pompeian-light) 55%, transparent); margin-bottom: 0.6rem; }
.worked { margin: 0.4rem 0 0.6rem; }
.worked-lines { margin: 0.3rem 0 0; padding-left: 1.3rem; display: grid; gap: 0.25rem; font-family: var(--font-mono); font-size: 0.86rem; line-height: 1.45; }
.keys, .errlib { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.3rem; font-size: 0.9rem; }
.keys li { font-family: var(--font-mono); font-size: 0.84rem; }
.errlib li.hit { color: var(--text); background: color-mix(in srgb, var(--pompeian) 20%, transparent); border-radius: 6px; padding: 0.2rem 0.4rem; margin-left: -0.4rem; }

/* ---------- concept cards (Learn in card mode) ---------- */
.card-slide { display: grid; gap: 0.7rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.6rem; }
.card-grid .callout { margin: 0; }
.formula-callout .formula-text { font-family: var(--font-mono); font-size: 1.02rem; margin-top: 0.3rem; line-height: 1.5; }
.vault-rows { display: grid; gap: 0.5rem; }
.vault-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.8rem; align-items: center; padding: 0.6rem 0.75rem; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.14); }
[data-theme="light"] .vault-row { background: rgba(90, 67, 48, 0.07); }
.vault-main { display: grid; gap: 0.25rem; min-width: 0; }
.vault-main .formula-text { font-family: var(--font-mono); font-size: 1rem; line-height: 1.5; }
.vault-side { display: grid; gap: 0.35rem; justify-items: end; }
.topic-picker { display: grid; gap: 0.35rem; }
.topic-row { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.topic-row .chip { cursor: pointer; }
.drill-count { gap: 0.4rem; }
@media (max-width: 640px) { .vault-row { grid-template-columns: 1fr; } .vault-side { justify-items: start; } }

/* ---- typeset formulas (KaTeX, app/math.js): fractions, subscripts and exponents as on the exam formula sheet */
.katex { font-size: 1.06em; }
.math { white-space: normal; } /* KaTeX may break a long run at an operator; the boxes below shrink instead of clipping */
.callout > div { min-width: 0; flex: 1 1 auto; }
.card-grid > .callout, .feedback-main, .seal-text { min-width: 0; }
.learn-layout > *, .learn-main, .lesson, .lesson-stage, .slide, .card-slide > *, .formula-callout, .vault-main, .vault-row, .sheet-term dd { min-width: 0; } /* a wide formula scrolls inside its box instead of widening the page */
.worked-lines { font-family: var(--font-body); font-size: 1rem; line-height: 1.7; text-transform: none; font-variant: normal; letter-spacing: 0; }
.formula-lines { display: flex; flex-wrap: wrap; gap: 0.35rem 1.8rem; align-items: baseline; margin-top: 0.35rem; }
.formula-lines .formula-line { max-width: 100%; overflow-x: auto; overflow-y: hidden; padding: 0.15rem 0; white-space: nowrap; }
.formula-lines .formula-line .katex { font-size: 1.2em; }
.formula-lines .formula-line.plain { font-family: var(--font-mono); font-size: 0.95rem; }
.formula-callout .formula-text, .vault-main .formula-text { font-family: inherit; }
.worked-lines .katex { font-size: 1.12em; }
.worked-lines li { line-height: 1.7; }
.stem .katex, .option .katex, .num-step-label .katex { font-size: 1.02em; }
.explanation .katex, .seal-text .katex, .errlib .katex { font-size: 1.04em; }
