:root {
  --bg: #090b10;
  --bg-2: #11151d;
  --panel: rgba(24, 28, 37, .92);
  --panel-2: rgba(33, 38, 49, .94);
  --silver: #eef1f5;
  --silver-2: #b8c0cc;
  --muted: #8f9bad;
  --line: rgba(235, 239, 246, .14);
  --line-2: rgba(235, 239, 246, .24);
  --red: #d7193f;
  --red-2: #8f102b;
  --red-soft: rgba(215, 25, 63, .16);
  --correct: #45b36b;
  --present: #d5a943;
  --absent: #4b5260;
  --shadow: 0 26px 80px rgba(0, 0, 0, .46);
  --radius: 24px;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 16% 0%, rgba(215, 25, 63, .18), transparent 32rem),
    radial-gradient(circle at 90% 8%, rgba(238, 241, 245, .12), transparent 34rem),
    linear-gradient(135deg, #080a0e 0%, #10141d 54%, #080a0e 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--silver);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(9,11,16,.12), rgba(9,11,16,.78));
  z-index: -1;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
code { color: #fff; background: rgba(255,255,255,.08); padding: 2px 6px; border-radius: 8px; }

.ew-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  padding: 14px clamp(14px, 4vw, 42px);
  background: rgba(8, 10, 14, .86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 36px rgba(0,0,0,.28);
}

.ew-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ew-brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.28), transparent 42%),
    linear-gradient(135deg, var(--red), #f0546f 48%, #cfd6df);
  color: white;
  font-weight: 1000;
  letter-spacing: -.08em;
  box-shadow: 0 0 0 1px rgba(255,255,255,.16), 0 14px 34px rgba(215,25,63,.22);
}

.ew-brand strong,
.ew-brand em { display: block; }
.ew-brand strong { font-size: 18px; line-height: 1; letter-spacing: -.035em; }
.ew-brand em { margin-top: 4px; color: var(--muted); font-size: 12px; font-style: normal; }

.ew-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.ew-nav a {
  color: var(--silver-2);
  padding: 10px 14px;
  border-radius: 999px;
  transition: .16s ease;
}

.ew-nav a:hover,
.ew-nav a.active {
  color: white;
  background: var(--red-soft);
  box-shadow: inset 0 0 0 1px rgba(215,25,63,.35);
}

.ew-user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px 7px 7px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.04));
  color: white;
  box-shadow: 0 16px 36px rgba(0,0,0,.26);
}

button.ew-user-pill {
  cursor: pointer;
}

button.ew-user-pill:hover {
  border-color: rgba(215,25,63,.58);
  background: linear-gradient(180deg, rgba(215,25,63,.18), rgba(255,255,255,.05));
}

.ew-user-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--red), #cfd6df);
  color: white;
  font-weight: 1000;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
  object-fit: cover;
}

img.ew-user-avatar {
  display: block;
}

.ew-user-pill strong { white-space: nowrap; font-weight: 900; }

.ew-page {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 58px;
}

.ew-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  margin-bottom: 22px;
}

.ew-hero-small { grid-template-columns: 1fr; }

.ew-hero > div,
.ew-hero-card,
.ew-mode-panel,
.ew-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,.075), rgba(255,255,255,.035)),
    linear-gradient(135deg, rgba(215,25,63,.055), rgba(238,241,245,.04)),
    var(--panel);
  box-shadow: var(--shadow);
}

.ew-hero > div::before,
.ew-hero-card::before,
.ew-mode-panel::before,
.ew-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255,255,255,.10), transparent 26%, transparent 78%, rgba(255,255,255,.04));
  opacity: .42;
}

.ew-hero > div > *,
.ew-hero-card > *,
.ew-mode-panel > *,
.ew-card > * { position: relative; z-index: 1; }

.ew-hero > div { padding: clamp(28px, 5vw, 54px); }

.ew-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  color: #ff6d86;
  letter-spacing: .22em;
  font-weight: 1000;
  font-size: 12px;
}

.ew-hero h1 {
  margin: 0 0 16px;
  font-size: clamp(46px, 7vw, 82px);
  line-height: .88;
  letter-spacing: -.08em;
  text-shadow: 0 10px 34px rgba(0,0,0,.46);
}

.ew-hero p {
  max-width: 840px;
  margin: 0;
  color: #d7dde6;
  font-size: 17px;
  line-height: 1.65;
}

.ew-hero-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px;
  min-height: 190px;
}

.ew-hero-card span { color: var(--muted); font-size: 13px; }
.ew-hero-card strong { margin-top: 10px; font-size: 31px; line-height: 1.14; letter-spacing: -.05em; }

.ew-mode-panel { padding: 20px; margin-bottom: 22px; }

.ew-section-title,
.ew-board-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}

.ew-section-title h2,
.ew-board-top h2 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: -.045em;
}

.ew-section-title p { margin: 5px 0 0; color: var(--muted); }

.ew-mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.ew-mode-chip {
  display: grid;
  gap: 4px;
  align-content: center;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.02));
  transition: .16s ease;
}

.ew-mode-chip:hover,
.ew-mode-chip.active {
  border-color: rgba(215,25,63,.62);
  background: linear-gradient(135deg, rgba(215,25,63,.22), rgba(238,241,245,.08));
  transform: translateY(-1px);
}

.ew-mode-chip strong { font-size: 20px; }
.ew-mode-chip span { color: var(--silver-2); font-size: 11px; text-transform: uppercase; letter-spacing: .16em; font-weight: 900; }

.ew-game-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.ew-card { padding: 24px; }

.ew-rules-card {
  position: sticky;
  top: 96px;
}

.ew-rules-card h2 { margin: 0 0 16px; font-size: 28px; letter-spacing: -.05em; }

.ew-rule-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: center;
  padding: 11px;
  margin: 11px 0;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 17px;
  background: rgba(0,0,0,.16);
}

