/* =====================================================
   Package Tycoon: cozy cartoon theme
   ===================================================== */
:root {
  --ink: #2b2340;
  --ink-soft: #6b6385;
  --cream: #fff8ec;
  --paper: #fffdf8;
  --sun: #ffd166;
  --mint: #5fd3a5;
  --coral: #ff7b7b;
  --sky: #7cc6fe;
  --lilac: #b79cff;
  --peach: #ffb385;
  --line: 3px solid var(--ink);
  --pop: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Fredoka", "Segoe UI Rounded", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-weight: 500;
  background: #ffe9cf;
  color: var(--ink);
  user-select: none;
}

canvas { display: block; }
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; }
.good { color: #1f9e6e; }
.bad { color: #e8505b; }
.muted { color: var(--ink-soft); }
b { font-weight: 700; }
small { font-size: 0.78em; }

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0 5px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  box-shadow: 0 2px 0 var(--ink);
  font: inherit;
  font-size: 0.8em;
  font-weight: 600;
  text-align: center;
}

/* ---------- shared building blocks ---------- */
.panel {
  background: var(--cream);
  border: var(--line);
  border-radius: 26px;
  box-shadow: 0 7px 0 var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: var(--line);
  border-radius: 999px;
  padding: 0.45rem 1.05rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--sun);
  box-shadow: 0 4px 0 var(--ink);
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s, filter 0.15s;
  white-space: nowrap;
}
.btn:not(:disabled):hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: 0 5px 0 var(--ink); }
.btn:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { background: #e9e1d4; color: #a59eb5; border-color: #a59eb5; box-shadow: 0 4px 0 #a59eb5; cursor: default; }
.btn.secondary { background: var(--paper); }
.btn.mint { background: var(--mint); }
.btn.lilac { background: var(--lilac); }
.btn.danger { background: var(--paper); color: #e8505b; }
.btn.big { font-size: 1.2rem; padding: 0.65rem 1.7rem; }
.btn.round { width: 42px; height: 42px; padding: 0; font-size: 1.1rem; }
.btn.small { width: 34px; height: 34px; font-size: 0.9rem; box-shadow: 0 3px 0 var(--ink); }
.btn.active { background: var(--mint); }

.bar {
  height: 12px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  overflow: hidden;
}
.bar > div, .progress > div {
  height: 100%;
  border-radius: 999px;
  background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.35) 0 6px, transparent 6px 12px);
  background-size: 34px 34px;
  animation: candy 1.2s linear infinite;
  transition: width 0.3s, background-color 0.4s;
}
@keyframes candy { to { background-position: 34px 0; } }
#time-fill { background-color: var(--sun); }
#rep-fill { background-color: var(--mint); }

/* ---------- top bar ---------- */
#topbar {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  z-index: 10;
  pointer-events: none;
}
#topbar > * { pointer-events: auto; }
.spacer { flex: 1; pointer-events: none !important; }

.chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 50px;
  padding: 0 0.95rem 0 0.4rem;
  background: var(--cream);
  border: var(--line);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  font-size: 1.05rem;
  white-space: nowrap;
}
.chip .ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--c);
  font-size: 1.05rem;
}
.chip-stack { display: flex; flex-direction: column; gap: 3px; min-width: 96px; }
.chip-stack small { font-size: 0.82rem; line-height: 1; }
.chip-btn { font: inherit; color: inherit; cursor: pointer; }
.chip-btn:hover { transform: translateY(-2px) rotate(-2deg); }
.chip.pop { animation: chip-pop 0.35s var(--pop); }
@keyframes chip-pop { 40% { transform: scale(1.12) rotate(-3deg); } }

.brand { padding-right: 1.1rem; font-size: 1.15rem; transform: rotate(-2deg); }
.brand b { color: #e8505b; }
.brand .logo { font-size: 1.6rem; animation: wobble 3s ease-in-out infinite; display: inline-block; }
@keyframes wobble { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg) translateY(-2px); } }

