/* Palace of the Djinn, v4: the background is pinned to the screen (the same picture on every tab,
   whatever the page height; it does not stretch with long pages). Keep this file beside background.webp. */
.tg-palace-theme {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100svh;
  background: #03131c;
}
/* A dark veil over the picture and almost solid tiles, on every screen: the text stays readable,
   the palace and the genie still show around it. */
.tg-palace-theme::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: #03131c;
  background-image: linear-gradient(#03131cb3, #03131cc7), url("./background.webp");
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
}
.tg-palace-theme .tg-glass,
.tg-palace-theme .tg-glass-soft {
  background: linear-gradient(160deg, #0a2a38f0, #041722f2);
}
.tg-palace-theme main p,
.tg-palace-theme main li,
.tg-palace-theme main h1,
.tg-palace-theme main h2,
.tg-palace-theme main nav a {
  text-shadow: 0 1px 2px #000c, 0 0 8px #000a;
}
/* Narrow screens: the genie side of the picture kept in view. */
@media (max-width: 1023px) {
  .tg-palace-theme::before {
    background-position: center center, right center;
  }
}
@media print {
  .tg-palace-theme::before { display: none; }
}


/* Palace of the Djinn: only the showcase component. No global rules. */
.tg-palace-profile {
  --tg-palace-text: #ffe5ad;
  position: relative;
  width: 100%;
  aspect-ratio: 1659 / 948;
  container-type: inline-size;
  isolation: isolate;
  color: var(--tg-palace-text);
  font-family: Georgia, "Times New Roman", serif;
}
.tg-palace-profile *, .tg-palace-profile *::before, .tg-palace-profile *::after { box-sizing: border-box; }
.tg-palace-profile__frame { display: block; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; user-select: none; }
.tg-palace-profile__avatar {
  position: absolute; left: 12.35%; top: 9.4%; width: 13.2%; aspect-ratio: 1;
  display: grid; place-items: center; overflow: hidden; border-radius: 50%;
}
.tg-palace-profile__avatar > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.tg-palace-profile__nickname {
  position: absolute; left: 32.8%; top: 14.8%; width: 41%; height: 12.9%;
  display: flex; align-items: center; padding-inline: 1.2%;
  font-size: 3.8cqw; font-weight: 700; line-height: 1.1;
}
.tg-palace-profile__nickname > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-palace-profile__rank {
  position: absolute; left: 41.4%; top: 28.7%; width: 17.4%; height: 4.8%;
  display: grid; place-items: center; font-size: 1.65cqw; font-weight: 700;
  line-height: 1; letter-spacing: .12cqw; text-transform: uppercase;
}
.tg-palace-profile__level-label {
  position: absolute; left: 81.1%; top: 14.1%; width: 12.1%; height: 4.6%;
  display: grid; place-items: center; font-size: 1.65cqw; font-weight: 700; letter-spacing: .12cqw;
}
.tg-palace-profile__level {
  position: absolute; left: 81.1%; top: 18.5%; width: 12.1%; height: 13.2%;
  display: grid; place-items: center; font-size: 5cqw; line-height: 1; font-weight: 700;
}
.tg-palace-profile__heading {
  position: absolute; left: 37.8%; top: 36.8%; width: 24.5%; height: 5%;
  display: grid; place-items: center; margin: 0; font-size: 1.65cqw;
  line-height: 1; letter-spacing: .11cqw; font-weight: 700; white-space: nowrap;
}
.tg-palace-profile__slots { list-style: none; margin: 0; padding: 0; }
.tg-palace-profile__slot {
  position: absolute; width: 15.6%; height: 21.2%; top: 43.5%;
  display: flex; align-items: center; justify-content: center;
}
.tg-palace-profile__slot:nth-child(5n + 1) { left: 7.35%; }
.tg-palace-profile__slot:nth-child(5n + 2) { left: 24.8%; }
.tg-palace-profile__slot:nth-child(5n + 3) { left: 42.4%; }
.tg-palace-profile__slot:nth-child(5n + 4) { left: 59.9%; }
.tg-palace-profile__slot:nth-child(5n) { left: 77.45%; }
.tg-palace-profile__slot:nth-child(n + 6) { top: 67.8%; }
/* The caller's existing badge component controls its own image and tooltip.
   This wrapper only positions it; it does not filter or recolor its image. */
.tg-palace-profile__slot > .tg-palace-profile__badge {
  display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
}
.tg-palace-profile__badge > img { display: block; width: 74%; height: 82%; object-fit: contain; }
.tg-palace-profile__badge:focus-visible { outline: 2px solid #fff4cd; outline-offset: 3px; border-radius: 5px; }
.tg-palace-profile__slot:focus-within { z-index: 2; }
.tg-palace-profile[data-rank="drewno"] { --tg-palace-text: #ffe5b3; }
.tg-palace-profile[data-rank="miedz"] { --tg-palace-text: #ffd8b8; }
.tg-palace-profile[data-rank="srebro"] { --tg-palace-text: #edf6ff; }
.tg-palace-profile[data-rank="zloto"] { --tg-palace-text: #ffe5ad; }
.tg-palace-profile[data-rank="platyna"] { --tg-palace-text: #ddfff6; }
.tg-palace-profile[data-rank="diament"] { --tg-palace-text: #dbf4ff; }
.tg-palace-profile[data-rank="rubin"] { --tg-palace-text: #ffe0c5; }
.tg-palace-profile[data-rank="master"] { --tg-palace-text: #ffebbc; }


/* TikGame / Pałac Dżina. Add tg-palace-theme to the full-page wrapper.
   Existing badge artwork and application data remain under application control. */
.tg-palace-theme {
  --tg-gold: #f1cf82;
  --tg-muted: #bbd1d6;
  --tg-panel-border: #c6a05d;
  --tg-xp-start: #04d3e4;
  --tg-xp-end: #f5d496;
  color: #e8f1ef;
}
.tg-palace-theme *, .tg-palace-theme *::before, .tg-palace-theme *::after { box-sizing: border-box; }
.tg-palace-theme .tg-palace-panel {
  border: 1px solid var(--tg-panel-border);
  border-radius: 12px;
  background: linear-gradient(125deg, #083040ed, #041722f5);
  box-shadow: inset 0 0 0 3px #e3c37e0a, 0 7px 25px #0002;
  padding: 20px;
}
.tg-palace-theme .tg-palace-title {
  color: var(--tg-gold);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
}
.tg-palace-theme .tg-palace-muted { color: var(--tg-muted); line-height: 1.6; }
.tg-palace-theme .tg-palace-progress {
  display: block; width: 100%; height: 12px;
  margin: 0; overflow: hidden; appearance: none; -webkit-appearance: none;
  border: 1px solid #73959a99; border-radius: 999px;
  background: #0b2430; color: var(--tg-xp-start); accent-color: var(--tg-xp-start);
}
.tg-palace-theme .tg-palace-progress::-webkit-progress-bar {
  background: #0b2430; border-radius: 999px; box-shadow: inset 0 1px 4px #0008;
}
.tg-palace-theme .tg-palace-progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--tg-xp-start), var(--tg-xp-end));
  border-radius: 999px; box-shadow: inset 0 1px 1px #ffffff66;
}
.tg-palace-theme .tg-palace-progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--tg-xp-start), var(--tg-xp-end));
  border-radius: 999px; box-shadow: inset 0 1px 1px #ffffff66;
}
.tg-palace-theme .tg-palace-progress--large { height: 18px; }
.tg-palace-theme .tg-palace-progress--small { height: 8px; }
.tg-palace-theme .tg-palace-progress[data-rank="drewno"] { --tg-xp-start:#855533; --tg-xp-end:#e7be7d; }
.tg-palace-theme .tg-palace-progress[data-rank="miedz"] { --tg-xp-start:#ad542f; --tg-xp-end:#f0b585; }
.tg-palace-theme .tg-palace-progress[data-rank="srebro"] { --tg-xp-start:#8393a3; --tg-xp-end:#edf5ff; }
.tg-palace-theme .tg-palace-progress[data-rank="zloto"] { --tg-xp-start:#c28a26; --tg-xp-end:#ffe6a1; }
.tg-palace-theme .tg-palace-progress[data-rank="platyna"] { --tg-xp-start:#86bdbb; --tg-xp-end:#e5fff9; }
.tg-palace-theme .tg-palace-progress[data-rank="diament"] { --tg-xp-start:#188bdf; --tg-xp-end:#c9f8ff; }
.tg-palace-theme .tg-palace-progress[data-rank="rubin"] { --tg-xp-start:#a91f43; --tg-xp-end:#ff9ba9; }
.tg-palace-theme .tg-palace-progress[data-rank="master"] { --tg-xp-start:#9144dd; --tg-xp-end:#f4d58c; }
.tg-palace-theme .tg-palace-stat-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.tg-palace-theme .tg-palace-tag {
  display: inline-block; border: 1px solid #b99c67; border-radius: 999px;
  padding: 3px 10px; color: #f1e5cb; background: #112d3c; font-size: 12px; line-height: 1.4;
}
.tg-palace-theme .tg-palace-button {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; justify-content: center; align-items: center; gap: 10px;
  min-height: 44px; padding: 10px 18px; border-radius: 9px; border: 1px solid #71d9ea;
  background: linear-gradient(180deg,#007fa2,#00567b);
  color: #fff9df; font: inherit; font-weight: 700; line-height: 1.3;
  text-decoration: none; text-align: center; cursor: pointer;
  box-shadow: inset 0 1px 0 #ffffff33,0 3px 12px #00d0e01a;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tg-palace-theme .tg-palace-button--secondary {
  background: linear-gradient(180deg,#1b3440,#081f2b);
  border-color: #c9a568; color: #f1d89c;
}
.tg-palace-theme .tg-palace-button:hover:not(:disabled):not([aria-disabled="true"]) {
  border-color: #f4d68d; box-shadow: inset 0 1px 0 #ffffff33,0 0 14px #52d8e333;
}
.tg-palace-theme .tg-palace-button:disabled, .tg-palace-theme .tg-palace-button[aria-disabled="true"] {
  opacity: .55; cursor: default;
}
.tg-palace-theme .tg-palace-tabs {
  display: flex; gap: 22px; overflow-x: auto; border-bottom: 1px solid #b38d4b70;
}
.tg-palace-theme .tg-palace-tab {
  display: inline-flex; align-items: center; padding: 14px 0;
  color: #c4dbe0; text-decoration: none; white-space: nowrap;
  font: inherit; background: transparent; border: 0; border-bottom: 2px solid transparent;
}
.tg-palace-theme .tg-palace-tab[aria-current="page"], .tg-palace-theme .tg-palace-tab[aria-selected="true"] {
  color: #f6d992; border-bottom-color: #f2cf80; font-weight: 700;
}
.tg-palace-theme .tg-palace-avatar {
  border-radius: 50%; overflow: hidden; border: 2px solid #c8a15c;
  background: radial-gradient(circle at 30% 25%,#164757,#061c28);
}
.tg-palace-theme .tg-palace-avatar > img { width: 100%; height: 100%; display: block; object-fit: cover; }
.tg-palace-theme .tg-palace-input {
  max-width: 100%; min-height: 44px; background: #0b2833; color: #fff0cf;
  border: 1px solid #a88c59; border-radius: 8px; padding: 9px 12px; font: inherit;
}
.tg-palace-theme :is(.tg-palace-button,.tg-palace-tab,.tg-palace-input):focus-visible {
  outline: 2px solid #fff0b9; outline-offset: 4px;
}
@media (prefers-reduced-motion: reduce) {
  .tg-palace-theme .tg-palace-button { transition: none; }
}

