* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
  --bg: #0b0f16;
  --bg-soft: #06080c;
  --panel: rgba(10, 10, 12, 0.7);
  --panel-strong: rgba(12, 12, 16, 0.9);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f5f7fb;
  --muted: #99a0ae;
  --blue: #4ea1ff;
  --green: #31d06d;
  --purple: #a970ff;
  --red: #ef4444;
  --shadow-blue: rgba(78, 161, 255, 0.24);
  --shadow-green: rgba(49, 208, 109, 0.22);
  --shadow-purple: rgba(169, 112, 255, 0.24);
  --font: 'Inter', sans-serif;
  --font-heavy: 'Montserrat', sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0b0f16, #06080c);
  color: var(--text);
  font-family: var(--font);
  overflow-x: hidden;
}

main {
  flex: 1 0 auto;
}

.theme-body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, transparent 0%, rgba(6, 8, 12, 0.2) 100%);
  pointer-events: none;
  z-index: -1;
}

.background-wrapper {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 50%, rgba(78, 161, 255, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(169, 112, 255, 0.08), transparent 25%),
    linear-gradient(180deg, #0b0f16, #06080c);
}

.orb {
  display: none;
}

.orb-1 {
  top: -12%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: rgba(32, 60, 150, 0.18);
}

.orb-2 {
  right: -10%;
  bottom: -12%;
  width: 54vw;
  height: 54vw;
  background: rgba(20, 20, 32, 0.85);
  animation-delay: -5s;
}

.orb-3 {
  top: 38%;
  left: 38%;
  width: 36vw;
  height: 36vw;
  background: rgba(58, 58, 74, 0.16);
  animation-delay: -9s;
}

.grid-glow {
  display: none;
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(24px, 36px) scale(1.08); }
  100% { transform: translate(-20px, -18px) scale(0.95); }
}

.fade-in { animation: fadeIn 0.8s ease forwards; }
.slide-down { animation: slideDown 0.6s ease forwards; }
.slide-up {
  opacity: 0;
  transform: translateY(20px);
  animation: slideUp 0.7s ease forwards;
  animation-delay: var(--delay, 0s);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }

.glass-panel,
.panel,
.panel-box {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

.lift-card {
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

.lift-card:hover,
.panel:hover,
.panel-box:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
}

.panel-topline {
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  border-radius: 999px 999px 0 0;
}

.blue-line { background: linear-gradient(90deg, rgba(78,161,255,0), rgba(78,161,255,1), rgba(78,161,255,0)); }
.green-line { background: linear-gradient(90deg, rgba(49,208,109,0), rgba(49,208,109,1), rgba(49,208,109,0)); }
.purple-line { background: linear-gradient(90deg, rgba(169,112,255,0), rgba(169,112,255,1), rgba(169,112,255,0)); }

/* AUTH */
.auth-page-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px;
}

.auth-shell {
  width: 100%;
  max-width: 1240px;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 28px;
  align-items: stretch;
}

.auth-showcase,
.auth-panel {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
}

.auth-showcase {
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 720px;
}

.auth-badge,
.hero-status-pill,
.tiny-pill,
.topbar-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(78, 161, 255, 0.22);
  background: rgba(78, 161, 255, 0.1);
  color: var(--blue);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.auth-showcase-title,
.auth-title,
.dashboard-hero-card h1,
.panel-card-head h2,
.brand-name {
  font-family: var(--font-heavy);
  letter-spacing: 0.02em;
}

.auth-showcase-title {
  font-size: clamp(2.5rem, 6vw, 4.6rem);
  line-height: 0.98;
  margin: 22px 0 14px;
  text-transform: uppercase;
}

.auth-showcase-copy,
.auth-subtitle,
.dashboard-hero-card p,
.dashboard-note-item p,
.module-card p,
.profile-subtext {
  color: var(--muted);
  line-height: 1.7;
}

.auth-rule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.auth-rule-card,
.hero-stat-card,
.mini-stat-box,
.auth-password-box,
.dashboard-note-item,
.news-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.auth-rule-card {
  padding: 18px;
}

.auth-rule-card span,
.hero-stat-card span,
.mini-stat-box span,
.auth-password-title,
.panel-kicker,
.brand-kicker,
.profile-rank,
.profile-overline,
.game-stage-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.auth-rule-card strong,
.hero-stat-card strong,
.mini-stat-box strong,
.panel-card-head h2,
.module-card strong,
.dashboard-note-item strong,
.profile-info .player-name {
  display: block;
  margin-top: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.auth-password-box {
  padding: 24px;
}

.auth-password-box ul {
  margin: 16px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.auth-panel {
  padding: 34px;
}

.auth-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.auth-tab {
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
}

.auth-tab.active,
.auth-tab:hover {
  color: var(--text);
  border-color: rgba(78, 161, 255, 0.3);
  background: rgba(78, 161, 255, 0.1);
}

.auth-title {
  font-size: 2rem;
  margin: 0 0 8px;
}

.auth-subtitle {
  margin: 0 0 26px;
  font-size: 14px;
}

.auth-form { display: grid; gap: 18px; }
.input-group { display: grid; gap: 8px; }
.input-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.auth-input {
  width: 100%;
  padding: 15px 16px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-input:focus {
  outline: none;
  border-color: rgba(78, 161, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(78, 161, 255, 0.12);
  background: rgba(0, 0, 0, 0.38);
}

.auth-code-input { text-transform: uppercase; letter-spacing: 0.08em; }
.muted-inline { color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; }

.auth-btn,
.nexus-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  border-radius: 14px;
  padding: 15px 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.auth-btn {
  width: 100%;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 12px 28px var(--shadow-blue);
}

.auth-btn:hover,
.nexus-btn:hover {
  transform: translateY(-2px);
}

.auth-btn-green { background: var(--green); box-shadow: 0 12px 28px var(--shadow-green); }
.auth-btn-purple { background: var(--purple); box-shadow: 0 12px 28px var(--shadow-purple); }

.auth-alert {
  padding: 16px 18px;
  border-radius: 16px;
  margin-bottom: 20px;
  border: 1px solid;
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.auth-alert-error {
  background: rgba(239, 68, 68, 0.09);
  border-color: rgba(239, 68, 68, 0.22);
  color: #ffb7b7;
}

.auth-alert-success {
  background: rgba(49, 208, 109, 0.1);
  border-color: rgba(49, 208, 109, 0.24);
  color: #c8ffd9;
}

.reset-code-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
}

.reset-code-box strong {
  font-size: 1.15rem;
  color: #fff;
  letter-spacing: 0.08em;
}

/* DASHBOARD */
.dashboard-theme-body {
  padding-bottom: 0;
}

.nexus-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 7, 11, 0.72);
  backdrop-filter: blur(16px);
}

.brand-shell,
.profile-identity-card,
.panel-card-head-inline,
.hero-action-row,
.system-item,
.profile-main,
.brand,
.top-nav {
  display: flex;
  align-items: center;
}

.brand-shell { gap: 14px; }
.brand-cube,
.brand-icon {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  box-shadow: 0 0 24px rgba(78, 161, 255, 0.34);
}

.brand-kicker { margin-bottom: 4px; }
.brand-name { font-size: 1.2rem; text-transform: uppercase; }

.nexus-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.nexus-nav a,
.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  border: 1px solid transparent;
}

.nexus-nav a:hover,
.nexus-nav a.active,
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: rgba(255,255,255,0.05);
  border-color: var(--line);
}

.nexus-dashboard-wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 24px 0;
}

.dashboard-hero-card,
.dashboard-card {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
}

.dashboard-hero-card {
  padding: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.7fr);
  gap: 26px;
  margin-bottom: 28px;
}

.dashboard-hero-card h1 {
  margin: 18px 0 14px;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1;
}

.hero-copy-block p { max-width: 720px; }
.hero-action-row { gap: 14px; margin-top: 26px; flex-wrap: wrap; }
.hero-side-stats { display: grid; gap: 14px; }
.hero-stat-card { padding: 18px; }

.nexus-btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 25px var(--shadow-blue);
}

.nexus-btn-secondary {
  color: var(--text);
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
}

.dashboard-main-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 28px;
}

.dashboard-side-stack,
.dashboard-center-stack,
.status-list-clean,
.dashboard-note-list,
.news-feed,
.system-list,
.game-sidebar {
  display: grid;
  gap: 24px;
}

.dashboard-card { padding: 26px; }
.panel-card-head { margin-bottom: 22px; }
.panel-card-head h2 { margin: 8px 0 0; font-size: 1.7rem; }
.panel-card-head-inline { justify-content: space-between; gap: 16px; }
.profile-identity-card { gap: 16px; margin-bottom: 20px; }
.profile-avatar-glow,
.avatar-large,
.avatar-mini {
  background: radial-gradient(circle at 30% 30%, rgba(78,161,255,0.95), rgba(33, 48, 92, 0.25) 70%);
  border: 1px solid rgba(78, 161, 255, 0.22);
}

.profile-avatar-glow,
.avatar-large {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  box-shadow: 0 0 28px rgba(78, 161, 255, 0.22);
}

.profile-rank { margin-bottom: 10px; }
.dashboard-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mini-stat-box { padding: 16px; }
.status-list-clean div,
.controls-list div,
.system-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 14px;
}

.status-list-clean div:last-child,
.controls-list div:last-child,
.system-item:last-child { border-bottom: 0; }
.status-list-clean span,
.controls-list span,
.sys-name { color: var(--muted); }
.good-text,
.sys-state.good { color: var(--green); }

.module-grid,
.features-row,
.stats-grid {
  display: grid;
  gap: 18px;
}

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

.module-card {
  text-decoration: none;
  color: inherit;
  padding: 22px;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}

.module-card:hover { transform: translateY(-4px); border-color: var(--line-strong); }
.module-card span { display: inline-block; margin-bottom: 16px; font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: 0.14em; }
.module-card p { margin: 10px 0 0; }
.module-card-blue:hover { box-shadow: 0 14px 30px rgba(78, 161, 255, 0.16); }
.module-card-green:hover { box-shadow: 0 14px 30px rgba(49, 208, 109, 0.16); }
.module-card-purple:hover { box-shadow: 0 14px 30px rgba(169, 112, 255, 0.16); }
.module-card-red:hover { box-shadow: 0 14px 30px rgba(239, 68, 68, 0.16); }
.dashboard-note-item { padding: 18px; }
.dashboard-note-item p { margin: 10px 0 0; }

/* ORIGINAL/GAME AREA */
.bg-fx {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 50%, rgba(78, 161, 255, 0.08), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(169, 112, 255, 0.08), transparent 25%);
}

.top-nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 12px 28px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 12, 0.72);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand { gap: 12px; font-weight: 800; font-size: 16px; letter-spacing: 0.08em; justify-self: start; white-space: nowrap; }
.nav-links { display: flex; gap: 12px; align-items: center; }
.nav-links-centered { justify-content: center; }

.profile-dropdown {
  position: relative;
}

.profile-dropdown summary {
  list-style: none;
}

.profile-dropdown summary::-webkit-details-marker {
  display: none;
}

.profile-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--muted);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 14px;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
}

.profile-dropdown-trigger:hover,
.profile-dropdown[open] .profile-dropdown-trigger {
  color: var(--text);
  background: rgba(255,255,255,0.05);
  border-color: var(--line);
}

.dropdown-caret {
  font-size: 10px;
  opacity: 0.85;
}

.profile-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  padding: 10px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(14, 18, 28, 0.98), rgba(8, 10, 18, 0.98));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 22px 42px rgba(0,0,0,0.34);
  display: grid;
  gap: 6px;
}

.profile-dropdown-menu a {
  display: block;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  padding: 11px 12px;
  border-radius: 12px;
}

.profile-dropdown-menu a:hover {
  background: rgba(255,255,255,0.06);
}

.auth-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  padding: 10px 18px;
  min-width: 112px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid rgba(78, 161, 255, 0.22);
  background: linear-gradient(180deg, rgba(78, 161, 255, 0.12), rgba(255,255,255,0.04));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
  font-weight: 800;
  font-size: 14px;
  white-space: nowrap;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.auth-logout-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(78, 161, 255, 0.38);
  background: linear-gradient(180deg, rgba(78, 161, 255, 0.18), rgba(255,255,255,0.06));
  box-shadow: 0 14px 28px rgba(0,0,0,0.2);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 300px 1fr 300px;
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px;
  min-height: calc(100vh - 72px);
}

.panel {
  border-radius: 20px;
  padding: 24px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.panel-header h2,
.hero-panel h1,
.feature-card h3,
.game-stage-header h2 {
  margin: 0;
}

.profile-main { gap: 16px; margin-bottom: 32px; }
.player-name { font-size: 18px; font-weight: 700; }
.player-title { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat-box {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value { font-size: 18px; font-weight: 700; }

.hero-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 48px;
}
.hero-content { position: relative; z-index: 2; max-width: 600px; }
.status-badge {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 24px;
}
.hero-panel h1 { font-size: 48px; line-height: 1.1; margin-bottom: 24px; letter-spacing: -0.02em; }
.hero-panel p { font-size: 16px; color: var(--muted); line-height: 1.6; margin: 0 0 32px; }
.action-row { display: flex; gap: 16px; }
.btn {
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}
.btn-primary {
  background: var(--blue);
  color: white;
  border: 1px solid var(--blue);
  box-shadow: 0 4px 14px var(--shadow-blue);
}
.btn-primary:hover { background: #3a8ce8; box-shadow: 0 6px 20px var(--shadow-blue); transform: translateY(-2px); }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-secondary:hover { background: rgba(255,255,255,0.06); border-color: var(--line-strong); }
.hero-graphics {
  position: absolute;
  right: -100px;
  top: 50%;
  transform: translateY(-50%);
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(78,161,255,0.14) 0%, transparent 70%);
  z-index: 1;
}

.status-indicator {
  width: 10px;
  height: 10px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--green);
}
.mt-4 { margin-top: 32px; }
.news-card { padding: 16px; }
.news-date { font-size: 12px; color: var(--blue); margin-bottom: 8px; font-weight: 700; }
.news-text { font-size: 14px; line-height: 1.5; color: var(--muted); }
.features-row { grid-column: 1 / -1; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.feature-card { display: flex; flex-direction: column; gap: 16px; }
.feat-icon { width: 40px; height: 40px; border-radius: 10px; }
.feat-icon.blue { background: rgba(78, 161, 255, 0.1); border: 1px solid var(--blue); }
.feat-icon.green { background: rgba(49, 208, 109, 0.1); border: 1px solid var(--green); }
.feat-icon.purple { background: rgba(169, 112, 255, 0.1); border: 1px solid var(--purple); }
.feature-card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.6; }

.game-body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}

.game-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 280px;
  gap: 20px;
  padding: 18px 24px 24px;
  width: min(1680px, calc(100vw - 24px));
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  box-sizing: border-box;
}

.game-layout-refined {
  flex: 1 0 auto;
  min-height: calc(100vh - 84px - 45px);
  min-height: calc(100dvh - 84px - 45px);
  height: auto;
  align-items: stretch;
}

.game-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

.game-left-sidebar,
.game-right-sidebar {
  justify-content: flex-start;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  text-decoration: none;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.03));
  box-shadow: 0 12px 28px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.05);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.back-btn-compact {
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.back-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(78, 161, 255, 0.3);
  background: linear-gradient(180deg, rgba(78, 161, 255, 0.16), rgba(255,255,255,0.04));
  box-shadow: 0 16px 32px rgba(0,0,0,0.24), 0 0 0 1px rgba(78, 161, 255, 0.08);
}

.back-btn:active {
  transform: translateY(1px) scale(0.985);
}

.panel-box {
  border-radius: 22px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(12, 15, 24, 0.88), rgba(7, 9, 16, 0.92));
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.panel-box h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.72);
}

.panel-box-kicker {
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.66);
  margin-bottom: 10px;
}

.area-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.current-area-line {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 800;
  color: #ffffff;
}

.profile-launch-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.profile-launch-card:hover {
  transform: translateY(-2px);
  border-color: rgba(78, 161, 255, 0.28);
  background: linear-gradient(180deg, rgba(15, 24, 40, 0.96), rgba(8, 11, 18, 0.96));
}

.profile-launch-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-launch-copy strong {
  font-size: 20px;
  line-height: 1.1;
  color: #fff;
}

.profile-launch-copy span:last-child {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.profile-launch-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  background: rgba(78, 161, 255, 0.12);
  border: 1px solid rgba(78, 161, 255, 0.16);
  color: #dceeff;
  font-size: 20px;
  font-weight: 800;
}

.radio-card {
  display: grid;
  gap: 14px;
}

.radio-player-shell {
  display: grid;
  gap: 10px;
}

.radio-now-playing {
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  line-height: 1.4;
  word-break: break-word;
}

.radio-player {
  width: 100%;
  height: 40px;
}

.radio-track-list {
  display: grid;
  gap: 8px;
  max-height: 210px;
  overflow: auto;
  padding-right: 4px;
}

.radio-track {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.07);
  background: rgba(255,255,255,0.03);
  color: rgba(255,255,255,0.84);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.radio-track:hover,
.radio-track.active {
  transform: translateY(-1px);
  background: rgba(78, 161, 255, 0.12);
  border-color: rgba(78, 161, 255, 0.22);
  color: #fff;
}

.radio-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.game-stage {
  display: flex;
  flex-direction: column;
  min-height: min(720px, calc(100dvh - 84px - 45px - 28px));
  padding: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(5,7,12,0.96), rgba(2,3,6,0.98));
}

.refined-stage {
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 28px 64px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.04);
}

.game-canvas-wrap,
.refined-canvas-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 0;
  background: #020307;
  isolation: isolate;
}



.game-clock-hud {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 18;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border: 3px solid #1a1a1a;
  border-radius: 4px;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.35s ease, transform 0.35s ease, box-shadow 0.35s ease;
}