.ew-rule-row p { margin: 0; color: #d9dfe8; }

.tile {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 2px solid rgba(220,227,238,.25);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  color: white;
  font-weight: 1000;
  text-transform: uppercase;
  font-size: 30px;
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.tile.sample { width: 44px; height: 44px; font-size: 20px; border-radius: 11px; }

.tile.correct,
.key.correct {
  background: linear-gradient(180deg, rgba(255,255,255,.24), transparent 38%), var(--correct);
  border-color: #65dc8f;
  color: #04130a;
}

.tile.present,
.key.present {
  background: linear-gradient(180deg, rgba(255,255,255,.25), transparent 38%), var(--present);
  border-color: #f1cf67;
  color: #161000;
}

.tile.absent,
.key.absent {
  background: linear-gradient(180deg, rgba(255,255,255,.10), transparent 38%), var(--absent);
  border-color: #626b7b;
  color: #edf1f7;
}

.ew-stat-box {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.ew-stat-box div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(0,0,0,.15);
}

.ew-stat-box span { color: var(--muted); }
.ew-stat-box strong { color: white; }

.ew-board-card { min-height: 640px; }
.ew-board-top h2 { font-size: 32px; }

.ew-small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  color: white;
  background: linear-gradient(135deg, var(--red), var(--red-2));
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  padding: 10px 15px;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(215,25,63,.18);
  cursor: pointer;
}

.ew-message {
  min-height: 48px;
  display: flex;
  align-items: center;
  margin: 0 0 20px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: #dce2eb;
  background: rgba(0,0,0,.18);
}

.ew-message.good { color: #dfffea; border-color: rgba(69,179,107,.52); background: rgba(69,179,107,.14); }
.ew-message.bad { color: #ffd9df; border-color: rgba(215,25,63,.62); background: rgba(215,25,63,.14); }

.ew-board {
  display: grid;
  justify-content: center;
  gap: 8px;
  margin: 18px auto 24px;
  padding: 24px;
  border-radius: 22px;
  background: rgba(0,0,0,.14);
}

.ew-row {
  display: grid;
  gap: 8px;
}

.ew-guess-form { display: grid; gap: 9px; }
.ew-guess-form label { color: #dbe1ea; font-weight: 900; }
.ew-guess-form div { display: grid; grid-template-columns: 1fr auto; gap: 10px; }

.ew-guess-form input {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: rgba(5,7,11,.76);
  color: white;
  outline: none;
  padding: 15px 16px;
  text-transform: uppercase;
  letter-spacing: .28em;
  font-weight: 1000;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.ew-guess-form input:focus {
  border-color: rgba(215,25,63,.78);
  box-shadow: 0 0 0 4px rgba(215,25,63,.16), inset 0 1px 0 rgba(255,255,255,.05);
}

.ew-guess-form button {
  border: 0;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, var(--red), var(--red-2));
  padding: 15px 24px;
  font-weight: 1000;
  cursor: pointer;
  box-shadow: 0 16px 28px rgba(215,25,63,.18);
}

.ew-keyboard {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.ew-key-row {
  display: flex;
  justify-content: center;
  gap: 7px;
}

.key {
  min-width: 38px;
  height: 46px;
  padding: 0 10px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
  color: white;
  font-weight: 1000;
  cursor: pointer;
}

.key-wide { min-width: 82px; }
.key:hover { filter: brightness(1.12); }

.ew-leaderboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}

.ew-table-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

.ew-empty {
  color: var(--muted);
  margin: 0;
}

.ew-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
  min-width: 900px;
}

.ew-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .14em;
  text-align: left;
  padding: 0 12px 4px;
  white-space: nowrap;
}

.ew-table td {
  padding: 14px 12px;
  background: rgba(0,0,0,.18);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.ew-table td:first-child {
  border-left: 1px solid var(--line);
  border-radius: 15px 0 0 15px;
  color: #ff6d86;
  font-weight: 1000;
}

.ew-table td:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 15px 15px 0;
}

.ew-player-name {
  color: white;
  font-weight: 950;
  white-space: nowrap;
}

.ew-daily-table {
  table-layout: auto;
}

.ew-daily-table th,
.ew-daily-table td {
  white-space: nowrap;
}

.ew-daily-table td:nth-child(2) {
  min-width: 180px;
}

.ew-daily-table td:nth-child(3) {
  min-width: 155px;
}

.ew-result-grid {
  display: inline-grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(235, 239, 246, .14);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.025)),
    rgba(0,0,0,.22);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 22px rgba(0,0,0,.22);
  vertical-align: middle;
}

.ew-result-row {
  display: grid;
  grid-template-columns: repeat(var(--mini-cols), 14px);
  gap: 4px;
}

.ew-result-tile {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}

.ew-result-tile.correct {
  background:
    linear-gradient(180deg, rgba(255,255,255,.22), transparent 42%),
    var(--correct);
  border-color: rgba(101, 220, 143, .78);
}

.ew-result-tile.present {
  background:
    linear-gradient(180deg, rgba(255,255,255,.22), transparent 42%),
    var(--present);
  border-color: rgba(241, 207, 103, .78);
}

.ew-result-tile.absent {
  background:
    linear-gradient(180deg, rgba(255,255,255,.10), transparent 42%),
    var(--absent);
  border-color: rgba(126, 137, 154, .78);
}

.ew-result-tile.empty {
  background: rgba(255,255,255,.055);
  border-color: rgba(255,255,255,.08);
}

.ew-no-grid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.06);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.ew-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 64px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
}

.ew-status-pill.won {
  color: #dfffea;
  background: rgba(69, 179, 107, .16);
  border: 1px solid rgba(69, 179, 107, .46);
}

.ew-status-pill.lost {
  color: #ffd9df;
  background: rgba(215, 25, 63, .16);
  border: 1px solid rgba(215, 25, 63, .46);
}

.ew-profile-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 4, 8, .76);
  backdrop-filter: blur(12px);
}

.ew-profile-modal[hidden] {
  display: none;
}

.ew-profile-card {
  position: relative;
  width: min(620px, 100%);
  border: 1px solid var(--line-2);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.085), rgba(255,255,255,.035)),
    linear-gradient(135deg, rgba(215,25,63,.10), rgba(238,241,245,.045)),
    #151922;
  box-shadow: 0 28px 90px rgba(0,0,0,.62);
  padding: 26px;
}

.ew-profile-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0,0,0,.22);
  color: var(--silver);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.ew-profile-close:hover {
  background: var(--red-soft);
  border-color: rgba(215,25,63,.5);
}

.ew-profile-head {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 18px;
  align-items: center;
  margin-bottom: 22px;
  padding-right: 28px;
}

.ew-profile-head h2 {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -.05em;
}

.ew-profile-head p {
  margin: 0;
  color: #d7dde6;
  line-height: 1.55;
}

.ew-profile-preview {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 26px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.22), transparent 42%),
    linear-gradient(135deg, var(--red), #cfd6df);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.18),
    0 18px 40px rgba(215,25,63,.18);
  overflow: hidden;
}

.ew-profile-preview-avatar {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 26px;
  object-fit: cover;
  color: white;
  font-size: 38px;
  font-weight: 1000;
}

span.ew-profile-preview-avatar {
  background: transparent;
}

