/* Markets of War — application shell: title, invite card, War Council lobby, map preview, codex.
   Uses the tokens in base.css. Screen-level layout only; game screen styles live in game.css. */

:root {
  --candle: #f2b45a;
  --candle-deep: #c86a1e;
  --leather: #3a1a16;
  --gutter: clamp(16px, 3vw, 32px);
}

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.noscript { padding: 24px; text-align: center; }

.app { position: fixed; inset: 0; }
.app__mute { position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); z-index: var(--z-hud); color: var(--brass-hi); background: rgba(20,12,8,.72); }
.screen { position: absolute; inset: 0; overflow-x: hidden; overflow-x: clip; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--brass-lo) transparent; }
.screen--center { display: grid; place-items: center; padding: var(--gutter); }
.game-stage { position: absolute; inset: 0; }
.game-stage__screen { position: absolute; inset: 0; }
.ldr-inline { animation: ldr-in .25s .15s both; }

.input--sm { min-height: 34px; padding: .15em .5em; font-size: .92rem; }
.linkish { background: none; border: 0; padding: .3em; color: inherit; font-style: italic; text-decoration: underline; text-decoration-color: rgba(122,95,53,.6); text-underline-offset: 3px; cursor: pointer; }
.linkish:hover { text-decoration-color: currentColor; }

/* ---------- themed loader (.ldr-…) ---------- */
.ldr {
  position: fixed; inset: 0; z-index: 55; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse 60% 50% at 50% 45%, #3a2416 0%, #1f140c 55%, #0e0905 100%) #120b07;
  animation: ldr-in .28s var(--ease) both;
}
.ldr--boot { animation-delay: .15s; }
.ldr--out { animation: ldr-out .32s ease both; pointer-events: none; }
@keyframes ldr-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ldr-out { from { opacity: 1; } to { opacity: 0; } }
.ldr__glow { position: absolute; left: 50%; top: 44%; width: 520px; height: 520px; max-width: 120vw; translate: -50% -50%; border-radius: 50%; background: radial-gradient(closest-side, rgba(242,180,90,.16), transparent 70%); animation: ldr-candle 3.4s ease-in-out infinite alternate; pointer-events: none; }
@keyframes ldr-candle { 0% { opacity: .75; transform: scale(.97); } 40% { opacity: 1; } 70% { opacity: .85; transform: scale(1.02); } 100% { opacity: .95; transform: scale(1); } }
.ldr__body { position: relative; display: grid; justify-items: center; gap: 14px; text-align: center; }
.ldr__label { margin: 6px 0 0; font-family: var(--font-display); font-weight: 600; letter-spacing: .08em; font-size: 1.15rem; color: var(--brass-hi); text-shadow: 0 2px 8px rgba(0,0,0,.8); }
.ldr__line { margin: 0; min-height: 1.5em; font-family: var(--font-body); font-style: italic; font-size: 1.02rem; color: rgba(233,217,181,.72); animation: ldr-line .5s ease both; }
@keyframes ldr-line { from { opacity: 0; transform: translateY(4px); } }
.ldr-compass { width: 112px; height: 112px; filter: drop-shadow(0 8px 14px rgba(0,0,0,.55)); animation: ldr-bob 2.6s ease-in-out infinite; }
.ldr-compass svg { width: 100%; height: 100%; display: block; }
.ldr-needle { transform-origin: 60px 60px; transform-box: view-box; animation: ldr-needle 7.8s cubic-bezier(.45,.05,.35,1) infinite; }
@keyframes ldr-bob { 50% { transform: translateY(-3px) rotate(-1.5deg); } }
@keyframes ldr-needle {
  0% { transform: rotate(-70deg); } 6% { transform: rotate(38deg); } 11% { transform: rotate(-20deg); } 16% { transform: rotate(10deg); }
  21% { transform: rotate(-4deg); } 26%, 33% { transform: rotate(0deg); }
  39% { transform: rotate(160deg); } 44% { transform: rotate(108deg); } 49% { transform: rotate(132deg); } 54% { transform: rotate(117deg); } 59%, 66% { transform: rotate(122deg); }
  72% { transform: rotate(-50deg); } 77% { transform: rotate(12deg); } 82% { transform: rotate(-26deg); } 87% { transform: rotate(-12deg); } 93%, 100% { transform: rotate(-70deg); }
}
.ldr-compass--sm { width: 56px; height: 56px; filter: drop-shadow(0 4px 8px rgba(0,0,0,.4)); }
.ldr-inline { display: grid; justify-items: center; align-content: center; gap: 10px; padding: 24px; min-height: 160px; text-align: center; }
.ldr-inline__line { margin: 0; font-style: italic; color: inherit; opacity: .75; }
.ldr--still .ldr-needle, .ldr--still .ldr-compass, .ldr--still .ldr__glow { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .ldr-needle, .ldr-compass, .ldr__glow { animation: none !important; }
  .ldr-compass { animation: ldr-pulse 2.4s ease-in-out infinite !important; animation-duration: 2.4s !important; }
  .ldr__line { animation: none !important; }
  .ldr { animation-duration: .4s !important; }
  .ldr--out { animation-duration: .32s !important; }
}
@keyframes ldr-pulse { 50% { opacity: .6; } }
/* Content waiting behind the veil: laid out (so it can measure itself) but never painted or focusable. */
.is-gated { visibility: hidden !important; }

