/* =========================
   Modernes Dark-Theme PokeIdle
   (HTML bleibt unverändert)
   ========================= */

:root {
  --bg-body: #020617;
  --bg-gradient-1: #020617;
  --bg-gradient-2: #0b1220;
  --bg-panel: rgba(15, 23, 42, 0.96);
  --bg-panel-soft: rgba(15, 23, 42, 0.85);
  --bg-elevated: rgba(15, 23, 42, 0.98);

  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.18);
  --accent-strong: #0ea5e9;

  --border-subtle: rgba(148, 163, 184, 0.5);
  --border-strong: rgba(148, 163, 184, 0.9);

  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-soft: #64748b;
  --danger: #f97373;
  --shadow-strong: 0 24px 60px rgba(15, 23, 42, 0.9);
}

/* Global Reset & Basics */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.25), transparent 55%),
    radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.22), transparent 55%),
    linear-gradient(145deg, var(--bg-gradient-1), var(--bg-gradient-2));
  font-family: 'Lato', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: flex-start;

  /* Scrollbar-Farbe für Firefox */
  scrollbar-color: rgba(56, 189, 248, 0.8) rgba(15, 23, 42, 0.95);
  scrollbar-width: thin;
}

/* Links */

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Game Container */

#gameContainer {
  width: min(1120px, 100vw - 32px);
  margin: 32px auto;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.98));
  border-radius: 24px;
  padding: 20px 20px 60px;
  box-shadow: var(--shadow-strong);
  border: 1px solid rgba(148, 163, 184, 0.35);
  position: relative;

  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 280px;
  grid-template-rows: minmax(260px, 1fr) minmax(260px, 1fr);
  grid-column-gap: 18px;
  grid-row-gap: 16px;
}

/* Allgemeine List Styles */

ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

/* Panels / Container */

.container {
  display: block;
  position: relative;
  background: var(--bg-panel);
  border-radius: 18px;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 14px 45px rgba(15, 23, 42, 0.75);
  padding: 12px 12px;
  overflow: hidden;
}

/* ============
   Layout-Grid
   ============ */

#playerPokes {
  grid-column: 1 / 2;
  grid-row: 1 / 3;
  height: auto;
  width: 100%;
  overflow: hidden;
}

#enemy {
  grid-column: 2 / 3;
  grid-row: 1 / 2;
}

#player {
  grid-column: 2 / 3;
  grid-row: 2 / 3;
}

#areasList {
  grid-column: 3 / 4;
  grid-row: 1 / 3;
  height: auto;
}

/* =========================
   Team (linke Spalte)
   ========================= */

#playerPokes {
  text-align: left;
}

#playerPokes .checkDescription {
  font-size: 14px;
  color: var(--text-main); /* FIX: vorher text-muted */
}

#playerPokes .controls {
  position: relative;
  padding: 4px 4px 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

#playerPokes input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

/* Heal Button */

#heal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  margin: 8px 0 2px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid rgba(56, 189, 248, 0.5);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.08s ease, box-shadow 0.18s ease;
  box-shadow: 0 0 0 rgba(56, 189, 248, 0);
}

#heal:hover {
  background: rgba(56, 189, 248, 0.26);
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.55);
}

#heal:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Team-Listen */

#playerPokesList ul,
#playerPokeDex ul {
  position: relative;
  padding-left: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  height: 472px;
  margin-top: 12px;
}

/* Scrollbar (WebKit) – ans Theme angepasst */

#playerPokesList ul::-webkit-scrollbar,
#playerPokeDex ul::-webkit-scrollbar,
#playerStorage ul::-webkit-scrollbar,
#areasList .list::-webkit-scrollbar,
#console::-webkit-scrollbar {
  width: 6px;
}

#playerPokesList ul::-webkit-scrollbar-track,
#playerPokeDex ul::-webkit-scrollbar-track,
#playerStorage ul::-webkit-scrollbar-track,
#areasList .list::-webkit-scrollbar-track,
#console::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 999px;
}

#playerPokesList ul::-webkit-scrollbar-thumb,
#playerPokeDex ul::-webkit-scrollbar-thumb,
#playerStorage ul::-webkit-scrollbar-thumb,
#areasList .list::-webkit-scrollbar-thumb,
#console::-webkit-scrollbar-thumb {
  background: rgba(56, 189, 248, 0.85);
  border-radius: 999px;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.7);
}

/* Storage */

#playerStorage ul {
  position: relative;
  padding-left: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  height: 502px;
}

/* Sortier-Selects */

#pokeSortOrderSelect,
#pokeSortDirSelect,
#dexView {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: var(--text-main);
  padding: 2px 10px;
  font-size: 12px;
  outline: none;
  margin-top: 4px;
}

#pokeSortOrderSelect {
  width: 140px;
  margin-left: 10px;
}

#pokeSortDirSelect {
  width: 80px;
}

