:root {
  --bg: #f7f7f4;
  --paper: #ffffff;
  --ink: #161616;
  --muted: #687385;
  --line: #d9dee7;
  --green: #6aaa64;
  --yellow: #c9b458;
  --wrong: #787c7e;
  --key: #d3d6da;
  --discord: #0d0a1c;
  --red: #ed4245;
  --shadow: 0 14px 36px rgba(27, 31, 42, 0.08);
  --board-size: 45px;
  --board-gap: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #05050a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  overflow: hidden;
}

button,
textarea {
  font: inherit;
}

button {
  user-select: none;
}

.activity {
  height: calc(100vh - 66px);
  min-height: 760px;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(106,170,100,.08), transparent 340px),
    radial-gradient(circle at bottom right, rgba(201,180,88,.09), transparent 360px),
    var(--bg);
  border: 1px solid #dfe2e7;
  position: relative;
  overflow: hidden;
}

.topbar {
  height: 70px;
  padding: 0 30px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(247,247,244,.90);
  backdrop-filter: blur(10px);
  z-index: 10;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.tilemark,
.hero-mark {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #111;
  gap: 2px;
  border: 2px solid #111;
  overflow: hidden;
}

.tilemark {
  width: 35px;
  height: 35px;
  border-radius: 5px;
}

.hero-mark {
  width: 58px;
  height: 58px;
  border-radius: 7px;
  margin: 0 auto 12px;
}

.tilemark span,
.hero-mark span { background: white; }

.yellow { background: var(--yellow) !important; }
.green { background: var(--green) !important; }

.brand h1 {
  font-size: 19px;
  margin: 0;
  line-height: 20px;
  letter-spacing: -0.02em;
}

.brand p {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 0;
}

.top-actions {
  display: flex;
  gap: 9px;
}

.top-actions button,
.game-status button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  padding: 8px 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(20,20,30,.03);
  transition: transform .12s ease, border-color .12s ease;
}

.top-actions button:hover,
.game-status button:hover,
.mode-card:hover,
.length-options button:hover,
.pill-options button:hover,
.start-btn:hover {
  transform: translateY(-1px);
}

.party-row {
  position: absolute;
  top: 88px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 4;
}

.party-card {
  width: 72px;
  height: 116px;
  border: 1px solid #ccd2da;
  border-radius: 13px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 8px 22px rgba(20,20,30,.06);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.invite-card {
  justify-content: center;
  cursor: pointer;
}

.plus {
  width: 39px;
  height: 39px;
  border-radius: 50%;
  background: var(--green);
  color: white;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 8px;
}

.invite-card strong,
.invite-card span {
  font-size: 9px;
  line-height: 10px;
}

.player-card {
  padding-top: 7px;
}

.player-card.selected {
  outline: 2px solid #111;
}

.avatar,
.discord-avatar,
.empty-avatar {
  width: 39px;
  height: 39px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  margin-bottom: 4px;
}

.discord-avatar {
  background: linear-gradient(135deg, #5865f2, #9aa4ff);
  color: white;
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.45);
}

.empty-avatar {
  background: #eef0f4;
  color: #8b94a3;
  border: 1px dashed #b5bdca;
}

.gold { background: #ffd166; }
.blue { background: #a0c4ff; }

.player-card strong,
.empty-slot strong {
  max-width: 62px;
  font-size: 10px;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-slot {
  justify-content: center;
  color: #7b8494;
}

.empty-slot span {
  font-size: 9px;
  line-height: 10px;
}

.mini-board {
  display: grid;
  grid-template-columns: repeat(5, 7px);
  grid-template-rows: repeat(6, 7px);
  gap: 1px;
}

.mini-board span {
  border: 1px solid #9aa0a6;
  background: white;
}

.mini-board .wrong { background: var(--wrong); }
.mini-board .yellow { background: var(--yellow); }
.mini-board .green { background: var(--green); }

.screen {
  position: absolute;
  top: 235px;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 80px));
  text-align: center;
}

.screen h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 42px;
  letter-spacing: -0.03em;
  margin: 0 0 4px;
}

.subtitle {
  font-size: 18px;
  color: #2d2d2d;
  margin: 0 0 24px;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.mode-card {
  min-height: 164px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255,255,255,.82);
  text-align: left;
  padding: 18px 18px 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .12s ease, box-shadow .12s ease;
}

.mode-card.primary {
  border-color: #111;
  box-shadow: inset 0 0 0 1px #111, var(--shadow);
}

.mode-icon {
  width: 35px;
  height: 35px;
  border-radius: 11px;
  background: #f1f3f5;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  font-size: 18px;
  font-weight: 900;
}

.mode-card.primary .mode-icon {
  background: #111;
  color: white;
}

.mode-card strong {
  display: block;
  font-size: 22px;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.mode-card span {
  display: block;
  font-size: 14px;
  color: #3d434d;
  line-height: 20px;
  max-width: 260px;
}

.mode-card em {
  display: block;
  margin-top: 17px;
  color: #5f6b7d;
  font-size: 12px;
  line-height: 16px;
  font-style: normal;
  font-weight: 800;
  white-space: normal;
}

.setup-screen {
  top: 210px;
  width: min(700px, calc(100vw - 90px));
}

.back-btn {
  position: absolute;
  top: -32px;
  left: 4px;
  border: 0;
  background: transparent;
  font-weight: 900;
  color: var(--muted);
  cursor: pointer;
}

.settings-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.84);
  box-shadow: var(--shadow);
  padding: 18px;
  text-align: left;
}

