/* Kick the Door: phone controller. Warm dungeon browns, torch gold, parchment cards. Mobile first. */
:root {
  --bg: #1a110b;
  --bg2: #22160c;
  --panel: #2c1d12;
  --panel2: #362416;
  --line: #5b3e22;
  --gold: #f3b843;
  --gold2: #ffd877;
  --text: #f6e7c8;
  --muted: #d9bf98;
  --green: #4cc35e;
  --green2: #9fe39a;
  --red: #e5533d;
  --red2: #ff9a80;
  --orange: #e98a2c;
  --purple: #8a5bd0;
  --hc: #c9a25c;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Rubik, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 18px; line-height: 1.3; color: var(--text);
  background:
    radial-gradient(ellipse 90% 45% at 50% -8%, #6a3a14 0%, #3a2110 38%, transparent 70%),
    radial-gradient(ellipse 70% 40% at 50% 108%, #3d220e 0%, transparent 70%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh; min-height: 100dvh;
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
body[data-screen="game"] { overflow: hidden; }
button, input { font-family: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
img { -webkit-user-drag: none; user-select: none; }
h2, h3 { margin: 0; }

/* ------------------------------------------------------------------ helpers */
.muted { color: var(--muted); }
.sm { font-size: 14px; }
.center { text-align: center; justify-content: center; }
.good { color: var(--green2); }
.dots { display: inline-block; min-width: 1.1em; }
.dots::before { content: '…'; animation: blink 1.2s steps(2) infinite; }
.spin {
  display: inline-block; width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 3px solid #ffffff40; border-top-color: #fff; animation: spin .8s linear infinite; vertical-align: -3px;
}

/* ------------------------------------------------------------------ boot / logo */
.boot {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; text-align: center; padding: 24px;
}
.boot-title, .logo-t {
  font-family: Lobster, Georgia, serif; font-size: 42px; line-height: 1.05; color: var(--gold2);
  text-shadow: 0 3px 0 #6b3a10, 0 6px 14px #0009;
}
.boot-sub { color: var(--muted); font-size: 19px; max-width: 320px; }
.tv-ico { font-size: 60px; animation: bob 2.4s ease-in-out infinite; }
.logo { text-align: center; padding: 14px 0 6px; }
.room-pill {
  display: inline-flex; align-items: baseline; gap: 6px; margin-top: 8px; padding: 6px 14px; border-radius: 20px;
  background: #ffffff10; border: 1px solid #6b4a2a; font-size: 15px; color: var(--muted);
}
.room-pill b { letter-spacing: 3px; color: var(--gold2); font-size: 20px; }

/* ------------------------------------------------------------------ panels */
.panel, .card-panel {
  margin: 12px 12px 0; padding: 16px; border-radius: 18px;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 #ffffff12, 0 4px 10px #0006;
}
.panel.slim { padding: 10px; }
.card-panel { margin: 12px 0 0; }
.ptitle {
  font-family: Lobster, Georgia, serif; font-weight: 400; font-size: 29px; line-height: 1.1; color: var(--gold2);
  text-align: center; margin: 0 0 12px; text-shadow: 0 2px 0 #5a300c;
}
.h3 { font-size: 19px; font-weight: 700; color: var(--gold2); margin: 0 0 10px; }
.psub { font-size: 16px; color: var(--muted); margin: 6px 0 12px; }
.lbl { display: block; font-size: 14px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 10px; font-weight: 600; }
.lbl.center { text-align: center; margin-top: 8px; }
.hint { font-size: 15px; color: var(--muted); text-align: center; margin: 10px 0 16px; }
.note {
  background: #00000030; border-radius: 12px; padding: 11px 13px; font-size: 16px; margin: 10px 0;
  border: 1px solid #8a643699;
}
.note.warn { border-inline-start-color: var(--orange); }
.note.good { border-inline-start-color: var(--green); color: var(--text); }
.empty { text-align: center; color: var(--muted); font-size: 18px; padding: 34px 10px; }
.empty.sm { padding: 10px; font-size: 16px; }
.msg-err:empty { display: none; }
.msg-err { background: #7a2416; border-radius: 12px; padding: 12px; margin-bottom: 14px; font-size: 17px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  min-height: 56px; padding: 10px 18px; border: 0; border-radius: 16px;
  font-size: 19px; font-weight: 700; line-height: 1.3; text-align: center;
  color: #2a1406; background: linear-gradient(#ffe39a, #f0a92e);
  box-shadow: 0 4px 0 #9a5c16, 0 8px 18px #0005;
  transition: transform .08s, box-shadow .08s, filter .2s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #9a5c16, 0 3px 8px #0005; }
.btn:disabled { filter: grayscale(.7) brightness(.62); cursor: default; }
.btn.dim { filter: saturate(.5) brightness(.8); }
.btn-txt { display: flex; flex-direction: column; align-items: center; }
.btn-txt small { font-size: 13.5px; font-weight: 500; opacity: .85; margin-top: 2px; }
.btn-ico { font-size: 1.25em; line-height: 1; flex: none; }
.btn-gold { color: #2a1406; }
.btn-green { color: #fff; text-shadow: 0 1px 2px #0007; background: linear-gradient(#78e070, #2e9a3d); box-shadow: 0 4px 0 #1a5e24, 0 8px 18px #0005; }
.btn-green:active:not(:disabled) { box-shadow: 0 1px 0 #1a5e24; }
.btn-red { color: #fff; text-shadow: 0 1px 2px #0007; background: linear-gradient(#f37b62, #c23a28); box-shadow: 0 4px 0 #7a1e12, 0 8px 18px #0005; }
.btn-red:active:not(:disabled) { box-shadow: 0 1px 0 #7a1e12; }
.btn-orange { color: #2a1406; background: linear-gradient(#ffb566, #e0761f); box-shadow: 0 4px 0 #8a4210, 0 8px 18px #0005; }
.btn-orange:active:not(:disabled) { box-shadow: 0 1px 0 #8a4210; }
.btn-thief { color: #fff; text-shadow: 0 1px 2px #0007; background: linear-gradient(#b48cf0, #6a3fb4); box-shadow: 0 4px 0 #3e2370, 0 8px 18px #0005; }
.btn-thief:active:not(:disabled) { box-shadow: 0 1px 0 #3e2370; }
.btn-sec { color: var(--text); background: linear-gradient(#4a3220, #34231a); border: 2px solid #8a6436; box-shadow: 0 4px 0 #160d06, 0 8px 18px #0005; }
.btn-sec:active:not(:disabled) { box-shadow: 0 1px 0 #160d06; }
.btn-ghost { color: var(--muted); background: none; background-color: transparent; background-image: none; border: 2px solid #6b4a2a; box-shadow: none; }
.btn-ghost:active:not(:disabled) { box-shadow: none; background: #ffffff08; }
.btn-xl { min-height: 74px; font-size: 23px; border-radius: 20px; }
.btn-lg { min-height: 62px; font-size: 20px; }
.btn-small { width: auto; min-height: 48px; font-size: 16px; padding: 6px 14px; border-radius: 13px; flex: none; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row > .btn { flex: 1; min-width: 0; padding-left: 10px; padding-right: 10px; }
.btn-col { display: grid; gap: 12px; margin-top: 12px; }
.panel > .btn + .btn, .panel > .btn + .btn-row, .wiz + .btn, .sheet-acts > * + * { margin-top: 12px; }
.linkbtn { background: none; border: 0; color: var(--gold2); font-size: 16px; padding: 10px 4px; min-height: 44px; }

/* ------------------------------------------------------------------ faces */
.face {
  position: relative; display: inline-block; flex: none; width: 52px; height: 52px; border-radius: 50%;
  background: #f1e2c6; box-shadow: 0 0 0 3px var(--hc), 0 3px 8px #0007; vertical-align: middle;
}
.face-img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.face.xs { width: 28px; height: 28px; box-shadow: 0 0 0 2px var(--hc); }
.face.sm { width: 40px; height: 40px; }
.face.md { width: 54px; height: 54px; }
.face.lg { width: 76px; height: 76px; box-shadow: 0 0 0 4px var(--hc), 0 4px 10px #0007; }
.face.xl { width: 112px; height: 112px; box-shadow: 0 0 0 5px var(--hc), 0 6px 14px #0008; }
.face.dead .face-img, .face.off .face-img { filter: grayscale(1) brightness(.75); }
.face-badge {
  position: absolute; right: -4px; bottom: -4px; min-width: 22px; height: 22px; border-radius: 11px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
  background: var(--gold); color: #2a1406; box-shadow: 0 0 0 2px var(--bg);
}

/* ------------------------------------------------------------------ chips / tags */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chips.center { justify-content: center; }
.chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 5px 13px; border-radius: 20px;
  font-size: 15px; background: #ffffff10; border: 1px solid #ffffff1c; color: var(--text);
}
button.chip { min-height: 46px; font-weight: 600; }
.chip.sm { min-height: 26px; padding: 3px 10px; font-size: 13.5px; }
.chip.muted { color: var(--muted); }
.chip-red { background: #7a2416; border-color: #b8432c; }
.chip-curse { background: #44206b; border-color: #8a5bd0; }
.chip-gold { background: #5e4210; border-color: var(--gold); color: var(--gold2); }
.chip-good { background: #235c2a; border-color: #3f9a46; }
.chip-act { border-color: var(--gold); box-shadow: inset 0 0 0 1px #f3b84355; }
.tag { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: #ffffff16; margin-left: 6px; vertical-align: 2px; }
.tag-gold { background: var(--gold); color: #2a1406; }
.tag-red { background: #7a2416; }
.tag-turn { background: #2f7a3a; }

/* ------------------------------------------------------------------ join + code */
.join, .lobby { max-width: 520px; margin: 0 auto; padding: 8px 14px 120px; }
.lobby { padding-bottom: 40px; }
.name-in, .code-in {
  display: block; width: 100%; font-size: 24px; font-weight: 600; padding: 14px 16px; border-radius: 14px;
  border: 2px solid #8a6436; background: #1b110a; color: var(--text); outline: none;
}
.name-in:focus, .code-in:focus { border-color: var(--gold); box-shadow: 0 0 0 3px #f3b84333; }
.code-in { text-align: center; letter-spacing: 14px; font-size: 42px; text-transform: uppercase; padding-left: 28px; }
.code-screen .card-panel { margin-top: 24px; }
.back-link { margin-top: 16px; text-decoration: none; }
.hero-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.hero-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0;
  padding: 10px 4px 9px; border-radius: 16px; background: #1f140c; border: 2px solid #4a3220;
  transition: transform .12s, box-shadow .2s;
}
.hero-tile:active { transform: scale(.96); }
.hero-tile .face { width: 100%; height: auto; aspect-ratio: 1; max-width: 86px; box-shadow: 0 0 0 3px var(--hc), 0 3px 8px #0007; }
.hero-tile.sel { border-color: var(--hc); background: #3a2716; box-shadow: 0 0 0 2px var(--hc), 0 6px 14px #0008; }
.hero-tile.taken { opacity: .5; }
.hero-tile.taken .face-img { filter: grayscale(1); }
.hero-name { font-size: 13px; font-weight: 600; line-height: 1.1; max-width: 100%; letter-spacing: -.2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-tile.taken .hero-name { color: var(--muted); font-weight: 400; }
.hero-check {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--hc); color: #fff; font-weight: 900; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px #0008; text-shadow: 0 1px 2px #0006;
}
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 58px; border-radius: 14px;
  border: 2px solid #6b4a2a; background: #1f140c; font-size: 18px; font-weight: 700;
}
.seg-btn.on { border-color: var(--gold); background: #4a3115; color: var(--gold2); box-shadow: inset 0 0 0 1px var(--gold); }
.seg-ico { font-size: 22px; }
.join-go {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 18px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 35%);
}
.join-go .btn { max-width: 520px; margin: 0 auto; }

/* ------------------------------------------------------------------ lobby */
.lobby-list { display: grid; gap: 8px; margin-top: 6px; }
.lobby-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--hc) 22%, var(--panel)), var(--panel));
  border: 2px solid color-mix(in srgb, var(--hc) 75%, transparent);
}
.lobby-row.fresh { animation: rise .35s both; }
.lobby-row.me { box-shadow: 0 0 0 2px var(--gold) inset; }
.lobby-who { flex: 1; min-width: 0; }
.lobby-name { font-size: 20px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.lobby-sub { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-top: 2px; }
.lobby-sub .tag { margin-inline-start: 4px; }
.lobby-host { display: grid; gap: 14px; margin-top: 18px; }
.lobby-wait { text-align: center; color: var(--muted); font-size: 18px; margin-top: 22px; }

/* ------------------------------------------------------------------ game frame */
.game { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.top {
  flex: none; position: relative; display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: linear-gradient(#2f1e10, #21150b);
  border-bottom: 2px solid var(--hc); box-shadow: 0 4px 14px #0007; z-index: 3;
}
.top-face { width: 50px; height: 50px; }
.top-who { flex: 1; min-width: 0; }
.top-name { font-family: Lobster, Georgia, serif; font-size: 23px; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-rc { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.top-stat {
  flex: none; text-align: center; min-width: 56px; padding: 4px 6px 3px; border-radius: 12px;
  background: #00000045; border: 1px solid #ffffff16;
}
.top-stat b { display: block; font-size: 29px; font-weight: 800; line-height: 1; color: var(--gold2); }
.top-stat small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.top-stat.pow b { color: var(--green2); }
.conn { width: 12px; height: 12px; border-radius: 50%; flex: none; background: #888; }
.conn-open { background: var(--green); box-shadow: 0 1px 3px #0008; }
.conn-connecting { background: var(--gold); }
.conn-lost { background: var(--red); animation: blink .8s infinite; }
.top-pending { position: absolute; inset-inline-end: 8px; bottom: -22px; z-index: 4; }
.tbar { flex: none; height: 7px; background: #00000070; opacity: 0; transition: opacity .3s; overflow: hidden; }
.tbar.on { opacity: 1; }
.tfill { height: 100%; width: 100%; transform-origin: left center; transform: scaleX(0); background: linear-gradient(90deg, #f0a92e, #ffe39a); transition: transform .2s linear; }
.tfill.low { background: linear-gradient(90deg, #c23a28, #ff7a5a); animation: blink .7s infinite; }
.main { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding-bottom: 18px; -webkit-overflow-scrolling: touch; }
.tabpage { padding: 12px 12px 0; }
.tabpage > .panel { margin: 12px 0 0; }
.tab-head { text-align: center; }
.tab-head .ptitle { margin-bottom: 4px; }

.tabs {
  flex: none; display: grid; grid-template-columns: repeat(4, 1fr);
  background: linear-gradient(#26180d, #170e07); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 3;
}
.tab {
  position: relative; min-height: 64px; background: none; border: 0; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 14px; font-weight: 600;
}
.tab.on { color: var(--gold2); }
.tab.on::before { content: ''; position: absolute; top: 0; left: 20%; right: 20%; height: 4px; border-radius: 0 0 4px 4px; background: var(--gold); }
.tab-ico { position: relative; font-size: 25px; line-height: 1; filter: saturate(.8); }
.tab.on .tab-ico { filter: none; transform: scale(1.08); }
.tab-badge {
  position: absolute; top: -7px; right: -16px; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 11px;
  background: #7a5430; color: #fff; font-size: 12.5px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.tab-dot { position: absolute; top: -4px; right: -8px; width: 13px; height: 13px; border-radius: 50%; background: #ff5a3a; animation: ping 1.4s 3; }

/* ------------------------------------------------------------------ "now" area */
.now.enter > .panel, .now.enter > .turn-strip, .now.enter > .waitline { animation: rise .32s both; }
.now.enter > :nth-child(2) { animation-delay: .04s; }
.now.enter > :nth-child(3) { animation-delay: .08s; }
.now.enter > :nth-child(4) { animation-delay: .12s; }
.turn-strip, .waitline {
  display: flex; align-items: center; gap: 10px; margin: 12px 12px 0; padding: 8px 12px; border-radius: 14px;
  background: #ffffff08; border: 1px solid #ffffff14; font-size: 16px;
}
.turn-strip.mine { background: linear-gradient(90deg, #6b4110, #3a2410); border-color: var(--gold); }
.ts-who { flex: 1; font-weight: 700; min-width: 0; }
.turn-strip.mine .ts-who { color: var(--gold2); font-size: 18px; }
.ts-n { color: var(--muted); font-size: 14px; }
.ts-watch { color: var(--gold2); font-size: 14px; }
.waitline { background: #3a2a18; border-style: dashed; border-color: #8a6436; }
.waitline > span:nth-child(2) { flex: 1; }
.panel.wait { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 24px 16px; }
.wait-t { font-size: 22px; font-weight: 700; line-height: 1.32; }
.wait-sub { color: var(--muted); font-size: 16px; display: flex; align-items: center; gap: 6px; }
.panel.watch { text-align: center; padding: 26px 16px; }
.watch-t { font-size: 21px; font-weight: 600; margin-top: 8px; }
.panel.tip .tip-t { font-size: 16px; color: var(--muted); margin-bottom: 10px; text-align: center; }
.dead-panel { text-align: center; border-color: #6b6b6b; background: linear-gradient(#2e2a26, #1f1c19); }
.big-ico { font-size: 54px; }

/* door: one per room */
.doors.one { grid-template-columns: 1fr; background: #120a05 var(--room, url(/img/bg/one_dungeon.webp)) 50% 42% / 230% auto no-repeat; }
.door.one-door { padding-bottom: 14px; }
.door-img { position: absolute; left: 36%; right: 36%; top: 9%; bottom: 12%; background: var(--door, url(/img/props/door.webp)) center / contain no-repeat; filter: drop-shadow(0 6px 10px #000a); }
.door.one-door .door-glow { left: 33%; right: 33%; top: 7%; bottom: 10%; }
.door.one-door.kicked .door-img { animation: dooropen .5s ease-in forwards; }
.room-name { position: absolute; left: 0; right: 0; top: 8px; text-align: center; font: 400 22px Lobster, Georgia, serif; color: #ffe8b0; text-shadow: 0 2px 4px #000; pointer-events: none; }
@keyframes dooropen { to { transform: perspective(500px) rotateY(-75deg); transform-origin: left center; opacity: .3; } }
/* doors */
.doors {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; aspect-ratio: 660 / 460; border-radius: 16px; overflow: hidden;
  background: #120a05 url(/img/bg/hall3d.webp) 50.8% 49.1% / 290.9% auto no-repeat;
  box-shadow: inset 0 0 0 2px #00000060, 0 8px 20px #0008;
}
.door { position: relative; border: 0; background: transparent; padding: 0 0 12px; display: flex; align-items: flex-end; justify-content: center; }
.door-glow {
  position: absolute; top: 11%; bottom: 15%; border-radius: 46% 46% 6px 6px / 30% 30% 6px 6px;
  outline: 4px solid #ffd87700; outline-offset: 0; animation: doorpulse 2.2s ease-in-out infinite;
}
.door.d1 .door-glow { left: 18%; right: 18%; }
.door.d2 .door-glow { left: 21%; right: 15%; animation-delay: 1.1s; }
.door-lbl {
  position: relative; z-index: 1; padding: 10px 16px; border-radius: 13px; font-size: 20px; font-weight: 800; color: #2a1406;
  background: linear-gradient(#ffe39a, #f0a92e); box-shadow: 0 4px 0 #9a5c16, 0 6px 14px #000a;
}
.door:active .door-lbl { transform: translateY(3px); box-shadow: 0 1px 0 #9a5c16; }
.doors.chosen { animation: shake .4s; }
.doors.chosen .door:not(.kicked)::after { content: ''; position: absolute; inset: 0; background: #000a; transition: opacity .2s; }
.door.kicked .door-glow { animation: kick .45s ease-out forwards; }
.grave .grave-top { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 15px; color: var(--muted); }
.grave .grave-top .card { --w: 62px; box-shadow: 0 3px 8px #0008; }

/* rows with a card thumbnail (trouble, throw-into-combat) */
.trow { display: grid; grid-template-columns: 86px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid #ffffff12; align-items: start; }
.trow:first-of-type { border-top: 0; }
.h3 + .trow, .psub + .trouble-list .trow:first-child { border-top: 0; }
.trow-card { padding: 0; border: 0; background: none; }
.trow-card .card { --w: 86px; box-shadow: 0 4px 10px #0008; }
.trow-body { min-width: 0; }
.trow-name { font-size: 18px; font-weight: 700; line-height: 1.32; }
.trow-eff { font-size: 14.5px; color: var(--muted); margin: 2px 0 8px; }
.trow-body .btn { min-height: 52px; font-size: 18px; }
.verdict { font-weight: 700; }
.v-easy { color: var(--green2); }
.v-even { color: #ffc07a; }
.v-hard { color: var(--red2); }

/* selling */
.sell-sum { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 17px; margin: 12px 0; padding: 11px 13px; background: #00000035; border-radius: 12px; }
.sell-sum b { font-size: 19px; }

/* ------------------------------------------------------------------ combat */
.panel.combat {
  border: 2px solid #9a2f1d;
  background: radial-gradient(ellipse at 50% 0%, #5e2013 0%, #2c1810 72%);
}
.panel.combat.win { border-color: #3f9a46; background: radial-gradient(ellipse at 50% 0%, #1f4a22 0%, #1d1a10 72%); }
.cb-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.cb-heroes { display: flex; }
.cb-heroes .face + .face { margin-inline-start: -8px; }
.cb-title { font-family: Lobster, Georgia, serif; font-size: 31px; line-height: 1; color: #ffb36b; text-shadow: 0 2px 0 #4a1408; }
.combat.win .cb-title { color: var(--green2); text-shadow: 0 2px 0 #0e3312; }
.cb-who { font-size: 17px; font-weight: 600; margin-top: 2px; }
.vs { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px 6px; margin: 8px 0 12px; }
.vs-side { text-align: center; }
.vs-lbl { font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.vs-num { font-size: 54px; font-weight: 800; line-height: 1; transition: color .3s; }
.vs-h .vs-num { color: var(--green2); }
.vs-m .vs-num { color: var(--red2); }
.vs.win .vs-h .vs-num { color: var(--green2); text-shadow: 0 3px 0 #0e3312; }
.vs.lose .vs-m .vs-num { color: #ff7a5a; text-shadow: 0 3px 0 #4a1408; }
.vs-x { font-family: Lobster, Georgia, serif; font-size: 28px; color: var(--gold); }
.vs-bar { grid-column: 1 / -1; height: 16px; border-radius: 9px; background: linear-gradient(90deg, #c23a28, #ef6a4f); overflow: hidden; box-shadow: inset 0 2px 5px #000a; margin-top: 6px; }
.vs-fill { height: 100%; width: 100%; transform-origin: left center; background: linear-gradient(90deg, #2e9a3d, #78e070); transition: transform .5s cubic-bezier(.2, .7, .3, 1); }
.vs-note { grid-column: 1 / -1; text-align: center; font-size: 20px; font-weight: 800; margin-top: 6px; }
.vs.win .vs-note { color: var(--green2); }
.vs.lose .vs-note { color: var(--red2); }
.mon-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 6px 0 4px; }
.mon { position: relative; padding: 0; border: 0; background: none; }
.mon .card { --w: 110px; box-shadow: 0 6px 16px #000a; }
.mon.gone { opacity: .45; filter: grayscale(.8); }
.mon { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 130px; }
.mon-name { font-size: 15px; font-weight: 700; line-height: 1.15; text-align: center; color: var(--text); }
.trow-card { position: relative; }
.x-n { position: absolute; top: -6px; left: -6px; z-index: 2; background: var(--gold); color: #2a1406; font-weight: 900; font-size: 14px; padding: 2px 7px; border-radius: 10px; box-shadow: 0 2px 6px #0008; }
.mon-pow {
  position: absolute; top: -9px; right: -9px; min-width: 40px; height: 40px; padding: 0 5px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center; font-size: 21px; font-weight: 900; color: #fff;
  background: radial-gradient(circle at 40% 35%, #ff8a6a, #b8261a); border: 2px solid #ffd2b8; box-shadow: 0 3px 8px #000a;
}
.mon-gone { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-12deg); background: #000c; padding: 3px 10px; border-radius: 8px; font-weight: 800; }
.mon-enh { position: absolute; top: -9px; inset-inline-start: -9px; display: flex; flex-direction: column; gap: 3px; }
.mon-enh span { background: #7a1e12; color: #fff; font-size: 14px; padding: 2px 8px; border-radius: 10px; font-weight: 800; border: 2px solid #ff9a80; box-shadow: 0 2px 6px #0009; }
.mods { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.mod { font-size: 13.5px; padding: 4px 10px; border-radius: 12px; font-weight: 600; }
.mod small { opacity: .75; font-weight: 400; }
.mod-h { background: #1f5a26; border: 1px solid #3f9a46; }
.mod-m { background: #6a1d12; border: 1px solid #b8432c; }
.panel.lastcall {
  display: flex; align-items: center; gap: 14px; border: 2px solid #ff8a4a;
  background: linear-gradient(90deg, #7a2a10, #3a1a0c); animation: glowred 1s ease-in-out infinite alternate;
}
.lc-num {
  flex: none; width: 66px; height: 66px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 900; color: #fff; background: radial-gradient(#ff7a4a, #b8261a); border: 3px solid #ffd2b8;
}
.lc-t { font-size: 20px; font-weight: 800; color: #ffd2b8; }
.lc-sub { font-size: 15px; color: #ffd2b8cc; margin-top: 2px; }
.offers { margin-top: 6px; }
.offer { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; border-radius: 14px; background: #00000030; border: 2px solid color-mix(in srgb, var(--hc) 70%, transparent); margin-bottom: 8px; }
.offer-t { flex: 1; font-size: 16px; font-weight: 600; min-width: 0; }
.offer-t small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 6px 0; }
.btn-step {
  width: 62px; min-height: 62px; padding: 0; font-size: 32px; font-weight: 600; border-radius: 50%; flex: none;
  color: var(--text); background: linear-gradient(#4a3220, #34231a); border: 2px solid #8a6436; box-shadow: 0 4px 0 #160d06;
}
.step-val { min-width: 96px; text-align: center; }
.step-val b { display: block; font-size: 40px; line-height: 1; color: var(--gold2); }
.step-val small { font-size: 14px; color: var(--muted); }
.power { padding: 12px 0; border-top: 1px solid #ffffff12; }
.h3 + .power { border-top: 0; padding-top: 2px; }
.power-t { font-size: 18px; font-weight: 700; }
.power-d { font-size: 14.5px; color: var(--muted); margin: 2px 0 6px; }

/* wizard choices */
.wiz { margin-top: 6px; }
.wiz-title { font-size: 15.5px; font-weight: 700; color: var(--muted); margin: 12px 0 8px; }
.trow-body .wiz-title, .power .wiz-title { margin-top: 4px; }
.wiz-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.wc-side { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wc-side .btn { min-height: 56px; font-size: 17px; padding: 8px 6px; }
.wc-side .btn:nth-child(3) { grid-column: 1 / -1; }
.pchip {
  display: inline-flex; align-items: center; gap: 9px; min-height: 54px; padding: 6px 12px 6px 7px; border-radius: 30px;
  background: linear-gradient(#4a3220, #34231a); border: 2px solid var(--hc); color: var(--text); box-shadow: 0 3px 0 #160d06;
}
.pchip:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.pchip:disabled { filter: brightness(.6); }
.pchip.on { background: color-mix(in srgb, var(--hc) 40%, #34231a); box-shadow: 0 0 0 2px var(--hc); }
.pchip .face.sm { width: 38px; height: 38px; box-shadow: none; }
.pchip-name { font-size: 17px; font-weight: 700; }
.pchip-lvl { font-size: 13px; font-weight: 800; background: #00000050; border-radius: 10px; padding: 2px 7px; color: var(--gold2); }
.mchip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 54px; padding: 6px 14px; border-radius: 16px;
  background: linear-gradient(#5a2014, #3a160e); border: 2px solid #c2452e; color: #fff; box-shadow: 0 3px 0 #1e0805; font-size: 16px; font-weight: 700;
}
.mchip:disabled { filter: brightness(.6); }
.mchip-pow { background: #000a; border-radius: 10px; padding: 1px 8px; color: var(--red2); }
.cchip { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 94px; padding: 4px 2px 6px; border: 2px solid transparent; border-radius: 12px; background: #00000025; }
.cchip:active:not(:disabled) { border-color: var(--gold); }
.cchip:disabled { filter: brightness(.6); }
.cchip .card { --w: 82px; box-shadow: 0 4px 10px #0008; }
.cchip-name { font-size: 13px; font-weight: 600; line-height: 1.15; text-align: center; }
.wc-card, .wc-item, .wc-with { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; }
.wc-card > *, .wc-item > *, .wc-with > * { flex: none; scroll-snap-align: start; }

/* ------------------------------------------------------------------ card tiles / grids */
.grid2, .grid3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; } /* always two per row, even inside a padded panel on a narrow phone */
.grid3 { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px 10px; }
.grid3 .tile .card { --w: calc(33vw - 26px); }
@supports (width: 1cqw) { .grid3 .tile .card { --w: 100cqw; } }
.grid3 .tile .card-mini .card-name { font-size: 1.4em; }
.tile { position: relative; display: block; padding: 0; border: 0; background: none; border-radius: 12px; container-type: inline-size; text-align: start; }
.tile .card { --w: calc(50vw - 34px); box-shadow: 0 6px 14px #0008; transition: transform .15s, box-shadow .2s; }
@supports (width: 1cqw) { .tile .card { --w: 100cqw; } }
.tile .card-mini .card-name { font-size: 1.3em; }
.tile:active .card { transform: scale(.97); }
.tile.can .card { box-shadow: 0 0 0 3px var(--gold2), 0 6px 12px #0008; }
.tile.unusable .card { filter: grayscale(.6); }
.sel-tile.on .card { box-shadow: 0 0 0 4px var(--green), 0 6px 12px #0008; transform: translateY(-3px); }
.tick {
  position: absolute; top: -7px; right: -7px; width: 34px; height: 34px; border-radius: 50%; z-index: 2;
  background: var(--green); color: #fff; font-weight: 900; font-size: 19px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px #0009;
}
.can-badge, .warn-badge {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); white-space: nowrap; z-index: 2;
  font-size: 13.5px; font-weight: 800; padding: 3px 10px; border-radius: 10px; background: var(--gold); color: #2a1406; box-shadow: 0 2px 6px #0008;
}
.warn-badge { background: #7a2416; color: #fff; }
/* why an item cannot be put on: two lines at most, inside the tile */
.why-badge {
  position: absolute; bottom: 8px; left: 6px; right: 6px; z-index: 2; text-align: center;
  font-size: 12.5px; font-weight: 700; line-height: 1.25; padding: 3px 6px; border-radius: 10px; background: #5a1c12ee; color: #ffe2d8; box-shadow: 0 2px 6px #0008;
}
.why-note { color: #ffb4a4; }
.tut .tut-top { display: flex; justify-content: space-between; align-items: center; font-weight: 800; color: var(--gold2); margin-bottom: 10px; }
.tut .tut-n { font-weight: 600; color: var(--text); opacity: 0.8; }
.tut .tut-q { text-align: center; }
.tut .tut-qt { font-size: 22px; font-weight: 800; line-height: 1.35; }
.tut .tut-acts { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.tut .tut-demo { margin: 0; }
.tut .tut-door { animation: hint-pulse-ph 1.4s ease-in-out infinite; }
@keyframes hint-pulse-ph { 50% { transform: scale(0.97); filter: brightness(1.15); } }
.tut .tut-fb { margin-top: 14px; padding: 14px; border-radius: 14px; font-size: 18px; font-weight: 700; text-align: center; }
.tut .tut-fb.ok { background: #1f5a2660; color: #b8f5c0; } .tut .tut-fb.bad { background: #5a1c1260; color: #ffd0c4; }
.tut .tut-wait { margin-top: 18px; text-align: center; }
.tut .tut-wait-t { font-size: 20px; font-weight: 800; color: #8ff0a4; }
.tut .tut-left { margin-top: 8px; font-size: 16px; opacity: 0.85; }
.power.has-card { display: flex; gap: 12px; align-items: flex-start; }
.power-card { flex: none; padding: 0; border: 0; background: none; }
.power-body { flex: 1; min-width: 0; }
.power-lose { margin: 6px 0 8px; }
.power-lose-t { font-size: 14px; font-weight: 700; color: #ffb4a4; margin-bottom: 4px; }
.mini-row { display: flex; flex-wrap: wrap; gap: 4px; }
/* on hand / gear tiles the badge sits under the card, never over its bottom line (price, slot, bonus) */
.tile .can-badge, .tile .warn-badge, .tile .why-badge { position: static; transform: none; display: block; width: fit-content; max-width: 100%; margin: 7px auto 0; white-space: normal; text-align: center; box-sizing: border-box; }
.swap-warn { padding: 12px 14px; border-radius: 14px; background: #4a2a0e; border: 1px solid #c9902e; display: flex; flex-direction: column; gap: 6px; }
.swap-t { font-weight: 800; color: var(--gold2); font-size: 17px; }
.swap-l { font-size: 15.5px; line-height: 1.4; color: var(--text); }
.gold-badge { position: absolute; top: 34%; right: 6px; z-index: 2; background: #2a1406e8; color: var(--gold2); font-weight: 800; font-size: 14px; padding: 2px 8px; border-radius: 10px; }
.eq-badge { position: absolute; top: 34%; left: 6px; z-index: 2; background: #235c2ae8; color: #fff; font-size: 12.5px; font-weight: 700; padding: 2px 7px; border-radius: 10px; }
.cheat-badge { position: absolute; top: 6px; inset-inline-start: 6px; font-size: 20px; z-index: 2; }
.dot-badge { position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px var(--bg); z-index: 2; }
.card-art.noart { background: radial-gradient(circle at 50% 40%, #fffaf0, #e3cc98 75%); }
.card-art .art-ico { font-size: calc(var(--w) * .3); line-height: 1; filter: drop-shadow(0 4px 4px #0005); }
.hand-tile {
  aspect-ratio: 5 / 7.2; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 12px; text-align: center; font-weight: 700; font-size: 16px; color: #fff; text-shadow: 0 1px 3px #000;
  background: repeating-linear-gradient(45deg, #7a3b1c 0 12px, #8f4a26 12px 24px); box-shadow: 0 6px 14px #0008; border: 3px solid #5a2a10;
}
.hand-tile .art-ico { font-size: 54px; }

/* ------------------------------------------------------------------ gear / table */
.me-card .me-top { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.me-name { font-family: Lobster, Georgia, serif; font-size: 28px; line-height: 1.1; }
.me-stats { display: flex; gap: 18px; font-size: 16px; color: var(--muted); margin-top: 4px; }
.me-stats b { font-size: 27px; color: var(--gold2); }
.me-card .lbl { margin-top: 12px; margin-bottom: 4px; }
.prow { border: 2px solid color-mix(in srgb, var(--hc) 75%, transparent); padding: 12px 12px 10px; }
.prow.me { background: linear-gradient(90deg, color-mix(in srgb, var(--hc) 18%, var(--panel2)), var(--panel)); }
.prow.turn { box-shadow: 0 0 0 2px var(--gold), 0 6px 18px #0006; }
.prow.is-dead { filter: saturate(.4); }
.prow-top { display: flex; align-items: center; gap: 12px; }
.prow-who { flex: 1; min-width: 0; }
.prow-name { font-size: 19px; font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.prow-name .tag { margin-inline-start: 4px; }
.prow-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.prow-stat { flex: none; text-align: center; min-width: 50px; }
.prow-stat b { display: block; font-size: 28px; line-height: 1; color: var(--gold2); font-weight: 800; }
.prow-stat small { font-size: 11.5px; color: var(--muted); text-transform: uppercase; }
.prow-stat.pow b { color: var(--green2); }
.p-items { display: flex; gap: 10px; overflow-x: auto; padding: 8px 2px 6px; scroll-snap-type: x proximity; }
.p-item { flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; scroll-snap-align: start; }
.p-item-card { padding: 0; border: 0; background: none; }
.p-item-card .card { --w: 94px; box-shadow: 0 4px 10px #0008; }
.p-item.eq .p-item-card .card { box-shadow: 0 0 0 2px var(--green), 0 4px 10px #0008; }
.p-item .btn-small { min-height: 44px; font-size: 15px; padding: 4px 10px; }
.trade-in { display: flex; flex-direction: column; align-items: stretch; gap: 10px; border: 2px solid var(--gold); animation: glowgold 1.2s ease-in-out infinite alternate; }
.ti-t { flex: 1; font-size: 17px; font-weight: 700; }
.trade-in .btn { width: 100%; }
.sec-pill { display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: 10px; background: #00000045; color: var(--gold2); font-size: 15px; white-space: nowrap; }
.over { text-align: center; border-color: var(--gold); background: radial-gradient(ellipse at 50% 0%, #6b4a10, #2c1d12 72%); }
.over-t { font-family: Lobster, Georgia, serif; font-weight: 400; font-size: 42px; color: var(--gold2); margin: 4px 0 16px; text-shadow: 0 3px 0 #5a300c; }
.confetti { font-size: 58px; animation: bob 1.6s ease-in-out infinite; }
.over-faces { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }
.over-name { font-size: 23px; font-weight: 800; margin-top: 12px; }
.res-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #ffffff10; }
.res-name { flex: 1; font-size: 18px; }
.res-lvl { font-weight: 800; color: var(--gold2); }
.help-list { display: grid; gap: 8px; }
.help-p {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 68px; padding: 8px 12px; border-radius: 16px; text-align: start;
  background: #1f140c; border: 2px solid #4a3220;
}
.help-p.on { border-color: var(--hc); background: color-mix(in srgb, var(--hc) 22%, #2a1b10); box-shadow: 0 0 0 2px var(--hc); }
.help-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 19px; font-weight: 700; }
.help-name small { font-size: 14px; font-weight: 400; color: var(--muted); }
.help-stat { text-align: center; }
.help-stat b { display: block; font-size: 26px; color: var(--green2); line-height: 1; }
.help-stat small { font-size: 12px; color: var(--muted); }
.steal-head { display: flex; align-items: center; gap: 14px; }
.steal-head .card { --w: 96px; }
.sub-h { font-size: 15.5px; font-weight: 700; color: var(--muted); margin-top: 16px; }

/* ------------------------------------------------------------------ overlays: sheets + prompts */
#layer { position: relative; z-index: 40; }
.overlay { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; justify-content: flex-end; }
.backdrop { position: absolute; inset: 0; background: #000000a0; animation: fadein .2s both; }
.backdrop.dark { background: #000000c4; }
.sheet {
  position: relative; display: flex; flex-direction: column; max-height: 92vh; max-height: 92dvh; overflow: hidden;
  background: linear-gradient(#3c2817, #22160c 60%); border-radius: 24px 24px 0 0; border-top: 2px solid #c08a3e;
  box-shadow: 0 -10px 40px #000a; animation: sheetin .3s cubic-bezier(.2, .9, .3, 1.1) both;
  padding-bottom: env(safe-area-inset-bottom);
}
.overlay.still .sheet, .overlay.still .backdrop { animation: none; }
.sheet-grip { width: 46px; height: 5px; border-radius: 3px; background: #ffffff33; margin: 8px auto 2px; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 2px 10px 6px 18px; flex: none; }
.sheet-title { flex: 1; min-width: 0; font-family: Lobster, Georgia, serif; font-size: 25px; color: var(--gold2); line-height: 1.1; }
.x { width: 48px; height: 48px; border-radius: 50%; border: 0; background: #ffffff12; font-size: 22px; color: var(--text); flex: none; }
.sheet-body { overflow-y: auto; padding: 6px 16px 22px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-card { display: flex; justify-content: center; padding: 4px 0 10px; }
.sheet-card .card { --w: min(290px, 74vw, calc((100vh - 360px) / 1.44)); --w: min(290px, 74vw, calc((100dvh - 360px) / 1.44)); }
.sheet-acts { margin-top: 10px; }
.sheet-acts .wiz:first-child { margin-top: 0; }
.prompt { border-top-color: var(--gold); }
.prompt.k-roll { border-top-color: var(--green); }
.prompt.k-run_fail { border-top-color: var(--red); }
.prompt > .tbar { border-radius: 24px 24px 0 0; height: 8px; }
.prompt .sheet-body { padding: 16px 18px 24px; text-align: center; }
.prompt .grid2, .prompt .grid3, .prompt .btn-col, .prompt .wiz-choices { text-align: start; }
.pr-title { font-family: Lobster, Georgia, serif; font-size: 31px; line-height: 1.15; color: var(--gold2); margin: 6px 0 8px; text-shadow: 0 2px 0 #5a300c; }
.pr-sub { font-size: 18px; margin: 4px 0 14px; }
.pr-sub.big { font-size: 22px; font-weight: 700; color: var(--gold2); }
.pr-need { font-size: 25px; font-weight: 800; color: var(--green2); margin: 10px 0 4px; }
.pr-face { display: flex; justify-content: center; margin: 4px 0 12px; }
.pr-card { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 10px 0; }
.pr-card .card { --w: 92px; box-shadow: 0 4px 10px #0008; flex: none; }
.pr-card b { font-size: 19px; text-align: start; max-width: 55%; }
.pr-foot { position: sticky; z-index: 5; bottom: -24px; margin: 6px -18px -24px; padding: 30px 18px 18px; background: linear-gradient(#22160c00 0, #22160c 26px); }
.pr-count { font-size: 17px; margin-bottom: 10px; color: var(--muted); }
.pr-count.good { color: var(--green2); font-weight: 700; }
.prompt .pick-grid { margin-top: 8px; }
.prompt .mon-row .card { --w: 92px; }
.prompt .vs { margin: 4px 0 8px; }
.prompt .vs-num { font-size: 42px; }

/* dice */
.die {
  display: inline-grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); width: 60px; height: 60px; padding: 10%;
  background: linear-gradient(145deg, #fffdf6, #e6d6b6); border-radius: 20%; box-shadow: inset 0 -5px 0 #0002, inset 0 3px 0 #fff, 0 6px 14px #0009;
}
.die i { display: block; }
.die i.pip { width: 68%; height: 68%; margin: auto; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #6b3a10, #2a1406); }
.die.big { width: 132px; height: 132px; }
.die.q { display: inline-flex; align-items: center; justify-content: center; font: 900 72px Rubik, sans-serif; color: #6b3a10; }
.roll-show .banner-t { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.roll-show .roll-line { font: 800 26px Rubik, sans-serif; }
.roll-show.ok .roll-line { color: #8ff0a4; }
.roll-show.bad .roll-line { color: #ff9a8a; }
.die.wobble { animation: wobble 1.8s ease-in-out 4; }
.die.rolling { animation: roll .65s cubic-bezier(.2, .7, .3, 1) both; }
.roll-btn { display: flex; flex-direction: column; align-items: center; gap: 18px; margin: 18px auto 6px; padding: 0; border: 0; background: none; width: 100%; }
.roll-btn:disabled { opacity: .9; }
.roll-lbl {
  display: block; width: 100%; padding: 20px 18px; border-radius: 20px; font-size: 25px; font-weight: 800; color: #062b0c;
  background: linear-gradient(#8ff087, #3fb04c); box-shadow: 0 5px 0 #1a5e24, 0 10px 22px #0006;
}
.roll-btn:active:not(:disabled) .roll-lbl { transform: translateY(3px); box-shadow: 0 2px 0 #1a5e24; }
.dice-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; justify-items: center; margin: 6px 0 4px; }
.die-btn { padding: 8px; border: 3px solid transparent; border-radius: 18px; background: #00000030; min-width: 88px; min-height: 88px; display: flex; align-items: center; justify-content: center; }
.die-btn.ok { border-color: var(--green); background: #1f5a2640; }
.die-btn .die { width: 64px; height: 64px; }

/* ------------------------------------------------------------------ banner, toasts, connection */
.banner { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; pointer-events: none; background: radial-gradient(ellipse 80% 22% at 50% 50%, #000000b0, transparent 75%); animation: fadein .2s both; }
.banner-t {
  font-family: Lobster, Georgia, serif; font-size: 60px; color: var(--gold2); text-align: center; padding: 0 20px;
  text-shadow: 0 4px 0 #6b3a10, 0 10px 24px #000c; animation: bannerpop 1.8s both;
}
#toasts { position: fixed; top: calc(74px + env(safe-area-inset-top)); left: 12px; right: 12px; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  max-width: 440px; padding: 12px 18px; border-radius: 14px; font-size: 17px; font-weight: 600; text-align: center;
  background: #2a1b10f2; border: 2px solid #c08a3e; box-shadow: 0 8px 24px #000a; animation: toastin .25s both;
  transition: opacity .4s, transform .4s;
}
.toast.err { border-color: var(--red); background: #3a150ef2; }
.toast.warn { border-color: var(--orange); }
.toast.out { opacity: 0; transform: translateY(-10px); }
.connbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 95; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: #8a2a1af2; color: #fff; font-size: 16px; font-weight: 600;
  transform: translateY(-110%); transition: transform .3s; pointer-events: none;
}
.connbar.on { transform: none; }

/* ------------------------------------------------------------------ animations */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetin { from { transform: translateY(100%); } to { transform: none; } }
@keyframes toastin { from { opacity: 0; transform: translateY(-14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: .35; } }
@keyframes bob { 50% { transform: translateY(-8px); } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 #ff5a3aaa; } 80%, 100% { box-shadow: 0 0 0 9px #ff5a3a00; } }
@keyframes wobble { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg) translateY(-6px); } }
@keyframes roll { 0% { transform: rotate(0) scale(1); } 40% { transform: rotate(400deg) scale(1.15) translateY(-20px); } 100% { transform: rotate(720deg) scale(1); } }
@keyframes doorpulse { 0%, 100% { outline-color: #ffd87700; transform: scale(1); } 50% { outline-color: #ffd877; transform: scale(1.02); } }
@keyframes kick { 0% { background: #fff0; transform: scale(1); } 30% { background: #fffb; transform: scale(1.04); } 100% { background: #fff0; transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-6px) rotate(-1deg); } 40% { transform: translateX(6px) rotate(1deg); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes bannerpop { 0% { opacity: 0; transform: scale(.4) rotate(-6deg); } 18% { opacity: 1; transform: scale(1.12) rotate(2deg); } 30% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.05) translateY(-20px); } }
@keyframes glowred { from { outline: 3px solid #ff8a4a00; outline-offset: 0; } to { outline: 3px solid #ff8a4a; outline-offset: 0; } }
@keyframes glowgold { from { outline: 3px solid #f3b84300; outline-offset: 0; } to { outline: 3px solid #f3b843; outline-offset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* small phones */
@media (max-width: 370px) {
  body { font-size: 17px; }
  .top-stat { min-width: 50px; }
  .top-stat b { font-size: 26px; }
  .hero-grid { gap: 8px; }
  .vs-num { font-size: 46px; }
  .btn-xl { font-size: 21px; }
}
/* tablets / landscape: keep the controller column readable */
@media (min-width: 640px) {
  .main > .now, .main > .tabpage { max-width: 620px; margin: 0 auto; }
}
/* narrow card rows: keep "За героев / За монстров" on one line */
.trow-body .wc-side .btn-ico { display: none; }
.trow-body .wc-side .btn { font-size: 16.5px; padding: 6px 4px; min-height: 54px; }
@media (max-width: 370px) {
  .join .card-panel { padding: 14px 12px; }
  .hero-grid { gap: 7px; }
  .hero-name { font-size: 12px; letter-spacing: -.3px; }
  .top-name { font-size: 21px; }
}

/* "you got" pop-up */
.got { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; background: #000a; animation: fadein .25s both; }
.got.out { opacity: 0; transition: opacity .4s; }
.got-panel { width: min(92vw, 420px); background: linear-gradient(#3a2414, #24160d); border: 2px solid var(--gold, #f3b843); border-radius: 22px; padding: 18px 16px 16px; text-align: center; box-shadow: 0 16px 40px #000c; }
.got-title { font: 400 30px Lobster, Georgia, serif; color: #ffd877; margin-bottom: 12px; }
.got-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.got-card { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 120px; font-size: 14px; font-weight: 700; line-height: 1.3; }
.got-card .card { --w: 110px; }
.got-sub { margin-top: 12px; font-size: 14px; color: #d9bf98; }

/* tips: the advisor's suggestions */
.panel.tips { padding: 12px 14px; border-color: #8a6a2c; background: linear-gradient(180deg, #3a2a14, #2a1d0f); }
.tips-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.tips-t { font-size: 15px; font-weight: 800; color: var(--gold2); letter-spacing: .2px; }
.tips-x { font: inherit; font-size: 14px; color: var(--muted); background: none; border: 0; padding: 8px 4px; cursor: pointer; }
.tip-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid #5b3e2266; }
.tip-row:first-of-type { border-top: 0; }
.tip-ico { font-size: 22px; line-height: 1; flex: none; width: 28px; text-align: center; }
.tip-cards { display: flex; gap: 4px; flex: none; }
.tip-card { padding: 0; border: 0; background: none; }
.tip-txt { flex: 1; min-width: 0; font-size: 16px; line-height: 1.4; color: var(--text); }
.btn.tip-do { min-height: 44px; font-size: 15px; padding: 6px 12px; border-radius: 12px; box-shadow: 0 3px 0 #9a5c16; }
.tips-pill { display: block; margin: 10px auto 0; font: inherit; font-size: 14px; font-weight: 700; color: var(--muted); background: #2c1d12; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; cursor: pointer; }
.tile.tipped { outline: 3px solid var(--gold2); outline-offset: 2px; }
.tip-badge {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%); white-space: nowrap; z-index: 3;
  font-size: 13px; font-weight: 800; padding: 2px 9px; border-radius: 10px; background: #2a1406; color: var(--gold2); border: 1px solid var(--gold);
}

/* language switch (Русский / עברית) */
.lang-pick { display: flex; justify-content: center; gap: 8px; margin: 10px auto 0; }
.lang-b { font: inherit; font-size: 15px; font-weight: 700; min-height: 40px; padding: 6px 16px; border-radius: 999px; cursor: pointer;
  color: var(--muted); background: #2c1d12; border: 1px solid var(--line); }
.lang-b.on { color: #2a1406; background: var(--gold); border-color: var(--gold2); }

/* Hebrew: bars grow from the right */
[dir=rtl] .tfill { transform-origin: right center; }
[dir=rtl] .vs-fill { transform-origin: right center; }

/* how to play: one short rule at a time while waiting */
.panel.howto { padding: 12px 14px; }
.howto-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.howto-title { font-size: 15px; font-weight: 800; color: var(--gold2); }
.howto-n { font-size: 13px; color: var(--muted); }
.howto-t { font-size: 16px; line-height: 1.45; color: var(--text); min-height: 4.4em; }
.howto-foot { display: flex; justify-content: flex-end; margin-top: 8px; }
.howto-next { font: inherit; font-size: 15px; font-weight: 700; min-height: 40px; padding: 6px 16px; border-radius: 999px; cursor: pointer; color: var(--text); background: #3a2414; border: 1px solid var(--line); }

/* tutorial coach: the real screen stays usable; the button to press is spotlit, Мерлиныч's bubble says what it does */
#coach { position: fixed; inset: 0; z-index: 95; pointer-events: none; }
#coach .coach-hole { position: fixed; display: none; border-radius: 16px; outline: 3px solid #ffd877; animation: coach-pulse 1.3s ease-in-out infinite; }
#coach.dim .coach-hole { box-shadow: 0 0 0 200vmax rgba(10, 5, 2, 0.6); }
@keyframes coach-pulse { 50% { outline-color: #ff9a40; outline-offset: 3px; } }
#coach .coach-bub { position: fixed; left: 12px; right: 12px; max-width: 460px; margin: 0 auto; padding: 14px 16px; border-radius: 18px; background: #fff7e6; color: #2a1406; box-shadow: 0 10px 30px #000a; pointer-events: auto; border: 3px solid #e8c37a; }
#coach .coach-bub.watch { background: #3a2410ee; color: #fbe9c8; border-color: #8a6a2c; }
#coach .coach-n { font-size: 13px; font-weight: 700; opacity: 0.7; margin-bottom: 4px; }
#coach .coach-t { font-size: 18px; font-weight: 800; line-height: 1.35; }
#coach .coach-bub .btn { margin-top: 10px; width: 100%; }

/* ============================================================ video call (phone_rtc.js) */
.rtc-me { position: fixed; z-index: 60; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rtc-me[hidden] { display: none !important; }
/* no top bar (lobby): a pill at the top right */
.rtc-me:not(.over) { top: calc(10px + env(safe-area-inset-top)); right: 10px; display: flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px;
  background: linear-gradient(180deg, #ffd877, #f0a92e); color: #2a1608; box-shadow: 0 4px 0 #9c6312, 0 8px 18px rgba(0, 0, 0, 0.45); }
[dir=rtl] .rtc-me:not(.over) { right: auto; left: 10px; padding: 6px 6px 6px 14px; }
.rtc-me:not(.over)::before { content: '🎥'; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.55); font-size: 20px; flex: none; }
.rtc-me:not(.over).on::before { display: none; }
.rtc-me .rtc-cta { display: flex; flex-direction: column; line-height: 1.1; text-align: start; }
.rtc-me .rtc-cta b { font-size: 14px; }
.rtc-me .rtc-cta small { font-size: 11px; opacity: 0.75; }
.rtc-me .rtc-self { display: none; width: 36px; height: 36px; border-radius: 50%; object-fit: cover; transform: scaleX(-1); background: #2a1608; flex: none; }
.rtc-me.on .rtc-self { display: block; }
.rtc-me .rtc-badge:empty { display: none !important; }
/* over my hero's face in the top bar: the live face replaces the picture */
.rtc-me.over { border-radius: 50%; background: transparent; overflow: visible; }
.rtc-me.over .rtc-cta { display: none; }
.rtc-me.over .rtc-self { width: 100%; height: 100%; }
.rtc-me.over.cam-off .rtc-self { display: none; }
.rtc-me.over .rtc-badge { position: absolute; right: -4px; bottom: -4px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px;
  background: #ffd877; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.rtc-me.over:not(.on) .rtc-badge { animation: rtc-nudge 2.4s ease-in-out infinite; }
@keyframes rtc-nudge { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.25); } 90% { transform: scale(0.95); } }
.rtc-me.asking { opacity: 0.7; pointer-events: none; }

.rtc-panel { position: fixed; inset: 0; z-index: 80; background: rgba(10, 5, 2, 0.6); display: flex; align-items: flex-end; justify-content: center; }
.rtc-sheet { width: min(520px, 100%); max-height: 88dvh; overflow: auto; background: linear-gradient(180deg, #3a2412, #23140a); border: 1px solid rgba(255, 216, 119, 0.25);
  border-radius: 22px 22px 0 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); color: #f6e7c8; box-shadow: 0 -16px 40px rgba(0, 0, 0, 0.6); animation: rtc-up 0.25s ease-out; }
@keyframes rtc-up { from { transform: translateY(40px); opacity: 0; } }
.rtc-head { display: flex; align-items: center; justify-content: space-between; }
.rtc-head b { font-size: 20px; }
.rtc-x { width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.1); color: inherit; font-size: 18px; }
.rtc-hint { font-size: 13px; opacity: 0.8; margin: 6px 0 14px; line-height: 1.35; }
.rtc-mine { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rtc-tog { display: grid; justify-items: center; gap: 2px; padding: 12px 8px; border-radius: 16px; border: 1.5px solid rgba(255, 255, 255, 0.15); background: rgba(0, 0, 0, 0.25); color: inherit; }
.rtc-tog span { font-size: 26px; }
.rtc-tog b { font-size: 15px; }
.rtc-tog small { font-size: 12px; opacity: 0.7; }
.rtc-tog.on { border-color: #4fd36a; background: rgba(79, 211, 106, 0.14); }
.rtc-lbl { margin: 16px 0 8px; font-size: 13px; font-weight: 700; opacity: 0.75; }
.rtc-list { display: grid; gap: 8px; }
.rtc-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); }
.rtc-face { width: 48px; height: 48px; border-radius: 50%; overflow: hidden; flex: none; border: 2px solid var(--hc, #ffcf5a); background: #2a1608; }
.rtc-face video, .rtc-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rtc-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rtc-name b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtc-name small { font-size: 12px; opacity: 0.7; }
.rtc-hush { border: 0; border-radius: 12px; padding: 9px 10px; font: inherit; font-size: 13px; font-weight: 700; background: rgba(255, 255, 255, 0.12); color: inherit; white-space: nowrap; }
.rtc-hush.on { background: #ffd877; color: #2a1608; }
.rtc-leave { width: 100%; margin-top: 16px; padding: 13px; border-radius: 14px; border: 1.5px solid rgba(255, 120, 90, 0.5); background: transparent; color: #ffb3a0; font: inherit; font-weight: 700; }
