/* In-game modals — alerts, wins, settings, rules */

#game-modals-root {
  position: relative;
  z-index: 200000;
  pointer-events: none;
}

.game-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
  pointer-events: auto;
  font-family: "Super Pandora", system-ui, sans-serif;
}

.game-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  cursor: pointer;
}

.game-modal-panel {
  position: relative;
  z-index: 1;
  max-width: min(96vw, 520px);
  max-height: min(92vh, 780px);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

.game-modal-close {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 3;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(20, 16, 12, 0.85);
  color: #ffe566;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.game-modal-close:hover {
  background: rgba(40, 32, 24, 0.95);
}

/* ── Text alert ── */

.game-modal-box--message {
  background: linear-gradient(180deg, #2a2218 0%, #1a1410 100%);
  border: 2px solid rgba(255, 234, 49, 0.45);
  border-radius: 14px;
  padding: 1.75rem 1.25rem 1.5rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.game-modal-caption {
  margin: 0 0 0.75rem;
  color: #ffea31;
  font-size: clamp(1.1rem, 4.5vw, 1.45rem);
  line-height: 1.25;
}

.game-modal-message {
  margin: 0;
  color: #fff;
  font-size: clamp(0.95rem, 3.8vw, 1.15rem);
  line-height: 1.45;
  white-space: pre-line;
}

.game-modal-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  margin-top: 1.25rem;
  flex-wrap: wrap;
}

.game-modal-btn {
  min-width: 5.5rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid rgba(255, 234, 49, 0.55);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffea31 0%, #d4b800 100%);
  color: #1a1408;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}

.game-modal-btn--secondary {
  background: rgba(30, 26, 20, 0.95);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.game-modal-btn:hover {
  filter: brightness(1.06);
}

/* ── Win celebration ── */

.game-modal-overlay--win .game-modal-panel {
  max-width: min(98vw, 640px);
}

.game-modal-win {
  position: relative;
  width: min(96vw, 560px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-modal-win-panel {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
  user-select: none;
}

.game-modal-win-title {
  position: absolute;
  top: 12%;
  left: 50%;
  transform: translateX(-50%);
  width: 62%;
  max-width: 340px;
  height: auto;
  pointer-events: none;
}

.game-modal-win-amount {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translateX(-50%);
  color: #fff;
  font-size: clamp(1.6rem, 7vw, 2.75rem);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85), 0 0 12px rgba(255, 200, 50, 0.35);
  white-space: nowrap;
}

/* ── Free spins ── */

.game-modal-free-spins-count {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translateX(-50%);
  color: #fff;
  font-size: clamp(2rem, 9vw, 3.5rem);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85);
}

.game-modal-start-btn {
  position: absolute;
  left: 50%;
  bottom: 10%;
  transform: translateX(-50%);
  min-width: 8rem;
  padding: 0.65rem 1.5rem;
  border: 1px solid rgba(255, 234, 49, 0.55);
  border-radius: 10px;
  background: linear-gradient(180deg, #ffea31 0%, #d4b800 100%);
  color: #1a1408;
  font-family: inherit;
  font-size: clamp(1rem, 4vw, 1.35rem);
  font-weight: 700;
  cursor: pointer;
}

/* ── Settings ── */

.game-modal-box--settings {
  background: url("../png/gui/SettingsPanel.webp") center top / contain no-repeat;
  width: min(96vw, 480px);
  min-height: 520px;
  padding: 3.5rem 1.5rem 1.5rem;
  box-sizing: border-box;
  padding-left: 20%;
  padding-right: 20%;
}

.game-modal-settings-title {
  display: block;
  width: 70%;
  max-width: 280px;
  margin: 0 auto 1.5rem;
  height: auto;
}

.game-modal-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.5rem;
  margin-bottom: 1.75rem;
}

.game-modal-settings-label {
  display: block;
  text-align: center;
  color: #000;
  font-size: 0.95rem;
  margin-bottom: 0.45rem;
}

.game-modal-toggle {
  display: block;
  width: 4.5rem;
  height: 2.2rem;
  margin: 0 auto;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.game-modal-toggle img {
  width: 100%;
  height: auto;
  display: block;
}

.game-modal-link-btn {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 0.65rem auto;
  padding: 0.7rem 1rem;
  border: 1px solid rgba(255, 234, 49, 0.35);
  border-radius: 8px;
  background: rgba(20, 16, 12, 0.75);
  color: #fff;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.game-modal-link-btn:hover {
  background: rgba(40, 32, 24, 0.9);
}

/* ── Rules / info tabs ── */

.game-modal-box--rules {
  position: relative;
  background: url("../png/gui/InfoPanel.webp") center top / 100% auto no-repeat;
  width: min(96vw, 520px);
  min-height: 560px;
  max-height: min(88vh, 680px);
  padding: 3.25rem 1.25rem 4.5rem;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  --game-label-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  --game-text-bg: rgba(10, 8, 6, 0.55);
  --game-text-border: rgba(255, 234, 49, 0.2);
}

.game-modal-rules-title {
  text-align: center;
  color: #ffe566;
  font-size: clamp(1rem, 4vw, 1.25rem);
  margin: 0 auto 0.75rem;
  flex-shrink: 0;
  display: inline-block;
  align-self: center;
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  background: var(--game-text-bg);
  border: 1px solid var(--game-text-border);
  text-shadow: var(--game-label-shadow);
}

.game-modal-rules-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2.25rem;
}

.game-modal-rules-tab {
  display: none;
}

.game-modal-rules-tab.is-active {
  display: block;
}

.game-modal-legend {
  text-align: center;
  color: #fff;
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 0 auto 1rem;
  max-width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: var(--game-text-bg);
  border: 1px solid var(--game-text-border);
  text-shadow: var(--game-label-shadow);
}

.game-modal-symbol-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1rem;
  margin: 0.5rem 0 1rem;
}

.game-modal-symbol-grid img {
  width: 3.25rem;
  height: 3.25rem;
  object-fit: contain;
}

.game-modal-spec-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1rem;
  text-align: left;
}

.game-modal-spec-row img {
  width: 3rem;
  height: 3rem;
  object-fit: contain;
  flex-shrink: 0;
}

.game-modal-spec-row p {
  flex: 1;
  margin: 0;
  color: #fff;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-line;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: var(--game-text-bg);
  border: 1px solid var(--game-text-border);
  text-shadow: var(--game-label-shadow);
}

.game-modal-rules-section {
  margin-bottom: 1.25rem;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: var(--game-text-bg);
  border: 1px solid var(--game-text-border);
}

.game-modal-rules-section h4 {
  margin: 0 0 0.35rem;
  color: #ffe566;
  font-size: 0.9rem;
  text-shadow: var(--game-label-shadow);
}

.game-modal-rules-section p {
  margin: 0;
  color: #fff;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-line;
  text-shadow: var(--game-label-shadow);
}

.game-modal-rules-nav {
  position: absolute;
  bottom: 1rem;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.game-modal-nav-btn {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.game-modal-nav-btn img {
  width: 100%;
  height: auto;
}

.game-modal-nav-dots {
  display: flex;
  gap: 0.45rem;
}

.game-modal-nav-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}

.game-modal-nav-dot.is-active {
  background: #ffea31;
}

@media (max-width: 768px) {
  .game-modal-box--settings {
    min-height: 460px;
  }

  .game-modal-box--rules {
    min-height: 500px;
  }
}