#chip-money { min-width: 140px; }
#money-delta {
  position: absolute;
  right: 10px;
  top: -18px;
  font-weight: 700;
  font-size: 0.95rem;
  opacity: 0;
  -webkit-text-stroke: 4px var(--ink);
  paint-order: stroke fill;
}
#money-delta.show { animation: delta 1s ease-out; }
@keyframes delta { 0% { opacity: 1; transform: translateY(4px) scale(.8); } 30% { transform: translateY(-4px) scale(1.15); } 100% { opacity: 0; transform: translateY(-14px); } }

.speed { padding: 0 5px; gap: 3px; }
.speed button {
  border: none;
  background: transparent;
  font: inherit;
  font-weight: 700;
  color: var(--ink);
  width: 38px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
}
.speed button:hover { background: #2b23401a; }
.speed button.active { background: var(--sun); border: 2.5px solid var(--ink); }

/* ---------- sticker cards (bottom-left) ---------- */
#side {
  position: fixed;
  left: 14px;
  bottom: 44px;
  width: 238px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  z-index: 5;
}
.sticker {
  position: relative;
  padding: 0.85rem 0.95rem 0.75rem;
  background: var(--cream);
  border: var(--line);
  border-radius: 20px;
  box-shadow: 0 5px 0 var(--ink);
  font-size: 0.9rem;
}
#contract { transform: rotate(-1.5deg); }
#crew-card { transform: rotate(1deg); }
.sticker::before { /* bit of tape */
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 70px;
  height: 20px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(255, 209, 102, 0.75);
  border: 2px solid rgba(43, 35, 64, 0.25);
  border-radius: 3px;
}
.sticker h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.4rem; }
.contract-goal { display: flex; align-items: center; gap: 0.45rem; font-weight: 600; margin-bottom: 0.45rem; }
.dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); display: inline-block; flex: none; }
.progress { height: 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--paper); overflow: hidden; margin: 0.35rem 0; }
.progress > div { background-color: var(--sun); }
.done .progress > div { background-color: var(--mint); }
.crew-row { display: flex; justify-content: space-between; padding: 0.12rem 0; }
.pill {
  display: inline-block;
  padding: 0 0.55rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--paper);
}
.pill.on { background: var(--mint); }

/* ---------- banners ---------- */
#banner {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1.4rem;
  border: var(--line);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 700;
  color: #fff;
  -webkit-text-stroke: 3px var(--ink);
  paint-order: stroke fill;
  background: var(--coral);
  z-index: 6;
  animation: wiggle 0.9s ease-in-out infinite;
}
@keyframes wiggle { 0%, 100% { transform: translateX(-50%) rotate(-1.5deg); } 50% { transform: translateX(-50%) rotate(1.5deg) scale(1.03); } }

#paused-banner {
  position: fixed;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-3deg);
  padding: 0.8rem 2.2rem;
  border: 4px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 7px 0 var(--ink);
  background: var(--sun);
  font-size: 2.2rem;
  font-weight: 700;
  pointer-events: none;
  z-index: 8;
  text-align: center;
  line-height: 1.1;
  animation: float 2s ease-in-out infinite;
}
#paused-banner small { display: block; font-size: 0.9rem; font-weight: 500; }
@keyframes float { 50% { transform: translate(-50%, -56%) rotate(-1deg); } }

/* ---------- toasts ---------- */
#toasts {
  position: fixed;
  right: 14px;
  top: 78px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 9px;
  z-index: 9;
  pointer-events: none;
  transition: right 0.3s var(--pop);
}
body.drawer-open #toasts { right: 412px; }
.toast {
  max-width: 300px;
  padding: 0.6rem 0.9rem 0.6rem 2.6rem;
  position: relative;
  background: var(--cream);
  border: var(--line);
  border-radius: 18px;
  box-shadow: 0 4px 0 var(--ink);
  font-size: 0.9rem;
  line-height: 1.35;
  animation: toast-in 0.45s var(--pop);
}
.toast::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--sun);
}
.toast.good::before { background: var(--mint); }
.toast.bad::before { background: var(--coral); }
.toast.out { animation: toast-out 0.3s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(.7); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(40px) scale(.8); } }

