/* One Deck Dungeon — page furniture from the Lost Cities styles (dungeon stone), cards, boxes and dice at the end. */
:root {
  --felt-glow: #4a4870; /* the glow at the top of the home page */
  --sheet: #1d1b2c; /* pop-up window background */
  --felt: #2a2b40;
  --felt-dark: #121220;
  --gold: #f5b700;
  --gold-deep: #c98a00;
  --ink: #1d1d1f;
  --paper: #fffdf6;
  --panel: rgba(16, 14, 28, 0.86);
  --text: #f4f1e8;
  --muted: #b9c8bf;
  --cw: 70px;
  --ch: 100px;
  --pw: 64px;
  --ph: 92px;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

input { -webkit-user-select: text; user-select: text; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- shared bits ---------- */
#home, #lobby {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(ellipse at 50% 20%, var(--felt-glow) 0%, var(--felt) 40%, var(--felt-dark) 100%);
}
.home-wrap { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; }
.brand { text-align: center; margin: 8px 0 20px; }
.brand h1 { font-family: Georgia, "Times New Roman", serif; font-size: 44px; margin: 8px 0 0; letter-spacing: 1px; text-shadow: 0 3px 0 rgba(0,0,0,.3); }

.panel { background: var(--panel); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 16px; margin: 14px 0; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.panel h2 { margin: 0 0 8px; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.field { display: block; margin: 8px 0 4px; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.field input { width: 100%; font-size: 20px; padding: 12px 14px; border-radius: 12px; border: 2px solid rgba(255,255,255,.15); background: rgba(0,0,0,.3); color: var(--text); outline: none; }
.row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-size: 17px; font-weight: 700; background: rgba(255,255,255,.12); }
.btn.gold:disabled { filter: grayscale(.8); opacity: .6; }
.btn.ghost { background: transparent; border: 2px solid rgba(255,255,255,.25); }
.btn.danger { background: #a3242f; }
.btn.small { padding: 8px 12px; font-size: 15px; }
.linkish { display: block; margin: 16px auto 0; background: none; border: 0; color: var(--gold); text-decoration: underline; font-size: 15px; }

.count-picker { display: flex; gap: 8px; margin: 8px 0 14px; }
.count-picker button { flex: 1; font-size: 22px; font-weight: 700; padding: 10px 0; border-radius: 12px; border: 2px solid rgba(255,255,255,.2); background: rgba(0,0,0,.25); }
.count-picker button.on { border-color: var(--gold); background: rgba(245,183,0,.2); color: var(--gold); }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #4be08c; box-shadow: 0 0 8px #4be08c; animation: pulse 1.6s infinite; }
.game-list { display: flex; flex-direction: column; gap: 8px; }
.game-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.06); }
.game-item .code { font-family: ui-monospace, Menlo, Consolas, monospace; background: rgba(0,0,0,.35); padding: 2px 6px; border-radius: 6px; font-size: 13px; margin-left: 6px; }

.code-row { display: flex; align-items: baseline; justify-content: space-between; }
.code-row strong { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 30px; color: var(--gold); letter-spacing: 4px; }
.seat-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.seat-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.06); }
.seat-list li.empty { opacity: .5; border: 2px dashed rgba(255,255,255,.2); background: transparent; }
.seat-list .tag { font-size: 12px; color: var(--muted); }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 18px; border: 2px solid rgba(255,255,255,.9); box-shadow: 0 2px 6px rgba(0,0,0,.4); flex: none; text-shadow: 0 1px 2px rgba(0,0,0,.4); }

