/* ==========================================
   WIKI-MODERN THEME (v2)
   - styl wiki + czytelne panele
   - zachowane pozycje slotów Alchemia.png
   - ulepszony przycisk Lista bonusów i +/-
   ========================================== */

/* ---------- Zmienne kolorów ---------- */
:root {
  --bg: #f8f9fa;
  --text: #202122;
  --muted: #54595d;
  --border: #dfe2e5;
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 18px rgba(0,0,0,.06);
  --link: #36c;
  --link-visited: #6b4;
  --accent: #2a4b8d;
  --accent-soft: #e7f0ff;
  --success: #14866d;
  --danger: #b32424;

  --slot-bg: rgba(0,0,0,0.03);
  --slot-hover: rgba(42, 75, 141, 0.12);
}

/* ---------- Tryb ciemny ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f14;
    --text: #e6e6e6;
    --muted: #b3b3b3;
    --border: #1f2a33;
    --card: #10171e;
    --shadow: 0 2px 14px rgba(0,0,0,.35);
    --link: #7ab8ff;
    --link-visited: #a5d690;
    --accent: #4da3ff;
    --accent-soft: rgba(77,163,255,.12);
    --slot-bg: rgba(255,255,255,0.04);
    --slot-hover: rgba(77,163,255,.16);
  }
}

/* ---------- Reset + typografia ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", "Helvetica Neue", Helvetica, sans-serif;
}

h1, h2, h3 {
  line-height: 1.25;
  margin: 0 0 .6rem;
  font-weight: 700;
}
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; color: var(--muted); }

p { margin: 0 0 .8rem; color: var(--text); }
small, .muted { color: var(--muted); }

a {
  color: var(--link);
  text-decoration: none;
}
a:hover { text-decoration: underline; }
a:visited { color: var(--link-visited); }

/* ---------- Layout ---------- */
.container {
  max-width: 1280px;
  margin: 24px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(520px, 560px) 1fr;
  gap: 28px;
}

/* ---------- Karty/panele ---------- */
.alchemy,
.inventory-wrap,
.filters,
.inventory,
.tooltip {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* ---------- Sekcja Alchemii ---------- */
.alchemy {
  position: relative;
  padding: 12px;
}

.bg {
  width: 100%;
  max-width: 512px;
  height: auto;
  display: block;
  margin: 0 auto;
  border-radius: 6px;
}

/* ---------- Sloty ---------- */
.slots {
  position: absolute;
  inset: 12px;
  max-width: 512px;
  margin: 0 auto;
  left: 50%;
  transform: translateX(-50%);
  height: 512px;
  z-index: 3;
  pointer-events: none;
}

.slot {
  position: absolute;
  width: 64px;
  height: 64px;
  border: 2px solid transparent;
  border-radius: 10px;
  background: none;
  box-shadow: none;
  transition: transform .2s ease, box-shadow .2s ease;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  filter: drop-shadow(0 0 4px rgba(0,0,0,0.9)); /* maskuje białe krawędzie z PNG */
}



/* --- Efekt hover: animowany pulsujący glow --- */
@keyframes pulseGlow {
  0%   { box-shadow: 0 0 10px 2px currentColor; }
  50%  { box-shadow: 0 0 20px 6px currentColor; }
  100% { box-shadow: 0 0 10px 2px currentColor; }
}

.slot:hover {
  transform: translate(-50%, -50%) scale(1.06);
  animation: pulseGlow 1.6s ease-in-out infinite;
}

/* --- Kolory glow dla każdego slotu --- */
.slot-blue   { color: rgba(85,170,255,0.5); }
.slot-red    { color: rgba(255,85,85,0.5); }
.slot-green  { color: rgba(68,255,119,0.5); }
.slot-black  { color: rgba(130,130,130,0.5); }
.slot-yellow { color: rgba(255,204,51,0.5); }
.slot-purple { color: rgba(130,85,255,0.5); }

.slot.occupied {
  border-color: inherit;
  animation: none;
}

/* --- Ikona wewnątrz slotu --- */
.placed {
  position: relative;
  width: 100%;
  height: 100%;
}
.placed img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(0,0,0,0.8)); /* usuwa biały kontur z pliku PNG */
}