#hint {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.25rem 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: rgba(255, 248, 236, 0.85);
  font-size: 0.8rem;
  pointer-events: none;
  white-space: nowrap;
}

/* ---------- buttons & text floating over the 3D world ---------- */
#world-ui { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.world-btn {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  border: var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  background: var(--sun);
  box-shadow: 0 3px 0 var(--ink);
}
.world-btn:hover { filter: brightness(1.06); }
.world-btn:active { box-shadow: 0 0 0 var(--ink); margin-top: 3px; }
.world-btn:disabled { background: var(--cream); color: var(--ink-soft); cursor: default; filter: none; }
.world-btn.full { background: var(--mint); animation: bob 0.8s var(--pop) infinite; }
.world-btn.fix { background: var(--coral); color: #fff; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; animation: bob 0.6s infinite; }
@keyframes bob { 50% { transform: translate(-50%, -62%) rotate(-2deg); } }

.popup {
  position: fixed;
  transform: translate(-50%, -50%);
  font-size: 1.45rem;
  font-weight: 700;
  -webkit-text-stroke: 5px var(--ink);
  paint-order: stroke fill;
  pointer-events: none;
  white-space: nowrap;
  z-index: 7;
  animation: popup 1s var(--pop) forwards;
}
@keyframes popup {
  0% { transform: translate(-50%, -30%) scale(.3); }
  25% { transform: translate(-50%, -80%) scale(1.15); opacity: 1; }
  100% { transform: translate(-50%, -190%) scale(1); opacity: 0; }
}

/* ---------- manage drawer ---------- */
#manage {
  position: fixed;
  top: 80px;
  right: 14px;
  bottom: 18px;
  width: 386px;
  display: flex;
  flex-direction: column;
  z-index: 9;
  transform: translateX(120%) rotate(4deg);
  transition: transform 0.4s var(--pop);
}
#manage.open { transform: translateX(0) rotate(0); }
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 0.7rem 0.6rem;
  border-bottom: 3px dashed #2b234033;
}
.tabs { display: flex; gap: 4px; padding: 4px; border: var(--line); border-radius: 999px; background: var(--paper); }
.tabs button {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
}
.tabs button.active { background: var(--sun); color: var(--ink); box-shadow: inset 0 0 0 2.5px var(--ink); }
#manage-body { flex: 1; overflow-y: auto; padding: 0.8rem; display: flex; flex-direction: column; gap: 0.75rem; }
#manage-body::-webkit-scrollbar { width: 10px; }
#manage-body::-webkit-scrollbar-thumb { background: #2b234033; border-radius: 5px; }

.item {
  position: relative;
  background: var(--paper);
  border: var(--line);
  border-radius: 20px;
  padding: 0.75rem 0.85rem 0.8rem 3.6rem;
  box-shadow: 0 4px 0 var(--ink);
}
.item .big-ico {
  position: absolute;
  left: 0.65rem;
  top: 0.7rem;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  background: var(--c, var(--sun));
  font-size: 1.3rem;
  transform: rotate(-4deg);
}
.item.locked { opacity: 0.6; }
.item-head { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.02rem; }
.item p { font-size: 0.85rem; color: var(--ink-soft); line-height: 1.4; margin: 0.25rem 0 0.6rem; }
.item-foot { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.item-foot .muted { font-size: 0.8rem; margin-left: auto; }
.count {
  min-width: 30px;
  padding: 0 0.45rem;
  text-align: center;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--sun);
  font-size: 0.85rem;
}
.lvl-dots { display: flex; gap: 4px; }
.lvl-dots i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); }
.lvl-dots i.on { background: var(--mint); }
.section-title { font-size: 0.95rem; font-weight: 700; margin-top: 0.2rem; }
.toggle-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.35rem 0; font-size: 0.95rem; }
.toggle-row small { color: var(--ink-soft); }