.ew-profile-form {
  display: grid;
  gap: 15px;
}

.ew-profile-form label {
  display: grid;
  gap: 8px;
  color: var(--silver-2);
  font-weight: 900;
}

.ew-profile-form input[type="text"],
.ew-profile-form input[type="file"] {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: rgba(5,7,11,.76);
  color: white;
  outline: none;
  padding: 14px 15px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}

.ew-profile-form input[type="text"]:focus,
.ew-profile-form input[type="file"]:focus {
  border-color: rgba(215,25,63,.78);
  box-shadow: 0 0 0 4px rgba(215,25,63,.16), inset 0 1px 0 rgba(255,255,255,.05);
}

.ew-profile-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.ew-profile-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-weight: 850;
}

.ew-profile-message.good {
  color: #dfffea;
}

.ew-profile-message.bad {
  color: #ffd9df;
}

.ew-profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.ew-profile-secondary {
  background: rgba(255,255,255,.08);
  box-shadow: none;
}

.ew-footer {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 34px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

@media (max-width: 960px) {
  .ew-header { grid-template-columns: 1fr auto; }
  .ew-nav { grid-column: 1 / -1; order: 3; justify-content: flex-start; overflow-x: auto; }
  .ew-hero,
  .ew-game-shell { grid-template-columns: 1fr; }
  .ew-rules-card { position: static; }
}

@media (max-width: 620px) {
  .ew-header { padding: 12px; }
  .ew-brand-mark { width: 42px; height: 42px; }
  .ew-user-pill strong { display: none; }
  .ew-page { width: min(100% - 20px, 1240px); padding-top: 20px; }
  .ew-hero > div,
  .ew-hero-card,
  .ew-mode-panel,
  .ew-card { padding: 16px; border-radius: 20px; }
  .ew-hero h1 { font-size: clamp(42px, 16vw, 62px); }
  .ew-section-title,
  .ew-board-top,
  .ew-footer { flex-direction: column; align-items: stretch; }
  .tile { width: 50px; height: 50px; font-size: 25px; }
  .tile.sample { width: 42px; height: 42px; font-size: 19px; }
  .ew-board { padding: 14px; }
  .ew-row { gap: 6px; }
  .ew-guess-form div { grid-template-columns: 1fr; }
  .ew-key-row { gap: 5px; }
  .key { min-width: 29px; height: 42px; padding: 0 6px; font-size: 13px; }
  .key-wide { min-width: 70px; }

  .ew-result-row {
    grid-template-columns: repeat(var(--mini-cols), 12px);
    gap: 3px;
  }

  .ew-result-tile {
    width: 12px;
    height: 12px;
    border-radius: 3px;
  }

  .ew-profile-head {
    grid-template-columns: 1fr;
    padding-right: 34px;
  }

  .ew-profile-actions {
    flex-direction: column;
  }

  .ew-profile-actions .ew-small-button {
    width: 100%;
  }
}
/* =========================================================
   Compact layout pass + profile modal close fix
   Add this at the VERY BOTTOM of assets/style.css
   ========================================================= */

:root {
  --shadow: 0 18px 50px rgba(0, 0, 0, .38);
  --radius: 18px;
}

.ew-header {
  padding: 9px clamp(12px, 3vw, 34px);
}

.ew-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 13px;
}

.ew-brand strong {
  font-size: 15px;
}

.ew-brand em {
  font-size: 11px;
}

.ew-nav a {
  padding: 8px 12px;
  font-size: 14px;
}

.ew-user-pill {
  padding: 5px 12px 5px 5px;
}

.ew-user-avatar {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.ew-user-pill strong {
  font-size: 14px;
}

.ew-page {
  width: min(1120px, calc(100% - 28px));
  padding: 22px 0 38px;
}

.ew-hero {
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 14px;
  margin-bottom: 14px;
}

.ew-hero > div {
  padding: 30px 34px;
}

.ew-hero h1 {
  font-size: clamp(38px, 5.5vw, 62px);
  margin-bottom: 12px;
}

.ew-hero p {
  font-size: 15px;
  line-height: 1.55;
}

.ew-hero-card {
  min-height: 150px;
  padding: 22px;
}

.ew-hero-card strong {
  font-size: 24px;
}

.ew-mode-panel {
  padding: 15px 18px;
  margin-bottom: 14px;
}

.ew-section-title,
.ew-board-top {
  margin-bottom: 13px;
}

.ew-section-title h2,
.ew-board-top h2 {
  font-size: 24px;
}

.ew-mode-grid {
  gap: 8px;
}

.ew-mode-chip {
  min-height: 58px;
  padding: 10px 14px;
  border-radius: 14px;
}

.ew-mode-chip strong {
  font-size: 16px;
}

.ew-mode-chip span {
  font-size: 9px;
}

.ew-game-shell {
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
}

.ew-card {
  padding: 18px;
}

.ew-rules-card {
  top: 72px;
}

.ew-rules-card h2 {
  font-size: 24px;
  margin-bottom: 12px;
}

.ew-rule-row {
  grid-template-columns: 42px 1fr;
  gap: 10px;
  padding: 9px;
  margin: 8px 0;
  border-radius: 14px;
}

.ew-rule-row p {
  font-size: 13px;
}

.tile {
  width: 50px;
  height: 50px;
  font-size: 24px;
  border-radius: 10px;
}

.tile.sample {
  width: 34px;
  height: 34px;
  font-size: 16px;
  border-radius: 9px;
}

.ew-stat-box {
  gap: 8px;
  margin-top: 14px;
}

.ew-stat-box div {
  padding: 10px 11px;
  border-radius: 12px;
  font-size: 13px;
}

.ew-board-card {
  min-height: auto;
}

.ew-board-top h2 {
  font-size: 26px;
}

.ew-kicker {
  font-size: 10px;
  margin-bottom: 7px;
}

.ew-small-button {
  padding: 8px 13px;
  font-size: 13px;
}

.ew-message {
  min-height: 40px;
  padding: 10px 13px;
  margin-bottom: 14px;
  font-size: 14px;
}

.ew-board {
  gap: 6px;
  margin: 12px auto 16px;
  padding: 18px;
  border-radius: 18px;
}

.ew-row {
  gap: 6px;
}

.ew-guess-form {
  gap: 7px;
}

.ew-guess-form label {
  font-size: 13px;
}

.ew-guess-form input {
  padding: 12px 14px;
  border-radius: 13px;
  font-size: 14px;
}

.ew-guess-form button {
  padding: 12px 18px;
  border-radius: 13px;
  font-size: 14px;
}

.ew-keyboard {
  gap: 6px;
  margin-top: 15px;
}

.ew-key-row {
  gap: 5px;
}

.key {
  min-width: 31px;
  height: 38px;
  padding: 0 7px;
  border-radius: 8px;
  font-size: 13px;
}

.key-wide {
  min-width: 68px;
}

.ew-footer {
  width: min(1120px, calc(100% - 28px));
  padding: 16px 0 24px;
  font-size: 13px;
}

/* Fix the broken question-mark close icon in the profile modal. */
.ew-profile-close {
  font-size: 0 !important;
  display: grid;
  place-items: center;
}

.ew-profile-close::before {
  content: "\00d7";
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  color: var(--silver);
}

/* Make the profile modal smaller and cleaner. */
.ew-profile-card {
  width: min(540px, 100%);
  padding: 20px;
  border-radius: 20px;
}

.ew-profile-head {
  grid-template-columns: 74px 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

.ew-profile-preview,
.ew-profile-preview-avatar {
  width: 72px;
  height: 72px;
  border-radius: 20px;
}

.ew-profile-preview-avatar {
  font-size: 30px;
}

.ew-profile-head h2 {
  font-size: 28px;
}

.ew-profile-head p {
  font-size: 14px;
}

.ew-profile-form {
  gap: 11px;
}

.ew-profile-form input[type="text"],
.ew-profile-form input[type="file"] {
  padding: 11px 13px;
  border-radius: 13px;
}

.ew-profile-actions {
  margin-top: 0;
}

/* Leaderboard avatar/name row. */
.ew-player-mini {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.ew-lb-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 999px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--red), #cfd6df);
  color: white;
  font-weight: 1000;
  font-size: 13px;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.22),
    0 8px 18px rgba(0,0,0,.24);
}