.setting-block {
  border: 1px solid #e2e6ed;
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,.65);
}

.setting-block + .setting-block {
  margin-top: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 12px 0;
}

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

.setting-title strong {
  font-size: 15px;
}

.setting-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.length-options,
.pill-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.length-options button,
.pill-options button {
  height: 36px;
  min-width: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  font-weight: 900;
  cursor: pointer;
}

.pill-options button {
  flex: 1 1 auto;
  min-width: 58px;
}

.length-options button.active,
.pill-options button.active {
  background: #111;
  color: white;
  border-color: #111;
}

.start-btn {
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 999px;
  background: #111;
  color: white;
  font-weight: 900;
  cursor: pointer;
}

.game {
  padding-top: 205px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-status {
  width: min(680px, calc(100vw - 80px));
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 12px;
  gap: 16px;
}

.game-status strong {
  display: block;
}

.game-status span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.game-actions {
  display: flex;
  gap: 8px;
}

.board-shell {
  max-width: calc(100vw - 80px);
  overflow-x: auto;
  padding: 2px 4px 8px;
}

.board {
  display: grid;
  grid-template-columns: repeat(var(--letters), var(--board-size));
  grid-template-rows: repeat(var(--attempts), var(--board-size));
  gap: var(--board-gap);
  width: max-content;
  margin: 0 auto;
}

.tile {
  width: var(--board-size);
  height: var(--board-size);
  background: white;
  border: 1px solid #cfd4dc;
  display: grid;
  place-items: center;
  font-size: 23px;
  font-weight: 900;
  text-transform: uppercase;
  transition: transform .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
  transform-style: preserve-3d;
}

.tile.filled {
  border-color: #878a8c;
  animation: letter-pop .12s ease-out;
}

.tile.green { background: var(--green); border-color: var(--green); color: white; }
.tile.yellow { background: var(--yellow); border-color: var(--yellow); color: white; }
.tile.wrong { background: var(--wrong); border-color: var(--wrong); color: white; }

.tile.pop {
  animation: letter-pop .13s ease-out;
}

.tile.shake {
  animation: shake .34s ease;
}

.tile.reveal {
  animation: tile-reveal .56s ease forwards;
}

.tile.win-bounce {
  animation: win-bounce .46s ease;
}

@keyframes letter-pop {
  0% { transform: scale(.86); }
  55% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@keyframes tile-reveal {
  0% { transform: rotateX(0deg); }
  49% { transform: rotateX(90deg); }
  50% { transform: rotateX(90deg); }
  100% { transform: rotateX(0deg); }
}

@keyframes win-bounce {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(-9px); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.message-pill {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.96);
  background: #111;
  color: white;
  border-radius: 18px;
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 800;
  z-index: 20;
  box-shadow: 0 18px 42px rgba(0,0,0,.24);
  min-width: 230px;
  text-align: center;
  animation: toast-in .16s ease forwards;
  pointer-events: none;
}

.message-pill.big {
  min-width: 320px;
  padding: 18px 22px;
  border-radius: 22px;
  font-size: 16px;
}

.message-pill .answer-word {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  letter-spacing: .14em;
}

.message-pill .answer-sub {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255,255,255,.72);
  font-weight: 700;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(.92); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.keyboard {
  position: absolute;
  bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.key-row {
  display: flex;
  gap: 6px;
}

.key-row.middle {
  transform: translateX(15px);
}

.keyboard button {
  min-width: 34px;
  height: 44px;
  border: 0;
  border-radius: 4px;
  background: var(--key);
  font-weight: 900;
  cursor: pointer;
}

.keyboard .wide {
  min-width: 60px;
  font-size: 10px;
}

.keyboard button.green {
  background: var(--green);
  color: white;
}

.keyboard button.yellow {
  background: var(--yellow);
  color: white;
}

.keyboard button.wrong {
  background: var(--wrong);
  color: white;
}

.dev-credit {
  position: absolute;
  right: 16px;
  bottom: 12px;
  font-size: 11px;
  color: rgba(17,17,17,.46);
  user-select: none;
  pointer-events: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.28);
  z-index: 50;
}

.modal {
  position: absolute;
  z-index: 60;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(430px, calc(100vw - 48px));
  background: white;
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 28px 70px rgba(0,0,0,.22);
  padding: 22px;
}

.modal h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.modal p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
}

.fake-input {
  border: 1px solid var(--line);
  background: #f6f7f9;
  border-radius: 12px;
  padding: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}

.primary-modal {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: #111;
  color: white;
  font-weight: 900;
  cursor: pointer;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.stats-grid div {
  background: #f6f7f9;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 8px;
  text-align: center;
}

.stats-grid strong,
.stats-grid span {
  display: block;
}

.stats-grid strong {
  font-size: 22px;
}

.stats-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

#shareText {
  width: 100%;
  height: 170px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  resize: none;
  margin-bottom: 14px;
  background: #f6f7f9;
}

.hidden { display: none !important; }

.discord-bar {
  height: 66px;
  background: var(--discord);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.self-avatar {
  position: absolute;
  left: 22px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1c344c, #a8dacd);
}

.call-controls {
  display: flex;
  gap: 9px;
}

.call-controls button,
.fullscreen {
  width: 44px;
  height: 39px;
  border: 0;
  border-radius: 10px;
  background: #22232c;
  color: white;
  font-size: 17px;
}

.call-controls .leave {
  background: var(--red);
}

.fullscreen {
  position: absolute;
  right: 18px;
  background: transparent;
}

@media (max-height: 790px) {
  .activity { min-height: 690px; }
  .screen { top: 195px; }
  .setup-screen { top: 160px; }
  .game { padding-top: 165px; }
  .keyboard { bottom: 18px; }
}

@media (max-width: 760px) {
  .mode-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .screen {
    top: 220px;
  }

  .party-row {
    transform: translateX(-50%) scale(.92);
  }

  .topbar {
    padding: 0 16px;
  }

  .top-actions button {
    padding: 8px 10px;
  }
}


/* v10: Discord already provides the real Activity/call controls.
   Hide any old fake controls that were part of the mockup. */
.discord-bar,
.activity-controls,
.discord-controls,
.mock-discord-bar,
.fake-discord-bar,
.call-controls,
.bottom-discord-bar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Real Discord avatar image support */
.discord-avatar {
  overflow: hidden;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

.discord-avatar.has-image {
  color: transparent !important;
  text-shadow: none !important;
}


/* v11 dark mode + Discord Activity cleanup */
.discord-bar,
.activity-controls,
.discord-controls,
.mock-discord-bar,
.fake-discord-bar,
.call-controls,
.bottom-discord-bar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.dark-mode {
  background: #111318 !important;
  color: #f1f4f8 !important;
}

body.dark-mode .app-shell,
body.dark-mode main,
body.dark-mode .screen,
body.dark-mode .mode-card,
body.dark-mode .setup-card,
body.dark-mode .topbar,
body.dark-mode .party-card,
body.dark-mode .player-card,
body.dark-mode .modal-card {
  background: #171a21 !important;
  color: #f1f4f8 !important;
  border-color: #2d3442 !important;
}

body.dark-mode .subtitle,
body.dark-mode .muted,
body.dark-mode .tiny,
body.dark-mode .setting-help,
body.dark-mode .party-card small,
body.dark-mode .player-card small {
  color: #aab3c2 !important;
}

body.dark-mode .tile.empty,
body.dark-mode .tile {
  background: #1f2430;
  border-color: #3a4252;
  color: #f1f4f8;
}

body.dark-mode .key {
  background: #2b3240;
  color: #f1f4f8;
}

body.dark-mode .top-btn,
body.dark-mode button {
  background: #202634;
  color: #f1f4f8;
  border-color: #3a4252;
}

body.dark-mode .mode-card.selected,
body.dark-mode .mode-card:hover {
  border-color: #7fa2ff !important;
  box-shadow: 0 0 0 2px rgba(127, 162, 255, 0.22);
}



.discord-avatar {
  overflow: hidden;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

.discord-avatar.has-image {
  color: transparent !important;
  text-shadow: none !important;
}


/* v12 UI hotfix */
html,
body {
  min-height: 100%;
}

body {
  overflow-x: hidden;
}

.app-shell,
main {
  min-height: calc(100vh - 90px);
}

.top-btn,
.theme-toggle,
#darkModeToggle {
  min-width: 96px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

#darkModeToggle {
  min-width: 118px;
}

body.dark-mode #darkModeToggle {
  background: #f1f4f8 !important;
  color: #111318 !important;
  border-color: #f1f4f8 !important;
}

body:not(.dark-mode) #darkModeToggle {
  background: #111318 !important;
  color: #ffffff !important;
  border-color: #111318 !important;
}

body.dark-mode {
  background: #0f1117 !important;
}

body.dark-mode .app-shell,
body.dark-mode main {
  background: #0f1117 !important;
}

body.dark-mode .topbar {
  background: #151924 !important;
  border-bottom-color: #2d3442 !important;
}

body.dark-mode .mode-card,
body.dark-mode .party-card,
body.dark-mode .player-card {
  box-shadow: 0 14px 40px rgba(0,0,0,.28);
}

/* Hide the old fake Discord mock controls forever. */
.discord-bar,
.activity-controls,
.discord-controls,
.mock-discord-bar,
.fake-discord-bar,
.call-controls,
.bottom-discord-bar {
  display: none !important;
}


/* v13 emergency render recovery */
html, body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
}

