:root {
  color-scheme: dark;
  --bg: #071017;
  --panel: #101b22;
  --panel-2: #17262d;
  --line: #2a4952;
  --line-soft: rgba(143, 184, 192, 0.22);
  --text: #f4f7f8;
  --muted: #9fb3ba;
  --accent: #f6c445;
  --accent-2: #27c3d9;
  --danger: #e45050;
  --ok: #5ad084;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(39, 195, 217, 0.12), transparent 34%),
    radial-gradient(circle at 90% 10%, rgba(246, 196, 69, 0.14), transparent 30%),
    var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #221a05;
  cursor: pointer;
  font-weight: 800;
  min-height: 42px;
  padding: 0 14px;
}

button:hover {
  filter: brightness(1.06);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.7);
  opacity: 0.62;
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.app-shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
}

.dex-sidebar {
  border-right: 1px solid var(--line);
  background:
    repeating-linear-gradient(135deg, rgba(39, 195, 217, 0.06) 0 5px, transparent 5px 12px),
    rgba(7, 16, 23, 0.92);
  padding: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid var(--accent-2);
  border-radius: 50%;
  background: #0e2b33;
  box-shadow: inset 0 0 18px rgba(39, 195, 217, 0.38);
  font-weight: 950;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1;
  text-transform: uppercase;
}

.brand p,
.eyebrow,
small {
  color: var(--muted);
}

.language-switcher {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 22px;
}

.language-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 34px;
  padding: 0 6px;
  border: 1px solid var(--line);
  background: rgba(8, 20, 26, 0.78);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

.language-btn.active {
  border-color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(39, 195, 217, 0.42), 0 0 18px rgba(39, 195, 217, 0.16);
}

.language-btn span {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 15px;
  overflow: hidden;
  flex: 0 0 auto;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(244, 247, 248, 0.28);
  font-size: 0;
}

.language-btn span::before,
.language-btn span::after {
  content: "";
  position: absolute;
  inset: 0;
}