.day-frame {
  background: linear-gradient(to bottom, #98b8b0, #709088);
  box-shadow:
    inset 2px 2px 0px #d8f0e8,
    inset -2px -2px 0px #3d5047,
    0 4px 0px rgba(0, 0, 0, 0.2);
}

.night-frame {
  background: linear-gradient(to bottom, #485078, #283048);
  box-shadow:
    inset 2px 2px 0px #7078a8,
    inset -2px -2px 0px #101028,
    0 4px 0px rgba(0, 0, 0, 0.3);
}

.pixel-grid {
  display: grid;
  grid-template-columns: repeat(12, 2px);
  grid-template-rows: repeat(12, 2px);
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.pixel-grid > span { display: block; width: 2px; height: 2px; }
.pixel-grid .s { background-color: #f8d030; }
.pixel-grid .o { background-color: #f8a020; }
.pixel-grid .m { background-color: #d0d8f8; }
.pixel-grid .x { background-color: transparent; }

.clock-digits {
  margin: 0;
  font-family: 'VT323', monospace;
  font-size: 38px;
  line-height: 1;
  letter-spacing: 2px;
  color: #ffffff;
  text-shadow: 2px 2px 0px #222;
}

.remote-player-layer {
  position: absolute;
  inset: 0;
  z-index: 17;
  pointer-events: none;
}

.remote-player-pill {
  z-index: 17;
  opacity: 1;
}

#playerNameTag {
  z-index: 18;
}

.player-name-pill {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 18;
  transform: translate(-50%, -100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 180px;
  min-height: 24px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-family: 'VT323', monospace;
  font-size: 18px;
  line-height: 1.15;
  letter-spacing: 0.4px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.82);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-optimize-contrast;
}

.dialog-box {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 28px;
  padding: 16px 18px;
  background: rgba(9, 10, 14, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.3);
}

.dialog-box.hidden { display: none; }
.dialog-title { font-weight: 800; margin-bottom: 4px; }
.dialog-text { color: var(--text); }
.dialog-hint { margin-top: 8px; color: var(--muted); font-size: 12px; }

.refined-joypad-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  overflow: hidden;
}

.joypad-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.joypad-head-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.joypad-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: center;
  justify-items: center;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 40px);
  grid-template-rows: repeat(3, 40px);
  gap: 6px;
  justify-content: center;
  margin: 0;
}

.pad-btn {
  background: linear-gradient(180deg, #1b1d2a, #121521);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pad-btn:hover,
.round-btn:hover,
.mini-btn:hover {
  transform: translateY(-1px);
}

.pad-btn:active,
.pad-btn.active {
  background: rgba(78, 161, 255, 0.8);
  border-color: rgba(78, 161, 255, 0.9);
}

.pad-up { grid-column: 2; grid-row: 1; }
.pad-left { grid-column: 1; grid-row: 2; }
.pad-center { grid-column: 2; grid-row: 2; cursor: default; }
.pad-right { grid-column: 3; grid-row: 2; }
.pad-down { grid-column: 2; grid-row: 3; }

.joypad-actions-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 220px;
}

.action-row.pad-action,
.compact-pad-action {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 0;
}

.round-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(180deg, #1b1d2a, #11131d);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
  font-weight: 800;
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.round-btn:active,
.round-btn.active {
  background: rgba(49, 208, 109, 0.8);
  border-color: rgba(49, 208, 109, 0.92);
}

.mini-controls,
.compact-mini-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin: 0;
}

.mini-btn {
  width: 100%;
  padding: 9px 12px;
  background: linear-gradient(180deg, #181b27, #11131d);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.mini-btn:active,
.mini-btn.active {
  background: #f5f7fb;
  color: #000;
}

.joypad-controls-embed {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding-top: 14px;
}

.controls-list,
.compact-controls-list {
  display: grid;
  gap: 0;
}

.controls-list div,
.compact-controls-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 13px;
}

.controls-list div:last-child,
.compact-controls-list div:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.controls-list span,
.compact-controls-list span {
  color: var(--muted);
}

.controls-list strong,
.compact-controls-list strong {
  color: #fff;
  font-size: 13px;
}

.profile-shell {
  max-width: 1820px;
  width: min(100%, 1820px);
  margin: 0 auto;
  padding: 24px 26px 48px;
  box-sizing: border-box;
}

.profile-page-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
}

.profile-card,
.profile-stats-panel,
.profile-section-panel {
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(11, 14, 23, 0.9), rgba(7, 9, 16, 0.96));
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 22px 56px rgba(0,0,0,0.26), inset 0 1px 0 rgba(255,255,255,0.03);
}

.profile-card {
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.profile-card-avatar {
  width: 86px;
  height: 86px;
  border-radius: 24px;
  background: radial-gradient(circle at 35% 35%, rgba(124, 192, 255, 0.9), rgba(34, 88, 160, 0.75) 50%, rgba(10, 18, 42, 0.92));
  box-shadow: 0 0 0 1px rgba(124,192,255,0.24), 0 18px 42px rgba(29, 82, 171, 0.28);
}

.profile-card-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-card-head h1,
.profile-section-head h2 {
  margin: 0;
}

.profile-card-subline,
.profile-section-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.profile-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.profile-pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.84);
  font-size: 12px;
  font-weight: 700;
}

.profile-meta-list {
  display: grid;
  gap: 12px;
}

.profile-meta-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 14px;
}

.profile-meta-item span { color: var(--muted); }
.profile-meta-item strong { color: #fff; }

.profile-main-stack {
  display: grid;
  gap: 24px;
}

.profile-stats-panel,
.profile-section-panel {
  padding: 24px;
}

.profile-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.profile-stat-card {
  border-radius: 22px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(15, 18, 30, 0.96), rgba(8, 10, 17, 0.96));
  border: 1px solid rgba(255,255,255,0.06);
}

.profile-stat-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.profile-stat-card strong {
  display: block;
  color: #fff;
  font-size: 28px;
  line-height: 1.05;
}

.profile-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.profile-detail-card {
  border-radius: 22px;
  padding: 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
}

.profile-detail-card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.72);
}

.profile-detail-list {
  display: grid;
  gap: 12px;
}

.profile-detail-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.profile-detail-list span { color: var(--muted); }
.profile-detail-list strong { color: #fff; }

@media (max-width: 1380px) {
  .game-layout {
    grid-template-columns: 240px minmax(0, 1fr) 320px;
    padding: 16px 18px 18px;
    gap: 16px;
  }

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

@media (max-width: 1200px) {
  .game-body {
    overflow: auto;
  }

  .game-layout-refined {
    height: auto;
  }

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

  .game-stage {
    min-height: 68vh;
  }

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

@media (max-width: 820px) {
  .joypad-grid,
  .profile-split-grid,
  .profile-stat-grid {
    grid-template-columns: 1fr;
  }

  .game-stage {
    min-height: 56vh;
  }

  .controls-list div,
  .compact-controls-list div,
  .profile-detail-list div,
  .profile-meta-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-shell,
  .game-layout {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 1200px) {
  .auth-shell,
  .dashboard-main-grid,
  .dashboard-hero-card,
  .dashboard-grid,
  .features-row { grid-template-columns: 1fr; }
  .hero-panel { min-height: 400px; }
  .hero-graphics { display: none; }
}

@media (max-width: 820px) {
  .auth-page-body,
  .nexus-dashboard-wrap,
  .game-layout { padding-left: 16px; padding-right: 16px; }
  .auth-showcase,
  .auth-panel,
  .dashboard-hero-card,
  .dashboard-card,
  .panel,
  .panel-box { padding: 20px; }
  .auth-showcase { min-height: auto; }
  .auth-rule-grid,
  .module-grid,
  .dashboard-mini-grid,
  .stats-grid { grid-template-columns: 1fr; }
  .nexus-topbar,
  .top-nav { padding-left: 16px; padding-right: 16px; }

  .top-nav {
    grid-template-columns: 1fr;
    height: auto;
    padding-top: 16px;
    padding-bottom: 16px;
    justify-items: stretch;
  }

  .brand,
  .auth-logout-btn {
    justify-self: stretch;
  }

  .auth-logout-btn {
    width: 100%;
  }
  .game-stage-header,
  .panel-card-head-inline,
  .brand-shell { align-items: flex-start; }
  .game-stage-header,
  .panel-card-head-inline { flex-direction: column; }
}

/* AUTH REDESIGN */
.auth-page-body {
  padding: 24px;
  align-items: stretch;
}

.auth-shell-redesign {
  width: min(1380px, 100%);
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(420px, 0.8fr);
  gap: 28px;
  align-items: stretch;
}

.auth-showcase,
.auth-panel-redesign {
  border-radius: 32px;
}

.auth-showcase {
  position: relative;
  padding: 34px;
  min-height: 760px;
  display: grid;
  gap: 22px;
  background:
    linear-gradient(180deg, rgba(13, 16, 26, 0.9), rgba(7, 9, 16, 0.88)),
    radial-gradient(circle at top left, rgba(78, 161, 255, 0.18), transparent 38%),
    radial-gradient(circle at bottom right, rgba(169, 112, 255, 0.16), transparent 34%),
    rgba(8, 10, 18, 0.84);
}

.auth-showcase::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(135deg, rgba(255,255,255,0.02), transparent 45%);
  pointer-events: none;
}

.auth-showcase-head,
.auth-password-box-redesign,
.auth-panel-head,
.auth-form-redesign,
.auth-form-footer,
.auth-scene-content {
  position: relative;
  z-index: 1;
}

.auth-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-badge-ghost {
  color: #d7def4;
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.12);
}

.auth-showcase-copy-wrap {
  max-width: 720px;
}

.auth-kicker,
.auth-panel-kicker,
.auth-scene-label {
  display: inline-block;
  margin-bottom: 14px;
  color: #b7c7ff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-showcase-title {
  max-width: 14ch;
  font-size: clamp(3rem, 5vw, 5.4rem);
  line-height: 0.92;
  margin: 0 0 16px;
  text-wrap: balance;
}

.auth-showcase-copy {
  max-width: 58ch;
  margin: 0;
  font-size: 1.04rem;
  color: #b8c0d0;
}

.auth-rule-grid-redesign {
  margin: 0;
}

.auth-rule-grid-redesign .auth-rule-card {
  padding: 18px 18px 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border-color: rgba(255,255,255,0.1);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.auth-scene-card {
  position: relative;
  overflow: hidden;
  min-height: 280px;
  border-radius: 28px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(4, 6, 12, 0.82);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 24px 54px rgba(0,0,0,0.32);
}

.auth-scene-map,
.auth-scene-overlay {
  position: absolute;
  inset: 0;
}

.auth-scene-map {
  background: url('assets/maps/new_bark_town.png') center/cover no-repeat;
  image-rendering: pixelated;
  transform: scale(1.04);
  filter: saturate(1.2) contrast(1.06);
}

.auth-scene-overlay {
  background:
    linear-gradient(180deg, rgba(3,5,10,0.16), rgba(3,5,10,0.72)),
    radial-gradient(circle at top right, rgba(78, 161, 255, 0.22), transparent 36%);
}

.auth-scene-content {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
}

.auth-scene-meta strong {
  display: block;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 800;
}

.auth-scene-team {
  display: inline-flex;
  align-items: flex-end;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 18px;
  align-self: flex-start;
  background: rgba(8, 10, 16, 0.74);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(8px);
}

.auth-scene-sprite {
  width: 34px;
  height: 34px;
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.45));
}

.auth-scene-sprite-main {
  width: 42px;
  height: 42px;
}

.auth-password-box-redesign {
  padding: 22px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.08);
}

.auth-password-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.auth-password-copy {
  margin: 8px 0 0;
  max-width: 48ch;
  color: var(--muted);
  line-height: 1.7;
}

.auth-status-stack {
  display: grid;
  gap: 10px;
}

.auth-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 126px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(49, 208, 109, 0.12);
  color: #8effb2;
  border: 1px solid rgba(49, 208, 109, 0.18);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.password-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.password-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #eff3ff;
  font-size: 13px;
  font-weight: 700;
}

.auth-panel-redesign {
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  background:
    linear-gradient(180deg, rgba(10, 12, 19, 0.92), rgba(7, 8, 14, 0.9)),
    rgba(8, 10, 16, 0.88);
}

.auth-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.auth-title {
  max-width: 14ch;
  margin: 0 0 8px;
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 0.94;
}

.auth-subtitle {
  margin: 0;
  max-width: 40ch;
  font-size: 0.98rem;
}

.auth-mode-chip {
  flex-shrink: 0;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: #f8fbff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-tabs-redesign {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 6px;
  margin-bottom: 22px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.auth-tabs-redesign .auth-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: center;
}

.auth-form-redesign {
  gap: 16px;
  margin-top: 2px;
}

.input-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.input-inline-link,
.auth-form-footer a {
  color: #b7c7ff;
  text-decoration: none;
  font-weight: 700;
}

.input-inline-link:hover,
.auth-form-footer a:hover {
  color: #fff;
}

.auth-input {
  min-height: 58px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.3);
}

.auth-btn {
  min-height: 58px;
  border-radius: 16px;
  margin-top: 2px;
}

.auth-two-col-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.auth-inline-note,
.auth-form-footer {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.auth-inline-note {
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
}

.auth-form-footer {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.reset-code-box {
  border-radius: 16px;
  background: rgba(255,255,255,0.08);
}

@media (max-width: 1200px) {
  .auth-shell-redesign {
    min-height: auto;
  }

  .auth-showcase {
    min-height: 620px;
  }
}

@media (max-width: 820px) {
  .auth-page-body {
    padding: 16px;
  }

  .auth-showcase,
  .auth-panel-redesign {
    padding: 22px;
    border-radius: 26px;
  }

  .auth-showcase-title,
  .auth-title {
    max-width: none;
  }

  .auth-panel-head,
  .auth-password-header,
  .input-row-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-tabs-redesign,
  .auth-two-col-grid {
    grid-template-columns: 1fr;
  }

  .auth-scene-card {
    min-height: 220px;
  }

  .auth-scene-team {
    gap: 10px;
  }
}
/* --- NEW AUTH PORTAL STYLES --- */
.auth-center-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  z-index: 10;
}

.auth-box {
  width: 100%;
  max-width: 420px;
  padding: 40px 32px;
  text-align: center;
}

.auth-logo {
  font-size: 24px;
  font-weight: 900;
  font-family: var(--font-heavy);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.auth-desc {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.auth-pill-tabs {
  display: flex;
  background: rgba(0,0,0,0.4);
  border-radius: 12px;
  padding: 6px;
  margin-bottom: 32px;
  border: 1px solid var(--line);
}

.auth-pill {
  flex: 1;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: 8px;
  transition: 0.2s ease;
}

.auth-pill:hover {
  color: var(--text);
}

.auth-pill.active-login { background: var(--blue); color: #fff; box-shadow: 0 4px 12px var(--shadow-blue); }
.auth-pill.active-register { background: var(--green); color: #fff; box-shadow: 0 4px 12px var(--shadow-green); }
.auth-pill.active-reset { background: var(--purple); color: #fff; box-shadow: 0 4px 12px var(--shadow-purple); }

.auth-field {
  text-align: left;
  margin-bottom: 20px;
}

.auth-field label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 8px;
}

.auth-field .opt {
  color: rgba(255,255,255,0.3);
  font-weight: 400;
}

.auth-field input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  transition: 0.2s ease;
}

.auth-field input:focus {
  outline: none;
  border-color: var(--text);
  background: rgba(0,0,0,0.5);
}

.auth-field input.mono {
  font-family: monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 16px;
}

.auth-submit {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: 0.2s ease;
  margin-top: 10px;
}

.btn-login { background: var(--blue); box-shadow: 0 4px 15px var(--shadow-blue); }
.btn-register { background: var(--green); box-shadow: 0 4px 15px var(--shadow-green); }
.btn-reset { background: var(--purple); box-shadow: 0 4px 15px var(--shadow-purple); }

.auth-submit:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.auth-notice {
  padding: 14px;
  border-radius: 12px;
  margin-bottom: 24px;
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}

.notice-err { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }
.notice-ok { background: rgba(49, 208, 109, 0.1); border: 1px solid rgba(49, 208, 109, 0.3); color: #86efac; }

.code-reveal {
  margin-top: 18px;
  padding: 12px;
  background: rgba(0,0,0,0.5);
  border-radius: 8px;
  border: 1px dashed var(--green);
  text-align: center;
}

.code-reveal span { display: block; font-size: 11px; text-transform: uppercase; margin-bottom: 4px; color: var(--green); }
.code-reveal strong { font-family: monospace; font-size: 18px; letter-spacing: 2px; color: #fff; }

/* Game page refinement patch */
.top-nav {
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  min-height: 64px;
  height: 64px;
  padding: 0 clamp(16px, 2vw, 28px);
}

.game-body {
  min-height: 100dvh;
}

.game-layout {
  grid-template-columns: clamp(230px, 15vw, 280px) minmax(0, 1fr) clamp(250px, 17vw, 300px);
  gap: clamp(12px, 1vw, 18px);
  padding: 14px clamp(12px, 1vw, 16px) 14px;
  width: min(1880px, calc(100% - 12px));
}

.game-layout-refined {
  flex: 1 0 auto;
  min-height: calc(100dvh - 84px - 45px);
  height: auto;
}

.game-sidebar {
  gap: 12px;
}

.panel,
.panel-box {
  border-radius: 20px;
}

.back-btn-compact {
  width: 100%;
  justify-content: center;
  padding: 9px 14px;
}

.area-card {
  padding: 18px;
}

.compact-radio-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.radio-card-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.radio-open-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(78, 161, 255, 0.2);
  background: linear-gradient(180deg, rgba(78, 161, 255, 0.16), rgba(78, 161, 255, 0.08));
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.radio-open-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(78, 161, 255, 0.35);
  box-shadow: 0 16px 28px rgba(0,0,0,0.22);
}

.radio-modal[hidden] { display: none; }
.radio-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
}

.radio-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 8, 0.72);
  backdrop-filter: blur(10px);
}

.radio-modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, calc(100vw - 28px));
  max-height: min(78dvh, 760px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 16px;
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(14, 18, 28, 0.98), rgba(7, 10, 18, 0.98));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 30px 80px rgba(0,0,0,0.42);
}

.radio-modal-head h2 {
  margin: 0;
  font-size: 28px;
}

.radio-modal-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.radio-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

.radio-modal-player-shell {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
}

.radio-now-playing-wrap {
  display: grid;
  gap: 6px;
}

.radio-now-playing-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.58);
}

.radio-modal-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  padding-right: 4px;
}

.radio-track {
  min-height: 72px;
  display: grid;
  gap: 6px;
  align-content: center;
}

.radio-track-title {
  display: block;
}

.radio-track-meta {
  display: block;
  font-size: 12px;
  color: rgba(255,255,255,0.56);
}

.game-stage {
  min-width: 0;
}

.refined-stage {
  border-radius: 24px;
}

.refined-joypad-shell {
  gap: 16px;
  padding: 16px;
}

@media (max-width: 1280px) {
  .game-layout {
    grid-template-columns: 220px minmax(0, 1fr) 250px;
  }
  .radio-modal-panel {
    width: min(700px, calc(100vw - 24px));
  }
}