.app-shell,
main {
  min-height: calc(100vh - 90px);
}

.discord-bar,
.activity-controls,
.discord-controls,
.mock-discord-bar,
.fake-discord-bar,
.call-controls,
.bottom-discord-bar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.top-btn,
.theme-toggle,
#darkModeToggle {
  min-width: 104px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

#darkModeToggle {
  min-width: 120px;
}

body:not(.dark-mode) #darkModeToggle {
  background: #111318 !important;
  color: #ffffff !important;
  border-color: #111318 !important;
}

body.dark-mode #darkModeToggle {
  background: #f1f4f8 !important;
  color: #111318 !important;
  border-color: #f1f4f8 !important;
}

body.dark-mode {
  background: #0f1117 !important;
  color: #f1f4f8 !important;
}

body.dark-mode .app-shell,
body.dark-mode main,
body.dark-mode .screen,
body.dark-mode .mode-card,
body.dark-mode .setup-card,
body.dark-mode .topbar,
body.dark-mode .party-card,
body.dark-mode .player-card,
body.dark-mode .modal-card {
  background: #171a21 !important;
  color: #f1f4f8 !important;
  border-color: #2d3442 !important;
}

body.dark-mode .subtitle,
body.dark-mode .muted,
body.dark-mode .tiny,
body.dark-mode .setting-help,
body.dark-mode .party-card small,
body.dark-mode .player-card small {
  color: #aab3c2 !important;
}