.switch {
  width: 52px;
  height: 30px;
  border: var(--line);
  border-radius: 999px;
  background: #e9e1d4;
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  background: var(--paper);
  transition: left 0.25s var(--pop);
}
.switch.on { background: var(--mint); }
.switch.on::after { left: 23px; }

/* ---------- modal menus ---------- */
#modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(255, 233, 207, 0.55);
  backdrop-filter: blur(5px);
  z-index: 20;
  overflow-y: auto;
}
#modal-panel {
  width: min(660px, 100%);
  margin: auto;
  padding: 2rem 2.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  text-align: center;
  animation: modal-in 0.5s var(--pop);
}
#modal-panel.wide { width: min(980px, 100%); }
@keyframes modal-in { from { transform: scale(0.6) rotate(-4deg); opacity: 0; } }
#modal-panel h1 { font-size: 3.4rem; line-height: 1; font-weight: 700; }
#modal-panel h2 { font-size: 2rem; font-weight: 700; }
#modal-panel p { color: var(--ink-soft); line-height: 1.55; max-width: 500px; }
.stack { display: flex; flex-direction: column; gap: 0.75rem; width: 100%; max-width: 320px; }
.row { display: flex; gap: 0.7rem; flex-wrap: wrap; justify-content: center; align-items: center; }

/* bouncy title */
.title-logo { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.title-logo .box { font-size: 4.5rem; animation: wobble 2.4s ease-in-out infinite; display: inline-block; }
.title-logo h1 span { display: inline-block; animation: hop 1.6s ease-in-out infinite; -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; }
.title-logo h1 .a { color: var(--sun); }
.title-logo h1 .b { color: var(--coral); }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-10px) rotate(-3deg); } }
.trophy-badge {
  padding: 0.25rem 0.9rem;
  border: var(--line);
  border-radius: 999px;
  background: var(--sun);
  box-shadow: 0 3px 0 var(--ink);
  font-weight: 600;
}