@media (max-width: 1080px) {
  .top-nav {
    grid-template-columns: 1fr auto;
    gap: 12px;
    min-height: auto;
    height: auto;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .brand {
    grid-column: 1 / 2;
  }

  .nav-links {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
    flex-wrap: wrap;
  }

  .auth-logout-btn {
    grid-column: 2 / 3;
    grid-row: 1;
  }

  .game-layout,
  .game-layout-refined {
    height: auto;
  }

  .game-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .game-left-sidebar,
  .game-right-sidebar {
    order: 2;
  }

  .game-stage {
    order: 1;
    min-height: 56dvh;
  }

  .radio-modal-panel {
    grid-template-rows: auto auto minmax(0, 1fr);
    max-height: min(82dvh, 760px);
  }
}

@media (max-width: 640px) {
  .nav-links {
    gap: 8px;
  }

  .nav-links a,
  .profile-dropdown-trigger,
  .auth-logout-btn {
    min-width: 0;
    padding-left: 12px;
    padding-right: 12px;
  }

  .radio-modal-panel {
    padding: 18px;
  }

  .radio-modal-list {
    grid-template-columns: 1fr;
  }
}


/* Shared header include */
.shared-site-header.crystal-header-shell {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: minmax(220px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 14px 28px;
  min-height: 84px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background:
    linear-gradient(180deg, rgba(7, 10, 18, 0.94), rgba(8, 11, 18, 0.82)),
    radial-gradient(circle at left center, rgba(112, 73, 255, 0.12), transparent 35%);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 42px rgba(0,0,0,0.24);
}

.crystal-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
  max-width: 100%;
}

.crystal-brand-image {
  display: block;
  width: auto;
  height: clamp(44px, 3vw, 58px);
  max-width: min(100%, 260px);
  object-fit: contain;
}

.crystal-brand-fallback {
  display: none;
  font-family: 'Montserrat', 'Inter', sans-serif;
  font-size: clamp(1rem, 1.2vw, 1.2rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #ffffff;
}

.crystal-header-nav {
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.crystal-header-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  color: rgba(255,255,255,0.75);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  background: transparent;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.crystal-header-nav a:hover,
.crystal-header-nav a.active {
  color: #ffffff;
  border-color: rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.04));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 10px 20px rgba(0,0,0,0.18);
  transform: translateY(-1px);
}

.crystal-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex: 0 0 auto;
}

.shared-user-pill.crystal-user-greeting {
  padding: 0;
  min-height: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  color: #ffffff;
  font-size: clamp(1rem, 1.25vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: none;
}

.shared-user-pill.crystal-user-greeting strong {
  color: #ffffff;
  font-weight: 800;
}

.auth-logout-btn.crystal-logout-btn {
  position: relative;
  overflow: hidden;
  min-width: 118px;
  min-height: 46px;
  padding: 11px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 85, 111, 0.52);
  background: linear-gradient(180deg, rgba(255, 84, 109, 0.95), rgba(191, 30, 57, 0.94));
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 26px rgba(161, 22, 45, 0.28), inset 0 1px 0 rgba(255,255,255,0.18);
  animation: logoutShimmer 3.2s ease-in-out infinite;
}

.auth-logout-btn.crystal-logout-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -130%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.28), transparent);
  transform: skewX(-24deg);
  animation: logoutSweep 4.2s ease-in-out infinite;
}

.auth-logout-btn.crystal-logout-btn:hover {
  transform: translateY(-1px) scale(1.01);
  border-color: rgba(255, 118, 139, 0.78);
  background: linear-gradient(180deg, rgba(255, 102, 126, 0.98), rgba(199, 30, 60, 0.96));
  box-shadow: 0 14px 30px rgba(161, 22, 45, 0.34), inset 0 1px 0 rgba(255,255,255,0.18);
}

@keyframes logoutSweep {
  0%, 16% { left: -130%; }
  36% { left: 150%; }
  100% { left: 150%; }
}

@keyframes logoutShimmer {
  0%, 100% { box-shadow: 0 10px 26px rgba(161, 22, 45, 0.24), inset 0 1px 0 rgba(255,255,255,0.18); }
  50% { box-shadow: 0 12px 30px rgba(183, 31, 57, 0.32), inset 0 1px 0 rgba(255,255,255,0.22); }
}

.feature-placeholder-shell {
  max-width: 1320px;
}

.feature-placeholder-panel {
  position: relative;
  overflow: hidden;
  border-radius: 30px;
  padding: 34px;
}

.feature-placeholder-panel h1 {
  margin: 10px 0 12px;
  font-size: clamp(2rem, 4vw, 3rem);
}

.feature-placeholder-panel > p {
  max-width: 760px;
}

.feature-placeholder-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.feature-placeholder-card {
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}

.feature-placeholder-card span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.feature-placeholder-card strong {
  font-size: 1.2rem;
}

@media (max-width: 1200px) {
  .shared-site-header.crystal-header-shell {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 16px;
    padding: 18px 22px;
  }

  .crystal-brand,
  .crystal-header-actions {
    justify-self: center;
  }

  .crystal-header-actions {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 820px) {
  .crystal-brand {
    width: auto;
    justify-content: center;
  }

  .crystal-header-nav {
    width: 100%;
    gap: 8px;
  }

  .crystal-header-nav a {
    flex: 1 1 auto;
    min-width: calc(50% - 8px);
  }

  .feature-placeholder-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shared-site-header.crystal-header-shell {
    padding: 16px;
  }

  .crystal-brand {
    justify-content: flex-start;
  }

  .crystal-brand-image {
    height: 34px;
    max-width: min(100%, 210px);
  }

  .crystal-header-nav a {
    min-width: 100%;
  }

  .crystal-header-actions {
    flex-direction: column;
    gap: 10px;
  }

  .shared-user-pill.crystal-user-greeting {
    text-align: center;
  }

  .auth-logout-btn.crystal-logout-btn {
    width: 100%;
  }

  .feature-placeholder-panel {
    padding: 24px;
  }
}



/* ========================================================================== 
   SHARED PAGE HEROES
   ========================================================================== */
.page-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
  gap: 24px;
  align-items: center;
  min-height: 248px;
  padding: 28px;
  margin-bottom: 22px;
  border-radius: 28px;
  border: 1px solid rgba(56, 189, 248, 0.26);
  box-shadow: 0 16px 40px rgba(0,0,0,0.30), inset 0 1px 0 rgba(255,255,255,0.03);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(6, 10, 18, 0.74), rgba(7, 10, 18, 0.88) 52%, rgba(7, 10, 18, 0.78));
  pointer-events: none;
}

.page-hero > * {
  position: relative;
  z-index: 1;
}

.page-hero-copy {
  grid-column: 1;
  max-width: 780px;
  justify-self: start;
  align-self: center;
  text-align: left;
}

.page-hero-copy h1 {
  margin: 8px 0 10px;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-family: var(--font-heavy);
  color: var(--text);
}

.page-hero-copy p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.65;
}

.page-hero-side {
  grid-column: 2;
  display: grid;
  gap: 12px;
  justify-self: end;
  align-self: center;
  width: min(100%, 340px);
}

.page-hero-side.compact {
  width: min(100%, 340px);
}

.page-hero-action {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 50px;
  padding: 0 18px;
  border-radius: 16px;
  text-decoration: none;
  font-weight: 800;
  background: linear-gradient(180deg, #2ec5f3, #1aa9e7);
  color: #ffffff;
  border: 1px solid rgba(125, 211, 252, 0.32);
  box-shadow: 0 12px 26px rgba(14, 165, 233, 0.22);
  transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
}

.page-hero-action.secondary {
  background: rgba(10, 20, 38, 0.72);
  border: 1px solid rgba(71, 85, 105, 0.65);
  color: #e2e8f0;
  box-shadow: none;
}

.page-hero-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(14, 165, 233, 0.26);
  filter: brightness(1.04);
}

.page-hero-action:visited {
  color: #ffffff;
}

.page-hero-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.page-hero-mini {
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(10,20,38,0.88), rgba(7,10,18,0.92));
  border: 1px solid rgba(71, 85, 105, 0.36);
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page-hero-mini span {
  display: block;
  margin-bottom: 6px;
  color: #8fa8c5;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.page-hero-mini strong {
  color: #fff;
  font-size: 1.55rem;
  font-family: 'Montserrat', sans-serif;
  letter-spacing: -0.03em;
}

@media (max-width: 980px) {
  .map-tool-chip-split { grid-column: span 3; }

  .page-hero {
    grid-template-columns: 1fr;
    min-height: unset;
  }

  .page-hero-side,
  .page-hero-side.compact {
    width: 100%;
    justify-self: stretch;
  }
}


/* ========================================================================== 
   POKEDEX PAGE
   ========================================================================== */
.pokedex-shell {
  max-width: 1820px;
  width: min(100%, 1820px);
  margin: 0 auto;
  padding: 24px 26px 48px;
}

.pokedex-hero,
.pokedex-main,
.pokedex-detail {
  position: relative;
  overflow: hidden;
}

.pokedex-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  padding: 26px;
  margin-bottom: 22px;
  border-radius: 28px;
  border: 1px solid rgba(56, 189, 248, 0.26);
  box-shadow: 0 16px 40px rgba(0,0,0,0.30), inset 0 1px 0 rgba(255,255,255,0.03);
}

.pokedex-hero-copy {
  flex: 1 1 auto;
  max-width: 860px;
}

.pokedex-hero h1 {
  margin: 8px 0 10px;
  font-size: clamp(2.55rem, 5vw, 4.2rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-family: var(--font-heavy);
  color: var(--text);
}

.pokedex-hero p {
  margin: 0;
  max-width: 760px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.6;
}

.pokedex-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  min-width: min(100%, 520px);
}

.pokedex-hero-stat {
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  min-height: 104px;
}

.pokedex-hero-stat span,
.pokedex-meta-card span,
.pokedex-results-copy span,
.pokedex-search span,
.pokedex-select-wrap span,
.pokedex-toggle-wrap span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted-strong);
  font-weight: 800;
}

.pokedex-hero-stat strong {
  font-size: clamp(1.75rem, 2.5vw, 2.45rem);
  line-height: 1;
  color: var(--text);
}

.pokedex-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}

.pokedex-main,
.pokedex-detail {
  padding: 22px;
}

.pokedex-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.3fr) repeat(2, minmax(150px, .42fr)) minmax(156px, .36fr);
  gap: 14px;
  margin-bottom: 18px;
}

.pokedex-search,
.pokedex-select-wrap,
.pokedex-toggle-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pokedex-search input,
.pokedex-select-wrap select {
  width: 100%;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.035);
  color: var(--text);
  font: inherit;
  outline: none;
}

.pokedex-search input:focus,
.pokedex-select-wrap select:focus {
  border-color: rgba(78, 161, 255, 0.48);
  box-shadow: 0 0 0 4px rgba(78, 161, 255, 0.12);
}

.pokedex-results-bar,
.pokedex-pagination,
.pokedex-pagination-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.pokedex-results-bar {
  margin-bottom: 14px;
}

.pokedex-results-copy strong {
  display: block;
  font-size: 2rem;
  line-height: 1;
}

.dex-page-btn {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.22s ease, background 0.22s ease, border-color 0.22s ease;
}

.dex-page-btn:hover:not(:disabled),
.dex-page-btn:focus-visible:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(78, 161, 255, 0.45);
  background: rgba(78, 161, 255, 0.12);
}

.dex-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dex-page-indicator {
  color: var(--muted-strong);
  font-weight: 700;
}

.dex-toggle-btn {
  min-height: 54px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.035);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 16px 0 12px;
  cursor: pointer;
  transition: border-color 0.22s ease, background 0.22s ease, transform 0.22s ease;
}

.dex-toggle-btn:hover,
.dex-toggle-btn:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(255, 214, 10, 0.5);
}

.dex-toggle-btn.is-active {
  background: linear-gradient(135deg, rgba(255, 214, 10, 0.22), rgba(255, 105, 180, 0.14));
  border-color: rgba(255, 214, 10, 0.52);
}

.dex-toggle-knob {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f8fafc, #cbd5e1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.28);
  flex: 0 0 auto;
}

.dex-toggle-btn.is-active .dex-toggle-knob {
  background: linear-gradient(135deg, #fde68a, #f472b6);
}

.dex-toggle-label {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.pokedex-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.pokedex-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  min-height: 186px;
  padding: 14px 12px 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.032);
  text-align: center;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.24s ease, border-color 0.24s ease, background 0.24s ease, box-shadow 0.24s ease;
}

.pokedex-card:hover,
.pokedex-card.is-active {
  transform: translateY(-4px);
  border-color: rgba(78, 161, 255, 0.45);
  background: rgba(78, 161, 255, 0.08);
  box-shadow: 0 18px 36px rgba(0,0,0,0.24);
}

.pokedex-card-number,
.pokedex-detail-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #dbeafe;
  background: rgba(78, 161, 255, 0.14);
  border: 1px solid rgba(78, 161, 255, 0.22);
}

.pokedex-card-state {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.35);
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.1);
}

.pokedex-card-state.is-seen {
  background: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.12);
}

.pokedex-card-state.is-caught {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.pokedex-card-sprite-wrap {
  display: grid;
  place-items: center;
  width: 100%;
  height: 66px;
}

.pokedex-card strong {
  font-size: 0.95rem;
  line-height: 1.16;
}

.pokedex-card-types,
.pokedex-detail-types,
.pokedex-matchups,
.pokedex-status-row,
.pokedex-detail-actions,
.pokedex-card-status-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.dex-type-pill,
.dex-matchup-pill,
.dex-status-pill,
.mini-status {
  --type-color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: var(--type-color);
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dex-status-pill,
.mini-status {
  background: rgba(148, 163, 184, 0.16);
  color: var(--muted-strong);
  border-color: rgba(148, 163, 184, 0.2);
}

.dex-status-pill.is-active {
  background: rgba(96, 165, 250, 0.16);
  color: #dbeafe;
  border-color: rgba(96, 165, 250, 0.3);
}

.dex-status-caught.is-active,
.mini-caught.is-active {
  background: rgba(34, 197, 94, 0.16);
  color: #dcfce7;
  border-color: rgba(34, 197, 94, 0.3);
}

.mini-status {
  min-height: 20px;
  min-width: 20px;
  padding: 0 6px;
  font-size: 10px;
}

.pokedex-detail-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.pokedex-detail-placeholder {
  min-height: 720px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
}

.pokedex-detail-placeholder-ball {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 8px solid rgba(255,255,255,0.08);
  position: relative;
  margin-bottom: 18px;
  background: linear-gradient(to bottom, rgba(239,68,68,0.7) 0 50%, rgba(248,250,252,0.14) 50% 100%);
}

.pokedex-detail-placeholder-ball::before {
  content: "";
  position: absolute;
  left: -8px;
  right: -8px;
  top: calc(50% - 4px);
  height: 8px;
  background: rgba(255,255,255,0.08);
}

.pokedex-detail-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
}

.pokedex-detail-top h2 {
  margin: 0;
  font-family: var(--font-heavy);
  font-size: 2rem;
}

.pokedex-detail-actions {
  gap: 10px;
}

.dex-action-btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.dex-action-btn:hover,
.dex-action-btn:focus-visible {
  transform: translateY(-2px);
}

.dex-action-btn.is-active {
  background: rgba(96, 165, 250, 0.14);
  border-color: rgba(96, 165, 250, 0.35);
}

.dex-caught-btn.is-active {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.35);
}

.pokedex-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.pokedex-meta-card,
.pokedex-info-section {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
}

.pokedex-meta-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.35rem;
  color: var(--text);
}

.pokedex-info-section p {
  margin: 10px 0 0;
  color: var(--text-soft);
  line-height: 1.65;
}

.pokedex-empty {
  grid-column: 1 / -1;
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
}

.pokedex-pagination {
  margin-top: 18px;
}

.pokemon-sprite {
  --frame-count: 1;
  width: 76px;
  height: 76px;
  border-radius: 14px;
  background-repeat: no-repeat;
  background-position: center top;
  background-size: 100% auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,0.34));
}

.pokemon-sprite.is-animated {
  animation: dexSpriteBounce 1s steps(1) infinite;
}

.pokemon-sprite.is-shiny {
  filter: hue-rotate(155deg) saturate(1.55) brightness(1.08) contrast(1.06) drop-shadow(0 0 18px rgba(255, 214, 10, 0.18));
}

.pokemon-sprite-detail {
  width: 128px;
  height: 128px;
}

@keyframes dexSpriteBounce {
  0%, 15%   { background-position: center 0%; }
  16%, 32%  { background-position: center 20%; }
  33%, 49%  { background-position: center 40%; }
  50%, 66%  { background-position: center 60%; }
  67%, 83%  { background-position: center 80%; }
  84%, 100% { background-position: center 100%; }
}

@media (min-width: 1650px) {
  .pokedex-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 1380px) {
  .pokedex-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .pokedex-detail {
    order: -1;
  }

  .pokedex-detail-placeholder {
    min-height: 320px;
  }
}

@media (max-width: 1120px) {
  .pokedex-shell {
    padding: 20px 18px 42px;
  }

  .pokedex-hero,
  .pokedex-toolbar,
  .pokedex-grid,
  .pokedex-hero-stats,
  .pokedex-detail-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pokedex-toolbar {
    display: grid;
  }

  .pokedex-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .pokedex-hero-stats,
  .pokedex-toolbar,
  .pokedex-grid,
  .pokedex-detail-meta {
    grid-template-columns: 1fr 1fr;
  }

  .pokedex-results-bar,
  .pokedex-pagination-top,
  .pokedex-pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .pokedex-main,
  .pokedex-detail,
  .pokedex-hero {
    padding: 18px;
  }
}

@media (max-width: 620px) {
  .pokedex-hero-stats,
  .pokedex-toolbar,
  .pokedex-grid,
  .pokedex-detail-meta {
    grid-template-columns: 1fr;
  }

  .pokedex-card {
    min-height: 174px;
  }

  .pokedex-detail-top h2 {
    font-size: 1.7rem;
  }

  .pokemon-sprite,
  .pokemon-sprite-detail {
    width: 108px;
    height: 108px;
  }

  .pokedex-card .pokemon-sprite {
    width: 66px;
    height: 66px;
  }
}


/* Pokedex sprite fix */
.pokedex-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.pokedex-card {
  min-height: 204px;
  padding: 14px 10px 12px;
}

.pokedex-card-sprite-wrap {
  height: 94px;
}

.pokemon-sprite-img {
  display: block;
  width: 106px;
  height: 106px;
  object-fit: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,0.34));
}

.pokemon-sprite-img-detail {
  width: 128px;
  height: 128px;
}

.pokemon-sprite-img-animated {
  width: 140px;
  height: 140px;
}

.pokedex-detail-sprite-frame {
  display: grid;
  place-items: center;
  width: 164px;
  height: 164px;
  border-radius: 24px;
  background: radial-gradient(circle at top, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
}

.pokedex-card-status-mini,
.pokedex-detail-actions .dex-action-btn:not(.dex-cry-btn) {
  display: none !important;
}

.pokedex-card.is-undiscovered .pokemon-sprite-img,
.pokedex-card.is-undiscovered strong,
.pokedex-card.is-undiscovered .pokedex-card-types {
  opacity: 0.38;
}

.pokedex-card.is-undiscovered::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(0,0,0,0.04), rgba(0,0,0,0.22));
  pointer-events: none;
}

.pokedex-card.is-undiscovered .pokedex-card-number,
.pokedex-card.is-undiscovered .pokedex-card-state {
  opacity: 0.9;
}