body.dark-mode .tile.empty,
body.dark-mode .tile {
  background: #1f2430;
  border-color: #3a4252;
  color: #f1f4f8;
}

body.dark-mode .key {
  background: #2b3240;
  color: #f1f4f8;
}


/* v14 button + Discord blank recovery */
.discord-bar,
.activity-controls,
.discord-controls,
.mock-discord-bar,
.fake-discord-bar,
.call-controls,
.bottom-discord-bar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#darkModeToggle,
.theme-toggle {
  min-width: 122px !important;
  height: 38px !important;
  padding: 0 16px !important;
  border-radius: 999px !important;
  font-weight: 800 !important;
  font-size: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
  cursor: pointer !important;
}

body:not(.dark-mode) #darkModeToggle {
  background: #111318 !important;
  color: #ffffff !important;
  border-color: #111318 !important;
}

body.dark-mode #darkModeToggle {
  background: #f1f4f8 !important;
  color: #111318 !important;
  border-color: #f1f4f8 !important;
}

body.dark-mode {
  background: #0f1117 !important;
  color: #f1f4f8 !important;
}

body.dark-mode .app-shell,
body.dark-mode main,
body.dark-mode .screen,
body.dark-mode .mode-card,
body.dark-mode .setup-card,
body.dark-mode .topbar,
body.dark-mode .party-card,
body.dark-mode .player-card,
body.dark-mode .modal-card {
  background: #171a21 !important;
  color: #f1f4f8 !important;
  border-color: #2d3442 !important;
}