.ew-table th {
  font-size: 10px;
}

.ew-table td {
  padding: 10px 12px;
  font-size: 14px;
}

.ew-result-grid {
  padding: 6px;
  border-radius: 11px;
}

.ew-result-row {
  grid-template-columns: repeat(var(--mini-cols), 12px);
  gap: 3px;
}

.ew-result-tile {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

@media (max-width: 960px) {
  .ew-hero,
  .ew-game-shell {
    grid-template-columns: 1fr;
  }

  .ew-rules-card {
    position: static;
  }
}

@media (max-width: 620px) {
  .ew-page {
    width: min(100% - 18px, 1120px);
  }

  .ew-hero > div,
  .ew-hero-card,
  .ew-mode-panel,
  .ew-card {
    padding: 14px;
  }

  .ew-profile-head {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   Challenge system
   ========================================================= */

.ew-nav-button {
  position: relative;
  color: var(--silver-2);
  padding: 8px 12px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: .16s ease;
}

.ew-nav-button:hover,
.ew-nav-button.active {
  color: white;
  background: var(--red-soft);
  box-shadow: inset 0 0 0 1px rgba(215,25,63,.35);
}

.ew-challenge-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--red), #ff6d86);
  color: white;
  font-size: 11px;
  font-weight: 1000;
  border: 1px solid rgba(255,255,255,.28);
}

.ew-challenge-modal,
.ew-ch-game-over {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3, 4, 8, .76);
  backdrop-filter: blur(12px);
}

.ew-challenge-modal[hidden],
.ew-ch-game-over[hidden] {
  display: none;
}

.ew-challenge-card,
.ew-ch-game-over-card {
  position: relative;
  width: min(1040px, 100%);
  max-height: min(820px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line-2);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.085), rgba(255,255,255,.035)),
    linear-gradient(135deg, rgba(215,25,63,.10), rgba(238,241,245,.045)),
    #151922;
  box-shadow: 0 28px 90px rgba(0,0,0,.62);
  padding: 22px;
}

.ew-ch-game-over-card {
  width: min(620px, 100%);
}

.ew-challenge-close,
.ew-ch-game-over-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0,0,0,.22);
  color: var(--silver);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.ew-challenge-close:hover,
.ew-ch-game-over-close:hover {
  background: var(--red-soft);
  border-color: rgba(215,25,63,.5);
}

.ew-challenge-head {
  padding-right: 48px;
  margin-bottom: 16px;
}

.ew-challenge-head h2,
.ew-ch-game-over-card h2 {
  margin: 0 0 8px;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -.05em;
}

.ew-challenge-head p,
.ew-ch-game-over-card p {
  margin: 0;
  color: #d7dde6;
  line-height: 1.5;
}

.ew-challenge-layout {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: 14px;
}

.ew-challenge-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(0,0,0,.16);
  padding: 16px;
}

.ew-challenge-panel h3 {
  margin: 0 0 12px;
  font-size: 21px;
  letter-spacing: -.04em;
}

.ew-challenge-panel h4 {
  margin: 14px 0 8px;
  color: var(--silver-2);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .16em;
}

.ew-challenge-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ew-challenge-refresh {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--silver);
  background: rgba(255,255,255,.07);
  cursor: pointer;
  font-weight: 850;
}

.ew-challenge-label {
  display: grid;
  gap: 7px;
  margin-bottom: 11px;
  color: var(--silver-2);
  font-weight: 900;
}

.ew-challenge-label input,
.ew-challenge-label select {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 13px;
  background: rgba(5,7,11,.76);
  color: white;
  outline: none;
  padding: 11px 12px;
}

.ew-challenge-label select option {
  color: #11151d;
}

.ew-challenge-two {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 10px;
}

.ew-challenge-search-results,
.ew-challenge-selected,
.ew-challenge-lists {
  display: grid;
  gap: 8px;
}

.ew-challenge-search-results {
  min-height: 50px;
  margin-bottom: 10px;
}

.ew-challenge-muted {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.ew-challenge-error {
  margin: 0;
  color: #ffd9df;
  font-size: 13px;
}

.ew-ch-search-result,
.ew-ch-selected-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.055);
  color: white;
  padding: 9px;
  cursor: pointer;
  text-align: left;
}

.ew-ch-search-result:hover,
.ew-ch-selected-chip:hover {
  border-color: rgba(215,25,63,.5);
  background: rgba(215,25,63,.12);
}

.ew-ch-search-result:disabled {
  opacity: .6;
  cursor: default;
}

.ew-ch-search-result span {
  display: grid;
  gap: 2px;
  flex: 1;
}

.ew-ch-search-result em {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.ew-ch-search-result b,
.ew-ch-selected-chip b {
  margin-left: auto;
  color: #ff8ca0;
}

.ew-ch-mini-avatar,
.ew-ch-chip-avatar,
.ew-ch-player-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--red), #cfd6df);
  color: white;
  font-size: 13px;
  font-weight: 1000;
}