.language-btn[data-language="es"] span:first-child {
  background: linear-gradient(to bottom, #c60b1e 0 25%, #ffc400 25% 75%, #c60b1e 75% 100%);
}

.language-btn[data-language="es"] span:last-child {
  background: linear-gradient(to right, #006847 0 33.3%, #fff 33.3% 66.6%, #ce1126 66.6% 100%);
}

.language-btn[data-language="es"] span:last-child::after {
  inset: 5px 9px;
  border-radius: 50%;
  background: #8c6b2f;
}

.language-btn[data-language="en"] span:first-child {
  background: repeating-linear-gradient(to bottom, #b22234 0 1.15px, #fff 1.15px 2.3px);
}

.language-btn[data-language="en"] span:first-child::before {
  right: 52%;
  bottom: 46%;
  background: #3c3b6e;
}

.language-btn[data-language="en"] span:last-child {
  background:
    linear-gradient(32deg, transparent 0 42%, #fff 42% 48%, #c8102e 48% 52%, #fff 52% 58%, transparent 58%),
    linear-gradient(148deg, transparent 0 42%, #fff 42% 48%, #c8102e 48% 52%, #fff 52% 58%, transparent 58%),
    linear-gradient(to right, transparent 0 40%, #fff 40% 45%, #c8102e 45% 55%, #fff 55% 60%, transparent 60%),
    linear-gradient(to bottom, transparent 0 35%, #fff 35% 43%, #c8102e 43% 57%, #fff 57% 65%, transparent 65%),
    #012169;
}

.language-btn[data-language="pt"] span:first-child {
  background: #009b3a;
}

.language-btn[data-language="pt"] span:first-child::before {
  inset: 3px 4px;
  background: #ffdf00;
  transform: rotate(45deg);
}

.language-btn[data-language="pt"] span:first-child::after {
  inset: 5px 8px;
  border-radius: 50%;
  background: #002776;
}

.language-btn[data-language="pt"] span:last-child {
  background: linear-gradient(to right, #006600 0 40%, #f00 40% 100%);
}

.language-btn[data-language="pt"] span:last-child::after {
  inset: 5px 8px;
  border-radius: 50%;
  background: #ffcc00;
}

.language-btn[data-language="pl"] span {
  background: linear-gradient(to bottom, #fff 0 50%, #dc143c 50% 100%);
}

.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-box,
.identity-fields label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field-title {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.identity-fields .check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.list-filter {
  margin-top: 12px;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #08141a;
  color: var(--text);
  padding: 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

.is-hidden {
  display: none !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(39, 195, 217, 0.14);
}

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0 22px;
}

.quick-actions button:first-child {
  grid-column: 1 / -1;
}

.type-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #17262d;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  min-height: 30px;
  padding: 6px 10px;
}

.type-planta { background: #286b44; }
.type-veneno { background: #743c9e; }
.type-fuego { background: #a4412d; }
.type-agua { background: #276aa3; }
.type-electrico { background: #957226; color: #fff8d6; }
.type-hielo { background: #317f91; }
.type-lucha { background: #8a3745; }
.type-tierra { background: #80613a; }
.type-volador { background: #536da8; }
.type-psiquico { background: #985073; }
.type-bicho { background: #5d722b; }
.type-roca { background: #6d6041; }
.type-fantasma { background: #554a88; }
.type-dragon { background: #4d56a8; }
.type-siniestro { background: #473d39; }
.type-acero { background: #5a6f79; }
.type-hada { background: #9b5f8f; }
.type-normal { background: #69675e; }

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

.preset-image {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0 4px, transparent 4px 10px),
    #08141a;
  color: var(--muted);
  padding: 0;
  overflow: hidden;
}

.preset-image:disabled {
  cursor: not-allowed;
}

.preset-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preset-image span {
  display: none;
  font-size: 12px;
  font-weight: 950;
}

.preset-image.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(246, 196, 69, 0.18);
}

.preset-image.missing img {
  display: none;
}

.pokemon-list {
  display: grid;
  gap: 10px;
}

.pokemon-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 66px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(16, 27, 34, 0.72);
  color: var(--text);
  padding: 10px;
  text-align: left;
}

.pokemon-item.active {
  border-color: var(--accent);
  background: rgba(246, 196, 69, 0.12);
}

.mini-art {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(145deg, #164a57, #33294f);
  color: white;
  font-size: 13px;
  font-weight: 950;
}

.pokemon-item strong,
.pokemon-item small {
  display: block;
}

.lock-dot {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(228, 80, 80, 0.16);
  color: #ffb1b1;
}

.dex-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 24px;
}

.top-panel,
.levels-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.top-panel {
  flex: 0 0 auto;
  min-height: 82px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

h2 {
  font-size: clamp(34px, 5vw, 70px);
  line-height: 0.96;
  text-transform: uppercase;
  text-shadow: 0 5px 0 rgba(0, 0, 0, 0.28);
}

.creator-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.top-contributors {
  display: grid;
  gap: 6px;
  min-width: 230px;
  max-width: 330px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(246, 196, 69, 0.13), rgba(39, 195, 217, 0.08)),
    rgba(8, 20, 26, 0.78);
  color: var(--text);
  padding: 10px 12px;
  text-align: left;
}

.top-contributors > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.top-contributors ol {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.top-contributors li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.top-contributors li span {
  color: var(--accent);
  white-space: nowrap;
}

.leaderboard-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 27, 34, 0.9);
  box-shadow: var(--shadow);
  padding: 22px;
}

.leaderboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 16px;
}

.leaderboard-header h3 {
  font-size: clamp(32px, 4vw, 58px);
  line-height: 1;
  text-transform: uppercase;
}

.library-credit {
  margin-top: 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.leaderboard-list {
  display: grid;
  gap: 10px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(246, 196, 69, 0.1), transparent),
    rgba(8, 20, 26, 0.72);
  padding: 14px;
}

.leaderboard-rank {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #0e2b33;
  color: var(--accent);
  font-weight: 950;
}

.leaderboard-row strong {
  font-size: 18px;
}

.leaderboard-row > span:not(.leaderboard-rank) {
  color: var(--accent);
  font-weight: 950;
}

.leaderboard-row small {
  font-weight: 900;
  white-space: nowrap;
}

.proficiency-search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 18px;
}

.proficiency-search-icon {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-height: 0;
  border: 1px solid var(--line);
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0 4px, transparent 4px 10px),
    #08141a;
  padding: 0;
}

.proficiency-search-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.proficiency-results {
  display: grid;
  gap: 10px;
}

.proficiency-results-header {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(8, 20, 26, 0.72);
  padding: 12px;
}

.proficiency-results-header img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.proficiency-results-header h3 {
  font-size: 18px;
  line-height: 1.25;
}

.proficiency-result-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(140px, 240px);
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line-soft);
  background: rgba(8, 20, 26, 0.72);
  color: var(--text);
  min-height: 58px;
  text-align: left;
}

.proficiency-result-row span,
.proficiency-result-row small {
  color: var(--muted);
  font-weight: 900;
}

.proficiency-result-row small {
  text-align: right;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.pokemon-card,
.levels-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 27, 34, 0.9);
  box-shadow: var(--shadow);
}

.pokemon-card {
  align-self: start;
  max-height: calc(100vh - 130px);
  overflow: auto;
}

.pokemon-art {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 220px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0 5px, transparent 5px 14px),
    conic-gradient(from 220deg, #f6c445, #27c3d9, #8157d9, #f6c445);
  overflow: hidden;
}

.pokemon-art img {
  display: none;
  width: 92%;
  height: 92%;
  min-height: 220px;
  object-fit: contain;
}

.pokemon-art span {
  display: grid;
  place-items: center;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(7, 16, 23, 0.78);
  border: 4px solid rgba(255, 255, 255, 0.8);
  font-size: 54px;
  font-weight: 950;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.35);
  z-index: 1;
}

.pokemon-art.has-image img {
  display: block;
}

.pokemon-art.has-image span {
  display: none;
}

.identity-fields {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.contributors-panel {
  display: grid;
  gap: 8px;
}

.contributors-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(8, 20, 26, 0.54);
  padding: 10px;
}

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

.contributor-chip {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
}

.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 16px 18px;
}

#statusBadge {
  border-radius: 999px;
  background: rgba(39, 195, 217, 0.14);
  color: #9beef8;
  font-weight: 900;
  padding: 6px 10px;
}

#statusBadge.locked {
  background: rgba(90, 208, 132, 0.14);
  color: #a9f0c0;
}

.contributor-badge {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding: 6px 10px;
  text-align: center;
}

.contributor-badge.rank-bronze,
.contributor-chip.rank-bronze {
  border-color: rgba(205, 127, 50, 0.58);
  color: #d99155;
  text-shadow: 0 0 12px rgba(205, 127, 50, 0.34);
}

.contributor-badge.rank-silver,
.contributor-chip.rank-silver {
  border-color: rgba(198, 210, 216, 0.7);
  color: #d8e0e4;
  text-shadow: 0 0 12px rgba(198, 210, 216, 0.34);
}

.contributor-badge.rank-gold,
.contributor-chip.rank-gold {
  border-color: rgba(245, 196, 66, 0.75);
  color: #ffd45f;
  text-shadow: 0 0 14px rgba(245, 196, 66, 0.45);
}

.levels-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  padding: 18px;
}

.levels-header {
  flex: 0 0 auto;
  margin-bottom: 16px;
}

.levels-container {
  display: grid;
  flex: 1 1 auto;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding-right: 8px;
}

.history-panel {
  flex: 0 0 auto;
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.history-list-full {
  max-height: none;
  overflow: visible;
}

.history-empty,
.history-item {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(8, 20, 26, 0.72);
  margin: 0;
  padding: 12px;
}

.history-empty {
  color: var(--muted);
  font-size: 13px;
}

.history-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.history-meta span,
.history-versions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.history-versions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.history-versions div {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
}

.history-versions p {
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  margin-top: 6px;
}

.level-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(143, 184, 192, 0.13), transparent),
    rgba(8, 20, 26, 0.82);
  padding: 12px;
}

.level-meta {
  display: grid;
  align-content: start;
  gap: 4px;
}

.level-number {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #0e2b33;
  color: var(--accent);
  font-weight: 950;
}

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

.slot-card {
  position: relative;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 27, 34, 0.88);
  padding: 10px;
  min-width: 0;
}

.slot-card.protected-slot {
  border-color: rgba(90, 208, 132, 0.42);
  background:
    linear-gradient(135deg, rgba(90, 208, 132, 0.08), transparent),
    rgba(16, 27, 34, 0.88);
}

.slot-card.protected-slot::after {
  content: "Verificado";
  position: absolute;
  right: 10px;
  bottom: 10px;
  color: #a9f0c0;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  opacity: 0.78;
  pointer-events: none;
}

.slot-description {
  min-height: 42px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.slot-suggestions {
  display: none;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #08141a;
  box-shadow: var(--shadow);
  z-index: 8;
}

.slot-suggestions.show {
  display: grid;
}

.slot-suggestions button {
  min-height: 34px;
  border-radius: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  padding: 8px 10px;
  text-align: left;
}

.slot-suggestions button:last-child {
  border-bottom: 0;
}

.slot-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.clear-slot {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.slot-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 84px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background:
    repeating-linear-gradient(135deg, rgba(39, 195, 217, 0.08) 0 4px, transparent 4px 10px),
    linear-gradient(135deg, rgba(246, 196, 69, 0.12), rgba(39, 195, 217, 0.1)),
    #08141a;
  color: var(--accent);
  outline: none;
}

.slot-preview.can-drop {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(246, 196, 69, 0.34);
}

.slot-preview img {
  display: none;
  width: 68px;
  height: 68px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.42));
}

.slot-preview span {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.55);
  background: rgba(8, 20, 26, 0.76);
  font-size: 20px;
  font-weight: 950;
}

.slot-preview.has-icon img {
  display: block;
}

.slot-preview.has-icon span {
  display: none;
}

.slot-preview p {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: min(220px, calc(100% + 48px));
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  background: rgba(12, 16, 19, 0.92);
  color: white;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  padding: 6px 8px;
  text-align: center;
  transform: translate(-50%, calc(100% + 8px));
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 5;
}

.slot-preview:hover p,
.slot-preview:focus p {
  opacity: 1;
  transform: translate(-50%, 0);
}

.slot-preview.empty {
  color: var(--muted);
}

.slot-preview.empty p {
  display: none;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d171d;
  color: var(--text);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  transform: translateY(120%);
  transition: transform 180ms ease;
  z-index: 20;
}

.toast.show {
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(4, 9, 12, 0.72);
  padding: 20px;
  z-index: 30;
}

.review-modal {
  display: grid;
  gap: 18px;
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d171d;
  box-shadow: var(--shadow);
  padding: 20px;
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.modal-head h3 {
  font-size: 28px;
  line-height: 1;
}

.review-modal label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.review-modal textarea {
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #081218;
  color: var(--text);
  padding: 12px;
}

.review-modal textarea:focus {
  border-color: var(--accent-2);
  outline: 2px solid rgba(39, 195, 217, 0.24);
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .dex-main {
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .dex-sidebar {
    position: static;
    height: auto;
    max-height: 48vh;
    overflow: auto;
  }

  .pokemon-card {
    max-height: none;
    height: auto;
    overflow: visible;
  }

  .levels-panel {
    max-height: none;
    height: auto;
    overflow: hidden;
  }

  .levels-container {
    display: grid;
    gap: 12px;
    overflow: visible;
    padding: 0 4px 10px 0;
  }

  .pokemon-list {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  }

  .level-row {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .slot-grid {
    grid-template-columns: repeat(4, minmax(138px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
  }

  #proficiencySearchBtn,
  #fishingSystemSearchBtn {
    order: -1;
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) and (orientation: portrait) {
  .levels-panel {
    padding: 9px;
  }

  .levels-header {
    gap: 10px;
  }

  .levels-header h3 {
    font-size: 20px;
    line-height: 1.05;
  }

  .levels-header button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 13px;
  }

  .level-row {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 5px;
    min-height: 0;
    overflow: visible;
    padding: 8px;
  }

  .level-number {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .level-meta {
    position: static;
    border-right: 0;
    background: transparent;
    padding-right: 0;
  }

  .level-meta strong {
    font-size: 13px;
  }

  .level-meta small {
    font-size: 10px;
    line-height: 1.15;
  }

  .slot-grid {
    grid-template-columns: repeat(4, minmax(52px, 1fr));
    gap: 4px;
    min-width: 0;
    overflow: visible;
    padding-bottom: 0;
  }

  .slot-card {
    min-width: 0;
    width: auto;
    gap: 4px;
    padding: 4px;
  }

  .slot-head {
    gap: 2px;
    font-size: 7px;
    line-height: 1.05;
  }

  .clear-slot {
    min-height: 18px;
    max-width: 34px;
    overflow: hidden;
    padding: 0 3px;
    border-radius: 6px;
    font-size: 7px;
  }

  .slot-preview {
    min-height: 46px;
    border-radius: 6px;
  }

  .slot-preview img {
    width: 38px;
    height: 38px;
  }

  .slot-preview span {
    width: 34px;
    height: 34px;
    border-width: 1px;
    font-size: 13px;
  }

  .slot-description {
    min-width: 0;
    min-height: 28px;
    border-radius: 6px;
    padding: 4px;
    font-size: 8px;
  }
}

@media (max-width: 680px) and (orientation: portrait) {
  .levels-panel {
    padding: 10px;
  }

  .levels-header {
    gap: 10px;
  }

  .levels-header h3 {
    font-size: 20px;
    line-height: 1.05;
  }

  .levels-header button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 13px;
  }

  .level-row {
    grid-template-columns: 66px minmax(0, 1fr);
    gap: 6px;
    padding: 8px;
  }

  .level-number {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .level-meta strong {
    font-size: 13px;
  }

  .level-meta small {
    font-size: 10px;
    line-height: 1.15;
  }

  .slot-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    min-width: 0;
    overflow: visible;
    padding-bottom: 0;
  }

  .slot-card {
    min-width: 0;
    width: auto;
    gap: 4px;
    padding: 5px;
  }

  .slot-head {
    gap: 3px;
    font-size: 7px;
    line-height: 1.05;
  }

  .clear-slot {
    min-height: 18px;
    padding: 0 4px;
    border-radius: 6px;
    font-size: 7px;
  }

  .slot-preview {
    min-height: 40px;
    border-radius: 6px;
  }

  .slot-preview img {
    width: 34px;
    height: 34px;
  }

  .slot-preview span {
    width: 30px;
    height: 30px;
    border-width: 1px;
    font-size: 12px;
  }

  .slot-description {
    min-width: 0;
    min-height: 28px;
    border-radius: 6px;
    padding: 4px;
    font-size: 9px;
  }
}

@media (max-width: 680px) and (orientation: portrait) {
  .levels-panel {
    overflow: hidden;
  }

  .level-row {
    grid-template-columns: 112px minmax(0, 1fr);
    overflow: hidden;
  }

  .slot-grid {
    display: grid;
    grid-template-columns: repeat(4, 132px);
    gap: 8px;
    min-width: 552px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
  }

  .slot-card {
    width: 132px;
    min-width: 132px;
  }
}

@media (max-width: 680px) {
  .dex-main,
  .dex-sidebar {
    padding: 16px;
  }

  .top-panel,
  .levels-header,
  .status-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .creator-tools {
    justify-content: stretch;
  }

  .creator-tools button,
  .levels-header button {
    width: 100%;
  }

  .level-row {
    grid-template-columns: 82px minmax(0, 1fr);
    min-height: 242px;
  }

  .level-meta {
    position: sticky;
    left: 0;
    z-index: 2;
    border-right: 1px solid var(--line-soft);
    background: rgba(16, 27, 34, 0.96);
    padding-right: 8px;
  }

  .level-meta strong {
    font-size: 16px;
  }

  .level-meta small {
    font-size: 12px;
  }

  .slot-grid {
    grid-template-columns: repeat(4, minmax(132px, 132px));
  }

  .slot-card {
    width: 132px;
  }

  .slot-preview {
    min-height: 74px;
  }

  .slot-preview img {
    width: 60px;
    height: 60px;
  }

  .history-meta,
  .history-versions,
  .leaderboard-header,
  .leaderboard-row,
  .proficiency-results-header,
  .proficiency-result-row {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .proficiency-result-row small {
    text-align: left;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: flex;
    flex-direction: column;
    width: auto;
    min-width: 100vw;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .dex-sidebar {
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 22px;
  }

  .dex-main {
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 24px;
  }

  .detail-grid {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .pokemon-card {
    max-height: none;
    height: auto;
    overflow: visible;
  }

  .levels-panel {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .levels-container {
    display: grid;
    overflow: visible;
    padding-right: 0;
  }

  .pokemon-list {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  }

  .top-panel,
  .levels-header,
  .status-strip,
  .leaderboard-header,
  .history-meta {
    align-items: center;
    flex-direction: row;
  }

  .creator-tools {
    justify-content: flex-end;
  }

  .creator-tools button,
  .levels-header button {
    width: auto;
  }

  .level-row {
    grid-template-columns: 112px minmax(0, 1fr);
    min-height: 0;
  }

  .level-meta {
    position: static;
    border-right: 0;
    background: transparent;
    padding-right: 0;
  }

  .slot-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow-x: visible;
    padding-bottom: 0;
  }

  .slot-card {
    min-width: 0;
    width: auto;
    gap: 6px;
    padding: 8px;
  }

  .slot-preview {
    min-height: 68px;
  }

  .slot-preview img {
    width: 56px;
    height: 56px;
  }

  .slot-preview span {
    width: 46px;
    height: 46px;
    font-size: 18px;
  }

  .slot-head {
    align-items: start;
    font-size: 10px;
  }

  .clear-slot {
    min-height: 24px;
    padding: 0 6px;
    font-size: 10px;
  }

  .slot-description {
    min-height: 36px;
    padding: 8px;
    font-size: 12px;
  }

  #proficiencySearchBtn,
  #fishingSystemSearchBtn {
    order: -1;
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) and (orientation: portrait) {
  .levels-panel {
    padding: 10px;
  }

  .levels-header {
    gap: 10px;
  }

  .levels-header h3 {
    font-size: 20px;
    line-height: 1.05;
  }

  .levels-header button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 13px;
  }

  .level-row {
    grid-template-columns: 66px minmax(0, 1fr);
    gap: 6px;
    min-height: 0;
    overflow: visible;
    padding: 8px;
  }

  .level-number {
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .level-meta {
    position: static;
    border-right: 0;
    background: transparent;
    padding-right: 0;
  }

  .level-meta strong {
    font-size: 13px;
  }

  .level-meta small {
    font-size: 10px;
    line-height: 1.15;
  }

  .slot-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    min-width: 0;
    overflow: visible;
    padding-bottom: 0;
  }

  .slot-card {
    min-width: 0;
    width: auto;
    gap: 4px;
    padding: 5px;
  }

  .slot-head {
    gap: 3px;
    font-size: 7px;
    line-height: 1.05;
  }

  .clear-slot {
    min-height: 18px;
    padding: 0 4px;
    border-radius: 6px;
    font-size: 7px;
  }

  .slot-preview {
    min-height: 40px;
    border-radius: 6px;
  }

  .slot-preview img {
    width: 34px;
    height: 34px;
  }

  .slot-preview span {
    width: 30px;
    height: 30px;
    border-width: 1px;
    font-size: 12px;
  }

  .slot-description {
    min-width: 0;
    min-height: 28px;
    border-radius: 6px;
    padding: 4px;
    font-size: 9px;
  }
}

@media (max-width: 680px) and (orientation: portrait) {
  .levels-panel {
    padding: 9px;
  }

  .level-row {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 5px;
    min-height: 0;
    overflow: visible;
    padding: 8px;
  }

  .slot-grid {
    grid-template-columns: repeat(4, minmax(52px, 1fr));
    gap: 4px;
    min-width: 0;
    overflow: visible;
    padding-bottom: 0;
  }

  .slot-card {
    min-width: 0;
    width: auto;
    gap: 4px;
    padding: 4px;
  }

  .clear-slot {
    max-width: 34px;
    overflow: hidden;
    padding: 0 3px;
  }

  .slot-preview {
    min-height: 46px;
  }

  .slot-preview img {
    width: 38px;
    height: 38px;
  }

  .slot-preview span {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .slot-description {
    font-size: 8px;
  }
}

@media (max-width: 980px) and (orientation: portrait) {
  .levels-panel {
    padding: 10px !important;
  }

  .levels-panel .level-row {
    grid-template-columns: 74px minmax(0, 1fr) !important;
    gap: 5px !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 8px !important;
  }

  .levels-panel .level-meta {
    position: static !important;
    border-right: 0 !important;
    background: transparent !important;
    padding-right: 0 !important;
  }

  .levels-panel .slot-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(54px, 1fr)) !important;
    gap: 4px !important;
    min-width: 0 !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
  }

  .levels-panel .slot-card {
    min-width: 0 !important;
    width: auto !important;
    gap: 4px !important;
    padding: 4px !important;
  }

  .levels-panel .slot-head {
    gap: 2px !important;
    font-size: 7px !important;
    line-height: 1 !important;
  }

  .levels-panel .clear-slot {
    max-width: 34px !important;
    min-height: 18px !important;
    overflow: hidden !important;
    padding: 0 3px !important;
    font-size: 7px !important;
  }

  .levels-panel .slot-preview {
    min-height: 48px !important;
    border-radius: 6px !important;
  }

  .levels-panel .slot-preview img {
    width: 40px !important;
    height: 40px !important;
  }

  .levels-panel .slot-preview span {
    width: 34px !important;
    height: 34px !important;
    border-width: 1px !important;
    font-size: 13px !important;
  }

  .levels-panel .slot-description {
    min-width: 0 !important;
    min-height: 28px !important;
    border-radius: 6px !important;
    padding: 4px !important;
    font-size: 8px !important;
  }

  .levels-panel .slot-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    max-height: 150px;
  }

  .levels-panel .slot-suggestions button {
    min-height: 28px;
    font-size: 9px;
    padding: 6px;
  }

}
