:root {
  --bg: #1a1410;
  --bg2: #241b15;
  --parch: #f1e4c6;
  --parch2: #e3d0a6;
  --ink: #2d2017;
  --ink-soft: #6a5440;
  --gold: #d9a441;
  --gold-dark: #9c6f1f;
  --red: #b3392f;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at top, #33261c, var(--bg) 70%);
  color: var(--parch);
  font-family: var(--serif);
  font-size: 15px;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: normal; }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--serif);
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 6px;
  border: 1px solid #8a6a3e;
  background: linear-gradient(#f6ead0, #dcc597);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 0 #6b4f2a;
  transition: transform .06s, filter .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.07); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 0 0 #6b4f2a; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(#f2c25c, #c98d26); border-color: #7d5410; font-weight: bold; }
.btn.danger { background: linear-gradient(#e8836f, #b3392f); color: #fff; border-color: #6e1f18; }
.btn.active { outline: 3px solid var(--gold); outline-offset: 1px; background: linear-gradient(#fff3c2, #f2c25c); }
.btn.big { font-size: 18px; padding: 11px 22px; }
.btn.small { font-size: 13px; padding: 4px 10px; }

select, input[type=text] {
  font-family: var(--serif);
  font-size: 14px;
  padding: 5px 7px;
  border-radius: 5px;
  border: 1px solid #8a6a3e;
  background: #fbf4e2;
  color: var(--ink);
}

/* ---------- start screen ---------- */
#welcome-screen, #theme-screen, #start-screen {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
}
.start-card {
  width: min(560px, 100%);
  background: linear-gradient(var(--parch), var(--parch2));
  color: var(--ink);
  border-radius: 14px;
  padding: 28px 28px 20px;
  box-shadow: 0 10px 40px rgba(0,0,0,.6), inset 0 0 0 2px #b99159;
}
.title {
  font-size: 52px;
  text-align: center;
  color: #7a2a14;
  letter-spacing: 2px;
  text-shadow: 0 2px 0 #f9e7b0;
}
.welcome-card { text-align: center; }
.free-badge { display: inline-block; margin: 0 auto 6px; padding: 6px 18px; border-radius: 999px; font-weight: bold; font-size: 20px; letter-spacing: 2px; color: #fff; background: linear-gradient(#3fae4f, #23802f); box-shadow: 0 3px 0 #1a5e22, 0 6px 14px rgba(0,0,0,.3); text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.free-line { margin: 4px 0 8px; font-size: 15.5px; font-weight: bold; color: #2f5a22; }
.free-points { list-style: none; padding: 0; margin: 0 auto 10px; display: inline-block; text-align: left; font-size: 14px; line-height: 1.6; }
#welcome-screen { flex-direction: column; gap: 6px; }
#theme-screen { flex-direction: column; }
#theme-screen .site-footer { margin-top: 26px; }
.site-logo { width: min(400px, 86vw); height: auto; filter: drop-shadow(0 8px 24px rgba(0,0,0,.6)); animation: logo-in .8s ease-out; }
.site-logo.small { width: min(240px, 60vw); display: block; margin: 0 auto 4px; }
/* The painted logo: its dark edges fade into the page background. */
.site-logo.hero {
  width: min(620px, 94vw); filter: none;
  /* Soft sides and top; the bottom stays sharp so "Strategy Games Arcade" reads clearly. */
  -webkit-mask-image: radial-gradient(ellipse 54% 100% at 50% 50%, #000 58%, transparent 98%),
                      linear-gradient(to bottom, transparent 0, #000 14%, #000 96%, transparent 100%);
  -webkit-mask-composite: source-in;
          mask-image: radial-gradient(ellipse 54% 100% at 50% 50%, #000 58%, transparent 98%),
                      linear-gradient(to bottom, transparent 0, #000 14%, #000 96%, transparent 100%);
          mask-composite: intersect;
  margin-bottom: 0;
}
.site-logo.hero.small { width: min(360px, 80vw); margin: 0 auto 2px; }
@keyframes logo-in { from { opacity: 0; transform: translateY(-12px) scale(.96); } to { opacity: 1; transform: none; } }
.crest { font-size: 34px; letter-spacing: 6px; margin-bottom: 4px; }
.name-label { display: flex; flex-direction: column; gap: 8px; font-size: 17px; margin: 10px auto 16px; max-width: 300px; }
.name-label input { font-size: 18px; padding: 9px 12px; text-align: center; }
.welcome-line { font-size: 20px; margin: 8px 0 16px; }
.start-card { position: relative; }
.back { position: absolute; left: 14px; top: 14px; }
.title.light { color: var(--gold); text-shadow: 0 3px 0 #000; margin-bottom: 18px; }
.theme-wrap { width: min(1000px, 100%); text-align: center; }
.hello { color: var(--parch); font-size: 17px; margin: 0 0 6px; }
.theme-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.theme-card {
  font-family: var(--serif);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 26px 18px 22px;
  border-radius: 16px;
  border: 2px solid #b99159;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
  transition: transform .15s, box-shadow .15s;
}
.theme-card:hover:not(.soon) { transform: translateY(-6px) scale(1.02); box-shadow: 0 18px 40px rgba(0,0,0,.7), 0 0 0 3px var(--gold); }
.theme-card.fantasy { background: linear-gradient(160deg, #f6e8c6, #d9bd85); }
.theme-card.pirate { background: linear-gradient(160deg, #cfe9ee, #6fa9b6); border-color: #3d6f7c; }
.theme-card.soon { background: linear-gradient(160deg, #5a5048, #3a332d); color: #c9bba5; border-style: dashed; cursor: default; opacity: .8; }
.theme-art { font-size: 46px; letter-spacing: 4px; }
.theme-name { font-size: 30px; font-weight: bold; }
.theme-card.fantasy .theme-name { color: #7a2a14; }
.theme-card.pirate .theme-name { color: #0e3b4a; }
.theme-kind { font-size: 14px; text-transform: uppercase; letter-spacing: 3px; opacity: .75; }
.theme-blurb { font-size: 14.5px; line-height: 1.45; margin-top: 6px; }
body.pirate .start-card, body.pirate .panel, body.pirate .modal-box { background: linear-gradient(#eef6f2, #cfe1d8); }
body.pirate .title, body.pirate .panel h3, body.pirate .modal-box h2, body.pirate .modal-box h3 { color: #0e3b4a; }
body.pirate .topbar { background: linear-gradient(#173540, #0f252d); border-bottom-color: #2c5866; }
body.pirate .brand { color: #8fd3e0; }
@media (max-width: 760px) { .theme-cards { grid-template-columns: 1fr; } }
.tagline { text-align: center; margin: 4px 0 18px; font-style: italic; color: var(--ink-soft); }
.start-card h2 { font-size: 20px; margin: 10px 0 8px; border-bottom: 1px solid #c4a674; padding-bottom: 4px; }
.slot {
  display: grid;
  grid-template-columns: 22px 1fr 110px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.slot.off input, .slot.off select:not(.slot-type) { opacity: .4; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #2d2017; }
.options { display: flex; gap: 16px; flex-wrap: wrap; margin: 14px 0; }
.options label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.start-buttons { display: flex; gap: 10px; justify-content: center; margin-top: 8px; flex-wrap: wrap; }
.fine { font-size: 12.5px; color: var(--ink-soft); text-align: center; margin: 12px 0 0; }

/* ---------- game layout ---------- */
#game-screen, #war-screen, #dk-screen { height: 100%; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: linear-gradient(#3a2b1f, #2a1f17);
  border-bottom: 2px solid #5c4329;
}
.brand { font-size: 20px; color: var(--gold); }
#turn-banner { flex: 1; text-align: center; font-size: 17px; }
.turn-dot { display: inline-block; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #000; vertical-align: -1px; margin-right: 5px; }
.topbar-buttons { display: flex; gap: 8px; }

.layout { flex: 1; display: flex; min-height: 0; }
.board-wrap { flex: 1; position: relative; min-width: 0; display: flex; }
#board { width: 100%; height: 100%; display: block; }
.hint {
  position: absolute;
  left: 50%; top: 12px;
  transform: translateX(-50%);
  background: rgba(20, 14, 10, .85);
  border: 1px solid var(--gold-dark);
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 15px;
  pointer-events: none;
  max-width: 90%;
  text-align: center;
}
.hint:empty { display: none; }

.side {
  width: 340px;
  overflow-y: auto;
  padding: 10px;
  background: #1f1712;
  border-left: 2px solid #4a3622;
}
.panel {
  background: linear-gradient(var(--parch), var(--parch2));
  color: var(--ink);
  border-radius: 9px;
  padding: 10px 11px;
  margin-bottom: 10px;
  box-shadow: inset 0 0 0 1px #b99159;
}
.panel h3 { font-size: 16px; margin-bottom: 7px; color: #6b2a14; }
details.panel summary { list-style: none; cursor: pointer; }
details.panel summary::-webkit-details-marker { display: none; }
details.panel:not([open]) h3 { margin-bottom: 0; }

.dice-row { display: flex; gap: 8px; align-items: center; margin-bottom: 9px; }
.dice { display: flex; gap: 5px; flex: 1; min-height: 38px; align-items: center; }
.die {
  width: 36px; height: 36px;
  background: linear-gradient(145deg, #fffdf6, #e6dcc6);
  border: 1px solid #8a7656;
  border-radius: 8px;
  box-shadow: 0 3px 0 #a8946e, 0 6px 8px rgba(0,0,0,.35), inset 0 1px 0 #fff;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 3px;
}
.die span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); place-self: center; }
.die.rolling { animation: tumble .45s ease-out; }
.dice-sum { font-size: 20px; font-weight: bold; margin-left: 4px; }
.dice-sum.seven { color: var(--red); }
@keyframes tumble { 0% { transform: rotate(-200deg) scale(.6); } 100% { transform: none; } }

.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }

.hand { display: flex; gap: 5px; flex-wrap: wrap; }
.card {
  flex: 1;
  min-width: 52px;
  text-align: center;
  border-radius: 7px;
  padding: 5px 2px 4px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
  border: 2px solid rgba(0,0,0,.35);
}
.card .ic { font-size: 20px; display: block; }
.card .n { font-size: 18px; font-weight: bold; }
.card .nm { font-size: 10.5px; display: block; }
.card.zero { opacity: .45; }
.rate { font-size: 10px; display: block; opacity: .9; }

.scrolls { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.scroll-item {
  display: flex; align-items: center; gap: 7px;
  background: #fbf4e2; border: 1px solid #c4a674; border-radius: 6px; padding: 4px 7px;
  font-size: 13px;
}
.scroll-item .nm { flex: 1; }
.scroll-item .new { font-size: 11px; color: var(--ink-soft); font-style: italic; }

.player-row {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 7px;
  align-items: center;
  padding: 5px 4px;
  border-radius: 6px;
}
.player-row.current { background: rgba(217, 164, 65, .3); box-shadow: inset 0 0 0 1px var(--gold-dark); }
.player-row .dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #000; }
.player-row .nm { font-weight: bold; font-size: 14px; }
.player-row .meta { font-size: 11.5px; color: var(--ink-soft); grid-column: 2 / 4; }
.player-row .glory { font-size: 17px; font-weight: bold; }
.badge { display: inline-block; font-size: 11px; background: #6b2a14; color: #fff; border-radius: 9px; padding: 0 6px; margin-left: 4px; }

.costs { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.cost-row { display: flex; justify-content: space-between; gap: 6px; }
.cost-row .what { font-weight: bold; }

.log { max-height: 200px; overflow-y: auto; font-size: 12.5px; line-height: 1.45; }
.log div { padding: 1px 0 1px 7px; border-left: 3px solid transparent; }
.log .turn-line { margin-top: 4px; font-weight: bold; }

/* ---------- board SVG ---------- */
.board-wrap {
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255, 200, 120, .16), transparent 60%),
    repeating-linear-gradient(92deg, rgba(0,0,0,.06) 0 3px, transparent 3px 22px),
    radial-gradient(ellipse at center, #4b3322 0%, #2b1c12 65%, #160e08 100%);
}
#board, #war-board { filter: drop-shadow(0 18px 22px rgba(0,0,0,.55)); }
.tile { stroke: rgba(255,255,255,.22); stroke-width: 1.2; stroke-linejoin: round; }
.hot-hex { cursor: pointer; stroke: #fff; stroke-width: 3.5; animation: glow 1.1s infinite alternate; }
.deco { pointer-events: none; }
.token { fill: #f6ecd2; stroke: #6b4f2a; stroke-width: 1.3; }
.token-num { font: bold 14px var(--serif); text-anchor: middle; fill: #2d2017; pointer-events: none; }
.token-num.red { fill: #b3241a; }
.pip { fill: #2d2017; }
.pip.red { fill: #b3241a; }
.dragon { font-size: 36px; text-anchor: middle; }
.dragon-float { animation: bob 2.4s ease-in-out infinite; }
.smoke { animation: smoke 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.smoke.s2 { animation-delay: -1s; }
.smoke.s3 { animation-delay: -2s; }
.harbor-txt { font: bold 10.5px var(--serif); text-anchor: middle; fill: #2d2017; }
.harbor-icon { font-size: 13px; text-anchor: middle; }
.hot { cursor: pointer; }
.hot-vertex { fill: rgba(255,255,255,.6); stroke: #fff; stroke-width: 2; animation: pulse 1s infinite alternate; }
.hot-arrow { fill: #ffd76a; stroke: #6b4f2a; stroke-width: 1; animation: hop .8s ease-in-out infinite alternate; }
.hot-vertex-hit { fill: transparent; }
.hot-edge { stroke: #fff; stroke-width: 5; stroke-dasharray: 5 5; stroke-linecap: round; animation: dash .6s linear infinite; opacity: .95; }
.hot-edge-hit { stroke: transparent; stroke-width: 26; }
.hot:hover .hot-vertex { fill: var(--gold); }
.hot:hover .hot-edge { stroke: var(--gold); }
.hot-ring { fill: rgba(255, 215, 106, .45); stroke: #fff; stroke-width: 2; animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .55; } to { opacity: 1; } }
@keyframes glow { from { stroke-opacity: .4; } to { stroke-opacity: 1; } }
@keyframes dash { to { stroke-dashoffset: -10; } }
.sea-lane { stroke: rgba(190, 225, 245, .16); stroke-width: 1; fill: none; pointer-events: none; }
.hot-sea { fill: rgba(150, 90, 200, .18); stroke: #e6c8ff; stroke-width: 2.5; stroke-dasharray: 6 4; cursor: pointer; animation: glow 1.1s infinite alternate; }
.hot-sea:hover { fill: rgba(150, 90, 200, .35); }
/* Frostmark: snow falling gently over the board (heavier in winter). */
body.frost .board-wrap::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 4;
  background-image:
    radial-gradient(2.5px 2.5px at 20px 30px, rgba(255,255,255,.9) 50%, transparent 51%),
    radial-gradient(2px 2px at 90px 80px, rgba(255,255,255,.8) 50%, transparent 51%),
    radial-gradient(3px 3px at 150px 20px, rgba(255,255,255,.85) 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 60px 130px, rgba(255,255,255,.7) 50%, transparent 51%),
    radial-gradient(2.2px 2.2px at 170px 150px, rgba(255,255,255,.75) 50%, transparent 51%);
  background-size: 200px 180px;
  animation: snowfall 14s linear infinite;
  opacity: .55;
}
body.frost.winter .board-wrap::after { opacity: .95; background-size: 140px 126px; animation: snowfall-winter 6s linear infinite; }
@keyframes snowfall { from { background-position: 0 0; } to { background-position: 40px 180px; } }
@keyframes snowfall-winter { from { background-position: 0 0; } to { background-position: 28px 126px; } }
.floe { animation: drift 7s ease-in-out infinite alternate; }
@media (prefers-reduced-motion: reduce) { body.frost .board-wrap::after, .floe { animation: none; } }
/* ---------- game-choice rows ---------- */
.row-title { color: var(--gold); font-size: 22px; margin: 22px 0 2px; text-shadow: 0 2px 0 #000; }
.row-sub { color: #c9bba5; font-size: 14px; margin: 0 0 12px; font-style: italic; }
.theme-cards.conquest-row { grid-template-columns: minmax(0, 1fr); max-width: 420px; margin: 0 auto; }
.theme-card.war { background: linear-gradient(160deg, #f1d9c4, #b97a5a); border-color: #6b2a14; }
.theme-card.war .theme-name { color: #6b1f12; }

/* ---------- Pirate's Bluff ---------- */
.theme-card.bluff { background: linear-gradient(160deg, #e9dcc0, #8fb7a8); border-color: #2c5866; }
.theme-card.bluff .theme-name { color: #0e3b4a; }
#bluff-screen { height: 100%; display: flex; flex-direction: column; }
.bluff-wrap { align-items: center; justify-content: center; }
.bluff-table { position: relative; width: min(100%, 980px); height: 100%; min-height: 420px; }
.bluff-table .deck {
  position: absolute; left: 8%; right: 8%; top: 12%; bottom: 12%; border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,220,160,.25), transparent 65%),
    repeating-linear-gradient(90deg, #7a4f2c 0 46px, #6b4426 46px 48px, #845733 48px 94px, #6b4426 94px 96px);
  border: 10px solid #4a2e16;
  box-shadow: inset 0 0 40px rgba(0,0,0,.55), 0 14px 30px rgba(0,0,0,.6), 0 0 0 4px #c8a46a;
}
.center-bid {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  text-align: center; color: #fff4d6; text-shadow: 0 2px 4px rgba(0,0,0,.8);
  background: rgba(30, 18, 8, .55); border: 2px solid rgba(242,194,92,.6); border-radius: 16px;
  padding: 10px 18px; min-width: 200px; z-index: 2;
}
.center-bid.reveal { background: rgba(20, 12, 6, .82); }
.cb-label { font-size: 14px; letter-spacing: 1px; }
.cb-bid { font-size: 34px; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0; }
.cb-count { font-size: 14px; font-style: italic; }
.cb-result { font-size: 16px; font-weight: bold; color: #ffd76a; margin: 6px 0; }
.center-bid .btn { margin-top: 6px; }
.die.big { width: 44px; height: 44px; }
.die.sm { width: 26px; height: 26px; padding: 2px; border-radius: 6px; }
.die.sm span { width: 5px; height: 5px; }
.die.match { background: linear-gradient(145deg, #fff3b0, #f2c25c); box-shadow: 0 0 0 3px #ffd76a, 0 0 14px #ffd76a; }
.seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 3; }
.seat-name { background: rgba(20,12,6,.85); color: #f1e4c6; border: 2px solid; border-radius: 14px; padding: 2px 10px; font-size: 13px; white-space: nowrap; }
.seat.turn .seat-name { box-shadow: 0 0 0 3px #ffd76a, 0 0 16px #ffd76a; }
.seat.out { opacity: .55; }
.seat-dice { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; max-width: 170px; }
.seat-dice.mine { max-width: none; margin-bottom: 6px; }
.seat-dice.mine .die { width: 38px; height: 38px; }
.cup {
  width: 46px; height: 50px; position: relative;
  background: linear-gradient(90deg, #5a341a, #8a5a32 45%, #5a341a);
  clip-path: polygon(8% 0, 92% 0, 100% 100%, 0 100%);
  border-radius: 6px 6px 4px 4px; box-shadow: 0 6px 10px rgba(0,0,0,.5);
  display: grid; place-items: center; color: #ffe9b8; font-weight: bold; font-size: 18px;
}
.cup::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: #3d2210; }
.plank { font-size: 34px; }
.bubble {
  background: #fffdf3; color: #2d2017; border: 2px solid #2d2017; border-radius: 14px;
  padding: 3px 10px; font-size: 14px; font-weight: bold; position: relative; white-space: nowrap;
  animation: pop .25s ease-out;
}
.bubble::after { content: ''; position: absolute; left: 50%; bottom: -8px; border: 7px solid transparent; border-top-color: #2d2017; transform: translateX(-50%); }
.bubble.shout { background: #ffdf7a; color: #7a1010; font-size: 17px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.bid-builder { border-top: 1px dashed #b8c8d4; margin-top: 8px; padding-top: 4px; }
.bid-q { font-size: 22px; min-width: 28px; text-align: center; }
.face-btn { border: 2px solid transparent; background: none; padding: 2px; border-radius: 8px; cursor: pointer; }
.face-btn.sel { border-color: #d9a441; background: rgba(242,194,92,.35); }
.bid-line { font-size: 13.5px; padding: 2px 0; }
@media (max-width: 860px) {
  #bluff-screen { height: auto; min-height: 100%; }
  .bluff-table { min-height: 0; height: 100%; }
  .seat-name { font-size: 11px; padding: 1px 7px; }
  .cup { width: 34px; height: 36px; font-size: 14px; }
  .seat-dice { max-width: 110px; }
  .die.sm { width: 20px; height: 20px; }
  .die.sm span { width: 4px; height: 4px; }
  .bubble { font-size: 11px; padding: 2px 7px; }
  .bubble.shout { font-size: 13px; }
  .center-bid { min-width: 150px; padding: 6px 10px; }
  .cb-bid { font-size: 24px; }
  .die.big { width: 32px; height: 32px; }
}

/* ---------- Pirate's Bluff: the pirate-ship look ---------- */
/* Screen colors: dark ship's wood, aged parchment, gold trim. */
body.bluff .start-card, body.bluff .panel, body.bluff .modal-box {
  background: radial-gradient(ellipse at 30% 20%, #f6e9c8, #e2c995 70%, #cfae72);
  box-shadow: inset 0 0 0 2px #8a6a3e, inset 0 0 30px rgba(120,80,30,.35), 0 6px 18px rgba(0,0,0,.45);
}
body.bluff .title, body.bluff .panel h3, body.bluff .modal-box h2, body.bluff .modal-box h3 { color: #7a1a10; }
body.bluff .title { letter-spacing: 3px; text-shadow: 0 2px 0 #f6e2a8; }
body.bluff .topbar {
  background: repeating-linear-gradient(90deg, #2b1a0e 0 60px, #24160b 60px 62px, #301d10 62px 122px, #24160b 122px 124px);
  border-bottom: 4px solid transparent;
  border-image: repeating-linear-gradient(45deg, #c8a46a 0 6px, #8a6a3e 6px 12px) 4;
}
body.bluff .brand { color: #ffd76a; letter-spacing: 1px; }
body.bluff .side { background: #1b120a; border-left-color: #5a3a1a; }
body.bluff .btn.danger { background: linear-gradient(#e0533f, #8f1f16); }

/* A ship's deck at night, lit by swaying lanterns. */
.bluff-wrap {
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(255,190,90,.14), transparent 60%),
    radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.65) 100%),
    repeating-linear-gradient(0deg, #3b2614 0 38px, #2c1c0e 38px 40px, #43301a 40px 78px, #2c1c0e 78px 80px);
}
.bluff-decor { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.bluff-decor > * { position: absolute; }
.lantern-glow { width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(255,190,90,.38), transparent 65%); animation: flicker 3.2s ease-in-out infinite alternate; }
.lantern-glow.l1 { left: -60px; top: -40px; }
.lantern-glow.l2 { right: -60px; top: -40px; animation-delay: -1.6s; }
.deco-lantern { width: 34px; top: 4px; transform-origin: top center; animation: sway 4s ease-in-out infinite alternate; filter: drop-shadow(0 0 10px #ffb347); }
.deco-lantern.lt1 { left: 60px; }
.deco-lantern.lt2 { right: 60px; animation-delay: -2s; }
.deco-flag { width: 92px; left: 50%; top: 4px; transform: translateX(-50%); animation: wave 3s ease-in-out infinite alternate; transform-origin: left center; opacity: .95; }
.deco-chest { width: 120px; right: 2%; bottom: 3%; filter: drop-shadow(0 6px 8px rgba(0,0,0,.6)); }
.deco-bottle { width: 30px; left: 4%; bottom: 5%; transform: rotate(-8deg); filter: drop-shadow(0 6px 6px rgba(0,0,0,.6)); }
.deco-parrot { font-size: 42px; left: 3%; top: 38%; transform: scaleX(-1); animation: bob 2.6s ease-in-out infinite; }
.deco-rope { width: 92px; right: 3%; top: 16%; opacity: .85; }
@keyframes flicker { 0% { opacity: .65; } 40% { opacity: .9; } 60% { opacity: .7; } 100% { opacity: 1; } }
@keyframes sway { from { transform: rotate(-5deg); } to { transform: rotate(5deg); } }
@keyframes wave { from { transform: translateX(-50%) skewY(-2deg); } to { transform: translateX(-50%) skewY(2deg); } }

/* The captain's table: dark polished wood, a brass-studded rim, and a treasure map. */
.bluff-table { z-index: 1; }
.bluff-table .deck {
  background:
    radial-gradient(ellipse at 45% 35%, rgba(255,215,150,.22), transparent 60%),
    repeating-radial-gradient(ellipse at 50% 50%, #5a3519 0 9px, #4f2e15 9px 11px, #613a1c 11px 19px);
  border: 14px solid #3a2210;
  box-shadow:
    inset 0 0 0 3px #b8892f, inset 0 0 50px rgba(0,0,0,.6),
    0 0 0 3px #1c1007, 0 18px 40px rgba(0,0,0,.75);
}
.bluff-table .deck::before { /* brass studs around the rim */
  content: ''; position: absolute; inset: -11px; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, #e8c35a 0 1.2deg, transparent 1.2deg 15deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px), #000 calc(100% - 3px), transparent calc(100% - 2px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 7px), #000 calc(100% - 6px), #000 calc(100% - 3px), transparent calc(100% - 2px));
}
.treasure-map {
  position: absolute; left: 24%; right: 24%; top: 24%; bottom: 24%;
  background: radial-gradient(ellipse at 40% 40%, #f1e0b5, #d8bd85 70%, #b8935a);
  border-radius: 6px; transform: rotate(-4deg);
  box-shadow: 0 6px 14px rgba(0,0,0,.55), inset 0 0 22px rgba(110,70,20,.55);
  clip-path: polygon(2% 4%, 20% 0, 44% 3%, 68% 0, 98% 2%, 100% 30%, 97% 58%, 100% 96%, 74% 100%, 50% 97%, 24% 100%, 0 97%, 3% 66%, 0 34%);
  opacity: .9;
}
.treasure-map svg { width: 100%; height: 100%; }
.center-bid { border: 3px double #c8a46a; background: rgba(28, 16, 6, .78); box-shadow: 0 8px 22px rgba(0,0,0,.6); }
.center-bid .cb-label { text-transform: uppercase; letter-spacing: 2px; font-size: 12px; color: #e8c35a; }

/* Bone dice and leather cups with brass bands. */
.bluff-table .die, #bluff-controls .die {
  background: linear-gradient(145deg, #fbf3dc, #dccaa0); border-color: #5a4026;
  box-shadow: 0 2px 0 #8a6f48, 0 4px 6px rgba(0,0,0,.4), inset 0 1px 0 #fff;
}
.bluff-table .die span, #bluff-controls .die span { background: #2a1408; }
.bluff-table .die.match, #bluff-controls .die.match { background: linear-gradient(145deg, #fff3b0, #f2c25c); box-shadow: 0 0 0 3px #ffd76a, 0 0 16px #ffd76a; }
.cup {
  background:
    linear-gradient(180deg, transparent 18%, #c9a23a 18% 24%, transparent 24% 74%, #c9a23a 74% 80%, transparent 80%),
    linear-gradient(90deg, #3d2010, #7a4524 35%, #9a5a2e 50%, #6b3a1c 70%, #3d2010);
}
.cup span { text-shadow: 0 1px 2px #000; }

/* Name scrolls and parchment speech bubbles. */
.seat-name {
  background: linear-gradient(#f6e9c8, #dcc08a); color: #3a1d0c;
  border: 2px solid #6b4a24; border-left: 6px solid var(--pc, #6b4a24); border-right: 6px solid var(--pc, #6b4a24);
  font-weight: bold; box-shadow: 0 3px 6px rgba(0,0,0,.5);
}
.seat-name .emblem { margin-right: 4px; }
.bubble { background: linear-gradient(#fffaf0, #f0dfb6); border-color: #5a3a1a; color: #3a1d0c; font-style: italic; }
.bubble.shout { background: linear-gradient(#ffe08a, #f2b13c); color: #7a1010; font-style: normal; letter-spacing: 1px; }
.plank { filter: drop-shadow(0 3px 4px rgba(0,0,0,.6)); }
@media (prefers-reduced-motion: reduce) { .lantern-glow, .deco-lantern, .deco-flag, .deco-parrot { animation: none; } }
@media (max-width: 860px) {
  .deco-flag { width: 60px; }
  .deco-lantern { width: 22px; }
  .deco-lantern.lt1 { left: 28px; } .deco-lantern.lt2 { right: 28px; }
  .deco-chest { width: 72px; right: 1%; bottom: 1%; }
  .deco-bottle { width: 20px; left: 2%; bottom: 2%; }
  .deco-parrot { font-size: 26px; left: 1%; top: 44%; }
  .deco-rope { display: none; }
  .bluff-table .deck { border-width: 9px; }
}

/* ---------- Pieces of Eight (five-dice scoring, same pirate look) ---------- */
.theme-cards.dice-games-row { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 860px; margin: 0 auto; }
.theme-card.eight { background: linear-gradient(160deg, #f6e7b8, #d9a441); border-color: #7a4a12; }
.theme-card.eight .theme-name { color: #6b2a0a; }
#eight-screen, #crew-screen, #gold-screen { height: 100%; display: flex; flex-direction: column; }
.eight-wrap { align-items: stretch; }
.eight-stage {
  position: relative; z-index: 1; flex: 1; min-width: 0; box-sizing: border-box;
  display: flex; gap: 22px; align-items: center; justify-content: center; padding: 18px; overflow: auto;
}
.eight-tray {
  position: relative; isolation: isolate; flex: 1 1 380px; max-width: 540px; min-height: 400px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 44px 26px;
}
.tray-deck {
  position: absolute; inset: 0; z-index: -1; border-radius: 34% / 42%;
  background:
    radial-gradient(ellipse at 45% 35%, rgba(255,215,150,.22), transparent 60%),
    repeating-radial-gradient(ellipse at 50% 50%, #5a3519 0 9px, #4f2e15 9px 11px, #613a1c 11px 19px);
  border: 14px solid #3a2210;
  box-shadow: inset 0 0 0 3px #b8892f, inset 0 0 50px rgba(0,0,0,.6), 0 0 0 3px #1c1007, 0 18px 40px rgba(0,0,0,.75);
}
.tray-head { display: flex; align-items: center; gap: 10px; }
.roll-pips { display: flex; gap: 5px; }
.roll-pip { width: 13px; height: 13px; border-radius: 50%; background: #ffd76a; border: 2px solid #3a2210; box-shadow: 0 0 6px #ffd76a; }
.roll-pip.used { background: #2a1408; box-shadow: none; }
.tray-dice { display: flex; gap: 12px; padding: 14px 0 18px; }
.tdie { position: relative; background: none; border: 0; padding: 0; cursor: pointer; transition: transform .18s; }
.tdie .die { width: 60px; height: 60px; padding: 7px; border-radius: 12px; }
.tdie .die span { width: 11px; height: 11px; }
.eight-tray .die, .score-card .die {
  background: linear-gradient(145deg, #fbf3dc, #dccaa0); border-color: #5a4026;
  box-shadow: 0 2px 0 #8a6f48, 0 4px 6px rgba(0,0,0,.4), inset 0 1px 0 #fff;
}
.eight-tray .die span, .score-card .die span { background: #2a1408; }
.tdie.held { transform: translateY(-12px); }
.eight-tray .tdie.held .die { background: linear-gradient(145deg, #fff3b0, #f2c25c); box-shadow: 0 0 0 3px #ffd76a, 0 0 18px #ffd76a; }
.tdie.idle .die { opacity: .45; filter: grayscale(.5); }
.keep-tag { position: absolute; left: 50%; bottom: -19px; transform: translateX(-50%); font-size: 10.5px; font-weight: bold; letter-spacing: 1.5px; color: #ffd76a; text-shadow: 0 1px 2px #000; }
.tray-hint {
  color: #fff4d6; text-shadow: 0 1px 3px #000; text-align: center; font-size: 14.5px;
  background: rgba(28,16,6,.75); border: 3px double #c8a46a; border-radius: 12px; padding: 7px 14px; max-width: 88%;
}
.tray-buttons { min-height: 46px; }
.tray-last { font-size: 13px; color: #f1e4c6; font-style: italic; text-shadow: 0 1px 2px #000; }
.kraken-splash {
  position: absolute; left: 50%; top: 42%; z-index: 5; pointer-events: none; white-space: nowrap;
  font-size: 46px; font-weight: bold; color: #ffd76a; text-shadow: 0 0 18px #ff3b2f, 0 3px 0 #5a0d08;
  animation: krakenPop 2s ease-out forwards;
}
@keyframes krakenPop {
  0% { transform: translate(-50%, -50%) scale(.3); opacity: 0; }
  15% { transform: translate(-50%, -50%) scale(1.25); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { transform: translate(-50%, -90%); opacity: 0; }
}
.eight-card {
  flex: 0 1 470px; max-height: 100%; overflow: auto; border-radius: 10px; padding: 6px 8px;
  background: radial-gradient(ellipse at 30% 20%, #f6e9c8, #e2c995 70%, #cfae72);
  box-shadow: inset 0 0 0 2px #8a6a3e, inset 0 0 30px rgba(120,80,30,.35), 0 10px 26px rgba(0,0,0,.6);
}
.score-card { width: 100%; border-collapse: collapse; color: #3a1d0c; font-size: 13px; line-height: 1.12; }
.score-card th, .score-card td { border-bottom: 1px solid rgba(110,70,30,.28); padding: 2px 4px; }
.score-card thead th { position: sticky; top: -6px; z-index: 1; background: #ecdcb2; }
.score-card th.cat { text-align: left; font-weight: normal; white-space: nowrap; }
.score-card th.cat > span { display: inline-block; vertical-align: middle; }
.score-card th.cat b { font-size: 13px; }
.score-card th.cat small { display: block; font-size: 10px; color: #6a5440; }
.score-card .corner { font-size: 15px; font-weight: bold; color: #7a1a10; }
.die.xs { display: inline-grid; vertical-align: middle; width: 19px; height: 19px; padding: 2px; border-radius: 5px; margin-right: 6px; }
.die.xs span { width: 4px; height: 4px; }
.cat-icon { display: inline-block; vertical-align: middle; width: 23px; margin-right: 4px; text-align: center; font-size: 16px; }
.score-card th.pc { font-size: 12px; border-bottom: 3px solid var(--pc); white-space: nowrap; min-width: 46px; text-align: center; }
.score-card th.pc .emblem { display: block; font-size: 16px; }
.score-card th.pc.now { background: #f7d982; }
.score-card td.pc { text-align: center; font-weight: bold; font-size: 15px; min-width: 46px; }
.score-card td.pc small { font-weight: normal; font-size: 10px; color: #6a5440; }
.score-card td.zero { color: #9a7a5a; }
.score-card td.fresh { animation: freshCell 1.8s ease-out; }
@keyframes freshCell { from { background: #ffd76a; } to { background: transparent; } }
.pick {
  width: 100%; min-width: 40px; padding: 1px 2px; border-radius: 7px; cursor: pointer; font: inherit; font-weight: bold; font-size: 14px;
  color: #1f6b2a; background: rgba(255,240,190,.75); border: 2px dashed #b8892f;
}
.pick:hover { background: #ffd76a; border-style: solid; }
.pick.zero { color: #a33; background: rgba(255,240,220,.4); border-color: rgba(160,80,60,.5); }
.pick.tip { border-style: solid; box-shadow: 0 0 0 2px #ffd76a, 0 0 10px #ffb347; }
.score-card tr.sum th, .score-card tr.sum td { background: rgba(120,80,30,.12); font-size: 12.5px; }
.score-card tr.sum th small { color: #6a5440; }
.score-card tr.bonus td { color: #7a4a12; }
.score-card tr.grand th, .score-card tr.grand td { font-size: 16px; font-weight: bold; background: rgba(184,137,47,.32); border-top: 2px solid #6b4a24; }
.record { text-align: center; font-weight: bold; color: #7a1a10; }
@media (min-width: 861px) { body.eight .coach, body.crew .coach, body.gold .coach { left: auto; right: 16px; } }
@media (max-width: 1100px) and (min-width: 861px) {
  .eight-stage { flex-direction: column; justify-content: flex-start; }
  .eight-tray { flex: none; width: 100%; min-height: 330px; }
  .eight-card { flex: none; width: 100%; max-width: 560px; max-height: none; overflow: visible; }
}
@media (max-width: 860px) {
  .theme-cards.dice-games-row { grid-template-columns: 1fr; max-width: 420px; }
  #eight-screen, #crew-screen, #gold-screen { height: auto; min-height: 100%; }
  .board-wrap.eight-wrap { position: relative; height: auto; z-index: auto; }
  .eight-stage { flex-direction: column; padding: 10px 8px; gap: 12px; overflow: visible; }
  .eight-tray { flex: none; width: 100%; min-height: 0; padding: 30px 12px 24px; gap: 10px; box-sizing: border-box; }
  .tray-deck { border-width: 9px; border-radius: 42%; }
  .tray-dice { gap: 7px; }
  .tdie .die { width: 48px; height: 48px; padding: 5px; }
  .tdie .die span { width: 9px; height: 9px; }
  .tray-hint { font-size: 13px; }
  .eight-card { flex: none; width: 100%; max-height: none; overflow-x: auto; box-sizing: border-box; padding: 4px; }
  .score-card th.cat small { display: none; }
  .score-card th.pc, .score-card td.pc { min-width: 36px; }
  .score-card th.pc .pn { display: none; }
  .eight-wrap .deco-parrot, .eight-wrap .deco-chest, .eight-wrap .deco-bottle, .eight-wrap .deco-rope { display: none; }
}

/* ---------- Dragon's Peak (push-your-luck climbing, fantasy look) ---------- */
.theme-cards.dice-games-row { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; }
.theme-card.peak { background: linear-gradient(160deg, #e6ddf2, #9a86c4); border-color: #3e2f6b; }
.theme-card.peak .theme-name { color: #34235e; }
#peak-screen { height: 100%; display: flex; flex-direction: column; }
.peak-wrap { background: radial-gradient(ellipse at 50% 30%, #3a2a5e, #120c22 75%); align-items: center; justify-content: center; overflow: hidden; }
#peak-board { width: 100%; height: 100%; display: block; filter: drop-shadow(0 14px 22px rgba(0,0,0,.6)); }
#peak-hint { left: 12px; top: 10px; transform: none; max-width: 60%; }
.cl-dot { display: inline-block; width: 11px; height: 11px; margin-left: 4px; border-radius: 50%; background: #ffd76a; border: 2px solid #fff; vertical-align: -1px; box-shadow: 0 0 6px #ffcf6a; }
.cl-dot.spent { background: transparent; box-shadow: none; opacity: .45; }
#peak-hint.fell { background: rgba(120, 20, 12, .9); border-color: #ff8a6a; font-weight: bold; }
.peak-wrap.shake #peak-board { animation: rockslide .6s ease-out; }
@keyframes rockslide {
  0%, 100% { transform: none; }
  15% { transform: translate(-7px, 3px); } 30% { transform: translate(6px, -2px); }
  45% { transform: translate(-5px, 2px); } 60% { transform: translate(4px, 0); } 80% { transform: translate(-2px, 1px); }
}
#peak-board .climber { animation: climberPulse 1.4s ease-in-out infinite alternate; }
@keyframes climberPulse { from { stroke-width: 3; } to { stroke-width: 5; } }
#peak-board .trail.hl .rock { stroke: #ffd76a; stroke-width: 4; }
#peak-board .trail.hl line { stroke: #ffd76a; opacity: 1; }
#peak-board .dragon { animation: dragonBreathe 4s ease-in-out infinite; transform-origin: 320px 30px; }
@keyframes dragonBreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.peak-dice { display: flex; gap: 6px; margin: 4px 0 8px; }
.peak-dice .die.sm, .move-btn .die.sm { width: 30px; height: 30px; }
.peak-moves { display: grid; gap: 6px; }
.move-btn { display: flex; align-items: center; gap: 10px; text-align: left; padding: 6px 10px; }
.move-btn .mini { display: flex; gap: 3px; }
.move-btn .die.sm { width: 22px; height: 22px; padding: 2px; }
.move-btn .die.sm span { width: 4px; height: 4px; }
.die.pa { background: linear-gradient(145deg, #fff3b0, #f2c25c); box-shadow: 0 0 0 2px #d9a441; }
.die.pb { background: linear-gradient(145deg, #d8ecff, #8fb8e6); box-shadow: 0 0 0 2px #3a7bd5; }
.die.unused { opacity: .35; }
@media (max-width: 1100px) { .theme-cards.dice-games-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .theme-cards.dice-games-row { grid-template-columns: 1fr; max-width: 420px; }
  #peak-screen { height: auto; min-height: 100%; }
  #peak-board { height: 100%; }
  .board-wrap.peak-wrap { height: auto; aspect-ratio: 640 / 560; }
  #peak-hint { max-width: 70%; font-size: 12px; }
}

/* ---------- Monster Mayhem (monster brawl dice, fantasy look) ---------- */
.theme-cards.dice-games-row { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 860px; margin: 0 auto; }
.theme-card.mayhem { background: linear-gradient(160deg, #e3f0d6, #7fae6a); border-color: #2f5a22; }
.theme-card.mayhem .theme-name { color: #24461a; }
body.mayhem .topbar { background: linear-gradient(#2a1840, #1a0f2a); border-bottom-color: #5a3a8a; }
body.mayhem .brand { color: #c9a6ff; }
.mm-swatch { display: grid; place-items: center; font-size: 15px; }
#mayhem-screen { height: 100%; display: flex; flex-direction: column; }
.mayhem-wrap {
  align-items: center; justify-content: center; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 58%, rgba(255,200,120,.28), transparent 45%),
    radial-gradient(ellipse 70% 30% at 50% 100%, #3f6a2e 60%, transparent 61%),
    radial-gradient(ellipse 50% 25% at 15% 95%, #2f5424 60%, transparent 61%),
    radial-gradient(ellipse 50% 25% at 85% 95%, #2f5424 60%, transparent 61%),
    linear-gradient(#1e1838, #4a2d5e 45%, #b0603e 80%, #3a5a2a 80.5%);
}
.mm-arena { position: relative; width: min(100%, 1000px); height: 100%; min-height: 470px; }
.mm-castle { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); z-index: 2; display: flex; flex-direction: column; align-items: center; }
.mm-keep { font-size: 110px; line-height: 1; filter: drop-shadow(0 10px 14px rgba(0,0,0,.65)); }
.mm-castle.held .mm-keep { font-size: 72px; margin-bottom: -6px; }
.mm-castle-label { color: #ffd76a; font-weight: bold; font-size: 14px; background: rgba(20,10,30,.78); border: 1px solid #d9a441; border-radius: 10px; padding: 2px 10px; margin: 4px 0; white-space: nowrap; }
.mm-empty { color: #f1e4c6; font-style: italic; font-size: 13px; text-shadow: 0 1px 3px #000; margin: 2px 0; text-align: center; max-width: 180px; }
.mm-seat { position: absolute; transform: translate(-50%, -50%); z-index: 3; }
.mm-mon {
  position: relative; width: 148px; box-sizing: border-box; padding: 5px 8px 6px; text-align: center; color: var(--ink);
  background: linear-gradient(#fff9e8, #ecdcb4); border: 3px solid var(--pc); border-radius: 12px;
  box-shadow: 0 6px 14px rgba(0,0,0,.55);
}
.mm-mon.inside { width: 168px; box-shadow: 0 0 0 2px #ffd76a, 0 8px 22px rgba(0,0,0,.6); }
.mm-mon.turn { box-shadow: 0 0 0 3px #ffd76a, 0 0 20px #ffd76a; }
.mm-mon.out { opacity: .5; filter: grayscale(.85); }
.mm-mon.winner { box-shadow: 0 0 0 4px #ffd76a, 0 0 30px #ffd76a; }
.mm-mon.hit { animation: mmHit .5s ease-out; }
.mm-icon { font-size: 40px; line-height: 1.1; }
.mm-name { font-weight: bold; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mm-stats { display: grid; gap: 1px; font-size: 12px; text-align: left; margin-top: 2px; }
.mm-stats > span { display: flex; align-items: center; gap: 3px; }
.mm-bar { flex: 1; height: 7px; margin-left: 3px; background: rgba(0,0,0,.18); border-radius: 4px; overflow: hidden; }
.mm-bar i { display: block; height: 100%; transition: width .4s; }
.mm-bar.hp i { background: linear-gradient(90deg, #b3241a, #ff6a5a); }
.mm-bar.glory i { background: linear-gradient(90deg, #c48a1c, #ffe17a); }
.mm-owned { font-size: 14px; letter-spacing: 2px; margin-top: 2px; }
.mm-float {
  position: absolute; left: 50%; top: 6px; z-index: 5; pointer-events: none; white-space: nowrap;
  font-size: 19px; font-weight: bold; text-shadow: 0 1px 2px #000, 0 0 6px #000; opacity: 0;
  animation: mmFloat 1.2s ease-out forwards;
}
.mm-float.dmg { color: #ff5a4a; } .mm-float.heal { color: #7dff8a; } .mm-float.glory { color: #ffd76a; } .mm-float.gem { color: #8fe3ff; }
@keyframes mmFloat { 0% { transform: translate(-50%, 0); opacity: 1; } 100% { transform: translate(-50%, -48px); opacity: 0; } }
@keyframes mmHit { 0%, 100% { transform: none; } 20% { transform: translateX(-7px) rotate(-3deg); } 40% { transform: translateX(6px) rotate(2deg); } 60% { transform: translateX(-3px); } }
.mm-dice { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.mm-slot { position: relative; background: none; border: 0; padding: 0 0 13px; cursor: pointer; font: inherit; }
span.mm-slot { cursor: default; }
.mm-die {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px;
  background: linear-gradient(145deg, #fffdf6, #e6dcc6); border: 1px solid #8a7656;
  box-shadow: 0 3px 0 #a8946e, 0 5px 8px rgba(0,0,0,.35); font-size: 22px; font-weight: bold; color: #3a1d5e;
}
.mm-die.face-1, .mm-die.face-2, .mm-die.face-3 { font-size: 25px; font-family: Georgia, serif; }
.mm-die.blank { opacity: .4; }
.mm-die.rolling { animation: tumble .45s ease-out; }
.mm-slot.kept .mm-die { background: linear-gradient(145deg, #fff3b0, #f2c25c); box-shadow: 0 0 0 3px #d9a441, 0 0 12px #ffd76a; }
.mm-slot small { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); font-size: 9px; font-weight: bold; letter-spacing: 1px; color: #a06d12; }
.mm-preview { font-size: 13px; background: rgba(217,164,65,.2); border-radius: 8px; padding: 5px 8px; margin: 4px 0 8px; }
.mm-market { display: grid; gap: 6px; }
.mm-card { border: 2px solid #8a6a3e; border-radius: 10px; padding: 6px 8px; background: linear-gradient(#fff9e8, #f0e0b8); overflow: hidden; }
.mm-card.keep { border-color: #5a3a8a; background: linear-gradient(#f6efff, #e2d6f5); }
.mm-card-head { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.mm-card-icon { font-size: 20px; }
.mm-cost { margin-left: auto; font-weight: bold; white-space: nowrap; }
.mm-card-text { font-size: 12.5px; margin: 3px 0; }
.mm-type { font-size: 9.5px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; color: #fff; background: #8a6a3e; border-radius: 4px; padding: 0 4px; vertical-align: 1px; }
.mm-card.keep .mm-type { background: #5a3a8a; }
.mm-card .btn { float: right; }
@media (max-width: 860px) {
  .theme-cards.dice-games-row { grid-template-columns: 1fr; max-width: 420px; }
  #mayhem-screen { height: auto; min-height: 100%; }
  .board-wrap.mayhem-wrap { position: relative; height: auto; z-index: auto; }
  .mm-arena { height: 430px; min-height: 0; }
  .mm-mon { width: 98px; padding: 3px 5px; border-width: 2px; }
  .mm-mon.inside { width: 112px; }
  .mm-icon { font-size: 26px; }
  .mm-name { font-size: 10.5px; }
  .mm-stats { font-size: 10px; }
  .mm-bar { height: 5px; }
  .mm-owned { font-size: 11px; letter-spacing: 0; }
  .mm-keep { font-size: 64px; }
  .mm-castle.held .mm-keep { font-size: 40px; }
  .mm-castle-label { font-size: 11px; }
  .mm-empty { font-size: 11px; max-width: 120px; }
  .mm-die { width: 40px; height: 40px; }
}

/* ---------- Skyline Resorts (resort-building property game) ---------- */
.theme-card.hotels { background: linear-gradient(160deg, #e4f4fb, #7cc2dc); border-color: #1f5f7a; }
.theme-card.hotels .theme-name { color: #12465c; }
body.hotels .topbar { background: linear-gradient(#17485e, #0f3242); border-bottom-color: #e2b84a; }
body.hotels .brand { color: #ffe08a; }
#hotel-screen { height: 100%; display: flex; flex-direction: column; }
.hotel-wrap { background: radial-gradient(ellipse at 50% 40%, #bfe6f5, #5aa9c9 75%); }
#hotel-board { width: 100%; height: 100%; display: block; filter: drop-shadow(0 16px 20px rgba(0,0,0,.4)); }
#hotel-board .htile.pick { cursor: pointer; }
#hotel-board .htile.glow { animation: tileGlow 1s ease-in-out infinite alternate; }
@keyframes tileGlow { from { fill-opacity: .35; } to { fill-opacity: .85; } }
#hotel-board .hpawn.active { animation: pawnBob 1s ease-in-out infinite alternate; }
@keyframes pawnBob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
.h-dice { display: flex; gap: 6px; margin: 2px 0 6px; }
.h-act { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px dashed rgba(110,70,30,.3); font-size: 13.5px; }
.h-act.col { flex-direction: column; align-items: stretch; }
.h-btns { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.build-list { display: grid; gap: 4px; }
.build-opt { display: flex; justify-content: space-between; gap: 8px; text-align: left; }
.build-opt span { white-space: nowrap; font-weight: normal; }
.rs-tag { display: inline-block; padding: 0 6px; border-radius: 6px; border: 2px solid var(--rc); background: rgba(255,255,255,.6); font-weight: bold; white-space: nowrap; }
.permit { display: flex; align-items: center; gap: 8px; margin: 6px 0; padding: 6px 8px; border-radius: 8px; background: rgba(76,175,80,.18); font-size: 14px; animation: pop .3s ease-out; }
.permit.denied { background: rgba(217,83,79,.2); } .permit.double { background: rgba(240,138,36,.22); } .permit.free { background: rgba(255,215,106,.45); }
.permit-die { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; background: linear-gradient(145deg, #fffdf6, #e6dcc6); border: 1px solid #8a7656; box-shadow: 0 3px 0 #a8946e; font-size: 20px; font-weight: bold; animation: tumble .45s ease-out; }
.rent-note { margin: 6px 0; padding: 6px 8px; border-radius: 8px; background: rgba(176,58,72,.14); font-size: 13.5px; }
.rs-row { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 4px 0 4px 8px; border-left: 4px solid var(--rc); margin-bottom: 4px; font-size: 13px; }
.rs-name { font-weight: bold; }
.rs-owner { text-align: right; font-size: 12px; }
.rs-stage { grid-column: 1 / 3; font-size: 12px; color: var(--ink-soft); letter-spacing: .5px; }
@media (max-width: 860px) {
  #hotel-screen { height: auto; min-height: 100%; }
}

/* ---------- Ship, Captain & Crew (classic tavern dice, pirate look) ---------- */
.theme-cards.dice-games-row { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; }
.theme-card.crew { background: linear-gradient(160deg, #f3e6c8, #b98a52); border-color: #5a3a1a; }
.theme-card.crew .theme-name { color: #4a2408; }
.crew-pot { color: #ffd76a; font-weight: bold; font-size: 20px; text-shadow: 0 2px 3px #000; white-space: nowrap; }
.crew-pot small { font-size: 12px; font-weight: normal; color: #f1e4c6; }
.berths { display: flex; align-items: center; gap: 6px; }
.berth { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 62px; padding: 5px 6px 3px; border-radius: 10px; border: 2px dashed rgba(241,228,198,.45); color: #f1e4c6; }
.berth.on { border-style: solid; border-color: #ffd76a; background: rgba(255,215,106,.18); box-shadow: 0 0 12px rgba(255,215,106,.45); }
.berth-icon { font-size: 18px; }
.berth-need { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; border: 2px dashed rgba(241,228,198,.5); font-weight: bold; }
.berth small { font-size: 10.5px; letter-spacing: 1px; text-transform: uppercase; }
.berth-arrow { color: #c8a46a; }
.eight-tray .tdie.aboard .die { background: linear-gradient(145deg, #d9f0ff, #8fc4e8); box-shadow: 0 0 0 2px #3a7bd5, 0 3px 6px rgba(0,0,0,.4); }
.keep-tag.role { color: #9fd3ff; }
.crew-table { width: 100%; border-collapse: collapse; color: #3a1d0c; font-size: 14px; }
.crew-table th { text-align: left; font-size: 12px; color: #7a1a10; padding: 4px; border-bottom: 2px solid #8a6a3e; }
.crew-table td { padding: 6px 4px; border-bottom: 1px solid rgba(110,70,30,.25); }
.crew-table tr.now td { background: #f7d982; }
.crew-table tr.gone td { opacity: .5; }
.crew-table .rn { font-weight: bold; border-left: 5px solid var(--pc); }
.crew-table .rn small { font-weight: normal; color: #6a5440; }
.crew-table .rc { white-space: nowrap; }
.crew-table .rr { font-weight: bold; white-space: nowrap; }
.crew-table .rr.top { color: #1f6b2a; }
.crew-roster .fine { text-align: left; }
.eight-stage .crew-roster { flex: 0 1 400px; }
.crew-tray .tray-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.crew-tray { gap: 12px; }
@media (max-width: 1100px) { .theme-cards.dice-games-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .theme-cards.dice-games-row { grid-template-columns: 1fr; max-width: 420px; margin: 0 auto; }
  .berth { min-width: 52px; padding: 3px 4px 2px; }
  .crew-pot { font-size: 16px; }
  .crew-table { font-size: 13px; }
  .home-btn { padding-left: 9px; padding-right: 9px; }
  .home-btn .lbl { display: none; }
  .topbar-buttons { gap: 4px; }
  .topbar-buttons .btn.small { padding-left: 7px; padding-right: 7px; }
}

/* ---------- Goblin Gold (the classic "10,000" dice game, in a treasure cave) ---------- */
.theme-card.gold { background: linear-gradient(160deg, #e8f0c8, #8aa84a); border-color: #3e5a1a; }
.theme-card.gold .theme-name { color: #2f4a10; }
body.gold .topbar { background: linear-gradient(#2b2418, #17130c); border-bottom-color: #d9a441; }
body.gold .brand { color: #ffd76a; }
.gold-wrap {
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 55%, rgba(255,196,80,.22), transparent 50%),
    radial-gradient(ellipse at center, transparent 35%, rgba(0,0,0,.7) 100%),
    repeating-radial-gradient(circle at 30% 20%, #2c2620 0 18px, #262019 18px 36px),
    #241e17;
}
.gold-wrap::before { /* stalactites along the cave roof */
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 46px; z-index: 0; pointer-events: none;
  background: conic-gradient(from 150deg at 50% 0, #18130d 0 60deg, transparent 60deg) 0 0 / 46px 46px repeat-x;
}
.gold-decor { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.gold-decor > * { position: absolute; }
.gold-decor .torch { font-size: 30px; top: 9%; filter: drop-shadow(0 0 12px #ff9a2a); animation: flicker 1.6s ease-in-out infinite alternate; }
.gold-decor .t1 { left: 3%; } .gold-decor .t2 { right: 3%; animation-delay: -.8s; }
.gold-decor .glow { width: 280px; height: 280px; border-radius: 50%; top: -60px; background: radial-gradient(circle, rgba(255,160,60,.3), transparent 65%); animation: flicker 2.4s ease-in-out infinite alternate; }
.gold-decor .g1 { left: -80px; } .gold-decor .g2 { right: -80px; animation-delay: -1.2s; }
.gold-decor .pile { bottom: 3%; font-size: 40px; filter: drop-shadow(0 0 14px rgba(255,215,106,.7)); }
.gold-decor .p1 { left: 3%; } .gold-decor .p2 { right: 4%; font-size: 32px; } .gold-decor .p3 { left: 12%; font-size: 26px; }
.gold-decor .bat { font-size: 22px; top: 18%; animation: batFly 9s ease-in-out infinite; }
.gold-decor .b1 { left: 20%; } .gold-decor .b2 { right: 22%; animation-delay: -4s; font-size: 18px; }
@keyframes batFly { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(40px, -12px); } 50% { transform: translate(80px, 8px); } 75% { transform: translate(30px, 14px); } }
.gold-tray .tray-deck {
  border-radius: 46% / 40%;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,215,140,.18), transparent 60%),
    radial-gradient(circle at 30% 30%, #6d6558, #4a443b 60%, #39342d);
  border: 12px solid #2c2722;
  box-shadow: inset 0 0 0 3px #b8892f, inset 0 0 50px rgba(0,0,0,.6), 0 0 0 3px #120f0b, 0 18px 40px rgba(0,0,0,.75);
}
.gold-tray .tray-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.gold-tray .tdie.held .die { background: linear-gradient(145deg, #fff3b0, #f2c25c); box-shadow: 0 0 0 3px #ffd76a, 0 0 18px #ffd76a; }
.gold-stake { color: #ffd76a; font-weight: bold; font-size: 20px; text-shadow: 0 2px 3px #000; white-space: nowrap; }
.gold-stake small { font-size: 11px; font-weight: normal; color: #f1e4c6; }
.gold-aside { display: flex; align-items: center; gap: 4px; color: #f1e4c6; font-size: 12px; }
.gold-aside .die.sm { opacity: .85; }
.kraken-splash.raid { color: #9cff6a; text-shadow: 0 0 18px #2a8a10, 0 3px 0 #0e3a08; }
.gold-bar { height: 7px; margin-top: 3px; background: rgba(0,0,0,.18); border-radius: 4px; overflow: hidden; }
.gold-bar i { display: block; height: 100%; background: linear-gradient(90deg, #c48a1c, #ffe17a); transition: width .5s; }
.eight-stage .gold-hoard { flex: 0 1 380px; }
.gold-guide { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.gold-guide td { padding: 2px 4px; border-bottom: 1px dotted rgba(110,70,30,.3); }
.gold-guide td:last-child { text-align: right; font-weight: bold; white-space: nowrap; }
@media (max-width: 860px) {
  .gold-decor .bat, .gold-decor .p3 { display: none; }
  .gold-decor .torch { font-size: 22px; }
  .gold-decor .pile { font-size: 28px; }
  .gold-stake { font-size: 16px; }
}

/* ---------- Territory Conquest row: Kraken Seas and Dice Kingdoms ---------- */
.theme-cards.war-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.theme-card.kraken { background: linear-gradient(160deg, #d6f0f2, #4f9fb0); border-color: #14505e; }
.theme-card.kraken .theme-name { color: #0c3a46; }
.theme-card.dk { background: linear-gradient(160deg, #f4e6f6, #b48ac4); border-color: #4a2a5e; }
.theme-card.dk .theme-name { color: #3a1a4e; }
@media (max-width: 1100px) { .theme-cards.war-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .theme-cards.war-row { grid-template-columns: 1fr; } }

/* Kraken Seas: sea-blue bar, the roaming Kraken, treasure glints */
body.sea .topbar { background: linear-gradient(#173540, #0f252d); border-bottom-color: #2c5866; }
body.sea .brand { color: #8fd3e0; }
.war-kraken { font-size: 86px; text-anchor: middle; filter: drop-shadow(0 4px 6px rgba(0,0,0,.6)); }
.kraken-ripple { fill: none; stroke: rgba(255,255,255,.7); stroke-width: 4; animation: krakenRipple 1.8s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes krakenRipple { from { transform: scale(.5); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.kraken-roam { animation: krakenBob 2.4s ease-in-out infinite alternate; }
.kraken-roam.fresh { animation: krakenRise 1.2s ease-out, krakenBob 2.4s ease-in-out 1.2s infinite alternate; }
@keyframes krakenBob { from { transform: translateY(0); } to { transform: translateY(-6px); } }
@keyframes krakenRise { 0% { transform: translateY(30px) scale(.4); opacity: 0; } 60% { transform: translateY(-10px) scale(1.25); opacity: 1; } 100% { transform: none; } }
.treasure-glint { filter: drop-shadow(0 0 6px rgba(255,215,80,.9)); }

/* Dice Kingdoms */
.dk-num { font: bold 17px var(--serif); fill: #fff; text-anchor: middle; pointer-events: none; }
.dk-stack.fresh { animation: dkFresh 1s ease-out; }
@keyframes dkFresh { 0% { transform: translateY(-14px); opacity: .3; } 100% { transform: none; opacity: 1; } }
.dk-battle { margin: 8px 0; padding: 6px 8px; border-radius: 10px; background: rgba(0,0,0,.06); border: 2px solid rgba(110,70,30,.25); }
.dk-battle.won { border-color: #3a8f3a; } .dk-battle.lost { border-color: #b3392f; }
.dk-side { font-size: 13px; }
.dk-sum { display: inline-block; min-width: 26px; text-align: center; font-weight: bold; font-size: 16px; background: #2a1d12; color: #ffd76a; border-radius: 6px; padding: 0 4px; margin-left: 4px; }
.dk-dice { display: flex; flex-wrap: wrap; gap: 3px; margin: 3px 0; }
.dk-dice .die.sm { width: 20px; height: 20px; }
.dk-dice .die.sm span { width: 4px; height: 4px; }
.dk-vs { text-align: center; font-weight: bold; color: #7a1a10; font-size: 12px; }
.dk-result { font-weight: bold; margin-top: 4px; font-size: 13.5px; }
.dk-odds { margin: 4px 0 6px; padding-left: 18px; font-size: 13px; }

/* ---------- Emberhold Wars ---------- */
#war-board, #dk-board { width: 100%; height: 100%; display: block; }
.war-tile { stroke: rgba(255,255,255,.18); stroke-width: 1; }
.war-tint { pointer-events: none; }
.war-rim { fill: none; stroke-width: 7; stroke-linecap: round; opacity: .95; pointer-events: none; }
.war-border { fill: none; stroke: #2a1a0c; stroke-width: 2.4; stroke-linecap: round; opacity: .75; pointer-events: none; }
.war-realm-border { fill: none; stroke: #f2c25c; stroke-width: 4.5; stroke-linecap: round; opacity: .9; pointer-events: none; }
.war-hot { fill: rgba(255,255,255,.12); stroke-width: 3; animation: glow 1s infinite alternate; pointer-events: none; }
.war-hot.place, .war-hot.source { stroke: #ffe08a; }
.war-hot.attack { stroke: #ff5a4a; fill: rgba(255,70,50,.18); }
.war-hot.move { stroke: #8af0a0; fill: rgba(120,240,150,.15); }
.war-sel { fill: rgba(255,255,255,.22); stroke: #fff; stroke-width: 3.5; pointer-events: none; }
[data-tid] { cursor: pointer; }
.war-num { font: bold 15px var(--serif); text-anchor: middle; pointer-events: none; }
.war-token.sel path { stroke: #fff; stroke-width: 3; }
.war-dragon { font-size: 30px; text-anchor: middle; }
.sea-route { fill: none; stroke: #e8f4ff; stroke-width: 3; stroke-dasharray: 2 9; stroke-linecap: round; opacity: .85; }
.sea-route-ship { font-size: 16px; text-anchor: middle; pointer-events: none; }
.orders-big { font-size: 18px; margin: 4px 0; }
.orders-warn { color: var(--red); font-weight: bold; }
.orders-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.orders-row input[type=range] { flex: 1; }
.vs { font-size: 15px; } .vs span { color: var(--red); font-weight: bold; margin: 0 4px; }
.battle-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.battle-row .who { flex: 1; font-size: 13px; font-weight: bold; }
.battle-row .dice { display: flex; gap: 4px; }
.die.red { background: linear-gradient(145deg, #ff8a7a, #c62f22); border-color: #6e1610; }
.die.red span { background: #fff; }
.banner-cards { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.banner-card { width: 38px; height: 50px; border-radius: 6px; display: grid; place-items: center; font-size: 22px; border: 2px solid #6b4f2a; background: linear-gradient(#fff7e2, #e8d3a0); box-shadow: 0 2px 0 #6b4f2a; }
.banner-card.dragon { background: linear-gradient(#e0d0ff, #a58be0); }
.realm-row { padding: 4px 0; border-bottom: 1px dashed #c4a674; font-size: 13.5px; }
.realm-row:last-child { border-bottom: none; }
.realm-row .bonus { float: right; font-weight: bold; color: #2f6b2a; }
.player-row.fallen { opacity: .5; }
.player-row.fallen .nm { text-decoration: line-through; }
.ice-road { stroke: #eaf6ff; stroke-width: 2; stroke-dasharray: 3 4; stroke-linecap: round; }
.giant-sway { animation: bob 3.2s ease-in-out infinite; }
body.frost .start-card, body.frost .panel, body.frost .modal-box { background: linear-gradient(#f2f6f9, #d6e2ea); }
body.frost .title, body.frost .panel h3, body.frost .modal-box h2, body.frost .modal-box h3 { color: #1d3d5c; }
body.frost .topbar { background: linear-gradient(#22313f, #18222c); border-bottom-color: #3c5568; }
body.frost .brand { color: #bfe3ff; }
body.frost.winter .board-wrap { background: radial-gradient(ellipse at center, #3b4a58 0%, #1e2832 65%, #11181e 100%); }
.theme-card.frost { background: linear-gradient(160deg, #eef5fa, #9fbfd6); border-color: #4f7593; }
.theme-card.frost .theme-name { color: #1d3d5c; }
.season { display: inline-block; margin-left: 10px; padding: 2px 10px; border-radius: 12px; font-size: 13px; background: #2f4b2a; color: #e8ffd8; }
.season.winter { background: #cfe8ff; color: #10314f; font-weight: bold; animation: pulse 1.2s infinite alternate; }
.saga { display: flex; gap: 7px; align-items: flex-start; font-size: 13px; padding: 4px 0; border-bottom: 1px dashed #b8c8d4; }
.saga:last-child { border-bottom: 0; }
.saga .nm { font-weight: bold; }
.saga.done { opacity: .75; }
.more-games { color: #c9bba5; margin-top: 22px; font-size: 15px; letter-spacing: 1px; }
.treasure-x { animation: pulse 1.6s infinite alternate; }
.fog-mark { font: bold 18px var(--serif); fill: rgba(90, 105, 125, .55); text-anchor: middle; }
.fog { animation: drift 6s ease-in-out infinite alternate; }
.kraken-float { animation: bob 3s ease-in-out infinite; }
.ripple { animation: pulse 1.4s infinite alternate; }
@keyframes drift { to { transform: translateX(4px); } }
@keyframes bob { 50% { transform: translateY(-5px); } }
@keyframes hop { to { transform: translateY(-3px); } }
@keyframes smoke { 0% { transform: translateY(2px) scale(.85); opacity: .5; } 50% { opacity: 1; } 100% { transform: translateY(-4px) scale(1.15); opacity: .5; } }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0;
  background: rgba(10, 6, 4, .78);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  padding: 12px;
}
#pass-screen { background: radial-gradient(#2c2018, #0c0806); z-index: 60; }
.pass-card { text-align: center; }
.pass-card h2 { font-size: 44px; color: var(--gold); margin: 8px 0 6px; }
.pass-card .fine { color: #b9a27c; margin-bottom: 22px; }
.modal-box {
  background: linear-gradient(var(--parch), var(--parch2));
  color: var(--ink);
  border-radius: 12px;
  padding: 20px 22px;
  width: min(520px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,.7), inset 0 0 0 2px #b99159;
}
.modal-box h2 { font-size: 24px; color: #6b2a14; margin-bottom: 10px; }
.modal-box h3 { font-size: 17px; color: #6b2a14; margin: 14px 0 6px; }
.modal-box p { margin: 6px 0; line-height: 1.45; }
.modal-box ul { padding-left: 20px; line-height: 1.5; margin: 6px 0; }
.modal-buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }

.picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.pick {
  text-align: center; border-radius: 8px; padding: 6px 2px;
  border: 2px solid rgba(0,0,0,.3);
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.7);
}
.pick .ic { font-size: 22px; display: block; }
.pick .n { font-size: 18px; font-weight: bold; display: block; }
.pick .have { font-size: 10.5px; display: block; }
.pick .pm { display: flex; justify-content: center; gap: 3px; margin-top: 4px; }
.pick .pm button { width: 26px; height: 24px; padding: 0; font-size: 15px; }
.pick.selectable { cursor: pointer; }
.pick.selected { outline: 3px solid #fff; box-shadow: 0 0 0 5px var(--gold-dark); }

.trade-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.final-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.final-table td, .final-table th { padding: 5px 6px; border-bottom: 1px solid #c4a674; text-align: left; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #6b1f16; color: #fff; padding: 9px 18px; border-radius: 8px;
  z-index: 70; box-shadow: 0 4px 16px rgba(0,0,0,.5);
}

/* ---------- board zoom & pan ---------- */
#board, #war-board, #hotel-board, #dk-board { touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
#board.panning, #war-board.panning, #hotel-board.panning, #dk-board.panning { cursor: grabbing; }
.zoom-ctl {
  position: absolute; right: 10px; bottom: 10px; z-index: 6;
  display: flex; flex-direction: column; gap: 6px;
}
.zoom-ctl .btn { width: 40px; height: 40px; padding: 0; font-size: 20px; line-height: 1; opacity: .92; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  /* The board stays pinned at the top while the controls scroll underneath. */
  .board-wrap {
    flex: none; position: sticky; top: 0; z-index: 20;
    height: 56vh; height: 56svh;
    border-bottom: 2px solid #4a3622;
  }
  #board, #war-board, #hotel-board, #dk-board { height: 100%; }
  .hint { top: 6px; font-size: 13px; padding: 5px 12px; max-width: 78%; }
  .zoom-ctl { right: 8px; bottom: 8px; gap: 8px; }
  .zoom-ctl .btn { width: 44px; height: 44px; }
  .side { width: 100%; border-left: none; overflow: visible; }
  #game-screen, #war-screen, #dk-screen { height: auto; min-height: 100%; }
  .brand { display: none; }
  .title { font-size: 40px; }
  .back { position: static; display: inline-block; margin-bottom: 6px; }
  .slot-name, .slot-type, .options select { min-height: 38px; }
  .actions .btn, .dice-row .btn { min-height: 42px; }
}

/* ---------- tutorial guide ---------- */
.coach {
  position: fixed; left: 16px; bottom: 16px; z-index: 55;
  width: min(390px, calc(100vw - 32px));
  max-height: min(70vh, 520px); overflow-y: auto;
  background: linear-gradient(#fff7e2, #f1dfb4);
  color: var(--ink);
  border-radius: 12px;
  border: 2px solid var(--gold);
  box-shadow: 0 12px 36px rgba(0,0,0,.6), 0 0 0 4px rgba(217,164,65,.25);
  font-size: 15px; line-height: 1.45;
  animation: coachIn .25s ease-out;
}
.coach.min { width: auto; max-width: calc(100vw - 32px); background: none; border: none; box-shadow: none; overflow: visible; }
@keyframes coachIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.coach-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 4px; font-size: 17px; color: #7a2a14; }
.coach-head b { flex: 1; }
.coach-cap { font-size: 22px; }
.coach-x { border: none; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-soft); padding: 0 4px; }
.coach-body { padding: 0 14px; }
.coach-body p, .coach-body ol, .coach-body ul { margin: 6px 0; }
.coach-body ol, .coach-body ul { padding-left: 20px; }
.coach-res { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.coach-foot { display: flex; align-items: center; gap: 8px; padding: 8px 12px 12px; }
.coach-step { flex: 1; text-align: center; font-size: 12px; color: var(--ink-soft); }
.coach-pill {
  font-family: var(--serif); font-size: 14px; cursor: pointer;
  padding: 8px 14px; border-radius: 20px; border: 2px solid var(--gold);
  background: linear-gradient(#fff3c2, #f2c25c); color: var(--ink);
  box-shadow: 0 6px 18px rgba(0,0,0,.5); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
body.pirate .coach-head { color: #0e3b4a; }
body.frost .coach-head { color: #1d3d5c; }
.coach-focus { animation: coachPulse 1.3s ease-in-out infinite; border-radius: 8px; }
.board-wrap.coach-focus { animation: coachPulseIn 1.3s ease-in-out infinite; border-radius: 0; }
@keyframes coachPulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--gold), 0 0 10px 2px rgba(242,194,92,.6); }
  50%      { box-shadow: 0 0 0 5px #ffe08a, 0 0 22px 8px rgba(242,194,92,.9); }
}
@keyframes coachPulseIn {
  0%, 100% { box-shadow: inset 0 0 0 3px var(--gold); }
  50%      { box-shadow: inset 0 0 0 6px #ffe08a, inset 0 0 30px rgba(242,194,92,.5); }
}
@media (max-width: 860px) {
  .coach { left: 8px; right: 8px; width: auto; bottom: 8px; max-height: 36vh; font-size: 13.5px; line-height: 1.4; }
  .coach-head { padding: 8px 10px 2px; font-size: 15px; }
  .coach-cap { font-size: 18px; }
  .coach-body { padding: 0 12px; }
  .coach-body p { margin: 4px 0; }
  .coach-foot { padding: 6px 10px 8px; }
  .coach.min { right: auto; }
  .topbar { flex-wrap: wrap; justify-content: center; row-gap: 6px; }
  .topbar-buttons { flex-wrap: wrap; justify-content: center; }
}

/* ---------- Banner ad (computers and tablets only; see js/ads.js) ---------- */
/* The ad gets its own strip: the page above is made shorter, so nothing is covered. */
.ad-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: 108px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: #120d09; border-top: 2px solid var(--gold-dark);
}
.ad-label { font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: #a8957a; }
.ad-slot { width: 728px; height: 90px; max-width: 100%; overflow: hidden; }
.ad-preview { width: 100%; height: 100%; display: grid; place-items: center; border: 2px dashed #9c6f1f; color: #e3c27a; font-size: 14px; background: repeating-linear-gradient(45deg, #1c1510 0 12px, #221a13 12px 24px); }
html.has-ad body { padding-bottom: 108px; }
/* Taller pages (the game list, setup screens) can scroll their last part clear of the ad. */
html.has-ad body::after { content: ""; display: block; height: 108px; }
html.has-ad .coach { bottom: 124px; }
html.has-ad .toast { bottom: 130px; }

/* ---------- footer links, About and Privacy pages ---------- */
.site-footer { text-align: center; font-size: 13px; color: #a8957a; margin: 18px auto 8px; padding: 0 12px; line-height: 1.8; }
.site-footer a { color: #e3c27a; text-decoration: none; white-space: nowrap; }
.site-footer a:hover { text-decoration: underline; }
body.doc-body { height: auto; min-height: 100%; }
.doc-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 900px; margin: 0 auto; padding: 14px 16px 6px; }
.doc-home img { display: block; width: 130px; height: auto; }
.doc-card {
  max-width: 900px; margin: 8px auto 0; padding: 26px 30px; border-radius: 14px; color: var(--ink); line-height: 1.55;
  background: linear-gradient(#f6ead0, #e9d6ac); box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.doc-card h1 { font-size: 32px; color: #6b2a14; margin-bottom: 4px; }
.doc-card h2 { font-size: 21px; color: #6b2a14; margin: 22px 0 6px; border-bottom: 1px solid rgba(110,70,30,.25); padding-bottom: 3px; }
.doc-card h3 { font-size: 16px; color: #4a2a14; margin: 12px 0 4px; font-weight: bold; }
.doc-card p, .doc-card li { font-size: 15px; }
.doc-card ul { padding-left: 22px; margin: 6px 0; }
.doc-card a { color: #8a3a12; }
.doc-date { color: var(--ink-soft); font-style: italic; margin: 0 0 12px; }
.doc-lead { font-size: 17px !important; }
.doc-summary { background: rgba(255,255,255,.45); border: 2px solid #c9a86a; border-radius: 10px; padding: 8px 16px; }
.doc-summary h2 { border: 0; margin-top: 6px; }
.privacy-switch { margin: 14px 0; padding: 10px 16px; border-radius: 10px; background: rgba(76,175,80,.14); border: 2px solid #5f9e55; }
.doc-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 8px 0; }
.doc-table th, .doc-table td { border: 1px solid rgba(110,70,30,.3); padding: 5px 7px; text-align: left; vertical-align: top; }
.doc-table th { background: rgba(110,70,30,.12); }
.doc-games { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; }
.doc-games p { margin: 2px 0 8px; }
@media (max-width: 700px) {
  .doc-card { padding: 18px 16px; border-radius: 0; }
  .doc-card h1 { font-size: 26px; }
  .doc-games { grid-template-columns: 1fr; }
  .doc-table { font-size: 12px; }
}

/* ---------- Cookie banner (home screens, until the visitor chooses) ---------- */
.cookie-banner {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 65;
  width: min(760px, calc(100% - 20px)); display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 12px; color: var(--ink);
  background: linear-gradient(#fff7e2, #f1dfb4); border: 2px solid var(--gold);
  box-shadow: 0 10px 30px rgba(0,0,0,.6);
}
.cookie-banner p { margin: 0; font-size: 14px; line-height: 1.45; flex: 1; }
.cookie-banner a { color: #8a3a12; }
.cookie-buttons { display: flex; gap: 8px; flex-shrink: 0; }
.cookie-buttons .btn { min-width: 90px; font-size: 15px; }
html.has-ad .cookie-banner { bottom: 122px; }
@media (max-width: 640px) {
  .cookie-banner { flex-direction: column; align-items: stretch; gap: 10px; bottom: 8px; padding: 10px 12px; }
  .cookie-banner p { font-size: 13px; }
  .cookie-buttons .btn { flex: 1; min-height: 42px; }
}

/* ---------- Send Feedback form ---------- */
#feedback { z-index: 80; }
.fb-box { position: relative; width: min(520px, calc(100% - 24px)); }
.fb-x { position: absolute; top: 10px; right: 12px; }
.fb-types { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 10px; }
.fb-types label { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 20px; border: 2px solid #c9a86a; background: rgba(255,255,255,.5); cursor: pointer; font-size: 14px; }
.fb-types label:has(input:checked) { background: #f7d982; border-color: var(--gold-dark); font-weight: bold; }
.fb-types input { accent-color: #9c6f1f; }
.fb-label { display: block; font-weight: bold; font-size: 14px; margin-top: 6px; }
.fb-label small { font-weight: normal; color: var(--ink-soft); }
.fb-label textarea, .fb-label input {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; border-radius: 8px; resize: vertical;
  border: 1px solid #8a6a3e; background: #fffdf6; color: var(--ink); font: 15px var(--serif);
}
.fb-count { text-align: right; font-size: 11px; color: var(--ink-soft); }
.fb-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---------- Feedback button at the far right of every game's top bar ---------- */
.fb-top { margin-left: auto; text-decoration: none; display: inline-flex; align-items: center; white-space: nowrap; }
@media (max-width: 860px) {
  .fb-top { margin-left: 0; }
  .fb-top .lbl { display: none; }          /* just the 💬 icon on tablets */
}
@media (max-width: 600px) {
  .fb-top { display: none; }               /* phones: no room up top; the footer link is still there */
}

/* ---------- Game list: compact cards (more games, less scrolling) ---------- */
.theme-cards, .theme-cards.war-row, .theme-cards.dice-games-row, .theme-cards.rpg-row { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; gap: 14px; }
.theme-cards.conquest-row { grid-template-columns: minmax(0, 1fr); max-width: 330px; margin: 0 auto; }
.theme-card { padding: 14px 14px 13px; gap: 3px; border-radius: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.theme-card:hover:not(.soon) { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(0,0,0,.65), 0 0 0 3px var(--gold); }
.theme-art { font-size: 30px; letter-spacing: 3px; line-height: 1.15; }
.theme-name { font-size: 21px; line-height: 1.15; }
.theme-kind { font-size: 11px; letter-spacing: 1.5px; }
.theme-blurb { font-size: 13px; line-height: 1.38; margin-top: 3px; }
.row-title { font-size: 20px; margin: 18px 0 2px; }
.row-sub { font-size: 13px; margin: 0 0 9px; }
@media (max-width: 900px) {
  .theme-cards, .theme-cards.war-row, .theme-cards.dice-games-row, .theme-cards.rpg-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Phones: one column, with the pictures beside the name so each card is short. */
@media (max-width: 600px) {
  .theme-cards, .theme-cards.war-row, .theme-cards.dice-games-row, .theme-cards.rpg-row, .theme-cards.conquest-row { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; gap: 10px; }
  .theme-card {
    display: grid; grid-template-columns: auto 1fr; grid-template-areas: "art name" "art kind" "blurb blurb";
    column-gap: 10px; row-gap: 1px; align-items: center; text-align: left; padding: 10px 12px;
  }
  .theme-art { grid-area: art; font-size: 22px; letter-spacing: 1px; }
  .theme-name { grid-area: name; font-size: 19px; }
  .theme-kind { grid-area: kind; font-size: 10.5px; letter-spacing: 1px; }
  .theme-blurb { grid-area: blurb; font-size: 12.5px; margin-top: 4px; }
}
.theme-card.delve { background: linear-gradient(160deg, #e6dccb, #8f7a62); border-color: #3e2f22; }
.theme-card.delve .theme-name { color: #3a1d0e; }
.theme-card.quest { background: linear-gradient(160deg, #f6e2bd, #c7924e); border-color: #6b3e14; }
.theme-card.quest .theme-name { color: #5a2a08; }
.theme-card.duel { background: linear-gradient(160deg, #f3d9d2, #c1695a); border-color: #6b1f14; }
.theme-card.duel .theme-name { color: #5e1408; }

/* ---------- Polyhedral dice (d4 to d20) ---------- */
.pdie { position: relative; display: inline-block; width: 50px; height: 50px; flex: none; vertical-align: middle; }
.pdie svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 3px 3px rgba(0,0,0,.5)); }
.pdie-tag { position: absolute; left: 50%; bottom: -13px; transform: translateX(-50%); font: bold 9.5px var(--serif); color: #f1e4c6; text-shadow: 0 1px 2px #000; letter-spacing: .5px; white-space: nowrap; }
.pdie.mini { width: 26px; height: 26px; }
.pdie.mini .pdie-tag { display: none; }
.pdie.rolling { animation: pdieRoll .6s cubic-bezier(.2, .8, .3, 1.15); }
.pdie.crit svg { filter: drop-shadow(0 0 7px #ffd76a) drop-shadow(0 0 3px #fff3b0); }
.pdie.fumble svg { filter: drop-shadow(0 0 6px #ff3a2a) saturate(.6); }
.pdie.dim { opacity: .4; }
@keyframes pdieRoll { 0% { transform: translateY(-26px) rotate(-260deg) scale(.5); opacity: .2; } 70% { transform: translateY(3px) rotate(12deg) scale(1.08); opacity: 1; } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .pdie.rolling { animation: none; } }

/* ---------- Fantasy adventures: shared stone-dungeon look ---------- */
#duel-screen, #quest-screen, #delve-screen { height: 100%; display: flex; flex-direction: column; }
body.rpg .topbar { background: linear-gradient(#3a3430, #221d1a); border-bottom-color: #8a6a3a; }
body.rpg .brand { color: #ffcf7a; }
body.rpg .side { background: #1a1614; border-left-color: #4a3e34; }
.rpg-wrap {
  flex-direction: column; overflow: auto; padding: 16px; box-sizing: border-box; gap: 12px;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,170,80,.18), transparent 60%),
    radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.65) 100%),
    linear-gradient(rgba(0,0,0,.25) 2px, transparent 2px) 0 0 / 64px 34px,
    linear-gradient(90deg, rgba(0,0,0,.25) 2px, transparent 2px) 0 0 / 64px 68px,
    linear-gradient(90deg, rgba(0,0,0,.25) 2px, transparent 2px) 32px 34px / 64px 68px,
    #3b3530;
}
.tavern-wrap {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255,190,100,.25), transparent 60%),
    radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,.6) 100%),
    repeating-linear-gradient(90deg, #4a2f1a 0 58px, #3e2715 58px 60px, #53351d 60px 118px, #3e2715 118px 120px);
}
.wide-card { width: min(760px, 100%); }
.ok { color: #2f8a3a; }
.bad { color: #c0392b; }
.duel-center .ok { color: #7ee08a; }
.duel-center .bad { color: #ff7b6b; }
.dmg { color: #ffb070; }
.cost { display: inline-block; font-size: 11px; font-weight: bold; padding: 0 6px; border-radius: 8px; background: #5b2c8a; color: #fff; vertical-align: 1px; }
.mana { display: inline-block; width: 9px; height: 9px; margin: 0 1px; transform: rotate(45deg); background: rgba(90,44,138,.25); border: 1px solid #5b2c8a; vertical-align: 0; }
.mana.on { background: linear-gradient(135deg, #e3b8ff, #8a3fd0); box-shadow: 0 0 5px #b36bff; }
.guard { font-size: 10px; padding: 0 5px; border-radius: 6px; background: #2f7fd0; color: #fff; letter-spacing: 1px; }
.dl-bar { position: relative; display: block; height: 18px; border-radius: 9px; background: #3a1410; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,.6); }
.dl-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#5fd06a, #2f8a3a); transition: width .5s; }
.dl-bar span { position: relative; display: block; text-align: center; font-size: 11.5px; line-height: 18px; color: #fff; text-shadow: 0 1px 2px #000; font-weight: bold; }
@keyframes rpgHit { 0%, 100% { transform: none; } 15% { transform: translateX(-8px) rotate(-2deg); } 35% { transform: translateX(7px) rotate(2deg); } 55% { transform: translateX(-4px); } 75% { transform: translateX(2px); } }
@keyframes rpgFlash { 0% { box-shadow: 0 0 0 3px #ff3a2a, 0 0 30px #ff3a2a; } 100% { box-shadow: 0 6px 18px rgba(0,0,0,.5); } }
@keyframes rpgTurn { from { box-shadow: 0 0 0 3px var(--pc, #ffd76a), 0 0 10px var(--pc, #ffd76a); } to { box-shadow: 0 0 0 3px var(--pc, #ffd76a), 0 0 26px var(--pc, #ffd76a); } }

/* The dice stage: every roll of the last move */
.duel-center {
  background: rgba(14,10,8,.82); color: #f1e4c6; border: 2px solid #8a6a3a; border-radius: 12px;
  padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.6); min-width: 0;
}
.stage-idle { text-align: center; font-size: 20px; color: #ffcf7a; padding: 26px 8px; line-height: 1.6; }
.stage-who { font-weight: bold; font-size: 16px; color: #ffcf7a; border-left: 4px solid var(--pc); padding-left: 8px; margin-bottom: 6px; }
.stage-row { display: grid; grid-template-columns: 110px auto 1fr; gap: 10px; align-items: center; padding: 6px 0 14px; border-bottom: 1px dotted rgba(241,228,198,.2); }
.stage-label { font-size: 12.5px; color: #d8c8a6; }
.stage-dice { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-math { font-size: 13.5px; }
.stage-math b { font-size: 16px; }
.stage-text { margin-top: 8px; font-size: 14px; font-style: italic; color: #fff3d6; }
.duel-actions { display: grid; gap: 7px; }
.act-btn { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 8px 11px; }
.act-btn b { font-size: 15px; }
.act-btn small { font-size: 12px; font-weight: normal; opacity: .85; line-height: 1.3; }

/* ---------- Dragon Duel ---------- */
.champ-picks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 6px 0 10px; }
.champ-pick {
  font-family: var(--serif); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 6px; cursor: pointer;
  border: 2px solid #b99159; border-radius: 10px; background: linear-gradient(#fbf1da, #e8d3a6); color: var(--ink); transition: transform .12s;
}
.champ-pick:hover { transform: translateY(-2px); }
.champ-pick.sel { border-color: #7a2a14; background: linear-gradient(#fff3c2, #f2c25c); box-shadow: 0 0 0 3px #d9a441; }
.champ-pick .cp-icon { font-size: 30px; }
.champ-pick small { font-size: 11px; line-height: 1.3; }
.champ-pick .cp-special { color: #5b2c8a; font-weight: bold; }
.duel-arena { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 1.6fr) minmax(150px, 1fr); gap: 14px; align-items: center; width: 100%; max-width: 1100px; margin: auto; }
.duelist {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 14px 12px;
  background: linear-gradient(#f6e8c6, #d9bd85); color: var(--ink); border: 3px solid var(--pc); border-radius: 14px; box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
.duelist.turn { animation: rpgTurn 1s ease-in-out infinite alternate; }
.duelist.hit { animation: rpgHit .5s, rpgFlash .8s; }
.duelist.down { filter: grayscale(.8); opacity: .75; }
.duelist.winner { box-shadow: 0 0 0 4px #ffd76a, 0 0 34px #ffd76a; }
.dl-icon { font-size: 54px; line-height: 1.1; }
.duelist.right .dl-icon { transform: scaleX(-1); }
.dl-name { font-weight: bold; font-size: 17px; text-align: center; }
.dl-class { font-size: 12px; color: var(--ink-soft); }
.duelist .dl-bar { width: 100%; }
.dl-stats { display: flex; gap: 10px; align-items: center; font-size: 14px; flex-wrap: wrap; justify-content: center; }
.dl-stats .used { opacity: .25; filter: grayscale(1); }

/* ---------- Tavern Quests ---------- */
.quest-board { width: 100%; max-width: 980px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.quest-sign { align-self: center; font-size: 22px; font-weight: bold; color: #3a1d0e; padding: 6px 26px; border-radius: 8px; background: linear-gradient(#e9c88a, #b98a4a); border: 3px solid #5a3214; box-shadow: 0 6px 14px rgba(0,0,0,.5); }
.quest-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.quest-card {
  font-family: var(--serif); position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 8px 10px;
  background: linear-gradient(#fbf1da, #e3cb98); color: var(--ink); border: 2px solid #8a6a3a; border-top: 8px solid var(--tc); border-radius: 6px 6px 10px 10px;
  box-shadow: 0 6px 14px rgba(0,0,0,.5); transform: rotate(-.6deg); cursor: default;
}
.quest-card:nth-child(2) { transform: rotate(.8deg); }
.quest-card:nth-child(3) { transform: rotate(-.3deg); }
.quest-card::before { content: '📌'; position: absolute; top: -14px; font-size: 16px; }
.quest-card.pickable { cursor: pointer; }
.quest-card.pickable:hover { transform: translateY(-4px) scale(1.03); box-shadow: 0 0 0 3px #ffd76a, 0 12px 22px rgba(0,0,0,.6); }
.quest-card.active { box-shadow: 0 0 0 4px #ffd76a, 0 0 26px #ffd76a; }
.qc-tier { font-size: 10.5px; font-weight: bold; letter-spacing: 2px; text-transform: uppercase; color: var(--tc); }
.qc-icon { font-size: 34px; line-height: 1.1; }
.qc-name { font-size: 15px; text-align: center; }
.qc-diff { font-size: 14px; }
.qc-diff b { font-size: 22px; color: #7a2a14; }
.qc-reward { font-size: 14px; font-weight: bold; }
.qc-risk { font-size: 11px; color: var(--ink-soft); text-align: center; }
.qc-chance { font-size: 11.5px; font-weight: bold; color: #2f6b2a; background: rgba(95,208,106,.2); border-radius: 8px; padding: 0 6px; }
.quest-roll { background: rgba(14,10,8,.82); border: 2px solid #8a6a3a; border-radius: 12px; padding: 14px; color: #f1e4c6; }
.qr-dice { display: flex; flex-wrap: wrap; gap: 14px 10px; justify-content: center; padding-bottom: 6px; }
.qr-die { position: relative; display: flex; align-items: center; gap: 2px; padding: 4px 6px 16px; background: rgba(255,255,255,.05); border: 2px solid transparent; border-radius: 10px; cursor: pointer; transition: transform .15s; }
.qr-die[tabindex="-1"] { cursor: default; }
.qr-die.picked { transform: translateY(-8px); border-color: #ffd76a; background: rgba(255,215,106,.15); box-shadow: 0 0 14px rgba(255,215,106,.5); }
.qr-die .keep-tag { bottom: -2px; }
.boom { font-size: 14px; }
.qr-total { text-align: center; font-size: 16px; margin-top: 4px; }
.qr-total > b { font-size: 22px; }
.qr-total.ok > b:first-child { color: #7ee08a; }
.qr-total.bad > b:first-child { color: #ffb070; }
.quest-roll .ok { color: #7ee08a; }
.quest-roll .bad { color: #ff7b6b; }
.pool-row { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin: 4px 0; }
.pool-row.inline { display: inline-flex; margin: 0; vertical-align: middle; }
.pool-row.inline .pdie.mini { width: 20px; height: 20px; }
.shop-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.shop-item { display: inline-flex; align-items: center; gap: 3px; }
.shop-item.maxed { font-size: 12px; color: var(--ink-soft); padding: 2px 6px; }
.fame-bar { grid-column: 1 / 4; height: 6px; background: rgba(0,0,0,.18); border-radius: 4px; overflow: hidden; }
.fame-bar i { display: block; height: 100%; background: linear-gradient(90deg, #c48a1c, #ffe17a); transition: width .5s; }

/* ---------- Dungeon Delve ---------- */
.delve-slots .slot { grid-template-columns: 22px minmax(0, 1fr) 118px 100px; }
.class-details { margin-top: 12px; font-size: 13.5px; }
.class-details summary { cursor: pointer; font-weight: bold; color: #7a2a14; }
#delve-classes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.class-info { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: 8px; background: rgba(255,255,255,.4); box-shadow: inset 0 0 0 1px #c4a674; }
.class-info small { font-size: 12px; line-height: 1.35; }
.class-info .fine { text-align: left; margin: 0; font-style: italic; }
.dungeon-wrap { justify-content: flex-start; }
.delve-track { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; padding: 8px 12px; border-radius: 10px; background: rgba(14,10,8,.7); color: #d8c8a6; font-size: 13px; align-self: center; }
.tr-floor { display: inline-flex; align-items: center; gap: 4px; opacity: .55; }
.tr-floor.cur { opacity: 1; color: #ffcf7a; }
.tr-floor b { margin-right: 4px; }
.tr-dot { display: inline-flex; align-items: center; justify-content: center; width: 13px; height: 13px; border-radius: 50%; border: 2px solid #8a6a3a; font-style: normal; font-size: 11px; }
.tr-dot.done { background: #8a6a3a; }
.tr-dot.here { background: #ffd76a; border-color: #fff3b0; box-shadow: 0 0 8px #ffd76a; }
.tr-dot.end { width: 20px; height: 20px; border: none; font-size: 16px; }
.delve-room { flex: 1; width: 100%; max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.room-head { text-align: center; font-size: 19px; color: #ffcf7a; text-shadow: 0 2px 3px #000; }
.doors { display: flex; justify-content: center; gap: 26px; flex-wrap: wrap; }
.door {
  font-family: var(--serif); display: flex; flex-direction: column; align-items: center; gap: 4px; width: 220px; padding: 0 0 12px; cursor: default;
  background: none; border: none; color: #f1e4c6; text-align: center;
}
.door-arch {
  display: flex; align-items: center; justify-content: center; width: 150px; height: 190px; margin-bottom: 6px;
  border-radius: 75px 75px 6px 6px; border: 8px solid #6d6558;
  background:
    radial-gradient(circle at 78% 55%, #d9a441 0 5px, transparent 6px),
    repeating-linear-gradient(90deg, #5a3519 0 22px, #4a2a12 22px 25px),
    #5a3519;
  box-shadow: inset 0 0 0 3px #2a1408, inset 0 -30px 40px rgba(0,0,0,.4), 0 10px 22px rgba(0,0,0,.6);
  transition: transform .15s, box-shadow .15s;
}
.door-icon { font-size: 46px; padding: 8px; border-radius: 50%; background: rgba(0,0,0,.45); box-shadow: 0 0 18px rgba(0,0,0,.6); }
.door b { font-size: 17px; color: #ffcf7a; }
.door small { font-size: 12.5px; color: #d8c8a6; max-width: 200px; }
.door.pickable { cursor: pointer; }
.door.pickable:hover .door-arch { transform: translateY(-5px); box-shadow: inset 0 0 0 3px #2a1408, 0 0 0 4px #ffd76a, 0 0 30px rgba(255,215,106,.6); }
.door-lair .door-arch, .door-elite .door-arch { border-color: #7a2a14; }
.foes { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.foe {
  font-family: var(--serif); position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; width: 150px; padding: 10px 8px 8px; cursor: pointer;
  background: linear-gradient(#e8ddd0, #b9a78e); color: var(--ink); border: 2px solid #5a4a3a; border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
.foe .dl-bar { width: 100%; }
.foe .dl-bar i { background: linear-gradient(#e0574a, #a3261a); }
.foe small { font-size: 11px; line-height: 1.3; text-align: center; }
.foe-icon { font-size: 40px; line-height: 1.1; }
.foe-name { font-size: 14px; text-align: center; }
.foe.target { border-color: #ffd76a; box-shadow: 0 0 0 3px #ffd76a, 0 0 22px rgba(255,215,106,.6); }
.foe.acting { animation: rpgTurn 1s ease-in-out infinite alternate; --pc: #ff5a3a; }
.foe.hit { animation: rpgHit .5s, rpgFlash .8s; }
.foe.dead { opacity: .4; filter: grayscale(1); cursor: default; }
.foe.elite { border-color: #6b2c8a; background: linear-gradient(#efe0f6, #b49ac4); }
.foe.boss { width: 260px; border-color: #7a2a14; background: linear-gradient(#f6d6c6, #c97a5a); }
.foe.boss .foe-icon { font-size: 76px; }
.foe.boss .foe-name { font-size: 17px; }
.target-tag { position: absolute; top: -11px; font-size: 10.5px; font-weight: bold; letter-spacing: 1px; padding: 1px 7px; border-radius: 8px; background: #ffd76a; color: #3a1d0e; box-shadow: 0 2px 4px rgba(0,0,0,.4); }
.delve-stage { width: 100%; max-width: 720px; margin: 0 auto; box-sizing: border-box; }
.room-card { align-self: center; width: min(640px, 100%); box-sizing: border-box; text-align: center; padding: 16px; border-radius: 14px; background: linear-gradient(var(--parch), var(--parch2)); color: var(--ink); box-shadow: 0 10px 30px rgba(0,0,0,.6), inset 0 0 0 2px #b99159; }
.room-card h2 { color: #7a2a14; margin: 2px 0 6px; }
.room-card .delve-stage { margin: 10px 0; text-align: left; }
.room-card .orders-row { justify-content: center; }
.room-icon { font-size: 52px; line-height: 1.1; animation: pop .4s ease-out; }
.shop-wares { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.ware { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 7px; }
.ware small { font-size: 11.5px; font-weight: normal; line-height: 1.3; }
.ware .cost { background: #7a4a12; }
.hero-row { display: grid; grid-template-columns: 38px 1fr; gap: 8px; align-items: center; padding: 6px 5px; border-radius: 8px; border-left: 4px solid var(--pc); margin-bottom: 5px; background: rgba(255,255,255,.25); }
.hero-row.turn { background: rgba(217,164,65,.35); box-shadow: inset 0 0 0 1px var(--gold-dark); }
.hero-row.down { opacity: .55; filter: grayscale(.8); }
.hero-row.hit { animation: rpgHit .5s; }
.hero-row.hit .hr-icon { animation: rpgFlash .8s; border-radius: 50%; }
.hr-icon { font-size: 28px; text-align: center; }
.hr-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hr-main small { font-size: 11.5px; color: var(--ink-soft); }
.hr-stats { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.party-purse { text-align: left; margin-top: 4px; }

@media (max-width: 1100px) and (min-width: 861px) {
  .duel-arena { grid-template-columns: 1fr 1fr; }
  .duel-arena .duel-center { grid-column: 1 / 3; grid-row: 2; }
}
@media (max-width: 860px) {
  #duel-screen, #quest-screen, #delve-screen { height: auto; min-height: 100%; }
  .board-wrap.rpg-wrap { position: relative; height: auto; z-index: auto; padding: 10px 8px; overflow: visible; }
  .duel-arena { grid-template-columns: 1fr 1fr; gap: 8px; }
  .duel-arena .duel-center { grid-column: 1 / 3; grid-row: 2; }
  .duelist { padding: 8px 6px; }
  .dl-icon { font-size: 40px; }
  .dl-name { font-size: 15px; }
  .stage-row { grid-template-columns: 1fr; gap: 4px; padding: 4px 0 14px; }
  .pdie { width: 42px; height: 42px; }
  .champ-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quest-cards { gap: 6px; }
  .quest-card { padding: 10px 4px 8px; }
  .qc-icon { font-size: 26px; }
  .qc-name { font-size: 12.5px; }
  .qc-risk { display: none; }
  .doors { gap: 12px; }
  .door { width: 46%; }
  .door-arch { width: 110px; height: 140px; border-width: 6px; }
  .door-icon { font-size: 34px; }
  .foes { gap: 6px; }
  .foe { width: calc(33% - 6px); min-width: 102px; padding: 8px 4px 6px; }
  .foe-icon { font-size: 30px; }
  .foe.boss { width: 100%; max-width: 280px; }
  .shop-wares { grid-template-columns: 1fr; }
  .delve-slots .slot { grid-template-columns: 22px minmax(0, 1fr) 104px; }
  .delve-slots .slot .slot-type { grid-column: 2 / 4; }
  #delve-classes { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .foe { width: calc(50% - 6px); }
  .foe small { display: none; }
  .quest-cards { grid-template-columns: 1fr; }
  .quest-card, .quest-card:nth-child(2), .quest-card:nth-child(3) { transform: none; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "icon name diff" "icon reward diff"; text-align: left; column-gap: 10px; padding: 8px 10px; }
  .quest-card .qc-icon { grid-area: icon; }
  .quest-card .qc-name { grid-area: name; text-align: left; }
  .quest-card .qc-diff { grid-area: diff; }
  .quest-card .qc-reward { grid-area: reward; font-size: 12.5px; }
  .quest-card .qc-tier, .quest-card .qc-chance { display: none; }
  .quest-card::before { display: none; }
}

/* Every game's setup page sits centered on the screen, like the welcome page. */
[id$="-setup-screen"] { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 12px; }
.quest-roll .pdie { width: 58px; height: 58px; }
@media (max-width: 860px) { .quest-roll .pdie { width: 44px; height: 44px; } }
@media (max-width: 860px) { .stage-dice { padding-bottom: 12px; } .stage-row { padding-bottom: 8px; } }

/* "Your Privacy Choices" link (California's short name for the opt-out link) with its toggle icon. */
.privacy-choices { white-space: nowrap; }
.privacy-choices::after {
  content: ''; display: inline-block; width: 28px; height: 13px; margin-left: 5px; vertical-align: -2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 14'%3E%3Crect x='.5' y='.5' width='29' height='13' rx='6.5' fill='%230066ff' stroke='%230066ff'/%3E%3Cpath d='M7 .5h10l-4 13H7a6.5 6.5 0 0 1 0-13z' fill='%23fff'/%3E%3Cpath d='M5.6 7.2l2 2 3.6-4.4' fill='none' stroke='%230066ff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M19.5 4.6l4.4 4.8M23.9 4.6l-4.4 4.8' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* Game cards with real polyhedral dice in their pictures */
.theme-art[data-dice] { display: inline-flex; align-items: center; justify-content: center; gap: 5px; }
.theme-art .pdie.art-die { width: 1.35em; height: 1.35em; }
.theme-art .pdie.art-die .pdie-tag { display: none; }
.theme-card:hover .theme-art .pdie.art-die { animation: pdieRoll .7s cubic-bezier(.2, .8, .3, 1.15); }
.theme-card:hover .theme-art .pdie.art-die:nth-child(3) { animation-delay: .08s; }

/* =====================================================================
   Dungeon Delve: painted dungeon scenes, hero portraits, effects, camp
   ===================================================================== */
.dungeon-wrap { padding: 10px 12px 14px; gap: 10px; position: relative; justify-content: flex-start; align-items: stretch; }
/* Each dungeon has its own colors: wall stone, torchlight and mood. */
.dungeon-wrap { --wallA: #4a4038; --wallB: #3a322b; --mortar: #231d18; --glow: 255,160,60; --floorA: #3b332c; --floorB: #2c2621; --mist: 0,0,0; }
.dungeon-wrap.dz-2 { --wallA: #3d4a3f; --wallB: #2f3a31; --mortar: #18201a; --glow: 140,255,140; --floorA: #34402f; --floorB: #262f22; --mist: 30,80,30; }
.dungeon-wrap.dz-3 { --wallA: #6f8494; --wallB: #546876; --mortar: #2a3640; --glow: 170,220,255; --floorA: #7c93a3; --floorB: #5c7282; --mist: 200,230,255; }
.dungeon-wrap.dz-4 { --wallA: #3f4566; --wallB: #30354f; --mortar: #181b2c; --glow: 150,180,255; --floorA: #363b58; --floorB: #272b42; --mist: 40,50,120; }
.dungeon-wrap.dz-5 { --wallA: #3a2f45; --wallB: #2a2134; --mortar: #120c18; --glow: 200,120,255; --floorA: #2e2538; --floorB: #1f1828; --mist: 60,20,90; }
.dungeon-wrap.dz-6 { --wallA: #6a5530; --wallB: #544222; --mortar: #2c2210; --glow: 255,215,110; --floorA: #5a4828; --floorB: #44361c; --mist: 120,90,20; }
.dungeon-wrap.rpg-wrap { background: radial-gradient(ellipse at 50% 30%, rgba(var(--glow), .1), transparent 60%), #15110e; }

/* ---- the floor map ---- */
.delve-map { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; padding: 6px 12px; border-radius: 10px;
  background: linear-gradient(#e9d6aa, #cdb07a); color: #3a2410; box-shadow: 0 4px 12px rgba(0,0,0,.5), inset 0 0 0 2px #8a6a3a; }
.map-title { font-weight: bold; font-size: 14px; white-space: nowrap; }
.map-title small { font-weight: normal; opacity: .8; }
.map-floors { display: flex; gap: 4px; }
.map-floors i { font-style: normal; font-size: 11px; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid #8a6a3a; }
.map-floors i.done { background: #8a6a3a; color: #fff; }
.map-floors i.cur { background: #ffd76a; border-color: #7a4a12; font-weight: bold; }
.map-svg { width: min(420px, 100%); height: 46px; flex: 1 1 260px; max-width: 420px; }
.map-svg .road { fill: none; stroke: #7a5a32; stroke-width: 3; stroke-dasharray: 5 5; }
.map-svg .node { fill: #f6e8c6; stroke: #7a5a32; stroke-width: 2; }
.map-svg .node.done { fill: #cdb07a; }
.map-svg .node.here { fill: #ffd76a; stroke: #b0400a; stroke-width: 3; animation: nodePulse 1s ease-in-out infinite alternate; }
.map-svg text { font-size: 15px; text-anchor: middle; dominant-baseline: central; }
.map-svg .q { fill: #7a5a32; font-weight: bold; font-family: var(--serif); }
@keyframes nodePulse { from { stroke-width: 2; } to { stroke-width: 5; } }

/* ---- the scene ---- */
.scene { position: relative; flex: none; height: clamp(300px, 50vh, 470px); border-radius: 14px; overflow: hidden; isolation: isolate;
  box-shadow: 0 12px 34px rgba(0,0,0,.7), inset 0 0 0 3px #1a1410; }
.scene.enter { animation: sceneIn .55s ease-out; }
@keyframes sceneIn { from { filter: brightness(0); transform: scale(1.04); } to { filter: none; transform: none; } }
.sc-wall { position: absolute; inset: 0 0 34% 0; z-index: -3;
  background:
    radial-gradient(ellipse 30% 55% at 16% 34%, rgba(var(--glow), .30), transparent 70%),
    radial-gradient(ellipse 30% 55% at 84% 34%, rgba(var(--glow), .30), transparent 70%),
    linear-gradient(to bottom, rgba(0,0,0,.55), transparent 30%, transparent 75%, rgba(0,0,0,.45)),
    linear-gradient(var(--mortar) 3px, transparent 3px) 0 0 / 90px 46px,
    linear-gradient(90deg, var(--mortar) 3px, transparent 3px) 0 0 / 90px 92px,
    linear-gradient(90deg, var(--mortar) 3px, transparent 3px) 45px 46px / 90px 92px,
    repeating-linear-gradient(115deg, rgba(255,255,255,.03) 0 6px, transparent 6px 17px),
    linear-gradient(var(--wallA), var(--wallB));
}
.sc-wall::after { /* stone arch framing the room */
  content: ''; position: absolute; left: 4%; right: 4%; top: -40%; bottom: -10%; border-radius: 50% 50% 0 0 / 40% 40% 0 0;
  box-shadow: 0 0 0 200px rgba(0,0,0,.42), inset 0 0 40px rgba(0,0,0,.7); pointer-events: none;
}
.sc-floor { position: absolute; left: -40%; right: -40%; bottom: -4%; height: 42%; z-index: -2; transform: perspective(380px) rotateX(52deg); transform-origin: 50% 100%;
  background:
    radial-gradient(ellipse 40% 70% at 50% 30%, rgba(var(--glow), .2), transparent 70%),
    linear-gradient(var(--mortar) 4px, transparent 4px) 0 0 / 120px 70px,
    linear-gradient(90deg, var(--mortar) 4px, transparent 4px) 0 0 / 120px 140px,
    linear-gradient(90deg, var(--mortar) 4px, transparent 4px) 60px 70px / 120px 140px,
    linear-gradient(var(--floorA), var(--floorB));
}
.sc-shade { position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: radial-gradient(ellipse 75% 85% at 50% 55%, transparent 55%, rgba(0,0,0,.6) 100%), radial-gradient(ellipse at 50% 100%, rgba(var(--mist), .25), transparent 55%); }
.sc-torch { position: absolute; top: 24%; width: 14px; height: 46px; z-index: -1; border-radius: 3px 3px 6px 6px;
  background: linear-gradient(90deg, #3a2412, #6b4524 50%, #3a2412); box-shadow: 0 4px 6px rgba(0,0,0,.6); }
.sc-torch::before { content: ''; position: absolute; left: -7px; right: -7px; top: -6px; height: 10px; border-radius: 3px; background: #2a1c10; border: 2px solid #8a6a3a; }
.sc-torch.l { left: 15%; } .sc-torch.r { right: 15%; }
.flame { position: absolute; left: 50%; bottom: calc(100% + 2px); width: 22px; height: 34px; transform: translateX(-50%); border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%;
  background: radial-gradient(ellipse at 50% 75%, #fff6c8 0 18%, rgb(var(--glow)) 45%, rgba(var(--glow), 0) 72%);
  filter: blur(.4px) drop-shadow(0 0 12px rgba(var(--glow), .9)); animation: torchFlame .35s ease-in-out infinite alternate; transform-origin: 50% 100%; }
.sc-torch.r .flame { animation-delay: -.2s; }
@keyframes torchFlame { from { transform: translateX(-50%) scale(1, 1) rotate(-3deg); } to { transform: translateX(-50%) scale(.9, 1.12) rotate(3deg); } }
.sc-stage { position: absolute; inset: 0; z-index: 2; }
.sc-title { position: absolute; top: 9px; left: 50%; transform: translateX(-50%); z-index: 4; white-space: nowrap; font-size: 18px; font-weight: bold; color: #ffe6a8;
  text-shadow: 0 2px 4px #000, 0 0 14px rgba(var(--glow), .6); letter-spacing: 1px; }

/* doors */
.sc-doors { position: absolute; left: 0; right: 0; bottom: 30%; display: flex; justify-content: center; gap: clamp(30px, 10vw, 110px); }
.sdoor { font-family: var(--serif); background: none; border: 0; padding: 0; color: #f1e4c6; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: default; }
.sdoor .frame { position: relative; width: 132px; height: 176px; border-radius: 66px 66px 4px 4px; perspective: 500px;
  background: radial-gradient(ellipse at 50% 60%, rgba(var(--glow), .85), rgba(var(--glow), .2) 55%, #000 90%);
  box-shadow: 0 0 0 10px #5d554b, 0 0 0 13px #2a241e, 0 12px 26px rgba(0,0,0,.7); }
.sdoor .frame::before { /* keystone */ content: ''; position: absolute; top: -18px; left: 50%; width: 22px; height: 22px; transform: translateX(-50%) rotate(45deg); background: #6d655a; border: 2px solid #2a241e; z-index: 2; }
.sdoor .glimpse { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 50px; filter: drop-shadow(0 0 10px #000); }
.sdoor .leaf { position: absolute; inset: 0; border-radius: 66px 66px 4px 4px; transform-origin: 0 50%; transition: transform .45s cubic-bezier(.3, .8, .4, 1);
  background:
    radial-gradient(circle at 82% 56%, #d9a441 0 6px, #6b4a12 7px, transparent 8px),
    linear-gradient(transparent 22%, #2a1606 22% 25%, transparent 25% 72%, #2a1606 72% 75%, transparent 75%),
    repeating-linear-gradient(90deg, #6a4020 0 24px, #4a2a12 24px 27px),
    #5a3519;
  box-shadow: inset 0 0 0 3px #2a1606, inset 0 -30px 40px rgba(0,0,0,.5); display: flex; align-items: flex-start; justify-content: center; padding-top: 30px; box-sizing: border-box; }
.sdoor .leaf .sign { font-size: 30px; padding: 6px; border-radius: 50%; background: radial-gradient(#3a2410, #1a0e06); box-shadow: 0 0 0 3px #8a6a3a, 0 4px 8px rgba(0,0,0,.6); line-height: 1; }
.sdoor .plaque { margin-top: 14px; padding: 4px 14px; border-radius: 6px; background: linear-gradient(#e9d6aa, #b9955a); color: #3a1d0e; font-weight: bold; font-size: 15px; box-shadow: 0 3px 8px rgba(0,0,0,.6), inset 0 0 0 2px #6b4a22; white-space: nowrap; }
.sdoor small { font-size: 12px; max-width: 200px; text-align: center; color: #f1e4c6; text-shadow: 0 1px 3px #000; }
.sdoor.pickable { cursor: pointer; }
.sdoor.pickable:hover .leaf, .sdoor.pickable:focus-visible .leaf { transform: rotateY(-62deg); }
.sdoor.pickable:hover .frame { box-shadow: 0 0 0 10px #5d554b, 0 0 0 13px #ffd76a, 0 0 40px rgba(var(--glow), .8); }
.sdoor.single .frame { width: 170px; height: 210px; border-radius: 85px 85px 4px 4px; }
.sdoor.single .leaf { border-radius: 85px 85px 4px 4px; }
.sdoor.door-lair .frame { box-shadow: 0 0 0 10px #5a2a1a, 0 0 0 13px #1a0a06, 0 0 50px rgba(255,60,20,.6); }

/* monsters standing in the room */
.sc-foes { position: absolute; left: 0; right: 0; bottom: 7%; display: flex; justify-content: center; align-items: flex-end; gap: clamp(4px, 2vw, 26px); padding: 0 6%; }
.mon { position: relative; display: flex; flex-direction: column; align-items: center; background: none; border: 0; padding: 0; font-family: var(--serif); cursor: pointer; min-width: 0; flex: 0 1 140px; }
.mon .plate { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; max-width: 128px; margin-bottom: 4px; }
.mon .plate b { font-size: 12.5px; color: #fff; text-shadow: 0 1px 3px #000, 0 0 6px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.mon .hpbar { position: relative; width: 100%; height: 9px; border-radius: 5px; background: #2a0a06; box-shadow: 0 0 0 1.5px #000, 0 2px 4px rgba(0,0,0,.6); overflow: hidden; }
.mon .hpbar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#ff6a50, #b3261a); transition: width .5s; }
.mon .hpbar.boss { height: 13px; }
.mon .stats { font-size: 10.5px; color: #e8dcc0; text-shadow: 0 1px 2px #000; white-space: nowrap; }
.mon .body { position: relative; font-size: clamp(46px, 7vw, 74px); line-height: 1; filter: drop-shadow(0 6px 4px rgba(0,0,0,.6)); animation: monIdle 2.2s ease-in-out infinite; transform-origin: 50% 100%; }
.mon:nth-child(2n) .body { animation-delay: -1.1s; }
.mon:nth-child(3n) .body { animation-delay: -.6s; }
.mon .shadow { width: 70%; height: 14px; margin-top: -6px; border-radius: 50%; background: radial-gradient(rgba(0,0,0,.7), transparent 70%); }
@keyframes monIdle { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-4px) scale(1.02, .98); } }
.mon.target .shadow { background: radial-gradient(rgba(255,215,106,.0) 40%, rgba(255,215,106,.9) 55%, transparent 72%); animation: ringSpin 1s ease-in-out infinite alternate; }
.mon.target::after { content: '▼'; position: absolute; top: -18px; left: 50%; transform: translateX(-50%); color: #ffd76a; font-size: 18px; text-shadow: 0 0 8px #ffb020, 0 2px 2px #000; animation: arrowBob .6s ease-in-out infinite alternate; }
@keyframes ringSpin { from { transform: scale(.9); } to { transform: scale(1.12); } }
@keyframes arrowBob { from { transform: translate(-50%, 0); } to { transform: translate(-50%, 5px); } }
.mon.acting .body { animation: monLunge .7s ease-in-out infinite alternate; filter: drop-shadow(0 0 12px rgba(255,60,30,.9)) drop-shadow(0 6px 4px rgba(0,0,0,.6)); }
@keyframes monLunge { from { transform: scale(1); } to { transform: scale(1.12) translateY(6px); } }
.mon.hit .body { animation: monHit .45s ease-out; }
@keyframes monHit { 0% { filter: brightness(3) drop-shadow(0 0 10px #fff); transform: translateX(0); } 25% { transform: translateX(-10px) rotate(-6deg); } 50% { transform: translateX(8px) rotate(4deg); } 100% { filter: drop-shadow(0 6px 4px rgba(0,0,0,.6)); transform: none; } }
.mon.dying .body { animation: monDie 1s ease-in forwards; }
@keyframes monDie { 0% { filter: brightness(3); } 30% { transform: rotate(-12deg) translateY(-6px); opacity: 1; } 100% { transform: rotate(80deg) translateY(30px) scale(.6); opacity: 0; } }
.mon.dead { cursor: default; }
.mon.dead .body { opacity: .18; filter: grayscale(1); animation: none; }
.mon.dead .plate { opacity: .35; }
.mon.elite .body { font-size: clamp(60px, 9vw, 94px); filter: drop-shadow(0 0 14px rgba(180,90,255,.7)) drop-shadow(0 6px 4px rgba(0,0,0,.6)); }
.mon.boss { flex-basis: 360px; }
.mon.boss .plate { max-width: 300px; }
.mon.boss .plate b { font-size: 15px; color: #ffd76a; }
.mon.boss .body { font-size: clamp(110px, 17vw, 170px); filter: hue-rotate(var(--hue, 0deg)) saturate(var(--sat, 1)) drop-shadow(0 0 26px rgba(var(--glow), .6)) drop-shadow(0 10px 6px rgba(0,0,0,.7)); animation: dragonBreath 3s ease-in-out infinite; }
.mon.boss.acting .body { animation: monLunge .7s ease-in-out infinite alternate; }
@keyframes dragonBreath { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.05) rotate(2deg); } }
.hoard { position: absolute; left: 0; right: 0; bottom: 3%; display: flex; justify-content: center; gap: 6px; font-size: 34px; z-index: -1; filter: drop-shadow(0 0 12px rgba(255,200,80,.7)); }
.hoard span:nth-child(odd) { transform: translateY(8px) rotate(-12deg); }

/* room props */
.prop { position: absolute; left: 50%; bottom: 20%; transform: translateX(-50%); z-index: 1; text-align: center; }
.prop .big { font-size: clamp(80px, 12vw, 120px); line-height: 1; filter: drop-shadow(0 10px 8px rgba(0,0,0,.6)); display: block; }
.prop-treasure .big { filter: drop-shadow(0 0 30px rgba(255,210,80,.9)); animation: glint 1.6s ease-in-out infinite alternate; }
@keyframes glint { from { filter: drop-shadow(0 0 16px rgba(255,210,80,.6)); } to { filter: drop-shadow(0 0 40px rgba(255,230,120,1)); } }
.sparkles { position: absolute; inset: 0; pointer-events: none; }
.sparkles i { position: absolute; font-style: normal; font-size: 18px; animation: sparkle 1.8s ease-in-out infinite; opacity: 0; }
@keyframes sparkle { 0% { opacity: 0; transform: translateY(10px) scale(.4); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(-40px) scale(1); } }
.prop-shrine .big { filter: drop-shadow(0 0 34px rgba(120,200,255,.95)); }
.prop-shrine::before { content: ''; position: absolute; left: 50%; bottom: 10%; width: 240px; height: 300px; transform: translateX(-50%); background: radial-gradient(ellipse at 50% 70%, rgba(150,220,255,.45), transparent 65%); z-index: -1; animation: flicker 2s ease-in-out infinite alternate; }
.spikes { position: absolute; left: 8%; right: 8%; bottom: 14%; height: 36px; z-index: 1;
  background: linear-gradient(135deg, transparent 50%, #b8b2a8 50% 56%, #77716a 56%) 0 0 / 28px 36px, linear-gradient(225deg, transparent 50%, #9d978e 50% 56%, #5f5a54 56%) 0 0 / 28px 36px;
  filter: drop-shadow(0 4px 3px rgba(0,0,0,.7)); }
.blades { position: absolute; top: 30%; font-size: 40px; animation: bladeSpin 1.2s linear infinite; filter: drop-shadow(0 0 6px rgba(255,255,255,.4)); }
.blades.l { left: 30%; } .blades.r { right: 30%; animation-direction: reverse; }
@keyframes bladeSpin { to { transform: rotate(360deg); } }
.stall { position: absolute; left: 50%; bottom: 14%; transform: translateX(-50%); width: min(360px, 80%); z-index: 1; }
.stall .awning { height: 34px; border-radius: 6px 6px 0 0; background: repeating-linear-gradient(90deg, #a3261a 0 30px, #f1e4c6 30px 60px); box-shadow: 0 6px 10px rgba(0,0,0,.5); clip-path: polygon(0 0, 100% 0, 100% 70%, 95% 100%, 90% 70%, 85% 100%, 80% 70%, 75% 100%, 70% 70%, 65% 100%, 60% 70%, 55% 100%, 50% 70%, 45% 100%, 40% 70%, 35% 100%, 30% 70%, 25% 100%, 20% 70%, 15% 100%, 10% 70%, 5% 100%, 0 70%); }
.stall .keeper { font-size: 74px; text-align: center; line-height: 1; margin: 2px 0 -10px; position: relative; z-index: -1; filter: drop-shadow(0 6px 6px rgba(0,0,0,.6)); }
.stall .counter { height: 54px; border-radius: 4px; background: repeating-linear-gradient(90deg, #6a4020 0 40px, #4a2a12 40px 43px); box-shadow: inset 0 6px 0 #8a5a2a, 0 10px 14px rgba(0,0,0,.6); display: flex; justify-content: space-around; align-items: flex-start; font-size: 28px; padding-top: 0; }
.stall .counter span { margin-top: -20px; filter: drop-shadow(0 3px 3px rgba(0,0,0,.6)); }
.stairs { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: 260px; height: 62%; z-index: 1; perspective: 300px; }
.stairs i { position: absolute; left: 50%; transform: translateX(-50%); height: 16%; border-radius: 3px; background: linear-gradient(#8a7f72, #4a433b); box-shadow: 0 6px 8px rgba(0,0,0,.6); }
.stairs i:nth-child(1) { bottom: 0; width: 100%; }
.stairs i:nth-child(2) { bottom: 15%; width: 86%; filter: brightness(.85); }
.stairs i:nth-child(3) { bottom: 30%; width: 72%; filter: brightness(.7); }
.stairs i:nth-child(4) { bottom: 45%; width: 58%; filter: brightness(.55); }
.stairs i:nth-child(5) { bottom: 60%; width: 44%; filter: brightness(.4); }
.stairs i:nth-child(6) { bottom: 75%; width: 30%; filter: brightness(.25); }
.stairs::after { content: ''; position: absolute; left: 50%; bottom: 85%; width: 34%; height: 30%; transform: translateX(-50%); border-radius: 50% 50% 0 0; background: radial-gradient(ellipse at 50% 100%, rgba(var(--glow), .6), #000 70%); }

/* the parchment card for rooms, results and the merchant */
.sc-scroll { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); width: min(560px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow: auto; box-sizing: border-box; z-index: 5;
  padding: 10px 16px 12px; border-radius: 10px; text-align: center; color: var(--ink);
  background: linear-gradient(#f6e8c6, #e0c48e); box-shadow: 0 10px 30px rgba(0,0,0,.7), inset 0 0 0 2px #8a6a3a, inset 0 0 30px rgba(120,80,30,.25); animation: scrollIn .45s ease-out; }
@keyframes scrollIn { from { transform: translate(-50%, 30px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.sc-scroll h2 { margin: 0 0 4px; color: #7a2a14; font-size: 20px; }
.sc-scroll p { margin: 4px 0; font-size: 14px; }
.sc-scroll .orders-row { justify-content: center; }
.sc-scroll .shop-wares { margin: 6px 0; }
.sc-scroll.top { top: 46px; bottom: auto; }

/* ---- the dice tray under the scene ---- */
.delve-dice:empty { display: none; }
.delve-dice .duel-center { margin: 0 auto; max-width: 820px; }

/* ---- hero portraits ---- */
.party-bar { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.hero-card { position: relative; display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 8px; align-items: center; flex: 0 1 230px; min-width: 190px; padding: 7px 10px 7px 7px; border-radius: 12px;
  background: linear-gradient(#2c241e, #1a1410); color: #f1e4c6; box-shadow: 0 6px 14px rgba(0,0,0,.6), inset 0 0 0 2px #5d4a34; transition: transform .25s, box-shadow .25s; }
.hero-card.turn { transform: translateY(-6px); box-shadow: 0 10px 22px rgba(0,0,0,.7), inset 0 0 0 2px #ffd76a, 0 0 20px rgba(255,215,106,.5); }
.hero-card.down { filter: grayscale(.9) brightness(.7); }
.hero-card.hit { animation: rpgHit .5s; }
.medal { position: relative; width: 62px; height: 62px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 32px;
  background: radial-gradient(circle at 35% 30%, var(--cA), var(--cB) 70%); box-shadow: 0 0 0 3px var(--pc), 0 0 0 5px #1a1410, 0 0 0 6px #b8892f, 0 4px 8px rgba(0,0,0,.6); }
.medal.warrior { --cA: #9fb6d0; --cB: #34506e; }
.medal.rogue { --cA: #8fc49a; --cB: #1f4a2c; }
.medal.wizard { --cA: #c7a0f0; --cB: #3e1f6b; }
.medal.cleric { --cA: #ffe9a0; --cB: #9a6a10; }
.medal .lvl { position: absolute; right: -6px; bottom: -4px; min-width: 22px; height: 22px; padding: 0 3px; box-sizing: border-box; border-radius: 11px; font-size: 12px; font-weight: bold; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(#ffe38a, #c98d26); color: #3a1d0e; box-shadow: 0 0 0 2px #1a1410; }
.medal .rip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 34px; background: rgba(0,0,0,.45); border-radius: 50%; }
.hc-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.hc-name { font-weight: bold; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-name small { font-weight: normal; color: #c9b893; font-size: 11px; }
.hc-bar { position: relative; height: 13px; border-radius: 7px; background: #3a1410; box-shadow: inset 0 1px 3px rgba(0,0,0,.6), 0 0 0 1px #000; overflow: hidden; }
.hc-bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(#6fe07a, #2f8a3a); transition: width .5s; }
.hc-bar span { position: relative; display: block; text-align: center; font-size: 10.5px; line-height: 13px; font-weight: bold; color: #fff; text-shadow: 0 1px 2px #000; }
.hc-xp { height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.hc-xp i { display: block; height: 100%; background: linear-gradient(90deg, #c48a1c, #ffe17a); transition: width .6s; }
.hc-stats { display: flex; gap: 8px; align-items: center; font-size: 11.5px; flex-wrap: wrap; color: #d8c8a6; }
.party-purse { flex: 1 0 100%; text-align: center; color: #d8c8a6; font-size: 12.5px; margin: 0; }

/* ---- effects: floating numbers, spells, level-ups ---- */
.fx-layer { position: absolute; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.fnum { position: absolute; transform: translate(-50%, -50%); font-weight: bold; font-size: 26px; font-family: var(--serif); color: #fff; white-space: nowrap;
  text-shadow: 0 2px 0 #000, 0 0 6px #000; animation: fnumUp 1.25s ease-out forwards; }
.fnum.dmg { color: #ff6a50; }
.fnum.crit { color: #ffd24a; font-size: 36px; }
.fnum.heal { color: #7cff8a; }
.fnum.miss { color: #cfc6b6; font-size: 20px; font-style: italic; }
@keyframes fnumUp { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.5); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.25); } 30% { transform: translate(-50%, -70%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -190%); } }
.fx-slash { position: absolute; width: 110px; height: 110px; transform: translate(-50%, -50%); }
.fx-slash::before, .fx-slash::after { content: ''; position: absolute; left: 50%; top: 50%; width: 130%; height: 5px; border-radius: 3px; background: linear-gradient(90deg, transparent, #fff 40%, #fff 60%, transparent); box-shadow: 0 0 12px #fff;
  transform: translate(-50%, -50%) rotate(-35deg) scaleX(0); animation: slash .35s ease-out forwards; }
.fx-slash.claw::before, .fx-slash.claw::after { background: linear-gradient(90deg, transparent, #ff3a2a 40%, #ff3a2a 60%, transparent); box-shadow: 0 0 12px #ff3a2a; }
.fx-slash::after { transform: translate(-50%, -50%) rotate(35deg) scaleX(0); animation-delay: .12s; }
@keyframes slash { 0% { transform: translate(-50%, -50%) rotate(var(--r, -35deg)) scaleX(0); opacity: 1; } 60% { opacity: 1; } 100% { transform: translate(-50%, -50%) rotate(var(--r, -35deg)) scaleX(1); opacity: 0; } }
.fx-slash::after { --r: 35deg; }
.fx-orb { position: absolute; width: 18px; height: 18px; border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(#fff, #c890ff 45%, rgba(140,60,255,0) 70%); box-shadow: 0 0 16px #b36bff; animation: orbFly .5s ease-in forwards; }
@keyframes orbFly { from { transform: translate(-50%, -50%); opacity: 1; } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))); opacity: .9; } }
.fx-boom { position: absolute; left: 50%; bottom: 8%; width: 80%; height: 70%; transform: translateX(-50%); border-radius: 50%;
  background: radial-gradient(circle, #fff6c8 0 10%, #ffb020 30%, #ff4a10 55%, rgba(255,40,0,0) 72%); mix-blend-mode: screen; animation: boom .9s ease-out forwards; }
@keyframes boom { 0% { transform: translateX(-50%) scale(.1); opacity: 1; } 40% { opacity: 1; } 100% { transform: translateX(-50%) scale(1.3); opacity: 0; } }
.scene.shake { animation: shake .45s; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translate(-6px, 3px); } 40% { transform: translate(6px, -3px); } 60% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -1px); } }
.fx-breath { position: absolute; left: 0; right: 0; top: 30%; bottom: 0; mix-blend-mode: screen; animation: breath 1.2s ease-out forwards;
  background: radial-gradient(ellipse 60% 90% at 50% 0%, var(--b1) 0 15%, var(--b2) 45%, transparent 75%); }
.fx-breath.fire { --b1: #fff6c8; --b2: rgba(255,90,20,.85); }
.fx-breath.poison { --b1: #eaffc8; --b2: rgba(90,220,60,.8); }
.fx-breath.frost { --b1: #ffffff; --b2: rgba(140,210,255,.85); }
.fx-breath.lightning { --b1: #ffffff; --b2: rgba(170,190,255,.9); animation: breath 1.2s ease-out forwards, zap .1s steps(2) 6; }
.fx-breath.shadow { --b1: #d8b0ff; --b2: rgba(90,20,140,.9); mix-blend-mode: normal; }
@keyframes breath { 0% { opacity: 0; transform: scaleY(.2); transform-origin: top; } 25% { opacity: 1; } 100% { opacity: 0; transform: scaleY(1.1); transform-origin: top; } }
@keyframes zap { 50% { filter: brightness(2.5); } }
.fx-sparkle { position: absolute; transform: translate(-50%, -50%); font-size: 20px; animation: healRise 1.1s ease-out forwards; }
@keyframes healRise { 0% { opacity: 0; transform: translate(-50%, 0) scale(.4); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -70px) scale(1.1); } }
.fx-shield { position: absolute; transform: translate(-50%, -50%); font-size: 56px; animation: shieldPop .8s ease-out forwards; filter: drop-shadow(0 0 14px #6ab0ff); }
@keyframes shieldPop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3); } 40% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -80%) scale(1); } }
.fx-levelup { position: absolute; transform: translate(-50%, -50%); font-weight: bold; font-size: 22px; color: #ffe17a; white-space: nowrap; font-family: var(--serif);
  text-shadow: 0 2px 0 #6b3a00, 0 0 14px #ffb020; animation: lvlUp 2.2s ease-out forwards; }
.fx-levelup::before { content: ''; position: absolute; left: 50%; top: 50%; width: 160px; height: 160px; transform: translate(-50%, -50%); border-radius: 50%; z-index: -1;
  background: conic-gradient(from 0deg, rgba(255,215,106,.0), rgba(255,215,106,.6), rgba(255,215,106,0) 20%, rgba(255,215,106,.6) 40%, rgba(255,215,106,0) 60%, rgba(255,215,106,.6) 80%, rgba(255,215,106,0)); animation: bladeSpin 2s linear infinite; mask-image: radial-gradient(circle, #000 30%, transparent 70%); -webkit-mask-image: radial-gradient(circle, #000 30%, transparent 70%); }
@keyframes lvlUp { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.4); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.3); } 30% { transform: translate(-50%, -60%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -110%); } }
@media (prefers-reduced-motion: reduce) {
  .mon .body, .flame, .blades, .scene.enter, .scene.shake { animation: none !important; }
}

/* ---- setup: tabs, campaign camp ---- */
.delve-tabs { display: flex; gap: 6px; justify-content: center; margin: 4px 0 12px; }
.delve-tabs .tab { font-family: var(--serif); font-size: 16px; padding: 8px 20px; border-radius: 10px 10px 0 0; border: 2px solid #b99159; border-bottom-width: 4px; background: rgba(255,255,255,.35); cursor: pointer; color: var(--ink); }
.delve-tabs .tab.on { background: linear-gradient(#fff3c2, #f2c25c); border-color: #7a4a12; font-weight: bold; }
.continue-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin: 4px 0 10px; border-radius: 10px;
  background: linear-gradient(#3a2b1f, #241a12); color: #f1e4c6; box-shadow: inset 0 0 0 2px #d9a441, 0 4px 12px rgba(0,0,0,.4); }
.continue-banner small { color: #d8c8a6; display: block; }
.camp-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; }
.camp-head h2 { border: 0; margin: 4px 0; }
.camp-heroes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.camp-hero { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.45); box-shadow: inset 0 0 0 1px #c4a674; }
.camp-hero .medal { width: 52px; height: 52px; font-size: 27px; }
.camp-hero b { font-size: 15px; }
.camp-hero small { font-size: 11.5px; color: var(--ink-soft); display: block; line-height: 1.35; }
.camp-hero select { font-size: 12px; margin-top: 3px; }
.camp-hero .hc-xp { background: rgba(0,0,0,.15); height: 6px; margin: 3px 0; }
.treasury { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; font-size: 15px; padding: 8px; border-radius: 10px; background: rgba(120,80,30,.12); margin: 6px 0; }
.smithy { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 6px 0 10px; }
.dungeon-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.dun { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; color: #f1e4c6;
  background: linear-gradient(90deg, hsl(var(--h) 30% 22%), hsl(var(--h) 25% 14%)); box-shadow: inset 0 0 0 2px hsl(var(--h) 40% 45%), 0 3px 8px rgba(0,0,0,.3); }
.dun .dn { font-size: 26px; text-align: center; filter: hue-rotate(var(--hue, 0deg)) saturate(var(--sat, 1)); }
.dun b { font-size: 15px; }
.dun small { display: block; font-size: 11.5px; color: #d8c8a6; }
.dun.locked { filter: grayscale(1) brightness(.75); }
.dun.next { box-shadow: inset 0 0 0 2px #ffd76a, 0 0 16px rgba(255,215,106,.4); }
.camp-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

/* ---- small screens ---- */
@media (max-width: 860px) {
  .dungeon-wrap { padding: 8px 6px 10px; }
  .scene { height: 300px; }
  .sc-doors { bottom: 26%; gap: 26px; }
  .sdoor .frame { width: 104px; height: 140px; }
  .sdoor.single .frame { width: 128px; height: 160px; }
  .sdoor .plaque { font-size: 13px; padding: 3px 9px; }
  .sdoor small { font-size: 11px; max-width: 140px; }
  .sc-torch { top: 18%; }
  .sc-torch.l { left: 5%; } .sc-torch.r { right: 5%; }
  .mon .plate b { font-size: 11px; }
  .mon .stats { display: none; }
  .hero-card { flex: 1 1 46%; min-width: 0; grid-template-columns: 46px minmax(0, 1fr); gap: 6px; padding: 6px; }
  .medal { width: 44px; height: 44px; font-size: 23px; }
  .medal .lvl { min-width: 18px; height: 18px; font-size: 10px; }
  .hc-name { font-size: 12.5px; }
  .hc-name small { display: none; }
  .sc-scroll { padding: 8px 10px; }
  .sc-scroll p { font-size: 13px; }
  .stall .keeper { font-size: 56px; }
  .camp-heroes, .smithy { grid-template-columns: 1fr; }
  .map-svg { height: 40px; }
}
@media (max-width: 420px) {
  .sdoor .frame { width: 88px; height: 120px; }
  .sdoor .leaf .sign { font-size: 22px; }
  .mon .body { font-size: 40px; }
  .mon.boss .body { font-size: 100px; }
}
/* Big screens: keep the room a sensible shape, centered, with bigger monsters. */
.dungeon-wrap > .scene, .dungeon-wrap > .delve-map, .dungeon-wrap > .delve-dice, .dungeon-wrap > .party-bar { width: 100%; max-width: 1080px; margin-left: auto; margin-right: auto; box-sizing: border-box; }
.scene { height: clamp(320px, 56vh, 540px); }
.mon .body { font-size: clamp(52px, 9vh, 96px); }
.mon.elite .body { font-size: clamp(66px, 11vh, 120px); }
.mon.boss .body { font-size: clamp(120px, 22vh, 210px); }
.sdoor .frame { width: clamp(120px, 13vh, 170px); height: clamp(160px, 18vh, 230px); }
.sc-wall { inset: 0 0 38% 0; background-color: var(--wallB); }
.sc-floor { height: 46%; filter: brightness(1.25); }
@media (max-width: 860px) {
  .scene { height: 310px; }
  .mon .body { font-size: 46px; }
  .mon.elite .body { font-size: 58px; }
  .mon.boss .body { font-size: 110px; }
  .sdoor .frame { width: 104px; height: 140px; }
}
@media (max-width: 420px) { .mon .body { font-size: 38px; } .sdoor .frame { width: 88px; height: 120px; } }
.mon.boss .body { filter: hue-rotate(var(--hue, 0deg)) saturate(var(--sat, 1)) brightness(var(--bright, 1)) drop-shadow(0 0 26px rgba(var(--glow), .6)) drop-shadow(0 10px 6px rgba(0,0,0,.7)); }
.dun .dn { filter: hue-rotate(var(--hue, 0deg)) saturate(var(--sat, 1)) brightness(var(--bright, 1)); }
.dun .dn:not(.dragon) { filter: none; }
/* The action bar right under the room */
.dungeon-wrap > .delve-actbar { width: 100%; max-width: 1080px; margin: 0 auto; box-sizing: border-box; padding: 8px 12px; }
.delve-actbar h3 { margin: 0 0 4px; }
.delve-actbar p { margin: 2px 0; }
.delve-actbar .duel-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.delve-log { max-height: none; height: calc(100vh - 140px); }
.sc-foes { bottom: 9%; }
@media (max-width: 860px) {
  .delve-actbar .duel-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .delve-actbar .act-btn small { font-size: 11px; }
  .delve-log { height: auto; max-height: 260px; }
  .mon .body { font-size: 54px; }
  .mon .plate { max-width: 110px; }
}
@media (max-width: 420px) { .mon .body { font-size: 48px; } .mon.boss .body { font-size: 108px; } }

/* ---- Dungeon Delve skills ---- */
.act-btn.skill { background: linear-gradient(#efe3ff, #cdb4f0); border-color: #5b2c8a; }
.act-btn.skill[disabled] { background: linear-gradient(#e8e2ee, #cfc8d6); }
.hero-card.hidden { opacity: .55; filter: saturate(.4); }
.hc-skills { display: inline-flex; gap: 1px; font-style: normal; }
.hc-skills i { font-style: normal; font-size: 12px; }
.skill-chips { display: flex; gap: 4px; margin-top: 3px; flex-wrap: wrap; }
.skill-chips i { position: relative; font-style: normal; font-size: 16px; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; background: rgba(0,0,0,.08); box-shadow: inset 0 0 0 1px #c4a674; filter: grayscale(1); opacity: .5; cursor: help; }
.skill-chips i.on { filter: none; opacity: 1; background: linear-gradient(#fff3c2, #f2c25c); box-shadow: inset 0 0 0 1px #7a4a12; }
.skill-chips i b { position: absolute; right: -3px; bottom: -4px; font-size: 9px; background: #3a2b1f; color: #fff; border-radius: 6px; padding: 0 3px; }
.skill-chips i b:empty { display: none; }
.fnum.poison { color: #9cff6a; }
.fx-boom.frost { background: radial-gradient(circle, #ffffff 0 10%, #bfe6ff 30%, #5ab0ff 55%, rgba(90,176,255,0) 72%); }
.fx-boom.holy { background: radial-gradient(circle, #fffbe0 0 12%, #ffe58a 35%, #ffc94a 55%, rgba(255,200,80,0) 72%); }
.fx-fall { position: absolute; transform: translate(-50%, -50%); font-size: 30px; animation: fxFall .9s ease-in forwards; }
@keyframes fxFall { from { transform: translate(-50%, -160%) rotate(-30deg); opacity: 0; } 30% { opacity: 1; } to { transform: translate(-50%, 60%) rotate(10deg); opacity: 0; } }
.fx-bolt { position: absolute; top: 0 !important; width: 26px; transform: translateX(-50%); background: linear-gradient(90deg, transparent, #b8d4ff 30%, #fff 50%, #b8d4ff 70%, transparent);
  clip-path: polygon(40% 0, 70% 0, 52% 38%, 78% 38%, 30% 100%, 44% 52%, 20% 52%); filter: drop-shadow(0 0 10px #8ab4ff); animation: bolt .7s steps(2) forwards; }
@keyframes bolt { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }

/* ---- Dungeon Delve: new classes, Armory, party editing, Hall of Heroes ---- */
.medal.ranger { --cA: #b8e08a; --cB: #3d5a1a; }
.medal.paladin { --cA: #fff3c4; --cB: #a8822a; }
.camp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.gear-line { color: #5a3a12 !important; }
.hero-btns { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.edit-party { background: rgba(255,255,255,.4); border-radius: 10px; padding: 10px; box-shadow: inset 0 0 0 1px #c4a674; margin: 6px 0; }
.edit-party h2 { margin-top: 0; }
.edit-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.edit-row .medal { width: 44px; height: 44px; font-size: 22px; }
.edit-row input { font-size: 15px; padding: 5px 8px; min-width: 0; }
.edit-row.recruit { grid-template-columns: 22px minmax(0, 1fr) auto auto auto; padding-top: 6px; border-top: 1px dashed #c4a674; }
.armory-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0 8px; }
.armory-tabs .tab { font-family: var(--serif); padding: 5px 12px; border-radius: 8px; border: 1px solid #b99159; background: rgba(255,255,255,.4); cursor: pointer; color: var(--ink); }
.armory-tabs .tab.on { background: linear-gradient(#fff3c2, #f2c25c); border-color: #7a4a12; font-weight: bold; }
.arm-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; align-items: center; margin-bottom: 6px; }
.arm-cur { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 8px; background: rgba(120,80,30,.1); }
.arm-cur small { color: var(--ink-soft); font-size: 11.5px; }
.arm-h { margin: 10px 0 4px; font-size: 15px; color: #7a2a14; }
.arm-h small { font-weight: normal; color: var(--ink-soft); font-size: 11.5px; }
.charms { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.charm { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 6px 8px; font-size: 13px; }
.charm small { font-weight: normal; font-size: 11px; line-height: 1.3; }
.charm.owned { background: linear-gradient(#e8f6e0, #c4e0b0); }
.charm.worn { background: linear-gradient(#fff3c2, #f2c25c); border-color: #7a4a12; opacity: 1; }
.unlocks { list-style: none; padding: 0; margin: 6px 0; max-height: 55vh; overflow-y: auto; }
.unlocks li { padding: 5px 6px; border-bottom: 1px dotted #c4a674; opacity: .55; font-size: 13.5px; }
.unlocks li.got { opacity: 1; background: rgba(95,208,106,.12); }
.unlocks li small { color: var(--ink-soft); }
.ul-lv { display: inline-block; min-width: 46px; font-weight: bold; color: #7a2a14; }
.hall-wrap { max-height: 55vh; overflow: auto; margin: 6px 0; }
.hall { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.hall th { position: sticky; top: 0; background: #e9d6aa; text-align: left; padding: 5px 6px; font-size: 12px; }
.hall td { padding: 5px 6px; border-bottom: 1px solid #d9c49a; white-space: nowrap; }
.hall tr.you td { background: rgba(255,215,106,.45); font-weight: bold; }
.hall .rk { text-align: center; width: 34px; }
.hall .pty span { margin-right: 3px; font-size: 12px; }
@media (max-width: 860px) {
  .arm-row { grid-template-columns: 1fr; }
  .edit-row.recruit { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .edit-row.recruit select, .edit-row.recruit button { grid-column: span 1; }
  .hall .pty { display: none; }
}
/* The Leaderboard button sits on the right, apart from the party buttons. */
.camp-actions .lb-btn, .camp-head .lb-btn { margin-left: auto; background: linear-gradient(#fff3c2, #f2c25c); border-color: #7a4a12; font-weight: bold; }
.lb-note { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: rgba(255,215,106,.25); box-shadow: inset 0 0 0 1px #c49a3a; text-align: center; }
.lb-note p { margin: 0 0 6px; }