/* ---------- loader / notices / toasts ---------- */
.loader { display: grid; justify-items: center; gap: 14px; color: var(--parchment); font-style: italic; }
.loader__seal { width: 54px; height: 54px; border-radius: 50%; border: 3px solid rgba(176,141,87,.25); border-top-color: var(--brass-hi); animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.notice { width: min(560px, 100%); }
.notice h2 { color: var(--oxblood); }
.notice__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.notice__err { font: .8rem/1.4 ui-monospace, monospace; white-space: pre-wrap; background: rgba(43,33,24,.08); padding: 8px 10px; border-radius: var(--radius); color: var(--ink-soft); max-height: 120px; overflow: auto; }

.toasts { position: fixed; left: 50%; top: max(72px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: var(--z-toast); display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toasts .toast { pointer-events: auto; animation: rise-in .25s var(--ease) both; cursor: pointer; font-size: 1rem; border-left: 4px solid var(--brass); }
.toast--good { border-left-color: var(--good) !important; }
.toast--bad { border-left-color: var(--oxblood-hi) !important; }

.confirm { width: min(460px, 100%); }
.confirm h2 { color: var(--oxblood); font-size: 1.45rem; }
.confirm__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.veil { position: absolute; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: 16px; background: rgba(10,6,3,.66); backdrop-filter: blur(3px) grayscale(.4); animation: fade-in .3s both; }
.veil__card { width: min(440px, 100%); text-align: center; display: grid; justify-items: center; gap: 6px; padding: 26px 24px; }
.veil__card h2 { font-size: 1.35rem; color: var(--brass-hi); margin-top: 8px; }
.veil__card p { margin: 0 0 10px; color: rgba(233,217,181,.82); }

/* ---------- connection lamp ---------- */
.lamp { display: inline-flex; align-items: center; gap: .55em; margin: 0; font-size: .92rem; font-style: italic; color: rgba(233,217,181,.78); }
.lamp__dot { width: 9px; height: 9px; border-radius: 50%; background: #888; flex: none; box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
.lamp--ok .lamp__dot { background: #8fbf6a; box-shadow: 0 0 8px #8fbf6a, 0 0 0 2px rgba(0,0,0,.35); }
.lamp--wait .lamp__dot { background: var(--candle); animation: pulse 1.2s ease-in-out infinite; }
.lamp--bad .lamp__dot { background: var(--oxblood-hi); }
@keyframes pulse { 50% { opacity: .35; } }

/* =========================================================
   Title screen
   ========================================================= */
.title { --px: 0; --py: 0; display: grid; background: #0c0805; }
.title-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.title-bg__hero {
  position: absolute; inset: -4%; width: 108%; height: 108%; object-fit: cover;
  transform: translate3d(calc(var(--px) * -18px), calc(var(--py) * -12px), 0) scale(1.02);
  transition: transform .6s var(--ease);
  filter: saturate(.95) brightness(.8);
}
.title-bg__glow { position: absolute; border-radius: 50%; mix-blend-mode: screen; pointer-events: none; }
.title-bg__glow--a { left: -10%; top: -25%; width: 60vmax; height: 60vmax; background: radial-gradient(closest-side, rgba(242,180,90,.34), rgba(200,106,30,.12) 45%, transparent 72%); animation: flicker 5.3s steps(1, end) infinite, sway 9s ease-in-out infinite alternate; transform: translate3d(calc(var(--px) * 10px), calc(var(--py) * 8px), 0); }
.title-bg__glow--b { right: -18%; top: 10%; width: 46vmax; height: 46vmax; background: radial-gradient(closest-side, rgba(242,170,80,.18), transparent 70%); animation: flicker 7.1s steps(1, end) infinite reverse; }
.title-bg__shade {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 62% at 50% 42%, rgba(10,6,3,.1), rgba(10,6,3,.55) 70%, rgba(6,3,1,.92) 100%),
    linear-gradient(180deg, rgba(6,3,1,.55), transparent 26%, transparent 60%, rgba(6,3,1,.8));
}
@keyframes flicker {
  0% { opacity: .92; } 7% { opacity: .78; } 13% { opacity: 1; } 21% { opacity: .86; } 34% { opacity: .97; }
  47% { opacity: .8; } 55% { opacity: .95; } 71% { opacity: .84; } 83% { opacity: 1; } 92% { opacity: .88; }
}
@keyframes sway { to { translate: 1.5% 1%; scale: 1.04; } }

.title__stage { position: relative; z-index: 1; min-height: 100%; display: grid; justify-items: center; align-content: center; gap: clamp(18px, 3.2vh, 34px); padding: clamp(28px, 7vh, 72px) var(--gutter) 56px; }

.wordmark { display: grid; justify-items: center; text-align: center; }
.wordmark__emblem { width: clamp(84px, 12vh, 132px); height: auto; aspect-ratio: 1; filter: drop-shadow(0 6px 18px rgba(0,0,0,.7)) drop-shadow(0 0 24px rgba(242,180,90,.18)); margin-bottom: clamp(4px, 1.4vh, 14px); }
.wordmark__title {
  margin: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; column-gap: .22em;
  font-family: var(--font-display); font-weight: 700; text-transform: uppercase; line-height: .95;
  font-size: clamp(2.7rem, 8.4vw, 7.4rem); letter-spacing: .07em;
}
.wordmark__word {
  background: linear-gradient(176deg, #fbeec4 0%, #e8cc8a 30%, #b08d57 58%, #f1dca0 64%, #8a6a3a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 rgba(43,24,10,.9)) drop-shadow(0 10px 22px rgba(0,0,0,.75));
}
.wordmark__pair { display: inline-flex; align-items: baseline; gap: .22em; white-space: nowrap; }
.title__stage::before { content: ""; position: absolute; left: 0; right: 0; margin-inline: auto; top: 46%; width: min(1100px, 100%); height: 86%; translate: 0 -50%; background: radial-gradient(closest-side, rgba(8,5,2,.72), rgba(8,5,2,.4) 60%, transparent); pointer-events: none; z-index: -1; }
.wordmark__of {
  font-family: var(--font-body); font-style: italic; font-weight: 400; text-transform: none; letter-spacing: 0;
  font-size: .4em; color: var(--brass-hi); padding: 0 .05em;
  text-shadow: 0 2px 8px rgba(0,0,0,.8);
}
.wordmark__tag {
  margin: clamp(10px, 1.8vh, 18px) 0 0; font-style: italic; font-size: clamp(1.1rem, 2.2vw, 1.5rem); color: var(--parchment-hi);
  text-shadow: 0 2px 10px rgba(0,0,0,.9); display: flex; align-items: center; gap: .8em;
}
.wordmark__tag::before, .wordmark__tag::after { content: ""; width: clamp(24px, 6vw, 70px); height: 1px; background: linear-gradient(90deg, transparent, var(--brass)); }
.wordmark__tag::after { transform: scaleX(-1); }

/* command panel */
.command {
  width: min(470px, 100%); padding: 20px 20px 16px; display: grid; gap: 14px;
  background:
    linear-gradient(180deg, rgba(48,28,20,.9), rgba(22,13,9,.94)),
    url("/assets/img/leather.webp") center / 256px;
  border-color: rgba(176,141,87,.7);
  box-shadow: 0 30px 80px rgba(0,0,0,.7), inset 0 1px 0 rgba(220,193,138,.22), inset 0 0 0 4px rgba(0,0,0,.25), inset 0 0 0 5px rgba(176,141,87,.25);
  backdrop-filter: blur(6px);
}
.namefield > span { color: var(--brass-hi); }
.namefield__input { font-size: 1.15rem; font-family: var(--font-body); }
.orders { display: grid; gap: 10px; }
.order {
  display: grid; grid-template-columns: 48px 1fr; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 10px 14px; min-height: 66px; border-radius: var(--radius); cursor: pointer; color: var(--parchment-hi);
  background: linear-gradient(180deg, rgba(90,70,49,.55), rgba(40,28,19,.7)); border: 1px solid rgba(176,141,87,.55);
  box-shadow: inset 0 1px 0 rgba(255,235,190,.12), 0 2px 6px rgba(0,0,0,.35);
  transition: transform .14s var(--ease), border-color .14s, background .14s;
}
.order:hover:not(:disabled) { border-color: var(--brass-hi); background: linear-gradient(180deg, rgba(110,84,56,.6), rgba(50,34,22,.75)); transform: translateY(-1px); }
.order:active:not(:disabled) { transform: translateY(1px); }
.order:disabled { opacity: .5; cursor: not-allowed; }
.order__icon { width: 48px; height: 48px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,.6)); }
.order__text { display: grid; gap: 1px; }
.order__title { font-family: var(--font-caps); font-size: 1.28rem; letter-spacing: .05em; line-height: 1.1; }
.order__line { font-size: .98rem; opacity: .78; line-height: 1.25; }
.order--primary { min-height: 78px; color: var(--ink); background: linear-gradient(180deg, #ecd49a, var(--brass) 70%, #9a7a48); border-color: #f4e0ad; box-shadow: inset 0 1px 0 rgba(255,248,225,.7), inset 0 -2px 0 rgba(90,60,20,.35), 0 6px 18px rgba(0,0,0,.45), 0 0 30px rgba(242,180,90,.12); }
.order--primary:hover:not(:disabled) { background: linear-gradient(180deg, #f5dfaa, #c19d64 70%, #a58250); border-color: #fff0c8; }
.order--primary .order__title { font-size: 1.5rem; font-weight: 600; }
.order--primary .order__line { opacity: .85; }
.order.is-busy .order__title { font-style: italic; }
.joinrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; animation: rise-in .2s var(--ease) both; }
/* An <input> has a wide intrinsic size (20 characters); with this letter-spacing it would push the page wider than a phone. */
.codeinput { min-width: 0; width: 100%; font-family: var(--font-display); font-size: 1.6rem; letter-spacing: .5em; text-align: center; text-transform: uppercase; padding-left: 1em; }
@media (max-width: 560px) {
  .joinrow { grid-template-columns: minmax(0, 1fr); }
  .joinrow .btn { width: 100%; min-height: 52px; }
  .codeinput { letter-spacing: .35em; padding-left: .7em; }
}
.command__learn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 4px; border-top: 1px solid rgba(176,141,87,.25); }
.command__learn .btn { color: var(--parchment); font-size: 1.02rem; }

.resume { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding: 10px 12px; border-radius: var(--radius); background: rgba(123,45,38,.35); border: 1px solid rgba(201,121,111,.5); }
.resume p { margin: 0; }
.resume__actions { display: flex; gap: 8px; }

.title__lamp { position: fixed; left: max(16px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); z-index: 2; }

/* invite card */
.title__stage--invite { gap: clamp(14px, 3vh, 28px); }
.title__stage--invite .wordmark__title { font-size: clamp(2rem, 5.4vw, 4.4rem); }
.title__stage--invite .wordmark__emblem { width: clamp(64px, 9vh, 96px); }
.invite-card { position: relative; width: min(470px, 100%); display: grid; gap: 14px; text-align: center; padding: 44px 24px 18px; margin-top: 26px; }
.invite-card__seal { position: absolute; top: -36px; left: 50%; width: 72px; height: 72px; translate: -50% 0; filter: drop-shadow(0 4px 6px rgba(0,0,0,.5)); }
.invite-card__title { font-size: clamp(1.35rem, 3.6vw, 1.75rem); color: var(--oxblood); margin: 0; text-wrap: balance; }
.invite-card__code { margin: 0; color: var(--ink-soft); }
.invite-card__code b { font-family: var(--font-display); letter-spacing: .3em; font-size: 1.2rem; color: var(--ink); }
.invite-card .field { text-align: left; }
.invite-card .namefield > span { color: var(--ink-soft); }
.invite-card__go { min-height: 54px; font-size: 1.25rem; }
.invite-card__warn { margin: 0; color: var(--oxblood); }
.invite-card .linkish { color: var(--ink-soft); justify-self: center; }

/* entrance: one orchestrated reveal */
.title:not(.is-in) :is(.wordmark__emblem, .wordmark__title, .wordmark__tag, .command, .invite-card) { opacity: 0; }
.title.is-in .wordmark__emblem { animation: emblem-in 1s var(--ease) both; }
.title.is-in .wordmark__title { animation: ink-in 1.2s .15s var(--ease) both; }
.title.is-in .wordmark__tag { animation: fade-in .9s .7s both; }
.title.is-in .command, .title.is-in .invite-card { animation: rise-in .8s .9s var(--ease) both; }
@keyframes emblem-in { from { opacity: 0; transform: scale(.86) translateY(-8px); filter: drop-shadow(0 0 0 transparent) blur(4px); } }
@keyframes ink-in { from { opacity: 0; letter-spacing: .22em; filter: blur(6px); } }

/* =========================================================
   Lobby — The War Council
   ========================================================= */
.lobby { display: flex; flex-direction: column; }
.lobby__bg { position: fixed; inset: 0; z-index: -1; background: radial-gradient(ellipse 80% 60% at 40% 35%, rgba(242,180,90,.08), transparent 70%), linear-gradient(rgba(12,8,5,.55), rgba(12,8,5,.78)), var(--wood) url("/assets/img/bg-table.webp") center / cover no-repeat; }
.lobby__bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px var(--gutter) 10px; }
.lobby__tools .mute { min-height: 32px; min-width: 40px; color: var(--brass-hi); }
.lobby__emblem { width: 48px; height: 48px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.6)); }
.lobby__heading h1 { margin: 0; font-size: clamp(1.45rem, 3vw, 2.1rem); color: var(--brass-hi); text-shadow: 0 2px 8px rgba(0,0,0,.7); }
.lobby__sub { margin: 0; font-size: .98rem; color: rgba(233,217,181,.75); }
.lobby__sub b { font-family: var(--font-display); letter-spacing: .18em; color: var(--parchment-hi); }
.lobby__lamp { margin-left: auto; }
.lobby__tools { display: flex; gap: 8px; }
.lobby__tools .btn { color: var(--parchment); }

.lobby__grid { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: clamp(16px, 2vw, 28px); padding: 6px var(--gutter) 24px; align-items: start; }
.lobby__main { display: grid; gap: 26px; min-width: 0; }
.lobby__side { display: grid; gap: 16px; min-width: 0; }
.side__title { font-size: 1.15rem; margin: 0 0 .5em; letter-spacing: .06em; }
.panel .side__title { color: var(--oxblood); }
.panel--dark .side__title { color: var(--brass-hi); }

/* council table */
.council { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto auto; gap: 14px 16px; position: relative; }
.council__seats { display: contents; list-style: none; margin: 0; padding: 0; }
.seat--p0 { grid-area: 1 / 1; } .seat--p1 { grid-area: 1 / 2; } .seat--p2 { grid-area: 1 / 3; }
.seat--p3 { grid-area: 3 / 3; } .seat--p4 { grid-area: 3 / 2; } .seat--p5 { grid-area: 3 / 1; }
.council__table {
  grid-area: 2 / 1 / 3 / 4; position: relative; display: grid; place-items: center; margin: 2px 6%; padding: clamp(12px, 1.8vw, 20px) clamp(28px, 6vw, 80px) clamp(18px, 2.4vw, 28px);
  border-radius: 50% / 50%; cursor: zoom-in; color: inherit; font: inherit;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(242,180,90,.16), transparent 60%),
    linear-gradient(180deg, #4a2a1c, #2a170f);
  border: 3px solid #6b4a2a;
  box-shadow: 0 0 0 2px #2a170f, 0 0 0 5px rgba(176,141,87,.6), 0 26px 60px rgba(0,0,0,.65), inset 0 2px 0 rgba(255,220,170,.15), inset 0 -18px 40px rgba(0,0,0,.45);
}
.council__map { display: block; width: min(380px, 100%); transform: rotate(-1.2deg); box-shadow: 0 10px 24px rgba(0,0,0,.6); border-radius: 3px; overflow: hidden; outline: 1px solid rgba(43,33,24,.6); transition: transform .3s var(--ease); }
.council__table:hover .council__map { transform: rotate(0) scale(1.02); }
.council__label { position: absolute; bottom: 10px; left: 50%; translate: -50% 0; padding: .1em .9em; font-family: var(--font-caps); font-size: .95rem; letter-spacing: .08em; color: var(--parchment-hi); background: rgba(28,19,13,.85); border: 1px solid var(--brass-lo); border-radius: 999px; white-space: nowrap; }

.seat {
  position: relative; display: grid; grid-template-columns: 68px minmax(0, 1fr); gap: 12px; align-items: start; min-height: 104px;
  padding: 12px 12px 12px 12px; border-radius: var(--radius-lg); color: var(--ink);
  background: var(--parchment) url("/assets/img/parchment.webp") center / 420px;
  border: 1px solid var(--brass-lo); box-shadow: var(--shadow), inset 0 0 30px rgba(122,95,53,.25);
  border-top: 4px solid var(--pc);
}
.seat--me { box-shadow: var(--shadow), inset 0 0 30px rgba(122,95,53,.25), 0 0 0 2px rgba(220,193,138,.7); }
.seat__medal { position: relative; width: 68px; height: 68px; }
.seat__portrait, .seat__initial { width: 68px; height: 68px; border-radius: 50%; object-fit: cover; object-position: 50% 22%; display: grid; place-items: center; border: 3px solid var(--pc); box-shadow: 0 0 0 1px rgba(43,33,24,.6), 0 3px 8px rgba(0,0,0,.35); }
.seat__initial { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--parchment-hi); background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pc) 70%, white), var(--pc) 60%, color-mix(in srgb, var(--pc) 60%, black)); text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.seat__colour { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; padding: 0; background: var(--c); border: 2px solid var(--parchment-hi); box-shadow: 0 1px 4px rgba(0,0,0,.5); cursor: pointer; }
.seat__colour:disabled { cursor: default; }
.seat__colour:not(:disabled)::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 1px dashed rgba(43,33,24,.55); }
.colours { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; display: grid; grid-template-columns: repeat(3, 34px); gap: 8px; padding: 10px; background: var(--wood-hi); border: 1px solid var(--brass); border-radius: var(--radius); box-shadow: var(--shadow-lift); animation: rise-in .15s var(--ease) both; }
.colours__c { width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 2px solid rgba(0,0,0,.4); cursor: pointer; box-shadow: inset 0 2px 3px rgba(255,255,255,.25); }
.colours__c.is-on { border-color: var(--parchment-hi); box-shadow: 0 0 0 2px var(--brass-hi); }
.colours__c:disabled { opacity: .22; cursor: not-allowed; }
.seat__body { min-width: 0; display: grid; gap: 2px; align-content: start; }
.seat__nameline { display: flex; align-items: center; gap: 6px; min-width: 0; padding-right: 22px; }
.seat__name { font-family: var(--font-display); font-weight: 600; font-size: 1.08rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat--ai .seat__name { white-space: normal; font-size: 1rem; }
.seat__crown { width: 22px; height: 22px; flex: none; }
.seat__edit { flex: none; border: 0; background: none; color: var(--ink-faint); padding: 4px; cursor: pointer; border-radius: 4px; }
.seat__edit:hover { color: var(--ink); background: rgba(43,33,24,.08); }
.seat__rename .input { min-height: 32px; padding: .1em .45em; width: 100%; }
.seat__role { margin: 0; font-style: italic; color: var(--ink-soft); font-size: .95rem; line-height: 1.2; }
.seat__diff { margin-top: 4px; }
.seat__diff select { width: 100%; max-width: 180px; }
.seat__diffro { margin: 2px 0 0; font-family: var(--font-caps); letter-spacing: .06em; font-size: .9rem; color: var(--oxblood); }
.seat__hint { margin: 3px 0 0; font-size: .86rem; line-height: 1.3; color: var(--ink-faint); }
.seat__state { margin: 2px 0 0; display: flex; align-items: center; gap: .5em; font-size: .95rem; color: var(--ink-soft); }
.seat__state--on .lamp__dot { background: #5e9a48; box-shadow: 0 0 6px rgba(94,154,72,.8); }
.seat__state--away .lamp__dot { background: var(--oxblood-hi); }
.seat__remove { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid transparent; background: none; color: var(--ink-faint); cursor: pointer; font-size: .9rem; line-height: 1; }
.seat__remove:hover { color: var(--oxblood); border-color: rgba(123,45,38,.4); background: rgba(123,45,38,.08); }
.seat--empty { background: rgba(28,19,13,.35); color: var(--parchment); border: 1px dashed rgba(176,141,87,.5); box-shadow: none; }
.seat__chair { display: block; width: 68px; height: 68px; border-radius: 50%; border: 2px dashed rgba(176,141,87,.45); background: radial-gradient(circle, rgba(176,141,87,.1), transparent 70%); }
.seat__name--empty { font-family: var(--font-caps); font-weight: 400; letter-spacing: .05em; color: var(--brass-hi); }
.seat--empty .seat__hint { color: rgba(233,217,181,.6); }
.seat__add { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.seat__add select { flex: 1 1 90px; min-width: 0; }
.panel--dark .input, .seat--empty .input { background: rgba(0,0,0,.35); color: var(--parchment); }

/* map picker */
.maps__head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 10px; }
.maps__head .side__title { color: var(--brass-hi); margin: 0; }
.maps__sub { margin: 0; font-size: .95rem; color: rgba(233,217,181,.7); font-style: italic; }
.maps__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.mapcard { position: relative; display: grid; }
.mapcard__pick {
  position: relative; display: grid; grid-template-rows: auto 1fr; width: 100%; text-align: left; padding: 0; cursor: pointer; color: var(--parchment);
  background: linear-gradient(180deg, rgba(51,35,26,.94), rgba(28,19,13,.96)); border: 1px solid rgba(176,141,87,.4); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow); transition: border-color .15s, transform .15s var(--ease);
}
.mapcard__pick:hover { border-color: var(--brass-hi); transform: translateY(-2px); }
.mapcard.is-on .mapcard__pick { border-color: var(--brass-hi); box-shadow: var(--shadow), 0 0 0 2px var(--brass), 0 0 26px rgba(242,180,90,.18); }
.mapthumb { aspect-ratio: 16 / 9; background: #9fb3ad url("/assets/img/ocean.webp") center / cover; overflow: hidden; }
.mapthumb img, .mapthumb svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.mapcard__text { display: grid; gap: 4px; padding: 10px 12px 46px; align-content: start; }
.mapcard__name { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--parchment-hi); }
.mapcard__blurb { font-size: .92rem; line-height: 1.3; color: rgba(233,217,181,.72); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mapcard__facts { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: .86rem; color: var(--brass-hi); margin-top: 2px; }
.mapcard__facts b { font-family: var(--font-num); color: var(--parchment-hi); }
.mapcard__warn { font-size: .85rem; color: #e39a8f; font-style: italic; }
.mapcard__seal { position: absolute; top: 6px; right: 6px; width: 62px; height: 62px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.6)); rotate: 12deg; }
.mapcard__look { position: absolute; left: 12px; bottom: 10px; color: var(--parchment); }

/* side panels */
.invite { display: grid; gap: 10px; }
.invite .side__title { margin: 0; }
.invite__lead { margin: 0; color: var(--ink-soft); }
.invite__code { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.invite__code span {
  display: grid; place-items: center; aspect-ratio: 4 / 5; max-height: 64px; font-family: var(--font-display); font-weight: 700; font-size: clamp(1.6rem, 3vw, 2.1rem); color: #2b1a0c;
  background: linear-gradient(180deg, #f1dca0, var(--brass) 75%, #8a6a3a); border-radius: 6px; border: 1px solid #6b5230;
  box-shadow: inset 0 1px 0 rgba(255,250,230,.8), inset 0 -2px 0 rgba(80,55,20,.4), 0 2px 4px rgba(0,0,0,.35); text-shadow: 0 1px 0 rgba(255,240,200,.6);
}
.invite__linkrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.invite__link { font-size: .9rem; min-width: 0; text-overflow: ellipsis; }
.invite__share { color: var(--ink); }
.invite__wait { margin: 0; display: flex; gap: .6em; align-items: baseline; font-style: italic; color: var(--ink-soft); font-size: .95rem; }
.quill { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--oxblood); animation: pulse 1.6s ease-in-out infinite; translate: 0 -1px; }

.rules { display: grid; gap: 10px; }
.rules .side__title { margin: 0; }
.rules__ro { margin: -4px 0 0; font-style: italic; color: var(--ink-faint); font-size: .92rem; }
.rules__hint { margin: -4px 0 2px; font-size: .9rem; color: var(--ink-soft); font-style: italic; line-height: 1.3; }
.seg { border: 0; margin: 0; padding: 0; min-width: 0; }
.seg__label { font-family: var(--font-caps); letter-spacing: .06em; font-size: .88rem; color: var(--ink-soft); padding: 0; margin-bottom: 4px; display: block; }
.seg__opts { display: flex; border: 1px solid var(--brass-lo); border-radius: var(--radius); overflow: hidden; background: rgba(255,250,235,.5); }
.seg__opt { flex: 1 1 0; position: relative; display: grid; place-items: center; min-height: 38px; padding: 0 6px; cursor: pointer; font-size: .95rem; text-align: center; line-height: 1.1; border-left: 1px solid rgba(122,95,53,.35); }
.seg__opt:first-child { border-left: 0; }
.seg__opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg__opt.is-on { background: linear-gradient(180deg, #5a4631, #3a2b1e); color: var(--parchment-hi); }
.seg__opt:has(input:focus-visible) { outline: 2px solid var(--oxblood); outline-offset: -3px; }
.seg:disabled .seg__opt { cursor: default; }
.seg:disabled .seg__opt:not(.is-on) { color: var(--ink-faint); }
.rules__cash { display: grid; }
.rules__cash select { max-width: 220px; }

.chat { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px; min-height: 240px; }
.chat .side__title { margin: 0; }
.chat__list { list-style: none; margin: 0; padding: 0 4px 0 0; max-height: 230px; min-height: 120px; display: grid; align-content: start; gap: 4px; font-size: .98rem; }
.chat__empty { font-style: italic; color: rgba(233,217,181,.55); }
.chat__msg b { color: color-mix(in srgb, var(--c, var(--brass-hi)) 55%, #f4e9cd); font-weight: 600; }
.chat__msg--sys { font-style: italic; color: rgba(233,217,181,.6); }
.chat__msg--bark span { font-style: italic; }
.chat__form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.chat__form .input { min-height: 40px; }

/* start bar */
.lobby__start {
  position: sticky; bottom: 0; z-index: var(--z-hud); display: flex; align-items: center; justify-content: flex-end; gap: 12px 20px; flex-wrap: wrap;
  padding: 12px var(--gutter) max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(74,24,20,.96), rgba(45,14,12,.98)), url("/assets/img/leather.webp") center / 256px;
  border-top: 1px solid var(--brass); box-shadow: 0 -10px 30px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,210,170,.15);
}
.lobby__reason { margin: 0; color: var(--parchment); font-style: italic; text-align: right; flex: 1 1 260px; }
.lobby__reason--wait { display: flex; gap: .6em; justify-content: center; align-items: baseline; font-size: 1.1rem; }
.lobby__reason--wait .quill { background: var(--brass-hi); }
.lobby__go { min-height: 54px; padding: .4em 2em; font-size: 1.3rem; }

/* =========================================================
   Map preview
   ========================================================= */
.preview { width: min(1240px, 100%); max-height: calc(100dvh - 32px); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px; padding: 16px 18px; animation: rise-in .28s var(--ease) both; }
.preview__head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.preview__head h2 { color: var(--brass-hi); margin: 0; font-size: 1.6rem; }
.preview__head .btn { color: var(--parchment); }
.preview__blurb { margin: 2px 0 0; color: rgba(233,217,181,.78); font-style: italic; max-width: 70ch; }
.preview__map { min-height: 0; aspect-ratio: 2000 / 1120; max-height: 64dvh; margin: 0 auto; width: 100%; display: grid; place-items: center; border-radius: var(--radius); overflow: hidden; background: #9fb3ad url("/assets/img/ocean.webp") center / cover; box-shadow: inset 0 0 0 1px rgba(43,33,24,.7), inset 0 0 60px rgba(30,20,10,.45); }
.preview__map .mapsvg { width: 100%; height: 100%; }
.preview__live { position: relative; width: 100%; height: 100%; }
.preview__mv { position: absolute; inset: 0; }
.preview__mv > .mv-root { position: absolute; inset: 0; }
.preview__wait { position: absolute; inset: 0; display: grid; place-items: center; color: var(--parchment); background: rgba(20,13,8,.55); }
.preview__map { position: relative; }
.preview__foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 20px; align-items: end; }
.preview__regions { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 16px; }
.preview__regions li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 3px 6px; border-radius: 4px; font-size: .95rem; }
.preview__regions li.is-hi { background: rgba(176,141,87,.18); }
.preview__rname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview__rcount { color: rgba(233,217,181,.6); font-size: .85rem; }
.preview__act { display: grid; justify-items: end; gap: 8px; }
.preview__facts { margin: 0; color: rgba(233,217,181,.8); text-align: right; }
.preview__chosen { margin: 0; color: var(--brass-hi); font-style: italic; }

.mapsvg__decor { fill: #d9c79d; opacity: .5; }
.mapsvg__sea path { fill: none; stroke: #3b4a52; stroke-width: 2.2; stroke-dasharray: 7 7; opacity: .7; }
.mapsvg__land path { fill-opacity: .82; stroke: #2b2118; stroke-width: 1.4; stroke-linejoin: round; transition: fill-opacity .2s, opacity .2s; }
.mapsvg__land path.is-hi { fill-opacity: 1; }
.mapsvg__land path.is-lo { opacity: .45; }
.mapsvg__labels { font-family: var(--font-display); font-weight: 700; pointer-events: none; }
.mapsvg__labels g { transition: opacity .2s; }
.mapsvg__labels g.is-lo { opacity: .3; }
.mapsvg__name { fill: #2b2118; letter-spacing: .08em; text-transform: uppercase; paint-order: stroke; stroke: rgba(244,233,205,.85); stroke-width: 4px; }
.mapsvg__bonus { fill: #6b1f1a; font-family: var(--font-num); font-weight: 600; paint-order: stroke; stroke: rgba(244,233,205,.85); stroke-width: 4px; }

/* =========================================================
   Codex (How to play)
   ========================================================= */
.codex-backdrop { padding: clamp(0px, 2vw, 24px); }
.codex {
  width: min(1120px, 100%); height: min(920px, calc(100dvh - 32px)); display: grid; grid-template-rows: auto minmax(0, 1fr);
  border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--brass); box-shadow: var(--shadow-lift);
  background: var(--parchment) url("/assets/img/parchment.webp") center / 640px; color: var(--ink);
  animation: rise-in .3s var(--ease) both;
}
.codex__head {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px 10px 18px; color: var(--parchment);
  background: linear-gradient(180deg, rgba(74,24,20,.97), rgba(45,14,12,.98)), url("/assets/img/leather.webp") center / 256px;
  border-bottom: 2px solid var(--brass);
}
.codex__seal { width: 36px; height: 36px; }
.codex__title { margin: 0; font-size: 1.35rem; color: var(--brass-hi); }
.codex__tabs { display: flex; gap: 4px; margin-left: auto; background: rgba(0,0,0,.3); padding: 3px; border-radius: 999px; border: 1px solid rgba(176,141,87,.4); }
.codex__tab { border: 0; background: none; color: var(--parchment); font-family: var(--font-caps); letter-spacing: .05em; font-size: 1rem; padding: .35em 1em; border-radius: 999px; cursor: pointer; min-height: 36px; }
.codex__tab.is-on { background: linear-gradient(180deg, var(--brass-hi), var(--brass)); color: var(--ink); }
.codex__close { color: var(--parchment) !important; }
.codex__wait { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-soft); pointer-events: none; }
.codex__wrap { position: relative; display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 0; }
.codex__toc { padding: 16px 12px 16px 16px; border-right: 1px solid rgba(122,95,53,.35); overflow: auto; background: rgba(122,95,53,.08); }
.codex__search .input { width: 100%; }
.codex__hits { font-size: .88rem; font-style: italic; color: var(--ink-soft); margin: 8px 2px 0; }
.codex__toc ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 1px; }
.codex__toc a { display: block; padding: .32em .6em; border-radius: 4px; color: var(--ink-soft); text-decoration: none; line-height: 1.25; border-left: 3px solid transparent; }
.codex__toc a:hover { background: rgba(122,95,53,.14); color: var(--ink); }
.codex__toc a.is-on { color: var(--oxblood); border-left-color: var(--oxblood); background: rgba(123,45,38,.08); font-weight: 600; }
.codex__body { overflow: auto; padding: clamp(18px, 3vw, 40px) clamp(18px, 4vw, 56px) 80px; scroll-behavior: smooth; }
.codex__body > section { max-width: 68ch; margin: 0 auto 2.6em; scroll-margin-top: 16px; }
.codex__body h2 { font-size: clamp(1.4rem, 2.6vw, 1.85rem); color: var(--oxblood); display: flex; align-items: center; gap: .4em; padding-bottom: .3em; border-bottom: 1px solid rgba(123,45,38,.35); margin-bottom: .7em; }
.codex__body h2 .icon { width: 1.25em; height: 1.25em; }
.codex__body h3 { font-size: 1.1rem; color: var(--ink); margin: 1.4em 0 .4em; }
.codex__body p, .codex__body li, .codex__body dd { line-height: 1.6; }
.codex__body p { margin: 0 0 .85em; }
.codex-lede { font-size: 1.16rem; }
.codex-lede::first-letter { float: left; font-family: var(--font-display); font-weight: 700; font-size: 3.3em; line-height: .82; padding: .06em .1em 0 0; color: var(--oxblood); }
.codex-steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 1em; display: grid; gap: 8px; }
.codex-steps li { counter-increment: step; position: relative; padding: 4px 0 4px 50px; min-height: 36px; }
.codex-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-family: var(--font-display); font-weight: 700; color: var(--parchment-hi); background: radial-gradient(circle at 35% 30%, var(--oxblood-hi), var(--oxblood) 70%); box-shadow: 0 2px 4px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,200,180,.3); }
.codex-list { padding-left: 1.2em; margin: 0 0 1em; }
.codex-list li { margin-bottom: .35em; }
.codex-ex { margin: 1em 0 1.2em; padding: 12px 16px; border-left: 3px solid var(--oxblood); background: rgba(255,250,235,.45); border-radius: 0 var(--radius) var(--radius) 0; }
.codex-ex p { margin: 0 0 .4em; }
.codex-ex p:last-child { margin: 0; }
.codex-ex__title { font-family: var(--font-caps); letter-spacing: .06em; color: var(--oxblood); font-size: .95rem; }
.codex-table { width: 100%; border-collapse: collapse; margin: .4em 0 1em; font-size: 1rem; }
.codex-table th { text-align: left; font-family: var(--font-caps); font-weight: 400; letter-spacing: .04em; font-size: .9rem; color: var(--ink-soft); border-bottom: 1px solid var(--brass-lo); padding: 4px 8px; }
.codex-table td { padding: 5px 8px; border-bottom: 1px solid rgba(122,95,53,.22); }
.codex-table .r { text-align: right; }
.codex-table--narrow { max-width: 420px; }
.codex-table--tight td { padding: 3px 4px; }
.codex-bonus__pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-style: italic; color: var(--ink-soft); }
.codex-bonus__pick .input { min-height: 36px; padding: .1em .5em; }
.codex-shop { display: grid; gap: 10px; }
.codex-shop__item { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: start; padding: 10px 12px; background: rgba(255,250,235,.4); border: 1px solid rgba(122,95,53,.3); border-radius: var(--radius); }
.codex-shop__item .icon { width: 44px; height: 44px; }
.codex-shop__item p { margin: .2em 0 0; font-size: .98rem; }
.codex-shop__item .money { margin-left: .4em; }
.codex-ladder { display: flex; flex-wrap: wrap; gap: 6px; margin: .4em 0 1.1em; }
.codex-ladder__step { display: grid; justify-items: center; min-width: 62px; padding: 5px 6px; border: 1px solid var(--brass-lo); border-radius: 6px; background: rgba(255,250,235,.5); }
.codex-ladder__step span { font-size: .75rem; color: var(--ink-faint); }
.codex-ladder__step b { font-size: .98rem; }
.codex-ladder__step--more { background: rgba(123,45,38,.1); border-style: dashed; }
.codex-dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 1em; }
.codex-dl dt { font-family: var(--font-caps); letter-spacing: .04em; display: flex; align-items: center; gap: .4em; white-space: nowrap; }
.codex-dl dd { margin: 0; }