/* Dex Farben */

.pokeDex0 { color: #808080; }
.pokeDex1 { color: rgb(128, 159, 255); }
.pokeDex2 { color: #99844b; }
.pokeDex3, .pokeDex5 { color: rgba(85, 109, 181, 0.5); }
.pokeDex4, .pokeDex7 { color: rgba(192, 160, 0, 0.5); }
.pokeDex3, .pokeDex4 { font-style: italic; }
.pokeDex6, .pokeDex8 { font-weight: bold; }
.pokeDex6 { color: rgb(77, 121, 255); }
.pokeDex8 { color: #c0a000; }

/* Team-Management Buttons */

.pokeDeleteButton,
.pokeUpButton,
.pokeDownButton,
.pokeFirstButton,
.pokeEvolveButton {
  display: none;
  font-size: 10px;
  margin-left: 2px;
}

#playerPokesList ul li:first-child .pokeUpButton,
#playerPokesList ul li:last-child .pokeDownButton,
#playerStorage ul li:first-child .pokeUpButton,
#playerStorage ul li:last-child .pokeDownButton {
  display: none;
}

.manageTeamEnabled .pokeDeleteButton,
.manageTeamEnabled .pokeUpButton,
.manageTeamEnabled .pokeDownButton,
.manageTeamEnabled .pokeFirstButton,
.manageTeamEnabled .canEvolve ~ .pokeEvolveButton {
  display: inline-block;
  padding: 0 4px;
}

/* Aktives Team-Pokémon */

.pokeListName {
  text-decoration: none;
  color: var(--text-main);
}

.pokeListName.activePoke {
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
}

/* =========================
   Regionen (rechte Spalte)
   ========================= */

#areasList {
  text-align: left;
  border-radius: 18px;
}

#areasList #regionSelectContainer {
  padding: 4px 10px 4px 4px;
}

#areasList #regionSelect {
  width: 100%;
  padding: 4px 10px;
  font-size: 13px;
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  outline: none;
}

#areasList .list {
  overflow-y: auto;
  overflow-x: hidden;
  height: 558px;
  margin-top: 12px;
  padding-right: 4px;
}

#areasList li,
#areasList a {
  margin-right: 4px;
  color: var(--text-main);
  font-size: 13px;
}

#areasList li {
  padding: 5px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}

#areasList li:hover {
  background: rgba(30, 64, 175, 0.6);
  transform: translateX(-1px);
}

/* =========================
   Gegner / Spieler Sprites
   ========================= */

.poke .inner {
  position: relative;
  line-height: 22px;
  font-size: 13px;
  text-align: center;
}

/* ► Animation über transform statt margin
   funktioniert für Gegner UND Spieler */
.poke .inner .img {
  transition: transform 0.08s ease-out;
  image-rendering: pixelated;
}

/* wird per JS beim Angriff gesetzt */
.poke .inner .img.attacked-right {
  transform: translateX(15px);
}

.poke .inner .img.attacked-left {
  transform: translateX(-15px);
}

.poke .inner .name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* Gegner-Panel */

#enemy {
  display: flex;
  align-items: stretch;
  gap: 12px;
  border-radius: 18px;
  background: var(--bg-elevated);
}

#enemy .inner {
  flex: 1 1 0;
  padding-right: 10px;
  border-right: 1px solid rgba(148, 163, 184, 0.4);
}

#enemy .status,
#enemy .expBar {
  display: none;
}

/* Capture-Options */

#capture-options {
  flex: 0 0 190px;
  box-sizing: border-box;
  padding: 8px 10px;
  margin-top: 0 !important;
  background: var(--bg-panel-soft);
  border-radius: 12px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  font-size: 12px;
}

#capture-options span {
  color: var(--text-muted);
}

#capture-options label {
  font-size: 12px;
  color: var(--text-main);
}

#capture-options input[type="checkbox"],
#capture-options input[type="radio"] {
  accent-color: var(--accent);
  cursor: pointer;
}

.ball-ammount {
  font-weight: 600;
  color: var(--accent);
}

/* =========================
   Spieler (unten Mitte)
   ========================= */

#player {
  background: var(--bg-elevated);
  border-radius: 18px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-rows: minmax(140px, auto) minmax(100px, auto);
  grid-template-areas:
    "playerInfo console"
    "playerInfo playerBox";
  column-gap: 10px;
  row-gap: 10px;
}

/* Spieler Inner */

#player .inner {
  grid-area: playerInfo;
  border-right: 1px solid rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid rgba(15, 23, 42, 0.3);
  padding-right: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#player .name {
  font-weight: 600;
}

#playerImg {
  margin: 4px 0;
}

#player.frontSprite #playerImg {
  -moz-transform: scaleX(-1);
  -o-transform: scaleX(-1);
  -webkit-transform: scaleX(-1);
  transform: scaleX(-1);
  filter: FlipH;
  -ms-filter: "FlipH";
}