.ew-ch-chip-avatar {
  width: 24px;
  height: 24px;
  font-size: 11px;
}

.ew-challenge-message {
  min-height: 20px;
  margin: 9px 0;
  color: var(--muted);
  font-weight: 850;
}

.ew-challenge-message.good { color: #dfffea; }
.ew-challenge-message.bad { color: #ffd9df; }

.ew-ch-list-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.045);
}

.ew-ch-list-title {
  color: white;
  font-weight: 1000;
}

.ew-ch-list-card p {
  margin: 3px 0;
  color: var(--silver-2);
  font-size: 13px;
}

.ew-ch-list-card small {
  color: var(--muted);
}

.ew-ch-actions {
  display: flex;
  gap: 6px;
}

.ew-ch-actions button,
.ew-ch-cancel,
.ew-ch-play {
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  padding: 7px 10px;
  color: white;
  background: rgba(69,179,107,.18);
  cursor: pointer;
  font-weight: 950;
  white-space: nowrap;
}

.ew-ch-actions button.danger,
.ew-ch-cancel {
  background: rgba(215,25,63,.18);
}

.ew-ch-play {
  background: linear-gradient(135deg, var(--red), var(--red-2));
}

.ew-ch-play.secondary {
  background: rgba(255,255,255,.08);
}

.ew-ch-player {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ew-challenge-match-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.ew-ch-players {
  display: grid;
  gap: 10px;
}

.ew-ch-player-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.16);
}

.ew-ch-player-card.active {
  border-color: rgba(215,25,63,.55);
  box-shadow: inset 0 0 0 1px rgba(215,25,63,.18);
}

.ew-ch-player-avatar {
  width: 42px;
  height: 42px;
}

.ew-ch-player-card strong {
  display: block;
}

.ew-ch-player-card span {
  color: var(--muted);
  font-size: 12px;
}

.ew-ch-result {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
}