.codex__body--cheat { padding: clamp(16px, 3vw, 32px); }
.cheat { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 28px; max-width: 1040px; margin: 0 auto; }
.cheat__col { min-width: 0; }
.cheat__col + .cheat__col { border-left: 1px solid rgba(122,95,53,.3); padding-left: 28px; }
.cheat h3 { color: var(--oxblood); font-size: 1.05rem; margin: 1em 0 .35em; }
.cheat h3:first-child { margin-top: 0; }
.cheat p { margin: 0 0 .5em; line-height: 1.45; font-size: 1rem; }
.cheat__steps { margin: 0; padding-left: 1.3em; }
.cheat__ladder { list-style: none; padding: 0; margin: 0 0 .6em; display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 2px 14px; font-size: .95rem; counter-reset: set; }
.cheat__ladder li:last-child { grid-column: 1 / -1; font-style: italic; color: var(--ink-soft); }
.cheat__list { margin: 0 0 .5em; padding-left: 1.1em; }
.codex .money { color: #7a5a10; }

/* =========================================================
   Tutorial host
   ========================================================= */
.tutorial-stage__gate, .tutorial-stage__mount { position: absolute; inset: 0; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1120px) {
  .lobby__grid { grid-template-columns: minmax(0, 1fr); }
  .lobby__side { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
}
@media (max-width: 860px) {
  .council { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .council__table { grid-area: auto; grid-column: 1 / -1; order: -1; margin: 0 0 4px; border-radius: 40% / 50%; }
  .council__seats { display: contents; }
  .seat--p0, .seat--p1, .seat--p2, .seat--p3, .seat--p4, .seat--p5 { grid-area: auto; }
  .codex__wrap { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .codex__toc { border-right: 0; border-bottom: 1px solid rgba(122,95,53,.35); padding: 10px 12px; }
  .codex__toc ul { display: flex; gap: 4px; overflow-x: auto; margin-top: 8px; scrollbar-width: none; }
  .codex__toc li { flex: none; }
  .codex__toc a { border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; padding: .25em .55em; font-size: .95rem; }
  .codex__toc a.is-on { border-bottom-color: var(--oxblood); }
  .cheat { grid-template-columns: minmax(0, 1fr); }
  .cheat__col + .cheat__col { border-left: 0; padding-left: 0; border-top: 1px solid rgba(122,95,53,.3); padding-top: 12px; margin-top: 12px; }
  .preview__foot { grid-template-columns: minmax(0, 1fr); }
  .preview__act { justify-items: start; }
  .preview__facts { text-align: left; }
}
@media (max-width: 600px) {
  .council { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .seat { min-height: 0; }
  .seat--empty ~ .seat--empty { display: none; }
  .lobby__bar { gap: 8px 12px; }
  .lobby__lamp { order: 3; margin-left: 0; width: 100%; font-size: .85rem; }
  .lobby__tools { margin-left: auto; }
  .lobby__side { grid-template-columns: minmax(0, 1fr); }
  .lobby__start { justify-content: stretch; }
  .lobby__reason { text-align: center; flex-basis: 100%; font-size: .95rem; }
  .lobby__go { width: 100%; }
  .maps__list { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .mapcard__blurb { display: none; }
  .mapcard__seal { width: 44px; height: 44px; }
  .mapcard__text { padding-bottom: 44px; }
  .codex { height: 100dvh; border-radius: 0; }
  .codex-backdrop { padding: 0; }
  .codex__title { display: none; }
  .codex__tabs { margin-left: 0; }
  .codex__close { margin-left: auto; }
  .codex-dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .codex-dl dd { margin-bottom: 8px; }
  .command { padding: 16px 14px 12px; }
  .order { min-height: 60px; gap: 12px; grid-template-columns: 40px 1fr; }
  .order__icon { width: 40px; height: 40px; }
  .title__lamp { position: static; justify-self: center; }
  .command__learn .btn { letter-spacing: .03em; font-size: .98rem; padding-inline: .6em; }
  .title__stage { padding-bottom: 24px; }
}
@media (max-width: 380px) {
  .maps__list { grid-template-columns: minmax(0, 1fr); }
  .command__learn { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1800px) {
  .lobby__grid, .lobby__bar { max-width: 1760px; margin-inline: auto; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .title-bg__glow { animation: none !important; }
  .title-bg__hero { transform: none !important; }
}

/* Solo skirmish setup (title screen) */
.solosetup { display: grid; gap: 10px; padding: 12px; border: 1px solid rgba(176,141,87,.45); border-radius: var(--radius); background: rgba(0,0,0,.28); animation: rise-in .2s var(--ease) both; }
.solosetup__count { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.solosetup .btn--sm { min-height: 40px; }
.solosetup__hint { display: block; margin-top: 4px; font-size: .85em; opacity: .8; line-height: 1.35; }

/* Nothing on a screen may scroll sideways: decorative layers are clipped, not merely hidden (hidden is still
   scrollable by focus and by touch on iOS, which shifted the whole title screen). */
.title__stage, .title-bg, .lobby { overflow-x: clip; }
.title__stage, .command, .orders, .solosetup, .joinrow { min-width: 0; max-width: 100%; }

/* =========================================================
   Accessibility tokens: focus rings that read on every surface.
   Other stylesheets use var(--focus-ring) / var(--focus-ring-width).
   Dark surfaces get brass; parchment surfaces get dark oxblood (≥ 3:1 on both).
   ========================================================= */
:root {
  --focus-ring-on-dark: #f1d48f;
  --focus-ring-on-light: #5a1712;
  --focus-ring: var(--focus-ring-on-dark);
  --focus-ring-width: 3px;
  --focus-ring-offset: 2px;
}
.panel:not(.panel--dark), .seat:not(.seat--empty), .codex, .tut-card, .tut-modal, .invite-card, .notice, .confirm, .light-surface {
  --focus-ring: var(--focus-ring-on-light);
}
:focus-visible { outline: var(--focus-ring-width) solid var(--focus-ring); outline-offset: var(--focus-ring-offset); }
.btn:focus-visible { box-shadow: 0 0 0 calc(var(--focus-ring-width) + var(--focus-ring-offset)) rgba(0,0,0,.001); }
.seg__opt:has(input:focus-visible) { outline: var(--focus-ring-width) solid var(--focus-ring-on-light); outline-offset: -4px; }
.num, .solosetup__count .btn { font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1; }
.solosetup__count .btn { font-family: var(--font-num); }

/* long names and chat never push layout sideways */
.seat__name, .chat__msg, .chat__msg span, .seatbar__msg, .invite-card__title, .lobby__sub, .resume p, .toast { overflow-wrap: anywhere; }
.seat__name { white-space: normal; }

/* ---------- lobby: colour control, unread badge ---------- */
.seat__colour { pointer-events: none; }
.seat__colourbtn {
  justify-self: start; display: inline-flex; align-items: center; gap: .45em; margin-top: 6px; min-height: 34px; padding: .15em .7em .15em .45em;
  font: inherit; font-size: .92rem; color: var(--ink); cursor: pointer;
  background: rgba(255,250,235,.6); border: 1px solid var(--brass-lo); border-radius: 999px;
}
.seat__colourbtn:hover { background: rgba(255,250,235,.9); }
.seat__colourbtn .swatch { width: 18px; height: 18px; }
.seat__chev { font-size: .8rem; opacity: .7; }
.seat__body { position: relative; }
.chat-badge {
  position: fixed; right: max(16px, env(safe-area-inset-right)); top: calc(72px + env(safe-area-inset-top)); z-index: calc(var(--z-hud) + 1);
  display: inline-flex; align-items: center; gap: .5em; min-height: 44px; padding: .3em .9em .3em .4em; cursor: pointer;
  font: 600 .95rem var(--font-body); color: var(--parchment-hi); background: var(--wood-hi); border: 1px solid var(--brass); border-radius: 999px;
  box-shadow: var(--shadow); animation: rise-in .25s var(--ease) both;
}
.chat-badge__n { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 999px; background: var(--oxblood); color: #fff; font-family: var(--font-num); }

/* ---------- game stage: seat bar for spectators / waiting guests ---------- */
.game-stage.has-bar { --seatbar-h: 48px; }
.game-stage.has-bar .game-stage__screen { top: var(--seatbar-h); }
.seatbar {
  position: absolute; left: 0; right: 0; top: 0; z-index: var(--z-panel); min-height: var(--seatbar-h); box-sizing: border-box;
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 6px max(12px, env(safe-area-inset-right)) 6px max(12px, env(safe-area-inset-left));
  background: linear-gradient(180deg, #4a1814, #2d0e0c); border-bottom: 1px solid var(--brass); color: var(--parchment-hi);
  box-shadow: 0 4px 14px rgba(0,0,0,.4); overflow-x: auto;
}
.seatbar__msg { margin: 0; flex: 1 1 220px; font-size: .95rem; display: flex; gap: .5em; align-items: baseline; }
.seatbar__msg b { font-family: var(--font-caps); letter-spacing: .04em; font-weight: 400; }
.seatbar .btn { flex: none; color: var(--parchment-hi); }
.seatbar .btn--primary { color: var(--ink); }
.seatbar .quill { background: var(--brass-hi); }
@media (max-width: 600px) { .game-stage.has-bar { --seatbar-h: 64px; } .seatbar__msg { font-size: .88rem; } }

/* ---------- replaced (other tab) ---------- */
.replaced { z-index: calc(var(--z-modal) + 2); }
.replaced__card { width: min(460px, 100%); }
.replaced__card h2 { color: var(--oxblood); font-size: 1.35rem; }
.focus-trap { display: contents; }

/* ---------- title: first visit + phones ---------- */
.title-bg__hero { opacity: 0; transition: opacity .6s ease, transform .6s var(--ease); }
.title-bg__hero.is-loaded { opacity: 1; }
.command__more { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding-top: 4px; border-top: 1px solid rgba(176,141,87,.25); }
.command__more .btn { color: var(--parchment); font-size: .98rem; padding-inline: .4em; letter-spacing: .03em; }
.solosetup__countset { border: 0; padding: 0; margin: 0; min-width: 0; }
.solosetup__countset legend { font-family: var(--font-caps); letter-spacing: .08em; font-size: .85rem; opacity: .85; padding: 0; margin-bottom: 4px; }
.invite-card__lead { margin: 0; color: var(--ink-soft); }
.invite-card__facts { font-size: .95rem; font-style: italic; color: var(--ink-soft); }
.title--first .order--primary .order__line { font-size: .95rem; }
@media (max-width: 600px) and (max-height: 760px) {
  .title__stage { gap: 10px; padding-top: 14px; padding-bottom: 12px; align-content: start; }
  .wordmark__emblem { width: 52px; margin-bottom: 2px; }
  .wordmark__title { font-size: clamp(2rem, 11vw, 2.6rem); }
  .wordmark__tag { margin-top: 4px; font-size: 1rem; }
  .wordmark__tag::before, .wordmark__tag::after { width: 18px; }
  .command { gap: 9px; padding: 12px 12px 10px; }
  .namefield > span { font-size: .8rem; }
  .namefield__input { min-height: 40px; font-size: 1.05rem; }
  .order { min-height: 54px; padding: 6px 10px; }
  .order--primary { min-height: 62px; }
  .order__title { font-size: 1.12rem; }
  .order--primary .order__title { font-size: 1.28rem; }
  .order__line { font-size: .88rem; }
  .order__icon { width: 34px; height: 34px; }
  .order { grid-template-columns: 34px 1fr; gap: 10px; }
  .command__more .btn, .command__learn .btn { min-height: 40px; font-size: .9rem; }
  .title__lamp { font-size: .8rem; }
  .resume { padding: 8px 10px; }
}
@media (max-width: 380px) {
  .command__more { grid-template-columns: 1fr 1fr; }
  .command__more .btn:last-child { grid-column: 1 / -1; }
}

/* ---------- players who step away (lobby rule) and email turn notices (lobby seat card, game settings) ---------- */
.awaypick { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 4px; }
.awaypick__label { font-family: var(--font-caps); letter-spacing: .06em; font-size: .88rem; color: var(--ink-soft); padding: 0; margin-bottom: 2px; }
.awaypick__opt { position: relative; display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; padding: 7px 9px; border-radius: var(--radius); cursor: pointer; border: 1px solid rgba(122,95,53,.35); background: rgba(255,250,235,.45); }
.awaypick__opt input { appearance: none; margin: 3px 0 0; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--brass-lo); background: #fffaf0; cursor: inherit; }
.awaypick__opt input:checked { background: var(--oxblood); box-shadow: inset 0 0 0 3px #fffaf0; border-color: var(--oxblood); }
.awaypick__opt input:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 2px; }
.awaypick__opt.is-on { border-color: var(--brass-lo); background: rgba(255,250,235,.85); box-shadow: inset 3px 0 0 var(--oxblood); }
.awaypick__text { display: grid; gap: 1px; line-height: 1.25; }
.awaypick__text b { font-weight: 600; font-size: .98rem; color: var(--ink); }
.awaypick__text small { font-size: .86rem; color: var(--ink-soft); }
.awaypick:disabled .awaypick__opt { cursor: default; }
.awaypick:disabled .awaypick__opt:not(.is-on) { opacity: .7; }
.awaypick--compact .awaypick__opt { padding: 6px 8px; }

.mailopt { display: grid; gap: 6px; margin-top: 6px; min-width: 0; }
.mailopt__open { justify-self: start; }
.mailopt__link { justify-self: start; padding: 2px 0; font-size: .9rem; color: var(--ink-soft); }
.mailopt .btn--ghost { color: var(--ink); border-color: var(--brass-lo); }
.mailopt--tight .mailopt__row .btn { min-height: 34px; padding: 0 .7em; }
.mailopt--tight .mailopt__fine { font-size: .76rem; }
.mailopt__label { font-size: .88rem; color: var(--ink-soft); }
.mailopt__row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mailopt__row .input { flex: 1 1 180px; min-width: 0; }
.mailopt__state { margin: 0; font-size: .92rem; line-height: 1.3; color: var(--ink-soft); overflow-wrap: anywhere; }
.mailopt__dot { display: inline-block; width: .6em; height: .6em; margin-right: .4em; border-radius: 50%; background: var(--warn); vertical-align: baseline; }
.mailopt__dot.is-on { background: #5e9a48; }
.mailopt__acts { display: flex; gap: 6px; }
.mailopt__fine { margin: 0; font-size: .8rem; line-height: 1.3; color: var(--ink-faint); }
.mailopt__note { margin: 4px 0 0; font-size: .82rem; font-style: italic; color: var(--ink-faint); }
.mailopt__err { margin: 0; font-size: .86rem; color: var(--bad); }

/* title: my slow games */
.slowlist { display: grid; gap: 6px; padding: 10px 12px; border-radius: var(--radius); background: rgba(31,58,77,.35); border: 1px solid rgba(120,160,190,.45); }
.slowlist__title { margin: 0; font-family: var(--font-caps); font-weight: 400; font-size: 1rem; letter-spacing: .06em; color: var(--brass-hi); }
.slowlist__items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.slowlist__item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 8px; }
.slowlist__text { display: grid; min-width: 0; line-height: 1.2; }
.slowlist__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--parchment-hi); }
.slowlist__meta { font-size: .82rem; opacity: .8; }
.slowlist__badge { font-size: .8rem; padding: 2px 8px; border-radius: 10px; white-space: nowrap; background: rgba(0,0,0,.3); border: 1px solid rgba(176,141,87,.5); color: var(--parchment); max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
.slowlist__badge--yours { background: var(--oxblood-hi); border-color: #e3a69c; color: #fff4e6; font-weight: 600; }
.slowlist__x { width: 32px; height: 32px; border: 0; background: none; color: var(--parchment); opacity: .65; font-size: 20px; cursor: pointer; border-radius: 50%; }
.slowlist__x:hover { opacity: 1; background: rgba(255,255,255,.08); }
@media (max-width: 420px) {
  .slowlist__item { grid-template-columns: minmax(0, 1fr) auto auto; }
  .slowlist__badge { grid-column: 1; grid-row: 2; justify-self: start; }
  .slowlist__item .btn { grid-row: 1 / span 2; grid-column: 2; }
  .slowlist__x { grid-row: 1 / span 2; grid-column: 3; }
}

/* =========================================================
   Table rules (modules): toggles, groups, presets
   ========================================================= */
.tablerules { display: grid; gap: 10px; }
.tablerules .side__title { margin: 0; }
.tablerules__sum { margin: 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.tablerules__sum b { color: var(--ink); font-weight: 600; }
.mods { display: grid; gap: 8px; }
.mods__presets { display: flex; flex-wrap: wrap; gap: 6px; }
.mods__presets .btn { min-height: 44px; flex: 1 1 auto; }
.panel:not(.panel--dark) .mods__presets .btn--ghost { color: var(--ink); }
.modgroup { border: 1px solid rgba(122,95,53,.35); border-radius: var(--radius); background: rgba(255,250,235,.35); }
.modgroup__head {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 6px 10px; cursor: pointer;
  background: none; border: 0; color: inherit; font: inherit; text-align: left;
}
.modgroup__title { font-family: var(--font-caps); letter-spacing: .05em; font-size: 1rem; flex: 1; }
.modgroup__count { font-size: .88rem; color: var(--ink-soft); }
.modgroup__chev { transition: transform .15s; }
.modgroup.is-open .modgroup__chev, [aria-expanded="true"] > .modgroup__chev { transform: rotate(180deg); }
.modgroup__list { list-style: none; margin: 0; padding: 0 10px 8px; display: grid; gap: 4px; }
.mod { display: grid; gap: 0; padding: 4px 0; border-top: 1px solid rgba(122,95,53,.18); }
.mod:first-child { border-top: 0; }
.mod__switch {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0; cursor: pointer; text-align: left;
  background: none; border: 0; color: inherit; font: inherit; font-weight: 600;
}
.mod__switch:disabled { cursor: not-allowed; opacity: .6; }
.mod__track { position: relative; flex: none; width: 44px; height: 26px; border-radius: 999px; background: rgba(43,33,24,.25); border: 1px solid var(--brass-lo); transition: background .15s; }
.mod__knob { position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--parchment-hi); box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .15s var(--ease); }
.mod__switch[aria-checked="true"] .mod__track { background: var(--forest); border-color: #2d4a2a; }
.mod__switch[aria-checked="true"] .mod__knob { transform: translateX(18px); }
.mod__switch[aria-checked="true"] .mod__track::after { content: "✓"; position: absolute; left: 6px; top: 2px; font-size: .8rem; color: #fff; }
.mod__name { overflow-wrap: anywhere; }
.mod__line { margin: 0 0 4px 54px; font-size: .9rem; line-height: 1.35; color: var(--ink-soft); }
.mod__help { font-size: .88rem; padding: 0 .2em; min-height: 0; color: var(--oxblood); }
.mod--ro { grid-template-columns: auto 1fr; column-gap: 10px; align-items: center; }
.mod--ro .mod__line { grid-column: 1 / -1; margin-left: 0; }
.mod__state { font-family: var(--font-caps); font-size: .82rem; letter-spacing: .05em; padding: .1em .55em; border-radius: 999px; border: 1px solid var(--brass-lo); color: var(--ink-soft); min-width: 3.2em; text-align: center; }
.mod--ro.is-on .mod__state { background: var(--forest); color: #fff; border-color: #2d4a2a; }
.mod--ro .mod__name { font-weight: 600; }
.council__rules { display: block; font-family: var(--font-body); font-size: .8rem; letter-spacing: 0; text-transform: none; opacity: .85; max-width: 60vw; overflow-wrap: anywhere; white-space: normal; }
.council__label { white-space: normal; text-align: center; }
/* solo setup (dark panel) */
.solosetup__rules { border: 1px solid rgba(176,141,87,.35); border-radius: var(--radius); }
.solosetup__rulesbtn {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 6px 10px; cursor: pointer;
  background: none; border: 0; color: var(--parchment); font: inherit; text-align: left;
}
.solosetup__rulesbtn span:first-child { font-family: var(--font-caps); letter-spacing: .05em; }
.solosetup__rulesbtn small { font-size: .85rem; opacity: .8; overflow-wrap: anywhere; }
.solosetup__rulesbtn[aria-expanded="true"] .modgroup__chev { transform: rotate(180deg); }
#solo-rules { padding: 0 8px 8px; }
.command .modgroup { background: rgba(0,0,0,.2); border-color: rgba(176,141,87,.3); }
.command .modgroup__count, .command .mod__line { color: rgba(233,217,181,.75); }
.command .mod__help { color: var(--brass-hi); }
.command .mod__track { background: rgba(0,0,0,.35); }
.command .mods__presets .btn--ghost { color: var(--parchment); }
.lobby__main .tablerules .modgroup__list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); column-gap: 18px; }
.lobby__main .tablerules .mod { border-top: 0; border-bottom: 1px solid rgba(122,95,53,.18); }

/* ---------- table rules v2: compact rows + "What it does" disclosure with example and diagram ---------- */
.mod, .mod--ro { display: block; padding: 6px 0; }
.mod__row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 44px; }
.mod__icon { width: 32px; height: 32px; object-fit: contain; }
.mod__text { display: grid; min-width: 0; }
.mod__name { font-weight: 600; line-height: 1.2; }
.mod .mod__line { margin: 0; font-size: .88rem; line-height: 1.3; color: var(--ink-soft); }
.mod__switch { min-height: 44px; min-width: 52px; justify-content: center; }
.mod--ro .mod__state { align-self: center; }
.mod__more {
  display: inline-flex; align-items: center; gap: .35em; min-height: 36px; margin: 2px 0 0 42px; padding: 0 .5em; cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: 999px; font: inherit; font-size: .88rem; color: var(--oxblood);
}
.mod__more:hover { border-color: rgba(123,45,38,.35); }
.mod__chev { display: inline-block; transition: transform .15s; }
.mod__more[aria-expanded="true"] .mod__chev { transform: rotate(180deg); }
.mod__info { margin: 4px 0 6px 42px; animation: rise-in .18s var(--ease) both; }
.mi { display: grid; gap: 10px; padding: 12px; border-radius: var(--radius); background: rgba(255,250,235,.55); border: 1px solid rgba(122,95,53,.3); color: var(--ink); }
.mi__top { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: start; }
.mi__icon { width: 64px; height: 64px; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,.25)); }
.mi__about { margin: 0; font-size: .95rem; line-height: 1.45; overflow-wrap: anywhere; }
.mi__example { padding: 8px 12px; border-left: 3px solid var(--oxblood); background: rgba(201,162,39,.16); border-radius: 0 var(--radius) var(--radius) 0; }
.mi__example b { font-family: var(--font-caps); letter-spacing: .05em; font-weight: 400; color: var(--oxblood); font-size: .9rem; }
.mi__example p { margin: 2px 0 0; font-size: .95rem; line-height: 1.4; font-variant-numeric: lining-nums; }
.mi__off { margin: 0; font-size: .9rem; color: var(--ink-soft); }
.mi__off b { color: var(--ink); }
.mi__more { justify-self: start; color: var(--oxblood); font-size: .9rem; }
.mi-art { object-fit: contain; }
.mi-dia { display: grid; gap: 6px; padding: 8px; border-radius: var(--radius); background: rgba(43,33,24,.06); border: 1px dashed rgba(122,95,53,.4); }
.mi-dia__cap { margin: 0; font-size: .85rem; color: var(--ink-soft); }
.mi-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.mi-note { flex-basis: 100%; font-size: .85rem; color: var(--ink-soft); }
.mi-bars { display: grid; gap: 3px; }
.mi-bars__row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 8px; font-size: .85rem; }
.mi-bars__row small { grid-column: 2 / -1; margin-top: -3px; color: var(--ink-soft); font-size: .8rem; }
.mi-bars__bar { height: 10px; border-radius: 999px; background: rgba(43,33,24,.12); overflow: hidden; }
.mi-bars__bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brass-lo), var(--brass)); }
.mi-bars__v { font-family: var(--font-num); font-weight: 600; color: #6a4e0e; }
.mi-token { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-family: var(--font-num); font-weight: 700; color: #fff; background: #b23a36; border: 2px solid var(--brass); }
.mi-plus, .mi-eq { font-weight: 600; color: var(--ink-soft); }
.mi-dice { display: inline-flex; gap: 4px; }
.mi-dice i { width: 20px; height: 20px; border-radius: 4px; background: var(--parchment-hi); border: 1px solid var(--ink-soft); box-shadow: inset 0 0 0 4px var(--parchment-hi), inset 0 0 0 7px var(--ink); }
.mi-arrow { position: relative; display: inline-grid; justify-items: center; padding: 0 22px 0 6px; font-size: .85rem; color: var(--ink); }
.mi-arrow::after { content: "→"; position: absolute; right: 2px; top: 50%; translate: 0 -55%; font-size: 1.3rem; color: var(--oxblood); }
.mi-arrow--back::after { content: "↩"; }
.mi-arrow__label { font-weight: 600; font-family: var(--font-num); }
.mi-arrow small { font-size: .78rem; color: var(--ink-soft); }
.mi-who { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 4px; border-radius: 999px; background: rgba(255,250,235,.8); border: 1px solid var(--brass-lo); font-size: .85rem; }
.mi-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mi-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .82rem; border: 1px solid var(--brass-lo); background: rgba(255,250,235,.8); }
.mi-chip--good { background: #dbe8d3; border-color: #6c8f5c; }
.mi-chip--bad { background: #f0d6cf; border-color: #b46a5c; }
.mi-pledge, .mi-branch { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.mi-depot { padding: 4px 10px; border-radius: 6px; background: #3f7d4e; color: #fff; font-size: .85rem; font-weight: 600; box-shadow: 0 0 0 2px var(--brass); }
.mi-arc { width: 100%; max-width: 280px; height: auto; color: var(--oxblood); }
.mi-arc__t { font: 600 13px var(--font-num), serif; fill: var(--ink); }
.mi-cardimg { width: 40px; height: 56px; border-radius: 4px; }
.mi-ladder { display: inline-flex; flex-wrap: wrap; gap: 3px; font-family: var(--font-num); font-size: .82rem; }
.mi-ladder span { padding: 1px 5px; border-radius: 4px; background: rgba(43,33,24,.08); }
.mi-ladder .is-next { background: var(--brass); color: var(--ink); font-weight: 700; }
.mi-good { display: inline-grid; justify-items: center; font-size: .78rem; color: var(--ink-soft); }
.mi-prices { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: .82rem; color: var(--ink-soft); }
.mi-prices b { font-family: var(--font-num); color: var(--ink); }
.mi-upkeep { display: flex; height: 26px; border-radius: 6px; overflow: hidden; font-size: .8rem; font-weight: 600; }
.mi-upkeep__free { display: grid; place-items: center; background: #cfdcc4; color: #2d4a2a; }
.mi-upkeep__paid { display: grid; place-items: center; background: #e7c2b9; color: #6b1f1a; }
.mi-levels { align-items: flex-end; }
.mi-level { display: inline-grid; justify-items: center; gap: 1px; min-width: 76px; font-size: .82rem; }
.mi-level small { color: var(--ink-soft); font-size: .76rem; }
.mi-fan { display: flex; justify-content: center; padding: 6px 0 2px; }
.mi-fan .mi-card { margin: 0 -8px; }
.mi-fan .mi-card:nth-child(1) { rotate: -6deg; } .mi-fan .mi-card:nth-child(3) { rotate: 6deg; translate: 0 2px; } .mi-fan .mi-card:nth-child(2) { z-index: 1; translate: 0 -4px; }
.mi-card { display: grid; justify-items: center; align-content: start; gap: 2px; width: 108px; min-height: 120px; padding: 8px 6px; text-align: center; border-radius: 8px;
  background: var(--parchment-hi); border: 1px solid var(--brass-lo); box-shadow: 0 3px 8px rgba(0,0,0,.2); font-size: .78rem; line-height: 1.25; }
.mi-card b { font-family: var(--font-display); font-size: .82rem; color: var(--oxblood); }
.mi-card__art { width: 64px; height: 44px; object-fit: cover; border-radius: 4px; }
.mi-timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; counter-reset: mt; }
.mi-timeline li { position: relative; display: grid; gap: 2px; padding: 6px 8px 6px 30px; border-radius: 6px; background: rgba(255,250,235,.8); border: 1px solid var(--brass-lo); font-size: .8rem; counter-increment: mt; }
.mi-timeline li::before { content: counter(mt); position: absolute; left: 7px; top: 7px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; background: var(--oxblood); color: #fff; font-size: .72rem; }
.mi-timeline b { font-size: .82rem; }
@media (max-width: 720px) {
  .mod__more, .mod__info { margin-left: 0; }
  .mi__top { grid-template-columns: 48px minmax(0, 1fr); }
  .mi__icon { width: 48px; height: 48px; }
  .mi-timeline { grid-template-columns: 1fr; }
  .mi-card { width: 96px; }
}
/* dark panel (solo setup) */
.command .mi { background: rgba(255,250,235,.92); }
.command .mod__more { color: var(--brass-hi); }
.command .mod__name { color: var(--parchment-hi); }
.lobby__main .tablerules .mod.is-open { grid-column: 1 / -1; }
.mi-bars__row { grid-template-columns: 84px minmax(0, 1fr) auto; }
.mi-fan .mi-card { margin: 0 -2px; }
@media (max-width: 720px) {
  .mi-fan { flex-wrap: wrap; gap: 6px; }
  .mi-fan .mi-card { margin: 0; rotate: none !important; translate: none !important; width: 30%; min-width: 84px; }
  .mi-row > .mi-card { width: calc(50% - 30px); min-width: 84px; }
  .mi-row > .mi-art[width="44"] { width: 32px; height: 32px; }
}
