:root {
  color-scheme: dark;
  --bg: #081019;
  --bg-soft: #101b28;
  --panel: rgba(8, 15, 25, 0.86);
  --panel-strong: rgba(12, 21, 34, 0.96);
  --panel-border: rgba(130, 185, 255, 0.16);
  --text: #f6f7fb;
  --muted: #93a6bd;
  --accent: #ffd166;
  --accent-strong: #ff9e3d;
  --cyan: #7ad9ff;
  --trail: #ff4d5a;
  --wall: #d9e5f2;
  --obstacle: #223244;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(122, 217, 255, 0.15), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 209, 102, 0.14), transparent 22%),
    linear-gradient(180deg, #0d1622 0%, #071018 55%, #050b12 100%);
}

.page-shell {
  width: min(1480px, calc(100vw - 24px));
  margin: 10px auto 18px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  margin-bottom: 12px;
  border: 1px solid rgba(130, 185, 255, 0.16);
  border-radius: 26px;
  background:
    radial-gradient(circle at left center, rgba(72, 221, 255, 0.06), transparent 28%),
    linear-gradient(90deg, rgba(16, 31, 43, 0.98), rgba(15, 23, 35, 0.95) 56%, rgba(19, 21, 34, 0.94)),
    rgba(10, 18, 28, 0.9);
  box-shadow: var(--shadow);
}

.topbar h1,
.panel h2 {
  margin: 0;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.logo-mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 4px;
  border-radius: 14px;
  background: rgba(6, 13, 22, 0.88);
  border: 1px solid rgba(135, 197, 255, 0.12);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.2);
}

.logo-mark-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1 {
  font-size: clamp(1.85rem, 3vw, 2.6rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
  font-weight: 900;
  text-wrap: balance;
}

.feedback-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(130, 185, 255, 0.18);
  background: rgba(122, 217, 255, 0.08);
  color: #dff7ff;
  font-weight: 800;
  text-decoration: none;
  opacity: 0.95;
  line-height: 1;
}

.brand-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
}

.feedback-link:hover,
.feedback-link:focus-visible {
  color: #ffffff;
  background: rgba(122, 217, 255, 0.14);
  border-color: rgba(130, 185, 255, 0.3);
  text-decoration: none;
}

.eyebrow,
.meta-label,
.pill span {
  display: block;
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  color: var(--muted);
}

.headline-stats {
  display: none;
  flex-wrap: wrap;
  justify-content: end;
  gap: 10px;
}

.fullscreen-stats {
  justify-content: flex-start;
  gap: 12px;
  flex: 1 1 auto;
}

.pill {
  min-width: 108px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pill strong {
  display: block;
  font-size: 1rem;
}

.pill.accent {
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.18), rgba(255, 77, 90, 0.12));
  border-color: rgba(255, 209, 102, 0.28);
}

.layout {
  display: grid;
  grid-template-columns: clamp(340px, 24vw, 380px) minmax(0, 1fr) 290px;
  gap: 12px;
}

.panel {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid var(--panel-border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 35%),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(122, 217, 255, 0.04), transparent 24%);
  pointer-events: none;
}

.control-panel,
.board-panel {
  padding: 22px;
}

.control-panel {
  padding: 20px;
}

.control-panel .panel-copy {
  display: grid;
  gap: 0;
}

.panel-copy h2 {
  margin-top: 0;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
  line-height: 1.1;
}

.lede {
  margin: 12px 0 0;
  color: #d9e6f3;
  line-height: 1.6;
}

.join-form {
  display: grid;
  gap: 12px;
  margin: 20px 0 18px;
}

.control-panel .join-form {
  gap: 14px;
  margin: 18px 0 20px;
}

.control-panel .join-form label span {
  font-size: 1.05rem;
  font-weight: 800;
  color: #eef4fb;
}

.control-panel #name-input {
  min-height: 60px;
  border-radius: 20px;
  padding: 16px 20px;
  font-size: 1rem;
  background: rgba(11, 18, 28, 0.96);
  border-color: rgba(255, 255, 255, 0.1);
}

