:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #f7f1df;
  --muted: #b9c8be;
  --panel: rgba(9, 33, 22, 0.92);
  --panel-strong: #0d2f20;
  --line: rgba(229, 208, 142, 0.28);
  --gold: #e5d08e;
  --green: #2f8f4e;
  --danger: #e26b66;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: #071a12;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(47, 143, 78, 0.28), transparent 32rem),
    radial-gradient(circle at 90% 8%, rgba(229, 208, 142, 0.16), transparent 28rem),
    linear-gradient(160deg, #06140e 0%, #0a271a 52%, #071a12 100%);
}

a {
  color: var(--gold);
  text-underline-offset: 0.2em;
}

a:hover {
  color: #fff4bc;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid rgba(229, 208, 142, 0.48);
  border-radius: 0.75rem;
  padding: 0.72rem 0.95rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--gold);
  background: rgba(229, 208, 142, 0.14);
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #f8dc75;
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button.primary {
  color: #082015;
  border-color: #f0dc98;
  background: linear-gradient(135deg, #f5e6aa, #cfad4f);
  font-weight: 800;
}

button.danger {
  border-color: rgba(226, 107, 102, 0.75);
  color: #ffd8d6;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding: clamp(1.25rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: rgba(4, 18, 12, 0.78);
  backdrop-filter: blur(14px);
}

.app-header > div:first-child {
  max-width: 58rem;
}

.app-header h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4.5rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.app-header h1 + p {
  margin: 0.45rem 0 0;
  color: var(--gold);
  font-size: clamp(1.05rem, 2vw, 1.4rem);
  font-weight: 750;
}

.app-header p {
  max-width: 65ch;
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 0.7rem;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.header-actions,
.action-row,
.manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.header-actions {
  justify-content: flex-end;
  min-width: max-content;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
  gap: 1rem;
  padding: clamp(0.75rem, 2vw, 1.5rem);
  max-width: 1600px;
  margin: 0 auto;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1rem;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel h2,
.panel h3 {
  margin-top: 0;
}

.setup-panel {
  grid-column: 1 / -1;
}

.player-name-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}

.player-name-field {
  display: grid;
  gap: 0.35rem;
}

.player-name-field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input {
  width: 100%;
  border: 1px solid rgba(229, 208, 142, 0.28);
  border-radius: 0.7rem;
  padding: 0.75rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
}

.board-wrap {
  min-width: 0;
  overflow: auto;
  border-radius: 1rem;
  scrollbar-color: var(--gold) #0a2117;
}

.board {
  display: grid;
  grid-template-columns: repeat(11, minmax(3.7rem, 1fr));
  grid-template-rows: repeat(11, minmax(3.7rem, 1fr));
  gap: 2px;
  min-width: 760px;
  aspect-ratio: 1;
  padding: 0.35rem;
  border: 2px solid rgba(229, 208, 142, 0.42);
  border-radius: 1rem;
  background: #07170f;
  box-shadow: var(--shadow);
}

.board-center {
  grid-area: 2 / 2 / 11 / 11;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.65rem;
  padding: clamp(1rem, 4vw, 3rem);
  text-align: center;
  border: 1px solid rgba(229, 208, 142, 0.23);
  background:
    radial-gradient(circle, rgba(47, 143, 78, 0.28), transparent 58%),
    linear-gradient(145deg, #0b2d1d, #071a12);
}

.board-center h2 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(2rem, 5vw, 5.5rem);
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.board-center p {
  max-width: 35rem;
  margin: 0;
  color: var(--muted);
}

.dice-display {
  display: flex;
  gap: 0.5rem;
  min-height: 2.6rem;
}

.die {
  display: grid;
  place-items: center;
  width: 2.6rem;
  aspect-ratio: 1;
  border: 1px solid var(--gold);
  border-radius: 0.65rem;
  color: #10271b;
  background: #f7edca;
  font-size: 1.35rem;
  font-weight: 900;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  overflow: hidden;
  padding: 0.48rem 0.42rem 0.38rem;
  border: 1px solid rgba(15, 35, 24, 0.4);
  color: #122219;
  background: #f2ead1;
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--space-color, #efe2bd) 82%, white);
}

.tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 0.38rem;
  background: var(--space-color, #efe2bd);
}

.tile.current-space {
  z-index: 2;
  outline: 3px solid #fff3a8;
  outline-offset: -3px;
}

.tile.owned {
  background: #fff8df;
}

.tile.mortgaged {
  filter: grayscale(0.72);
  opacity: 0.72;
}

.tile-number {
  color: #526057;
  font-size: 0.62rem;
  font-weight: 800;
}

.tile-name {
  margin-top: 0.1rem;
  font-size: clamp(0.56rem, 0.8vw, 0.76rem);
  font-weight: 900;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.tile-price,
.owner-badge,
.upgrade-badge {
  font-size: 0.58rem;
  line-height: 1.1;
}

.tile-price {
  margin-top: auto;
  font-weight: 800;
}

.owner-badge {
  overflow: hidden;
  padding: 0.18rem 0.28rem;
  border-radius: 999px;
  color: #fff;
  background: #173f2a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upgrade-badge {
  color: #5a3e00;
  font-weight: 900;
}

.token-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.12rem;
  min-height: 1rem;
}

.player-token {
  display: inline-grid;
  place-items: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  font-size: 0.78rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.corner {
  background: #e8d5a5;
}

.card {
  background: #e5f0e7;
}

.tax,
.fee {
  background: #f4d6cf;
}

.utility {
  background: #dbe9e5;
}

.category {
  background: #efe1b1;
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 1rem;
}

.turn-summary {
  margin: 0 0 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.pending-card {
  margin: 0.8rem 0;
  padding: 0.8rem;
  border-left: 4px solid var(--gold);
  background: rgba(229, 208, 142, 0.1);
}

.player-list,
.property-list,
.log {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.player-card,
.property-card {
  border: 1px solid rgba(229, 208, 142, 0.19);
  border-radius: 0.8rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.045);
}

.player-card.current {
  border-color: var(--gold);
  background: rgba(229, 208, 142, 0.09);
}

.player-card header,
.property-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.player-card p,
.property-card p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.status-badge {
  display: inline-flex;
  padding: 0.18rem 0.42rem;
  border-radius: 999px;
  color: #082015;
  background: var(--gold);
  font-size: 0.65rem;
  font-weight: 900;
  text-transform: uppercase;
}

.auction-grid {
  display: grid;
  gap: 0.55rem;
  margin: 0.8rem 0;
}

.auction-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7rem;
  align-items: center;
  gap: 0.6rem;
}

.log {
  max-height: 22rem;
  overflow: auto;
  padding-right: 0.35rem;
  counter-reset: event;
}

.log li {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.log li:first-child {
  color: var(--ink);
  font-weight: 700;
}

.empty-state {
  color: var(--muted);
  font-style: italic;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

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

  .sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-header {
    display: grid;
  }

  .header-actions {
    justify-content: flex-start;
    min-width: 0;
  }

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

  .layout {
    padding: 0.65rem;
  }
}

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