* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, 0.28), transparent 32%),
    radial-gradient(circle at bottom right, rgba(124, 58, 237, 0.22), transparent 35%),
    #020617;
  color: #f8fafc;
}

button,
input,
select {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

.screen {
  min-height: 100vh;
}

.login-screen {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 480px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 28px;
  padding: 30px;
  box-shadow: 0 35px 90px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(16px);
}

.login-card h1 {
  margin: 0 0 10px;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.login-card p {
  margin: 0 0 20px;
  color: #cbd5e1;
}

.login-card label {
  display: block;
  margin: 14px 0 6px;
  font-size: 13px;
  font-weight: 800;
  color: #e2e8f0;
}

.login-card input {
  width: 100%;
  padding: 14px 15px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(2, 6, 23, 0.78);
  color: white;
  outline: none;
  font-size: 15px;
}

.login-card input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 8px;
}

button {
  border: 0;
  cursor: pointer;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 900;
  color: white;
  background: #334155;
  transition: transform 0.12s ease, filter 0.12s ease, opacity 0.12s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

button:active:not(:disabled) {
  transform: translateY(0);
}

.tab {
  background: rgba(51, 65, 85, 0.95);
}

.tab.active,
.main-btn,
#newGameBtn,
#voiceBtn {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.main-btn {
  width: 100%;
  margin-top: 18px;
  padding: 15px 18px;
}

.error {
  margin-top: 14px !important;
  color: #fca5a5 !important;
  font-weight: 800;
  min-height: 22px;
}

.public-rooms-panel {
  margin-top: 18px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(2, 6, 23, 0.42);
  border: 1px solid rgba(96, 165, 250, 0.22);
}

.public-rooms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.public-rooms-header strong {
  color: #ffffff;
  font-size: 15px;
  font-weight: 1000;
}

#publicRefreshBtn {
  padding: 8px 11px;
  border-radius: 11px;
  background: rgba(37, 99, 235, 0.95);
  font-size: 12px;
}

.public-rooms-help {
  margin: 10px 0 12px !important;
  color: #94a3b8 !important;
  font-size: 12px;
  line-height: 1.35;
}

.public-rooms-list {
  display: grid;
  gap: 9px;
  max-height: 210px;
  overflow: auto;
  padding-right: 3px;
}

.public-room-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border-radius: 15px;
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.public-room-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.public-room-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f8fafc;
  font-size: 14px;
  font-weight: 1000;
}

.public-room-info span {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
}

.public-join-btn {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: 11px;
  background: #16a34a;
  font-size: 12px;
}

.public-room-empty {
  padding: 12px;
  border-radius: 14px;
  color: #94a3b8;
  background: rgba(15, 23, 42, 0.65);
  border: 1px dashed rgba(148, 163, 184, 0.28);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
  padding: 22px;
}

.topbar h1 {
  margin: 0;
  font-size: 34px;
  letter-spacing: -0.04em;
}

#status {
  margin: 8px 0 0;
  color: #cbd5e1;
  font-weight: 700;
}

#roomLabel {
  margin: 6px 0 0;
  color: #facc15;
  font-weight: 900;
}

.room-id-label {
  display: inline-block;
  margin: 7px 0 0;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(250, 204, 21, 0.35);
  color: #fde68a;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.controls,
.voice-controls {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px;
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.controls label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 900;
  color: #cbd5e1;
}

.controls input {
  width: 82px;
  border: 0;
  outline: none;
  padding: 10px;
  border-radius: 12px;
  background: #e2e8f0;
  color: #020617;
  font-weight: 800;
}

.voice-controls {
  align-items: center;
}

#muteBtn {
  background: #475569;
}

#muteBtn.active {
  background: #dc2626;
}

#voiceStatus {
  color: #cbd5e1;
  font-weight: 800;
  font-size: 14px;
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(1);
}

.info {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 22px 18px;
}

.info div {
  padding: 11px 15px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: #cbd5e1;
  font-weight: 800;
}