body.dark-mode .subtitle,
body.dark-mode .muted,
body.dark-mode .tiny,
body.dark-mode .setting-help,
body.dark-mode .party-card small,
body.dark-mode .player-card small {
  color: #aab3c2 !important;
}

body.dark-mode .tile.empty,
body.dark-mode .tile {
  background: #1f2430 !important;
  border-color: #3a4252 !important;
  color: #f1f4f8 !important;
}

body.dark-mode .key {
  background: #2b3240 !important;
  color: #f1f4f8 !important;
}


/* v15 Discord Activity Debug Overlay */
.wu-debug-panel {
  position: fixed;
  left: 12px;
  top: 12px;
  width: min(430px, calc(100vw - 24px));
  max-height: min(62vh, 520px);
  z-index: 2147483647;
  background: rgba(15, 17, 23, .96);
  color: #f4f7fb;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow: hidden;
}

.wu-debug-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: rgba(255,255,255,.08);
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
}

.wu-debug-head button,
.wu-debug-actions button {
  border: 0;
  border-radius: 9px;
  background: #5865f2;
  color: white;
  font-weight: 800;
  padding: 7px 10px;
  cursor: pointer;
}

.wu-debug-head button {
  background: #ff4d4d;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 18px;
}

.wu-debug-lines {
  padding: 10px 12px;
  overflow: auto;
  max-height: 360px;
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.42;
}

.wu-debug-actions {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,.12);
}

