:root {
  --txt: #f6ecd9;
  --dim: #c0b7b6;
  --line: #e6d6bf2b;
  --gold: #edc786;
}
body { font-family: 'Trebuchet MS', system-ui, sans-serif; }
#app::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--world-image) center/cover;
  opacity: .17;
  pointer-events: none;
}
#hud {
  background: linear-gradient(180deg,var(--bg),transparent);
  border-bottom: 1px solid #f1d9b914;
  padding: calc(12px + var(--safeT)) 18px 14px;
}
#hud .balv { color: #f6dbad; }
#hud .back, #gear {
  background: var(--panel);
  border-color: #ead2b736;
  border-radius: 15px;
  box-shadow: inset 0 1px #fff0d41a;
}
#worldbg::after {
  background: linear-gradient(180deg,#11152260,transparent 35%,#18122240 65%,var(--bg));
}
#wtag {
  top: 18px;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: min(80%,520px);
  padding: 12px 15px;
  border-radius: 20px;
  background: var(--panel);
  border: 1px solid #e8d2b936;
  box-shadow: inset 0 1px #ffffff12,0 8px 30px #0d102335;
  backdrop-filter: blur(6px);
}
#wtag b {
  font-family: Georgia, serif;
  font-weight: 500;
  font-size: 23px;
  color: #fff0d5;
  letter-spacing: 0;
}
#wtag span {
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
  color: var(--neon);
  text-shadow: none;
}
#music {
  top: 20px;
  right: 2px;
  border-radius: 14px;
  background: var(--panel);
}
#taplabel { top: 23%; }
#taplabel .t1 {
  font-size: 13px;
  color: #f4e3c9;
  text-shadow: 0 2px 9px #000;
}
#taplabel .t2 {
  color: #ffe0a7;
  text-shadow: 0 2px 8px #17142b;
  margin-top: 3px;
}
#comboHud { top: 34%; color: #f7d89d; }
#comboTrack { background: #ffffff26; }
#tap {
  width: min(78vw,340px);
  height: 35%;
  bottom: 22%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 6px;
  overflow: visible;
}
#tableCompanion {
  width: min(100%,210px);
  height: calc(100% - 45px);
  max-height: 210px;
  object-fit: contain;
  filter: drop-shadow(0 12px 10px #15102590);
  pointer-events: none;
  animation: table-float 5s ease-in-out infinite;
}
.tap-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 10px 22px;
  border-radius: 18px;
  background: linear-gradient(120deg,#f0d5a4,#dbb579);
  color: #493426;
  font-weight: 800;
  font-size: 13px;
  box-shadow: inset 0 1px #fff4d799,0 4px 0 #251b2a80,0 8px 25px #16102255;
  pointer-events: none;
}
.tap-caption span { opacity: .55; }
#tap:active .tap-caption { transform: translateY(2px); }
#tapGlow {
  background: radial-gradient(ellipse,#f1d7a630,transparent 70%);
  width: 90%;
}
#seats {
  max-width: 380px;
  gap: 7px;
  margin-bottom: 14px;
}
.seat {
  border-radius: 12px;
  border-color: #edd9b840;
  color: #f2e1c4;
  background: var(--panel);
}
.bigbtn {
  border-radius: 18px;
  border-color: #e0cbb942;
  box-shadow: inset 0 1px #ffffff17,0 5px 15px #15102330;
}
#boostBtn.rdy {
  background: linear-gradient(135deg,#725d3b,#403743);
  border-color: #e8c99280;
  box-shadow: inset 0 1px #fff0cd22,0 0 20px #e8c99220;
}
#boostBtn.rdy .lab { color: #f4d5a0; }
#gtabs {
  background: linear-gradient(0deg,var(--bg) 65%,transparent);
  padding: 12px 12px calc(8px + var(--safeB));
  gap: 6px;
}
.gtab { border-radius: 15px; color: #c3b9b8; }
.gtab.on {
  background: var(--panel);
  box-shadow: inset 0 1px #fff2d41a;
  color: var(--neon);
}
.gtab.on .gi { filter: none; }
.card, .agent, .up {
  border-radius: 20px;
  border-color: #f4dbc52e;
  box-shadow: inset 0 1px #fff5e00c,0 6px 20px #11102020;
}
.hh {
  color: #dfccb6;
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  margin: 18px 4px 12px;
}
.buy, .qty, .strategy-grid button {
  background: #463e505c;
  border-color: #ead2b936;
}
.buy.can { border-color: var(--neon); box-shadow: 0 0 12px #e9cf9910; }
.qty.on, .strategy-grid button.active {
  background: #80644940;
  border-color: var(--neon);
  box-shadow: inset 0 1px #ffffff15;
}
.strategy-action {
  background: linear-gradient(120deg,#a78659,#766172);
  color: #fff3db;
  box-shadow: inset 0 1px #fff3cd33;
  border-radius: 13px;
}
.strategy-meter i { background: linear-gradient(90deg,var(--neon2),var(--neon)); }
.wcard {
  background: var(--panel);
  border-radius: 20px;
  border-color: #ead2b92e;
}
.wcard .wi {
  width: 96px;
  height: 82px;
  border: 3px solid #d5c3ac;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.wcard.cur { border-color: var(--neon); box-shadow: inset 0 1px #ffffff12; }
.sheet { background: var(--panel); border-color: #e7c79b40; border-radius: 26px 26px 0 0; }
.mbtn { background: linear-gradient(120deg,#ae8a58,#796777); color: #fff3d8; }
@keyframes table-float {
  0%,100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
}
@media (min-width:800px) {
  .scene:not(#sc-table) { padding-left: max(24px,calc((100vw - 850px)/2)); padding-right: max(24px,calc((100vw - 850px)/2)); }
  #wtag { top: 22px; }
  #taplabel { top: 22%; }
  #comboHud { top: 32%; }
}
@media (max-height:700px) {
  #wtag { top: 7px; padding: 7px 12px; }
  #wtag b { font-size: 19px; }
  #wtag span { font-size: 9px; }
  #taplabel { top: 23%; }
  #comboHud { top: 36%; font-size: 10px; }
  #tableCompanion { max-height: 125px; }
  #tap { bottom: 25%; height: 30%; }
  .tap-caption { padding: 7px 18px; }
}
@media (prefers-reduced-motion:reduce) {
  *,*::before,*::after { animation: none !important; transition: none !important; }
}

#tableCompanion.landscape-companion { width: 180px; height: 180px; max-height: 65%; aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 5px solid #dfd2ac; box-shadow: 0 0 0 5px #d1c38e24,0 10px 30px #16102280; animation: none; }

/* Every element occupies its own row, including a fully populated team. */
#stage {
  height: auto;
  min-height: 100%;
  max-width: 550px;
  margin: auto;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 0 20px;
}
#wtag {
  position: relative;
  top: auto;
  left: auto;
  right: auto;
  transform: none;
  width: calc(100% - 70px);
  flex-shrink: 0;
}
#music { top: 18px; right: 4px; }
#taplabel, #comboHud {
  position: static;
  width: 100%;
  flex-shrink: 0;
}
#taplabel { margin-top: 2px; }
#taplabel .t1 { font-size: 11px; }
#taplabel .t2 { font-size: 25px; }
#comboTrack { margin-bottom: 0; }
#tap {
  position: relative;
  left: auto;
  bottom: auto;
  transform: none;
  height: clamp(145px,20dvh,190px);
  width: min(100%,340px);
  flex-shrink: 0;
}
#tableCompanion { height: calc(100% - 47px); max-height: 170px; }
.tap-caption { min-height: 42px; }
.team-strip {
  width: 100%;
  max-width: 380px;
  padding: 10px 12px;
  border: 1px solid #e7d4b726;
  background: var(--panel);
  border-radius: 18px;
  flex-shrink: 0;
}
.team-label {
  display: block;
  color: var(--dim);
  font-size: 8px;
  letter-spacing: .14em;
  margin-bottom: 9px;
}
#seats { margin: 0; max-width: none; gap: 6px; }
#seats .seat { width: 30px; height: 30px; }
#actions { max-width: 380px; flex-shrink: 0; }
#partyCard {
  width: 100%;
  max-width: 380px;
  flex-shrink: 0;
  border: 1px solid #e7d4b736;
  border-radius: 18px;
  padding: 12px 14px;
  text-align: left;
  background: var(--panel);
  box-shadow: inset 0 1px #fff3d31a;
}
.party-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.party-top b { font-size: 12px; color: #f8e2c4; }
.party-top small { color: var(--neon); font-size: 11px; white-space: nowrap; }
#partyCard .strategy-meter { margin: 8px 0; }
#partyStory { font-size: 11px; color: var(--dim); margin: 0 0 5px; }
#partyHint { font-size: 9px; color: #c6af93; display: block; }
#partyChoices { display: flex; gap: 7px; margin: 9px 0; }
#partyChoices[hidden] { display: none; }
#partyChoices button {
  flex: 1;
  padding: 9px 5px;
  min-height: 44px;
  border-radius: 12px;
  background: #80644955;
  border: 1px solid #e8cd9850;
  color: #f9e4c3;
  font-size: 11px;
}
#partyChoices small { display: block; color: var(--dim); font-size: 9px; margin-top: 2px; }
@media (max-height:700px) {
  #stage { gap: 9px; }
  #wtag { padding: 7px 12px; }
  #tap { height: 145px; }
  #tableCompanion { max-height: 100px; }
}