.control-panel #name-input::placeholder {
  color: #90a0b9;
}

.control-panel #join-button {
  width: fit-content;
  min-width: 182px;
  padding: 16px 24px;
  border-radius: 20px;
  background: linear-gradient(135deg, #67e8f9, #43d6f4);
  color: #07111a;
  box-shadow: 0 16px 30px rgba(67, 214, 244, 0.24);
}

.control-panel #join-button:hover,
.control-panel #join-button:focus-visible {
  background: linear-gradient(135deg, #7ff0ff, #53ddf8);
}

.play-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.play-button::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 10px solid currentColor;
  flex: 0 0 auto;
}

.control-panel #join-button.play-button::before,
#create-room-button.play-button::before {
  border-left-color: #07111a;
}

.mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mode-button,
.secondary-button {
  width: 100%;
  border-radius: 14px;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mode-button.active {
  border-color: rgba(255, 209, 102, 0.7);
  background: rgba(255, 209, 102, 0.16);
  color: var(--accent);
}

.join-form label {
  display: grid;
  gap: 8px;
}

.practice-settings.hidden {
  display: none;
}

.field-feedback {
  margin: -4px 2px 2px;
  font-size: 0.82rem;
  color: #ff8f8f;
}

.field-feedback.success {
  color: #7af0b5;
}

#custom-room-feedback {
  margin-top: 10px;
}

input,
select,
button {
  width: 100%;
  border-radius: 16px;
  padding: 13px 14px;
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(5, 10, 16, 0.85);
  color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(122, 217, 255, 0.8);
  box-shadow: 0 0 0 4px rgba(122, 217, 255, 0.12);
}

input:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

textarea {
  width: 100%;
  min-height: 180px;
  border-radius: 18px;
  padding: 13px 14px;
  font: inherit;
  resize: vertical;
}

button {
  border: 0;
  font-weight: 800;
  color: #091018;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 18px 32px rgba(255, 158, 61, 0.24);
}

.secondary-button {
  min-width: 132px;
  color: var(--text);
  border: 1px solid rgba(130, 185, 255, 0.18);
  background: rgba(122, 217, 255, 0.08);
  box-shadow: none;
}

#create-room-button {
  background: linear-gradient(135deg, #67e8f9, #43d6f4);
  color: #07111a;
  box-shadow: 0 16px 30px rgba(67, 214, 244, 0.24);
}

#create-room-button:hover,
#create-room-button:focus-visible {
  background: linear-gradient(135deg, #7ff0ff, #53ddf8);
}