.info strong {
  color: white;
}

.public-vote-panel {
  min-width: min(100%, 360px);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-color: rgba(34, 197, 94, 0.35) !important;
  background: rgba(20, 83, 45, 0.28) !important;
}

.public-vote-title {
  width: 100%;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #bbf7d0 !important;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#publicNewGameVoteBtn {
  padding: 9px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  font-size: 12px;
}

#publicKickReasonSelect {
  min-width: 170px;
  border: 1px solid rgba(34, 197, 94, 0.38);
  outline: none;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.82);
  color: #f8fafc;
  font-weight: 800;
}

#publicKickReasonSelect:focus {
  border-color: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.16);
}

.public-vote-status {
  width: 100%;
  padding: 8px 0 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #bbf7d0 !important;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.game-layout {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 0 22px 22px;
}

#boardWrap {
  position: relative;
  width: fit-content;
  max-width: 100%;
  overflow: auto;
  padding: 14px;
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

#board {
  display: grid;
  gap: 4px;
  user-select: none;
}

.tile {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 1000;
  background: linear-gradient(145deg, #475569, #1e293b);
  color: white;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -3px 0 rgba(0, 0, 0, 0.32);
}

.tile:hover {
  outline: 2px solid #38bdf8;
  outline-offset: 1px;
}

.tile.revealed {
  background: #e2e8f0;
  color: #0f172a;
  box-shadow: none;
  cursor: default;
}

.tile.flagged {
  background: linear-gradient(145deg, #f59e0b, #92400e);
}

.tile.mine {
  background: linear-gradient(145deg, #ef4444, #7f1d1d);
  color: white;
}

.n1 {
  color: #2563eb;
}

.n2 {
  color: #16a34a;
}

.n3 {
  color: #dc2626;
}

.n4 {
  color: #7c3aed;
}

.n5 {
  color: #be123c;
}

.n6 {
  color: #0891b2;
}

.n7 {
  color: #111827;
}

.n8 {
  color: #475569;
}

.players-panel {
  width: 270px;
  min-width: 240px;
  padding: 16px;
  border-radius: 24px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
}

.players-panel h2 {
  margin: 0 0 14px;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  padding: 11px;
  border-radius: 16px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.player-left {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.player-row.owner {
  background: rgba(113, 63, 18, 0.55);
  border-color: rgba(250, 204, 21, 0.72);
}

.player-row.owner .player-name {
  color: #facc15;
  font-weight: 1000;
}

.player-row.admin-player {
  background: rgba(20, 83, 45, 0.62);
  border-color: rgba(34, 197, 94, 0.95);
  box-shadow:
    0 0 0 1px rgba(34, 197, 94, 0.35),
    0 0 18px rgba(34, 197, 94, 0.25);
}

.player-row.admin-player.owner {
  background: rgba(20, 83, 45, 0.72);
  border-color: rgba(34, 197, 94, 1);
}

.player-row.admin-player .player-name {
  color: #22c55e;
  font-weight: 1000;
}

.player-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.admin-pin,
.admin-pin-wrap,
.admin-pin-svg {
  display: none !important;
}

.admin-pin-img-wrap {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  overflow: visible;
}

.admin-pin-img {
  width: 16px;
  height: 16px;
  display: block;
  object-fit: contain;
  object-position: center;
  background: transparent !important;
  box-shadow: none !important;
  filter: drop-shadow(0 0 4px rgba(34, 197, 94, 0.45));
}

.kick-btn {
  padding: 8px 10px;
  border-radius: 11px;
  background: #991b1b;
  font-size: 12px;
}

.public-votekick-btn {
  background: linear-gradient(135deg, #dc2626, #7f1d1d);
}

#cursors {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.cursor {
  position: absolute;
  transform: translate(-3px, -3px);
  pointer-events: none;
  white-space: nowrap;
  will-change: left, top;
}

.cursor .arrow {
  font-size: 23px;
  line-height: 1;
  text-shadow: 0 2px 4px black;
}

.cursor .name {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-left: 16px;
  margin-top: -6px;
  padding: 4px 8px;
  border-radius: 999px;
  color: white;
  font-size: 13px;
  font-weight: 900;
  text-shadow: 0 1px 2px black;
}

.cursor.admin-cursor .arrow {
  color: #22c55e !important;
  filter: drop-shadow(0 0 7px rgba(34, 197, 94, 0.8));
}

.cursor.admin-cursor .name {
  background: rgba(20, 83, 45, 0.72) !important;
  color: #22c55e !important;
  font-weight: 1000;
  text-shadow: none;
  border: 1px solid rgba(34, 197, 94, 0.95);
  box-shadow:
    0 0 0 1px rgba(34, 197, 94, 0.28),
    0 0 14px rgba(34, 197, 94, 0.28);
}

.mod-cursor-icons {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin-right: 6px;
  color: #22c55e;
  font-weight: 1000;
}

.mod-balance-icon {
  color: #22c55e;
  filter: none;
}

.mod-user-icon {
  display: none !important;
}

#remoteAudios {
  display: none;
}

/* Full-screen ban / shutdown lock modal */

.lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at top left, rgba(239, 68, 68, 0.35), transparent 35%),
    radial-gradient(circle at bottom right, rgba(127, 29, 29, 0.55), transparent 38%),
    rgba(2, 6, 23, 0.96);
  backdrop-filter: blur(18px);
}

.lock-modal {
  width: min(560px, 100%);
  padding: 34px;
  border-radius: 30px;
  background:
    linear-gradient(145deg, rgba(127, 29, 29, 0.92), rgba(15, 23, 42, 0.98)),
    #111827;
  border: 1px solid rgba(248, 113, 113, 0.45);
  box-shadow:
    0 40px 120px rgba(0, 0, 0, 0.72),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: center;
  animation: lockPop 0.22s ease-out;
}

@keyframes lockPop {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.lock-icon {
  width: 78px;
  height: 78px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: rgba(239, 68, 68, 0.22);
  border: 1px solid rgba(252, 165, 165, 0.5);
  font-size: 38px;
  box-shadow: 0 18px 50px rgba(127, 29, 29, 0.55);
}

.lock-eyebrow {
  margin: 0 0 8px;
  color: #fecaca;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 0.16em;
}

.lock-modal h1 {
  margin: 0;
  color: #ffffff;
  font-size: 34px;
  letter-spacing: -0.04em;
}

.lock-modal > p:not(.lock-eyebrow) {
  margin: 12px auto 22px;
  max-width: 420px;
  color: #fee2e2;
  font-size: 15px;
  line-height: 1.45;
}

.lock-details {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  text-align: left;
}

.lock-details div {
  padding: 13px 15px;
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.58);
  border: 1px solid rgba(252, 165, 165, 0.22);
}

.lock-details span {
  display: block;
  margin-bottom: 4px;
  color: #fca5a5;
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lock-details strong {
  display: block;
  color: #ffffff;
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.lock-main-menu {
  width: 100%;
  margin-top: 22px;
  padding: 15px 18px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ef4444, #7c2d12);
  color: #ffffff;
  font-weight: 1000;
}

.cursor-gavel-icon {
  width: 12px !important;
  height: 12px !important;
  flex: 0 0 12px !important;
  margin-right: 5.5px;
  transform: translateX(2px);
}

.cursor-gavel-icon .admin-pin-img,
.cursor-gavel-icon img {
  width: 12px !important;
  height: 12px !important;
}

@media (max-width: 900px) {
  .game-layout {
    flex-direction: column;
  }

  .players-panel {
    width: 100%;
  }

  .topbar {
    flex-direction: column;
  }

  .controls,
  .voice-controls {
    width: 100%;
  }

  .public-vote-panel {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .login-card {
    padding: 24px;
  }

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

  .public-room-row {
    align-items: stretch;
    flex-direction: column;
  }

  .public-join-btn {
    width: 100%;
  }
}