.ew-ch-result.win { color: #dfffea; background: rgba(69,179,107,.18); }
.ew-ch-result.loss { color: #ffd9df; background: rgba(215,25,63,.18); }
.ew-ch-result.draw { color: #fff1c6; background: rgba(213,169,67,.18); }

.ew-ch-turn-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 13px;
  border-radius: 14px;
  background: rgba(255,255,255,.055);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}

.ew-ch-turn-box span {
  color: var(--silver-2);
}

.ew-ch-moves {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.ew-ch-move {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: rgba(0,0,0,.14);
}

.ew-ch-move.timeout {
  opacity: .82;
}

.ew-ch-move-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ew-ch-move-head span {
  color: var(--muted);
  font-size: 12px;
}

.ew-ch-move-tiles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ew-ch-move-tiles .tile {
  width: 42px;
  height: 42px;
  font-size: 20px;
}

.ew-ch-end-grid {
  display: inline-grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(0,0,0,.18);
  margin: 8px 0 12px;
}

.ew-ch-end-row {
  display: flex;
  gap: 4px;
}

.ew-ch-final-player {
  margin-top: 12px;
}

@media (max-width: 900px) {
  .ew-challenge-layout,
  .ew-challenge-match-grid {
    grid-template-columns: 1fr;
  }

  .ew-challenge-two {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .ew-nav {
    gap: 4px;
  }

  .ew-nav-button {
    padding: 8px 10px;
    font-size: 13px;
  }

  .ew-challenge-card,
  .ew-ch-game-over-card {
    padding: 16px;
  }

  .ew-ch-list-card {
    grid-template-columns: 1fr;
  }

  .ew-ch-move-tiles .tile {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }
}
/* =========================================================
   Challenge battle grid fix
   Adds visible empty/filled challenge board rows.
   ========================================================= */

.ew-ch-board {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.ew-ch-board-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(235, 239, 246, .12);
  border-radius: 14px;
  background: rgba(0, 0, 0, .16);
}

.ew-ch-board-row.next {
  border-color: rgba(215, 25, 63, .55);
  background: rgba(215, 25, 63, .10);
}

.ew-ch-board-row.timeout {
  opacity: .78;
}

.ew-ch-board-player {
  display: flex;
  align-items: center;
  min-width: 0;
}

.ew-ch-board-player .ew-ch-player {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ew-ch-board-player .ew-ch-player strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ew-ch-empty-player {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.ew-ch-board-tiles {
  display: grid;
  grid-template-columns: repeat(var(--ch-cols), 38px);
  gap: 6px;
  justify-content: start;
  overflow-x: auto;
  padding-bottom: 2px;
}

.ew-ch-board-tile {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid rgba(220, 227, 238, .22);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  color: white;
  font-size: 18px;
  font-weight: 1000;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.ew-ch-board-tile.correct {
  background: linear-gradient(180deg, rgba(255,255,255,.24), transparent 38%), var(--correct);
  border-color: #65dc8f;
  color: #04130a;
}

.ew-ch-board-tile.present {
  background: linear-gradient(180deg, rgba(255,255,255,.25), transparent 38%), var(--present);
  border-color: #f1cf67;
  color: #161000;
}

.ew-ch-board-tile.absent {
  background: linear-gradient(180deg, rgba(255,255,255,.10), transparent 38%), var(--absent);
  border-color: #626b7b;
  color: #edf1f7;
}

.ew-ch-board-tile.empty {
  background: rgba(255,255,255,.045);
  border-color: rgba(220,227,238,.16);
  color: transparent;
}

.ew-ch-timeout-row {
  display: flex;
  align-items: center;
  min-height: 38px;
  color: var(--muted);
  font-weight: 900;
}

@media (max-width: 720px) {
  .ew-ch-board-row {
    grid-template-columns: 1fr;
  }

  .ew-ch-board-tiles {
    grid-template-columns: repeat(var(--ch-cols), 34px);
  }

  .ew-ch-board-tile {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }
}

/* =========================================================
   Multiplayer challenge boards - single-player style layout
   Shows one board per player, hides opponent letters until game over.
   Additions are intentionally at the bottom so they override older challenge board CSS.
   ========================================================= */

.ew-challenge-match-grid {
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.ew-ch-moves {
  margin-top: 16px;
}

.ew-mp-boards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 14px;
}

.ew-mp-board-card {
  border: 1px solid rgba(235,239,246,.13);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.025)),
    rgba(0,0,0,.16);
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.045);
}

.ew-mp-board-card.mine {
  border-color: rgba(215,25,63,.35);
  background:
    linear-gradient(135deg, rgba(215,25,63,.10), rgba(255,255,255,.035)),
    rgba(0,0,0,.18);
}

.ew-mp-board-card.active {
  border-color: rgba(215,25,63,.70);
  box-shadow:
    0 0 0 3px rgba(215,25,63,.10),
    inset 0 1px 0 rgba(255,255,255,.06);
}

.ew-mp-board-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ew-mp-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 999px;
  object-fit: cover;
  background: linear-gradient(135deg, var(--red), #cfd6df);
  color: white;
  font-size: 14px;
  font-weight: 1000;
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.22),
    0 8px 18px rgba(0,0,0,.24);
}

.ew-mp-board-head strong {
  display: block;
  color: white;
  font-size: 15px;
  line-height: 1.1;
}

.ew-mp-board-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.ew-mp-board-grid {
  display: grid;
  gap: 6px;
  justify-content: center;
  padding: 14px;
  border-radius: 16px;
  background: rgba(0,0,0,.16);
}

.ew-mp-row {
  display: grid;
  grid-template-columns: repeat(var(--mp-cols), 42px);
  gap: 6px;
  justify-content: center;
}

.ew-mp-row.timeout {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid rgba(235,239,246,.12);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.ew-mp-row.next .ew-mp-tile.empty {
  border-color: rgba(215,25,63,.65);
  background: rgba(215,25,63,.08);
}

.ew-mp-tile {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(220,227,238,.25);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  color: white;
  font-size: 21px;
  font-weight: 1000;
  text-transform: uppercase;
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.ew-mp-tile.correct {
  background: linear-gradient(180deg, rgba(255,255,255,.24), transparent 38%), var(--correct);
  border-color: #65dc8f;
  color: #04130a;
}

.ew-mp-tile.present {
  background: linear-gradient(180deg, rgba(255,255,255,.25), transparent 38%), var(--present);
  border-color: #f1cf67;
  color: #161000;
}

.ew-mp-tile.absent {
  background: linear-gradient(180deg, rgba(255,255,255,.10), transparent 38%), var(--absent);
  border-color: #626b7b;
  color: #edf1f7;
}

.ew-mp-tile.empty {
  background: rgba(255,255,255,.045);
  border-color: rgba(220,227,238,.16);
  color: transparent;
}

.ew-mp-tile.hidden-letter {
  color: transparent;
  text-shadow: none;
}

.ew-mp-hidden-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.ew-ch-keyboard {
  margin: 15px auto 0;
}

.ew-ch-keyboard[hidden] {
  display: none;
}

.ew-ch-guess-form[hidden] {
  display: none;
}

.ew-ch-end-grid {
  display: grid;
  gap: 6px;
  margin: 10px 0 16px;
}

.ew-ch-end-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 42px;
  gap: 6px;
  justify-content: start;
}

@media (max-width: 960px) {
  .ew-challenge-match-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .ew-mp-boards {
    grid-template-columns: 1fr;
  }

  .ew-mp-board-grid {
    padding: 10px;
  }

  .ew-mp-row {
    grid-template-columns: repeat(var(--mp-cols), 34px);
    gap: 5px;
  }

  .ew-mp-tile {
    width: 34px;
    height: 34px;
    font-size: 17px;
    border-radius: 8px;
  }

  .ew-ch-end-row {
    grid-auto-columns: 34px;
    gap: 5px;
  }
}
/* =========================================================
   Challenge board sizing fix for 8/9/10-letter modes
   Keeps multiplayer boards from overlapping.
   ========================================================= */

.ew-ch-moves {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.ew-ch-player-boards,
.ew-ch-boards,
.ew-ch-board-list {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.ew-ch-player-board,
.ew-ch-board-card,
.ew-ch-board-panel {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.ew-ch-board {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.ew-ch-board-row {
  grid-template-columns: minmax(90px, 130px) minmax(0, 1fr) !important;
  min-width: 0;
}

.ew-ch-board-player {
  min-width: 0;
  overflow: hidden;
}

.ew-ch-board-player .ew-ch-player {
  min-width: 0;
  max-width: 100%;
}

.ew-ch-board-player .ew-ch-player strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Main fix: tiles now shrink to fit the board instead of forcing overflow. */
.ew-ch-board-tiles,
.ew-ch-private-row,
.ew-ch-player-row,
.ew-ch-wordle-row {
  display: grid !important;
  grid-template-columns: repeat(var(--ch-cols), minmax(20px, 1fr)) !important;
  gap: clamp(3px, .55vw, 6px) !important;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: visible !important;
}

.ew-ch-board-tile,
.ew-ch-private-tile,
.ew-ch-player-tile,
.ew-ch-wordle-tile {
  width: 100% !important;
  max-width: 38px;
  min-width: 0;
  height: auto !important;
  aspect-ratio: 1 / 1;
  font-size: clamp(12px, 1.6vw, 18px);
  border-radius: clamp(6px, .8vw, 9px);
  margin: 0 auto;
}

/* Wider challenge modes should use a full-width stacked layout. */
.ew-ch-player-boards:has([style*="--ch-cols:8"]),
.ew-ch-player-boards:has([style*="--ch-cols:9"]),
.ew-ch-player-boards:has([style*="--ch-cols:10"]),
.ew-ch-boards:has([style*="--ch-cols:8"]),
.ew-ch-boards:has([style*="--ch-cols:9"]),
.ew-ch-boards:has([style*="--ch-cols:10"]) {
  grid-template-columns: 1fr !important;
}

.ew-challenge-match-grid {
  grid-template-columns: 260px minmax(0, 1fr);
}

.ew-challenge-match-grid > .ew-card {
  min-width: 0;
}

.ew-ch-guess-form {
  margin-bottom: 14px;
}

.ew-ch-turn-box {
  flex-wrap: wrap;
}

.ew-ch-countdown {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(215, 25, 63, .18);
  border: 1px solid rgba(215, 25, 63, .35);
  color: #ffffff !important;
  font-weight: 950;
  font-size: 12px;
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .ew-challenge-match-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .ew-ch-board-row {
    grid-template-columns: 1fr !important;
  }

  .ew-ch-board-tile,
  .ew-ch-private-tile,
  .ew-ch-player-tile,
  .ew-ch-wordle-tile {
    max-width: 34px;
  }
}
/* =========================================================
   Multiplayer challenge board overlap fix
   Put this at the VERY BOTTOM of assets/style.css
   ========================================================= */

.ew-challenge-page .ew-ch-moves {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

/* Force any board wrapper inside challenge moves to become 1 column. */
.ew-challenge-page .ew-ch-moves > *,
.ew-challenge-page .ew-ch-moves [class*="boards"],
.ew-challenge-page .ew-ch-moves [class*="board-list"],
.ew-challenge-page .ew-ch-moves [class*="player-boards"],
.ew-challenge-page .ew-ch-moves [class*="multi"] {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 16px !important;
}

/* Player board cards must never sit beside each other on large word modes. */
.ew-challenge-page .ew-ch-moves [class*="player-board"],
.ew-challenge-page .ew-ch-moves [class*="board-card"],
.ew-challenge-page .ew-ch-moves [class*="board-panel"],
.ew-challenge-page .ew-ch-player-board,
.ew-challenge-page .ew-ch-board-card,
.ew-challenge-page .ew-ch-board-panel {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
  display: block !important;
}

/* If your JS put boards directly as articles/cards, stack those too. */
.ew-challenge-page .ew-ch-moves > article,
.ew-challenge-page .ew-ch-moves > section,
.ew-challenge-page .ew-ch-moves > div > article,
.ew-challenge-page .ew-ch-moves > div > section {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

/* Rows inside each player's board. */
.ew-challenge-page .ew-ch-board,
.ew-challenge-page .ew-ch-player-wordle,
.ew-challenge-page .ew-ch-private-board,
.ew-challenge-page .ew-ch-player-grid {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

/* The actual tile rows. This is the important part for 10-letter mode. */
.ew-challenge-page .ew-ch-board-tiles,
.ew-challenge-page .ew-ch-private-row,
.ew-challenge-page .ew-ch-player-row,
.ew-challenge-page .ew-ch-wordle-row,
.ew-challenge-page .ew-ch-board-row .ew-ch-board-tiles {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  display: grid !important;
  grid-template-columns: repeat(var(--ch-cols), minmax(0, 1fr)) !important;
  gap: clamp(4px, 0.6vw, 8px) !important;
  justify-content: stretch !important;
  overflow: hidden !important;
}

/* Shrink tiles to fit cleanly instead of forcing overflow. */
.ew-challenge-page .ew-ch-board-tile,
.ew-challenge-page .ew-ch-private-tile,
.ew-challenge-page .ew-ch-player-tile,
.ew-challenge-page .ew-ch-wordle-tile {
  width: 100% !important;
  max-width: 42px !important;
  min-width: 0 !important;
  height: auto !important;
  aspect-ratio: 1 / 1 !important;
  margin: 0 auto !important;
  font-size: clamp(12px, 1.4vw, 18px) !important;
  border-radius: clamp(6px, 0.8vw, 10px) !important;
}

/* Remove the side-by-side look completely inside the battle board. */
.ew-challenge-page .ew-ch-moves {
  container-type: inline-size;
}

@container (max-width: 9999px) {
  .ew-challenge-page .ew-ch-moves [class*="boards"],
  .ew-challenge-page .ew-ch-moves [class*="board-list"],
  .ew-challenge-page .ew-ch-moves [class*="player-boards"] {
    grid-template-columns: 1fr !important;
  }
}

/* Make the battle card itself able to contain wide boards. */
.ew-challenge-page .ew-challenge-match-grid,
.ew-challenge-page .ew-challenge-match-grid > *,
.ew-challenge-page .ew-card {
  min-width: 0 !important;
}

/* On 10-letter games, slightly reduce padding so the board breathes. */
.ew-challenge-page .ew-ch-moves .ew-card,
.ew-challenge-page .ew-ch-moves [class*="player-board"] {
  padding-inline: clamp(10px, 2vw, 18px) !important;
}

/* Mobile fallback. */
@media (max-width: 900px) {
  .ew-challenge-page .ew-challenge-match-grid {
    grid-template-columns: 1fr !important;
  }

  .ew-challenge-page .ew-ch-board-tile,
  .ew-challenge-page .ew-ch-private-tile,
  .ew-challenge-page .ew-ch-player-tile,
  .ew-challenge-page .ew-ch-wordle-tile {
    max-width: 34px !important;
  }
}
/* =========================================================
   Sleek TopList-style Extreme Wordle visual pass
   Pure visuals only. Append to bottom of assets/style.css.
   ========================================================= */

:root {
  --shadow: 0 14px 34px rgba(0, 0, 0, .22);
  --radius: 18px;
}

.ew-header {
  min-height: 54px;
  padding: 8px clamp(14px, 2.5vw, 32px) !important;
  background: rgba(7, 8, 12, .94) !important;
}

.ew-brand-mark {
  width: 34px !important;
  height: 34px !important;
  border-radius: 10px !important;
  font-size: 12px !important;
}

.ew-brand {
  gap: 9px !important;
}

.ew-brand strong {
  font-size: 14px !important;
}

.ew-brand em {
  font-size: 10px !important;
}

.ew-nav {
  gap: 4px !important;
}

.ew-nav a,
.ew-nav-button {
  padding: 7px 11px !important;
  font-size: 13px !important;
}

.ew-user-pill {
  padding: 4px 10px 4px 4px !important;
}

.ew-user-avatar {
  width: 28px !important;
  height: 28px !important;
}

.ew-user-pill strong {
  font-size: 13px !important;
}

.ew-header-mode-control {
  position: fixed;
  top: 10px;
  left: clamp(190px, 18vw, 330px);
  z-index: 80;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 3px 4px 3px 10px;
  border: 1px solid rgba(235, 239, 246, .13);
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}

.ew-header-mode-control label {
  color: #7a7f8b;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.ew-header-mode-control select {
  height: 27px;
  min-width: 126px;
  border: 0;
  border-radius: 999px;
  background: #f5f6f8;
  color: #161922;
  padding: 0 28px 0 10px;
  font-size: 13px;
  font-weight: 900;
  outline: none;
  cursor: pointer;
}

.ew-header-mode-control select:focus {
  box-shadow: 0 0 0 3px rgba(215,25,63,.16);
}

.ew-page {
  width: min(1040px, calc(100% - 28px)) !important;
  padding: 22px 0 34px !important;
}

.ew-focus-page {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.ew-focus-card {
  width: min(640px, 100%);
  margin: 16px auto 0;
  padding: 20px 22px 22px !important;
  border-radius: 22px !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.035)),
    rgba(20, 22, 28, .88) !important;
  box-shadow: 0 18px 42px rgba(0,0,0,.28) !important;
}

.ew-focus-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.ew-focus-top h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: -.04em;
}

.ew-focus-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ew-info-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(235,239,246,.18);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: white;
  font-size: 15px;
  font-weight: 1000;
  cursor: pointer;
}

.ew-info-button:hover {
  background: rgba(215,25,63,.18);
  border-color: rgba(215,25,63,.45);
}

.ew-compact-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0 10px;
}

.ew-compact-stats span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid rgba(235,239,246,.10);
  border-radius: 999px;
  background: rgba(0,0,0,.16);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.ew-compact-stats strong {
  color: white;
}

.ew-focus-card .ew-kicker,
.ew-lb-topline .ew-kicker {
  margin-bottom: 5px;
  font-size: 9px;
  letter-spacing: .18em;
}

.ew-focus-card .ew-message {
  min-height: 34px !important;
  margin-bottom: 10px !important;
  padding: 8px 12px !important;
  border-radius: 999px !important;
  font-size: 13px !important;
}

.ew-focus-card .ew-board {
  margin: 8px auto 14px !important;
  padding: 16px !important;
  gap: 6px !important;
  border-radius: 18px !important;
  background: rgba(0,0,0,.12) !important;
}

.ew-focus-card .ew-row {
  gap: 6px !important;
}

.ew-focus-card .tile {
  width: clamp(34px, 6vw, 48px) !important;
  height: clamp(34px, 6vw, 48px) !important;
  border-radius: 10px !important;
  font-size: clamp(18px, 3vw, 24px) !important;
}

.ew-focus-card .ew-guess-form {
  gap: 6px !important;
}

.ew-focus-card .ew-guess-form label {
  font-size: 12px !important;
}

.ew-focus-card .ew-guess-form div {
  gap: 8px !important;
}

.ew-focus-card .ew-guess-form input {
  padding: 11px 13px !important;
  border-radius: 999px !important;
  font-size: 13px !important;
}

.ew-focus-card .ew-guess-form button {
  padding: 10px 17px !important;
  border-radius: 999px !important;
  font-size: 13px !important;
}

.ew-focus-card .ew-keyboard {
  margin-top: 12px !important;
  gap: 5px !important;
}

.ew-focus-card .ew-key-row {
  gap: 5px !important;
}

.ew-focus-card .key {
  min-width: 29px !important;
  height: 34px !important;
  padding: 0 7px !important;
  border-radius: 8px !important;
  font-size: 12px !important;
}

.ew-focus-card .key-wide {
  min-width: 62px !important;
  font-size: 11px !important;
}

.ew-rules-modal {
  position: fixed;
  inset: 0;
  z-index: 700;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(3,4,8,.72);
  backdrop-filter: blur(10px);
}

.ew-rules-modal[hidden] {
  display: none;
}

.ew-rules-modal-card {
  position: relative;
  width: min(390px, 100%);
  padding: 22px;
  border: 1px solid rgba(235,239,246,.18);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.035)),
    #171a22;
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
}

.ew-rules-modal-card h2 {
  margin: 0 0 13px;
  font-size: 28px;
  letter-spacing: -.05em;
}

.ew-rules-close {
  position: absolute;
  top: 13px;
  right: 13px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(235,239,246,.14);
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: white;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.ew-rules-small {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.ew-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.ew-lb-sleek-page {
  width: min(980px, calc(100% - 28px)) !important;
}

.ew-lb-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 14px;
}

.ew-lb-topline h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 46px);
  letter-spacing: -.07em;
  line-height: .95;
}

.ew-lb-sleek-grid {
  gap: 14px !important;
}

.ew-lb-card {
  padding: 18px !important;
  border-radius: 22px !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,.065), rgba(255,255,255,.03)),
    rgba(21, 23, 30, .88) !important;
  box-shadow: 0 16px 38px rgba(0,0,0,.24) !important;
}

.ew-lb-card .ew-board-top {
  margin-bottom: 10px !important;
}

.ew-lb-card .ew-board-top h2 {
  font-size: 22px !important;
}

.ew-lb-card .ew-table {
  min-width: 760px !important;
  border-spacing: 0 7px !important;
}

.ew-lb-card .ew-table th {
  font-size: 9px !important;
  padding: 0 10px 2px !important;
}

.ew-lb-card .ew-table td {
  padding: 9px 10px !important;
  font-size: 13px !important;
}

.ew-lb-card .ew-result-grid {
  padding: 5px !important;
  border-radius: 10px !important;
}

.ew-lb-card .ew-result-row {
  grid-template-columns: repeat(var(--mini-cols), 10px) !important;
  gap: 3px !important;
}

.ew-lb-card .ew-result-tile {
  width: 10px !important;
  height: 10px !important;
  border-radius: 3px !important;
}

.ew-slim-footer {
  width: min(980px, calc(100% - 28px)) !important;
  padding: 14px 0 22px !important;
  font-size: 12px !important;
}

@media (max-width: 900px) {
  .ew-header-mode-control {
    position: static;
    width: min(520px, calc(100% - 24px));
    margin: 10px auto 0;
    justify-content: space-between;
    border-radius: 14px;
  }

  .ew-header-mode-control select {
    flex: 1;
  }

  .ew-focus-card {
    margin-top: 12px;
  }
}

@media (max-width: 620px) {
  .ew-focus-top,
  .ew-lb-topline {
    flex-direction: column;
    align-items: stretch;
  }

  .ew-focus-actions {
    justify-content: space-between;
  }

  .ew-focus-card .ew-guess-form div {
    grid-template-columns: 1fr !important;
  }

  .ew-focus-card .key {
    min-width: 25px !important;
    height: 32px !important;
    padding: 0 5px !important;
    font-size: 11px !important;
  }

  .ew-focus-card .key-wide {
    min-width: 56px !important;
  }
}
/* Fix rules modal close button showing broken ? symbol */
.ew-rules-close {
  font-size: 0 !important;
  display: grid !important;
  place-items: center !important;
}

.ew-rules-close::before {
  content: "X";
  font-size: 15px;
  line-height: 1;
  font-weight: 1000;
  color: #ffffff;
}
/* =========================================================
   Small sleek web app install/update controls
   ========================================================= */

.ew-app-tools {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  margin: -2px 0 8px;
  min-height: 24px;
}

.ew-app-mini {
  border: 1px solid rgba(235, 239, 246, .13);
  border-radius: 999px;
  background: rgba(255, 255, 255, .055);
  color: rgba(238, 241, 245, .82);
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .03em;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition: .15s ease;
}

.ew-app-mini:hover {
  color: #ffffff;
  border-color: rgba(215, 25, 63, .45);
  background: rgba(215, 25, 63, .14);
}

.ew-app-mini:disabled {
  opacity: .55;
  cursor: wait;
}

.ew-app-mini[hidden] {
  display: none !important;
}