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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0a0a1a;
  color: #f0f0f0;
  user-select: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#scene {
  position: absolute;
  inset: 0;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(20,20,40,0.85) 0%, rgba(0,0,0,0.95) 100%);
  z-index: 100;
  backdrop-filter: blur(8px);
}

.hidden { display: none !important; }

/* ---------- Start screen ---------- */
.start-card {
  background: linear-gradient(135deg, #1a1a3a 0%, #2a1a4a 100%);
  border: 2px solid #d4af37;
  border-radius: 16px;
  padding: 48px 56px;
  box-shadow: 0 20px 60px rgba(212,175,55,0.3), inset 0 0 40px rgba(212,175,55,0.05);
  text-align: center;
  min-width: 420px;
  max-width: 90vw;
}

.title {
  font-size: 64px;
  font-weight: 900;
  letter-spacing: 8px;
  color: #d4af37;
  text-shadow: 0 4px 20px rgba(212,175,55,0.5), 0 0 40px rgba(212,175,55,0.3);
  margin-bottom: 4px;
}

.subtitle {
  font-size: 18px;
  color: #a8a8c8;
  letter-spacing: 4px;
  margin-bottom: 32px;
  text-transform: uppercase;
}

.config {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 32px;
  text-align: left;
}

.config label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: #c0c0d0;
}

.config select {
  background: #0a0a1f;
  color: #f0f0f0;
  border: 1px solid #4a4a6a;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.config select:hover, .config select:focus {
  border-color: #d4af37;
  outline: none;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  transition: all 0.2s;
  padding: 10px 18px;
}

button.primary {
  background: linear-gradient(135deg, #d4af37 0%, #b8941f 100%);
  color: #1a1a3a;
  padding: 14px 36px;
  font-size: 17px;
  letter-spacing: 1px;
  box-shadow: 0 4px 12px rgba(212,175,55,0.4);
}

button.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212,175,55,0.6);
}

button.secondary {
  background: #2a2a4a;
  color: #f0f0f0;
  border: 1px solid #4a4a6a;
}

button.secondary:hover { background: #3a3a5a; }

button.danger {
  background: linear-gradient(135deg, #c04040 0%, #902020 100%);
  color: white;
}

button.danger:hover { filter: brightness(1.1); }

button.success {
  background: linear-gradient(135deg, #40a060 0%, #208040 100%);
  color: white;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.hint {
  margin-top: 20px;
  font-size: 12px;
  color: #80809a;
  font-style: italic;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#hud > * { pointer-events: auto; }

.panel {
  background: rgba(20,20,40,0.85);
  border: 1px solid rgba(212,175,55,0.4);
  border-radius: 10px;
  padding: 14px 18px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

#player-panel {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 280px;
}

#player-panel h2 {
  font-size: 18px;
  color: #d4af37;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

#player-panel .row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 14px;
  color: #c0c0d0;
}

#player-panel .row > span:last-child {
  color: #f0f0f0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

#player-panel .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

#player-panel .actions button {
  flex: 1 1 calc(50% - 3px);
  font-size: 13px;
  padding: 8px 6px;
}

.player-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  vertical-align: middle;
  box-shadow: 0 0 6px currentColor;
}

/* Players bar */
#players-bar {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
}

.player-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(40,40,60,0.6);
  border: 2px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s;
}

.player-card.active {
  background: rgba(212,175,55,0.2);
  border-color: #d4af37;
  box-shadow: 0 0 12px rgba(212,175,55,0.4);
}

.player-card.bankrupt {
  opacity: 0.4;
  text-decoration: line-through;
}

.player-card .pc-name { flex: 1; font-weight: 600; }
.player-card .pc-cash { color: #d4af37; font-variant-numeric: tabular-nums; }

/* Log */
#log {
  position: absolute;
  bottom: 20px;
  left: 20px;
  width: 320px;
  max-height: 280px;
  display: flex;
  flex-direction: column;
}

#log h3 {
  font-size: 14px;
  color: #d4af37;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#log-list {
  list-style: none;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.5;
  color: #c0c0d0;
  padding-right: 4px;
}

#log-list li {
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

#log-list li.roll { color: #f0c040; }
#log-list li.buy { color: #80d090; }
#log-list li.rent { color: #ff8080; }
#log-list li.card { color: #80c0ff; }
#log-list li.jail { color: #c080ff; }
#log-list li.info { color: #a0a0b0; }

#log-list::-webkit-scrollbar { width: 6px; }
#log-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
#log-list::-webkit-scrollbar-thumb { background: rgba(212,175,55,0.4); border-radius: 3px; }

/* Properties */
#properties {
  position: absolute;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  width: 260px;
  max-height: 60vh;
  display: flex;
  flex-direction: column;
}

#properties h3 {
  font-size: 14px;
  color: #d4af37;
  margin-bottom: 8px;
}

#properties-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.prop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: rgba(0,0,0,0.3);
  border-radius: 6px;
  font-size: 12px;
}

.prop-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.4);
}

.prop-row .pname { flex: 1; }
.prop-row .pmort { font-size: 10px; color: #ff8080; }
.prop-row .phouses { color: #80d090; font-size: 11px; }

/* Modal */
.modal-card {
  background: linear-gradient(135deg, #1a1a3a 0%, #2a1a4a 100%);
  border: 2px solid #d4af37;
  border-radius: 16px;
  padding: 32px 40px;
  min-width: 360px;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-card h2 {
  color: #d4af37;
  font-size: 24px;
  margin-bottom: 16px;
}

.modal-card p {
  color: #d0d0e0;
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 24px;
}

#modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  text-align: left;
}

.choice-list button {
  background: #2a2a4a;
  color: #f0f0f0;
  border: 1px solid #4a4a6a;
  text-align: left;
  padding: 10px 14px;
}

.choice-list button:hover { background: #3a3a5a; border-color: #d4af37; }

/* Dice indicator */
#dice-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20,20,40,0.9);
  border: 2px solid #d4af37;
  border-radius: 12px;
  padding: 12px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.dice-pair {
  display: flex;
  gap: 16px;
}

.die {
  width: 50px;
  height: 50px;
  background: #f0f0f0;
  color: #1a1a3a;
  font-size: 30px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4), inset 0 0 4px rgba(0,0,0,0.2);
  font-variant-numeric: tabular-nums;
}

.die.rolling { animation: dice-shake 0.1s infinite; }

@keyframes dice-shake {
  0% { transform: translate(0,0) rotate(0deg); }
  25% { transform: translate(2px,-2px) rotate(5deg); }
  50% { transform: translate(-2px,2px) rotate(-5deg); }
  75% { transform: translate(2px,2px) rotate(3deg); }
  100% { transform: translate(-2px,-2px) rotate(-3deg); }
}

#dice-total {
  color: #d4af37;
  font-weight: 700;
  font-size: 16px;
}

@media (max-width: 900px) {
  #player-panel { width: 220px; font-size: 12px; }
  #log { width: 240px; max-height: 200px; }
  #properties { width: 200px; }
  .title { font-size: 44px; letter-spacing: 4px; }
}