/* Sprite Choice */

.spriteChoice {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--text-muted);
}

.spriteChoice label {
  cursor: pointer;
}

/* Konsole */

#console {
  grid-area: console;
  width: 100%;
  height: 190px;
  box-sizing: border-box;
  padding: 6px 8px;
  overflow: auto;
  border-radius: 12px;
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.9));
  border: 1px solid rgba(148, 163, 184, 0.5);
  font-size: 11px;
}

#console .console-text {
  font-family: "Fira Code", monospace;
  color: var(--text-soft);
}

/* Player Box */

#playerBox {
  grid-area: playerBox;
  width: 100%;
  height: auto;
  font-size: 12px;
}

#playerBox button {
  margin-top: 6px;
  width: 130px;
  margin-right: 5px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

#playerBox button:hover {
  background: rgba(30, 64, 175, 0.8);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

#playerBox button:active {
  transform: translateY(0);
  box-shadow: none;
}

#playerBox input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: pointer;
}

#saveLoadButtons {
  margin-bottom: 4px;
}

/* =========================
   Dialoge (Save / Stats)
   ========================= */

#saveDialogContainer,
#statisticsContainer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(15, 23, 42, 0.85);
  z-index: 200;
}

#saveDialog,
#statisticsDialog {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 10vh;
  bottom: 10vh;
  left: 10vw;
  right: 10vw;
  padding: 14px 16px;
  background: radial-gradient(circle at top, #0f172a, #020617);
  border: 1px solid rgba(148, 163, 184, 0.75);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.9);
  border-radius: 20px;
  color: var(--text-main);
}

#saveDialogTitle,
#statisticsTitle {
  flex: 0 0 auto;
  margin: 0;
  padding: 0 0 10px;
  font-size: 18px;
  letter-spacing: 0.04em;
}

#copySaveText {
  float: right;
  margin-top: 2px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  cursor: pointer;
}

#saveText {
  flex: 1 1 auto;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: rgba(15, 23, 42, 0.95);
  color: var(--text-main);
  font-family: "Fira Code", monospace;
  font-size: 12px;
  resize: none;
}

/* =========================
   Footer / Links
   ========================= */

#version,
#gitLink,
#subLink,
#disLink {
  position: absolute;
  bottom: 12px;
  font-size: 11px;
  color: var(--text-muted);
}

#version {
  left: 20px;
}

#gitLink {
  right: 230px;
}

#subLink {
  right: 150px;
}

#disLink {
  right: 70px;
}

#gitLink,
#subLink,
#disLink {
  color: var(--accent);
}

#gitLink:hover,
#subLink:hover,
#disLink:hover {
  text-decoration: underline;
}

/* =========================
   Progress Bars (HP / EXP)
   ========================= */

/* Reset */
progress,
progress[role] {
  appearance: none;
  -moz-appearance: none;
  -webkit-appearance: none;
  border: none;
  background-size: auto;
}

/* Größe */

progress {
  width: 120px;
  height: 6px;
  position: relative;
  top: -2px;
  box-shadow: 0 0 2px black;
  border-radius: 999px;
}

progress.expBar {
  width: 150px;
}

/* Hintergrund */

progress,
progress[role][aria-valuenow] {
  background: rgba(15, 23, 42, 0.9) !important;
}

progress::-webkit-progress-bar {
  background: rgba(15, 23, 42, 0.9);
}

/* ► Standard: HP-Bar (rot) */

/* IE10 */
progress {
  color: var(--danger);
}

/* HP – Firefox */
progress::-moz-progress-bar {
  background: linear-gradient(90deg, #ef4444, #f97316);
  border-radius: 999px;
}

/* HP – Chrome/WebKit */
progress::-webkit-progress-value {
  background: linear-gradient(90deg, #ef4444, #f97316);
  border-radius: 999px;
}

/* HP – Polyfill */
progress[aria-valuenow]:before {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

/* ► EXP-Bar in Grün/Blau */

progress.expBar::-moz-progress-bar {
  background: linear-gradient(90deg, #22c55e, #38bdf8);
}

progress.expBar::-webkit-progress-value {
  background: linear-gradient(90deg, #22c55e, #38bdf8);
}

progress.expBar[aria-valuenow]:before {
  background: linear-gradient(90deg, #22c55e, #38bdf8);
}

/* Polyfill BG-Fix */
progress[role]:after {
  background-image: none;
}

/* Polyfill Text */
progress[role] strong {
  display: none;
}

/* =========================
   Sonstiges
   ========================= */

.hidden {
  display: none;
}

/* Confirm Clear Link */

#confirmClearData + a {
  color: var(--danger);
  font-weight: 600;
}

/* Kleinere Text-Finetunes */

span.status,
span.hp {
  color: var(--text-soft);
  font-size: 12px;
}