.info-card {
  margin-top: 16px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.info-card.subtle {
  background: rgba(122, 217, 255, 0.05);
}

.multiplayer-browser {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.session-browser-section {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.browser-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 14px;
}

.browser-section-heading h2 {
  margin: 0;
  font-size: 1rem;
}

.browser-updated {
  font-size: 0.8rem;
}

.public-session-list {
  list-style: none;
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.public-session-row,
.public-session-empty {
  display: grid;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(130, 185, 255, 0.12);
  background: rgba(8, 14, 23, 0.62);
}

.public-session-row.current {
  border-color: rgba(255, 209, 102, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.12);
}

.public-session-details {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.public-session-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.public-session-meta {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.public-session-actions,
.session-browser-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
  width: 100%;
}

.public-session-actions .secondary-button,
.session-browser-actions .secondary-button,
.session-browser-actions button {
  width: 100%;
  min-width: 0;
}

.public-session-actions > :only-child,
.session-browser-actions > :only-child {
  grid-column: 1 / -1;
}

.session-browser-form {
  display: grid;
  gap: 12px;
}

.control-panel .panel-copy {
  display: grid;
  gap: 10px;
}

.control-panel .lede {
  margin-top: 0;
  font-size: 1.02rem;
}

.control-panel .info-card {
  margin-top: 14px;
  padding: 16px;
}

.control-panel .browser-section-heading {
  align-items: start;
}

.control-panel .browser-updated {
  text-align: right;
}

.current-session-tag {
  color: #ffd166;
  border-color: rgba(255, 209, 102, 0.38);
  background: rgba(255, 209, 102, 0.08);
}

button:disabled {
  cursor: default;
  opacity: 0.56;
  box-shadow: none;
}

.feedback-shell {
  width: min(920px, calc(100vw - 24px));
}

.feedback-layout {
  display: block;
}

.feedback-panel {
  padding: 28px;
}

.guide-shell {
  width: min(1120px, calc(100vw - 24px));
}

.guide-layout {
  display: grid;
  gap: 16px;
}

.guide-panel {
  padding: 28px;
}

.guide-hero h2,
.guide-section-heading h2,
.guide-copy h3 {
  margin: 0;
}

.guide-section-heading {
  margin-bottom: 18px;
}

.guide-grid {
  display: grid;
  gap: 14px;
}

.basics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.power-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.guide-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 60%),
    rgba(255, 255, 255, 0.035);
}

.guide-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.guide-copy p {
  margin: 0;
  color: #d7e2ee;
  line-height: 1.55;
}

.guide-visual,
.guide-icon {
  display: block;
}

.guide-visual {
  position: relative;
  min-height: 72px;
  border-radius: 18px;
  border: 1px solid rgba(130, 185, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 60%),
    rgba(5, 11, 18, 0.7);
  overflow: hidden;
}

.guide-icon {
  width: 54px;
  height: 54px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(130, 185, 255, 0.14);
  background: rgba(5, 11, 18, 0.76);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
}

.keys-visual {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(2, 44px);
  justify-content: center;
  align-content: center;
  gap: 6px;
}

.keycap {
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid rgba(130, 185, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #eef6ff;
  font-size: 1.05rem;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.keycap.up {
  grid-column: 2;
  grid-row: 1;
}

.keycap.left {
  grid-column: 1;
  grid-row: 2;
}

.keycap.down {
  grid-column: 2;
  grid-row: 2;
}

.keycap.right {
  grid-column: 3;
  grid-row: 2;
}

.motion-visual,
.danger-visual,
.win-visual {
  display: grid;
  place-items: center;
}

.motion-dot,
.winner-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 999px;
}

.motion-dot {
  left: 20px;
  top: 29px;
  background: #7ad9ff;
  box-shadow: 0 0 16px rgba(122, 217, 255, 0.65);
}

.motion-trail {
  position: absolute;
  left: 32px;
  top: 34px;
  width: 90px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(44, 117, 255, 0.85), rgba(44, 117, 255, 0.08));
}

.motion-arrow {
  position: absolute;
  right: 22px;
  top: 18px;
  color: var(--accent);
  font-size: 1.5rem;
  font-weight: 900;
}

.danger-wall,
.danger-obstacle,
.danger-trail {
  position: absolute;
  border-radius: 10px;
}

.danger-wall {
  left: 24px;
  top: 16px;
  width: 14px;
  height: 40px;
  background: var(--wall);
}

.danger-obstacle {
  left: 54px;
  top: 24px;
  width: 28px;
  height: 24px;
  background: #36506a;
}

.danger-trail {
  right: 22px;
  top: 33px;
  width: 76px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #13c86f, #13c86f 28%, rgba(19, 200, 111, 0.2));
  box-shadow: 0 0 14px rgba(19, 200, 111, 0.32);
}

.winner-dot {
  left: 50%;
  top: 50%;
  transform: translate(-50%, -10%);
  width: 18px;
  height: 18px;
  background: #ffd166;
  box-shadow: 0 0 18px rgba(255, 209, 102, 0.55);
}

.winner-crown {
  position: absolute;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  color: #ffd166;
  font-size: 1.35rem;
  text-shadow: 0 0 16px rgba(255, 209, 102, 0.4);
}

.feedback-status {
  margin: 6px 2px 0;
  font-weight: 700;
}

.feedback-status.success {
  color: #7af0b5;
}

.feedback-status.error {
  color: #ff8f8f;
}

.info-card p:last-child {
  margin-bottom: 0;
  line-height: 1.6;
  color: #dce7f2;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 12px;
  align-items: center;
}

.control-grid span {
  color: var(--muted);
}

.maze-challenge-card {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.maze-challenge-card strong {
  font-size: 1.15rem;
}

.maze-challenge-copy {
  margin: 0;
  color: #d7e4f0;
  line-height: 1.55;
}

.maze-button {
  width: fit-content;
  min-width: 220px;
  padding: 14px 22px;
  border-radius: 18px;
  background: linear-gradient(135deg, #67e8f9, #43d6f4);
  color: #07111a;
  border-color: rgba(103, 232, 249, 0.26);
  box-shadow: 0 16px 30px rgba(67, 214, 244, 0.24);
}

.maze-button:hover,
.maze-button:focus-visible {
  background: linear-gradient(135deg, #7ff0ff, #53ddf8);
}

.maze-button::before {
  border-left-color: #07111a;
}

.arena-panel {
  overflow: visible;
  padding: 12px;
  display: grid;
  gap: 10px;
  align-content: start;
  background:
    radial-gradient(circle at top center, rgba(122, 217, 255, 0.08), transparent 32%),
      linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 35%),
      var(--panel-strong);
}

.home-showcase {
  display: grid;
  gap: 14px;
}

.game-shell {
  display: none;
  gap: 10px;
}

.showcase-card {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(130, 185, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 42%),
    rgba(10, 17, 27, 0.84);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.28);
}

.showcase-hero-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.94fr);
  gap: 18px;
  padding: 22px;
}

.showcase-copy,
.showcase-section-heading {
  display: grid;
  align-content: start;
  gap: 10px;
}

.showcase-copy h2,
.showcase-section-heading h2 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.showcase-lede {
  margin: 0;
  max-width: 36ch;
  color: #d7e4f0;
  font-size: 1.04rem;
  line-height: 1.6;
}

.showcase-actions {
  display: grid;
  gap: 14px;
  margin-top: 6px;
}

.showcase-play-button {
  width: fit-content;
  min-width: 166px;
  padding: 16px 24px;
  border-radius: 20px;
  background: linear-gradient(135deg, #67e8f9, #43d6f4);
  color: #07111a;
  box-shadow: 0 18px 36px rgba(67, 214, 244, 0.24);
}

.showcase-play-button:hover,
.showcase-play-button:focus-visible {
  background: linear-gradient(135deg, #7ff0ff, #53ddf8);
}

.showcase-play-button.play-button::before {
  border-left-color: #07111a;
}

.showcase-tags {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 10px;
  align-items: start;
}

.showcase-tag {
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #d9e6f3;
  font-size: 0.88rem;
}

.showcase-tag-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  background: linear-gradient(135deg, #67e8f9, #43d6f4);
  border-color: rgba(103, 232, 249, 0.4);
  color: #07111a;
  box-shadow: 0 12px 24px rgba(67, 214, 244, 0.18);
}

.showcase-tag-button:hover,
.showcase-tag-button:focus-visible {
  background: linear-gradient(135deg, #7ff0ff, #53ddf8);
  border-color: rgba(103, 232, 249, 0.5);
  color: #07111a;
}

.showcase-art {
  position: relative;
  min-height: 300px;
  border-radius: 24px;
  border: 1px solid rgba(130, 185, 255, 0.12);
  background:
    radial-gradient(circle at 22% 78%, rgba(64, 226, 184, 0.12), transparent 28%),
    radial-gradient(circle at 78% 18%, rgba(232, 121, 249, 0.12), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 35%),
    #050b12;
}

.showcase-grid {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18) 1px, transparent 1px);
  background-size: 26px 26px;
}

.showcase-trail {
  position: absolute;
  filter: drop-shadow(0 0 14px currentColor);
}

.showcase-trail::before,
.showcase-trail::after {
  content: "";
  position: absolute;
  background: currentColor;
  border-radius: 999px;
}

.trail-cyan {
  color: #67e8f9;
  left: 13%;
  top: 16%;
  width: 34%;
  height: 30%;
}

.trail-cyan::before {
  left: 0;
  top: 0;
  width: 78%;
  height: 3px;
}

.trail-cyan::after {
  right: 22%;
  top: 0;
  width: 3px;
  height: 78%;
}

.trail-magenta {
  color: #f472b6;
  right: 16%;
  top: 19%;
  width: 22%;
  height: 24%;
}

.trail-magenta::before {
  right: 0;
  top: 0;
  width: 3px;
  height: 78%;
}

.trail-magenta::after {
  left: 0;
  bottom: 22%;
  width: 100%;
  height: 3px;
}

.trail-green {
  color: #4ade80;
  left: 28%;
  bottom: 16%;
  width: 40%;
  height: 22%;
}

.trail-green::before {
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
}

.trail-green::after {
  left: 0;
  bottom: 0;
  width: 3px;
  height: 72%;
}

.showcase-power-pill {
  position: absolute;
  right: 18%;
  top: 34%;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 209, 102, 0.38);
  background: rgba(255, 209, 102, 0.12);
  color: #ffecb0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.showcase-callout {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(130, 185, 255, 0.12);
  background: rgba(5, 10, 18, 0.7);
  color: #e8f0f8;
  backdrop-filter: blur(14px);
}

.showcase-guide-card {
  padding: 22px;
  display: grid;
  gap: 18px;
}

.showcase-power-card {
  padding: 22px;
  display: grid;
  gap: 18px;
}

.howto-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.howto-item {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.howto-visual {
  position: relative;
  min-height: 82px;
  border-radius: 18px;
  border: 1px solid rgba(130, 185, 255, 0.14);
  background: rgba(10, 16, 25, 0.92);
  display: grid;
  place-items: center;
  color: #eef4fb;
}

.howto-copy {
  display: grid;
  align-content: center;
  gap: 6px;
}

.howto-copy strong {
  font-size: 1rem;
}

.howto-copy p {
  margin: 0;
  color: #d6e4f0;
  line-height: 1.5;
}

.keyboard-visual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.keyboard-visual > span,
.keyboard-visual div span {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1px solid rgba(122, 217, 255, 0.26);
  background: rgba(122, 217, 255, 0.08);
  font-size: 0.82rem;
  font-weight: 700;
}

.keyboard-visual div {
  display: flex;
  gap: 4px;
}

.motion-dot {
  position: absolute;
  left: 18px;
  top: 34px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #67e8f9;
  box-shadow: 0 0 14px rgba(103, 232, 249, 0.85);
}

.motion-line {
  position: absolute;
  left: 28px;
  top: 38px;
  width: 34px;
  height: 3px;
  border-radius: 999px;
  background: #67e8f9;
  box-shadow: 0 0 12px rgba(103, 232, 249, 0.7);
}

.motion-line.short {
  top: 48px;
  width: 22px;
  opacity: 0.45;
}

.danger-wall,
.danger-trail {
  position: absolute;
  border-radius: 999px;
}

.danger-wall {
  left: 16px;
  top: 18px;
  width: 8px;
  height: 46px;
  background: #e6edf7;
}

.danger-trail {
  right: 12px;
  bottom: 18px;
  width: 40px;
  height: 3px;
  background: #fb7185;
  box-shadow: 0 0 10px rgba(251, 113, 133, 0.7);
}

.danger-x {
  position: absolute;
  right: 17px;
  top: 16px;
  color: #ffb4b4;
  font-size: 1.45rem;
  font-weight: 700;
}

.crown-visual {
  overflow: hidden;
}

.crown-icon {
  position: relative;
  z-index: 1;
  color: #ffd166;
  font-size: 1.35rem;
}

.crown-ring {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(255, 209, 102, 0.4);
  background: radial-gradient(circle, rgba(255, 209, 102, 0.18), transparent 68%);
}

.arena-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 8px 0;
  align-items: center;
}

.arena-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.arena-actions .secondary-button {
  width: auto;
  min-width: 0;
  padding: 11px 18px;
}

.canvas-frame {
  position: relative;
  overflow: visible;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 10px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent),
    linear-gradient(135deg, rgba(8, 14, 23, 0.98), rgba(10, 17, 27, 0.96));
  border: 1px solid rgba(130, 185, 255, 0.12);
}