/* ---------- table ---------- */
#table { overflow: hidden; touch-action: none; }
.felt {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255,255,255,.10), transparent 60%),
    repeating-radial-gradient(circle at 30% 30%, rgba(0,0,0,.025) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at 50% 40%, #8a5530 0%, var(--felt) 45%, var(--felt-dark) 100%);
}
.topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 6px calc(10px + var(--safe-r)) 0 calc(10px + var(--safe-l)); z-index: 5; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.round-info { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.top-buttons { display: flex; gap: 6px; }
.icon-btn { height: 34px; min-width: 34px; padding: 0 8px; border-radius: 10px; border: 0; background: rgba(0,0,0,.35); font-size: 16px; display: flex; align-items: center; gap: 4px; }
.icon-btn span { font-size: 13px; font-weight: 700; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 12px; animation: fade .2s ease-out; }
.sheet.narrow { width: 420px; }
.sheet.wide { width: 900px; }
.sheet h2 { margin: 0 0 10px; font-family: Georgia, serif; }
.sheet .btn { margin-top: 8px; }
.sheet .btn.ghost, .sheet .btn.danger { width: 100%; }
.toggle { display: flex; gap: 10px; align-items: center; font-size: 15px; margin: 8px 0; }
.toggle input { width: 22px; height: 22px; }
.rules h3 { color: var(--text); margin: 0 0 4px; font-size: 15px; }
.rules p { margin: 4px 0; }
.claim-list { display: flex; flex-direction: column; gap: 8px; }
.claim-list button { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 0; background: rgba(255,255,255,.08); font-size: 17px; font-weight: 700; text-align: left; }

.score-table-wrap { overflow-x: auto; }
table.scores { border-collapse: collapse; width: 100%; font-size: 14px; }
table.scores th, table.scores td { padding: 5px 8px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.08); white-space: nowrap; }
table.scores th { font-size: 13px; }
table.scores td.rd { color: var(--muted); text-align: left; }
table.scores tr.current td { background: rgba(245,183,0,.12); }
table.scores tr.total td { font-weight: 900; font-size: 16px; border-top: 2px solid rgba(255,255,255,.3); }
table.scores td.zero { color: #4be08c; font-weight: 800; }
table.scores td.leader { color: var(--gold); }
table.scores .th-name { display: inline-flex; align-items: center; gap: 4px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.result-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: rgba(255,255,255,.05); margin-bottom: 6px; }
.result-row.out { background: rgba(245,183,0,.15); border: 1px solid rgba(245,183,0,.5); }
.result-row .who { width: 110px; flex: none; display: flex; align-items: center; gap: 6px; font-weight: 700; }
.result-row .who .avatar { width: 28px; height: 28px; font-size: 13px; }
.result-row .cards { flex: 1; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.result-row .left { display: flex; gap: 3px; padding: 3px; border-radius: 6px; background: rgba(214,40,58,.25); outline: 1px dashed rgba(255,120,120,.6); }
.result-row .pts { width: 70px; text-align: right; font-weight: 900; font-size: 18px; }
.result-row .pts small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.winner-banner { text-align: center; font-size: 22px; margin: 4px 0 12px; }
.winner-banner .big { font-size: 48px; display: block; animation: float 1.4s ease-in-out infinite; }

.rotate { display: none; }
@media (orientation: portrait) {
  body.in-game .rotate { display: flex; position: fixed; inset: 0; z-index: 100; flex-direction: column; align-items: center; justify-content: center; background: var(--felt-dark); font-size: 20px; text-align: center; padding: 24px; }
  .rotate-phone { font-size: 80px; animation: turn 2s ease-in-out infinite; }
}

.toast { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 90; background: #222; color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 700; box-shadow: 0 8px 20px rgba(0,0,0,.5); animation: rise .2s ease-out; max-width: 90vw; }

.your-turn-flash { position: absolute; inset: 0; z-index: 25; pointer-events: none; box-shadow: inset 0 0 60px 10px rgba(245,183,0,.7); animation: fadeOut 1.2s ease-out forwards; }

@keyframes glow { 0%,100% { box-shadow: 0 0 0 3px var(--gold), 0 0 10px 3px rgba(245,183,0,.6); } 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 22px 8px rgba(245,183,0,.95); } }
@keyframes bob { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -4px); } }

.back-link { display: inline-block; text-decoration: none; font-weight: 700; font-size: 15px; padding: 4px 0; }
.back-link:active { color: var(--gold); }
.linkbtn { display: block; text-align: center; text-decoration: none; box-sizing: border-box; margin-top: 8px; }