@media (max-width: 1650px) {
  .pokedex-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 1380px) {
  .pokedex-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 1080px) {
  .pokedex-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Pokedex sidebar polish patch */
.pokedex-select-wrap {
  position: relative;
}

.pokedex-select-wrap::after {
  content: "";
  position: absolute;
  right: 18px;
  bottom: 19px;
  width: 10px;
  height: 10px;
  border-right: 2px solid rgba(226, 232, 240, 0.88);
  border-bottom: 2px solid rgba(226, 232, 240, 0.88);
  transform: rotate(45deg);
  pointer-events: none;
  opacity: 0.9;
}

.pokedex-select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 44px;
  border-radius: 18px;
  border-color: rgba(148, 163, 184, 0.2);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03)),
    rgba(10, 16, 30, 0.92);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 10px 24px rgba(0,0,0,0.22);
}

.pokedex-select-wrap select option {
  color: #e2e8f0;
  background: #0f172a;
}

.pokedex-search input {
  border-radius: 18px;
  border-color: rgba(148, 163, 184, 0.2);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03)),
    rgba(10, 16, 30, 0.9);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 10px 24px rgba(0,0,0,0.2);
}

.pokedex-detail-card {
  gap: 14px;
}

.pokedex-detail-top {
  gap: 14px;
  padding: 18px 18px 16px;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background:
    radial-gradient(circle at top, rgba(96, 165, 250, 0.14), transparent 54%),
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.025));
  box-shadow: 0 18px 36px rgba(0,0,0,0.22);
}

.pokedex-detail-heading {
  width: 100%;
}

.pokedex-detail-heading-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pokedex-detail-number {
  min-height: 26px;
  padding: 0 12px;
  border-radius: 10px;
  letter-spacing: 0.14em;
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.24), rgba(37, 99, 235, 0.12));
  border-color: rgba(96, 165, 250, 0.26);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.pokedex-detail-top h2 {
  font-size: 2.2rem;
  line-height: 1;
}

.pokedex-detail-sprite-frame {
  position: relative;
  overflow: hidden;
  width: 172px;
  height: 172px;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 22%, rgba(255,255,255,0.2), rgba(255,255,255,0.04) 38%, rgba(15, 23, 42, 0.24) 72%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(30, 41, 59, 0.82));
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 18px 30px rgba(0,0,0,0.28);
}

.pokedex-detail-sprite-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.02) 34%, transparent 35%);
  pointer-events: none;
}

.pokemon-sprite-img,
.pokemon-sprite-img-detail,
.pokemon-sprite-img-animated {
  position: relative;
  z-index: 1;
}

.pokedex-detail-types,
.pokedex-matchups {
  gap: 10px;
}

.dex-type-pill,
.dex-matchup-pill {
  position: relative;
  overflow: hidden;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.16);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02)), var(--type-color);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), inset 0 -1px 0 rgba(0,0,0,0.18), 0 8px 14px rgba(0,0,0,0.16);
  letter-spacing: 0.08em;
}

.dex-type-pill::before,
.dex-matchup-pill::before {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  top: 1px;
  height: 48%;
  border-radius: 9px 9px 14px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.32), rgba(255,255,255,0.08));
  pointer-events: none;
}

.dex-status-pill {
  min-height: 30px;
  padding: 0 12px;
  border-radius: 10px;
}

.dex-action-btn.dex-cry-btn {
  width: 100%;
  min-height: 46px;
  border-radius: 16px;
  border-color: rgba(96, 165, 250, 0.24);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.18), rgba(30, 64, 175, 0.12));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 14px 24px rgba(0,0,0,0.18);
}

.pokedex-detail-meta {
  gap: 10px;
}

.pokedex-meta-card {
  padding: 12px 14px;
  border-radius: 16px;
  border-color: rgba(148, 163, 184, 0.16);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.028)),
    rgba(15, 23, 42, 0.42);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}

.pokedex-meta-card span {
  font-size: 10px;
  letter-spacing: 0.12em;
}

.pokedex-meta-card strong {
  margin-top: 6px;
  font-size: 1.02rem;
  line-height: 1.18;
}

.pokedex-info-section {
  padding: 14px 16px;
  border-radius: 18px;
  border-color: rgba(148, 163, 184, 0.15);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.025)),
    rgba(15, 23, 42, 0.34);
}

.pokedex-info-section .panel-kicker {
  display: inline-block;
  margin-bottom: 10px;
}

.pokedex-info-section p {
  margin-top: 0;
}


/* Pokedex sidebar refinement patch */
.pokedex-detail-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: nowrap;
}

.pokedex-detail-heading-copy {
  width: 100%;
}

.pokedex-detail-number {
  order: 2;
  margin: 0;
  flex: 0 0 auto;
}

.pokedex-detail-top h2 {
  margin: 0;
  font-size: 1.95rem;
  line-height: 1;
}

.pokedex-detail-sprite-frame {
  padding: 14px;
}

.pokemon-sprite-img-hd {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.28));
}

.pokedex-detail-actions {
  margin-top: 2px;
}

.pokedex-meta-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 92px;
}

.pokedex-meta-card span,
.pokedex-meta-card strong {
  width: 100%;
  text-align: center;
}

.pokedex-meta-card strong {
  margin-top: 8px;
}

@media (max-width: 520px) {
  .pokedex-detail-title-row {
    gap: 10px;
  }

  .pokedex-detail-top h2 {
    font-size: 1.7rem;
  }
}
/* --- ORIGINAL POKEDEX CLEANUP PATCH --- */

/* 1. Redesigned Rectangular Type Pills */
.dex-type-pill {
    background: #0a0a0c !important; /* Black center */
    border: 1px solid var(--type-color, #888) !important; /* Matches the Pokemon's type color */
    color: #ffffff !important; /* White text */
    border-radius: 6px !important; /* Rectangular rather than pill-shaped */
    padding: 4px 10px !important; /* Much smaller padding */
    font-size: 10px !important; /* Smaller text */
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    box-shadow: none !important; /* Removes bulky shadows */
}

/* 2. Compact the Sidebar Stats (Height, Weight, Region, Dex No) */
#pokedexDetailCard .pokedex-info-section {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important; /* Puts the stats side-by-side in 2 columns */
    gap: 8px !important; /* Tighter spacing so it isn't massive */
    padding: 16px !important;
    background: rgba(0, 0, 0, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    margin-top: 16px !important;
}

/* Cleans up the boxes inside the stat section */
#pokedexDetailCard .pokedex-info-section > * {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
}

/* Makes the stat labels (Height, Weight, etc) smaller and cleaner */
#pokedexDetailCard .pokedex-info-section .panel-kicker {
    font-size: 10px !important;
    color: #94a3b8 !important;
    margin-bottom: 4px !important;
    border: none !important;
    padding: 0 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
}

/* Makes the actual stat values (2'00", Kanto, etc) bold and crisp */
#pokedexDetailCard .pokedex-info-section p, 
#pokedexDetailCard .pokedex-info-section strong {
    font-size: 13px !important;
    color: #fff !important;
    margin: 0 !important;
    font-weight: 600 !important;
}

/* 3. Compact the Top Details (Name and Number) */
.pokedex-detail-heading-copy h2 {
    font-size: 1.8rem !important;
    margin: 0 0 4px 0 !important;
}

.pokedex-detail-number {
    font-size: 1rem !important;
    color: #4ea1ff !important;
    margin: 0 0 12px 0 !important;
}

/* Pokedex card pokeball + sidebar cleanup patch */
.pokedex-card-state {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
}

.pokedex-card-state img {
  width: 100%;
  height: 100%;
  opacity: 1;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.24));
}

.pokedex-card-state.is-seen,
.pokedex-card-state.is-caught,
.pokedex-card.is-undiscovered .pokedex-card-state {
  background: transparent !important;
  box-shadow: none !important;
}

.pokedex-detail-title-row {
  gap: 0;
}

.pokedex-detail-heading-copy h2,
.pokedex-detail-top h2 {
  color: #ffffff !important;
  font-size: 2rem !important;
  line-height: 1.08;
  text-align: center;
}

.pokedex-detail-number {
  display: none !important;
}

.pokedex-detail-sprite-frame {
  display: none !important;
}

.pokedex-detail-sprite-plain {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 156px;
}

.pokedex-detail-sprite-plain .pokemon-sprite-img-hd,
.pokedex-detail-sprite-plain .pokemon-sprite-img-detail {
  width: min(220px, 100%);
  height: auto;
  max-height: 220px;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 12px 20px rgba(0,0,0,0.24));
}

.pokedex-detail-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

@media (max-width: 820px) {
  .pokedex-detail-meta {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 520px) {
  .pokedex-detail-meta {
    grid-template-columns: 1fr !important;
  }

  .pokedex-detail-heading-copy h2,
  .pokedex-detail-top h2 {
    font-size: 1.6rem !important;
  }
}


/* Matchup + entry sidebar fix patch */
.pokedex-entry-card {
  position: relative;
  overflow: hidden;
  padding: 16px 18px !important;
  border-radius: 20px;
  background:
    radial-gradient(circle at top right, rgba(78, 161, 255, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02)),
    rgba(10, 15, 28, 0.78);
  border: 1px solid rgba(98, 146, 224, 0.16);
}

.pokedex-entry-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), transparent 34%);
  pointer-events: none;
}

.pokedex-entry-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.pokedex-entry-text {
  position: relative;
  z-index: 1;
  margin: 0 !important;
  padding-left: 14px;
  color: rgba(241, 245, 249, 0.95) !important;
  line-height: 1.72 !important;
}

.pokedex-entry-text::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(96,165,250,0.95), rgba(96,165,250,0.12));
}

.pokedex-matchups-card {
  padding: 16px 18px !important;
}

.pokedex-matchups-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.pokedex-matchup-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.pokedex-matchup-heading {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pokedex-matchups-column {
  justify-content: flex-start;
  align-content: flex-start;
}

.dex-matchup-outline {
  background: #0a0a0c !important;
  border: 1px solid var(--type-color, #888) !important;
  color: #ffffff !important;
  border-radius: 8px !important;
  padding: 4px 10px !important;
  min-height: 28px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06) !important;
}

.dex-matchup-outline::before {
  display: none !important;
}

@media (max-width: 640px) {
  .pokedex-matchups-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}


/* Sidebar cleanup patch */
.pokedex-detail-meta-two {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.pokedex-entry-card-simple {
  padding: 18px 20px !important;
  display: block;
}

.pokedex-entry-card-simple::before {
  display: none;
}

.pokedex-entry-card-simple .panel-kicker {
  display: block;
  margin-bottom: 10px;
}

.pokedex-entry-text-simple {
  padding-left: 0 !important;
  line-height: 1.8 !important;
  color: rgba(241, 245, 249, 0.96) !important;
}

.pokedex-entry-text-simple::before {
  display: none !important;
}

.pokedex-matchups-card-flat {
  padding: 18px 20px !important;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pokedex-matchups-row {
  display: grid;
  grid-template-columns: 124px 1fr;
  gap: 14px;
  align-items: start;
}

.pokedex-matchups-label {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.35;
  padding-top: 4px;
}

.pokedex-matchups-values {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
}

.pokedex-matchups-values .dex-matchup-outline {
  margin: 0 !important;
}

@media (max-width: 820px) {
  .pokedex-matchups-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

@media (max-width: 520px) {
  .pokedex-detail-meta-two {
    grid-template-columns: 1fr !important;
  }
}


/* 2026-03-16 definitive pokedex sidebar override */
#pokedexDetailCard .dex-clean-entry,
#pokedexDetailCard .dex-clean-matchups {
  display: block !important;
  padding: 16px 18px !important;
  border-radius: 18px !important;
  border: 1px solid rgba(255,255,255,0.08) !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015)), rgba(7,10,18,0.92) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04) !important;
}

#pokedexDetailCard .dex-clean-entry-label,
#pokedexDetailCard .dex-clean-matchup-label {
  margin: 0 0 10px 0 !important;
  color: #a9b5ca !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: 0.14em !important;
  text-transform: uppercase !important;
}

#pokedexDetailCard .dex-clean-entry-body {
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #f4f7fb !important;
  font-size: 1.02rem !important;
  line-height: 1.7 !important;
}

#pokedexDetailCard .dex-clean-matchups {
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
}

#pokedexDetailCard .dex-clean-matchup-row {
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

#pokedexDetailCard .dex-clean-matchup-values {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

#pokedexDetailCard .dex-clean-matchup-values .dex-matchup-outline,
#pokedexDetailCard .dex-clean-matchup-values .dex-type-pill {
  background: #0a0a0c !important;
  border: 1px solid var(--type-color, #888) !important;
  color: #ffffff !important;
  border-radius: 8px !important;
  padding: 4px 12px !important;
  min-height: 30px !important;
  box-shadow: none !important;
}

#pokedexDetailCard .dex-clean-entry::before,
#pokedexDetailCard .dex-clean-entry::after,
#pokedexDetailCard .dex-clean-matchups::before,
#pokedexDetailCard .dex-clean-matchups::after,
#pokedexDetailCard .dex-clean-entry-body::before,
#pokedexDetailCard .dex-clean-entry-body::after {
  display: none !important;
  content: none !important;
}


/* SHARED SITE FOOTER */
.site-footer {
  width: 100%;
  margin: auto 0 0;
  padding: 0;
  border: 0;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  background: #05070c;
  box-shadow: none;
  backdrop-filter: none;
  border-radius: 0;
}

.site-footer-inner {
  width: min(1480px, calc(100% - 32px));
  min-height: 44px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}

.site-footer-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  justify-content: flex-end;
}

.site-footer-links a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.2;
  opacity: 0.88;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.site-footer-links a:hover {
  color: #ffffff;
  opacity: 1;
}

@media (max-width: 900px) {
  .site-footer {
    margin-top: auto;
  }

  .site-footer-inner {
    width: min(100%, calc(100% - 24px));
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    min-height: 0;
    padding: 8px 0;
  }

  .site-footer-links {
    width: 100%;
    justify-content: flex-start;
    gap: 14px;
  }
}


/* Pokedex shiny card size + cross-fade patch */
.pokedex-card-sprite-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pokedex-card .pokemon-sprite-img {
  width: 106px;
  height: 106px;
  object-fit: contain;
  transform-origin: center center;
  transition: opacity 0.14s ease, transform 0.14s ease, filter 0.14s ease;
}

.pokedex-card .pokemon-sprite-img.is-shiny-static {
  width: 84px;
  height: 84px;
}

.pokedex-grid.is-shiny-transitioning .pokedex-card .pokemon-sprite-img {
  opacity: 0.3;
  transform: scale(0.96);
}

.pokedex-grid.is-shiny-fade-in .pokedex-card .pokemon-sprite-img {
  animation: pokedexSpriteCrossFade 0.16s ease both;
}

@keyframes pokedexSpriteCrossFade {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
/* --- POKEDEX SPRITE SIZE NORMALIZATION --- */
.pokemon-card img,
.pokemon-sprite img {
    width: 72px !important;
    height: 72px !important;
    object-fit: contain;
    image-rendering: pixelated;
    display: block;
    margin: 0 auto;
}

/* 2026-03-16 pokedex sprite consistency + smaller detail gif patch */
.pokedex-card .pokemon-sprite-img,
.pokedex-card .pokemon-sprite-img.is-shiny-static {
  width: 106px !important;
  height: 106px !important;
  object-fit: contain;
}

.pokedex-detail-sprite-plain .pokemon-sprite-img-hd,
.pokedex-detail-sprite-plain .pokemon-sprite-img-detail {
  width: min(110px, 100%) !important;
  max-height: 110px !important;
  height: auto !important;
  object-fit: contain;
}


/* 2026-03-16 pokedex number badge + centered matchup mobile fix */
.pokedex-card-number {
  min-width: 58px !important;
  height: 28px !important;
  padding: 0 12px !important;
  border-radius: 8px !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.09), rgba(255,255,255,0.03)),
    rgba(10, 16, 30, 0.94) !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 8px 16px rgba(0,0,0,0.18) !important;
  color: #dbeafe !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: 0.12em !important;
}

.pokedex-card .pokemon-sprite-img,
.pokedex-card .pokemon-sprite-img.is-shiny-static {
  width: 106px !important;
  height: 106px !important;
  object-fit: contain !important;
}

#pokedexDetailCard .pokedex-detail-sprite-plain .pokemon-sprite-img-hd,
#pokedexDetailCard .pokedex-detail-sprite-plain .pokemon-sprite-img-detail,
#pokedexMobileDetailCard .pokedex-detail-sprite-plain .pokemon-sprite-img-hd,
#pokedexMobileDetailCard .pokedex-detail-sprite-plain .pokemon-sprite-img-detail {
  width: min(96px, 60vw) !important;
  max-width: 96px !important;
  max-height: 96px !important;
  height: auto !important;
  object-fit: contain !important;
}

#pokedexDetailCard .dex-clean-matchups,
#pokedexMobileDetailCard .dex-clean-matchups {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
}

#pokedexDetailCard .dex-clean-matchup-row,
#pokedexMobileDetailCard .dex-clean-matchup-row {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  margin: 0 !important;
  padding: 0 !important;
  text-align: center !important;
  border: 0 !important;
  background: transparent !important;
}

#pokedexDetailCard .dex-clean-matchup-label,
#pokedexMobileDetailCard .dex-clean-matchup-label {
  width: 100% !important;
  margin: 0 !important;
  text-align: center !important;
}

#pokedexDetailCard .dex-clean-matchup-values,
#pokedexMobileDetailCard .dex-clean-matchup-values {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 10px !important;
}

@media (max-width: 520px) {
  #pokedexDetailCard .dex-clean-matchups,
  #pokedexMobileDetailCard .dex-clean-matchups {
    gap: 14px !important;
  }

  #pokedexDetailCard .dex-clean-matchup-row,
  #pokedexMobileDetailCard .dex-clean-matchup-row {
    gap: 10px !important;
  }

  #pokedexDetailCard .dex-clean-matchup-values,
  #pokedexMobileDetailCard .dex-clean-matchup-values {
    gap: 8px !important;
  }

  #pokedexDetailCard .dex-clean-matchup-values .dex-matchup-outline,
  #pokedexDetailCard .dex-clean-matchup-values .dex-type-pill,
  #pokedexMobileDetailCard .dex-clean-matchup-values .dex-matchup-outline,
  #pokedexMobileDetailCard .dex-clean-matchup-values .dex-type-pill {
    padding: 4px 10px !important;
  }
}