.ledger {
  width: 100%;
  max-width: 440px;
  background: var(--paper);
  border: var(--line);
  border-radius: 20px;
  padding: 0.8rem 1.2rem;
  text-align: left;
  font-size: 0.95rem;
}
.ledger div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.18rem 0; }
.ledger .total { border-top: 3px dashed #2b234033; margin-top: 0.35rem; padding-top: 0.5rem; font-weight: 700; }
.chart-wrap { width: 100%; max-width: 500px; }
.chart-wrap canvas { width: 100%; height: 150px; }
.legend { display: flex; gap: 1rem; justify-content: center; font-size: 0.85rem; font-weight: 600; }

.howto { text-align: left; font-size: 0.95rem; line-height: 1.75; max-width: 520px; }
.howto li { margin-left: 1.2rem; }

/* ---------- research tree ---------- */
.tree { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; width: 100%; }
.branch { display: flex; flex-direction: column; align-items: stretch; }
.branch-head {
  padding: 0.4rem;
  border: var(--line);
  border-radius: 999px;
  background: var(--c);
  box-shadow: 0 4px 0 var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.8rem;
}
.node {
  position: relative;
  background: var(--paper);
  border: var(--line);
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--ink);
  padding: 0.7rem 0.75rem;
  text-align: left;
}
.node + .node { margin-top: 26px; }
.node + .node::before { /* connector line */
  content: "";
  position: absolute;
  top: -29px;
  left: 50%;
  width: 6px;
  height: 22px;
  transform: translateX(-50%);
  background: var(--ink);
  border-radius: 3px;
}
.node.done + .node::before { background: var(--mint); box-shadow: 0 0 0 2px var(--ink); }
.node-top { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.node-ico {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  background: var(--c);
  font-size: 1.15rem;
}
.node p { font-size: 0.8rem; color: var(--ink-soft) !important; line-height: 1.35; margin: 0.35rem 0 0.55rem; }
.node .btn { font-size: 0.85rem; padding: 0.3rem 0.8rem; }
.node.done { background: #e6fbf2; }
.node.locked { opacity: 0.55; }
.node.locked .node-ico { filter: grayscale(1); }
.done-tag { font-weight: 700; color: #1f9e6e; font-size: 0.9rem; }

.perk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.8rem; width: 100%; text-align: left; }
.perk-grid .item p { margin-bottom: 0.5rem; }

/* research chip glows when you can afford something */
.chip-btn.glow { background: var(--lilac); animation: glow 1.2s ease-in-out infinite; }
@keyframes glow { 50% { transform: translateY(-2px) rotate(-2deg); box-shadow: 0 6px 0 var(--ink); } }

/* disabled always looks disabled, whatever its color */
.btn[disabled], .btn[disabled]:hover {
  background: #e9e1d4 !important;
  color: #a59eb5;
  border-color: #a59eb5;
  box-shadow: 0 4px 0 #a59eb5;
  transform: none;
  filter: none;
}

/* smaller screens: squeeze the top bar */
@media (max-width: 1400px) {
  .brand > span:last-child { display: none; }
  .brand { padding-right: 0.4rem; }
}
@media (max-width: 1200px) {
  .chip-stack { min-width: 70px; }
  #chip-money { min-width: 110px; }
  #manage-btn { padding: 0.45rem 0.7rem; }
  #hint { display: none; }
}

/* =====================================================
   Versus mode
   ===================================================== */
.field { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; text-align: left; width: 100%; max-width: 320px; }
.field input, .code-input {
  font: inherit;
  font-size: 1.05rem;
  padding: 0.5rem 0.9rem;
  border: var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 0 3px 0 #2b234014;
  outline: none;
}
.field input:focus, .code-input:focus { box-shadow: 0 0 0 4px var(--sun); }
.code-input { width: 130px; text-transform: uppercase; letter-spacing: 3px; font-weight: 700; }
.vs-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; width: 100%; text-align: left; }
.room-code {
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: 0.4rem;
  padding: 0.3rem 1.4rem;
  border: 4px dashed var(--ink);
  border-radius: 22px;
  background: var(--sun);
  transform: rotate(-2deg);
  user-select: all;
}
.waiting .dots::after { content: ""; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.vs-cols { display: flex; align-items: stretch; gap: 0.8rem; width: 100%; justify-content: center; }
.vs-col {
  flex: 1;
  max-width: 330px;
  padding: 0.8rem;
  border: var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 4px 0 var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.vs-col.me { background: #fff4d6; }
.vs-col.winner { background: #e6fbf2; animation: chip-pop 0.6s var(--pop) 2; }
.vs-col .ledger { padding: 0.5rem 0.8rem; font-size: 0.88rem; }
.vs-name { font-weight: 700; font-size: 1.1rem; }
.vs-money { font-size: 1.9rem; font-weight: 700; }
.vs-vs {
  align-self: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  -webkit-text-stroke: 6px var(--ink);
  paint-order: stroke fill;
  transform: rotate(-8deg);
}

#vs-card {
  position: fixed;
  top: 80px;
  left: 14px;
  width: 270px;
  z-index: 6;
  transform: rotate(-1deg);
  background: #f2ecff;
}
.vs-row { display: flex; justify-content: space-between; align-items: center; gap: 0.4rem; padding: 0.1rem 0; }
.vs-tag { font-weight: 700; font-size: 1.05rem; }
.lead { margin-top: 0.35rem; padding: 0.2rem 0.6rem; border: 2.5px solid var(--ink); border-radius: 999px; text-align: center; font-size: 0.88rem; }
.lead.ahead { background: var(--mint); }
.lead.behind { background: var(--coral); color: #fff; }

#ability-bar {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.7rem;
  background: var(--cream);
  border: var(--line);
  border-radius: 24px;
  box-shadow: 0 5px 0 var(--ink);
  z-index: 8;
}
.ability {
  position: relative;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: 0.4rem;
  align-items: center;
  padding: 0.3rem 0.7rem 0.3rem 0.4rem;
  border: var(--line);
  border-radius: 16px;
  background: var(--coral);
  box-shadow: 0 3px 0 var(--ink);
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.ability:not(:disabled):hover { transform: translateY(-2px); }
.ability:not(:disabled):active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.ability[data-ability="shield"] { background: var(--sky); }
.ability.active { background: var(--mint); animation: chip-pop 0.8s infinite; }
.ability:disabled { background: #e9e1d4; color: #8a819e; cursor: default; }
.a-ico { grid-row: span 2; font-size: 1.5rem; }
.a-name { font-weight: 700; font-size: 0.85rem; line-height: 1.1; }
.a-cost { font-size: 0.78rem; line-height: 1.1; }
.a-cd {
  position: absolute;
  top: -10px;
  right: -8px;
  padding: 0 0.35rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--sun);
  font-size: 0.75rem;
  font-weight: 700;
}
.a-cd:empty { display: none; }
.emote-row { display: flex; gap: 0.25rem; padding-left: 0.5rem; border-left: 3px dashed #2b234033; }
.emote-btn {
  width: 38px;
  height: 38px;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
}
.emote-btn:hover { transform: scale(1.12) rotate(-6deg); }

.emote {
  position: fixed;
  top: 140px;
  font-size: 3.5rem;
  font-weight: 700;
  pointer-events: none;
  z-index: 15;
  -webkit-text-stroke: 6px var(--ink);
  paint-order: stroke fill;
  color: var(--sun);
  animation: emote 1.8s var(--pop) forwards;
}
.emote.theirs { left: 300px; }
.emote.mine { left: 50%; }
@keyframes emote {
  0% { transform: scale(0) rotate(-20deg); }
  20% { transform: scale(1.3) rotate(8deg); }
  35% { transform: scale(1) rotate(0); }
  80% { opacity: 1; }
  100% { transform: translateY(-50px); opacity: 0; }
}

@media (max-width: 1100px) {
  .ability .a-name { display: none; }
  #vs-card { width: 220px; }
}

/* volume sliders */
.slider-row { display: grid; grid-template-columns: 90px 1fr 34px; align-items: center; gap: 0.6rem; padding: 0.35rem 0; font-size: 0.95rem; }
.slider-row b { text-align: right; font-variant-numeric: tabular-nums; }
.slider-row input[type=range] { -webkit-appearance: none; appearance: none; height: 12px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--paper); cursor: pointer; }
.slider-row input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--ink); background: var(--sun); box-shadow: 0 2px 0 var(--ink); }
.slider-row input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--ink); background: var(--sun); }

.version-tag {
  padding: 0.05rem 0.6rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* info screen */
.info-card {
  width: 100%;
  max-width: 420px;
  padding: 0.7rem 1.1rem;
  background: var(--paper);
  border: var(--line);
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--ink);
  text-align: left;
}
.info-title { font-weight: 700; margin-bottom: 0.3rem; }
.info-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.22rem 0; font-size: 0.95rem; }
.info-row a { color: #2f7fd6; font-weight: 600; text-decoration: none; border-bottom: 2px dashed #7cc6fe; }
.info-row a:hover { color: var(--ink); border-bottom-color: var(--sun); }
.row.tight { flex-wrap: nowrap; gap: 0.45rem; }
.row.tight .btn { padding: 0.4rem 0.75rem; font-size: 0.88rem; }
.stack:has(.row.tight) { max-width: 390px; }
.info-row > span:first-child { white-space: nowrap; }