canvas {
  display: block;
  width: min(100%, 100%);
  height: auto;
  border-radius: 18px;
  background: #060c13;
}

.spawn-labels {
  position: absolute;
  inset: 10px;
  z-index: 5;
  pointer-events: none;
}

.spawn-label {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  max-width: 150px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--label-color) 48%, rgba(255, 255, 255, 0.12));
  background: rgba(5, 10, 16, 0.92);
  color: var(--label-color);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.1;
  white-space: nowrap;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  text-shadow: none;
}

.spawn-label.self {
  background: rgba(18, 15, 7, 0.96);
}

.spawn-label[data-side="left"] {
  transform: translate(-100%, -50%);
  text-align: center;
}

.spawn-label[data-side="right"] {
  transform: translate(0, -50%);
  text-align: center;
}

.spawn-label[data-side="top"] {
  transform: translate(-50%, -100%);
  text-align: center;
}

.spawn-label[data-side="bottom"] {
  transform: translate(-50%, 0);
  text-align: center;
}

.arena-overlay {
  position: absolute;
  inset: 12px;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-size: clamp(1.8rem, 3vw, 3.5rem);
  font-weight: 900;
  letter-spacing: 0.04em;
  color: rgba(246, 247, 251, 0.98);
  text-shadow: 0 12px 42px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  white-space: pre-line;
}