/* MAP EDITOR PRO */
.map-editor-pro-shell {
  width: min(100%, 1720px);
  margin: 0 auto;
  padding: 22px 18px 42px;
}
.map-editor-pro-panel {
  padding: 18px;
  border-radius: 28px;
}
.map-editor-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.map-editor-topbar-left {
  display: grid;
  gap: 8px;
}
.map-editor-heading h1 {
  margin: 0 0 8px;
  font-family: var(--font-heavy);
  font-size: clamp(1.9rem, 3vw, 2.8rem);
}
.map-editor-heading p,
.map-editor-inline-meta,
.map-editor-help-card li,
.map-editor-help-card p,
.map-editor-help-card small,
.map-tool-chip small,
.map-tool-chip strong {
  color: var(--muted);
}
.map-editor-inline-meta {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  font-weight: 700;
}
.editor-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 10px 20px rgba(0,0,0,0.18);
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.editor-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(56,189,248,0.26);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 12px 24px rgba(0,0,0,0.22);
}
.editor-btn-soft {
  background: linear-gradient(180deg, rgba(15,23,42,0.92), rgba(2,6,23,0.92));
}
.editor-btn-primary {
  border-color: rgba(56,189,248,0.4);
  background: linear-gradient(180deg, rgba(14,165,233,0.92), rgba(37,99,235,0.92));
}
.editor-btn-active {
  border-color: rgba(250, 204, 21, 0.42);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.26), rgba(37, 99, 235, 0.2));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 1px rgba(250, 204, 21, 0.08), 0 12px 24px rgba(0,0,0,0.22);
}
.map-editor-topbar-right {
  display: grid;
  gap: 12px;
  justify-items: end;
  min-width: min(100%, 920px);
}
.map-editor-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.map-editor-field {
  display: grid;
  gap: 6px;
  min-width: 250px;
}
.map-editor-field span {
  color: #dce7f8;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.map-editor-select {
  min-height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(56,189,248,0.18);
  background: rgba(7,13,23,0.95);
  color: #fff;
  font-weight: 700;
}
.map-editor-zoom-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  min-height: 46px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.045);
  color: #fff;
  font-weight: 800;
}
.map-editor-toolstrip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.map-tool-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.035);
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.map-tool-chip:hover,
.map-tool-chip.active {
  transform: translateY(-1px);
  border-color: rgba(56,189,248,0.34);
  background: rgba(56,189,248,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 24px rgba(0,0,0,0.18);
}
.map-tool-chip-split {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px;
  align-items: stretch;
  gap: 0;
  padding: 0;
  overflow: visible;
}
.map-tool-chip-split.active,
.map-tool-chip-split:hover {
  transform: translateY(-1px);
  border-color: rgba(56,189,248,0.34);
  background: rgba(56,189,248,0.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 12px 24px rgba(0,0,0,0.18);
}
.map-tool-chip-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 18px 0 0 18px;
}
.map-tool-chip-caret {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  min-height: 58px;
  border: 0;
  border-left: 1px solid rgba(255,255,255,0.08);
  background: transparent;
  color: #fff;
  cursor: pointer;
  border-radius: 0 18px 18px 0;
  flex: 0 0 52px;
}
.map-tool-chip-caret:hover,
.map-tool-chip-main:hover {
  background: rgba(255,255,255,0.03);
}
.map-tool-chip-caret-icon {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-right: 2px solid rgba(255,255,255,0.9);
  border-bottom: 2px solid rgba(255,255,255,0.9);
  transform: rotate(45deg);
  margin-top: -4px;
}
.map-tool-chip-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 140px;
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(56,189,248,0.2);
  background: linear-gradient(180deg, rgba(6,10,18,0.98), rgba(2,6,14,0.98));
  box-shadow: 0 18px 44px rgba(0,0,0,0.42);
  display: grid;
  gap: 6px;
}
.map-tool-chip-menu-item {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: #fff;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.map-tool-chip-menu-item:hover,
.map-tool-chip-menu-item.active {
  border-color: rgba(56,189,248,0.34);
  background: rgba(56,189,248,0.14);
}
.map-tool-chip span:last-child {
  display: grid;
  gap: 3px;
}
.map-tool-chip strong {
  color: #fff;
  font-size: 0.9rem;
}
.map-tool-chip small {
  font-size: 0.74rem;
}
.map-tool-chip-icon,
.legend-badge {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.map-tool-chip-icon::before,
.map-tool-chip-icon::after,
.legend-badge::before,
.legend-badge::after {
  content: '';
  position: absolute;
}
.map-tool-chip-icon-ground,
.legend-badge-ground { background: rgba(203, 213, 225, 0.92); }
.map-tool-chip-icon-ground::before,
.legend-badge-ground::before {
  left: 9px; top: 18px; width: 8px; height: 4px;
  border-left: 3px solid rgba(22, 163, 74, 0.98);
  border-bottom: 3px solid rgba(22, 163, 74, 0.98);
  transform: rotate(-45deg);
}
.map-tool-chip-icon-ground::after,
.legend-badge-ground::after {
  left: 15px; top: 10px; width: 14px; height: 22px;
  border-right: 3px solid rgba(22, 163, 74, 0.98);
  border-bottom: 3px solid rgba(22, 163, 74, 0.98);
  transform: rotate(40deg);
  border-radius: 2px;
}
.map-tool-chip-icon-block,
.legend-badge-block { background: rgba(153, 27, 27, 0.86); }
.map-tool-chip-icon-block::before,
.legend-badge-block::before {
  inset: 8px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.95);
}
.map-tool-chip-icon-block::after,
.legend-badge-block::after {
  left: 10px; right: 10px; top: 17px; height: 2px;
  background: rgba(255,255,255,0.95);
  transform: rotate(-35deg);
  transform-origin: center;
}
.map-tool-chip-icon-grass,
.legend-badge-grass { background: rgba(22, 163, 74, 0.86); }
.map-tool-chip-icon-grass::before,
.legend-badge-grass::before {
  left: 11px; top: 9px; width: 16px; height: 18px;
  background: rgba(255,255,255,0.96);
  border-radius: 70% 0 70% 0;
  transform: rotate(-35deg);
}
.map-tool-chip-icon-grass::after,
.legend-badge-grass::after {
  left: 18px; top: 18px; width: 2px; height: 10px;
  background: rgba(21, 128, 61, 0.95);
  transform: rotate(-35deg);
  border-radius: 999px;
}
.map-tool-chip-icon-water,
.legend-badge-water { background: rgba(37, 99, 235, 0.86); }
.map-tool-chip-icon-water::before,
.legend-badge-water::before {
  left: 12px; top: 7px; width: 14px; height: 20px;
  background: rgba(255,255,255,0.94);
  border-radius: 60% 60% 70% 70% / 45% 45% 100% 100%;
  transform: rotate(45deg);
}
.map-tool-chip-icon-ledge,
.legend-badge-ledge { background: rgba(146, 64, 14, 0.86); }
.map-tool-chip-icon-ledge::before,
.legend-badge-ledge::before {
  left: 17px; top: 7px; width: 4px; height: 16px;
  background: rgba(255,255,255,0.95);
  border-radius: 999px;
}
.map-tool-chip-icon-ledge::after,
.legend-badge-ledge::after {
  left: 11px; top: 17px; width: 16px; height: 16px;
  background: rgba(255,255,255,0.95);
  clip-path: polygon(50% 100%, 0 35%, 30% 35%, 30% 0, 70% 0, 70% 35%, 100% 35%);
}
.map-tool-chip-icon-ledge[data-direction="left"]::before { left: 5px; top: 15px; width: 14px; height: 4px; }
.map-tool-chip-icon-ledge[data-direction="left"]::after { left: 11px; top: 9px; width: 16px; height: 16px; clip-path: polygon(100% 50%, 35% 0, 35% 30%, 0 30%, 0 70%, 35% 70%, 35% 100%); }
.map-tool-chip-icon-ledge[data-direction="right"]::before { left: 15px; top: 15px; width: 14px; height: 4px; }
.map-tool-chip-icon-ledge[data-direction="right"]::after { left: 7px; top: 9px; width: 16px; height: 16px; clip-path: polygon(0 50%, 65% 0, 65% 30%, 100% 30%, 100% 70%, 65% 70%, 65% 100%); }

.map-tool-chip-icon-door,
.legend-badge-door { background: rgba(245, 158, 11, 0.86); }
.map-tool-chip-icon-door::before,
.legend-badge-door::before {
  left: 9px; top: 7px; width: 20px; height: 24px;
  background: rgba(255,255,255,0.96);
  border-radius: 7px 7px 4px 4px;
}
.map-tool-chip-icon-door::after,
.legend-badge-door::after {
  left: 14px; top: 12px; width: 8px; height: 11px;
  background: rgba(146, 64, 14, 0.98);
  border-radius: 2px;
  box-shadow: 10px 5px 0 -2px rgba(146, 64, 14, 0.98);
}
.map-tool-chip-icon-warp,
.legend-badge-warp { background: rgba(124, 58, 237, 0.86); }
.map-tool-chip-icon-warp::before,
.legend-badge-warp::before {
  left: 9px; top: 9px; width: 16px; height: 16px;
  border: 3px solid rgba(255,255,255,0.96);
  border-radius: 999px;
}
.map-tool-chip-icon-warp::after,
.legend-badge-warp::after {
  left: 16px; top: 16px; width: 4px; height: 4px;
  background: rgba(255,255,255,0.96);
  border-radius: 999px;
  box-shadow: 0 -10px 0 0 rgba(255,255,255,0.96), 0 10px 0 0 rgba(255,255,255,0.96), -10px 0 0 0 rgba(255,255,255,0.96), 10px 0 0 0 rgba(255,255,255,0.96);
}
.map-tool-chip-icon-sign,
.legend-badge-sign { background: rgba(255,255,255,0.9); }
.map-tool-chip-icon-sign::before,
.legend-badge-sign::before {
  left: 9px; top: 8px; width: 18px; height: 10px;
  background: rgba(31, 41, 55, 0.95);
  border-radius: 3px;
}
.map-tool-chip-icon-sign::after,
.legend-badge-sign::after {
  left: 17px; top: 18px; width: 4px; height: 13px;
  background: rgba(31, 41, 55, 0.95);
  box-shadow: -5px 11px 0 0 rgba(31, 41, 55, 0.95), 5px 11px 0 0 rgba(31, 41, 55, 0.95);
}

.map-tool-chip-icon-cut-tree,
.legend-badge-cut-tree { background: rgba(21, 128, 61, 0.9); }
.map-tool-chip-icon-cut-tree::before,
.legend-badge-cut-tree::before {
  left: 11px; top: 7px; width: 14px; height: 14px; background: rgba(255,255,255,0.96); border-radius: 999px; box-shadow: -7px 6px 0 0 rgba(255,255,255,0.96), 7px 6px 0 0 rgba(255,255,255,0.96);
}
.map-tool-chip-icon-cut-tree::after,
.legend-badge-cut-tree::after {
  left: 16px; top: 19px; width: 4px; height: 11px; background: rgba(120,53,15,0.98); box-shadow: -6px 8px 0 -1px rgba(255,255,255,0.9); transform: rotate(34deg); border-radius: 999px;
}
.map-tool-chip-icon-boulder,
.legend-badge-boulder { background: rgba(120, 113, 108, 0.9); }
.map-tool-chip-icon-boulder::before,
.legend-badge-boulder::before {
  left: 8px; top: 8px; width: 20px; height: 17px; background: rgba(255,255,255,0.96); border-radius: 44% 56% 58% 42% / 48% 40% 60% 52%; transform: rotate(-10deg);
}
.map-tool-chip-icon-boulder::after,
.legend-badge-boulder::after {
  left: 13px; top: 15px; width: 11px; height: 2px; background: rgba(71,85,105,0.95); box-shadow: -3px -5px 0 0 rgba(71,85,105,0.95), 2px 5px 0 0 rgba(71,85,105,0.95); transform: rotate(-18deg);
}
.map-tool-chip-icon-clear { background: rgba(100, 116, 139, 0.86); }
.map-tool-chip-icon-clear::before,
.map-tool-chip-icon-clear::after {
  left: 9px; right: 9px; top: 18px; height: 2px; background: rgba(255,255,255,0.95);
}
.map-tool-chip-icon-clear::before { transform: rotate(45deg); }
.map-tool-chip-icon-clear::after { transform: rotate(-45deg); }
.map-editor-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: start;
}
.map-editor-canvas-panel {
  display: grid;
  gap: 14px;
}
.map-editor-canvas-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}
.map-editor-canvas-head h2 {
  margin: 0 0 8px;
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  font-family: var(--font-heavy);
}
.map-editor-canvas-head p { margin: 0; color: var(--muted); }
.map-editor-canvas-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}
.map-editor-canvas-shell-pro {
  min-height: min(75vh, 980px);
  overflow: auto;
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.08);
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.92), rgba(4, 8, 16, 0.96));
  padding: 16px;
}
.map-editor-canvas-shell-pro canvas {
  display: block;
  margin: 0 auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
  border-radius: 18px;
  box-shadow: 0 18px 36px rgba(0,0,0,0.32);
}
.map-editor-help-panel {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 92px;
}
.map-editor-help-card {
  border-radius: 22px;
}
.map-editor-help-steps,
.map-editor-bullet-list,
.map-editor-legend-pro {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}
.map-editor-legend-pro {
  list-style: none;
  padding-left: 0;
}
.map-editor-legend-pro li {
  display: flex;
  align-items: center;
  gap: 12px;
}
.map-editor-legend-pro div {
  display: grid;
  gap: 2px;
}
.map-editor-legend-pro strong,
.map-editor-help-card strong {
  color: #fff;
}
.map-editor-text-input,
.map-editor-textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(4, 10, 20, 0.92);
  color: #fff;
  font: inherit;
  resize: vertical;
}
.map-editor-text-input:focus,
.map-editor-textarea:focus {
  outline: none;
  border-color: rgba(56,189,248,0.4);
  box-shadow: 0 0 0 4px rgba(56,189,248,0.12);
}
.map-editor-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
}
.map-editor-modal {
  width: min(560px, 100%);
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.1);
  background: linear-gradient(180deg, rgba(10, 16, 28, 0.98), rgba(3, 7, 16, 0.98));
  box-shadow: 0 30px 60px rgba(0,0,0,0.38);
  padding: 20px;
  display: grid;
  gap: 16px;
}
.map-editor-modal-head,
.map-editor-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.map-editor-modal-head h2 { margin: 2px 0 0; color: #fff; font-size: 1.35rem; }
.map-editor-modal-body { display: grid; gap: 14px; }
.map-editor-icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04); color: #fff; font: inherit; font-size: 1.3rem; font-weight: 800; cursor: pointer;
}
.map-editor-modal-backdrop[hidden] { display: none; }

.map-editor-toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1400;
  display: grid;
  gap: 10px;
  pointer-events: none;
}
.map-editor-toast {
  min-width: min(360px, calc(100vw - 32px));
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(8, 12, 22, 0.96);
  box-shadow: 0 18px 34px rgba(0,0,0,0.3);
  color: #fff;
  display: grid;
  gap: 3px;
  transform: translateY(10px);
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}
.map-editor-toast.visible {
  transform: translateY(0);
  opacity: 1;
}
.map-editor-toast strong { font-size: .95rem; }
.map-editor-toast span { color: var(--muted); }
.map-editor-toast-success { border-color: rgba(34,197,94,0.22); }
.map-editor-toast-error { border-color: rgba(239,68,68,0.22); }
.map-editor-toast-info { border-color: rgba(56,189,248,0.22); }
.editor-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none !important;
}
.editor-status-pill-live {
  border-color: rgba(250, 204, 21, 0.32) !important;
  color: #fff2a8 !important;
}
@media (max-width: 1280px) {
  .map-editor-toolstrip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .map-editor-workspace { grid-template-columns: 1fr; }
  .map-editor-help-panel { position: static; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .map-tool-chip-split { grid-column: span 3; }

  .map-editor-topbar,
  .map-editor-canvas-head { flex-direction: column; }
  .map-editor-topbar-right,
  .map-editor-toolbar-actions,
  .map-editor-canvas-status { justify-items: start; justify-content: flex-start; min-width: 0; }
  .map-editor-opacity { width: 100%; justify-content: space-between; }
  .map-editor-help-panel { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .map-editor-pro-shell { padding: 16px 12px 32px; }
  .map-editor-pro-panel { padding: 14px; }
  .map-editor-toolstrip { grid-template-columns: 1fr; }
  .map-tool-chip { min-height: 54px; }
  .map-editor-modal { padding: 16px; border-radius: 20px; }
  .map-editor-modal-head, .map-editor-modal-actions { flex-direction: column; align-items: stretch; }
  .map-editor-canvas-shell-pro { min-height: 56vh; padding: 10px; }
  .map-editor-text-input,
.map-editor-textarea {
  width: 100%;
  padding: 13px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(4, 10, 20, 0.92);
  color: #fff;
  font: inherit;
  resize: vertical;
}
.map-editor-text-input:focus,
.map-editor-textarea:focus {
  outline: none;
  border-color: rgba(56,189,248,0.4);
  box-shadow: 0 0 0 4px rgba(56,189,248,0.12);
}
.map-editor-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(6px);
}
.map-editor-modal {
  width: min(560px, 100%);
  border-radius: 24px;
  border: 1px solid rgba(255,255,255,0.1);
  background: linear-gradient(180deg, rgba(10, 16, 28, 0.98), rgba(3, 7, 16, 0.98));
  box-shadow: 0 30px 60px rgba(0,0,0,0.38);
  padding: 20px;
  display: grid;
  gap: 16px;
}
.map-editor-modal-head,
.map-editor-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.map-editor-modal-head h2 { margin: 2px 0 0; color: #fff; font-size: 1.35rem; }
.map-editor-modal-body { display: grid; gap: 14px; }
.map-editor-icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04); color: #fff; font: inherit; font-size: 1.3rem; font-weight: 800; cursor: pointer;
}
.map-editor-modal-backdrop[hidden] { display: none; }

.map-editor-toast-stack { right: 12px; left: 12px; bottom: 14px; }
  .map-editor-toast { min-width: 0; max-width: none; }
}