/* Shell pieces copied from ud.css: the history list, its delete button (🗑), the lobby's bot rows, confetti */
.celebrate { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 70; pointer-events: none; }
/* game history */
#historyBtn { margin-top: 4px; }
.win-tally { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.win-chip b { color: var(--gold); margin-left: 4px; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { background: rgba(255,255,255,.06); border-radius: 12px; overflow: hidden; }
.history-item.open { background: rgba(255,255,255,.1); }
.history-item.incomplete .hi-title { color: var(--muted); }
.hi-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.hi-main { flex: 1; min-width: 0; }
.hi-date { font-size: 12px; color: var(--muted); }
.hi-title { font-size: 16px; margin: 2px 0; }
.hi-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hi-del { border: 0; background: rgba(0,0,0,.25); border-radius: 10px; width: 36px; height: 36px; font-size: 16px; flex: none; }
.hi-detail { padding: 0 12px 12px; overflow-x: auto; }
.seat-list li.can-bot { flex-wrap: wrap; }
.bot-tag { font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 4px; }


/* ================= One Deck Dungeon ================= */
.felt {
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,200,120,.10), transparent 60%),
    repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 2px, transparent 2px 38px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.14) 0 2px, transparent 2px 76px),
    radial-gradient(ellipse at 50% 40%, #3a3d55 0%, var(--felt) 50%, var(--felt-dark) 100%);
}
.odd-title { font-family: Georgia, "Times New Roman", serif; letter-spacing: 2px; text-transform: uppercase; }
.brand-art { font-size: 48px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.4)); }
.brand-art span { display: inline-block; transform: translateY(-10px) rotate(-12deg); font-size: 38px; }
.dungeon-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 4px 0 12px; }
.dungeon-picker .dungeon { display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: 12px; border: 2px solid rgba(255,255,255,.18); background: rgba(0,0,0,.25); text-align: left; }
.dungeon-picker .dungeon.on { border-color: var(--gold); background: rgba(245,183,0,.18); }
.dungeon-picker .da { font-size: 24px; }
.dungeon-picker b { flex: 1; font-size: 14px; }
.dungeon-picker .dots { color: var(--gold); font-size: 12px; letter-spacing: 1px; }
.pill { background: rgba(0,0,0,.4); padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; border: 0; color: inherit; }
.pill.potion { cursor: pointer; }
.round-info { gap: 6px; font-size: 15px; flex-wrap: wrap; }