.session-overlay {
  position: absolute;
  top: 18px;
  right: 18px;
  width: min(280px, calc(100% - 36px));
  z-index: 3;
  pointer-events: none;
}

.session-overlay.practice-interactive,
.session-overlay.practice-interactive .session-card,
.session-overlay.practice-interactive .practice-overlay-controls,
.session-overlay.practice-interactive .practice-overlay-controls * {
  pointer-events: auto;
}

.players-overlay.multiplayer-interactive,
.players-overlay.multiplayer-interactive .players-card,
.players-overlay.multiplayer-interactive #multiplayer-name-controls,
.players-overlay.multiplayer-interactive #multiplayer-name-controls * {
  pointer-events: auto;
}

.players-overlay {
  position: absolute;
  left: 18px;
  bottom: 18px;
  width: min(280px, calc(100% - 36px));
  z-index: 3;
  pointer-events: none;
}

.overlay-count-badge {
  width: fit-content;
  margin: 12px auto 0;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(130, 185, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.session-card {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(130, 185, 255, 0.18);
  background: rgba(6, 12, 20, 0.72);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28);
}

.players-card {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(130, 185, 255, 0.18);
  background: rgba(6, 12, 20, 0.72);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28);
}

#multiplayer-name-controls {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.practice-overlay-controls {
  display: grid;
  gap: 12px;
}