/* MAP EDITOR COMPACT LAYOUT OVERRIDES */
.map-editor-topbar { align-items: end; margin-bottom: 14px; }
.map-editor-topbar-right { min-width: 280px; justify-items: stretch; }
.map-editor-toolbar-actions-inline { justify-content: flex-start; margin-bottom: 10px; }
.map-editor-toolbar-actions-inline .editor-btn,
.map-editor-toolbar-actions-inline .map-editor-zoom-pill { min-height: 40px; }
.map-editor-mapbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.map-editor-mapbar h2 {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.7rem);
  font-family: var(--font-heavy);
}
.map-editor-inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: unset;
  padding: 0;
  border: 0;
  background: transparent;
}
#mapMetaInline {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  font-weight: 800;
  color: #dbe8fb;
}
.editor-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
  font-size: .88rem;
  font-weight: 700;
}
.map-editor-workspace { grid-template-columns: minmax(0, 1fr) 280px; }
.map-editor-help-panel { position: sticky; top: 92px; }
.map-editor-tools-card { padding: 16px; }
.map-editor-toolpanel-head { margin-bottom: 12px; }
.map-editor-toolpanel-head p { margin: 4px 0 0; color: var(--muted); }
.map-editor-toolstrip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 0;
}
.map-tool-chip {
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 16px;
  gap: 12px;
}
.map-tool-chip span:last-child { min-width: 0; }
.map-tool-chip strong { font-size: .93rem; line-height: 1.1; }
.map-tool-chip small { font-size: .75rem; line-height: 1.15; }
.map-tool-chip-icon, .legend-badge {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  border-radius: 12px;
}
.map-tool-chip-icon-door::before, .legend-badge-door::before {
  left: 11px; top: 6px; width: 16px; height: 24px; background: rgba(255,255,255,.96); border-radius: 7px 7px 3px 3px;
}
.map-tool-chip-icon-door::after, .legend-badge-door::after {
  left: 19px; top: 18px; width: 3px; height: 3px; background: rgba(146,64,14,.98); border-radius: 999px; box-shadow: none;
}
.map-tool-chip-icon-sign::before, .legend-badge-sign::before { left: 8px; top: 8px; width: 20px; height: 11px; border-radius: 3px; }
.map-tool-chip-icon-sign::after, .legend-badge-sign::after { left: 17px; top: 19px; width: 4px; height: 11px; background: rgba(31,41,55,.95); box-shadow: none; }
.map-tool-chip-icon-warp::before, .legend-badge-warp::before { left: 10px; top: 10px; width: 14px; height: 14px; }
.map-tool-chip-icon-warp::after, .legend-badge-warp::after { left: 17px; top: 17px; width: 4px; height: 4px; box-shadow: 0 -9px 0 0 rgba(255,255,255,.96), 0 9px 0 0 rgba(255,255,255,.96), -9px 0 0 0 rgba(255,255,255,.96), 9px 0 0 0 rgba(255,255,255,.96); }
.map-editor-canvas-panel { gap: 0; }
.map-editor-canvas-shell-pro { min-height: min(68vh, 860px); }
@media (max-width: 1280px) {
  .map-editor-workspace { grid-template-columns: 1fr; }
  .map-editor-help-panel { position: static; }
}
@media (max-width: 980px) {
  .map-tool-chip-split { grid-column: span 3; }

  .map-editor-mapbar { flex-direction: column; align-items: flex-start; }
  .map-editor-inline-meta { width: 100%; }
  .map-editor-toolbar-actions-inline { justify-content: flex-start; }
}
@media (max-width: 760px) {
  .map-editor-toolbar-actions-inline { gap: 6px; }
  .map-editor-toolbar-actions-inline .editor-btn, .map-editor-toolbar-actions-inline .map-editor-zoom-pill { min-height: 38px; padding: 0 12px; }
  .map-editor-toolstrip { display: grid; grid-template-columns: 1fr; }
}


/* Warp destination modal */
.map-editor-modal-wide { max-width: min(1100px, 94vw); }
.map-editor-modal-body-grid { grid-template-columns: minmax(0, 1fr) 260px; align-items: start; }
.map-editor-modal-main { display: grid; gap: 14px; min-width: 0; }
.map-editor-modal-row { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.warp-preview-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.warp-preview-scroller { overflow: auto; max-height: min(68vh, 620px); border: 1px solid rgba(148, 163, 184, 0.18); border-radius: 18px; background: rgba(4, 10, 22, 0.9); padding: 12px; }
.warp-preview-inner { position: relative; width: max-content; min-width: 100%; }
.warp-preview-inner img,
.warp-preview-inner canvas { display: block; max-width: none; }
.warp-preview-inner canvas { position: absolute; inset: 0; cursor: crosshair; }
.warp-modal-tipbox { min-height: 100%; }
.warp-modal-tipbox p { margin: 0; color: rgba(226, 232, 240, 0.82); line-height: 1.55; }
.warp-modal-tipbox p + p { margin-top: 10px; }
@media (max-width: 980px) {
  .map-tool-chip-split { grid-column: span 3; }

  .map-editor-modal-body-grid, .map-editor-modal-row { grid-template-columns: 1fr; }
}

/* Warp modal tidy pass */
.map-editor-modal-head-tight {
  align-items: flex-start;
  gap: 16px;
}
.map-editor-modal-body-single {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.map-editor-modal-wide {
  max-width: min(1000px, 94vw);
}
.warp-modal-body-clean {
  gap: 16px;
}
.warp-modal-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1.35fr) minmax(180px, 0.8fr) minmax(220px, 1fr);
  gap: 14px;
  align-items: end;
}
.warp-modal-controls .map-editor-field {
  min-width: 0;
}
.warp-modal-controls .map-editor-select,
.warp-modal-controls input[type="range"] {
  width: 100%;
}
.warp-preview-toolbar-clean {
  gap: 10px;
}
.warp-preview-toolbar-clean .editor-status-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
}
.warp-preview-card {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(8, 14, 30, 0.92), rgba(4, 10, 22, 0.98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  padding: 12px;
}
.warp-preview-scroller {
  overflow: auto;
  max-height: min(68vh, 620px);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 18px;
  background: rgba(3, 8, 19, 0.88);
  padding: 10px;
}
.warp-preview-inner {
  position: relative;
  width: max-content;
  min-width: 100%;
}
.warp-preview-inner img,
.warp-preview-inner canvas {
  display: block;
  max-width: none;
}
.warp-preview-inner img {
  border-radius: 12px;
}
.warp-preview-inner canvas {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}
@media (max-width: 900px) {
  .warp-modal-controls {
    grid-template-columns: 1fr;
  }
  .map-editor-modal-wide {
    max-width: min(96vw, 760px);
  }
}


.map-tool-chip-danger {
  border-color: rgba(255, 114, 114, 0.38);
}

.map-tool-chip-danger:hover,
.map-tool-chip-danger:focus-visible {
  border-color: rgba(255, 114, 114, 0.68);
  box-shadow: 0 0 0 1px rgba(255, 114, 114, 0.16), 0 18px 28px rgba(6, 10, 24, 0.48);
}


/* MAP EDITOR grouped selectors + sidebar cleanup */
.map-editor-selector-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) minmax(280px, 1.25fr);
  gap: 12px;
  width: min(100%, 980px);
}
.map-editor-search-input {
  min-height: 48px;
}
.map-editor-mapbar {
  margin-bottom: 10px;
}
.map-editor-save-readout[hidden] {
  display: none !important;
}
.map-editor-sidebar-status {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.map-editor-sidebar-status #mapMetaInline,
.map-editor-sidebar-status .editor-status-pill {
  width: 100%;
  justify-content: flex-start;
}
.map-editor-sidebar-overlay {
  margin-bottom: 14px;
}
.map-editor-opacity-sidebar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}
.map-editor-opacity-sidebar span {
  margin: 0;
  color: #dce7f8;
  font-weight: 800;
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.map-editor-opacity-sidebar input[type="range"] {
  width: 100%;
}
.map-editor-opacity-sidebar strong {
  min-width: 44px;
  text-align: right;
  color: #fff;
}
@media (max-width: 1180px) {
  .map-editor-selector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .map-editor-field-map {
    grid-column: 1 / -1;
  }
}
@media (max-width: 760px) {
  .map-editor-selector-grid {
    grid-template-columns: 1fr;
  }
  .map-editor-field-map {
    grid-column: auto;
  }
}


/* MAP EDITOR compact filter row + routes grouping polish */
.map-editor-topbar {
  align-items: end;
}
.map-editor-topbar-right {
  justify-items: stretch;
  min-width: min(100%, 980px);
}
.map-editor-selector-grid {
  grid-template-columns: minmax(280px, 1.35fr) minmax(220px, 1fr) minmax(220px, 1fr);
  align-items: end;
}
.map-editor-field {
  min-width: 0;
}
.map-editor-field-search {
  min-width: 0;
}
.map-editor-sidebar-status-minimal {
  margin-bottom: 10px;
}
.map-editor-sidebar-status-minimal .editor-status-pill {
  width: 100%;
  justify-content: flex-start;
}
.map-editor-mapbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.map-editor-mapbar h2 {
  margin: 0;
}
@media (max-width: 1180px) {
  .map-editor-selector-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }
  .map-editor-field-map {
    grid-column: auto;
  }
  .map-editor-field-search {
    grid-column: 1 / -1;
  }
}
@media (max-width: 760px) {
  .map-editor-topbar {
    align-items: flex-start;
  }
  .map-editor-selector-grid {
    grid-template-columns: 1fr;
  }
  .map-editor-field-search,
  .map-editor-field-group,
  .map-editor-field-map {
    grid-column: auto;
  }
}


/* MAP EDITOR area/location row bugfix */
.map-editor-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(480px, 760px);
  align-items: end;
  gap: 20px;
}
.map-editor-topbar-left,
.map-editor-heading {
  min-width: 0;
}
.map-editor-topbar-right {
  min-width: 0;
  width: 100%;
}
.map-editor-selector-grid {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.map-editor-field-group,
.map-editor-field-map {
  min-width: 0;
}
.map-editor-select {
  width: 100%;
}
@media (max-width: 1180px) {
  .map-editor-topbar {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
  .map-editor-selector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .map-editor-selector-grid {
    grid-template-columns: 1fr;
  }
}




/* GAME sign popup redesign + sign editor polish */
.dialog-box {
  position: absolute;
  left: 50%;
  right: auto;
  bottom: clamp(92px, 12vh, 138px);
  transform: translateX(-50%) translateY(10px);
  width: min(448px, calc(100% - 96px));
  max-width: calc(100% - 96px);
  min-height: 108px;
  padding: 12px 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0;
  background:
    repeating-linear-gradient(
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.04) 2px,
      rgba(0, 0, 0, 0.04) 4px
    ),
    linear-gradient(to bottom, #ffffff 0%, #e5e5e5 100%);
  border: 6px solid #b0b0b0;
  border-radius: 12px;
  box-shadow:
    inset 2px 2px 0 #ffffff,
    inset -2px -2px 0 #707070,
    -2px -2px 0 #ffffff,
    2px 2px 0 #707070,
    4px 6px 10px rgba(0, 0, 0, 0.3);
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9;
}

.dialog-box.hidden {
  display: flex;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(18px);
}

.dialog-box[hidden] {
  display: none !important;
}

.dialog-title {
  display: none !important;
}

.dialog-text {
  color: #333333;
  font-family: 'VT323', monospace;
  font-size: clamp(26px, 2.15vw, 33px);
  line-height: 1.02;
  letter-spacing: 0.005em;
  text-shadow: 1px 1px 0 #ffffff;
  min-height: calc(2.04em + 2px);
  margin: 0;
  padding: 1px 28px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
}

.dialog-arrow {
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid #ffffff;
  filter: drop-shadow(0px 2px 0px #333333) drop-shadow(0px -2px 0px #333333) drop-shadow(2px 0px 0px #333333) drop-shadow(-2px 0px 0px #333333);
  position: absolute;
  right: 16px;
  bottom: 10px;
  animation: dialogArrowBounce 1s infinite;
}

.dialog-arrow.hidden {
  display: none;
}

@keyframes dialogArrowBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

.sign-editor-modal-body {
  display: grid;
  gap: 18px;
  padding-top: 6px;
}

#signModal .map-editor-modal {
  width: min(760px, 94vw);
  max-width: min(760px, 94vw);
  max-height: min(88vh, 900px);
}

#signModal .map-editor-modal-body {
  overflow: auto;
}

.sign-text-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg, rgba(9,16,34,0.86), rgba(5,10,22,0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.sign-text-panel small {
  color: rgba(220,231,248,0.72);
  line-height: 1.45;
}

.sign-single-textarea {
  min-height: 180px;
  resize: vertical;
}

@media (max-width: 760px) {
  .dialog-box {
    width: min(92vw, 460px);
    max-width: min(92vw, 460px);
    min-height: 96px;
    bottom: 24px;
    padding: 10px 14px 18px;
  }
  .dialog-text {
    font-size: clamp(21px, 5.1vw, 28px);
    min-height: calc(2.04em + 2px);
    padding-right: 24px;
  }
}

/* MAP EDITOR warp modal final layout fix */
.map-editor-modal.warp-modal-shell {
  width: min(1180px, 96vw);
  max-width: min(1180px, 96vw);
  max-height: min(92vh, 980px);
  overflow: hidden;
}
.warp-modal-head-clean {
  padding-bottom: 2px;
}
.warp-modal-body-clean {
  gap: 18px;
  min-width: 0;
}
.warp-modal-intro-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(59,130,246,0.2);
  background: linear-gradient(180deg, rgba(10,18,34,0.9), rgba(5,11,24,0.96));
}
.warp-modal-intro-card h3 {
  margin: 0 0 4px;
  color: #edf5ff;
  font-size: 1.06rem;
}
.warp-modal-intro-card p {
  margin: 0;
  color: rgba(226,232,240,0.82);
  line-height: 1.5;
}
.warp-modal-intro-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(96,165,250,0.26);
  background: rgba(59,130,246,0.12);
  color: #dbeafe;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
}
.warp-modal-controls-clean {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(220px, 0.9fr) minmax(280px, 1.15fr);
  gap: 16px;
  align-items: end;
}
.warp-modal-map-field,
.warp-modal-facing-field,
.warp-modal-zoom-field-clean {
  min-width: 0;
}
.warp-modal-zoom-field-clean {
  display: grid;
  gap: 8px;
}
.warp-modal-zoom-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.warp-modal-zoom-row input[type="range"] {
  width: 100%;
  min-width: 0;
}
#warpPreviewZoomValue {
  min-width: 54px;
  text-align: right;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
}
.warp-preview-toolbar-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.warp-preview-toolbar-grid .editor-status-pill {
  width: 100%;
  min-width: 0;
  justify-content: flex-start;
}
.warp-preview-card-clean {
  padding: 14px;
}
.warp-preview-card-clean .warp-preview-scroller {
  max-height: min(62vh, 700px);
  min-height: 420px;
  padding: 12px;
}
.warp-preview-card-clean .warp-preview-inner {
  min-width: max-content;
}
@media (max-width: 1024px) {
  .map-editor-modal.warp-modal-shell {
    width: min(96vw, 900px);
    max-width: min(96vw, 900px);
  }
  .warp-modal-controls-clean {
    grid-template-columns: minmax(0, 1fr) minmax(200px, 0.8fr);
  }
  .warp-modal-zoom-field-clean {
    grid-column: 1 / -1;
  }
  .warp-preview-toolbar-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .map-editor-modal.warp-modal-shell {
    width: min(96vw, 640px);
    max-width: min(96vw, 640px);
    max-height: 94vh;
  }
  .warp-modal-intro-card,
  .warp-modal-controls-clean,
  .warp-modal-zoom-row,
  .warp-preview-toolbar-grid {
    grid-template-columns: 1fr;
  }
  #warpPreviewZoomValue {
    text-align: left;
  }
  .warp-preview-card-clean .warp-preview-scroller {
    min-height: 300px;
  }
}

/* 2026-03-20: map editor visual refresh */
.map-editor-topbar {
  grid-template-columns: minmax(0, 1fr) minmax(460px, 760px);
  align-items: end;
  gap: 24px;
  margin-bottom: 18px;
}

.map-editor-topbar-right {
  display: grid;
  gap: 14px;
  justify-items: stretch;
  align-self: stretch;
}

