:root {
  --bg1: #f7fbff;
  --bg2: #eef5ff;
  --panel: rgba(255, 255, 255, 0.8);
  --text: #23324a;
  --muted: #6d7c95;
  --border: #d9e4f2;
  --shadow: 0 12px 35px rgba(35, 50, 74, 0.12);
  --accent: #6ea4ff;
  --green: #9fd9b3;
  --danger: #ffc6c6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, #ffffff 0%, rgba(255,255,255,0.65) 18%, transparent 40%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 100%);
}

.app {
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(720px, 1fr) 390px;
  gap: 24px;
}

.panel {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.board-panel {
  padding: 20px;
}

.sidebar {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: start;
  position: sticky;
  top: 16px;
}

.title-wrap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.title-wrap h1 {
  margin: 0 0 6px;
  font-size: 2rem;
}

.title-wrap p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.title-badge {
  background: linear-gradient(180deg, #fff4d0 0%, #ffe08a 100%);
  border: 1px solid #f8d469;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  color: #694f09;
}

.board {
  display: grid;
  grid-template-columns: repeat(7, minmax(82px, 1fr));
  grid-template-rows: repeat(7, 88px);
  gap: 10px;
  aspect-ratio: 1 / 1;
}

.space {
  position: relative;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.space::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 10px;
  background: rgba(255,255,255,0.4);
}

.space.property.green { background: linear-gradient(180deg, #effcf4 0%, #e4f8ea 100%); }
.space.property.pink { background: linear-gradient(180deg, #fff3f8 0%, #ffe9f2 100%); }
.space.property.blue { background: linear-gradient(180deg, #eef9ff 0%, #e3f3ff 100%); }
.space.property.purple { background: linear-gradient(180deg, #f7f3ff 0%, #eee8ff 100%); }
.space.property.gold { background: linear-gradient(180deg, #fff8e6 0%, #fff0c1 100%); }
.space.special { background: linear-gradient(180deg, #fffdf6 0%, #fff8df 100%); }
.space.card-space { background: linear-gradient(180deg, #f5f6ff 0%, #eceeff 100%); }

.space-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  position: relative;
  z-index: 1;
}

.space-name {
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.12;
  max-width: 100%;
}

.space-price {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 700;
}

.space-type {
  font-size: 0.67rem;
  color: var(--muted);
  position: relative;
  z-index: 1;
  max-width: 100%;
  padding-right: 44px;
}



.upgrade-container {
  position: absolute;
  right: 6px;
  bottom: 6px;
  font-size: 0.7rem;
  line-height: 1;
  pointer-events: none;
  z-index: 5;
  display: flex;
  gap: 1px;
  justify-content: flex-end;
  align-items: center;
  max-width: 58px;
  overflow: hidden;
}




.owner-chip {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 22px;
  font-size: 0.62rem;
  padding: 2px 5px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 4;
}

.tokens {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 60px;
  z-index: 3;
}

.token {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.12);
  transition: transform 0.25s ease;
}

.token.bump {
  animation: token-bump 0.45s ease;
}

@keyframes token-bump {
  0% { transform: scale(1); }
  35% { transform: translateY(-10px) scale(1.18); }
  100% { transform: scale(1); }
}

.token.p1, .dot.p1 { background: #ff82ac; }
.token.p2, .dot.p2 { background: #6ea8ff; }
.token.p3, .dot.p3 { background: #82d39c; }
.token.p4, .dot.p4 { background: #ae8dff; }

.center-card {
  grid-column: 2 / 7;
  grid-row: 2 / 7;
  border-radius: 34px;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.5) 22%, transparent 45%),
    linear-gradient(180deg, #ffffff 0%, #f5f9ff 100%);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.center-card::after {
  content: '🎓';
  position: absolute;
  right: 24px;
  bottom: 14px;
  font-size: 4rem;
  opacity: 0.12;
}

.center-card h2 {
  margin: 0 0 8px;
  font-size: 2.1rem;
}

.center-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  max-width: 420px;
}

.section-title {
  margin: 0 0 10px;
  font-size: 1rem;
}

.player-list {
  display: grid;
  gap: 10px;
}

.player-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px;
  background: rgba(255,255,255,0.85);
}

.player-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(110, 164, 255, 0.13);
  background: #f7fbff;
}

.player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.player-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.money {
  font-weight: 900;
}

.mini-text {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.45;
}

.controls {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

button {
  border: none;
  border-radius: 15px;
  padding: 14px 16px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(36, 50, 74, 0.12);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.primary { background: linear-gradient(180deg, #7cb0ff 0%, #669bfa 100%); color: white; }
.secondary { background: #eef4ff; color: var(--text); }
.success { background: linear-gradient(180deg, #aae0bc 0%, #90d4a6 100%); color: #173321; }
.danger { background: #ffe9e9; color: #7a2f2f; }

.log {
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  max-height: 260px;
  overflow: auto;
}

.log-entry {
  font-size: 0.92rem;
  line-height: 1.45;
  padding: 8px 0;
  border-bottom: 1px solid #edf1f8;
}

.log-entry:last-child {
  border-bottom: none;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.badge {
  font-size: 0.74rem;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef3fb;
  color: var(--text);
  font-weight: 700;
}

.result-box {
  padding: 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
}

.hero-box {
  background: linear-gradient(180deg, rgba(255,255,255,0.86) 0%, rgba(244,249,255,0.82) 100%);
}

.dice-area {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.dice {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
}

.dice.rolling {
  animation: dice-roll 0.75s ease;
}

@keyframes dice-roll {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(18deg) scale(1.08); }
  50% { transform: rotate(-14deg) scale(0.96); }
  75% { transform: rotate(10deg) scale(1.06); }
  100% { transform: rotate(0deg) scale(1); }
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.legend-item {
  border-radius: 14px;
  padding: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.72);
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
}

.event-preview {
  border-radius: 22px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 18px;
}

.card-back {
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.4) 0%, transparent 35%),
    linear-gradient(135deg, #788dff 0%, #8a6dff 40%, #ff8cb5 100%);
  color: white;
}

.event-preview-inner {
  display: grid;
  gap: 10px;
}

.event-icon {
  font-size: 2.6rem;
}

.event-label {
  font-size: 1.2rem;
  font-weight: 900;
}

.event-sub {
  font-size: 0.92rem;
  opacity: 0.95;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 33, 50, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 50;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  width: min(460px, 100%);
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 22px 60px rgba(19, 28, 44, 0.28);
  border: 1px solid #eef2fb;
  padding: 22px;
}

.modal h3 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.modal p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.center-actions {
  justify-content: center;
}

.event-modal {
  width: min(520px, 100%);
  background: transparent;
  box-shadow: none;
  border: none;
  padding: 0;
}

.event-card {
  border-radius: 28px;
  padding: 24px;
  color: white;
  box-shadow: 0 22px 60px rgba(19, 28, 44, 0.28);
  border: 1px solid rgba(255,255,255,0.25);
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.28) 0%, transparent 30%),
    linear-gradient(135deg, #738eff 0%, #936fff 35%, #ff93bc 100%);
  transform: perspective(900px) rotateY(90deg);
  opacity: 0;
}

.event-card.show {
  animation: event-flip 0.55s ease forwards;
}

@keyframes event-flip {
  0% { transform: perspective(900px) rotateY(90deg) scale(0.96); opacity: 0; }
  100% { transform: perspective(900px) rotateY(0deg) scale(1); opacity: 1; }
}

.event-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.event-card-tag {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
}

.event-card-big-icon {
  font-size: 2rem;
}

.event-card h3 {
  margin: 0 0 10px;
  font-size: 1.6rem;
  color: white;
}

.event-card p {
  margin: 0;
  color: rgba(255,255,255,0.95);
}

.winner-banner {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff7da 0%, #ffedb0 100%);
  border: 1px solid #f2d77d;
  color: #6f5409;
  font-weight: 800;
}

.hidden {
  display: none;
}

/* Setup Overlay */
.setup-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 25, 40, 0.52);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 80;
}

.setup-backdrop.hidden {
  display: none;
}

.setup-panel {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 28px;
  padding: 24px;
  box-shadow: 0 24px 70px rgba(19, 28, 44, 0.28);
  border: 1px solid #eef2fb;
}

.setup-panel h2 {
  margin: 0 0 8px;
  font-size: 1.7rem;
  color: #23324a;
}

.setup-panel p {
  margin: 0 0 18px;
  color: #6d7c95;
  line-height: 1.5;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.setup-field {
  display: grid;
  gap: 8px;
}

.setup-field label {
  font-size: 0.9rem;
  font-weight: 800;
  color: #23324a;
}

.setup-field select,
.setup-field input {
  width: 100%;
  border: 1px solid #d9e4f2;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  background: #f8fbff;
  color: #23324a;
}

.setup-note {
  font-size: 0.88rem;
  color: #6d7c95;
  margin-top: -2px;
  margin-bottom: 16px;
}

.setup-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 1120px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }
}

@media (max-width: 840px) {
  .board {
    grid-template-columns: repeat(7, minmax(44px, 1fr));
    grid-template-rows: repeat(7, 72px);
  }

  .space-name {
    font-size: 0.68rem;
  }

  .space-type,
  .space-price {
    font-size: 0.62rem;
  }

  .owner-chip {
    font-size: 0.58rem;
    padding: 4px 6px;
  }

  .center-card h2 {
    font-size: 1.45rem;
  }

  .title-wrap {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .setup-grid {
    grid-template-columns: 1fr;
  }

  .legend-grid {
    grid-template-columns: 1fr;
  }
}

.token.active-turn {
  box-shadow: 0 0 0 3px rgba(110, 164, 255, 0.28), 0 2px 5px rgba(0,0,0,0.12);
  transform: scale(1.12);
}

#eventActionRow {
  justify-content: center;
}

.deck-area {
  display: flex;
  gap: 40px;
  align-items: center;
  justify-content: center;
}

.deck {
  width: 90px;
  height: 120px;
  border-radius: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 10px;
  font-weight: 800;
  color: white;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.deck:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.deck-label {
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.2;
}

.deck-count {
  opacity: 0.9;
  font-size: 0.72rem;
}

.event-deck {
  background: linear-gradient(135deg, #738eff, #936fff, #ff93bc);
}

.opportunity-deck {
  background: linear-gradient(135deg, #6ed7a8, #4bbf9f);
}

.deck.draw {
  animation: deck-draw 0.4s ease;
}

.upgrade-label {
  margin-top: 2px;
  font-size: 0.55rem;
  font-weight: 800;
  color: #4f6280;
  line-height: 1.1;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 88px;
}


.space.landed-highlight {
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.75), 0 0 24px rgba(96, 165, 250, 0.9);
  transform: scale(1.04);
  z-index: 5;
}


.ability-label {
  margin-top: 2px;
  font-size: 0.5rem;
  font-weight: 800;
  color: #6b4f12;
  background: rgba(255, 241, 180, 0.7);
  border-radius: 999px;
  padding: 1px 4px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 88px;
}

.money-popup {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  font-weight: 900;
  font-size: 1rem;
  padding: 6px 10px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.2);
  pointer-events: none;
  z-index: 50;
  animation: moneyFloat 1s ease-out forwards;
}

.money-popup.positive {
  color: #15803d;
}

.money-popup.negative {
  color: #b91c1c;
}

@keyframes moneyFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.8);
  }

  20% {
    opacity: 1;
    transform: translate(-50%, -8px) scale(1.05);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -44px) scale(1);
  }
}





@keyframes deck-draw {
  0% { transform: scale(1); }
  50% { transform: scale(1.15) rotate(-2deg); }
  100% { transform: scale(1); }
}

.flying-card {
  position: fixed;
  left: 0;
  top: 0;
  width: 120px;
  height: 160px;
  border-radius: 18px;
  z-index: 100;
  pointer-events: none;
  background: linear-gradient(135deg, #738eff, #936fff, #ff93bc);
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  transform: translate(-50%, -50%) scale(0.72);
  opacity: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.3);
}

.flying-card-label {
  color: white;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.flying-card.opportunity {
  background: linear-gradient(135deg, #6ed7a8, #4bbf9f);
}




.test-toolbar {
  position: fixed;
  bottom: 10px;
  right: 10px;
  z-index: 9999;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 360px;
  justify-content: flex-end;
}

.test-toolbar button {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.75rem;
}

/* ====================== */
/* Friendly Trade UI      */
/* ====================== */
.trade-button {
  background: linear-gradient(180deg, #2f93ff 0%, #1265d8 100%);
  color: #fff;
  box-shadow: 0 12px 26px rgba(18, 101, 216, 0.24);
}

.floating-trade-button {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  min-width: 120px;
}

.trade-backdrop {
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(6px);
  z-index: 90;
}

.trade-modal {
  width: min(940px, 96vw);
  max-height: 92vh;
  overflow: auto;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
}

.trade-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 54px 1fr 54px;
  align-items: center;
  padding: 16px 18px;
  background: linear-gradient(180deg, #1c62bc 0%, #0e4b9c 100%);
  color: #fff;
  border-radius: 28px 28px 0 0;
}

.trade-header h3 {
  margin: 0;
  text-align: center;
  font-size: 1.65rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.trade-header-icon {
  font-size: 1.8rem;
}

.trade-close {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  padding: 0;
  font-size: 2rem;
  line-height: 1;
  background: #fff;
  color: #1f2a44;
}

.trade-with-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 18px 4px;
  font-size: 1rem;
  color: #40506c;
  font-weight: 700;
}

.trade-player-select,
.trade-input {
  width: 100%;
  border: 1px solid #cfdced;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  color: #1f2a44;
  font: inherit;
  font-weight: 750;
  outline: none;
}

.trade-player-select {
  max-width: 260px;
  background: #eef6ff;
  color: #0f4f9e;
}

.trade-status {
  margin: 12px auto 0;
  width: calc(100% - 44px);
  border-radius: 16px;
  padding: 11px 14px;
  font-weight: 800;
  text-align: center;
}

.trade-status.warning,
.trade-status.declined {
  background: #fff1d8;
  color: #8a4c00;
  border: 1px solid #ffd28f;
}

.trade-status.accepted {
  background: #e7f8ed;
  color: #116130;
  border: 1px solid #bfeaca;
}

.trade-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(210px, 0.8fr) minmax(220px, 1fr);
  gap: 16px;
  padding: 20px 22px 14px;
}

.trade-side {
  border-radius: 24px;
  padding: 16px;
  display: grid;
  gap: 10px;
}

.you-side {
  background: linear-gradient(180deg, #f0f8ff 0%, #e7f2ff 100%);
  border: 1px solid #a9d0ff;
}

.them-side {
  background: linear-gradient(180deg, #fff3f4 0%, #ffe9ec 100%);
  border: 1px solid #ffb8c1;
}

.trade-side-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.trade-side-title strong {
  display: block;
  color: #16223a;
  font-size: 1.18rem;
}

.trade-side-title small {
  display: block;
  color: #6b7890;
  font-weight: 650;
  margin-top: 2px;
}

.trade-avatar {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.you-avatar { border: 3px solid #66aaf8; }
.them-avatar { border: 3px solid #ff9daa; }

.trade-label {
  font-size: 0.86rem;
  font-weight: 900;
  color: #1e2b46;
  margin-top: 4px;
}

.cash-input-wrap {
  position: relative;
}

.cash-input-wrap span {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #6a7890;
  font-weight: 900;
  z-index: 1;
}

.cash-input-wrap input {
  padding-left: 32px;
}

.trade-total {
  margin-top: 6px;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 900;
}

.you-total {
  background: #dff0ff;
  color: #0d5cad;
}

.them-total {
  background: #ffe0e5;
  color: #c3213a;
}

.trade-total strong {
  font-size: 1.35rem;
}

.trade-summary-card {
  align-self: stretch;
  border: 1px solid #f1d2a2;
  border-radius: 24px;
  padding: 18px;
  background: linear-gradient(180deg, #fff8eb 0%, #fff1dc 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.trade-shake {
  text-align: center;
  font-size: 3.1rem;
  margin-bottom: 2px;
}

.trade-summary-card h4 {
  margin: 0 0 8px;
  text-align: center;
  color: #7c3f20;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
  color: #273550;
}

.summary-line {
  height: 1px;
  background: rgba(124, 63, 32, 0.18);
  margin: 4px 0;
}

.trade-hint {
  margin-top: 10px;
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.72);
  color: #5d6a80;
  font-size: 0.9rem;
  line-height: 1.35;
  font-weight: 800;
  text-align: center;
}

.trade-hint.good-for-you { color: #116130; background: #e9f8ef; }
.trade-hint.caution { color: #974100; background: #fff1d8; }
.trade-hint.balanced { color: #0d5cad; background: #e7f2ff; }

.trade-tip {
  margin: 0 22px 16px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid #f1d2a2;
  background: #fff8eb;
  color: #663d15;
  text-align: center;
  font-weight: 750;
}

.trade-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 0 22px 22px;
  flex-wrap: wrap;
}

.trade-actions button {
  min-width: 180px;
  font-size: 1rem;
}

@media (max-width: 820px) {
  .trade-grid {
    grid-template-columns: 1fr;
  }

  .trade-summary-card {
    order: 3;
  }

  .trade-with-row {
    flex-direction: column;
  }
}


/* =====================================================
   Polished board-game layout inspired by the mockup
   ===================================================== */
:root {
  --game-blue: #1677d8;
  --game-blue-dark: #102b4b;
  --game-line: #2b91e6;
  --card-cream: #fffdf2;
  --card-shadow: 0 6px 0 rgba(47, 107, 165, 0.16), 0 12px 28px rgba(21, 63, 115, 0.18);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 26% 18%, rgba(255,255,255,0.95) 0 16%, transparent 34%),
    linear-gradient(180deg, #f8fcff 0%, #e8f5ff 100%);
}

.game-shell {
  width: min(1510px, 100vw);
  margin: 0 auto;
  padding: 14px 14px 12px;
}

.app {
  max-width: none;
  padding: 0;
  grid-template-columns: minmax(820px, 1fr) 425px;
  gap: 14px;
  align-items: start;
}

.panel {
  border-radius: 18px;
  box-shadow: 0 12px 36px rgba(27, 77, 130, 0.18);
  border: 1px solid rgba(43, 125, 210, 0.28);
}

.board-panel {
  padding: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(238,248,255,0.82));
  overflow: hidden;
}

.title-wrap { display: none; }

.board {
  width: 100%;
  aspect-ratio: 1.23 / 1;
  display: grid;
  grid-template-columns: 168px repeat(5, minmax(116px, 1fr)) 168px;
  grid-template-rows: repeat(7, minmax(92px, 1fr));
  gap: 6px;
  padding: 10px;
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.9) 0 28%, rgba(217,239,255,0.44) 55%, rgba(245,251,255,0.55) 100%);
}

.space {
  border-radius: 15px;
  border: 2px solid #5aa7ed;
  background: linear-gradient(180deg, #fffef7 0%, #fff4dc 100%);
  padding: 9px 8px 7px;
  justify-content: flex-start;
  align-items: center;
  text-align: center;
  box-shadow: var(--card-shadow);
  min-height: 0;
}

.space::before { display: none; }
.space-color-bar {
  position: absolute;
  inset: 0 0 auto 0;
  height: 10px;
  border-radius: 13px 13px 0 0;
  background: #2f97e8;
}

.space.property.green .space-color-bar { background: #25b84c; }
.space.property.pink .space-color-bar { background: #ff498a; }
.space.property.blue .space-color-bar { background: #2196f3; }
.space.property.purple .space-color-bar { background: #9b42d6; }
.space.property.gold .space-color-bar { background: #ffad18; }
.space.card-space.event-space .space-color-bar { background: #8f38cf; }
.space.card-space.opportunity-space .space-color-bar { background: #1395de; }
.space.special .space-color-bar { background: #ffad18; }
.space[data-space-id="0"] .space-color-bar { background: #1fbb63; }
.space[data-space-id="6"] .space-color-bar { background: #ff4b3d; }

.space-top { justify-content: center; width: 100%; margin-top: 8px; }
.space-name {
  font-size: clamp(0.72rem, 0.86vw, 0.95rem);
  line-height: 1.05;
  text-transform: uppercase;
  color: #101827;
  text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}
.space-price {
  color: #111827;
  font-size: clamp(0.72rem, 0.82vw, 0.9rem);
  font-weight: 800;
  margin-top: 3px;
}
.space-icon {
  font-size: clamp(1.9rem, 3.2vw, 3.05rem);
  line-height: 1;
  margin: 6px 0 4px;
  filter: drop-shadow(0 4px 2px rgba(20, 45, 70, 0.18));
}
.space-type {
  color: #202b3a;
  font-size: clamp(0.68rem, 0.75vw, 0.82rem);
  font-weight: 700;
  padding: 0;
  margin-top: auto;
}
.upgrade-label,
.ability-label,
.owner-chip { display: none; }
.tokens {
  left: -20px;
  right: auto;
  bottom: 50%;
  transform: translateY(50%);
  flex-direction: column;
  max-width: none;
}
.token {
  width: 30px;
  height: 30px;
  border: 3px solid #fff;
  box-shadow: 0 3px 0 rgba(38, 76, 120, 0.26), 0 5px 12px rgba(15, 35, 60, 0.28);
}

.center-card {
  grid-column: 2 / 7;
  grid-row: 2 / 7;
  border: 2px solid rgba(75, 164, 239, 0.42);
  border-radius: 28px;
  background:
    linear-gradient(rgba(231, 247, 255, 0.74), rgba(231, 247, 255, 0.74)),
    radial-gradient(circle at 30% 24%, rgba(255,255,255,0.9), transparent 16%),
    linear-gradient(135deg, #dff3ff, #f7fdff 48%, #dcefff);
  box-shadow: inset 0 0 45px rgba(75, 157, 225, 0.16);
}
.center-card::after { display: none; }
.center-inner { max-width: 600px; }
.campus-logo {
  display: inline-grid;
  text-transform: uppercase;
  letter-spacing: -0.04em;
  line-height: 0.82;
  font-weight: 950;
  font-size: clamp(2.6rem, 5vw, 4.9rem);
  color: #fff;
  -webkit-text-stroke: 2px #17233d;
  text-shadow: 0 4px 0 #17233d, 0 8px 0 rgba(246, 165, 36, 0.95), 0 15px 20px rgba(20,40,80,.25);
}
.campus-logo strong { color: #ffc233; }
.center-card p {
  max-width: 460px;
  margin: 26px auto 0;
  color: #13294b;
  font-size: clamp(0.95rem, 1.2vw, 1.15rem);
  font-weight: 800;
}
.deck-area { gap: 34px; }
.deck {
  width: 114px;
  height: 148px;
  border-radius: 16px;
  padding: 15px 10px;
  align-items: center;
  justify-content: center;
  display: grid;
  border: 3px solid rgba(255,255,255,.8);
  box-shadow: 0 8px 0 rgba(20, 70, 130, .18), 0 14px 22px rgba(20,60,100,.18);
}
.deck-big-icon { font-size: 3rem; }
.deck-label { font-size: 1rem; text-transform: uppercase; }
.deck-count-bubble {
  position: absolute;
  right: -14px;
  bottom: -12px;
  background: white;
  color: #14305a;
  border-radius: 999px;
  padding: 5px 9px;
  font-weight: 950;
  box-shadow: 0 3px 9px rgba(0,0,0,.2);
}

.sidebar {
  padding: 0;
  gap: 12px;
  background: transparent;
  box-shadow: none;
  border: none;
  position: sticky;
  top: 10px;
}
.sidebar > * {
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(15, 40, 70, 0.2);
}
.result-box,
.sidebar > div:not(.result-box) {
  background: linear-gradient(180deg, #102b4b 0%, #081a2d 100%);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  padding: 14px;
}
.hero-box { background: linear-gradient(180deg, #f8fcff, #eff7ff); color: #13233a; }
.section-title { text-transform: uppercase; letter-spacing: 0.02em; font-weight: 900; }
.dice-area { justify-content: center; }
.dice {
  width: 72px;
  height: 72px;
  background: #fff;
  color: #111827;
  font-size: 2.25rem;
  border-radius: 12px;
  box-shadow: 0 5px 0 rgba(0,0,0,.14), 0 8px 18px rgba(0,0,0,.14);
}
.badge-row { width: 100%; justify-content: center; }
.primary {
  background: linear-gradient(180deg, #2ac653 0%, #15933c 100%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 5px 0 rgba(0,80,28,.35);
}
.secondary { background: linear-gradient(180deg, #fff, #d7dce4); color: #111827; border: 1px solid #a7b0bd; }
.danger { background: linear-gradient(180deg, #fff1f1, #ffd8d8); color: #8e2020; }
.trade-button {
  font-size: 1.15rem;
  background: linear-gradient(180deg, #2b9bff 0%, #0968cf 100%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 5px 0 rgba(0,61,135,.35);
}

.player-list { gap: 6px; }
.player-card {
  padding: 10px 12px;
  background: linear-gradient(180deg, #203b58, #132a43);
  border: 1px solid rgba(255,255,255,.16);
  color: #fff;
  border-radius: 10px;
}
.player-card.active {
  background: linear-gradient(180deg, #0d8dff, #0766ca);
  box-shadow: 0 0 0 2px rgba(97, 183, 255, .55);
}
.player-name { gap: 10px; }
.player-name > span:last-child { display: grid; gap: 2px; }
.player-name small { font-size: .75rem; font-weight: 700; opacity: .9; }
.player-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  font-size: 1.45rem;
}
.money { color: #fff; font-size: 1.25rem; }
.player-detail { display: none; }
.dot { width: 18px; height: 18px; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.log {
  background: rgba(255,255,255,0.06);
  border: none;
  color: #e9f5ff;
  max-height: 210px;
}
.log-entry { border-bottom: 1px solid rgba(255,255,255,0.08); color: #eef7ff; }
.legend-grid { display: none; }
.sidebar .result-box:nth-of-type(2) { display: none; }
.event-preview { display: none; }

.feature-strip {
  margin-top: 10px;
  border: 1px solid rgba(80, 143, 205, .35);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(239,247,255,.92));
  box-shadow: 0 10px 28px rgba(30, 80, 130, .14);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  overflow: hidden;
}
.feature-item {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  color: #10233f;
  border-right: 1px solid rgba(62, 98, 140, .2);
}
.feature-item:last-child { border-right: none; }
.feature-icon { font-size: 2rem; filter: drop-shadow(0 2px 2px rgba(20,50,80,.2)); }
.feature-item strong { display:block; text-transform: uppercase; font-weight: 950; font-size: .95rem; }
.feature-item span:not(.feature-icon) { display:block; color:#314765; font-weight:650; font-size:.86rem; line-height:1.25; }

@media (max-width: 1180px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .game-shell { padding: 8px; }
  .board { grid-template-columns: repeat(7, minmax(45px, 1fr)); grid-template-rows: repeat(7, 72px); gap: 4px; padding: 6px; aspect-ratio: 1/1; }
  .space-icon { font-size: 1.5rem; }
  .space-name { font-size: .56rem; }
  .space-price, .space-type { font-size: .52rem; }
  .center-card { border-radius: 18px; padding: 10px; }
  .campus-logo { font-size: 2rem; -webkit-text-stroke: 1px #17233d; text-shadow: 0 2px 0 #17233d, 0 4px 0 rgba(246, 165, 36, 0.95); }
  .center-card p { display: none; }
  .deck { width: 70px; height: 92px; }
  .deck-big-icon { font-size: 1.8rem; }
  .deck-label { font-size: .65rem; }
  .feature-strip { grid-template-columns: 1fr; }
  .feature-item { border-right: none; border-bottom: 1px solid rgba(62, 98, 140, .2); }
}


/* Advanced AI + auction polish */
.ai-personality-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.16);
  font-size: 0.68rem;
  font-weight: 900;
}


/* =====================================================
   Restored setup menu + fuller player profile details
   ===================================================== */
.player-card {
  display: block;
}

.player-detail {
  display: block !important;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.88);
  font-size: 0.82rem;
  line-height: 1.35;
}

.player-card.active .player-detail {
  color: rgba(255,255,255,0.95);
}

.setup-backdrop {
  background: rgba(8, 24, 44, 0.62);
  backdrop-filter: blur(7px);
}

.setup-panel {
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.78);
  background: linear-gradient(180deg, #ffffff 0%, #eef7ff 100%);
  box-shadow: 0 30px 90px rgba(10, 40, 75, 0.35);
}

.setup-panel h2 {
  font-size: 2rem;
  text-align: center;
  color: #102b4b;
}

.setup-panel p,
.setup-note {
  text-align: center;
}

.setup-field select,
.setup-field input {
  border: 2px solid #c8def4;
  background: #ffffff;
  font-weight: 800;
}

.setup-actions {
  justify-content: center;
}

.setup-actions .primary {
  min-width: 210px;
  font-size: 1.05rem;
}

/* =====================================================
   Final fix: show upgrade labels clearly on polished board
   Added to override earlier hidden label rules
   ===================================================== */
.owner-chip {
  display: none !important;
}

.upgrade-label {
  display: block !important;
  margin-top: 2px;
  font-size: 0.58rem;
  font-weight: 900;
  color: #10233f;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(16, 35, 63, 0.1);
  border-radius: 999px;
  padding: 2px 6px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 92%;
  align-self: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.ability-label {
  display: block !important;
  margin-top: 2px;
  font-size: 0.52rem;
  font-weight: 900;
  color: #6b4f12;
  background: rgba(255, 241, 180, 0.9);
  border: 1px solid rgba(107, 79, 18, 0.1);
  border-radius: 999px;
  padding: 1px 5px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 92%;
  align-self: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}

.space-icon {
  font-size: clamp(1.6rem, 2.6vw, 2.4rem);
  margin: 4px 0 2px;
}

@media (max-width: 860px) {
  .upgrade-label {
    font-size: 0.48rem;
    padding: 1px 4px;
    max-width: 96%;
  }

  .ability-label {
    font-size: 0.45rem;
    padding: 1px 4px;
    max-width: 96%;
  }

  .space-icon {
    font-size: 1.35rem;
    margin: 2px 0 1px;
  }
}

/* =====================================================
   Clean board cards + hover/tap space detail popups
   Keeps icons and upgrade icons visible while moving full
   dollar/rent details into a tooltip.
   ===================================================== */
.board-panel,
.board,
.space {
  overflow: visible !important;
}

.space {
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: stretch !important;
  align-items: stretch !important;
  text-align: center !important;
  isolation: isolate;
  cursor: help;
}

.space-color-bar {
  position: relative !important;
  inset: auto !important;
  height: 24px !important;
  min-height: 24px !important;
  border-radius: 12px 12px 0 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 5px !important;
  z-index: 2;
}

.space-name {
  font-size: clamp(0.52rem, 0.68vw, 0.74rem) !important;
  line-height: 1 !important;
  font-weight: 950 !important;
  color: #ffffff !important;
  text-transform: uppercase !important;
  letter-spacing: -0.01em !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100% !important;
}

/* Lighter top bars need dark text for readability */
.space.property.gold .space-name,
.space.special .space-name,
.space[data-space-id="0"] .space-name {
  color: #10233f !important;
  text-shadow: 0 1px 0 rgba(255,255,255,0.7) !important;
}

.space-card-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  padding: 3px 6px 5px;
  position: relative;
}

/* Keep board card clean. Full price/rent details are in tooltip. */
.space.property .main-price,
.space.property .space-type {
  display: none !important;
}

.space:not(.property) .main-price {
  display: block !important;
  font-size: clamp(0.56rem, 0.62vw, 0.72rem) !important;
  font-weight: 900 !important;
  color: #111827 !important;
  line-height: 1 !important;
  margin: 2px 0 0 !important;
}

.space-icon {
  display: grid !important;
  place-items: center !important;
  font-size: clamp(1.65rem, 2.7vw, 2.75rem) !important;
  line-height: 1 !important;
  margin: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  filter: drop-shadow(0 4px 2px rgba(20, 45, 70, 0.18));
  transform-origin: center;
}

.space-bottom-info {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 1px;
  min-height: 18px;
}

.upgrade-icon-row {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 1px !important;
  max-width: 100% !important;
  font-size: clamp(0.55rem, 0.78vw, 0.82rem) !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.12));
}

.upgrade-label,
.ability-label {
  display: block !important;
  max-width: 96% !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  align-self: center !important;
  line-height: 1.08 !important;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06) !important;
}

.upgrade-label {
  margin: 0 !important;
  font-size: clamp(0.42rem, 0.5vw, 0.56rem) !important;
  font-weight: 950 !important;
  color: #10233f !important;
  background: rgba(255, 255, 255, 0.88) !important;
  border: 1px solid rgba(16, 35, 63, 0.1) !important;
  border-radius: 999px !important;
  padding: 1px 5px !important;
}

.ability-label {
  margin: 0 !important;
  font-size: clamp(0.4rem, 0.46vw, 0.52rem) !important;
  font-weight: 950 !important;
  color: #6b4f12 !important;
  background: rgba(255, 241, 180, 0.92) !important;
  border: 1px solid rgba(107, 79, 18, 0.1) !important;
  border-radius: 999px !important;
  padding: 1px 5px !important;
}

.owner-chip {
  display: none !important;
}

.upgrade-container {
  display: none !important;
}

.space-type {
  padding: 0 !important;
  margin: 0 !important;
  font-size: clamp(0.48rem, 0.56vw, 0.66rem) !important;
  font-weight: 800 !important;
  color: #1f2d3d !important;
}

/* Detail popup. Works on hover, keyboard focus, and tap/click via tooltip-open. */
.space::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(4px) scale(0.98);
  width: max-content;
  min-width: 170px;
  max-width: 240px;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f9ff 100%);
  color: #10233f;
  border: 1px solid rgba(43, 125, 210, 0.32);
  box-shadow: 0 16px 36px rgba(15, 40, 70, 0.22);
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.35;
  text-align: left;
  white-space: pre-line;
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.space::before {
  content: '' !important;
  position: absolute !important;
  left: 50% !important;
  bottom: calc(100% + 2px) !important;
  transform: translateX(-50%) !important;
  width: 0 !important;
  height: 0 !important;
  border-left: 8px solid transparent !important;
  border-right: 8px solid transparent !important;
  border-top: 8px solid #f4f9ff !important;
  background: transparent !important;
  opacity: 0 !important;
  z-index: 1000 !important;
  pointer-events: none !important;
  transition: opacity 0.15s ease !important;
}

.space:hover,
.space:focus,
.space.tooltip-open {
  z-index: 50 !important;
}

.space:hover::after,
.space:focus::after,
.space.tooltip-open::after,
.space:hover::before,
.space:focus::before,
.space.tooltip-open::before {
  opacity: 1 !important;
}

.space:hover::after,
.space:focus::after,
.space.tooltip-open::after {
  transform: translateX(-50%) translateY(0) scale(1) !important;
}

/* Keep tooltips inside screen a little better on the left/right columns */
.space:nth-child(7n + 1)::after,
.space:nth-child(7n + 1)::before {
  left: 0 !important;
  transform: translateX(0) translateY(4px) scale(0.98);
}

.space:nth-child(7n)::after,
.space:nth-child(7n)::before {
  left: auto !important;
  right: 0 !important;
  transform: translateX(0) translateY(4px) scale(0.98);
}

.space:nth-child(7n + 1):hover::after,
.space:nth-child(7n + 1):focus::after,
.space:nth-child(7n + 1).tooltip-open::after,
.space:nth-child(7n):hover::after,
.space:nth-child(7n):focus::after,
.space:nth-child(7n).tooltip-open::after {
  transform: translateX(0) translateY(0) scale(1) !important;
}

@media (max-width: 860px) {
  .space-color-bar {
    height: 18px !important;
    min-height: 18px !important;
    padding: 0 3px !important;
  }

  .space-name {
    font-size: 0.46rem !important;
  }

  .space-card-body {
    padding: 2px 3px 3px;
  }

  .space-icon {
    font-size: 1.28rem !important;
  }

  .upgrade-icon-row {
    font-size: 0.48rem !important;
  }

  .upgrade-label {
    font-size: 0.38rem !important;
    padding: 1px 3px !important;
  }

  .ability-label {
    font-size: 0.36rem !important;
    padding: 1px 3px !important;
  }

  .space::after {
    min-width: 145px;
    max-width: 200px;
    font-size: 0.68rem;
    padding: 8px 9px;
  }
}

/* =====================================================
   Tooltip + clean-space final fix
   - Show top-row popups below the space so they are visible
   - Hide on-card money amounts for bonus/penalty/property spaces
     because full details are shown in the tooltip
   ===================================================== */

/* Keep the board cards clean: full money details live in the popup. */
.space .main-price {
  display: none !important;
}

/* Give the illustration more room now that prices are removed. */
.space-card-body {
  grid-template-rows: 1fr auto !important;
  padding: 5px 6px 6px !important;
}

.space-icon {
  font-size: clamp(1.85rem, 3vw, 2.9rem) !important;
  margin: 1px 0 2px !important;
}

.space-bottom-info {
  min-height: 18px !important;
}

/* Top row: show tooltip BELOW the space, not above the browser window. */
.space.tooltip-below::after {
  top: calc(100% + 10px) !important;
  bottom: auto !important;
}

.space.tooltip-below::before {
  top: calc(100% + 2px) !important;
  bottom: auto !important;
  border-left: 8px solid transparent !important;
  border-right: 8px solid transparent !important;
  border-bottom: 8px solid #ffffff !important;
  border-top: 0 !important;
}

.space.tooltip-below:hover::after,
.space.tooltip-below:focus::after,
.space.tooltip-below.tooltip-open::after {
  transform: translateX(-50%) translateY(0) scale(1) !important;
}

/* Bottom row stays above. */
.space.tooltip-above::after {
  top: auto !important;
  bottom: calc(100% + 10px) !important;
}

.space.tooltip-above::before {
  top: auto !important;
  bottom: calc(100% + 2px) !important;
  border-left: 8px solid transparent !important;
  border-right: 8px solid transparent !important;
  border-top: 8px solid #f4f9ff !important;
  border-bottom: 0 !important;
}

/* Left and right columns: keep popup inside the board area. */
.space.tooltip-align-left::after,
.space.tooltip-align-left::before {
  left: 0 !important;
  right: auto !important;
  transform: translateX(0) translateY(4px) scale(0.98) !important;
}

.space.tooltip-align-right::after,
.space.tooltip-align-right::before {
  left: auto !important;
  right: 0 !important;
  transform: translateX(0) translateY(4px) scale(0.98) !important;
}

.space.tooltip-align-left:hover::after,
.space.tooltip-align-left:focus::after,
.space.tooltip-align-left.tooltip-open::after,
.space.tooltip-align-right:hover::after,
.space.tooltip-align-right:focus::after,
.space.tooltip-align-right.tooltip-open::after {
  transform: translateX(0) translateY(0) scale(1) !important;
}

/* Top corners need to open below and align inward. */
.space.tooltip-below.tooltip-align-left::after,
.space.tooltip-below.tooltip-align-left::before,
.space.tooltip-below.tooltip-align-right::after,
.space.tooltip-below.tooltip-align-right::before {
  top: calc(100% + 10px) !important;
  bottom: auto !important;
}

.space.tooltip-below.tooltip-align-left::before,
.space.tooltip-below.tooltip-align-right::before {
  top: calc(100% + 2px) !important;
}

@media (max-width: 860px) {
  .space-card-body {
    padding: 3px 3px 4px !important;
  }

  .space-icon {
    font-size: 1.45rem !important;
  }
}

/* =====================================================
   FINAL clean board + polished tooltip behavior
   Requested:
   - Hide all on-card money amounts
   - Hide base/upgrade text labels like "Base Library"
   - Keep illustrations/icons
   - Keep upgrade icons
   - Keep ability labels like 📚 Study Bonus / 🏀 Team Spirit
   - Keep event/opportunity action labels
   - Show full details in hover/tap tooltip
   ===================================================== */

/* Remove all visible dollar/amount text from the board cards. */
.space-price,
.space .main-price {
  display: none !important;
}

/* Hide upgrade text labels such as Base Library / Base Cafeteria.
   The current upgrade name still appears in the tooltip. */
.upgrade-label {
  display: none !important;
}

/* Keep ability labels visible and compact. */
.ability-label {
  display: block !important;
  max-width: 96% !important;
  margin: 0 !important;
  padding: 2px 6px !important;
  border-radius: 999px !important;
  background: rgba(255, 241, 180, 0.95) !important;
  border: 1px solid rgba(107, 79, 18, 0.12) !important;
  color: #6b4f12 !important;
  font-size: clamp(0.43rem, 0.48vw, 0.55rem) !important;
  font-weight: 950 !important;
  line-height: 1.05 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Keep event/opportunity labels readable, but compact. */
.space-type {
  display: block !important;
  max-width: 96% !important;
  margin: 0 !important;
  padding: 0 !important;
  color: #1f2d3d !important;
  font-size: clamp(0.48rem, 0.55vw, 0.65rem) !important;
  font-weight: 850 !important;
  line-height: 1.05 !important;
  white-space: normal !important;
}

/* Since money and base labels are removed, let the icon breathe. */
.space-card-body {
  grid-template-rows: 1fr auto !important;
  padding: 5px 6px 6px !important;
}

.space-icon {
  font-size: clamp(1.9rem, 3.2vw, 3rem) !important;
  margin: 0 !important;
}

.space-bottom-info {
  min-height: 16px !important;
  gap: 2px !important;
}

/* Upgrade icons stay visible, small, and centered. */
.upgrade-icon-row {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  max-width: 96% !important;
  font-size: clamp(0.58rem, 0.78vw, 0.86rem) !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Friendly hover/tap feedback. */
.space {
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease !important;
}

.space:hover,
.space:focus,
.space.tooltip-open {
  transform: translateY(-2px) scale(1.025) !important;
  box-shadow: 0 8px 0 rgba(47, 107, 165, 0.13), 0 18px 34px rgba(21, 63, 115, 0.25), 0 0 0 3px rgba(47, 151, 232, 0.18) !important;
  z-index: 60 !important;
}

/* Tooltip as a polished mini info card. */
.space::after {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98) 0%, rgba(242,248,255,0.98) 100%) !important;
  border: 2px solid rgba(43, 125, 210, 0.34) !important;
  border-left: 6px solid var(--game-blue, #1677d8) !important;
  border-radius: 16px !important;
  box-shadow: 0 18px 42px rgba(15, 40, 70, 0.28) !important;
  color: #10233f !important;
  font-size: 0.78rem !important;
  font-weight: 800 !important;
  line-height: 1.38 !important;
  letter-spacing: 0.005em !important;
  padding: 11px 13px !important;
  min-width: 190px !important;
  max-width: 260px !important;
}

/* Tooltip arrow polish. */
.space::before {
  filter: drop-shadow(0 2px 2px rgba(15, 40, 70, 0.18)) !important;
}

/* Top row opens downward. */
.space.tooltip-below::after {
  top: calc(100% + 12px) !important;
  bottom: auto !important;
}

.space.tooltip-below::before {
  top: calc(100% + 4px) !important;
  bottom: auto !important;
  border-left: 8px solid transparent !important;
  border-right: 8px solid transparent !important;
  border-bottom: 8px solid #ffffff !important;
  border-top: 0 !important;
}

/* Bottom row opens upward. */
.space.tooltip-above::after {
  top: auto !important;
  bottom: calc(100% + 12px) !important;
}

.space.tooltip-above::before {
  top: auto !important;
  bottom: calc(100% + 4px) !important;
  border-left: 8px solid transparent !important;
  border-right: 8px solid transparent !important;
  border-top: 8px solid #f4f9ff !important;
  border-bottom: 0 !important;
}

@media (max-width: 860px) {
  .space-card-body {
    padding: 3px 3px 4px !important;
  }

  .space-icon {
    font-size: 1.45rem !important;
  }

  .ability-label {
    font-size: 0.36rem !important;
    padding: 1px 4px !important;
  }

  .space-type {
    font-size: 0.4rem !important;
  }

  .upgrade-icon-row {
    font-size: 0.5rem !important;
  }

  .space::after {
    min-width: 155px !important;
    max-width: 210px !important;
    font-size: 0.68rem !important;
    padding: 9px 10px !important;
  }
}


/* =====================================================
   FINAL OVERRIDE: absolutely no money amounts on board
   The script no longer renders main-price, and these rules
   hide any remaining legacy amount elements. Details remain
   available in the hover/tap tooltip.
   ===================================================== */
.space-price,
.main-price,
.space .main-price,
.space-card-body > .space-price,
.space-card-body > .main-price {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

/* With money removed, keep the board face simple: icon + bottom labels. */
.space-card-body {
  grid-template-rows: 1fr auto !important;
}

/* Hide base upgrade text labels, keep upgrade icons and ability/action labels. */
.upgrade-label {
  display: none !important;
}

.ability-label,
.space.card-space .space-type,
.space:not(.property) .space-type {
  display: block !important;
}

/* =====================================================
   FINAL POLISH: make Event + Opportunity spaces stand out
   Event = purple/mystery card style
   Opportunity = bright blue/idea reward style
   ===================================================== */
.space.card-space {
  position: relative !important;
  border-width: 3px !important;
  box-shadow:
    0 7px 0 rgba(26, 58, 96, 0.18),
    0 14px 28px rgba(21, 63, 115, 0.22),
    inset 0 0 0 2px rgba(255,255,255,0.45) !important;
}

.space.card-space .space-color-bar {
  height: 28px !important;
  min-height: 28px !important;
  border-radius: 12px 12px 0 0 !important;
}

.space.card-space .space-name {
  font-size: clamp(0.56rem, 0.72vw, 0.78rem) !important;
  letter-spacing: 0.025em !important;
}

.space.event-space {
  border-color: #8b3be8 !important;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.55) 0%, transparent 42%),
    linear-gradient(180deg, #f7efff 0%, #ead9ff 100%) !important;
}

.space.event-space .space-color-bar {
  background: linear-gradient(135deg, #6b21c9 0%, #9736e8 48%, #ff73bb 100%) !important;
}

.space.opportunity-space {
  border-color: #1395de !important;
  background:
    radial-gradient(circle at top right, rgba(255,255,255,0.62) 0%, transparent 42%),
    linear-gradient(180deg, #effaff 0%, #d9f3ff 100%) !important;
}

.space.opportunity-space .space-color-bar {
  background: linear-gradient(135deg, #0476d9 0%, #18a9f2 50%, #6fe5ff 100%) !important;
}

.space.card-space .space-icon {
  font-size: clamp(2rem, 3.35vw, 3.15rem) !important;
  filter: drop-shadow(0 5px 2px rgba(20, 45, 70, 0.22)) !important;
}

.space.card-space .space-type {
  display: block !important;
  max-width: 94% !important;
  border-radius: 999px !important;
  padding: 2px 7px !important;
  font-size: clamp(0.42rem, 0.52vw, 0.62rem) !important;
  font-weight: 950 !important;
  line-height: 1.05 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  box-shadow: 0 2px 7px rgba(15, 40, 70, 0.12) !important;
}

.space.event-space .space-type {
  color: #ffffff !important;
  background: linear-gradient(180deg, #8b3be8 0%, #6824c2 100%) !important;
  border: 1px solid rgba(255,255,255,0.35) !important;
}

.space.opportunity-space .space-type {
  color: #05325c !important;
  background: linear-gradient(180deg, #c9f3ff 0%, #8ddfff 100%) !important;
  border: 1px solid rgba(4, 118, 217, 0.22) !important;
}

.space.card-space::selection {
  background: transparent;
}

/* Small corner badge to make card spaces recognizable at a glance */
.space.event-space .space-card-body::before,
.space.opportunity-space .space-card-body::before {
  position: absolute;
  right: 6px;
  top: 5px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.86);
  box-shadow: 0 2px 6px rgba(15, 40, 70, 0.16);
  font-size: 0.78rem;
  z-index: 3;
}

.space.event-space .space-card-body::before {
  content: '🎴';
}

.space.opportunity-space .space-card-body::before {
  content: '💡';
}

/* Give card spaces a gentle hover glow without changing layout */
.space.event-space:hover,
.space.event-space.tooltip-open {
  box-shadow:
    0 0 0 4px rgba(151, 54, 232, 0.28),
    0 10px 0 rgba(26, 58, 96, 0.16),
    0 18px 34px rgba(87, 38, 150, 0.32) !important;
}

.space.opportunity-space:hover,
.space.opportunity-space.tooltip-open {
  box-shadow:
    0 0 0 4px rgba(24, 169, 242, 0.28),
    0 10px 0 rgba(26, 58, 96, 0.16),
    0 18px 34px rgba(4, 118, 217, 0.28) !important;
}

@media (max-width: 860px) {
  .space.card-space .space-color-bar {
    height: 20px !important;
    min-height: 20px !important;
  }

  .space.card-space .space-name {
    font-size: 0.48rem !important;
  }

  .space.card-space .space-icon {
    font-size: 1.55rem !important;
  }

  .space.card-space .space-type {
    font-size: 0.36rem !important;
    padding: 1px 4px !important;
  }

  .space.event-space .space-card-body::before,
  .space.opportunity-space .space-card-body::before {
    width: 16px;
    height: 16px;
    right: 3px;
    top: 3px;
    font-size: 0.62rem;
  }
}

/* =====================================================
   Collapsible sidebar sections
   Deck Preview, Board Guide, and Game Log
   ===================================================== */
.collapsible-section {
  overflow: hidden;
}

.collapsible-header {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
  box-shadow: none;
  text-align: left;
}

.collapsible-header:hover {
  transform: none !important;
  box-shadow: none !important;
  background: rgba(255, 255, 255, 0.13);
}

.collapsible-header .section-title {
  margin: 0;
  font-size: 0.98rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-weight: 950;
}

.chevron {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.15);
  font-size: 1.05rem;
  line-height: 1;
  transition: transform 0.25s ease, background 0.25s ease;
}

.collapsible-section.is-collapsed .chevron {
  transform: rotate(-90deg);
}

.collapsible-content {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition: grid-template-rows 0.28s ease, opacity 0.22s ease;
}

.collapsible-section.is-collapsed .collapsible-content {
  grid-template-rows: 0fr;
  opacity: 0;
}

.collapsible-inner {
  overflow: hidden;
  padding-top: 12px;
}

/* Override earlier rules that hid these sidebar helpers. */
.collapsible-section .event-preview {
  display: flex !important;
  min-height: 135px;
}

.collapsible-section .legend-grid {
  display: grid !important;
  grid-template-columns: 1fr;
  gap: 8px;
}

.collapsible-section .legend-item {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

.scrollable-log {
  max-height: 180px !important;
  min-height: 92px;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.scrollable-log::-webkit-scrollbar {
  width: 8px;
}

.scrollable-log::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}

.scrollable-log::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 999px;
}

.game-log-section {
  background: linear-gradient(180deg, #102b4b 0%, #081a2d 100%);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  padding: 14px;
}

.hero-box .collapsible-header,
.result-box.hero-box .collapsible-header {
  background: rgba(16, 43, 75, 0.06);
}

@media (max-width: 860px) {
  .scrollable-log {
    max-height: 155px !important;
  }
}

/* =====================================================
   Distinct Event + Opportunity board spaces
   Matches the card deck gradient colors so these spaces
   feel special and are easier to spot on the board.
   ===================================================== */
.space.card-space.event-space,
.space.card-space.opportunity-space {
  border-width: 3px !important;
  color: #ffffff !important;
  transform-origin: center;
  overflow: visible !important;
}

.space.card-space.event-space {
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.14) 22%, transparent 44%),
    linear-gradient(135deg, #738eff 0%, #936fff 42%, #ff93bc 100%) !important;
  border-color: rgba(255, 147, 188, 0.95) !important;
  box-shadow:
    0 7px 0 rgba(107, 72, 176, 0.28),
    0 14px 28px rgba(139, 99, 255, 0.34),
    0 0 0 2px rgba(255,255,255,0.55) inset !important;
}

.space.card-space.opportunity-space {
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,0.38) 0%, rgba(255,255,255,0.14) 22%, transparent 44%),
    linear-gradient(135deg, #6ed7a8 0%, #4bbf9f 58%, #26a987 100%) !important;
  border-color: rgba(110, 215, 168, 0.95) !important;
  box-shadow:
    0 7px 0 rgba(28, 130, 95, 0.28),
    0 14px 28px rgba(75, 191, 159, 0.34),
    0 0 0 2px rgba(255,255,255,0.55) inset !important;
}

.space.card-space.event-space .space-color-bar,
.space.card-space.opportunity-space .space-color-bar {
  height: 28px !important;
  min-height: 28px !important;
  border-bottom: 1px solid rgba(255,255,255,0.28) !important;
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.18) !important;
}

.space.card-space.event-space .space-color-bar {
  background: linear-gradient(135deg, #5d75ef 0%, #7d55ef 45%, #f979aa 100%) !important;
}

.space.card-space.opportunity-space .space-color-bar {
  background: linear-gradient(135deg, #4ec991 0%, #29a981 100%) !important;
}

.space.card-space.event-space .space-name,
.space.card-space.opportunity-space .space-name {
  color: #ffffff !important;
  text-shadow: 0 2px 3px rgba(0,0,0,0.42) !important;
  letter-spacing: 0.01em !important;
}

.space.card-space.event-space .space-card-body,
.space.card-space.opportunity-space .space-card-body {
  background: rgba(255,255,255,0.12) !important;
  border-radius: 0 0 12px 12px !important;
  padding-bottom: 7px !important;
}

.space.card-space.event-space .space-icon,
.space.card-space.opportunity-space .space-icon {
  font-size: clamp(1.9rem, 3vw, 3rem) !important;
  filter: drop-shadow(0 4px 5px rgba(0,0,0,0.32)) !important;
  transform: scale(1.04);
}

.space.card-space.event-space .space-type,
.space.card-space.opportunity-space .space-type,
.space.card-space.event-space .ability-label,
.space.card-space.opportunity-space .ability-label,
.space.card-space.event-space .upgrade-label,
.space.card-space.opportunity-space .upgrade-label {
  color: #ffffff !important;
  background: rgba(255,255,255,0.18) !important;
  border-color: rgba(255,255,255,0.25) !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25) !important;
}

.space.card-space.event-space:hover,
.space.card-space.event-space.tooltip-open,
.space.card-space.opportunity-space:hover,
.space.card-space.opportunity-space.tooltip-open {
  transform: translateY(-2px) scale(1.035) !important;
}

.space.card-space.event-space.landed-highlight {
  box-shadow:
    0 0 0 5px rgba(255, 147, 188, 0.72),
    0 0 30px rgba(147, 111, 255, 0.9),
    0 7px 0 rgba(107, 72, 176, 0.28) !important;
}

.space.card-space.opportunity-space.landed-highlight {
  box-shadow:
    0 0 0 5px rgba(110, 215, 168, 0.72),
    0 0 30px rgba(75, 191, 159, 0.9),
    0 7px 0 rgba(28, 130, 95, 0.28) !important;
}

@media (max-width: 860px) {
  .space.card-space.event-space .space-color-bar,
  .space.card-space.opportunity-space .space-color-bar {
    height: 20px !important;
    min-height: 20px !important;
  }

  .space.card-space.event-space .space-icon,
  .space.card-space.opportunity-space .space-icon {
    font-size: 1.45rem !important;
  }
}