/* colours */
.c-y { --cc: #f2c94c; } .c-p { --cc: #e46fc7; } .c-b { --cc: #4f8fe0; } .c-k { --cc: #26262e; } .c-any { --cc: #9a9aa6; }
.chip-c { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 6px; background: var(--cc); color: #1a1a1a; font-weight: 900; font-size: 12px; }
.chip-c.c-k { color: #fff; }
.c-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--cc); vertical-align: -1px; }

/* ---------- table: heroes | stage | side ---------- */
#table { --left: calc(150px + var(--safe-l)); --right: calc(min(230px, 28vw) + var(--safe-r)); --box: 36px; --die: 38px; }
.odd-heroes { position: absolute; left: 0; top: 40px; bottom: calc(4px + var(--safe-b)); width: var(--left); padding: 0 4px 0 calc(4px + var(--safe-l)); display: flex; flex-direction: column; justify-content: flex-end; gap: 5px; z-index: 3; overflow-y: auto; touch-action: pan-y; }
.hero { background: rgba(10,10,20,.62); border: 2px solid rgba(255,255,255,.12); border-radius: 12px; padding: 5px 6px; display: flex; flex-direction: column; gap: 3px; }
.hero.me { border-color: rgba(245,183,0,.55); }
.hero.hit { animation: heroHit .7s ease-out; }
@keyframes heroHit { 0%, 30% { background: rgba(200,30,40,.75); transform: translateX(-3px); } 15% { transform: translateX(3px); } 100% { background: rgba(10,10,20,.62); transform: none; } }
.hero .hh { display: flex; align-items: center; gap: 4px; min-width: 0; }
.hero .ha { font-size: 20px; }
.hero .hh b { font-size: 14px; }
.hero .hh small { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero .rdy { margin-left: auto; font-size: 10px; color: #8fe3a8; font-weight: 800; }
.hearts { font-size: 13px; letter-spacing: -1px; color: rgba(255,255,255,.2); }
.hearts i { font-style: normal; } .hearts i.full { color: #ff5a6a; }
.hdice { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.feat-i { margin-left: auto; border: 0; background: rgba(255,255,255,.1); border-radius: 6px; font-size: 12px; padding: 1px 4px; }
.items { display: flex; gap: 2px; flex-wrap: wrap; }
.items .item { font-size: 10px; padding: 0 3px; border-radius: 5px; background: var(--cc); color: #1a1a1a; font-weight: 800; }
.skills { display: flex; flex-direction: column; gap: 2px; }
.skill { display: flex; align-items: center; gap: 4px; border: 1px solid rgba(255,255,255,.15); background: rgba(255,255,255,.06); border-radius: 7px; padding: 2px 5px; font-size: 11.5px; font-weight: 700; text-align: left; }
.skill.can { border-color: var(--gold); background: rgba(245,183,0,.18); }
.skill.used { opacity: .4; text-decoration: line-through; }
.skill.passive { font-style: italic; color: var(--muted); }
.skill .cost { display: inline-grid; place-items: center; min-width: 16px; height: 16px; border-radius: 4px; background: var(--cc); color: #1a1a1a; font-size: 10px; font-weight: 900; padding: 0 2px; }
.skill .cost.free { background: #8a6fd8; color: #fff; }

.stage { position: absolute; left: var(--left); right: var(--right); top: 38px; bottom: calc(2px + var(--safe-b)); display: flex; align-items: center; justify-content: center; z-index: 2; overflow: hidden; }
.odd-side { position: absolute; right: 0; top: 40px; bottom: calc(4px + var(--safe-b)); width: var(--right); padding: 0 calc(5px + var(--safe-r)) 0 4px; display: flex; flex-direction: column; gap: 5px; z-index: 3; overflow-y: auto; touch-action: pan-y; }
.odd-prompt { font-size: 13px; line-height: 1.3; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.odd-prompt .tally { display: block; margin-top: 3px; font-weight: 900; color: #ffd6da; }
.odd-actions { display: flex; flex-wrap: wrap; gap: 4px; }
.odd-actions .btn { padding: 7px 10px; font-size: 14px; flex: 1 1 auto; }
.odd-actions .btn.small { padding: 5px 8px; font-size: 12px; flex: 0 1 auto; }

/* dice */
.pool { display: flex; flex-direction: column; gap: 4px; }
.mydice { display: flex; flex-wrap: wrap; gap: 4px; }
.die { position: relative; width: var(--die); height: var(--die); padding: 0; border: 0; background: none; border-radius: 8px; }
.die svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 2px rgba(0,0,0,.5)); }
.die.sel { transform: translateY(-3px); box-shadow: 0 0 0 3px var(--gold), 0 0 12px rgba(245,183,0,.9); }
.die.rolling { animation: tumble .18s linear infinite; }
@keyframes tumble { 50% { transform: rotate(16deg) translateY(-4px); } }
.die .dt { position: absolute; right: -3px; top: -4px; font-size: 10px; background: #222; color: #fff; border-radius: 5px; padding: 0 3px; }
.pdice { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; opacity: .8; }
.pdice small { color: var(--muted); margin-right: 3px; font-size: 11px; }
.pdice .pd { width: 20px; height: 20px; } .pdice .pd svg { width: 100%; height: 100%; }

/* ---------- cards and boxes ---------- */
.enc { display: flex; gap: 8px; align-items: center; justify-content: center; max-width: 100%; max-height: 100%; }
.card { position: relative; display: flex; flex-direction: column; gap: 4px; width: 132px; padding: 6px; border-radius: 10px; background: linear-gradient(#e9e2d0, #d6cdb5); color: #2a2418; box-shadow: 0 6px 16px rgba(0,0,0,.5); border: 2px solid #6b5a3a; text-align: left; }
.card.peril { background: linear-gradient(#dfe6d6, #c6d2b8); }
.card.boss { background: linear-gradient(#e7d6d6, #c9a9a9); border-color: #7a2a2a; }
.card.big { width: min(56vh, 100%); max-width: 330px; }
.card .ch { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.card.big .ch { font-size: 16px; }
.card .ch .kind { font-size: 13px; }
.card .bhp { margin-left: auto; font-size: 12px; color: rgba(0,0,0,.25); letter-spacing: -1px; }
.card .bhp i { font-style: normal; } .card .bhp i.full { color: #c0202f; }
.card .art { font-size: 34px; text-align: center; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); }
.card.big .art { font-size: calc(var(--box) * 1.15); }
.card .ability { font-size: 11px; line-height: 1.25; min-height: 1em; }
.card .boxes { display: flex; flex-wrap: wrap; gap: 4px; }
.card:not(.big) .boxes, .card:not(.big) .choices .box { --box: 22px; }
.card:not(.big) .ability { display: none; }
.choices { display: flex; flex-direction: column; gap: 4px; }
.choice { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 3px 5px; border-radius: 8px; background: rgba(255,255,255,.4); cursor: pointer; }
.choice.chosen { background: rgba(245,183,0,.45); }
.choice.dim { opacity: .35; }
.choice .cn { font-size: 12px; font-weight: 800; }
.choice .cc { font-size: 10px; }
.loot { display: flex; align-items: center; gap: 4px; font-size: 11px; border-top: 1px dashed rgba(0,0,0,.25); padding-top: 3px; }
.loot .li { background: var(--cc); border-radius: 5px; padding: 0 3px; font-weight: 800; }
.loot .ls { flex: 1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loot .lx { color: #b07a00; letter-spacing: -1px; }
.box { position: relative; width: var(--box); height: var(--box); padding: 0; border-radius: 7px; border: 2px solid rgba(0,0,0,.45); background: var(--cc); color: #1a1a1a; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; overflow: hidden; }
.box.wide { width: calc(var(--box) * 2.1); }
.box.c-any { background: repeating-linear-gradient(135deg, #b5b5bf 0 5px, #a2a2ad 5px 10px); }
.box.c-b, .box.c-k { color: #fff; }
.box.armor { box-shadow: inset 0 0 0 3px #2e8b57; }
.box .shield { position: absolute; left: 1px; top: 0; font-size: calc(var(--box) * .26); }
.box .bv { font-weight: 900; font-size: calc(var(--box) * .42); font-family: Georgia, serif; text-shadow: 0 0 2px rgba(255,255,255,.9), 0 0 4px rgba(255,255,255,.6); }
.box.c-b .bv, .box.c-k .bv { text-shadow: 0 0 2px rgba(0,0,0,.9), 0 0 4px rgba(0,0,0,.6); }
/* The consequence icons on a dark strip so they read on every box colour */
.box .bi { display: flex; gap: 1px; margin-top: 1px; padding: 1px 4px; border-radius: 6px; background: rgba(20,16,28,.82); font-size: calc(var(--box) * .24); line-height: 1.1; white-space: nowrap; }
.box .bi:empty { display: none; }
.box .bi i { font-style: normal; }
.box .bi .ih { color: #ff5a6a; font-weight: 900; }
.box .bi .it, .box .bi .is { filter: saturate(1.3) brightness(1.15); }
.box.can { cursor: pointer; }
.box.can:not(.covered) { box-shadow: 0 0 0 2px rgba(255,255,255,.75), 0 0 8px rgba(255,255,255,.4); }
.box.armor.can:not(.covered) { box-shadow: inset 0 0 0 3px #2e8b57, 0 0 0 2px #fff; }
.box.covered { filter: saturate(.45) brightness(.9); }
.box.covered::after { content: "✓"; position: absolute; right: 2px; bottom: 0; font-size: calc(var(--box) * .3); color: #0a6b2a; font-weight: 900; text-shadow: 0 0 2px #fff; }
.box.hit .bv { text-decoration: line-through; }
.box .bd { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 1px; background: rgba(255,255,255,.25); }
.box .mini { width: calc(var(--box) * .52); height: calc(var(--box) * .52); }
.box.wide .mini { width: calc(var(--box) * .44); height: calc(var(--box) * .44); }
.box .mini svg { width: 100%; height: 100%; }
.box .mini.mine { cursor: pointer; }

/* the dungeon card */
.dcard { background: rgba(20,18,30,.82); border: 2px solid #8a7a5a; border-radius: 10px; padding: 5px 6px; display: flex; flex-direction: column; gap: 3px; max-width: 220px; --box: 26px; }
.dcard .dh { font-weight: 800; font-size: 12px; color: var(--gold); }
.dcard .floor { border-top: 1px solid rgba(255,255,255,.12); padding-top: 3px; }
.dcard .fn { font-size: 11px; }
.dcard .fn small { display: block; color: var(--muted); font-size: 10px; line-height: 1.2; }
.dcard .fsides { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.dcard .fs { display: flex; align-items: center; gap: 2px; font-size: 10px; opacity: .55; }
.dcard .fs.on { opacity: 1; }
.enc .dcard { --box: calc(var(--big-box, 30px)); }

/* the dungeon view */
.dungeon-view { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.doors { display: flex; gap: 6px; align-items: center; }
.door { border: 0; padding: 0; background: none; border-radius: 10px; }
.door.closed { width: 92px; height: 130px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 46px 46px 8px 8px; background: linear-gradient(#7a4a26, #4e2c13); border: 3px solid #2a1709; box-shadow: inset 0 0 0 4px rgba(0,0,0,.25), 0 6px 14px rgba(0,0,0,.5); color: #f4e2c6; }
.door.closed .dart { font-size: 34px; }
.door.closed .dl { font-size: 12px; font-weight: 800; }
.door.empty { width: 92px; height: 130px; border: 2px dashed rgba(255,255,255,.18); border-radius: 46px 46px 8px 8px; }
.door.open .card { width: 104px; }
.deckpile { width: 70px; height: 100px; border-radius: 8px; background: #1e1c2c; border: 2px solid #8a7a5a; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 3px 3px 0 #141322, 6px 6px 0 #0d0c18; }
.deckpile .dk { font-size: 26px; }
.deckpile b { font-size: 20px; }
.deckpile small { font-size: 10px; color: var(--muted); }
.deckpile.stairs { background: #3a2a14; }

/* hero choice */
.hero-pick { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-height: 100%; overflow-y: auto; touch-action: pan-y; padding: 4px; }
.hp-card { position: relative; width: 150px; display: flex; flex-direction: column; gap: 3px; padding: 6px; border-radius: 12px; border: 2px solid rgba(255,255,255,.15); background: rgba(10,10,20,.7); text-align: left; }
.hp-card.on { border-color: var(--gold); background: rgba(245,183,0,.15); }
.hp-card.taken { opacity: .45; }
.hp-card .hp-art { font-size: 26px; }
.hp-card .hp-dice { display: flex; gap: 3px; align-items: center; }
.hp-card .hp-hp { color: #ff5a6a; font-weight: 900; margin-left: 4px; }
.hp-card .hp-feat, .hp-card .hp-skill { font-size: 10.5px; line-height: 1.25; color: var(--muted); }
.hp-card .hp-feat b, .hp-card .hp-skill b { color: var(--text); }
.hp-card .hp-by { position: absolute; right: 6px; top: 6px; font-size: 11px; background: var(--gold); color: #3a2800; border-radius: 999px; padding: 0 6px; font-weight: 800; }

/* windows */
.skill-text { font-size: 15px; }
#skillBody .step { margin: 8px 0 4px; font-weight: 800; font-size: 14px; }
#skillBody .pick { display: flex; flex-wrap: wrap; gap: 5px; --die: 40px; }
#skillBody .opts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.potion-row { padding: 8px; border-radius: 10px; background: rgba(255,255,255,.06); margin-bottom: 6px; }
.potion-row p { margin: 3px 0; font-size: 14px; color: var(--muted); }
.final-line { text-align: center; font-size: 16px; }
.round-intro { position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; max-width: 80vw; z-index: 40; text-align: center; pointer-events: none; padding: 14px 26px; border-radius: 18px; background: rgba(15,12,25,.82); box-shadow: 0 10px 40px rgba(0,0,0,.5); animation: zoomIn .4s cubic-bezier(.2,1.6,.4,1) both; }
.round-intro .ri-round { font-family: Georgia, serif; font-size: 7vh; font-weight: 900; color: #fff; text-shadow: 0 0 18px var(--gold); }
.round-intro .ri-dealer { margin-top: 6px; font-size: 3.4vh; font-weight: 700; }

@media (max-height: 380px) {
  .topbar { padding-top: 3px; }
  .icon-btn { height: 30px; min-width: 30px; }
  .round-info { font-size: 13px; }
  .pill { font-size: 12px; padding: 2px 7px; }
  .odd-heroes, .odd-side { top: 35px; }
  .stage { top: 33px; }
  .odd-prompt { font-size: 12px; }
  .odd-actions .btn { padding: 5px 8px; font-size: 13px; }
  .card .art { font-size: 26px; }
  .door.closed, .door.empty { width: 74px; height: 104px; }
  .door.open .card { width: 92px; }
  .dcard { max-width: 190px; }
}
@media (max-width: 760px) { #table { --left: calc(132px + var(--safe-l)); } }

/* ---------- 2026-10-13 rearrangement (phone screenshot): doors fit the width, the dungeon's boxes go inside the
   encounter card, bigger text everywhere ---------- */
.dungeon-view { flex-direction: column; flex-wrap: nowrap; gap: 8px; width: 100%; max-height: 100%; }
.doors { width: 100%; justify-content: center; gap: 6px; }
.door.closed, .door.empty, .door.open { flex: 1 1 0; min-width: 0; max-width: 96px; width: auto; height: auto; aspect-ratio: 92 / 128; }
.door.closed .dart { font-size: clamp(22px, 6vh, 34px); }
.door.closed .dl { font-size: 13px; }
.door.open { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px; border-radius: 46px 46px 8px 8px; border: 3px solid #6b5a3a; background: linear-gradient(#e9e2d0, #d6cdb5); color: #2a2418; box-shadow: 0 6px 14px rgba(0,0,0,.5); }
.door.open.peril { background: linear-gradient(#dfe6d6, #c6d2b8); }
.door.open .dart { font-size: clamp(22px, 6vh, 32px); }
.door.open .dl { font-size: 12px; font-weight: 800; text-align: center; line-height: 1.1; }
.door.open .dk { font-size: 10.5px; font-weight: 700; opacity: .75; }
.dcard { width: min(460px, 100%); max-width: 100%; --box: 28px; }
.dcard .dh { font-size: 14px; }
.dcard .fn { font-size: 13px; line-height: 1.3; }
.dcard .fe { color: var(--muted); }
.dcard .fs { opacity: 1; font-size: 12px; gap: 3px; }

.card.big { width: min(100%, 360px); max-width: 360px; max-height: 100%; overflow-y: auto; touch-action: pan-y; }
.card .ch .art-s { margin-left: auto; font-size: 22px; line-height: 1; }
.card.big .ch { font-size: 17px; }
.card .ability { font-size: 13px; line-height: 1.3; }
.choice .cn { font-size: 14px; }
.choice .cc { font-size: 12px; }
.loot { font-size: 12.5px; }
.floorrow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; border-top: 1px dashed rgba(0,0,0,.3); padding-top: 4px; }
.floorrow .frl { font-size: 16px; }
.floorrow .fr { display: flex; align-items: center; gap: 3px; }
.floorrow .ftag { border: 0; border-radius: 999px; background: #4a3d26; color: #f4e2c6; font-size: 11.5px; font-weight: 800; padding: 1px 6px; }
.preview .card.big { width: 100%; max-width: 380px; margin: 0 auto; }

.hero .hh b { font-size: 15px; }
.hero .hh small { font-size: 12px; }
.hearts { font-size: 15px; }
.chip-c { min-width: 22px; height: 22px; font-size: 13.5px; }
.skill { font-size: 13px; padding: 3px 6px; }
.skill .cost { min-width: 18px; height: 18px; font-size: 11.5px; }
.items .item { font-size: 12px; padding: 1px 4px; }
.odd-prompt { font-size: 15px; }
.odd-actions .btn { font-size: 15px; }
.odd-actions .btn.small { font-size: 13px; }
.hp-card .hp-feat, .hp-card .hp-skill { font-size: 12px; }
@media (max-height: 380px) {
  .odd-prompt { font-size: 14px; }
  .odd-actions .btn { font-size: 14px; }
  .dcard { --box: 24px; }
  .card.big .ch { font-size: 15px; }
}
