:root {
  color-scheme: dark;
  --ink: #f7f5ff;
  --muted: #a6a7ba;
  --panel: rgba(18, 20, 40, 0.78);
  --panel-solid: #14162a;
  --line: rgba(255, 255, 255, 0.11);
  --purple: #765dff;
  --purple-light: #9b8aff;
  --pink: #ff4f7b;
  --yellow: #ffd23f;
  --green: #40e8a9;
  --dark: #090b18;
  --font-display: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--dark);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    linear-gradient(rgba(255, 255, 255, 0.021) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.021) 1px, transparent 1px),
    radial-gradient(circle at 50% -10%, #25205a 0, #0d1024 38%, var(--dark) 70%);
  background-size: 52px 52px, 52px 52px, auto;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(255, 210, 63, 0.95);
  outline-offset: 3px;
}

button,
.room-code-card {
  -webkit-tap-highlight-color: transparent;
}

.lobby-invite-grid {
  display: grid;
  width: min(650px, 100%);
  margin: 0 auto;
  grid-template-columns: minmax(0, 1fr) 210px;
  align-items: stretch;
  gap: 12px;
}

.lobby-invite-grid .room-code-card {
  width: 100%;
  margin: 0;
}

.room-qr-card {
  display: grid;
  min-height: 210px;
  margin: 0;
  padding: 13px;
  place-content: center;
  justify-items: center;
  gap: 7px;
  border: 1px solid rgba(64, 232, 169, 0.3);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
}

.room-qr-card canvas {
  display: block;
  width: 180px;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.room-qr-card figcaption {
  color: #25283b;
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

[hidden] {
  display: none !important;
}

.access-gate {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  padding:
    max(18px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  overflow: auto;
  place-items: center;
  background:
    linear-gradient(rgba(255, 255, 255, 0.023) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.023) 1px, transparent 1px),
    radial-gradient(circle at 50% 0, #29225d 0, #101227 43%, #080a16 75%);
  background-size: 42px 42px, 42px 42px, auto;
}

.access-gate::before,
.access-gate::after {
  content: "";
  position: fixed;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.13;
  pointer-events: none;
}

.access-gate::before {
  top: -170px;
  right: -80px;
  background: var(--pink);
}

.access-gate::after {
  bottom: -190px;
  left: -80px;
  background: var(--green);
}

.access-gate[hidden] {
  display: none;
}

body.access-locked {
  overflow: hidden;
}

body.access-locked > :not(.access-gate):not(script) {
  visibility: hidden;
}

.access-gate-card {
  position: relative;
  width: min(100%, 460px);
  padding: clamp(29px, 7vw, 48px);
  overflow: hidden;
  border: 1px solid rgba(155, 138, 255, 0.34);
  border-radius: 28px;
  text-align: center;
  background:
    linear-gradient(145deg, rgba(118, 93, 255, 0.13), transparent 42%),
    rgba(16, 18, 36, 0.95);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(20px);
}

.access-gate-mark {
  position: relative;
  display: block;
  width: 92px;
  height: 92px;
  margin: 0 auto 22px;
  transform: rotate(45deg);
}

.access-gate-mark i {
  position: absolute;
  width: 41px;
  height: 41px;
  border-radius: 24px 24px 8px 24px;
}

.access-gate-mark i:nth-child(1) { top: 1px; left: 1px; background: var(--pink); }
.access-gate-mark i:nth-child(2) { top: 1px; right: 1px; transform: rotate(90deg); background: var(--yellow); }
.access-gate-mark i:nth-child(3) { right: 1px; bottom: 1px; transform: rotate(180deg); background: var(--green); }
.access-gate-mark i:nth-child(4) { bottom: 1px; left: 1px; transform: rotate(270deg); background: var(--purple); }
.access-gate-mark b {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  font-size: 17px;
  background: white;
  transform: translate(-50%, -50%) rotate(-45deg);
}

.access-kicker {
  margin: 0 0 10px !important;
  color: var(--purple-light) !important;
  font-size: 9px !important;
  font-weight: 900;
  letter-spacing: 0.22em;
}

.access-gate-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(32px, 8vw, 46px);
  line-height: 0.98;
  letter-spacing: -0.055em;
  text-transform: uppercase;
}

.access-gate-card > p:not(.access-kicker) {
  max-width: 340px;
  margin: 17px auto 25px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.access-gate-card label {
  display: block;
  margin-bottom: 9px;
  color: #d7d5e1;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

#access-code-input {
  width: min(100%, 220px);
  height: 61px;
  padding: 0 15px 0 25px;
  border: 1px solid rgba(155, 138, 255, 0.45);
  border-radius: 14px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.35em;
  text-align: center;
  background: rgba(5, 7, 18, 0.75);
}

#access-gate-error {
  min-height: 19px;
  margin: 10px 0 !important;
  color: #ff9bb3 !important;
  font-size: 12px !important;
  font-weight: 750;
}

.access-gate-submit {
  width: 100%;
  margin-top: 2px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.13;
  pointer-events: none;
}

.ambient-one {
  top: 20%;
  left: -260px;
  background: var(--pink);
}

.ambient-two {
  right: -260px;
  bottom: 0;
  background: var(--purple);
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1180px, calc(100% - 40px));
  height: 92px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 0.92;
  letter-spacing: 0.09em;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.brand strong {
  color: var(--purple-light);
  font-size: 13px;
}

.brand-mark {
  position: relative;
  display: block;
  width: 42px;
  height: 42px;
  transform: rotate(45deg);
}

.brand-mark i {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 12px 12px 4px 12px;
}

.brand-mark i:nth-child(1) { top: 1px; left: 1px; background: var(--pink); }
.brand-mark i:nth-child(2) { top: 1px; right: 1px; transform: rotate(90deg); background: var(--yellow); }
.brand-mark i:nth-child(3) { right: 1px; bottom: 1px; transform: rotate(180deg); background: var(--green); }
.brand-mark i:nth-child(4) { bottom: 1px; left: 1px; transform: rotate(270deg); background: var(--purple); }
.brand-mark b {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: white;
  transform: translate(-50%, -50%);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.hub-link {
  display: inline-flex;
  min-height: 42px;
  padding: 0 13px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.035);
  transition: 0.2s ease;
}

.hub-link:hover {
  border-color: rgba(155, 138, 255, 0.55);
  color: var(--ink);
  background: rgba(118, 93, 255, 0.1);
}

.hub-link svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.1;
}

.hub-link[hidden] {
  display: none;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  font-size: 20px;
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.icon-button .sound-off {
  display: none;
}

.icon-button[aria-pressed="false"] .sound-on {
  display: none;
}

.icon-button[aria-pressed="false"] .sound-off {
  display: inline;
}

.connection-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(64, 232, 169, 0.25);
  border-radius: 999px;
  color: #a7f7d8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: rgba(64, 232, 169, 0.07);
}

.connection-pill i,
.live-tag i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
}

.connection-pill.offline {
  border-color: rgba(255, 79, 123, 0.25);
  color: #ff9eb6;
}

.connection-pill.offline i {
  background: var(--pink);
  box-shadow: none;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  min-height: calc(100vh - 92px);
  min-height: calc(100dvh - 92px);
  margin: 0 auto;
}

.screen {
  animation: screen-in 0.42s ease both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.home-screen {
  padding: 74px 0 80px;
}

.hero-copy {
  max-width: 840px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 18px;
  color: var(--purple-light);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.2em;
}

.eyebrow > span {
  display: inline-block;
  width: 20px;
  height: 2px;
  background: currentColor;
}

.eyebrow.centered {
  justify-content: center;
}

.hero-copy h1,
.setup-copy h1 {
  max-width: 900px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(46px, 7vw, 92px);
  line-height: 0.94;
  letter-spacing: -0.065em;
  text-transform: uppercase;
}

h1 em,
.setup-copy em {
  color: transparent;
  font-style: normal;
  -webkit-text-stroke: 2px var(--purple-light);
  text-stroke: 2px var(--purple-light);
}

.hero-intro {
  max-width: 650px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 52px;
}

.mode-card {
  position: relative;
  display: grid;
  min-height: 224px;
  padding: 31px;
  overflow: hidden;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 24px;
  border: 1px solid var(--line);
  border-radius: 24px;
  color: var(--ink);
  text-align: left;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: 0.25s ease;
}

.mode-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  background: linear-gradient(135deg, rgba(118, 93, 255, 0.24), transparent 55%);
  transition: opacity 0.25s ease;
}