.practice-overlay-field {
  display: grid;
  gap: 8px;
}

.practice-overlay-field span {
  color: #dce7f2;
  font-size: 0.9rem;
  font-weight: 800;
}

.practice-overlay-field input,
.practice-overlay-field select {
  min-height: 46px;
  border-radius: 16px;
  background: rgba(5, 10, 16, 0.9);
}

.practice-overlay-button {
  width: 100%;
  justify-content: center;
  border-radius: 16px;
  padding: 12px 16px;
}

.practice-overlay-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.practice-leaderboard-list li {
  align-items: center;
}

.practice-rank {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: #eaf3fd;
  font-size: 0.82rem;
  font-weight: 900;
  flex: 0 0 auto;
}

.practice-rank.top {
  border-color: rgba(255, 209, 102, 0.28);
  background: rgba(255, 209, 102, 0.12);
  color: #ffe39b;
}

.practice-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.practice-entry-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.practice-entry-copy strong {
  min-width: 0;
}

.practice-entry-copy span {
  color: var(--muted);
  font-size: 0.82rem;
}

.legend-overlay {
  position: absolute;
  left: 18px;
  bottom: 16px;
  width: min(286px, calc(100% - 36px));
  z-index: 3;
  pointer-events: none;
}

.legend-card {
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(130, 185, 255, 0.18);
  background: rgba(6, 12, 20, 0.72);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.28);
}