.map-editor-topbar-meta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.map-editor-current-map {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.map-editor-meta-label {
  color: rgba(219, 232, 251, 0.74);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.map-editor-current-map strong {
  display: block;
  color: #fff;
  font-family: var(--font-heavy);
  font-size: clamp(1.55rem, 2.2vw, 2.2rem);
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-editor-cursor-pill,
.map-editor-save-readout {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.18);
  background: linear-gradient(180deg, rgba(14, 23, 40, 0.94), rgba(5, 10, 21, 0.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
  color: #dbe8fb;
}

.map-editor-selector-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.map-editor-field span {
  margin-bottom: 2px;
}

.map-editor-select {
  min-height: 50px;
  border-radius: 16px;
  border-color: rgba(56, 189, 248, 0.16);
  background: linear-gradient(180deg, rgba(7,13,23,0.96), rgba(4,9,18,0.98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.map-editor-toolbar-actions-inline {
  gap: 10px;
  margin-bottom: 12px;
}

.editor-btn,
.map-editor-zoom-pill {
  position: relative;
  overflow: hidden;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(19, 31, 54, 0.96), rgba(7, 13, 26, 0.98));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.07), 0 10px 24px rgba(0,0,0,0.22);
}

.editor-btn::before,
.map-editor-zoom-pill::before {
  content: '';
  position: absolute;
  inset: 1px 1px auto 1px;
  height: 48%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.2), rgba(255,255,255,0.03));
  pointer-events: none;
}

.editor-btn-soft {
  background: linear-gradient(180deg, rgba(18, 30, 54, 0.96), rgba(6, 12, 24, 0.98));
}

.editor-btn-primary {
  border-color: rgba(96, 165, 250, 0.4);
  background: linear-gradient(180deg, rgba(49, 138, 247, 0.98), rgba(28, 94, 214, 0.98));
}

.editor-btn-active {
  border-color: rgba(96, 165, 250, 0.42);
  background: linear-gradient(180deg, rgba(29, 78, 216, 0.72), rgba(16, 48, 120, 0.88));
}

.editor-btn:hover,
.map-tool-chip:hover,
.map-tool-chip.active {
  transform: translateY(-1px);
}

.map-editor-zoom-pill {
  min-width: 78px;
  font-weight: 900;
}

.map-editor-mapbar-minimal {
  justify-content: flex-end;
  min-height: 0;
  margin: 0 0 10px;
}

.map-editor-mapbar-minimal .map-editor-save-readout[hidden] {
  display: none !important;
}

.map-editor-help-card {
  padding: 14px;
}

.map-editor-sidebar-overlay {
  margin-bottom: 10px;
}

.map-editor-opacity-sidebar {
  min-height: 64px;
  padding: 10px 12px;
  border-radius: 16px;
}

.map-editor-toolstrip {
  gap: 8px;
}

.map-tool-chip,
.map-tool-chip-main,
.map-tool-chip-caret {
  min-height: 52px;
}

.map-tool-chip {
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(180deg, rgba(14, 23, 40, 0.92), rgba(6, 10, 20, 0.95));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.map-tool-chip-main {
  padding: 8px 10px;
  border-radius: 14px 0 0 14px;
}

.map-tool-chip-caret {
  width: 48px;
  min-width: 48px;
  border-radius: 0 14px 14px 0;
}

.map-tool-chip span:last-child {
  gap: 2px;
}

.map-tool-chip strong {
  font-size: .88rem;
}

.map-tool-chip small {
  font-size: .72rem;
  color: rgba(219, 232, 251, 0.7);
}

.map-tool-chip-icon,
.legend-badge {
  width: 32px;
  height: 32px;
  flex-basis: 32px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 18px 18px;
}

.map-tool-chip-menu {
  min-width: 148px;
}

.map-tool-chip-menu[hidden] {
  display: none !important;
}

.map-tool-chip-icon-ground,
.legend-badge-ground {
  background: linear-gradient(180deg, rgba(226, 232, 240, 0.96), rgba(203, 213, 225, 0.96));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316a34a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
.map-tool-chip-icon-ground::before,
.map-tool-chip-icon-ground::after,
.legend-badge-ground::before,
.legend-badge-ground::after,
.map-tool-chip-icon-block::before,
.map-tool-chip-icon-block::after,
.legend-badge-block::before,
.legend-badge-block::after,
.map-tool-chip-icon-grass::before,
.map-tool-chip-icon-grass::after,
.legend-badge-grass::before,
.legend-badge-grass::after,
.map-tool-chip-icon-water::before,
.map-tool-chip-icon-water::after,
.legend-badge-water::before,
.legend-badge-water::after,
.map-tool-chip-icon-door::before,
.map-tool-chip-icon-door::after,
.legend-badge-door::before,
.legend-badge-door::after,
.map-tool-chip-icon-warp::before,
.map-tool-chip-icon-warp::after,
.legend-badge-warp::before,
.legend-badge-warp::after,
.map-tool-chip-icon-sign::before,
.map-tool-chip-icon-sign::after,
.legend-badge-sign::before,
.legend-badge-sign::after,
.map-tool-chip-icon-cut-tree::before,
.map-tool-chip-icon-cut-tree::after,
.legend-badge-cut-tree::before,
.legend-badge-cut-tree::after,
.map-tool-chip-icon-boulder::before,
.map-tool-chip-icon-boulder::after,
.legend-badge-boulder::before,
.legend-badge-boulder::after,
.map-tool-chip-icon-clear::before,
.map-tool-chip-icon-clear::after,
.legend-badge-clear::before,
.legend-badge-clear::after {
  display: none;
}

.map-tool-chip-icon-block,
.legend-badge-block {
  background-color: rgba(153, 27, 27, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M8.5 15.5 15.5 8.5'/%3E%3C/svg%3E");
}

.map-tool-chip-icon-grass,
.legend-badge-grass {
  background-color: rgba(22, 163, 74, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M18.5 3c-4.2.6-8 3.4-9.6 7.1-1 2.1-1.2 4.4-.8 6.3-2.2-1-4-2.7-5.1-4.8-.1 6 4 9.4 8.8 9.4 5.5 0 9.7-4.4 9.7-10.3 0-2.8-1-5.6-3-7.7Z'/%3E%3Cpath d='M7 19c2-3.8 5.6-7 10.4-9.2' stroke='%23166534' stroke-width='2' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
}

.map-tool-chip-icon-water,
.legend-badge-water {
  background-color: rgba(37, 99, 235, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2c2.2 3.2 6.5 7.3 6.5 11.3A6.5 6.5 0 1 1 5.5 13.3C5.5 9.3 9.8 5.2 12 2Z'/%3E%3C/svg%3E");
}

.map-tool-chip-icon-ledge,
.legend-badge-ledge {
  background-color: rgba(161, 98, 7, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v12'/%3E%3Cpath d='m7 12 5 5 5-5'/%3E%3C/svg%3E");
}

.map-tool-chip-icon-ledge[data-direction='left'],
.legend-badge-ledge[data-direction='left'] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 12H7'/%3E%3Cpath d='m12 7-5 5 5 5'/%3E%3C/svg%3E");
}

.map-tool-chip-icon-ledge[data-direction='right'],
.legend-badge-ledge[data-direction='right'] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h12'/%3E%3Cpath d='m12 7 5 5-5 5'/%3E%3C/svg%3E");
}

.map-tool-chip-icon-door,
.legend-badge-door {
  background-color: rgba(217, 119, 6, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 21V7.8A1.8 1.8 0 0 1 7.8 6h8.4A1.8 1.8 0 0 1 18 7.8V21'/%3E%3Cpath d='M9 21V4h6v17'/%3E%3Ccircle cx='14.4' cy='12.2' r='.9' fill='white' stroke='none'/%3E%3C/svg%3E");
}

.map-tool-chip-icon-warp,
.legend-badge-warp {
  background-color: rgba(37, 99, 235, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v16'/%3E%3Cpath d='M4 12h16'/%3E%3Ccircle cx='12' cy='12' r='3.5' fill='white' fill-opacity='.18'/%3E%3C/svg%3E");
}

.map-tool-chip-icon-sign,
.legend-badge-sign {
  background-color: rgba(71, 85, 105, 0.94);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 6h10l-1.4 5H7z'/%3E%3Cpath d='M12 11v8'/%3E%3C/svg%3E");
}

.map-tool-chip-icon-cut-tree,
.legend-badge-cut-tree {
  background-color: rgba(21, 128, 61, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3 7 9h3l-3 4h3l-3 4h10l-3-4h3l-3-4h3z' fill='white' fill-opacity='.18'/%3E%3Cpath d='M12 17v4'/%3E%3Cpath d='m6 6 12 12' stroke='%23dc2626'/%3E%3C/svg%3E");
}

.map-tool-chip-icon-boulder,
.legend-badge-boulder {
  background-color: rgba(120, 53, 15, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M7 8.5 11.5 5h4L19 8l1 5-3 5H7l-3-4 1-4.5z' opacity='.95'/%3E%3C/svg%3E");
}

.map-tool-chip-icon-clear,
.legend-badge-clear {
  background-color: rgba(71, 85, 105, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E");
}

#ledgeDirectionToggle[aria-expanded='true'] .map-tool-chip-caret-icon {
  transform: rotate(225deg);
  margin-top: 2px;
}

@media (max-width: 1180px) {
  .map-editor-topbar {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  .map-editor-topbar-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .map-editor-current-map strong,
  .map-editor-cursor-pill {
    white-space: normal;
  }

  .map-editor-toolbar-actions-inline {
    gap: 8px;
  }

  .editor-btn,
  .map-editor-zoom-pill {
    min-height: 40px;
    padding: 0 13px;
  }
}


/* MAP EDITOR polish follow-up: darker native dropdowns + ledge chip sizing */
.map-editor-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  color-scheme: dark;
  background-image:
    linear-gradient(180deg, rgba(7,13,23,0.96), rgba(4,9,18,0.98)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='m5 7 5 6 5-6' stroke='%23dbeafe' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, calc(100% - 14px) 50%;
  background-size: auto, 14px 14px;
  padding-right: 42px;
}

.map-editor-select option,
.map-editor-select optgroup {
  background: #08111f;
  color: #eef6ff;
}

.map-tool-chip-label-single {
  display: flex !important;
  align-items: center;
}

#ledgeDirectionLabel {
  display: none;
}

.map-tool-chip-split {
  grid-template-columns: minmax(0, 1fr) 48px;
}

.map-tool-chip-split .map-tool-chip-main,
.map-tool-chip-split .map-tool-chip-caret {
  min-height: 52px;
}

.map-tool-chip-split .map-tool-chip-main {
  padding-top: 8px;
  padding-bottom: 8px;
}

.map-tool-chip-icon-ledge,
.legend-badge-ledge {
  background-color: rgba(161, 98, 7, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M10.25 5.8c.85-.62 2-.97 3.1-.8 1.63.25 2.9 1.52 3.16 3.15.18 1.13-.16 2.29-.82 3.15-.38.5-.57 1.09-.57 1.7v1.1h-3.1v-1.7c0-.62.2-1.21.58-1.71.25-.32.38-.71.32-1.14-.1-.7-.66-1.26-1.36-1.37-.51-.08-.98.08-1.34.35-.38.29-.87.41-1.34.29-.64-.15-1.1-.72-1.11-1.38 0-.62.28-1.16.78-1.54Z' fill='white'/%3E%3Cpath d='M9.3 15.1c1.06 1.22 2.57 1.87 4.25 1.87 1.08 0 2.1-.28 3.04-.83' stroke='white' stroke-width='1.9' stroke-linecap='round'/%3E%3Cpath d='M10.9 17.7c.66.72 1.58 1.1 2.62 1.1.87 0 1.7-.27 2.37-.78' stroke='white' stroke-width='1.9' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 18px 18px;
}

.map-tool-chip-icon-ledge[data-direction='left'],
.legend-badge-ledge[data-direction='left'],
.map-tool-chip-icon-ledge[data-direction='right'],
.legend-badge-ledge[data-direction='right'] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M10.25 5.8c.85-.62 2-.97 3.1-.8 1.63.25 2.9 1.52 3.16 3.15.18 1.13-.16 2.29-.82 3.15-.38.5-.57 1.09-.57 1.7v1.1h-3.1v-1.7c0-.62.2-1.21.58-1.71.25-.32.38-.71.32-1.14-.1-.7-.66-1.26-1.36-1.37-.51-.08-.98.08-1.34.35-.38.29-.87.41-1.34.29-.64-.15-1.1-.72-1.11-1.38 0-.62.28-1.16.78-1.54Z' fill='white'/%3E%3Cpath d='M9.3 15.1c1.06 1.22 2.57 1.87 4.25 1.87 1.08 0 2.1-.28 3.04-.83' stroke='white' stroke-width='1.9' stroke-linecap='round'/%3E%3Cpath d='M10.9 17.7c.66.72 1.58 1.1 2.62 1.1.87 0 1.7-.27 2.37-.78' stroke='white' stroke-width='1.9' stroke-linecap='round'/%3E%3C/svg%3E");
}


/* 2026-03-20: warp modal usability + icon cleanup */
.map-editor-modal-backdrop {
  overflow-y: auto;
}

.map-editor-modal.warp-modal-shell {
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 940px);
}

.warp-modal-body-clean {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 4px;
}

.warp-modal-body-clean::-webkit-scrollbar {
  width: 10px;
}

.warp-modal-body-clean::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 999px;
}

.map-editor-modal.warp-modal-shell .map-editor-modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding-top: 14px;
  margin-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.14);
  background: linear-gradient(180deg, rgba(7, 13, 24, 0.15), rgba(7, 13, 24, 0.98) 28%);
}

.warp-modal-controls-clean {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(200px, 0.82fr) minmax(240px, 1fr);
}

.warp-modal-area-field,
.warp-modal-map-field,
.warp-modal-facing-field,
.warp-modal-zoom-field-clean {
  min-width: 0;
}

@media (max-width: 1100px) {
  .warp-modal-controls-clean {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .warp-modal-zoom-field-clean {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .map-editor-modal.warp-modal-shell {
    max-height: 94vh;
  }

  .warp-modal-body-clean {
    padding-right: 0;
  }

  .warp-modal-controls-clean {
    grid-template-columns: 1fr;
  }
}

.map-tool-chip-split {
  min-height: 52px;
  align-items: stretch;
}

.map-tool-chip-split .map-tool-chip-main,
.map-tool-chip-split .map-tool-chip-caret {
  height: 100%;
}

.map-tool-chip-icon-ledge,
.legend-badge-ledge,
.map-tool-chip-icon-ledge[data-direction='left'],
.legend-badge-ledge[data-direction='left'],
.map-tool-chip-icon-ledge[data-direction='right'],
.legend-badge-ledge[data-direction='right'] {
  background-color: rgba(161, 98, 7, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.5 11.5c1.2-1.2 3-1.4 4.4-.5l1.1.7c1 .7 2.4.6 3.3-.1l1.2-.9'/%3E%3Cpath d='M9 12.5v2.5'/%3E%3Cpath d='M13 12.3v3.2'/%3E%3Cpath d='M10 18.3c.9.5 1.9.7 2.9.7 1.5 0 2.9-.5 4.1-1.3'/%3E%3C/svg%3E");
  background-size: 18px 18px;
}

.map-tool-chip-icon-door,
.legend-badge-door {
  background-color: rgba(217, 119, 6, 0.92);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 21V5.8c0-.4.2-.8.6-.9l6.8-1.9c.7-.2 1.6.3 1.6 1.1V21'/%3E%3Cpath d='M8 21h9'/%3E%3Cpath d='M10.8 8.4v8.8'/%3E%3Cpath d='M14.2 7.4v9.8'/%3E%3Ccircle cx='13.1' cy='12.3' r='.8' fill='white' stroke='none'/%3E%3C/svg%3E");
  background-size: 17px 17px;
}


/* 2026-03-20 map editor grouped tool refresh */
.map-editor-toolstrip { align-content: start; }
.map-tool-chip { min-height: 58px; border-radius: 14px; position: relative; overflow: hidden; }
.map-tool-chip::after { content: ""; position: absolute; inset: 1px 1px auto 1px; height: 46%; border-radius: inherit; background: linear-gradient(180deg, rgba(255,255,255,0.16), rgba(255,255,255,0)); pointer-events: none; }
.map-tool-chip > span:last-child { display: grid; min-width: 0; }
.map-tool-chip small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-tool-chip-group small { color: rgba(191, 219, 254, 0.94); }
.map-tool-chip-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 10px; color: #f8fbff; background: linear-gradient(180deg, rgba(15, 23, 42, 0.24), rgba(15, 23, 42, 0.52)); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14), 0 8px 18px rgba(2,6,23,0.18); }
.map-tool-chip-icon svg { width: 18px; height: 18px; }
.map-tool-chip[data-tool="block"] .map-tool-chip-icon { background: linear-gradient(180deg, rgba(127,29,29,0.92), rgba(153,27,27,0.92)); }
.map-tool-chip[data-tool="walkable"] .map-tool-chip-icon { background: linear-gradient(180deg, rgba(3,105,161,0.92), rgba(2,132,199,0.92)); }
.map-tool-chip[data-tool="grass"] .map-tool-chip-icon, .map-tool-chip[data-tool-group="tree"] .map-tool-chip-icon, .map-tool-chip[data-tool="sudowoodo"] .map-tool-chip-icon { background: linear-gradient(180deg, rgba(21,128,61,0.92), rgba(22,163,74,0.92)); }
.map-tool-chip[data-tool-group="water"] .map-tool-chip-icon { background: linear-gradient(180deg, rgba(29,78,216,0.92), rgba(37,99,235,0.92)); }
.map-tool-chip[data-tool-group="ledge"] .map-tool-chip-icon, .map-tool-chip[data-tool="door"] .map-tool-chip-icon { background: linear-gradient(180deg, rgba(180,83,9,0.92), rgba(217,119,6,0.92)); }
.map-tool-chip[data-tool="warp"] .map-tool-chip-icon { background: linear-gradient(180deg, rgba(109,40,217,0.92), rgba(124,58,237,0.92)); }
.map-tool-chip[data-tool="sign"] .map-tool-chip-icon { background: linear-gradient(180deg, rgba(51,65,85,0.92), rgba(71,85,105,0.92)); }
.map-tool-chip[data-tool-group="rock"] .map-tool-chip-icon, .map-tool-chip[data-tool="erase_special"] .map-tool-chip-icon, .map-tool-chip-danger .map-tool-chip-icon { background: linear-gradient(180deg, rgba(82,82,91,0.92), rgba(113,113,122,0.92)); }
.map-tool-chip-split, .map-tool-chip-caret, .map-tool-chip-main, .map-tool-chip-menu { display: none !important; }
.tool-picker-modal { max-width: min(620px, 92vw); }
.tool-picker-body { gap: 16px; }
.tool-picker-copy { margin: 0; color: rgba(203, 213, 225, 0.92); }
.tool-picker-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.tool-picker-option { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; border-radius: 16px; border: 1px solid rgba(148, 163, 184, 0.18); background: linear-gradient(180deg, rgba(15,23,42,0.9), rgba(15,23,42,0.76)); padding: 14px 16px; color: #f8fbff; cursor: pointer; box-shadow: 0 16px 34px rgba(2,6,23,0.22), inset 0 1px 0 rgba(255,255,255,0.08); }
.tool-picker-option:hover, .tool-picker-option.active { border-color: rgba(96, 165, 250, 0.56); transform: translateY(-1px); background: linear-gradient(180deg, rgba(17,24,39,0.96), rgba(30,41,59,0.88)); }
.tool-picker-option > span:last-child { display: grid; min-width: 0; }
.tool-picker-option strong { font-size: 0.95rem; }
.tool-picker-option small { color: rgba(191, 219, 254, 0.88); line-height: 1.25; }
.tool-picker-option-icon { flex: 0 0 auto; }
@media (max-width: 700px) { .tool-picker-grid { grid-template-columns: 1fr; } }

.map-tool-chip-icon::before, .map-tool-chip-icon::after { content: none !important; display: none !important; }


/* 2026-03-20 grouped tool icon/modal fix */
.map-tool-chip-icon { display: inline-grid; place-items: center; overflow: hidden; }
.map-tool-chip-icon svg { width: 18px; height: 18px; display: block; position: relative; z-index: 2; }
.map-tool-chip-icon::before,
.map-tool-chip-icon::after { z-index: 0; }
.tool-picker-option .map-tool-chip-icon { background: rgba(255,255,255,0.06); }


/* 2026-03-21: editor search + live test refresh */
.map-editor-selector-grid {
  grid-template-columns: minmax(220px, 1fr) minmax(200px, 0.9fr) minmax(260px, 1.1fr);
}

.map-editor-search-input {
  width: 100%;
  padding-left: 16px;
  padding-right: 16px;
  color: #eef6ff;
  background-image: none;
}

.map-editor-search-input::placeholder {
  color: rgba(203, 213, 225, 0.72);
}

.map-editor-search-input::-webkit-search-cancel-button {
  filter: invert(1) opacity(.8);
  cursor: pointer;
}

.warp-modal-controls-clean {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.9fr) minmax(0, 1.2fr) minmax(200px, 0.82fr) minmax(220px, 1fr);
}

.warp-modal-search-field,
.map-editor-field-search {
  min-width: 0;
}

@media (max-width: 1180px) {
  .map-editor-selector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-editor-field-search,
  .map-editor-field-map {
    grid-column: 1 / -1;
  }

  .warp-modal-controls-clean {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .warp-modal-search-field,
  .warp-modal-zoom-field-clean {
    grid-column: 1 / -1;
  }
}

/* Crystal route banner reveal + ledge jump shadow support */
.route-reveal-banner {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translate(-50%, -115%);
  background-color: #80a8a0;
  border: 4px solid #282828;
  border-radius: 8px;
  padding: 6px;
  box-shadow:
    inset 4px 4px 0 #a4c8c0,
    inset -4px -4px 0 #5c847c,
    0 8px 0 rgba(0, 0, 0, 0.22);
  pointer-events: none;
  opacity: 0;
  z-index: 100;
  will-change: transform, opacity;
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1), opacity 240ms ease;
}

.route-reveal-banner.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

.route-reveal-inner {
  background-color: #e8d8a0;
  border: 4px solid #282828;
  border-radius: 4px;
  padding: 8px 48px;
  position: relative;
  box-shadow:
    inset 4px 4px 0 #fdf3d0,
    inset -4px -4px 0 #c4b078;
  background-image: radial-gradient(#d0b878 2px, transparent 2px);
  background-size: 16px 16px;
}

.route-reveal-title {
  margin: 0;
  font-family: 'VT323', monospace;
  font-size: 36px;
  line-height: 1;
  letter-spacing: 2px;
  text-align: center;
  white-space: nowrap;
  color: #ffffff;
  text-shadow:
    2px 0 0 #282828,
    -2px 0 0 #282828,
    0 2px 0 #282828,
    0 -2px 0 #282828,
    2px 2px 0 #282828,
    -2px -2px 0 #282828,
    2px -2px 0 #282828,
    -2px 2px 0 #282828;
}

@media (max-width: 760px) {
  .route-reveal-banner {
    top: 12px;
    max-width: calc(100% - 20px);
  }

  .route-reveal-inner {
    padding: 8px 28px;
  }

  .route-reveal-title {
    font-size: clamp(28px, 7vw, 36px);
    letter-spacing: 1px;
  }
}


/* 2026-03-24 Gemini encounter sidebar exact layout */
.encounter-sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 40px 30px;
  overflow: hidden;
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
}

.encounter-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.26s ease, transform 0.26s ease;
}

.encounter-state[hidden] {
  display: none !important;
}

.encounter-state.is-fading,
.encounter-state.is-entering {
  opacity: 0;
  transform: translateY(10px);
}

.encounter-state-idle {
  justify-content: center;
  box-sizing: border-box;
}

.encounter-heading {
  margin: 0;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.04em;
  font-family: 'Montserrat', 'Inter', sans-serif;
}

.encounter-heading-idle {
  max-width: 220px;
  font-size: 26px;
  line-height: 1.2;
  margin-bottom: 40px;
}

.encounter-subtext {
  color: #a9b7cf;
  font-family: 'Montserrat', 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 0;
}

.encounter-heading-active {
  font-size: clamp(1.82rem, 3.7vw, 2.6rem);
  line-height: 0.96;
  margin: 8px 0 4px;
}

.encounter-idle-ball {
  width: 100px;
  height: 100px;
  background: linear-gradient(to bottom, #f05050 48%, #333 48%, #333 52%, #fff 52%);
  border-radius: 50%;
  border: 6px solid #333;
  position: relative;
  animation: encounterIdlePulse 2.4s ease-out infinite;
}

.encounter-idle-ball::before {
  content: '';
  position: absolute;
  left: -6px;
  right: -6px;
  top: calc(50% - 3px);
  height: 6px;
  background: #333;
}

.encounter-idle-ball::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 24px;
  background-color: #fff;
  border: 6px solid #333;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes encounterIdlePulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.encounter-idle-copy {
  color: #a9b7cf;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  margin: 40px 0 0;
  line-height: 1.5;
  letter-spacing: 0.01em;
  max-width: 200px;
}

.encounter-state-active {
  justify-content: flex-start;
  box-sizing: border-box;
}

.encounter-stage-art {
  position: relative;
  width: 100%;
  height: 228px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 18px;
  margin-bottom: 18px;
}


.encounter-shiny-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 8px;
}

.encounter-shiny-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  min-height: 30px;
  border-radius: 999px;
  border: 2px solid #d9b64b;
  background: linear-gradient(180deg, rgba(76, 56, 10, 0.96), rgba(36, 26, 4, 0.98));
  color: #fff2be;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset, 0 0 18px rgba(217, 182, 75, 0.24);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 900;
  font-size: 0.68rem;
}

.encounter-shiny-badge[hidden] {
  display: none !important;
}

.encounter-shiny-badge-star {
  font-size: 0.82rem;
  line-height: 1;
  color: #ffe27a;
  text-shadow: 0 0 10px rgba(255, 226, 122, 0.55);
}

.encounter-shiny-badge-label {
  line-height: 1;
}

.encounter-type-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 12px;
}

.encounter-platform-art {
  width: 286px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
  position: absolute;
  left: 50%;
  bottom: 25px;
  transform: translateX(-50%);
  z-index: 1;
  filter: drop-shadow(0 10px 10px rgba(0,0,0,0.25));
}

.encounter-pokemon-art {
  position: absolute;
  z-index: 2;
  width: 70px;
  max-width: 47%;
  height: auto;
  image-rendering: pixelated;
  left: 50%;
  bottom: 75px;
  transform: translateX(-50%);
  filter: drop-shadow(0 10px 10px rgba(0,0,0,0.4));
}

.encounter-meta-row,
.battle-prototype-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
  margin-bottom: auto;
  flex-wrap: nowrap;
}

.encounter-type-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 11px;
  min-height: 28px;
  border-radius: 10px;
  background: #1a1a1a;
  border: 2px solid var(--encounter-type-outline, #b0c4de);
  color: #f8fbff;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  filter: drop-shadow(0 0 5px var(--encounter-type-glow, rgba(176, 196, 222, 0.4)));
  box-shadow: 0 10px 30px rgba(0,0,0,0.5), inset 0 0 20px rgba(56, 189, 248, 0.1);
  backdrop-filter: blur(12px);
  box-sizing: border-box;
}

.encounter-level-tag {
  color: #ffffff;
  font-family: 'Montserrat', 'Inter', sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  margin: 0;
  text-transform: uppercase;
}


.encounter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 90%;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  color: #f8fbff;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 0.96rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
  margin-top: 14px;
}

.encounter-btn:hover {
  background: linear-gradient(180deg, rgba(34, 211, 238, 0.28), rgba(14, 165, 233, 0.4));
  border-color: rgba(125, 211, 252, 0.42);
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(2, 132, 199, 0.24), inset 0 1px 0 rgba(255,255,255,0.12);
}

.encounter-btn-primary {
  border: 1px solid rgba(125, 211, 252, 0.22);
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.2), rgba(2, 132, 199, 0.32));
  box-shadow: 0 14px 28px rgba(2, 132, 199, 0.18), inset 0 1px 0 rgba(255,255,255,0.08);
}

:root {
  --encounter-type-outline: #b0c4de;
  --encounter-type-glow: rgba(176, 196, 222, 0.4);
}

body .encounter-type-normal { --encounter-type-outline: #A8A77A; --encounter-type-glow: rgba(168, 167, 122, 0.4); }
body .encounter-type-fire { --encounter-type-outline: #EE8130; --encounter-type-glow: rgba(238, 129, 48, 0.4); }
body .encounter-type-water { --encounter-type-outline: #6390F0; --encounter-type-glow: rgba(99, 144, 240, 0.4); }
body .encounter-type-electric { --encounter-type-outline: #F7D02C; --encounter-type-glow: rgba(247, 208, 44, 0.4); }
body .encounter-type-grass { --encounter-type-outline: #7AC74C; --encounter-type-glow: rgba(122, 199, 76, 0.4); }
body .encounter-type-ice { --encounter-type-outline: #96D9D6; --encounter-type-glow: rgba(150, 217, 214, 0.4); }
body .encounter-type-fighting { --encounter-type-outline: #C22E28; --encounter-type-glow: rgba(194, 46, 40, 0.4); }
body .encounter-type-poison { --encounter-type-outline: #A33EA1; --encounter-type-glow: rgba(163, 62, 161, 0.4); }
body .encounter-type-ground { --encounter-type-outline: #E2BF65; --encounter-type-glow: rgba(226, 191, 101, 0.4); }
body .encounter-type-flying { --encounter-type-outline: #A98FF3; --encounter-type-glow: rgba(169, 143, 243, 0.4); }
body .encounter-type-psychic { --encounter-type-outline: #F95587; --encounter-type-glow: rgba(249, 85, 135, 0.4); }
body .encounter-type-bug { --encounter-type-outline: #A6B91A; --encounter-type-glow: rgba(166, 185, 26, 0.4); }
body .encounter-type-rock { --encounter-type-outline: #B6A136; --encounter-type-glow: rgba(182, 161, 54, 0.4); }
body .encounter-type-ghost { --encounter-type-outline: #735797; --encounter-type-glow: rgba(115, 87, 151, 0.4); }
body .encounter-type-dragon { --encounter-type-outline: #6F35FC; --encounter-type-glow: rgba(111, 53, 252, 0.4); }
body .encounter-type-dark { --encounter-type-outline: #705746; --encounter-type-glow: rgba(112, 87, 70, 0.4); }
body .encounter-type-steel { --encounter-type-outline: #B7B7CE; --encounter-type-glow: rgba(183, 183, 206, 0.4); }
body .encounter-type-fairy { --encounter-type-outline: #D685AD; --encounter-type-glow: rgba(214, 133, 173, 0.4); }

@media (max-width: 960px) {
  .encounter-sidebar {
    padding: 30px 22px;
  }

  .encounter-stage-art {
    height: 212px;
  }

  .encounter-platform-art {
    width: 258px;
    bottom: -14px;
  }

  .encounter-pokemon-art {
    width: 108px;
    bottom: 12px;
  }
}

.encounter-bubble {
  position: absolute;
  left: 0;
  top: 0;
  width: 44px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fdf6e3;
  box-shadow:
    0 -2px 0 0 #a4a28d, 0 2px 0 0 #a4a28d,
    -2px 0 0 0 #a4a28d, 2px 0 0 0 #a4a28d,
    -2px -2px 0 0 transparent, 2px -2px 0 0 transparent,
    -2px 2px 0 0 transparent, 2px 2px 0 0 transparent;
  background-image:
    linear-gradient(#d1cdb7, #d1cdb7),
    linear-gradient(#d1cdb7, #d1cdb7),
    linear-gradient(#d1cdb7, #d1cdb7),
    linear-gradient(#d1cdb7, #d1cdb7);
  background-size: 4px 4px;
  background-position: 0 0, 100% 0, 0 100%, 100% 100%;
  background-repeat: no-repeat;
  border-radius: 0;
  z-index: 22;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 16px));
  opacity: 1;
  transition: opacity 0.26s ease, transform 0.26s ease;
}

.encounter-bubble::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 10px solid #a4a28d;
}

.encounter-bubble::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #fdf6e3;
  z-index: 1;
}

.encounter-bubble.hidden {
  opacity: 0;
  transform: translate(-50%, calc(-100% - 10px)) scale(0.84);
}

.encounter-bubble.active {
  animation: encounterBubblePop 0.18s ease-out, encounterBubbleFloat 0.95s ease-in-out infinite 0.18s;
}

.encounter-bubble.is-fading {
  opacity: 0;
  transform: translate(-50%, calc(-100% - 28px)) scale(0.92);
  animation: none;
}

.encounter-bubble-mark {
  position: relative;
  z-index: 2;
  color: #ff5a00;
  font-family: 'Arial Black', sans-serif;
  font-size: 28px;
  font-weight: bold;
  line-height: 1;
  padding-bottom: 2px;
  text-shadow: -2px 0 0 #000, 2px 0 0 #000, 0 -2px 0 #000, 0 2px 0 #000;
}

@keyframes encounterBubblePop {
  0% { transform: translate(-50%, calc(-100% - 10px)) scale(0); }
  100% { transform: translate(-50%, calc(-100% - 16px)) scale(1); }
}

@keyframes encounterBubbleFloat {
  0%, 100% { transform: translate(-50%, calc(-100% - 16px)); }
  50% { transform: translate(-50%, calc(-100% - 22px)); }
}

.battle-shell {
  width: min(920px, calc(100% - 24px));
  margin: 24px auto;
  flex: 1 0 auto;
}

.battle-card {
  padding: 28px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(10, 14, 24, 0.92), rgba(5, 8, 14, 0.96));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 30px 80px rgba(0,0,0,0.34);
  text-align: center;
}

.battle-card h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.04;
}

.battle-subcopy {
  max-width: 560px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.battle-prototype-stage {
  position: relative;
  min-height: 280px;
  margin-top: 20px;
  display: grid;
  place-items: center;
}

.battle-prototype-platform {
  width: min(360px, 100%);
  height: auto;
}

.battle-prototype-sprite {
  position: absolute;
  left: 50%;
  bottom: 98px;
  transform: translateX(-50%);
  width: min(132px, 30vw);
  image-rendering: pixelated;
}

@media (max-width: 1080px) {
  .encounter-sidebar { min-height: 0; }
  .encounter-platform-art { width: min(220px, 100%); }
}


/* 2026-03-28 mobile game screen + gameboy joypad patch */
@media (max-width: 900px) {
  .game-body {
    padding-bottom: calc(172px + env(safe-area-inset-bottom, 0px));
  }

  .game-layout,
  .game-layout-refined {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 8px 0 calc(16px + env(safe-area-inset-bottom, 0px));
    gap: 10px;
  }

  .game-stage {
    min-height: auto;
    border-radius: 0;
  }

  .refined-stage {
    border-radius: 20px;
    margin: 0;
    border-left: 0;
    border-right: 0;
  }

  .game-canvas-wrap,
  .refined-canvas-wrap {
    width: 100%;
    min-height: 0;
    aspect-ratio: 4 / 5;
    min-block-size: min(62dvh, calc(100vw - 20px));
  }

  .game-left-sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    padding: 0 8px calc(8px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
  }

  .game-left-sidebar .refined-joypad-shell {
    pointer-events: auto;
  }

  .game-right-sidebar {
    display: none;
  }

  .refined-joypad-shell {
    gap: 10px;
    padding: 12px 14px 10px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(42, 47, 60, 0.98), rgba(25, 30, 40, 0.99));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .joypad-head-row,
  .joypad-controls-embed {
    display: none;
  }

  .joypad-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, auto);
    gap: 12px 16px;
    align-items: center;
  }

  .dpad {
    grid-template-columns: repeat(3, clamp(48px, 12vw, 58px));
    grid-template-rows: repeat(3, clamp(48px, 12vw, 58px));
    gap: 5px;
    justify-self: start;
  }

  .pad-btn {
    border-radius: 14px;
    font-size: clamp(19px, 4.8vw, 24px);
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
  }

  .pad-center {
    background: rgba(0, 0, 0, 0.16);
    color: transparent;
    border-color: rgba(255, 255, 255, 0.05);
  }

  .joypad-actions-stack {
    justify-self: end;
    width: auto;
    max-width: none;
    gap: 8px;
  }

  .action-row.pad-action,
  .compact-pad-action {
    gap: 12px;
    transform: translateY(-4px) rotate(-16deg);
    transform-origin: center;
  }

  .round-btn {
    width: clamp(58px, 14vw, 68px);
    height: clamp(58px, 14vw, 68px);
    font-size: clamp(24px, 6vw, 28px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.24);
    touch-action: manipulation;
  }

  .mini-controls,
  .compact-mini-controls {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 248px;
    margin: 0 0 0 auto;
  }

  .mini-btn {
    min-height: 38px;
    padding: 8px 14px;
    font-size: 11px;
    letter-spacing: 0.06em;
    touch-action: manipulation;
  }

  .game-clock-hud {
    top: 8px;
    right: 8px;
    gap: 4px;
    padding: 2px 6px;
    border-width: 2px;
    border-radius: 4px;
  }

  .pixel-grid {
    grid-template-columns: repeat(12, 1.2px);
    grid-template-rows: repeat(12, 1.2px);
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
  }

  .pixel-grid > span {
    width: 1.2px;
    height: 1.2px;
  }

  .clock-digits {
    font-size: clamp(18px, 4.6vw, 22px);
    letter-spacing: 0.5px;
    text-shadow: 1px 1px 0 #222;
  }

  .player-name-pill {
    max-width: 44vw;
    min-height: 18px;
    padding: 2px 7px;
    font-size: 12px;
  }

  .dialog-box {
    left: 10px;
    right: 10px;
    bottom: 10px;
    padding: 10px 12px;
    border-radius: 14px;
  }

  .dialog-title {
    font-size: 13px;
  }

  .dialog-text {
    font-size: 12px;
    line-height: 1.45;
  }

  .route-reveal-banner {
    top: 10px;
    max-width: calc(100% - 82px);
    border-width: 2px;
    border-radius: 6px;
    padding: 4px;
  }

  .route-reveal-inner {
    border-width: 2px;
    border-radius: 3px;
    padding: 4px 12px;
    background-size: 10px 10px;
  }

  .route-reveal-title {
    font-size: clamp(14px, 4.4vw, 18px);
    letter-spacing: 0.4px;
    text-shadow: 1px 0 0 #282828, -1px 0 0 #282828, 0 1px 0 #282828, 0 -1px 0 #282828;
  }
}

@media (max-width: 520px) {
  .refined-stage {
    border-radius: 18px;
  }

  .refined-joypad-shell {
    padding: 10px 12px 8px;
  }

  .joypad-grid {
    gap: 10px 12px;
  }

  .mini-controls,
  .compact-mini-controls {
    max-width: 220px;
  }
}

@media (max-width: 900px) and (orientation: landscape) {
  .game-body {
    padding-bottom: calc(132px + env(safe-area-inset-bottom, 0px));
  }

  .game-canvas-wrap,
  .refined-canvas-wrap {
    aspect-ratio: auto;
    min-height: 64dvh;
  }

  .refined-joypad-shell {
    padding: 8px 10px 7px;
  }

  .dpad {
    grid-template-columns: repeat(3, 42px);
    grid-template-rows: repeat(3, 42px);
  }

  .round-btn {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }

  .mini-btn {
    min-height: 32px;
  }
}

/* 2026-04-04 mobile encounter top-center overlay */
.mobile-encounter-overlay {
  display: none;
}

@media (max-width: 900px) {
  .game-right-sidebar {
    display: none !important;
  }

  .mobile-encounter-overlay {
    position: absolute;
    inset: 0;
    z-index: 65;
    display: block;
    pointer-events: none;
  }

  .mobile-encounter-overlay[hidden] {
    display: none !important;
  }

  .mobile-encounter-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(6, 10, 18, 0.16);
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
  }

  .mobile-encounter-overlay:not([hidden])::before {
    opacity: 1;
  }

  .mobile-encounter-overlay__content {
    position: absolute;
    top: clamp(44px, 10vw, 62px);
    left: 50%;
    width: min(92%, 300px);
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    pointer-events: none;
  }

  .mobile-encounter-overlay__text {
    margin: 0 0 -2px;
    color: #ffffff;
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-size: clamp(11px, 3.6vw, 16px);
    font-weight: 900;
    line-height: 1.02;
    letter-spacing: -0.025em;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0,0,0,0.45);
    pointer-events: none;
  }

  .mobile-encounter-overlay__stage {
    position: relative;
    width: min(250px, 70vw);
    height: min(135px, 36vw);
    pointer-events: none;
  }

  .mobile-encounter-overlay__platform {
    position: absolute;
    left: 50%;
    bottom: 8px;
    width: min(185px, 52vw);
    height: auto;
    transform: translateX(-50%);
    object-fit: contain;
    filter: drop-shadow(0 8px 8px rgba(0,0,0,0.22));
    image-rendering: pixelated;
  }

  .mobile-encounter-overlay__pokemon {
    position: absolute;
    left: 50%;
    bottom: 34px;
    width: min(88px, 22vw);
    max-width: 45%;
    height: auto;
    transform: translateX(-50%);
    image-rendering: pixelated;
    filter: drop-shadow(0 8px 10px rgba(0,0,0,0.34));
  }

  .mobile-encounter-overlay__button {
    width: min(132px, 36vw);
    min-width: 0;
    min-height: 32px;
    margin-top: -10px;
    padding: 6px 12px;
    font-size: 0.82rem;
    pointer-events: auto;
  }
}

@media (min-width: 901px) {
  .mobile-encounter-overlay {
    display: none !important;
  }

  .encounter-mobile-close {
    display: none;
  }
}