/* --- POZYCJE SLOTÓW (dopasowane 1:1 do grafiki Alchemia.png) --- */
.slot-blue   { left: 50.2%; top: 23.5%;  border-color: #55aaff; transform: translate(-50%, -50%); }
.slot-red    { left: -8.6%; top: 41.6%;  border-color: #ff5555; transform: translate(-50%, -50%); }
.slot-green  { left: -8.6%; top: 66.1%;  border-color: #44ff77; transform: translate(-50%, -50%); }
.slot-black  { left: 107.5%; top: 41.6%; border-color: #666; transform: translate(-50%, -50%); }
.slot-yellow { left: 107.5%; top: 66.1%; border-color: #ffcc33; transform: translate(-50%, -50%); }
.slot-purple { left: 50.2%; top: 84.1%;  border-color: #8255ff; transform: translate(-50%, -50%); }

/* Hover poświaty */
.slot-blue:hover   { box-shadow: 0 0 0 3px rgba(85,170,255,0.35); }
.slot-red:hover    { box-shadow: 0 0 0 3px rgba(255,85,85,0.35); }
.slot-green:hover  { box-shadow: 0 0 0 3px rgba(68,255,119,0.35); }
.slot-black:hover  { box-shadow: 0 0 0 3px rgba(102,102,102,0.35); }
.slot-yellow:hover { box-shadow: 0 0 0 3px rgba(255,204,51,0.35); }
.slot-purple:hover { box-shadow: 0 0 0 3px rgba(130,85,255,0.35); }

/* ---------- Panel po prawej ---------- */
.inventory-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

/* ---------- Pasek filtrów ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  align-items: center;
}

.filters select,
.filters button {
  appearance: none;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.filters select:focus,
.filters button:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#btn-reset {
  font-weight: 600;
  cursor: pointer;
}

/* ---------- Lista ikon (ekwipunek) – stały układ siatki ---------- */
.inventory-wrap {
  width: 100%;
  display: block;
}

.inventory {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  grid-auto-rows: 72px;
  gap: 12px;
  justify-content: center;
  align-content: start;
  padding: 16px;
  width: 100%;
  max-width: 600px; /* szerokość pola z kamieniami */
  margin: 0 auto;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.item {
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--slot-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 68px;
  height: 68px;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.item img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  image-rendering: auto;
}

.item:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 0 6px rgba(42,75,141,0.3);
}


/* ---------- Przyciski ---------- */
.bonusy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(42, 75, 141, 0.3);
  margin: 12px auto;
  transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
}
.bonusy-btn:hover {
  background: #1e3d7a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(42, 75, 141, 0.4);
}
.bonusy-btn img {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

/* ---------- Tooltip ---------- */
.tooltip {
  position: fixed;
  background: var(--card);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  z-index: 999;
  pointer-events: none;
  box-shadow: var(--shadow);
  max-width: 260px;
  text-align: left;
}
.tooltip b { color: var(--accent); }
.tooltip hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 6px 0;
}

/* ---------- Przyciski +/- ---------- */
.alchemy .slot > button {
  background: var(--accent);
  border: none;
  color: #fff !important;
  font-weight: 700;
  font-size: 18px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.alchemy .slot > button:hover {
  background: #1e3d7a;
  transform: scale(1.08);
}
.alchemy .slot > button:active {
  transform: scale(0.95);
}

/* Etykieta poziomu */
.alchemy .slot > div[style*="position: absolute"][style*="right: 6px"] {
  color: var(--accent);
  font-weight: 700;
  text-shadow: 0 0 4px rgba(42,75,141,.4);
}

/* ---------- Efekty błysku ---------- */
@keyframes glow-green {
  0%   { box-shadow: 0 0 0 0 rgba(20,134,109,.35); }
  50%  { box-shadow: 0 0 20px 6px rgba(20,134,109,.45); }
  100% { box-shadow: 0 0 0 0 rgba(20,134,109,.35); }
}
@keyframes glow-red {
  0%   { box-shadow: 0 0 0 0 rgba(179,36,36,.35); }
  50%  { box-shadow: 0 0 20px 6px rgba(179,36,36,.45); }
  100% { box-shadow: 0 0 0 0 rgba(179,36,36,.35); }
}

.alchemy.flash-green { animation: glow-green .5s ease-out; }
.alchemy.flash-red   { animation: glow-red .5s ease-out; }

/* ---------- Responsywność ---------- */
@media (max-width: 980px) {
  .container {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .alchemy { order: 1; }
  .inventory-wrap { order: 2; }
}