.mode-card:hover {
  border-color: rgba(155, 138, 255, 0.55);
  transform: translateY(-5px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.mode-card:hover::before {
  opacity: 1;
}

.mode-number {
  position: absolute;
  top: 21px;
  left: 25px;
  color: rgba(255, 255, 255, 0.27);
  font-family: var(--font-display);
  font-size: 11px;
}

.mode-icon {
  position: relative;
  z-index: 1;
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  border-radius: 20px;
  font-family: var(--font-display);
  font-size: 35px;
  background: rgba(118, 93, 255, 0.15);
  transform: rotate(-4deg);
}

.online-card .mode-icon {
  color: var(--green);
  background: rgba(64, 232, 169, 0.1);
}

.mode-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mode-copy small {
  color: var(--purple-light);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.online-card .mode-copy small {
  color: var(--green);
}

.mode-copy strong {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -0.04em;
  text-transform: uppercase;
}

.mode-copy > span {
  color: var(--muted);
  font-size: 14px;
}

.mode-copy > span b {
  color: var(--ink);
}

.mode-arrow {
  position: relative;
  z-index: 1;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 22px;
  transition: 0.2s ease;
}

.mode-card:hover .mode-arrow {
  color: var(--dark);
  background: var(--green);
  transform: translateX(3px);
}

.live-tag {
  position: absolute;
  top: 20px;
  right: 22px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid rgba(64, 232, 169, 0.2);
  border-radius: 99px;
  color: var(--green);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.game-library {
  margin-top: 105px;
}

.mode-choice {
  margin-top: 82px;
}

.mode-choice .mode-grid {
  margin-top: 28px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 45px);
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

.section-heading .eyebrow {
  margin-bottom: 10px;
}

.section-heading > p {
  max-width: 360px;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

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

.game-tile {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  color: var(--ink);
  font: inherit;
  text-align: left;
  background: rgba(17, 19, 37, 0.76);
  cursor: pointer;
  transition: 0.22s ease;
}

.game-tile:hover {
  border-color: rgba(155, 138, 255, 0.55);
  transform: translateY(-4px);
}

.game-tile:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 4px;
}

.game-tile.selected {
  border-color: var(--green);
  box-shadow:
    0 0 0 2px rgba(64, 232, 169, 0.12),
    0 20px 55px rgba(0, 0, 0, 0.26);
}

.game-tile.selected .game-status::before {
  content: "✓ ";
}

.game-art {
  position: relative;
  height: 188px;
  overflow: hidden;
  background: #1d1a41;
}

.reaction-art {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.09) 1px, transparent 1px),
    radial-gradient(circle at center, #6e55ff, #251d62 70%);
  background-size: 17px 17px, auto;
}

.reaction-art::before,
.reaction-art::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
}

.reaction-art::after {
  width: 165px;
  height: 165px;
}

.reaction-art .bolt {
  z-index: 2;
  display: grid;
  width: 86px;
  height: 86px;
  place-items: center;
  border-radius: 50%;
  color: var(--dark);
  font-family: var(--font-display);
  font-size: 54px;
  background: var(--yellow);
  box-shadow: 0 0 50px rgba(255, 210, 63, 0.35);
}

.reaction-art i {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: white;
}

.reaction-art i:nth-of-type(1) { top: 24px; left: 28%; }
.reaction-art i:nth-of-type(2) { right: 22%; bottom: 32px; }
.reaction-art i:nth-of-type(3) { top: 43%; right: 8%; }

.orbit-art {
  background: radial-gradient(circle at 45% 45%, #424867, #15182a 65%);
}

.orbit-art span {
  position: absolute;
  top: 42px;
  left: calc(50% - 48px);
  width: 96px;
  height: 96px;
  border: 22px solid #777e99;
  border-radius: 50%;
}

.orbit-art i {
  position: absolute;
  top: 14px;
  left: 12%;
  width: 76%;
  height: 154px;
  border: 3px solid #b4b6c8;
  border-radius: 50%;
  transform: rotate(-15deg);
}

.target-art {
  display: grid;
  place-items: center;
  background: radial-gradient(circle, #3a2637, #181724 70%);
}

.target-art span,
.target-art i,
.target-art b {
  position: absolute;
  border: 3px solid #958c95;
  border-radius: 50%;
}

.target-art span { width: 130px; height: 130px; }
.target-art i { width: 86px; height: 86px; }
.target-art b { width: 34px; height: 34px; background: #777078; }

.game-info {
  padding: 22px 23px 24px;
}

.game-status {
  color: var(--green);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.game-locked .game-status {
  color: var(--muted);
}

.game-info h3 {
  margin: 8px 0 9px;
  font-family: var(--font-display);
  font-size: 21px;
  letter-spacing: -0.03em;
  text-transform: uppercase;
}

.game-info p {
  min-height: 42px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.game-meta {
  display: flex;
  gap: 7px;
  margin-top: 18px;
}

.game-meta span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: #c2c1cf;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.back-button,
.quit-button,
.text-button {
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.back-button {
  margin-top: 32px;
  font-size: 13px;
  font-weight: 800;
}

.back-button:hover,
.text-button:hover {
  color: var(--ink);
}

.setup-screen {
  padding-bottom: 60px;
}

.setup-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(45px, 9vw, 120px);
  align-items: center;
  min-height: calc(100vh - 155px);
  min-height: calc(100dvh - 155px);
}

.setup-copy h1 {
  font-size: clamp(44px, 6vw, 76px);
}

.setup-copy > p:not(.eyebrow) {
  max-width: 520px;
  margin: 26px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.setup-copy .selected-game-chip {
  display: inline-flex;
  margin-top: 22px;
  padding: 10px 14px;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(64, 232, 169, 0.28);
  border-radius: 99px;
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
}

.selected-game-chip strong {
  color: var(--ink);
  letter-spacing: 0;
  text-transform: uppercase;
}

.setup-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 34px;
  color: #c7c5d4;
  font-size: 11px;
  font-weight: 700;
}

.setup-steps span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.setup-steps b {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: var(--dark);
  background: var(--purple-light);
}

.setup-steps i {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.setup-panel {
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(18, 20, 39, 0.88);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.27);
  backdrop-filter: blur(18px);
}

.setup-panel label {
  display: block;
  margin-bottom: 9px;
  color: #d7d5e1;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.setup-panel input {
  width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(5, 7, 18, 0.7);
}

.setup-panel input::placeholder {
  color: #606174;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 52px;
  padding: 0 20px;
  border-radius: 12px;
  font-weight: 900;
  cursor: pointer;
  transition: 0.2s ease;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  color: #0c0d18;
  background: var(--green);
  box-shadow: 0 10px 30px rgba(64, 232, 169, 0.15);
}

.primary-button:hover:not(:disabled) {
  background: #63f1bd;
  transform: translateY(-2px);
}

.primary-button:disabled {
  color: #777889;
  background: #292b3b;
  box-shadow: none;
  cursor: not-allowed;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

.secondary-button:hover {
  border-color: rgba(155, 138, 255, 0.55);
  background: rgba(118, 93, 255, 0.1);
}

.danger-button {
  border: 1px solid rgba(255, 79, 123, 0.35);
  color: #ffadc1;
  background: rgba(255, 79, 123, 0.1);
}

.create-button {
  width: 100%;
  margin-top: 25px;
}

.create-button b {
  font-size: 21px;
}

.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0;
  color: #77788b;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.code-entry {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
}

.code-entry input {
  font-family: var(--font-display);
  font-size: 23px;
  letter-spacing: 0.16em;
  text-align: center;
  text-transform: uppercase;
}

.form-message {
  min-height: 20px;
  margin: 14px 0 0;
  color: #ff9bb3;
  font-size: 12px;
}

.lobby-screen {
  padding-bottom: 60px;
}

.lobby-card {
  width: min(680px, 100%);
  margin: 45px auto 0;
  text-align: center;
}

.lobby-card h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(36px, 6vw, 60px);
  letter-spacing: -0.055em;
  text-transform: uppercase;
}

.lobby-lead {
  margin: 14px auto 28px;
  color: var(--muted);
}

.lobby-game-name {
  margin: 13px 0 -2px;
  color: var(--green);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.lobby-game-name strong {
  color: var(--ink);
}

.room-code-card {
  position: relative;
  display: flex;
  width: min(420px, 100%);
  margin: 0 auto;
  padding: 25px;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(155, 138, 255, 0.35);
  border-radius: 22px;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(118, 93, 255, 0.22), rgba(118, 93, 255, 0.05)),
    var(--panel-solid);
  cursor: pointer;
}

.room-code-card small {
  color: var(--purple-light);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.room-code-card strong {
  font-family: var(--font-display);
  font-size: clamp(42px, 8vw, 64px);
  letter-spacing: 0.16em;
  line-height: 1.1;
}

.room-code-card > span {
  color: var(--muted);
  font-size: 10px;
}

.lobby-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 12px 0 35px;
}

.share-button,
.close-room-button {
  min-height: 42px;
  font-size: 12px;
}

.remove-player-button {
  min-height: 31px;
  margin-top: 7px;
  padding: 0 12px;
  border: 1px solid rgba(255, 79, 123, 0.35);
  border-radius: 99px;
  color: #ffadc1;
  font-size: 11px;
  font-weight: 900;
  background: rgba(255, 79, 123, 0.08);
  cursor: pointer;
}

.remove-player-button:hover {
  border-color: rgba(255, 79, 123, 0.7);
  background: rgba(255, 79, 123, 0.16);
}

.versus-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(18, 20, 39, 0.64);
}

.player-slot {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.avatar {
  display: grid;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  place-items: center;
  border-radius: 16px;
  color: #0a0b16;
  font-family: var(--font-display);
  font-size: 20px;
  transform: rotate(-4deg);
}

.avatar-one { background: var(--purple-light); }
.avatar-two { background: var(--pink); transform: rotate(4deg); }

.player-slot small,
.score-player small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.player-slot strong {
  max-width: 170px;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ready-label {
  margin-top: 4px;
  color: #767789;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.player-slot.ready .ready-label {
  color: var(--green);
}

.versus-mark,
.score-divider span {
  font-family: var(--font-display);
  font-size: 17px;
  font-style: italic;
}

.start-button {
  width: min(420px, 100%);
  margin: 22px auto 0;
}

.lobby-note {
  min-height: 19px;
  color: var(--muted);
  font-size: 11px;
}

.game-screen {
  padding: 24px 0 45px;
}

.game-topline {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  margin-bottom: 14px;
}

.quit-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
}

.quit-button svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

.round-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  line-height: 1.35;
}

.round-label strong {
  color: var(--ink);
}

.best-of {
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(17, 19, 37, 0.78);
}

.score-player {
  display: flex;
  min-width: 0;
  padding: 15px 20px;
  align-items: center;
  gap: 13px;
}

.score-player .avatar {
  width: 43px;
  height: 43px;
  margin: 0;
  border-radius: 13px;
  font-size: 16px;
}

.score-player > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.score-player strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-player b {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 35px;
}

.player-two-score {
  justify-content: flex-end;
  text-align: right;
}

.player-two-score b {
  margin: 0 auto 0 0;
}

.score-divider {
  display: grid;
  width: 50px;
  place-items: center;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  color: #6e6f80;
  background: rgba(255, 255, 255, 0.018);
}

.arena {
  position: relative;
  display: grid;
  min-height: min(620px, calc(100vh - 280px));
  min-height: min(620px, calc(100dvh - 280px));
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at center, rgba(118, 93, 255, 0.14), transparent 48%),
    #0e1020;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.round-winner-banner {
  position: absolute;
  z-index: 10;
  top: 18px;
  left: 50%;
  display: flex;
  width: max-content;
  max-width: calc(100% - 28px);
  min-height: 48px;
  padding: 8px 18px 8px 9px;
  align-items: center;
  gap: 10px;
  border: 2px solid rgba(139, 255, 210, 0.82);
  border-radius: 999px;
  color: #071811;
  background: linear-gradient(135deg, #8bffd2, var(--green));
  box-shadow: 0 8px 34px rgba(64, 232, 169, 0.42), 0 0 0 5px rgba(64, 232, 169, 0.1);
  transform: translateX(-50%);
  animation: winner-confirm 0.42s ease both;
}

.round-winner-banner[hidden] {
  display: none;
}

.round-winner-banner span {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  font-size: 20px;
  font-weight: 950;
  background: #071811;
}

.round-winner-banner strong {
  overflow: hidden;
  font-size: 15px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.round-winner-banner.draw {
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--ink);
  background: #303348;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
}

.round-winner-banner.draw span {
  color: var(--ink);
  background: #17192b;
}

@keyframes winner-confirm {
  from { opacity: 0; transform: translate(-50%, -12px) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.arena-grid {
  position: absolute;
  inset: 0;
  opacity: 0.34;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black, transparent 75%);
}

.reaction-button {
  position: relative;
  z-index: 1;
  display: flex;
  width: clamp(230px, 38vw, 350px);
  aspect-ratio: 1;
  padding: 34px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(155, 138, 255, 0.6);
  border-radius: 50%;
  color: var(--ink);
  background:
    radial-gradient(circle at 48% 38%, rgba(255, 255, 255, 0.1), transparent 24%),
    radial-gradient(circle, #5942d7, #291f70 72%);
  box-shadow:
    0 0 0 14px rgba(118, 93, 255, 0.05),
    0 0 90px rgba(118, 93, 255, 0.25),
    inset 0 -25px 60px rgba(0, 0, 0, 0.25);
  user-select: none;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
  touch-action: manipulation;
}

.reaction-button[hidden],
.color-game[hidden],
.orbit-game[hidden] {
  display: none;
}

.color-game,
.orbit-game {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(680px, calc(100% - 34px));
  justify-items: center;
}

.challenge-kicker,
.challenge-help,
.color-instruction {
  margin: 0;
  text-align: center;
}

.challenge-kicker {
  color: var(--purple-light);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.challenge-help {
  min-height: 18px;
  margin-top: 17px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.color-instruction {
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.color-target {
  margin-top: 3px;
  font-family: var(--font-display);
  font-size: clamp(48px, 8vw, 82px);
  letter-spacing: -0.05em;
  line-height: 1;
}

.color-options {
  display: grid;
  width: min(570px, 100%);
  margin-top: 31px;
  grid-template-columns: repeat(2, 1fr);
  gap: 13px;
}

.color-option {
  min-height: 92px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  color: #fff;
  font: 900 16px var(--font-body);
  letter-spacing: 0.08em;
  text-shadow: 0 1px 5px rgba(0, 0, 0, 0.46);
  cursor: pointer;
  transition: 0.12s ease;
  touch-action: manipulation;
}

.color-option:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.7);
  transform: translateY(-2px);
}

.color-option:active:not(:disabled) {
  transform: scale(0.97);
}

.color-option:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.color-option[data-color="red"] { background: #e5475e; }
.color-option[data-color="blue"] { background: #3478db; }
.color-option[data-color="green"] { background: #21966c; }
.color-option[data-color="yellow"] { color: #211b04; text-shadow: none; background: #f1c83b; }

.orbit-game {
  --orbit-radius: clamp(102px, 20vw, 145px);
}

.orbit-track {
  position: relative;
  width: calc(var(--orbit-radius) * 2 + 28px);
  aspect-ratio: 1;
  margin-top: 20px;
  border: 2px solid rgba(155, 138, 255, 0.55);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(118, 93, 255, 0.2) 0 21%, transparent 22%),
    repeating-radial-gradient(circle, transparent 0 23px, rgba(255, 255, 255, 0.035) 24px 25px);
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.36),
    0 0 70px rgba(118, 93, 255, 0.18);
}

.orbit-core {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  border: 1px solid rgba(155, 138, 255, 0.4);
  border-radius: 50%;
  color: var(--purple-light);
  font-size: 30px;
  background: #151832;
  transform: translate(-50%, -50%);
}

.orbit-arm,
.orbit-target-zone {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  transform: rotate(0deg);
}

.orbit-arm::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: -1px;
  width: 2px;
  height: var(--orbit-radius);
  opacity: 0.36;
  background: linear-gradient(transparent, var(--purple-light));
}

.orbit-arm i {
  position: absolute;
  top: calc(-1 * var(--orbit-radius) - 12px);
  left: -12px;
  width: 24px;
  height: 24px;
  border: 4px solid #ece9ff;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 0 24px rgba(155, 138, 255, 0.85);
}

.orbit-target-zone::before {
  content: "";
  position: absolute;
  top: calc(-1 * var(--orbit-radius) - 17px);
  left: -31px;
  width: 62px;
  height: 30px;
  border: 4px solid var(--green);
  border-radius: 50%;
  background: rgba(64, 232, 169, 0.18);
  box-shadow: 0 0 30px rgba(64, 232, 169, 0.48);
}

.orbit-stop-button {
  min-width: 190px;
  min-height: 58px;
  margin-top: 19px;
  padding: 0 30px;
  border: 0;
  border-radius: 99px;
  color: #090b18;
  font: 900 15px var(--font-body);
  letter-spacing: 0.12em;
  background: var(--green);
  box-shadow: 0 12px 34px rgba(64, 232, 169, 0.2);
  cursor: pointer;
  touch-action: manipulation;
}

.orbit-stop-button:disabled {
  color: #777889;
  background: #292b3b;
  box-shadow: none;
  cursor: not-allowed;
}

.arena.win .challenge-kicker,
.arena.win .challenge-help {
  color: #8bffd2;
}

.arena.lose .challenge-kicker,
.arena.lose .challenge-help {
  color: #ff9bb3;
}

.reaction-button:active {
  transform: scale(0.96);
}

.reaction-rings {
  position: absolute;
  inset: -30%;
  pointer-events: none;
}

.reaction-rings i {
  position: absolute;
  inset: 20%;
  border: 1px solid rgba(155, 138, 255, 0.13);
  border-radius: 50%;
}

.reaction-rings i:nth-child(2) { inset: 10%; }
.reaction-rings i:nth-child(3) { inset: 0; }

.reaction-kicker {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.reaction-button strong {
  font-family: var(--font-display);
  font-size: clamp(70px, 12vw, 118px);
  line-height: 0.95;
  letter-spacing: -0.07em;
}

.reaction-help {
  max-width: 190px;
  margin-top: 15px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  line-height: 1.4;
}

.arena.go {
  border-color: rgba(64, 232, 169, 0.45);
  background:
    radial-gradient(circle at center, rgba(64, 232, 169, 0.19), transparent 48%),
    #0d171b;
}

.arena.go .reaction-button {
  border-color: rgba(160, 255, 220, 0.82);
  color: #06130e;
  background: radial-gradient(circle at 48% 35%, #8bffd2, var(--green) 70%);
  box-shadow:
    0 0 0 14px rgba(64, 232, 169, 0.07),
    0 0 100px rgba(64, 232, 169, 0.4);
  animation: go-pulse 0.55s ease infinite alternate;
}

@keyframes go-pulse {
  to { transform: scale(1.025); }
}

.arena.lose {
  border-color: rgba(255, 79, 123, 0.38);
  background: radial-gradient(circle at center, rgba(255, 79, 123, 0.14), transparent 48%), #160e18;
}

.arena.lose .reaction-button {
  border-color: rgba(255, 120, 153, 0.58);
  background: radial-gradient(circle at 48% 38%, #d84971, #78263f 72%);
}

.arena.win .reaction-button {
  border-color: rgba(139, 255, 210, 0.82);
  color: #06130e;
  background: radial-gradient(circle at 48% 38%, #a5ffdc, var(--green) 72%);
  box-shadow: 0 0 100px rgba(64, 232, 169, 0.38);
}

.arena.round-won {
  border: 2px solid rgba(64, 232, 169, 0.9);
  background:
    radial-gradient(circle at center, rgba(64, 232, 169, 0.24), transparent 55%),
    #0b1918;
  box-shadow: inset 0 0 70px rgba(64, 232, 169, 0.11), 0 0 28px rgba(64, 232, 169, 0.14);
}

.round-dots {
  position: absolute;
  bottom: 23px;
  left: 50%;
  display: flex;
  gap: 7px;
  transform: translateX(-50%);
}

.round-dots i {
  display: block;
  width: 26px;
  height: 4px;
  border-radius: 9px;
  background: #2c2e42;
}

.round-dots i.p1 { background: var(--purple-light); }
.round-dots i.p2 { background: var(--pink); }
.round-dots i.draw { background: #767789; }

dialog {
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(4, 5, 13, 0.8);
  backdrop-filter: blur(10px);
}

.result-dialog {
  width: min(490px, calc(100% - 30px));
  padding: 42px;
  overflow: hidden;
  border: 1px solid rgba(155, 138, 255, 0.35);
  border-radius: 28px;
  text-align: center;
  background:
    radial-gradient(circle at 50% -20%, rgba(118, 93, 255, 0.4), transparent 48%),
    #141629;
}

.result-icon {
  position: relative;
  z-index: 1;
  display: grid;
  width: 78px;
  height: 78px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 24px;
  color: #11121e;
  font-family: var(--font-display);
  font-size: 42px;
  background: var(--yellow);
  transform: rotate(-5deg);
}

.result-dialog h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 42px;
  letter-spacing: -0.05em;
  text-transform: uppercase;
}

.result-dialog > p:not(.eyebrow) {
  color: var(--muted);
}

.final-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 22px 0;
}

.final-score strong {
  font-family: var(--font-display);
  font-size: 54px;
}

.final-score strong:first-child { color: var(--purple-light); }
.final-score strong:last-child { color: var(--pink); }
.final-score span { color: #6f7081; font-size: 28px; }

.result-dialog .primary-button {
  width: 100%;
}

.text-button {
  margin-top: 20px;
  font-size: 12px;
  font-weight: 800;
}

.confirm-dialog {
  width: min(440px, calc(100% - 30px));
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 22px;
  text-align: center;
  background: #17192b;
}

.confirm-dialog h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  text-transform: uppercase;
}

.confirm-dialog p {
  color: var(--muted);
}

.confirm-dialog > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 24px;
}

.toast {
  position: fixed;
  z-index: 100;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  padding: 11px 17px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  background: #202238;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 820px) {
  .topbar,
  .app-shell {
    width: min(100% - 28px, 680px);
  }

  .mode-grid,
  .setup-layout {
    grid-template-columns: 1fr;
  }

  .mode-card {
    min-height: 195px;
  }

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

  .setup-layout {
    min-height: 0;
    padding: 65px 0;
  }

  .setup-steps {
    max-width: 500px;
  }

  .arena {
    min-height: calc(100dvh - 280px);
  }
}

@media (max-width: 560px) {
  .topbar {
    height: 74px;
  }

  .app-shell {
    min-height: calc(100dvh - 74px);
  }

  .hub-link {
    width: 42px;
    min-height: 42px;
    padding: 0;
    justify-content: center;
  }

  .hub-link span {
    display: none;
  }

  .home-screen {
    padding: 46px 0 55px;
  }

  .hero-copy h1,
  .setup-copy h1 {
    font-size: clamp(40px, 13vw, 59px);
  }

  h1 em,
  .setup-copy em {
    -webkit-text-stroke-width: 1px;
  }

  .hero-intro {
    margin-top: 20px;
    font-size: 15px;
  }

  .mode-grid {
    margin-top: 34px;
  }

  .mode-card {
    min-height: 176px;
    padding: 25px 19px;
    grid-template-columns: auto 1fr;
    gap: 16px;
  }

  .mode-icon {
    width: 58px;
    height: 58px;
    border-radius: 17px;
    font-size: 27px;
  }

  .mode-copy strong {
    font-size: 20px;
  }

  .mode-copy > span,
  .mode-arrow {
    display: none;
  }

  .game-library {
    margin-top: 75px;
  }

  .mode-choice {
    margin-top: 62px;
  }

  .section-heading {
    display: block;
  }

  .section-heading > p {
    margin-top: 14px;
  }

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

  .setup-layout {
    gap: 42px;
    padding: 52px 0;
  }

  .setup-steps {
    display: none;
  }

  .lobby-card {
    margin-top: 35px;
  }

  .versus-row {
    gap: 8px;
    padding: 18px 10px;
  }

  .player-slot strong {
    max-width: 110px;
  }

  .game-screen {
    padding-top: 13px;
  }

  .best-of {
    display: none;
  }

  .game-topline {
    grid-template-columns: 1fr auto;
  }

  .scoreboard {
    margin-bottom: 10px;
  }

  .score-player {
    padding: 10px;
    gap: 8px;
  }

  .score-player .avatar {
    display: none;
  }

  .score-player b {
    font-size: 30px;
  }

  .score-divider {
    width: 38px;
  }

  .arena {
    min-height: calc(100dvh - 212px);
    border-radius: 20px;
  }

  .reaction-button {
    width: min(70vw, 300px);
  }

  .color-game,
  .orbit-game {
    width: calc(100% - 22px);
  }

  .color-options {
    gap: 9px;
  }

  .color-option {
    min-height: 76px;
    border-radius: 14px;
    font-size: 13px;
  }

  .orbit-game {
    --orbit-radius: clamp(92px, 31vw, 122px);
  }

  .result-dialog {
    padding: 34px 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Juegos online · multijugador, cuentas y nuevos retos */

.account-button {
  display: inline-flex;
  min-height: 42px;
  padding: 5px 13px 5px 6px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 850;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.account-button:hover {
  border-color: rgba(155, 138, 255, 0.55);
  background: rgba(118, 93, 255, 0.12);
}

.account-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: #11121e;
  font-weight: 950;
  background: var(--yellow);
}

.hero-actions {
  display: flex;
  margin-top: 30px;
  gap: 10px;
}

.hero-actions .primary-button,
.hero-actions .secondary-button {
  width: auto;
  min-height: 48px;
  padding-inline: 20px;
}

.game-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.math-art,
.memory-art,
.odd-art {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  font-family: var(--font-display);
  font-size: 31px;
}

.flag-art,
.stroop-art,
.trivia-art,
.illusion-art {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flag-art {
  gap: 12px;
  background:
    radial-gradient(circle at 50% 50%, rgba(74, 168, 255, 0.22), transparent 62%),
    #121a31;
}

.flag-art span,
.flag-art i,
.flag-art b {
  position: relative;
  font-size: 42px;
  font-style: normal;
  filter: drop-shadow(0 8px 11px rgba(0, 0, 0, 0.28));
}

.flag-art span { transform: translateY(-8px) rotate(-6deg); }
.flag-art i { transform: translateY(9px) rotate(5deg); }
.flag-art b { transform: translateY(-5px) rotate(7deg); }

.stroop-art {
  flex-direction: column;
  gap: 1px;
  font-family: var(--font-display);
  font-size: 29px;
  line-height: 0.92;
  background:
    linear-gradient(115deg, rgba(229, 71, 94, 0.12), rgba(77, 142, 232, 0.15)),
    #17182a;
}

.stroop-art span { color: #4d8ee8; }
.stroop-art i { color: #f1c83b; font-style: normal; transform: translateX(17px); }
.stroop-art b { color: #e5475e; transform: translateX(-10px); }

.trivia-art {
  background:
    radial-gradient(circle at center, rgba(255, 210, 63, 0.2), transparent 55%),
    #201c2b;
}

.trivia-art span {
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  border: 2px solid rgba(255, 210, 63, 0.55);
  border-radius: 50%;
  color: var(--yellow);
  font-family: var(--font-display);
  font-size: 57px;
  box-shadow: 0 0 45px rgba(255, 210, 63, 0.14);
}

.trivia-art i,
.trivia-art b {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--purple-light);
}

.trivia-art i { top: 28px; left: 22%; }
.trivia-art b { right: 20%; bottom: 32px; }

.illusion-art {
  background:
    repeating-radial-gradient(circle at center, #eceaf8 0 5px, #252941 6px 12px);
}

.illusion-art::after {
  content: "";
  position: absolute;
  inset: 20px;
  border: 1px solid rgba(64, 232, 169, 0.8);
  border-radius: 50%;
}

.illusion-art span,
.illusion-art i,
.illusion-art b {
  position: absolute;
  z-index: 1;
  width: 34px;
  height: 34px;
  border: 8px solid #0f1223;
  border-radius: 50%;
  background: var(--green);
}

.illusion-art span { left: 26%; }
.illusion-art i { right: 24%; width: 22px; height: 22px; }
.illusion-art b { top: 25px; left: 48%; width: 15px; height: 15px; }

.math-art span,
.math-art b,
.memory-art span,
.memory-art b,
.odd-art span,
.odd-art b {
  position: relative;
}

.math-art i,
.memory-art i,
.odd-art i {
  position: relative;
  font-style: normal;
}

.math-art {
  color: var(--yellow);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 210, 63, 0.15), transparent 60%),
    rgba(255, 255, 255, 0.018);
}

.memory-art {
  color: var(--green);
  background:
    radial-gradient(circle at 50% 50%, rgba(64, 232, 169, 0.14), transparent 60%),
    rgba(255, 255, 255, 0.018);
}

.odd-art {
  color: var(--purple-light);
  background:
    radial-gradient(circle at 50% 50%, rgba(118, 93, 255, 0.17), transparent 60%),
    rgba(255, 255, 255, 0.018);
}

.ranking-section {
  margin-top: 90px;
  scroll-margin-top: 30px;
}

.ranking-card {
  margin-top: 30px;
  padding: clamp(18px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: 25px;
  background:
    linear-gradient(135deg, rgba(118, 93, 255, 0.1), transparent 45%),
    rgba(14, 16, 34, 0.82);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.2);
}

.profile-summary {
  display: flex;
  margin-bottom: 18px;
  padding: 15px 18px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border: 1px solid rgba(64, 232, 169, 0.22);
  border-radius: 15px;
  background: rgba(64, 232, 169, 0.07);
}

.profile-summary p,
.profile-summary span {
  margin: 0;
}

.profile-summary p {
  color: var(--green);
  font-size: 14px;
  font-weight: 900;
}

.profile-summary span {
  color: var(--muted);
  font-size: 12px;
}

.ranking-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 8px;
  list-style: none;
}

.ranking-list li {
  display: grid;
  min-height: 65px;
  padding: 10px 16px;
  grid-template-columns: 45px 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.027);
}

.ranking-list li:nth-child(-n + 3) {
  border-color: rgba(255, 210, 63, 0.15);
  background: rgba(255, 210, 63, 0.035);
}

.ranking-position {
  font-size: 20px;
  font-weight: 900;
  text-align: center;
}

.ranking-list li div {
  display: grid;
  gap: 3px;
}

.ranking-list li strong {
  font-size: 14px;
}

.ranking-list li small {
  color: var(--muted);
  font-size: 10px;
}

.ranking-list li > b {
  color: var(--purple-light);
  font-size: 12px;
}

.ranking-list .ranking-empty {
  display: block;
  min-height: 0;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.ranking-login {
  width: 100%;
  margin-top: 16px;
}

.setup-panel select {
  width: 100%;
  height: 52px;
  margin-bottom: 20px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: #111426;
}

.form-message.success {
  color: var(--green);
}

.lobby-player-grid {
  display: grid;
  margin: 28px 0 22px;
  grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  gap: 9px;
}

.lobby-player-grid .player-slot {
  min-width: 0;
  padding: 17px 9px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}

.lobby-player-grid .player-slot.ready {
  border-color: color-mix(in srgb, var(--player-color) 46%, transparent);
  background: color-mix(in srgb, var(--player-color) 9%, transparent);
}

.lobby-player-grid .avatar {
  color: #10121e;
  background: var(--player-color, var(--purple-light));
}

.lobby-player-grid .player-slot strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multiplayer-scoreboard {
  display: grid;
  margin: 0 auto 12px;
  grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
  gap: 7px;
}

.multiplayer-scoreboard .score-player {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 72px;
  padding: 10px 12px;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.035);
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.multiplayer-scoreboard .score-player.is-me {
  border-color: color-mix(in srgb, var(--player-color) 70%, white 10%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--player-color) 22%, transparent);
}

.multiplayer-scoreboard .score-player.is-eliminated {
  opacity: 0.42;
  filter: grayscale(0.6);
}

.multiplayer-scoreboard .score-player.is-winner {
  border-color: var(--yellow);
  background: rgba(255, 210, 63, 0.08);
}

.multiplayer-scoreboard .score-player.is-round-winner {
  opacity: 1;
  border-color: var(--green);
  background: rgba(64, 232, 169, 0.15);
  box-shadow:
    inset 0 0 0 1px rgba(139, 255, 210, 0.28),
    0 0 22px rgba(64, 232, 169, 0.2);
  filter: none;
}

.multiplayer-scoreboard .score-player.is-round-winner small,
.multiplayer-scoreboard .score-player.is-round-winner > b {
  color: #8bffd2;
}

.multiplayer-scoreboard .avatar {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 10px;
  color: #10121e;
  font-size: 12px;
  font-weight: 950;
  background: var(--player-color);
}

.multiplayer-scoreboard .score-player > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.multiplayer-scoreboard small {
  color: var(--player-color);
  font-size: 9px;
  font-weight: 950;
  letter-spacing: 0.07em;
}

.multiplayer-scoreboard strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multiplayer-scoreboard .score-player > b {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 28px;
}

.choice-game,
.intruder-game {
  position: relative;
  z-index: 2;
  width: min(720px, calc(100% - 30px));
  margin: 0 auto;
  text-align: center;
}

.choice-label {
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.14em;
}

.choice-prompt {
  display: block;
  min-height: 65px;
  margin-bottom: 22px;
  font-family: var(--font-display);
  font-size: clamp(36px, 8vw, 67px);
  letter-spacing: 0.04em;
}

.choice-prompt.flag-prompt {
  min-height: 82px;
  font-family: sans-serif;
  font-size: clamp(63px, 13vw, 102px);
  line-height: 1;
}

.choice-prompt.stroop-prompt {
  font-size: clamp(54px, 11vw, 92px);
  letter-spacing: 0.01em;
  text-shadow: 0 5px 28px rgba(0, 0, 0, 0.32);
}

.choice-prompt.textual-prompt,
.choice-prompt.illusion-question {
  max-width: 680px;
  min-height: 0;
  margin: 10px auto 19px;
  font-family: var(--font-body);
  font-size: clamp(22px, 4.2vw, 34px);
  font-weight: 900;
  line-height: 1.16;
  letter-spacing: -0.025em;
}

.answer-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
}

.answer-options button,
.color-options button {
  min-height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 15px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(18px, 4vw, 27px);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  line-height: 1.12;
  padding: 10px 12px;
}

.answer-options[data-game-id="bandera-express"] button,
.answer-options[data-game-id="cultura-relampago"] button,
.answer-options[data-game-id="ilusion-optica"] button {
  font-family: var(--font-body);
  font-size: clamp(16px, 3vw, 20px);
  font-weight: 900;
}

.answer-options .stroop-answer {
  letter-spacing: 0.05em;
}

.illusion-stage {
  display: flex;
  width: min(520px, 100%);
  min-height: 132px;
  margin: -4px auto 18px;
  padding: 15px;
  align-items: center;
  justify-content: center;
  gap: clamp(28px, 8vw, 70px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 17px;
  background: #e9e8ed;
}

.illusion-stage[hidden] {
  display: none;
}

.muller-row {
  display: grid;
  width: 200px;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 10px;
  color: #1d2132;
  font-size: 13px;
  font-weight: 950;
}

.illusion-stage.illusion-muller {
  flex-direction: column;
  gap: 31px;
}

.muller-line {
  position: relative;
  display: block;
  width: 150px;
  height: 4px;
  background: #202536;
}

.muller-line::before,
.muller-line::after {
  content: "";
  position: absolute;
  top: -10px;
  width: 21px;
  height: 21px;
  border-top: 4px solid #202536;
  border-right: 4px solid #202536;
}

.muller-line::before { left: -2px; }
.muller-line::after { right: -2px; }
.arrows-out::before { transform: rotate(-135deg); }
.arrows-out::after { transform: rotate(45deg); }
.arrows-in::before { transform: rotate(45deg); }
.arrows-in::after { transform: rotate(-135deg); }

.ebbinghaus-set {
  position: relative;
  width: 118px;
  height: 118px;
}

.ebbinghaus-set b {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  background: #4d59aa;
  transform: translate(-50%, -50%);
}

.ebbinghaus-set i {
  --angle: 0deg;
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  background: #252b43;
}

.large-ring i {
  width: 27px;
  height: 27px;
  margin: -13px;
  transform: rotate(var(--angle)) translateY(-44px);
}

.small-ring i {
  width: 11px;
  height: 11px;
  margin: -5px;
  transform: rotate(var(--angle)) translateY(-38px);
}

.ebbinghaus-set i:nth-child(2) { --angle: 60deg; }
.ebbinghaus-set i:nth-child(3) { --angle: 120deg; }
.ebbinghaus-set i:nth-child(4) { --angle: 180deg; }
.ebbinghaus-set i:nth-child(5) { --angle: 240deg; }
.ebbinghaus-set i:nth-child(6) { --angle: 300deg; }

.rail-lines {
  position: relative;
  width: 280px;
  height: 105px;
}

.rail-lines i {
  position: absolute;
  left: 8px;
  width: 264px;
  height: 4px;
  background: #252a3e;
}

.rail-lines i:first-child { top: 28px; }
.rail-lines i:nth-child(2) { bottom: 28px; }

.rail-lines span {
  position: absolute;
  top: 7px;
  width: 3px;
  height: 91px;
  background: #757c96;
  transform: rotate(58deg);
}

.rail-lines span:nth-of-type(1) { left: 35px; }
.rail-lines span:nth-of-type(2) { left: 85px; transform: rotate(-58deg); }
.rail-lines span:nth-of-type(3) { left: 135px; }
.rail-lines span:nth-of-type(4) { left: 185px; transform: rotate(-58deg); }
.rail-lines span:nth-of-type(5) { left: 235px; }

.cafe-wall {
  width: 286px;
  padding: 4px 0;
  background: #777;
}

.cafe-wall i {
  display: block;
  height: 20px;
  border-bottom: 3px solid #888;
  background: repeating-linear-gradient(90deg, #111 0 24px, #f4f4f4 24px 48px);
}

.cafe-wall i:nth-child(even) {
  background-position-x: 12px;
}

.answer-options button:hover:not(:disabled),
.color-options button:hover:not(:disabled) {
  border-color: var(--yellow);
  transform: translateY(-2px);
}

.answer-options button:disabled,
.color-options button:disabled,
.intruder-grid button:disabled {
  cursor: default;
}

.answer-options .memory-answer {
  font-size: clamp(17px, 4vw, 24px);
  letter-spacing: 0.08em;
}

.color-options .color-red { background: rgba(229, 71, 94, 0.3); }
.color-options .color-blue { background: rgba(77, 142, 232, 0.3); }
.color-options .color-green { background: rgba(64, 232, 169, 0.25); }
.color-options .color-yellow { background: rgba(241, 200, 59, 0.25); }

.intruder-grid {
  display: grid;
  width: min(440px, 100%);
  margin: 18px auto;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.intruder-grid button {
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  font-size: clamp(25px, 6vw, 40px);
  background: rgba(255, 255, 255, 0.055);
  cursor: pointer;
}

.intruder-grid button:hover:not(:disabled) {
  border-color: var(--yellow);
  background: rgba(255, 210, 63, 0.1);
  transform: scale(1.035);
}

.round-dots i.player-win {
  background: var(--dot-color);
}

.account-dialog {
  width: min(520px, calc(100% - 26px));
  padding: 0;
  border: 1px solid rgba(155, 138, 255, 0.34);
  border-radius: 25px;
  background:
    radial-gradient(circle at 30% -15%, rgba(118, 93, 255, 0.34), transparent 45%),
    #141629;
}

.account-panel {
  position: relative;
  padding: clamp(27px, 6vw, 42px);
}

.dialog-close-form {
  position: absolute;
  top: 13px;
  right: 13px;
}

.dialog-close {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 22px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.account-panel h2 {
  margin: 8px 0 10px;
  font-family: var(--font-display);
  font-size: clamp(29px, 7vw, 40px);
  letter-spacing: -0.045em;
  text-transform: uppercase;
}

.dialog-intro {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-tabs {
  display: grid;
  margin-bottom: 20px;
  padding: 4px;
  grid-template-columns: 1fr 1fr;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
}

.auth-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  background: transparent;
  cursor: pointer;
}

.auth-tabs button.active {
  color: var(--ink);
  background: rgba(118, 93, 255, 0.24);
}

.auth-form {
  display: grid;
  gap: 13px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: #d7d5e1;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-form input {
  width: 100%;
  height: 49px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  font-size: 14px;
  text-transform: none;
  background: rgba(5, 7, 18, 0.65);
}

.auth-form .primary-button {
  width: 100%;
  margin-top: 5px;
}

.auth-message {
  min-height: 18px;
  margin: 12px 0 0;
  color: #ff9bb3;
  font-size: 12px;
}

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

.account-stats div {
  display: grid;
  min-height: 76px;
  place-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  text-align: center;
  background: rgba(255, 255, 255, 0.035);
}

.account-stats strong {
  font-family: var(--font-display);
  font-size: 23px;
}

.account-stats small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.final-standings {
  display: grid;
  margin: 22px 0;
  gap: 7px;
}

.final-standings div {
  display: grid;
  padding: 10px 13px;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
}

.final-standings div.winner {
  border-color: rgba(255, 210, 63, 0.5);
  background: rgba(255, 210, 63, 0.08);
}

.final-standings span {
  color: var(--muted);
  font-size: 11px;
}

.final-standings b {
  color: var(--purple-light);
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 920px) {
  .game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .top-actions {
    gap: 6px;
  }

  .account-button {
    padding-right: 6px;
  }

  .account-button #account-label {
    display: none;
  }

  .hero-actions {
    align-items: stretch;
  }

  .hero-actions > button {
    flex: 1;
  }

  .profile-summary {
    display: grid;
  }

  .ranking-list li {
    grid-template-columns: 36px 1fr;
  }

  .ranking-list li > b {
    grid-column: 2;
  }

  .lobby-player-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lobby-invite-grid {
    max-width: 420px;
    grid-template-columns: 1fr;
  }

  .room-qr-card {
    min-height: 205px;
  }

  .multiplayer-scoreboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .multiplayer-scoreboard .score-player {
    min-height: 58px;
    padding: 7px 9px;
  }

  .multiplayer-scoreboard .score-player > b {
    font-size: 23px;
  }

  .account-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .ranking-section {
    margin-top: 62px;
  }

  .choice-game,
  .intruder-game {
    width: calc(100% - 20px);
  }

  .round-label {
    max-width: 245px;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-align: right;
  }

  .round-winner-banner {
    top: 12px;
    min-height: 44px;
    padding: 7px 14px 7px 7px;
  }

  .round-winner-banner span {
    width: 28px;
    height: 28px;
    font-size: 18px;
  }

  .round-winner-banner strong {
    font-size: 13px;
  }

  .multiplayer-scoreboard small {
    font-size: 10px;
  }

  .multiplayer-scoreboard strong {
    font-size: 14px;
  }

  .challenge-kicker,
  .choice-label,
  .reaction-kicker,
  .color-instruction {
    font-size: 14px;
    letter-spacing: 0.1em;
  }

  .challenge-help,
  .reaction-help {
    font-size: 15px;
  }

  .reaction-help {
    max-width: 220px;
  }

  .choice-prompt.textual-prompt,
  .choice-prompt.illusion-question {
    font-size: clamp(25px, 7.2vw, 32px);
    line-height: 1.2;
  }

  .answer-options button {
    min-height: 61px;
    font-size: clamp(19px, 5.5vw, 25px);
  }

  .answer-options[data-game-id="bandera-express"] button,
  .answer-options[data-game-id="cultura-relampago"] button,
  .answer-options[data-game-id="ilusion-optica"] button {
    font-size: 17px;
    line-height: 1.22;
  }

  .color-option {
    font-size: 17px;
  }

  .result-dialog > p:not(.eyebrow),
  .confirm-dialog p {
    font-size: 16px;
    line-height: 1.45;
  }

  .result-dialog .text-button {
    font-size: 15px;
  }

  .intruder-grid {
    gap: 6px;
  }

  .intruder-grid button {
    border-radius: 11px;
  }

  .arena {
    min-height: calc(100dvh - 278px);
  }
}

/* Ajedrez online */

.mode-card.unavailable,
.mode-card.unavailable:hover {
  border-color: var(--line);
  opacity: 0.48;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.mode-card.unavailable::before,
.mode-card.unavailable:hover::before {
  opacity: 0;
}

.chess-art {
  display: grid;
  place-items: center;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.055) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.055) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.055) 25%, transparent 25% 75%, rgba(255, 255, 255, 0.055) 75%),
    radial-gradient(circle at 50% 35%, #395c59, #142825 72%);
  background-position: 0 0, 26px 26px, 0 0;
  background-size: 52px 52px, 52px 52px, auto;
}

.chess-art span,
.chess-art i,
.chess-art b {
  position: absolute;
  color: #f4e8cf;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 88px;
  font-style: normal;
  line-height: 1;
  text-shadow: 0 8px 20px rgba(0, 0, 0, 0.42);
}

.chess-art span { z-index: 2; transform: translateY(5px); }
.chess-art i { left: 15%; color: #c6aa7b; font-size: 61px; transform: rotate(-9deg); }
.chess-art b { right: 14%; color: #8ad9c2; font-size: 62px; transform: rotate(8deg); }

.arena.chess-arena {
  min-height: 0;
  padding: 18px;
  overflow: visible;
  place-items: stretch;
  border-color: rgba(138, 217, 194, 0.25);
  background:
    radial-gradient(circle at 45% 38%, rgba(64, 232, 169, 0.08), transparent 48%),
    #0b1119;
}

.arena.chess-arena .arena-grid {
  opacity: 0.13;
}

.chess-game {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(930px, 100%);
  margin: 0 auto;
  gap: 10px;
}

.chess-player-strip {
  display: grid;
  min-height: 66px;
  padding: 9px 14px;
  grid-template-columns: 42px 1fr auto;
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(8, 11, 18, 0.86);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.chess-player-strip.active {
  border-color: rgba(64, 232, 169, 0.65);
  background: rgba(30, 70, 60, 0.48);
  box-shadow: inset 0 0 0 1px rgba(64, 232, 169, 0.12);
}

.chess-player-strip.urgent.active {
  border-color: rgba(255, 79, 123, 0.78);
  background: rgba(99, 30, 50, 0.4);
}

.chess-player-piece {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 10px;
  color: #111823;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  background: #e6d8be;
}

.chess-player-strip > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.chess-player-strip small {
  color: var(--green);
  font-size: 8px;
  font-weight: 950;
  letter-spacing: 0.14em;
}

.chess-player-strip strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chess-captures {
  display: flex;
  min-width: 0;
  min-height: 17px;
  overflow: hidden;
  align-items: center;
  color: var(--muted);
  line-height: 1;
  white-space: nowrap;
}

.chess-captured-piece {
  width: 14px;
  flex: 0 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  text-align: center;
}

.chess-captured-piece.white {
  color: #f4e8cf;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.chess-captured-piece.black {
  color: #84958f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.12);
}

.chess-material-advantage {
  margin-left: 5px;
  color: var(--yellow);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 950;
}

.chess-player-strip time {
  min-width: 112px;
  padding: 8px 12px;
  border-radius: 10px;
  color: #f7f5ed;
  font-family: var(--font-display);
  font-size: clamp(25px, 4vw, 34px);
  letter-spacing: 0.02em;
  text-align: center;
  background: rgba(255, 255, 255, 0.075);
}

.chess-player-strip.active time {
  color: #071811;
  background: var(--green);
}

.chess-player-strip.urgent.active time {
  color: white;
  background: #d63861;
}

.chess-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  align-items: stretch;
  gap: 12px;
}

.chess-board-wrap {
  display: grid;
  min-width: 0;
  place-items: center;
}

.chess-board {
  display: grid;
  width: min(580px, 100%);
  aspect-ratio: 1;
  overflow: hidden;
  grid-template: repeat(8, minmax(0, 1fr)) / repeat(8, minmax(0, 1fr));
  border: 5px solid #1b2928;
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.42);
}

.chess-square {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  place-items: center;
  border: 0;
  color: #18201f;
  cursor: pointer;
}

.chess-square.light { background: #e7d8b9; }
.chess-square.dark { background: #6e9c87; }
.chess-square.last-move { box-shadow: inset 0 0 0 999px rgba(247, 220, 72, 0.32); }
.chess-square.selected { box-shadow: inset 0 0 0 999px rgba(255, 203, 47, 0.58); }
.chess-square.in-check { box-shadow: inset 0 0 0 999px rgba(229, 48, 81, 0.58); }

.chess-square.movable::before {
  content: "";
  position: absolute;
  inset: 9%;
  border: 2px solid rgba(11, 25, 22, 0.18);
  border-radius: 7px;
}

.chess-square.legal-empty::after {
  content: "";
  position: absolute;
  width: 24%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(8, 24, 20, 0.35);
}

.chess-square.legal-capture::after {
  content: "";
  position: absolute;
  inset: 7%;
  border: clamp(3px, 0.55vw, 7px) solid rgba(8, 24, 20, 0.32);
  border-radius: 50%;
}

.chess-piece {
  position: relative;
  z-index: 2;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(27px, 5.2vw, 58px);
  line-height: 1;
  transform: translateY(-1px);
  pointer-events: none;
}

.chess-piece.white {
  color: #fff8e9;
  text-shadow: 0 2px 0 #5b4f3c, 0 3px 7px rgba(0, 0, 0, 0.4);
}

.chess-piece.black {
  color: #17201f;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.32), 0 3px 6px rgba(0, 0, 0, 0.28);
}

.chess-square small {
  position: absolute;
  z-index: 3;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(7px, 1vw, 11px);
  font-weight: 950;
  pointer-events: none;
}

.chess-square .rank-coordinate { top: 3px; left: 4px; }
.chess-square .file-coordinate { right: 4px; bottom: 2px; }
.chess-square.light small { color: #587c6d; }
.chess-square.dark small { color: #e7d8b9; }

.chess-side-panel {
  display: flex;
  min-width: 0;
  padding: 13px;
  flex-direction: column;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(8, 11, 18, 0.78);
}

.chess-status {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(64, 232, 169, 0.22);
  border-radius: 11px;
  color: var(--green);
  font-size: 13px;
  font-weight: 850;
  line-height: 1.4;
  background: rgba(64, 232, 169, 0.07);
}

.chess-status.check {
  border-color: rgba(255, 79, 123, 0.35);
  color: #ff9bb3;
  background: rgba(255, 79, 123, 0.08);
}

.chess-moves-panel {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 7px;
}

.chess-moves-panel > span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 950;
  letter-spacing: 0.14em;
}

.chess-moves-panel ol {
  max-height: 375px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.chess-moves-panel li {
  display: grid;
  min-height: 31px;
  padding: 5px 3px;
  grid-template-columns: 27px 1fr 1fr;
  align-items: center;
  gap: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  font-size: 12px;
}

.chess-moves-panel li span { color: var(--muted); }
.chess-moves-panel li b { overflow: hidden; text-overflow: ellipsis; }
.chess-moves-panel li.empty { display: block; padding: 14px 3px; color: var(--muted); }

.chess-resign-button {
  width: 100%;
  min-height: 41px;
  margin-top: auto;
}

.promotion-dialog .promotion-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.promotion-options button {
  display: grid;
  min-height: 83px;
  padding: 7px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #f4e8cf;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 38px;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.promotion-options button:hover { border-color: var(--green); background: rgba(64, 232, 169, 0.09); }
.promotion-options button span { color: var(--muted); font-family: var(--font-body); font-size: 9px; font-weight: 850; }
.promotion-dialog > .text-button { margin-top: 18px; }

@media (max-width: 760px) {
  .arena.chess-arena {
    padding: 10px;
  }

  .chess-main {
    grid-template-columns: 1fr;
  }

  .chess-side-panel {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  .chess-moves-panel {
    grid-column: 1 / -1;
    order: 3;
  }

  .chess-moves-panel ol {
    max-height: 126px;
  }

  .chess-resign-button {
    width: auto;
    margin: 0;
  }
}

@media (max-width: 560px) {
  .arena.chess-arena {
    min-height: 0;
    margin-inline: -5px;
    padding: 6px;
    border-radius: 14px;
  }

  .chess-game {
    gap: 7px;
  }

  .chess-player-strip {
    min-height: 62px;
    padding: 6px 8px;
    grid-template-columns: 34px 1fr auto;
    gap: 7px;
    border-radius: 10px;
  }

  .chess-player-piece {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 24px;
  }

  .chess-captured-piece {
    width: 12px;
    flex-basis: 12px;
    font-size: 16px;
  }

  .chess-player-strip time {
    min-width: 82px;
    padding: 6px 7px;
    border-radius: 8px;
    font-size: 24px;
  }

  .chess-board {
    width: 100%;
    border-width: 3px;
  }

  .chess-piece {
    font-size: clamp(30px, 11vw, 45px);
  }

  .chess-side-panel {
    padding: 9px;
    gap: 8px;
  }

  .chess-status {
    padding: 9px;
    font-size: 12px;
  }

  .chess-moves-panel {
    display: none;
  }

  .chess-resign-button {
    min-height: 37px;
    padding: 8px 12px;
    font-size: 11px;
  }

  .promotion-dialog {
    padding: 25px 18px;
  }
}
