.hidden {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #1c2430;
  background: #f4f7fc;
}

body.dark-mode {
  color: #e6edff;
  background: radial-gradient(circle at 20% 10%, #192542 0%, #0f1628 55%, #090d18 100%);
}

.ludo-lobby-page {
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, #5f79f0 0%, #3f5cd7 45%, #1f2f74 100%);
}

.ludo-lobby {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.ludo-lobby-card {
  width: 100%;
  max-width: 560px;
  background: linear-gradient(180deg, #ffffff, #f4f8ff);
  border-radius: 18px;
  border: 1px solid #d6e3ff;
  box-shadow: 0 28px 70px rgba(17, 26, 44, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 24px;
  transform: perspective(1200px) rotateX(2deg);
}

.ludo-lobby-head h1 {
  margin: 0 0 6px;
  font-size: 30px;
}

.ludo-lobby-head p {
  margin: 0 0 18px;
  color: #4f5b70;
}

.ludo-row {
  margin-bottom: 14px;
}

.ludo-row label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.ludo-row input,
.ludo-row select,
.ludo-row button {
  width: 100%;
  border: 1px solid #cfd7e6;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
}

.ludo-row .inline {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 120px;
}

button.primary,
button.secondary,
.ludo-actions button,
#roll-btn,
#send-chat-btn {
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
}

button.primary,
.ludo-actions button,
#roll-btn {
  background: #2e55db;
  color: #fff;
}

#roll-btn {
  display: none;
}

button.secondary {
  background: #e8edf8;
  color: #203257;
}

.lobby-message {
  margin: 8px 0 0;
  min-height: 22px;
  font-size: 14px;
}

.lobby-message.ok {
  color: #14733d;
}

.lobby-message.error {
  color: #ab1f31;
}

.ludo-game-page {
  min-height: 100vh;
}

.game-wrap {
  max-width: 1380px;
  margin: 0 auto;
  padding: 12px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(360px, 900px) 1fr;
  perspective: 1400px;
}

.game-left,
.game-right {
  background: linear-gradient(180deg, #ffffff, #f7faff);
  border-radius: 14px;
  border: 1px solid #dbe3f3;
}

body.dark-mode .game-left,
body.dark-mode .game-right {
  background: linear-gradient(180deg, #1c2944, #162238);
  border-color: #2f4168;
}

.game-left {
  padding: 10px;
  transform: rotateX(1.3deg);
}

.board-hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 6px;
  padding: 6px;
  border-radius: 10px;
  border: 1px solid #d6e0f4;
  background: linear-gradient(180deg, #ffffff, #f0f5ff);
}

.board-hud.bottom {
  margin-top: 6px;
  margin-bottom: 0;
}

body.dark-mode .board-hud {
  border-color: #39507d;
  background: linear-gradient(180deg, #213251, #1a2943);
}

.player-strip {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  width: 100%;
}

.mini-player {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #d4dff5;
  background: #f8fbff;
  font-size: 12px;
  min-width: 122px;
  justify-content: space-between;
}

body.dark-mode .mini-player {
  border-color: #3d5485;
  background: #142136;
}

.mini-player.turn {
  border-color: #2e55db;
  background: #e9f0ff;
  box-shadow: 0 0 0 2px rgba(46, 85, 219, 0.2) inset;
}

body.dark-mode .mini-player.turn {
  border-color: #7ea4ff;
  background: #263f6d;
}

.mini-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.mini-soldier {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffd7b3, #e8b48f);
  border: 1px solid rgba(0, 0, 0, 0.2);
  position: relative;
  flex: 0 0 auto;
}

.mini-soldier::before {
  content: "";
  position: absolute;
  left: 3px;
  top: -4px;
  width: 10px;
  height: 6px;
  border-radius: 3px 3px 0 0;
  background: #2d3f66;
}

.mini-soldier::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 10px;
  width: 8px;
  height: 7px;
  border-radius: 2px;
  background: var(--soldier-color, #556);
}

.strip-dice {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid #b7c8ea;
  background: linear-gradient(145deg, #ffffff, #dbe8ff);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1f396f;
  font-size: 12px;
  font-weight: 700;
}

.strip-roll-btn {
  border: 0;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2f5df0, #1f3fa8);
  cursor: pointer;
}

.strip-roll-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#game-container {
  width: 100%;
  min-height: 680px;
  border-radius: 10px;
  overflow: hidden;
  background: radial-gradient(circle at center, #ffffff 0%, #e7efff 100%);
}

body.dark-mode #game-container {
  background: radial-gradient(circle at center, #233453 0%, #1a2640 100%);
}

.game-right {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(180deg, #fbfdff, #f3f8ff);
}

body.dark-mode .game-right {
  background: linear-gradient(180deg, #1b2945, #152038);
}

.panel {
  border: 1px solid #e1e8f6;
  border-radius: 10px;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  box-shadow: 0 8px 20px rgba(24, 54, 111, 0.08);
}

body.dark-mode .panel {
  border-color: #31456e;
  background: linear-gradient(180deg, #1f2d49, #18253d);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.panel h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

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

#dice-number {
  font-size: 48px;
  text-align: center;
  font-weight: 700;
  margin: 6px 0;
}

.dice-visual {
  width: 72px;
  height: 72px;
  margin: 0 auto 10px;
  border-radius: 14px;
  background: linear-gradient(145deg, #fefefe, #dce8ff);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.8), 0 8px 14px rgba(0, 0, 0, 0.15);
  position: relative;
  border: 1px solid #b9cbef;
  transform-style: preserve-3d;
  transform: rotateX(15deg) rotateY(-12deg);
}

.dice-visual .pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1f396f;
  position: absolute;
  display: none;
}

.dice-visual .p1 { top: 12px; left: 12px; }
.dice-visual .p2 { top: 12px; right: 12px; }
.dice-visual .p3 { top: 31px; left: 12px; }
.dice-visual .p4 { top: 31px; left: 31px; }
.dice-visual .p5 { top: 31px; right: 12px; }
.dice-visual .p6 { bottom: 12px; left: 12px; }
.dice-visual .p7 { bottom: 12px; right: 12px; }

.dice-visual.face-1 .p4 { display: block; }
.dice-visual.face-2 .p1, .dice-visual.face-2 .p7 { display: block; }
.dice-visual.face-3 .p1, .dice-visual.face-3 .p4, .dice-visual.face-3 .p7 { display: block; }
.dice-visual.face-4 .p1, .dice-visual.face-4 .p2, .dice-visual.face-4 .p6, .dice-visual.face-4 .p7 { display: block; }
.dice-visual.face-5 .p1, .dice-visual.face-5 .p2, .dice-visual.face-5 .p4, .dice-visual.face-5 .p6, .dice-visual.face-5 .p7 { display: block; }
.dice-visual.face-6 .p1, .dice-visual.face-6 .p2, .dice-visual.face-6 .p3, .dice-visual.face-6 .p5, .dice-visual.face-6 .p6, .dice-visual.face-6 .p7 { display: block; }

.status-line {
  margin: 4px 0;
  font-size: 14px;
  color: #4a5975;
}

body.dark-mode .status-line {
  color: #b9c8eb;
}

.players-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.players-list li {
  padding: 6px 8px;
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid #edf1fa;
}

body.dark-mode .players-list li {
  border-color: #3a4e78;
  background: rgba(255, 255, 255, 0.03);
}

.players-list li.turn {
  border-color: #2e55db;
  background: linear-gradient(180deg, #eff4ff, #dfeaff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

body.dark-mode .players-list li.turn {
  border-color: #7194ff;
  background: linear-gradient(180deg, #2d477e, #22365e);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.chat-box {
  display: flex;
  flex-direction: column;
  min-height: 200px;
}

#chat-messages {
  height: 170px;
  overflow-y: auto;
  border: 1px solid #e1e8f6;
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: #f9fbff;
}

body.dark-mode #chat-messages {
  border-color: #39507f;
  background: #111a2c;
}

.chat-item {
  margin-bottom: 8px;
  font-size: 13px;
}

.chat-item b {
  color: #25418c;
}

body.dark-mode .chat-item b {
  color: #8eb0ff;
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 8px;
}

#chat-input {
  border: 1px solid #cfd7e6;
  border-radius: 8px;
  padding: 10px;
}

body.dark-mode #chat-input {
  border-color: #405986;
  background: #0f1728;
  color: #e6edff;
}

@media (max-width: 1180px) {
  .game-wrap {
    grid-template-columns: 1fr;
  }

  #game-container {
    min-height: 520px;
  }

  .board-hud {
    flex-direction: column;
    align-items: stretch;
  }
}