.wu-debug-ok { color: #69db7c; }
.wu-debug-warn { color: #ffd43b; }
.wu-debug-bad { color: #ff8787; }


/* v16: debug panel hidden by default. Type vixendebug to show it. */
.wu-debug-panel {
  display: none !important;
}

.wu-debug-panel.open {
  display: block !important;
}


/* v17 dark mode setup/options readability fix */
body.dark-mode .setup-panel,
body.dark-mode .setup-card,
body.dark-mode .option-card,
body.dark-mode .setting-card,
body.dark-mode .settings-card,
body.dark-mode .game-options,
body.dark-mode .options-grid,
body.dark-mode .setup-grid > *,
body.dark-mode .setup-section,
body.dark-mode .config-card,
body.dark-mode .form-card {
  background: #171a21 !important;
  color: #f3f6fb !important;
  border-color: #30394a !important;
}

body.dark-mode .setup-panel h1,
body.dark-mode .setup-panel h2,
body.dark-mode .setup-panel h3,
body.dark-mode .setup-card h1,
body.dark-mode .setup-card h2,
body.dark-mode .setup-card h3,
body.dark-mode .option-card h1,
body.dark-mode .option-card h2,
body.dark-mode .option-card h3,
body.dark-mode .setting-card h1,
body.dark-mode .setting-card h2,
body.dark-mode .setting-card h3,
body.dark-mode .setup-section h1,
body.dark-mode .setup-section h2,
body.dark-mode .setup-section h3,
body.dark-mode .config-card h1,
body.dark-mode .config-card h2,
body.dark-mode .config-card h3 {
  color: #ffffff !important;
}

body.dark-mode .setup-panel small,
body.dark-mode .setup-panel span,
body.dark-mode .setup-card small,
body.dark-mode .setup-card span,
body.dark-mode .option-card small,
body.dark-mode .option-card span,
body.dark-mode .setting-card small,
body.dark-mode .setting-card span,
body.dark-mode .setup-section small,
body.dark-mode .setup-section span,
body.dark-mode .config-card small,
body.dark-mode .config-card span {
  color: #b8c2d3 !important;
}

/* Option pill buttons */
body.dark-mode .choice-btn,
body.dark-mode .option-btn,
body.dark-mode .pill-btn,
body.dark-mode .toggle-btn,
body.dark-mode .length-btn,
body.dark-mode .attempt-btn,
body.dark-mode button[data-value],
body.dark-mode button[data-length],
body.dark-mode button[data-attempts],
body.dark-mode .setup-card button,
body.dark-mode .option-card button,
body.dark-mode .setting-card button {
  background: #242b3a !important;
  color: #f7f9fc !important;
  border: 1px solid #465168 !important;
  box-shadow: none !important;
}

/* Selected/active option buttons */
body.dark-mode .choice-btn.active,
body.dark-mode .choice-btn.selected,
body.dark-mode .option-btn.active,
body.dark-mode .option-btn.selected,
body.dark-mode .pill-btn.active,
body.dark-mode .pill-btn.selected,
body.dark-mode .toggle-btn.active,
body.dark-mode .toggle-btn.selected,
body.dark-mode .length-btn.active,
body.dark-mode .length-btn.selected,
body.dark-mode .attempt-btn.active,
body.dark-mode .attempt-btn.selected,
body.dark-mode button.active,
body.dark-mode button.selected,
body.dark-mode button[aria-pressed="true"] {
  background: #ffffff !important;
  color: #0f1117 !important;
  border-color: #ffffff !important;
}

/* Main start button in dark mode */
body.dark-mode #startUnlimitedBtn,
body.dark-mode .start-round-btn,
body.dark-mode .primary-btn,
body.dark-mode button.primary {
  background: #ffffff !important;
  color: #0f1117 !important;
  border-color: #ffffff !important;
}

/* Prevent white washed cards with white text */
body.dark-mode .white-card,
body.dark-mode .card,
body.dark-mode .panel {
  color: #f3f6fb;
}


/* v18 Discord desktop cache/style hardening */
#wuDebugPanel {
  display: none !important;
}

#wuDebugPanel.open {
  display: block !important;
}

.discord-bar,
.activity-controls,
.discord-controls,
.mock-discord-bar,
.fake-discord-bar,
.call-controls,
.bottom-discord-bar {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#darkModeToggle,
.theme-toggle {
  min-width: 122px !important;
  height: 38px !important;
  padding: 0 16px !important;
  border-radius: 999px !important;
  font-weight: 800 !important;
  font-size: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
  cursor: pointer !important;
}


/* v19: fix invisible Unlimited Setup labels in dark mode */
body.dark-mode .setup-panel label,
body.dark-mode .setup-panel .label,
body.dark-mode .setup-panel .section-label,
body.dark-mode .setup-panel .setting-label,
body.dark-mode .setup-panel .option-label,
body.dark-mode .setup-panel .card-label,
body.dark-mode .setup-panel [class*="label"],
body.dark-mode .setup-card label,
body.dark-mode .setup-card .label,
body.dark-mode .setup-card .section-label,
body.dark-mode .setup-card .setting-label,
body.dark-mode .setup-card .option-label,
body.dark-mode .setup-card .card-label,
body.dark-mode .setup-card [class*="label"],
body.dark-mode .setup-section label,
body.dark-mode .setup-section .label,
body.dark-mode .setup-section [class*="label"],
body.dark-mode .config-card label,
body.dark-mode .config-card .label,
body.dark-mode .config-card [class*="label"],
body.dark-mode .option-card label,
body.dark-mode .option-card .label,
body.dark-mode .option-card [class*="label"],
body.dark-mode .setting-card label,
body.dark-mode .setting-card .label,
body.dark-mode .setting-card [class*="label"] {
  color: #f8fafc !important;
  opacity: 1 !important;
  text-shadow: none !important;
}

/* Direct setup text helpers for the exact header rows */
body.dark-mode .setup-panel strong,
body.dark-mode .setup-card strong,
body.dark-mode .setup-section strong,
body.dark-mode .config-card strong,
body.dark-mode .option-card strong,
body.dark-mode .setting-card strong {
  color: #ffffff !important;
  opacity: 1 !important;
}

/* Small right-side status text like "5 letters", "6 guesses", "Normal", "Group" */
body.dark-mode .setup-panel small,
body.dark-mode .setup-card small,
body.dark-mode .setup-section small,
body.dark-mode .config-card small,
body.dark-mode .option-card small,
body.dark-mode .setting-card small,
body.dark-mode .setup-panel .current-value,
body.dark-mode .setup-card .current-value,
body.dark-mode .setup-section .current-value,
body.dark-mode .config-card .current-value,
body.dark-mode .option-card .current-value,
body.dark-mode .setting-card .current-value,
body.dark-mode .setup-panel [class*="current"],
body.dark-mode .setup-card [class*="current"],
body.dark-mode .setup-section [class*="current"] {
  color: #cbd5e1 !important;
  opacity: 1 !important;
}

/* If those labels are inside light sub-cards, force readable dark text */
body.dark-mode .setup-panel .light-card label,
body.dark-mode .setup-card .light-card label,
body.dark-mode .setup-panel .white-card label,
body.dark-mode .setup-card .white-card label {
  color: #111318 !important;
}


/* v20 exact Unlimited Setup dark-mode fixes */
body.dark-mode .settings-panel {
  background: #151a24 !important;
  border-color: #333d50 !important;
  box-shadow: 0 18px 55px rgba(0,0,0,.32) !important;
}

body.dark-mode .setting-block {
  background: #1d2430 !important;
  border-color: #3a455a !important;
  color: #f8fafc !important;
}

body.dark-mode .setting-title strong {
  color: #ffffff !important;
  opacity: 1 !important;
  visibility: visible !important;
}

body.dark-mode .setting-title span {
  color: #cbd5e1 !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Option pills: unselected dark, selected light */
body.dark-mode .length-options button,
body.dark-mode .pill-options button {
  background: #242d3c !important;
  color: #f8fafc !important;
  border-color: #47546b !important;
  text-shadow: none !important;
}

body.dark-mode .length-options button.active,
body.dark-mode .pill-options button.active {
  background: #ffffff !important;
  color: #0f1117 !important;
  border-color: #ffffff !important;
}

/* Start button remains readable and clean */
body.dark-mode .start-btn {
  background: #ffffff !important;
  color: #0f1117 !important;
  border-color: #ffffff !important;
}

/* top player card avatar image support */
.discord-avatar {
  overflow: hidden;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
}

.discord-avatar.has-image {
  color: transparent !important;
  text-indent: -9999px;
}


/* v21: bottom-right dev credit readability in dark mode */
.credit,
.dev-credit,
.creator-credit,
.footer-credit,
.watermark,
.activity-credit,
.made-by,
[class*="credit"],
[class*="watermark"] {
  opacity: 0.72 !important;
}

body.dark-mode .credit,
body.dark-mode .dev-credit,
body.dark-mode .creator-credit,
body.dark-mode .footer-credit,
body.dark-mode .watermark,
body.dark-mode .activity-credit,
body.dark-mode .made-by,
body.dark-mode [class*="credit"],
body.dark-mode [class*="watermark"] {
  color: #cbd5e1 !important;
  opacity: 0.75 !important;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55) !important;
}

body.dark-mode .credit a,
body.dark-mode .dev-credit a,
body.dark-mode .creator-credit a,
body.dark-mode .footer-credit a,
body.dark-mode .watermark a,
body.dark-mode .activity-credit a,
body.dark-mode .made-by a,
body.dark-mode [class*="credit"] a,
body.dark-mode [class*="watermark"] a {
  color: #e5e7eb !important;
  opacity: 0.95 !important;
  text-decoration: none !important;
}

/* keep it subtle on light mode too */
.credit,
.dev-credit,
.creator-credit,
.footer-credit,
.watermark,
.activity-credit,
.made-by,
[class*="credit"],
[class*="watermark"] {
  font-size: 11px !important;
}


/* v22: hide waiting player card when the round is Solo */
body.solo-mode #waitingPlayerCard,
body.solo-mode .waiting-player-card,
body.solo-mode [data-waiting-player="true"] {
  display: none !important;
}