.session-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.leaderboard-meta {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.leaderboard-meta {
  margin-bottom: 14px;
}

.session-section {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.session-section-title {
  color: #ffd166;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.session-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.session-list-empty {
  justify-content: flex-start !important;
}

.legend-panel {
  padding: 2px 2px 4px;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.legend-grid-overlay {
  grid-template-columns: 1fr;
  gap: 7px;
}

.legend-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: #dbe6f0;
}

.legend-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.legend-copy strong {
  display: block;
  line-height: 1.2;
  font-size: 0.95rem;
}

.legend-copy span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.hidden {
  display: none !important;
}

.legend-swatch {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  margin-top: 2px;
}

.legend-grid-overlay .legend-item {
  gap: 9px;
  padding: 8px 10px;
  border-radius: 15px;
}

.legend-grid-overlay .legend-copy strong {
  font-size: 0.9rem;
}

.legend-grid-overlay .legend-copy span {
  font-size: 0.76rem;
  line-height: 1.25;
}

.legend-grid-overlay .legend-swatch {
  width: 18px;
  height: 18px;
}

.legend-swatch.power-speed {
  background:
    url("/power-speed.svg") center / contain no-repeat,
    linear-gradient(135deg, #ffe768, #ffb400);
  box-shadow: 0 0 12px rgba(255, 196, 0, 0.5);
}

.legend-swatch.power-phase {
  background:
    url("/power-phase.svg") center / contain no-repeat,
    linear-gradient(135deg, #8ad9ff, #2f7cff);
  box-shadow: 0 0 12px rgba(65, 150, 255, 0.48);
}

.legend-swatch.power-eraser {
  background:
    url("/power-eraser.svg") center / contain no-repeat,
    linear-gradient(135deg, #ffb56b, #ff5e4d);
  box-shadow: 0 0 12px rgba(255, 122, 77, 0.52);
}

.legend-swatch.power-portal {
  background:
    url("/power-portal.svg") center / contain no-repeat,
    linear-gradient(135deg, #79f0ff, #4f7dff);
  box-shadow: 0 0 12px rgba(79, 125, 255, 0.52);
}

.legend-swatch.power-gap {
  background:
    url("/power-gap.svg") center / contain no-repeat,
    linear-gradient(135deg, #88ffca, #11c27a);
  box-shadow: 0 0 12px rgba(17, 194, 122, 0.48);
}

.legend-swatch.power-wipe {
  background:
    url("/power-wipe.svg") center / contain no-repeat,
    linear-gradient(135deg, #ff8872, #ff3d3d);
  box-shadow: 0 0 12px rgba(255, 70, 70, 0.52);
}

.side-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 14px;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.list li.list-section-title {
  padding: 4px 2px 0;
  border: 0;
  background: transparent;
  color: #ffd166;
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.list li.list-empty {
  justify-content: flex-start;
}

.compact li {
  align-items: start;
  flex-direction: column;
}

.compact li.session-leader-row {
  align-items: center;
  flex-direction: row;
}

.session-row-label,
.session-row-value {
  display: inline-flex;
  align-items: center;
}

.session-row-label {
  min-width: 0;
}

.session-row-value {
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}

.global-leader-row {
  align-items: stretch !important;
  flex-direction: column;
  gap: 8px !important;
}

.global-leader-main,
.global-leader-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.global-leader-main strong,
.global-leader-meta span {
  min-width: 0;
}

.global-leader-main .muted,
.global-leader-meta .muted {
  white-space: nowrap;
}

.global-leader-meta {
  font-size: 0.84rem;
}

.leaderboard-loading {
  pointer-events: none;
}

.skeleton-line {
  display: inline-flex;
  height: 0.86rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
  background-size: 200% 100%;
  animation: leaderboard-shimmer 1.3s linear infinite;
}

.skeleton-name {
  width: 46%;
}

.skeleton-short {
  width: 26%;
}

.skeleton-medium {
  width: 34%;
}

@keyframes leaderboard-shimmer {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

.player-chip {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
}

.player-text {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.player-name-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.player-effects {
  display: grid;
  gap: 4px;
}

.effect-tag {
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
}

.effect-tag.speed {
  color: #ffe768;
  border-color: rgba(255, 231, 104, 0.38);
  background: rgba(255, 196, 0, 0.12);
}

.effect-tag.phase {
  color: #8ad9ff;
  border-color: rgba(77, 164, 255, 0.38);
  background: rgba(41, 108, 255, 0.13);
}

.effect-tag.trailGap {
  color: #8fffd4;
  border-color: rgba(76, 255, 180, 0.38);
  background: rgba(17, 194, 122, 0.14);
}

.players-session-list li {
  align-items: flex-start;
}

.players-session-list .status-tag {
  text-align: right;
  white-space: nowrap;
}

.swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 0 10px currentColor;
}

.status-tag {
  color: var(--muted);
  font-size: 0.82rem;
}

.self {
  color: var(--accent);
}

.muted {
  color: var(--muted);
}

@media (max-width: 1320px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .canvas-frame {
    min-height: 0;
  }

  .side-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

body.fullscreen-mode .page-shell {
  width: min(100vw - 12px, 100%);
  margin: 6px auto;
}

body.fullscreen-mode .layout {
  grid-template-columns: 1fr;
}

body.fullscreen-mode .topbar {
  display: none;
}

body.fullscreen-mode .fullscreen-stats {
  display: flex;
}

body.fullscreen-mode .control-panel,
body.fullscreen-mode .side-stack {
  display: none;
}

body.fullscreen-mode .home-showcase {
  display: none;
}

body.fullscreen-mode .game-shell {
  display: grid;
}

body.fullscreen-mode .arena-panel {
  min-height: calc(100vh - 12px);
  padding: 8px;
  gap: 8px;
}

body.fullscreen-mode .arena-topbar {
  padding: 0 4px;
  gap: 12px;
}

body.fullscreen-mode .canvas-frame {
  padding: 6px;
}

body.fullscreen-mode .session-overlay {
  left: 18px;
  right: auto;
  top: 18px;
}

body.fullscreen-mode .legend-panel {
  display: none;
}

body.fullscreen-mode .players-overlay {
  right: 18px;
  left: auto;
  top: 18px;
  bottom: auto;
}

body.fullscreen-mode .session-overlay.hidden {
  display: none !important;
}

body.fullscreen-mode .players-overlay.hidden {
  display: none !important;
}

@media (max-width: 860px) {
  .page-shell {
    width: min(100vw - 18px, 100%);
    margin: 9px auto 18px;
  }

  .topbar,
  .arena-topbar,
  .headline-stats,
  .side-stack {
    display: grid;
  }

  .fullscreen-stats {
    display: none;
  }

  .headline-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .arena-actions {
    width: 100%;
    justify-content: stretch;
  }

  .arena-actions .secondary-button {
    flex: 1 1 160px;
    width: auto;
  }

  .panel,
  .control-panel,
  .board-panel,
  .guide-panel,
  .feedback-panel {
    padding: 16px;
  }

  .canvas-frame {
    padding: 10px;
  }

  .showcase-hero-card,
  .howto-grid {
    grid-template-columns: 1fr;
  }

  .brand-links {
    gap: 10px;
  }

  .brand-block {
    width: 100%;
  }

  .topbar {
    align-items: flex-start;
  }

  .basics-grid,
  .power-grid {
    grid-template-columns: 1fr;
  }

  .legend-grid {
    grid-template-columns: 1fr;
  }

  .public-session-row,
  .public-session-empty,
  .browser-section-heading {
    align-items: flex-start;
  }

  .public-session-row,
  .public-session-empty {
    flex-direction: column;
  }

  .public-session-actions,
  .session-browser-actions {
    width: 100%;
  }

  .public-session-actions .secondary-button,
  .session-browser-actions .secondary-button,
  .session-browser-actions button {
    flex: 1 1 150px;
  }
}
