html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Inter, Segoe UI, Arial, Helvetica, sans-serif;
  background: #07120b;
}
canvas { display: block; }
#ui {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 2;
  background: linear-gradient(145deg, rgba(8, 20, 14, 0.82), rgba(20, 34, 24, 0.72));
  color: #f6fff4;
  padding: 14px 16px;
  border: 1px solid rgba(255, 225, 90, 0.22);
  border-radius: 16px;
  max-width: 390px;
  box-shadow: 0 16px 42px rgba(0,0,0,0.34);
  backdrop-filter: blur(10px);
}
#ui h1 {
  margin: 4px 0 8px;
  font-size: 21px;
  letter-spacing: 0.2px;
}
#ui p {
  margin: 5px 0;
  font-size: 13px;
  line-height: 1.38;
  color: rgba(246, 255, 244, 0.86);
}
#status {
  color: #ffe15a !important;
  font-weight: 700;
}
.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 225, 90, 0.14);
  color: #ffe15a;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

#dashboard {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 3;
  width: 230px;
  padding: 14px;
  color: #f6fff4;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(10, 21, 15, 0.88), rgba(28, 48, 31, 0.78));
  border: 1px solid rgba(255, 225, 90, 0.24);
  box-shadow: 0 18px 46px rgba(0,0,0,0.34);
  backdrop-filter: blur(10px);
}
.dash-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.dash-title {
  color: rgba(246,255,244,.7);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .7px;
  font-weight: 800;
}
#editNameBtn {
  cursor: pointer;
  border: 1px solid rgba(255,225,90,.35);
  background: rgba(255,225,90,.13);
  color: #ffe15a;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 800;
}
.player-name {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 12px;
}
.currency-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-top: 8px;
  border-radius: 14px;
  background: rgba(255,255,255,.07);
  color: rgba(246,255,244,.9);
}
.currency-row strong { color: #ffe15a; }
#nameTag {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 4;
  pointer-events: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(7, 18, 11, 0.78);
  color: white;
  font-size: 12px;
  font-weight: 900;
  text-shadow: 0 2px 4px rgba(0,0,0,.9);
  border: 1px solid rgba(255,255,255,.18);
}
#minimapWrap {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 3;
  padding: 10px;
  border-radius: 18px;
  background: rgba(8, 20, 14, 0.82);
  border: 1px solid rgba(255, 225, 90, 0.24);
  box-shadow: 0 18px 46px rgba(0,0,0,0.34);
  backdrop-filter: blur(10px);
}
#minimap {
  display: block;
  width: 180px;
  height: 180px;
  border-radius: 12px;
  cursor: grab;
  border: 1px solid rgba(255,255,255,.16);
}
#minimap:active { cursor: grabbing; }
.miniHelp {
  margin-top: 7px;
  color: rgba(246,255,244,.72);
  text-align: center;
  font-size: 11px;
}

#interactionPanel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  width: 230px;
  padding: 14px;
  color: #f6fff4;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(10, 21, 15, 0.9), rgba(28, 48, 31, 0.8));
  border: 1px solid rgba(255, 225, 90, 0.24);
  box-shadow: 0 18px 46px rgba(0,0,0,0.34);
  backdrop-filter: blur(10px);
}
#tileDetails p { margin: 0 0 10px; color: rgba(246,255,244,.74); font-size: 13px; }
.tile-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-size: 13px;
}
.tile-line span { color: rgba(246,255,244,.68); }
.tile-line strong { color: #ffe15a; }
.tile-note {
  margin: 10px 0;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: rgba(246,255,244,.78);
  font-size: 12px;
  line-height: 1.35;
}

.color-picker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 10px 0 4px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(255,255,255,.055);
  border: 1px solid rgba(255,255,255,.08);
}
.color-choice {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 24px;
  border-radius: 9px;
  cursor: pointer;
  background: var(--swatch);
  border: 2px solid rgba(255,255,255,.22);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}
.color-choice.active {
  border-color: #ffe15a;
  box-shadow: 0 0 0 2px rgba(255,225,90,.22), inset 0 0 0 1px rgba(0,0,0,.2);
}
.color-label {
  margin-top: 10px;
  color: rgba(246,255,244,.68);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .55px;
}

#buyTileBtn, #colorTileBtn {
  width: 100%;
  margin-top: 8px;
  cursor: pointer;
  border: 1px solid rgba(255,225,90,.35);
  background: rgba(255,225,90,.14);
  color: #ffe15a;
  border-radius: 12px;
  padding: 9px 10px;
  font-weight: 900;
}
#buyTileBtn:disabled, #colorTileBtn:disabled {
  cursor: not-allowed;
  color: rgba(246,255,244,.42);
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
}

.casino-panel {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.casino-title {
  color: #ffe15a;
  font-weight: 900;
  margin-bottom: 10px;
}
.casino-game {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  align-items: center;
}
.casino-game label {
  color: rgba(246,255,244,.72);
  font-size: 12px;
  font-weight: 800;
}
.casino-game select,
.casino-game input {
  min-width: 0;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  color: #f6fff4;
  padding: 7px 8px;
  font-weight: 800;
}
#rollDiceBtn,
#spinWheelBtn {
  width: 100%;
  margin-top: 8px;
  cursor: pointer;
  border: 1px solid rgba(255,225,90,.35);
  background: rgba(255,225,90,.14);
  color: #ffe15a;
  border-radius: 12px;
  padding: 9px 10px;
  font-weight: 900;
}
#rollDiceBtn { grid-column: 1 / -1; }
#spinWheelBtn:disabled {
  cursor: not-allowed;
  color: rgba(246,255,244,.42);
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
}
.casino-result {
  margin-top: 9px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: rgba(246,255,244,.78);
  font-size: 12px;
  line-height: 1.35;
}

