/* Self-hosted copies of the fonts brownbiscuitgames.com uses (SIL Open Font License, latin subset):
   Outfit for headings, Manrope for body text, Poppins for buttons/accents. */
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 600 800; font-display: swap; src: url(/fonts/outfit.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/manrope.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/poppins-600.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/poppins-700.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --orange: #f26a2e;
  --orange-dark: #d24f17;
  --cream: #fff4e3;
  --paper: #fffaf2;
  --ink: #1d1a17;
  --muted: #6d625a;
  --purple: #7d7fc7;
  --good: #2f9e5a;
  --bad: #d23b3b;
  --radius: 12px;
  --shadow: 4px 4px 0 var(--ink);
  --display: 'Outfit', 'Trebuchet MS', sans-serif;
  --accent-font: 'Poppins', 'Manrope', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--orange);
  background-image: radial-gradient(rgba(255,255,255,.12) 1.5px, transparent 1.5px);
  background-size: 18px 18px;
  color: var(--ink);
  font-family: 'Manrope', system-ui, sans-serif;
  min-height: 100vh;
}

button, input { font: inherit; }

h1, h2, h3, .display { font-family: var(--display); letter-spacing: -0.01em; font-weight: 800; margin: 0; }

.btn {
  border: 3px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  padding: .55em 1.1em;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: #ffcf2e; }
.btn.go { background: var(--good); color: #fff; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.small { padding: .3em .7em; font-size: .85em; box-shadow: 2px 2px 0 var(--ink); }

.panel {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

input[type=text] {
  border: 3px solid var(--ink);
  border-radius: 10px;
  padding: .55em .8em;
  background: #fff;
  width: 100%;
}

/* ------------------------------------------------------------ home/lobby */

.home { max-width: 760px; margin: 0 auto; padding: 32px 16px 48px; }
.logo {
  font-family: var(--display);
  font-size: clamp(64px, 14vw, 120px);
  line-height: .9;
  color: #fff;
  text-shadow: 4px 4px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink);
  text-align: center;
  transform: rotate(-3deg);
}
.logo small { display: block; font-size: .33em; color: #ffcf2e; }
.tagline { text-align: center; color: #fff; font-weight: 800; margin: 12px 0 28px; text-shadow: 1px 1px 0 var(--ink); }
.home .panel { margin-bottom: 20px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1 1 200px; }
.label { font-weight: 800; margin: 12px 0 6px; display: block; }

.chars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.char {
  border: 3px solid var(--ink);
  border-radius: 10px;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  font-weight: 800;
  font-size: .8em;
  position: relative;
}
.char.sel { outline: 4px solid var(--orange-dark); outline-offset: 2px; }
.char.taken { opacity: .35; cursor: not-allowed; }
.avatar {
  /* Full rectangular character portrait: never cropped, no extra frame (the art has its own). */
  display: inline-flex; flex: none; height: 56px; aspect-ratio: 550 / 780;
  align-items: flex-end; justify-content: center;
}
.char .avatar { height: 76px; margin-bottom: 4px; }

.code {
  font-family: var(--display);
  font-size: 56px;
  letter-spacing: .15em;
  background: #ffcf2e;
  border: 3px solid var(--ink);
  border-radius: 10px;
  padding: 0 16px;
  display: inline-block;
}
.plist { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 8px; }
.plist li { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 6px 10px; }
.plist .name { font-weight: 800; flex: 1; }
.tag { font-size: .7em; font-weight: 800; border: 2px solid var(--ink); border-radius: 6px; padding: 1px 6px; background: #eee; }
.tag.host { background: #ffcf2e; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); border: 2px solid var(--ink); flex: none; }
.dot.off { background: #bbb; }

/* ------------------------------------------------------------ game */

.game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  grid-template-areas: "top top" "board log";
  gap: 14px;
  padding: 14px;
  max-width: 1500px;
  margin: 0 auto;
}
.topbar { grid-area: top; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 14px; position: sticky; top: 0; z-index: 20; }
.topbar .title { font-family: var(--display); font-size: 30px; color: var(--orange-dark); }
.stat { display: flex; align-items: center; gap: 6px; font-weight: 800; }
.meter { width: 160px; height: 16px; border: 2px solid var(--ink); border-radius: 8px; background: #fff; overflow: hidden; }
.meter > div { height: 100%; background: var(--orange); }
.final { background: var(--bad); color: #fff; font-family: var(--display); padding: 2px 10px; border-radius: 8px; border: 2px solid var(--ink); font-size: 20px; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { transform: scale(1.06); } }
.spacer { flex: 1; }

.side { grid-area: log; min-width: 0; display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow-y: auto; }
.log { display: flex; flex-direction: column; flex: 1 1 0; min-height: 160px; }
.log h3 { font-size: 24px; margin-bottom: 8px; }
.log ol { list-style: none; padding: 0; margin: 0; overflow-y: auto; font-size: .85em; display: flex; flex-direction: column; gap: 4px; }
.log li { padding: 4px 6px; border-radius: 6px; background: #fff; border: 1px solid #e5d8c5; }
.log li.round { background: var(--ink); color: #fff; font-weight: 800; text-align: center; }

.empty { color: var(--muted); font-size: .85em; font-style: italic; }

.phases { display: flex; gap: 6px; flex-wrap: wrap; }
.phases span { border: 2px solid var(--ink); border-radius: 8px; padding: 2px 10px; font-weight: 800; font-size: .85em; background: #fff; }
.phases span.on { background: var(--ink); color: #fff; }
.timer { font-weight: 800; color: var(--bad); }

.section-title { font-family: var(--display); font-size: 22px; margin-top: 14px; }

/* ------------------------------------------------------------ cards */

.card {
  --c: #888;
  width: 150px;
  min-height: 206px;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 12px;
  transition: transform .12s;
  text-align: left;
  padding: 0;
  color: var(--ink);
}
.card .band { background: var(--c); color: #fff; padding: 6px 8px 5px; min-height: 64px; position: relative; }
.card .type { font-size: 9px; font-weight: 800; text-transform: uppercase; background: var(--ink); color: #fff; display: inline-block; padding: 1px 5px; border-radius: 4px; }
.card .nm { font-family: var(--display); font-size: 21px; line-height: 1; margin-top: 4px; text-shadow: 1px 1px 0 rgba(0,0,0,.4); }
.card .sub { font-size: 10px; font-weight: 800; opacity: .95; }
.card .badge {
  position: absolute; top: 5px; right: 5px; width: 26px; height: 26px; border-radius: 6px;
  background: #fff; color: var(--ink); border: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px;
}
.card .icon { font-size: 30px; text-align: center; padding: 8px 0 2px; }
.card .text { padding: 2px 8px 8px; flex: 1; font-weight: 600; line-height: 1.25; }
.card .foot { display: flex; border-top: 2px solid var(--ink); font-weight: 800; }
.card .foot div { flex: 1; text-align: center; padding: 4px 0; }
.card .foot div + div { border-left: 2px solid var(--ink); }
.card .catname { font-size: 9px; font-weight: 800; text-transform: uppercase; color: var(--muted); padding: 0 8px 6px; }

.card.mini { width: 112px; min-height: 0; font-size: 10px; box-shadow: 2px 2px 0 var(--ink); }
.card.mini .band { min-height: 0; padding: 4px 6px; }
.card.mini .nm { font-size: 15px; }
.card.mini .sub, .card.mini .text, .card.mini .icon, .card.mini .catname, .card.mini .type { display: none; }
.card.mini .badge { width: 18px; height: 18px; font-size: 11px; top: 3px; right: 3px; }

.card.big { width: 190px; min-height: 250px; font-size: 13px; }
.card.big .nm { font-size: 26px; }

button.card { cursor: pointer; }
button.card.playable:hover { transform: translateY(-6px); }
button.card.unplayable { opacity: .6; cursor: not-allowed; }
button.card.sel { transform: translateY(-10px); outline: 4px solid #ffcf2e; outline-offset: 2px; }
.card.targetable { outline: 4px dashed var(--bad); outline-offset: 2px; cursor: crosshair; }

.upkeep-list { display: grid; gap: 8px; margin-top: 10px; }
.upkeep-row { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 6px 10px; }
.upkeep-row .nm { flex: 1; font-weight: 800; }
.toggle { display: inline-flex; border: 2px solid var(--ink); border-radius: 8px; overflow: hidden; }
.toggle button { border: 0; background: #fff; padding: 4px 10px; font-weight: 800; cursor: pointer; }
.toggle button.on { background: var(--ink); color: #fff; }

/* ------------------------------------------------------------ overlays */

.modal-bg { position: fixed; inset: 0; background: rgba(29,26,23,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { max-width: 560px; width: 100%; max-height: 90vh; overflow-y: auto; }
.modal h2 { font-size: 36px; color: var(--orange-dark); }
.modal .center { display: flex; justify-content: center; margin: 12px 0; }
.rank { list-style: none; padding: 0; display: grid; gap: 8px; }
.rank li { display: flex; gap: 10px; align-items: center; background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 8px 12px; font-weight: 800; }
.rank li:first-child { background: #ffcf2e; font-size: 1.15em; }
.rules h3 { font-size: 22px; margin-top: 14px; color: var(--orange-dark); }
.rules p, .rules li { font-size: .92em; line-height: 1.45; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 800; z-index: 100;
  max-width: calc(100vw - 32px);
}

@media (max-width: 980px) {
  .game { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "board" "log"; }
  .log { max-height: 320px; }
  .chat { flex: none; height: 440px; }
}
@media (max-width: 640px) {
  .game { padding: 8px; gap: 10px; }
  .chars { grid-template-columns: repeat(3, 1fr); }
  .card { width: calc(50% - 5px); }
  .card.mini { width: 100px; }
  .meter { width: 100px; }
  .code { font-size: 40px; }
}

/* <button> cards don't stretch flex children by default in every browser. */
.card > .band, .card > .foot, .card > .text, .card > .icon, .card > .catname { width: 100%; align-self: stretch; }

/* ------------------------------------------------------------ chat */

.chat { display: flex; flex-direction: column; flex: 1 1 0; min-height: 260px; }
.chat h3 { font-size: 24px; margin-bottom: 8px; }
.home .chat { margin-top: 20px; max-height: 420px; }
#chat-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-height: 60px; }
#chat-list li { display: flex; gap: 8px; align-items: flex-start; font-size: .88em; }
#chat-list li > div { background: #fff; border: 1px solid #e5d8c5; border-radius: 10px; padding: 4px 9px; min-width: 0; max-width: 85%; }
#chat-list li.mine { flex-direction: row-reverse; }
#chat-list li.mine > div { background: #ffe9a8; border-color: #e6c35c; }
#chat-list li.empty { color: var(--muted); font-style: italic; }
#chat-list .meta { font-size: .78em; color: var(--muted); }
#chat-list .meta b { color: var(--ink); }
#chat-list .msg { overflow-wrap: anywhere; }
.quick { display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px 6px; flex: none; }
.quick .btn { font-size: .75em; padding: .25em .6em; }
.chat-form { display: flex; gap: 8px; flex: none; }
.chat-form input { flex: 1; min-width: 0; padding: .45em .7em; }
.badge-count { background: var(--bad); color: #fff; border-radius: 999px; padding: 0 6px; font-size: .8em; margin-left: 2px; }

/* ------------------------------------------------------------ animations
   Classes below are applied only on the render where the change happened
   (see computeFx in app.js), so they play once. Fill mode "backwards" keeps
   hover/selected transforms working once an animation has finished. */

@keyframes deal {
  from { transform: translate(-60px, -80px) rotate(-14deg) scale(.7); opacity: 0; }
  70% { transform: translate(0, 4px) rotate(2deg) scale(1.02); opacity: 1; }
}
.card.deal { animation: deal .5s cubic-bezier(.2, .8, .3, 1) backwards; animation-delay: calc(var(--i, 0) * 80ms); }

@keyframes place {
  0% { transform: scale(.2) rotate(12deg); opacity: 0; }
  60% { transform: scale(1.12) rotate(-3deg); opacity: 1; }
  80% { transform: scale(.96) rotate(1deg); }
}
.card.place { animation: place .55s cubic-bezier(.3, 1.4, .5, 1) backwards; }

@keyframes flip {
  0% { transform: perspective(600px) rotateY(90deg) scale(.8); }
  60% { transform: perspective(600px) rotateY(-12deg) scale(1.06); }
}
.card.flip { animation: flip .7s ease-out backwards; }

@keyframes hit {
  0%, 100% { transform: none; }
  15% { transform: translateX(-8px) rotate(-1deg); }
  30% { transform: translateX(7px) rotate(1deg); }
  45% { transform: translateX(-5px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}
.panel.hit { animation: hit .55s ease-in-out; box-shadow: 4px 4px 0 var(--bad); }

@keyframes quake {
  0%, 100% { transform: none; }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(4px, -2px); }
  60% { transform: translate(-3px, 1px); }
  80% { transform: translate(2px, -1px); }
}
.table.quake { animation: quake .6s ease-in-out; }

@keyframes pulse-chip {
  0% { transform: scale(1); }
  35% { transform: scale(1.28); box-shadow: 0 0 0 4px rgba(255, 207, 46, .7); }
  100% { transform: scale(1); }
}
.tok.pulse { animation: pulse-chip .6s ease-out; }

@keyframes glow {
  from { outline-color: #ffcf2e; box-shadow: var(--shadow); }
  to { outline-color: #ffe48a; box-shadow: var(--shadow), 0 0 22px 4px rgba(255, 207, 46, .55); }
}
.seat.turn { animation: glow 1.2s ease-in-out infinite alternate; }
.seat.hit { animation: hit .55s ease-in-out; box-shadow: 4px 4px 0 var(--bad); }
.seat.turn.hit { animation: hit .55s ease-in-out, glow 1.2s ease-in-out infinite alternate; }

.meter > div { transition: width .9s cubic-bezier(.4, 0, .2, 1); }

@keyframes chat-in { from { transform: translateY(10px) scale(.96); opacity: 0; } }
#chat-list li.new { animation: chat-in .3s ease-out backwards; }

@keyframes modal-pop { from { transform: scale(.8) translateY(20px); opacity: 0; } }
.modal.pop { animation: modal-pop .35s cubic-bezier(.3, 1.4, .5, 1) backwards; }

@keyframes tick-pulse { 50% { transform: scale(1.15); } }
.timer.urgent { animation: tick-pulse .5s ease-in-out infinite; display: inline-block; }

/* Floating +/- numbers next to coin and customer chips */
.float {
  position: fixed;
  z-index: 90;
  pointer-events: none;
  transform: translate(-50%, 0);
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: .03em;
  white-space: nowrap;
  text-shadow: 2px 2px 0 var(--ink), -1px -1px 0 var(--ink), 1px -1px 0 var(--ink), -1px 1px 0 var(--ink);
  animation: float-up 1.3s ease-out forwards;
}
.float.up { color: #ffcf2e; }
.float.down { color: #ff7b7b; }
@keyframes float-up {
  0% { transform: translate(-50%, 6px) scale(.6); opacity: 0; }
  15% { transform: translate(-50%, -8px) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -56px) scale(1); opacity: 0; }
}

/* Big announcement banner (your turn, final round, bankrupt) */
.banner {
  position: fixed;
  top: 22%;
  left: 50%;
  z-index: 95;
  pointer-events: none;
  font-family: var(--display);
  font-size: clamp(36px, 8vw, 72px);
  color: #fff;
  background: var(--orange);
  border: 4px solid var(--ink);
  border-radius: 16px;
  box-shadow: 6px 6px 0 var(--ink);
  padding: 6px 28px;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  text-align: center;
  text-shadow: 3px 3px 0 var(--ink);
  animation: banner 2s cubic-bezier(.3, 1.4, .5, 1) forwards;
}
.banner.turn { background: var(--good); }
.banner.bad { background: var(--bad); }
.banner.start { background: #ffcf2e; color: var(--ink); text-shadow: none; }
@keyframes banner {
  0% { transform: translate(-50%, -40px) rotate(-6deg) scale(.4); opacity: 0; }
  15% { transform: translate(-50%, 0) rotate(-3deg) scale(1.05); opacity: 1; }
  25% { transform: translate(-50%, 0) rotate(-3deg) scale(1); }
  80% { transform: translate(-50%, 0) rotate(-3deg) scale(1); opacity: 1; }
  100% { transform: translate(-50%, 20px) rotate(-3deg) scale(.9); opacity: 0; }
}

/* Confetti for the end of the game */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.confetti i {
  position: absolute;
  top: -20px;
  width: 10px;
  height: 14px;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); }
}

/* Steam rising from the logo's chai */
.logo { position: relative; }
.steam { position: absolute; left: 50%; top: -34px; display: flex; gap: 10px; transform: translateX(-50%); }
.steam span {
  width: 8px; height: 30px; border-radius: 50%;
  background: rgba(255, 255, 255, .75);
  filter: blur(3px);
  animation: steam 2.4s ease-in-out infinite;
}
.steam span:nth-child(2) { animation-delay: .6s; }
.steam span:nth-child(3) { animation-delay: 1.2s; }
@keyframes steam {
  0% { transform: translateY(14px) scaleX(.6); opacity: 0; }
  40% { opacity: .9; }
  100% { transform: translateY(-26px) scaleX(1.4) rotate(12deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .steam, .float, .confetti { display: none !important; }
}

/* ------------------------------------------------------------ official artwork */

.ico { height: 1.15em; width: auto; vertical-align: -0.22em; }
.card-ico { height: 1.35em; border-radius: 2px; }
.waiter-ico { height: 1.35em; }

.avatar img { width: 100%; height: 100%; object-fit: contain; display: block; }

.card .badge { background: #fff; }
.card .badge img { width: 72%; height: 72%; object-fit: contain; }
.card .icon { display: flex; justify-content: center; }
.card .icon .cat-ico { height: 34px; width: auto; }
.card.big .icon .cat-ico { height: 44px; }
.card .foot .ico { height: 1.2em; }

.logo { display: flex; flex-direction: column; align-items: center; }
.logo-img {
  width: min(420px, 82vw);
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 22px;
  box-shadow: 6px 6px 0 var(--ink);
  padding: 10px 26px;
}
.logo small { margin-top: 6px; }
.fan { display: flex; justify-content: center; margin: 14px 0 -6px; }
.fan-img { width: min(460px, 90%); filter: drop-shadow(4px 6px 0 rgba(29, 26, 23, .35)); }
.title-logo { height: 40px; width: auto; }


.phases span { display: inline-flex; align-items: center; gap: 5px; }
.phases .ico { height: 20px; background: #fff; border-radius: 50%; padding: 1px; }

.icon-legend { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; }
.icon-legend img { height: 22px; width: 22px; object-fit: contain; vertical-align: middle; margin-right: 6px; }

/* Dhaba news: actor portrait (→ target), event icon, text */
.log h3 .ico { height: .9em; vertical-align: -0.05em; }
.log li.news { display: flex; gap: 7px; align-items: flex-start; border-left: 4px solid #e5d8c5; }
.news .who { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.news .who:empty { display: none; }
.news .who .avatar { height: 34px; }
.news .arrow { font-size: .75em; color: var(--muted); }
.news .what { min-width: 0; overflow-wrap: anywhere; }
.news .icons { display: inline-flex; gap: 3px; margin-right: 5px; vertical-align: -0.3em; }
.news .icons .ico { height: 18px; width: auto; }
.log li.news.good { border-left-color: var(--good); }
.log li.news.bad { border-left-color: var(--bad); background: #fff6f5; }
.log li.news.attack { border-left-color: var(--orange); }
.log li.news.event { border-left-color: #5d73b8; background: #eef0ff; font-weight: 600; }
.log li.news.quiet { opacity: .6; }
.connecting { text-align: center; font-weight: 800; font-size: 1.1em; margin-top: 30vh; }

/* Outfit is a geometric sans: give every display-font element a heavy weight and tighter tracking
   (the old values were tuned for Bangers). */
.code, .topbar .title, .final, .section-title, .card .nm, .float, .banner, .logo small {
  font-weight: 800;
}
.card .nm { font-size: 17px; letter-spacing: -0.01em; line-height: 1.05; }
.card.mini .nm { font-size: 13px; }
.card.big .nm { font-size: 22px; }
.code { letter-spacing: .1em; }
.float, .banner { letter-spacing: -0.01em; }
.btn, .tok, .tag, .phases span, .type, .quick .btn { font-family: var(--accent-font); font-weight: 600; }
.you-are { display: flex; align-items: center; gap: 12px; margin-top: 14px; background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 8px 12px; }
.you-are b { display: block; font-family: var(--display); font-size: 1.25em; }

/* ------------------------------------------------------------ copyright / footer */
.copyright .notice { background: #fff4d6; border: 2px solid var(--ink); border-radius: 10px; padding: 10px 12px; margin: 10px 0 4px; line-height: 1.45; }
.copyright a, .site-foot a { color: var(--orange-dark); font-weight: 700; }
.copyright .row { gap: 10px; }
.site-foot { text-align: center; color: #fff; font-size: .85em; margin-top: 22px; text-shadow: 1px 1px 0 rgba(29, 26, 23, .5); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: #fff; font-weight: 800; text-decoration: underline; cursor: pointer; }

/* Hand Reset (once per game) */
.actions.confirm-reset { background: #fff4d6; border: 2px solid var(--ink); border-radius: 10px; padding: 10px 12px; }
.actions.confirm-reset .ico { height: 1.4em; }

/* Name entry */
input.invalid { border-color: var(--bad); box-shadow: 0 0 0 3px rgba(210, 59, 59, .25); }
.field-error { color: var(--bad); font-weight: 800; font-size: .9em; margin-top: 6px; }
.joining { font-weight: 800; margin-bottom: 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.code.small-code { font-size: 28px; padding: 0 10px; }
.or { color: var(--muted); font-weight: 700; font-size: .9em; }
.you-are .grow { min-width: 0; }
.rename { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.rename label { font-size: .85em; font-weight: 800; color: var(--muted); }
.rename input { flex: 1 1 140px; min-width: 0; padding: .35em .6em; }

/* Leave / back-to-lobby confirmations */
.modal.confirm { max-width: 440px; }
.modal.confirm h2 { font-size: 28px; }

/* "Buy the real game" call to action on the results screen */
.buy-cta {
  display: flex; gap: 14px; align-items: center; margin-top: 14px; padding: 12px;
  background: #fff4d6; border: 3px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink); text-decoration: none; transition: transform .1s;
}
.buy-cta:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.buy-cta b { display: block; font-family: var(--display); font-size: 1.2em; margin-bottom: 2px; }
.buy-cta > span { font-size: .9em; line-height: 1.4; }
.buy-img { width: 120px; flex: none; }
.buy-btn { display: inline-block; margin-top: 8px; }
.site-foot a.linkish { color: #fff; }
@media (max-width: 480px) { .buy-cta { flex-direction: column; text-align: center; } .buy-img { width: 160px; } }
.buy-cta > span { display: flex; flex-direction: column; align-items: flex-start; }
.buy-btn { margin-top: 10px; }
@media (max-width: 480px) { .buy-cta > span { align-items: center; } }

/* ------------------------------------------------------------ the table: a top-down view of the board
   Seats sit around a wooden table with the decks, customer pool, bank and event in the middle.
   On wide screens the whole table fits in one view (no page scrolling). */

.game { grid-template-rows: auto minmax(0, 1fr); }
@media (min-width: 981px) {
  .game { height: 100vh; min-height: 660px; }
}

.table {
  grid-area: board;
  position: relative;
  display: grid;
  gap: 10px;
  padding: 16px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border: 3px solid var(--ink);
  border-radius: 30px;
  box-shadow: var(--shadow), inset 0 0 0 10px #7a4724, inset 0 0 0 12px rgba(29, 26, 23, .55), inset 0 0 80px 10px rgba(60, 30, 10, .35);
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(20% - 2px), rgba(70, 35, 12, .3) calc(20% - 2px) 20%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .045) 0 2px, transparent 2px 7px),
    radial-gradient(ellipse at 50% 40%, #cf9762, #a96d3b 75%);
}
/* Opponents sit across the table from you; the middle of the table runs the full width between. */
.table.n1 { grid-template: "top" auto "center" minmax(auto, 1fr) "me" auto / minmax(0, 1fr); }
.table.n2 { grid-template: "tl tr" auto "center center" minmax(auto, 1fr) "me me" auto / minmax(0, 1fr) minmax(0, 1fr); }
.table.n3 { grid-template: "left top right" auto "center center center" minmax(auto, 1fr) "me me me" auto / minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }
.table.n4 { grid-template: "left tl tr right" auto "center center center center" minmax(auto, 1fr) "me me me me" auto / minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); }

/* A player's mat */
.seat {
  --pc: var(--orange);
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px 10px 10px;
  background: rgba(255, 250, 242, .96);
  border: 3px solid var(--ink);
  border-top: 9px solid var(--pc);
  border-radius: 14px;
  box-shadow: 3px 4px 0 rgba(29, 26, 23, .7);
  align-self: start;
}
.seat:not(.seat-me) { align-self: stretch; }
.seat.turn { outline: 4px solid #ffcf2e; outline-offset: 2px; }
.seat.out { opacity: .55; filter: grayscale(1); }
.seat.targetable { outline: 4px dashed var(--bad); outline-offset: 2px; cursor: crosshair; }
.seat-head { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.seat-head .who { flex: 1 1 90px; min-width: 0; }
.seat-head .who b { display: block; font-family: var(--display); font-size: 1.05em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-head .who span { display: block; font-size: .75em; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-head { position: static; }
.turn-token { position: absolute; top: -20px; right: 10px; height: 32px; width: auto; z-index: 2; filter: drop-shadow(2px 2px 0 rgba(29, 26, 23, .45)); animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-3px) rotate(-6deg); } }
.doing { position: absolute; top: -13px; left: 12px; z-index: 2; font-family: var(--accent-font); font-weight: 600; font-size: .72em; background: var(--ink); color: #fff; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.doing.bad { background: var(--bad); }
.dots { display: inline-flex; gap: 2px; margin-left: 4px; vertical-align: middle; }
.dots i { width: 4px; height: 4px; border-radius: 50%; background: #ffcf2e; animation: dot 1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-3px); opacity: 1; } }
.target-btn { pointer-events: none; position: absolute; top: -16px; right: 8px; z-index: 3; }

.seat-body { display: flex; gap: 8px 12px; align-items: center; min-width: 0; }
.stash { display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.tok {
  display: inline-flex; align-items: center; gap: 3px;
  background: #fff; border: 2px solid var(--ink); border-radius: 10px;
  padding: 1px 7px 1px 4px; font-size: .9em; white-space: nowrap;
}
.tok img { height: 22px; width: auto; }
.tok b { font-weight: 700; }
.tok small { color: var(--muted); font-size: .78em; }
.tok.coins { background: #fff1d2; }
.tok.coins .stack { display: inline-flex; }
.tok.coins .stack img + img { margin-left: -14px; }
.tok.coins img.none { opacity: .3; }
.tok.cust { background: #fff6c8; }
.tok.reset { font-size: .8em; padding: 2px 6px; position: relative; background: #e6f6ec; border-color: var(--good); color: #1d6b3d; }
.tok.reset.used { background: #eee; border-color: #bbb; color: var(--muted); }
.tok.reset.used::after { content: ''; position: absolute; left: 3px; right: 3px; top: 50%; border-top: 2px solid var(--bad); transform: rotate(-35deg); }
.stash { flex-wrap: nowrap; }

.fan-backs { position: relative; width: 90px; height: 48px; flex: none; }
.fan-backs span { position: absolute; left: 50%; bottom: 0; width: 28px; transform-origin: 50% 130%; transform: translateX(-50%) rotate(calc((var(--i) - (var(--n) - 1) / 2) * 11deg)); }
.fan-backs img { width: 100%; display: block; border-radius: 3px; box-shadow: 1px 1px 0 rgba(29, 26, 23, .5); }
.fan-backs .count { position: absolute; right: -4px; bottom: -4px; background: var(--ink); color: #fff; border-radius: 999px; font-size: .75em; padding: 0 7px; font-family: var(--accent-font); }

/* Attractions lie side by side, overlapping more as they run out of room (--k = how many). */
.seat .tableau { --w: 98px; flex: 1 1 0; min-width: 0; display: flex; flex-wrap: nowrap; min-height: 20px; align-items: flex-start; }
.seat .tableau > .card { flex: none; width: min(var(--w), 100%); }
.seat .tableau > .card + .card { margin-left: min(6px, calc((100% - var(--k) * var(--w)) / max(1, var(--k) - 1))); }
.seat .tableau > .card:hover { z-index: 3; }

/* Your mat: dhaba on the left, hand and controls on the right */
.seat-me .seat-body { display: grid; grid-template-columns: minmax(230px, 1fr) minmax(0, 2.6fr); gap: 14px; align-items: start; }
.seat-me .seat-head .stash { flex: 1 1 100%; flex-wrap: wrap; }
.seat-me .hand { align-self: center; }
.seat-me .tableau { flex: none; width: 100%; }
.mat-left, .mat-right { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.seat-me .section-title { font-size: 15px; margin: 2px 0 0; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.seat-me .hand { display: flex; gap: 8px; padding-top: 10px; }
.seat-me .hand .card { flex: 0 1 124px; width: auto; min-width: 0; min-height: 0; font-size: 10.5px; }
.seat-me .hand .card .catname { display: none; }
.seat-me .hand .card .band { min-height: 52px; padding: 5px 7px 4px; }
.seat-me .hand .card .nm { font-size: 15px; }
.card .cat-mini { display: none; }
.seat-me .hand .card .icon { display: none; }
.seat-me .hand .card .cat-mini { display: inline-block; height: 14px; width: 14px; object-fit: contain; vertical-align: -3px; margin-right: 3px; background: #fff; border-radius: 50%; padding: 1px; }
.seat-me .hand .card .text { padding: 4px 7px 5px; line-height: 1.18; font-size: .95em; }
/* Your turn's controls get their own row in the top bar, so they stay in view. */
.topbar .actions { flex: 1 1 100%; display: flex; gap: 6px 8px; flex-wrap: wrap; align-items: center; justify-content: center; font-size: .9em; border-top: 2px dashed #e5d8c5; padding-top: 8px; }
.topbar .actions .spacer { display: none; }
.topbar .actions .btn { padding: .3em .75em; font-size: .88em; box-shadow: 2px 2px 0 var(--ink); }
.turn-info .phases .timer { border: 0; background: none; padding: 1px 2px; }
.seat-me .upkeep-row { flex-wrap: wrap; gap: 6px; padding: 4px 8px; font-size: .9em; }
.table.my-turn .seat-me { box-shadow: 3px 4px 0 rgba(29, 26, 23, .7), 0 0 0 4px rgba(255, 207, 46, .4); }

/* The middle of the table */
.table-center {
  grid-area: center;
  position: relative;
  min-width: 0;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-evenly; gap: 10px 24px;
  padding: 11px 18px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 26px;
  outline: 2px dashed #d89a5a;
  outline-offset: -10px;
  box-shadow: 3px 4px 0 rgba(29, 26, 23, .55);
}
.piles { display: flex; gap: 12px; flex-wrap: nowrap; justify-content: center; align-items: flex-end; }
.pile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; font-weight: 800; }
.pile label { font-size: .68em; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.pile-img { width: 50px; display: block; border-radius: 6px; box-shadow: 2px 2px 0 var(--ink), 4px 4px 0 rgba(29, 26, 23, .3); }
.pile .count { position: absolute; top: -8px; right: -10px; min-width: 22px; text-align: center; background: var(--ink); color: #fff; border-radius: 999px; font-size: .72em; padding: 0 6px; font-family: var(--accent-font); z-index: 1; }
.pile .slot { display: block; width: 50px; height: 70px; border: 2px dashed #c9b394; border-radius: 8px; }
.pile.discard .card.mini { width: 80px; }
.pile .card.small { width: 104px; min-height: 0; font-size: 9.5px; box-shadow: 2px 2px 0 var(--ink); }
.pile .card.small .band { min-height: 0; padding: 4px 6px; }
.pile .card.small .nm { font-size: 14px; }
.pile .card.small .icon { padding: 3px 0 0; }
.pile .card.small .icon .cat-ico { height: 22px; }
.pile .card.small .text, .pile .card.small .icon { display: none; }
.pile .card.small .catname { padding: 4px 6px 5px; }
.pile.event.live .card { outline: 4px solid #ffcf2e; outline-offset: 2px; }
.heap { position: relative; width: 80px; height: 64px; }
.pool label b { font-family: var(--display); font-size: 1.5em; color: var(--ink); letter-spacing: 0; }
.heap span { position: absolute; }
.heap img { height: 24px; width: auto; display: block; filter: drop-shadow(1px 2px 0 rgba(29, 26, 23, .35)); }
.pool b { font-family: var(--display); font-size: 20px; line-height: 1; }
.pool b small { font-size: .6em; color: var(--muted); }
.pool .meter { width: 80px; height: 10px; }
.turn-info { text-align: center; flex: 1 1 300px; max-width: 720px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.turn-info h2 { font-size: 22px; color: var(--orange-dark); line-height: 1.1; }
.turn-info .ph-body { font-size: .85em; }
.turn-info .phases { justify-content: center; margin-top: 2px; }
.turn-info .phases span { font-size: .72em; padding: 1px 7px; }
.spot { position: absolute; left: 50%; top: 50%; width: 1px; height: 1px; pointer-events: none; }

/* Things flying across the table (see ChaiFX.flyPath) */
.flyer { position: fixed; z-index: 85; pointer-events: none; opacity: 0; will-change: transform, opacity; width: max-content; }
.flyer > .card { width: 150px; box-shadow: 6px 8px 0 rgba(29, 26, 23, .45); }
.flyer > .card.mini { width: 98px; }
.flyer .tok-img { height: 26px; width: auto; display: block; filter: drop-shadow(2px 2px 0 rgba(29, 26, 23, .45)); }
.flyer .back-img { width: 106px; display: block; border-radius: 8px; box-shadow: 2px 2px 0 var(--ink); }
.flyer .cup-img { height: 30px; width: auto; display: block; }

.fx-caption {
  position: fixed; z-index: 86; pointer-events: none;
  transform: translate(-50%, 0);
  max-width: min(90vw, 560px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--ink); color: #fff; border: 3px solid #ffcf2e; border-radius: 12px;
  padding: 6px 16px; font-family: var(--display); font-weight: 800; font-size: 20px;
  box-shadow: 4px 4px 0 rgba(29, 26, 23, .4);
  opacity: 0; animation: fx-caption 1.3s ease both;
}
@keyframes fx-caption {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.9); }
  15%, 85% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -6px); }
}
.fx-bubble {
  position: fixed; z-index: 84; pointer-events: none;
  max-width: 260px; background: #fff; border: 3px solid var(--ink); border-radius: 12px;
  padding: 4px 11px; font-weight: 800; font-size: .82em; line-height: 1.3;
  box-shadow: 3px 3px 0 var(--ink);
  animation: fx-bubble 2.6s ease both;
}
.fx-bubble::after { content: ''; position: absolute; left: 50%; bottom: -13px; transform: translateX(-50%); border: 8px solid transparent; border-top-color: var(--ink); }
@keyframes fx-bubble {
  0% { opacity: 0; transform: translate(-50%, -100%) scale(.7); }
  10%, 85% { opacity: 1; transform: translate(-50%, calc(-100% - 12px)) scale(1); }
  100% { opacity: 0; transform: translate(-50%, calc(-100% - 22px)); }
}

@media (max-width: 1250px) {
  .seat-me .seat-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  /* Phones: opponents two to a row above the middle of the table, your mat below. */
  .table, .table.n1, .table.n2, .table.n3, .table.n4 { grid-template: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 16px 12px; border-radius: 22px; gap: 8px; }
  .table > * { grid-area: auto !important; }
  .table > .table-center, .table > .seat-me, .table.n1 > .seat-top { grid-column: 1 / -1 !important; }
  .seat { align-self: stretch; padding: 7px 8px 8px; }
  .seat:not(.seat-me) .stash { flex-wrap: wrap; }
  .seat:not(.seat-me) .tok { font-size: .8em; }
  .seat:not(.seat-me) .seat-body { flex-wrap: wrap; }
  .seat:not(.seat-me) .tableau { flex-basis: 100%; }
  .piles { flex-wrap: wrap; gap: 12px; }
  .seat-me .hand { flex-wrap: wrap; }
  .seat-me .hand .card { flex: 0 0 calc((100% - 16px) / 3); }
}
@media (prefers-reduced-motion: reduce) {
  .flyer, .fx-caption, .fx-bubble { display: none !important; }
}
.table.n1 .seat-top { justify-self: center; width: min(100%, 620px); }

/* Narrow opponent mats (5 players, smaller windows): compact tokens so everything stays inside the mat. */
.seat:not(.seat-me) { container-type: inline-size; }
.seat .tableau { overflow: hidden; padding: 4px; margin: -4px; }
@container (max-width: 250px) {
  .stash { gap: 3px; }
  .tok { font-size: .8em; padding: 1px 5px 1px 3px; gap: 2px; border-radius: 8px; }
  .tok img { height: 18px; }
  .seat-body { gap: 6px; }
  .fan-backs { width: 64px; }
  .fan-backs span { width: 24px; }
  .seat .tableau { --w: 90px; }
}
@container (max-width: 205px) {
  .stash { flex-wrap: wrap; }
}
.seat-me .hand .card .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Lobby: game mode picker (only on sites that offer several modes) */
.mode-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mode-pick .btn:disabled { opacity: .55; cursor: default; }
.mode-pick .btn.sel:disabled { opacity: 1; }
.mode-pick .hint { font-size: .85em; color: var(--muted); }