.casino-game-block { display: none; }
#blackjackGame input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  color: #f6fff4;
  padding: 7px 8px;
  font-weight: 800;
}
.full-label {
  display: block;
  margin-bottom: 6px;
  color: rgba(246,255,244,.72);
  font-size: 12px;
  font-weight: 800;
}
#playBlackjackBtn {
  width: 100%;
  margin-top: 8px;
  cursor: pointer;
  border: 1px solid rgba(255,225,90,.35);
  background: rgba(255,225,90,.14);
  color: #ffe15a;
  border-radius: 12px;
  padding: 9px 10px;
  font-weight: 900;
}

.inventory-title {
  margin-top: 12px;
  color: rgba(246,255,244,.68);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .55px;
}
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.inv-slot {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 11px;
  color: rgba(246,255,244,.78);
  cursor: default;
  padding: 4px;
  box-sizing: border-box;
}
.inv-slot.tool { cursor: pointer; }
.inv-slot.equipped { border-color: #ffe15a; box-shadow: 0 0 0 2px rgba(255,225,90,.18); color: #ffe15a; }
.dice-anim, .wheel-anim {
  margin-top: 8px;
  min-height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.06);
  font-size: 28px;
  grid-column: 1 / -1;
}
.dice-anim.rolling { animation: diceShake .55s linear 3; }
.wheel-anim.spinning { animation: wheelSpin 1.35s cubic-bezier(.16,.84,.3,1); }
@keyframes diceShake {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(18deg) scale(1.12); }
  50% { transform: rotate(-22deg) scale(.95); }
  75% { transform: rotate(15deg) scale(1.08); }
  100% { transform: rotate(0deg) scale(1); }
}
@keyframes wheelSpin {
  from { transform: rotate(0deg) scale(1); }
  to { transform: rotate(1440deg) scale(1.15); }
}
.blackjack-cards {
  padding: 8px 10px;
  margin: 8px 0;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
  color: rgba(246,255,244,.82);
  font-size: 12px;
  line-height: 1.35;
}
.blackjack-buttons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.blackjack-buttons button, .action-btn {
  cursor: pointer;
  border: 1px solid rgba(255,225,90,.35);
  background: rgba(255,225,90,.14);
  color: #ffe15a;
  border-radius: 12px;
  padding: 8px 8px;
  font-weight: 900;
}
.blackjack-buttons button:disabled, .action-btn:disabled {
  cursor: not-allowed;
  color: rgba(246,255,244,.42);
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
}
.action-row { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:8px; }

.event-log {
  position: fixed;
  top: 185px;
  left: 16px;
  z-index: 3;
  width: 390px;
  max-height: 150px;
  overflow: hidden;
  padding: 10px 12px;
  color: rgba(246,255,244,.86);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(8, 20, 14, 0.76), rgba(20, 34, 24, 0.64));
  border: 1px solid rgba(255, 225, 90, 0.18);
  box-shadow: 0 12px 34px rgba(0,0,0,.25);
  backdrop-filter: blur(10px);
  pointer-events: none;
}
.log-line {
  font-size: 12px;
  line-height: 1.35;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.inv-slot.empty {
  opacity: .5;
}

#loginOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 35%, rgba(255, 207, 63, .2), transparent 28%), rgba(5, 12, 8, .82);
  backdrop-filter: blur(8px);
}
.login-card {
  width: min(420px, calc(100vw - 36px));
  padding: 24px;
  border-radius: 22px;
  background: rgba(17, 28, 20, .94);
  border: 1px solid rgba(255, 207, 63, .35);
  color: #f5f3df;
  box-shadow: 0 20px 70px rgba(0,0,0,.4);
  text-align: center;
}
.login-card h2 { margin: 8px 0 8px; font-size: 30px; }
.login-card p { margin: 0 0 18px; color: rgba(245,243,223,.75); line-height: 1.45; }
.login-badge { display:inline-block; padding: 5px 10px; border-radius: 99px; background: rgba(255,207,63,.14); color:#ffdb60; font-size: 12px; font-weight: 800; }
#loginNameInput {
  width: 100%; box-sizing: border-box; padding: 13px 14px; border-radius: 14px;
  border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.08); color: #fff;
  font-size: 16px; outline: none; margin-bottom: 12px;
}
#loginBtn {
  width: 100%; padding: 13px 14px; border: 0; border-radius: 14px; cursor: pointer;
  background: linear-gradient(135deg, #ffe067, #ffb72f); color: #1e1505; font-weight: 900; font-size: 15px;
}
#loginBtn:disabled { opacity: .55; cursor: not-allowed; }
#loginStatus { margin-top: 12px; font-size: 13px; color: rgba(245,243,223,.68); }
.remote-name-tag {
  position: fixed;
  left: 0; top: 0;
  z-index: 15;
  pointer-events: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(20, 26, 20, .8);
  color: #dfffe1;
  border: 1px solid rgba(255,255,255,.15);
  font-size: 12px;
  font-weight: 800;
  text-shadow: 0 1px 2px #000;
}
