.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
  z-index: 1200;
}

.modal[hidden] {
  display: none !important;
}

.modal__content {
  width: min(100%, 360px);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 24px 20px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.modal__content--win {
  background: linear-gradient(135deg, #1e3a8a 0%, #7c3aed 50%, #ec4899 100%);
  border: 3px solid #fbbf24;
  box-shadow:
    0 0 60px rgba(251, 191, 36, 0.6),
    0 0 100px rgba(236, 72, 153, 0.4),
    0 25px 50px rgba(0, 0, 0, 0.6);
  animation: modal-celebrate 0.6s ease-out;
}

.modal__content--win::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  background: linear-gradient(45deg, #fbbf24, #f59e0b, #ef4444, #ec4899, #a855f7, #6366f1, #3b82f6, #fbbf24);
  background-size: 400% 400%;
  animation: rainbow-border 3s linear infinite;
  z-index: -1;
  opacity: 0.8;
}

.modal__content--win::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.3) 0%, transparent 70%);
  transform: translate(-50%, -50%);
  animation: victory-pulse 2s ease-in-out infinite;
  pointer-events: none;
}

.modal__content--lose {
  background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #475569 100%);
  border: 2px solid #64748b;
  box-shadow:
    0 0 30px rgba(100, 116, 139, 0.3),
    0 25px 50px rgba(0, 0, 0, 0.6);
  animation: modal-appear 0.4s ease-out;
}

.modal__content--lose::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: radial-gradient(circle at top, rgba(100, 116, 139, 0.1) 0%, transparent 60%);
  pointer-events: none;
}

.modal__title {
  margin: 0 0 12px;
  font-size: 1.2rem;
  position: relative;
  z-index: 1;
  user-select: none;
  -webkit-user-select: none;
}

.modal__content--win .modal__title {
  font-family: 'Orbitron', monospace;
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow:
    0 0 20px rgba(251, 191, 36, 0.8),
    0 0 40px rgba(236, 72, 153, 0.6),
    0 4px 8px rgba(0, 0, 0, 0.5);
  animation: title-glow 1.5s ease-in-out infinite;
}

.modal__content--lose .modal__title {
  font-family: 'Orbitron', monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #94a3b8;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.modal__body {
  margin: 0 0 20px;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
  user-select: none;
  -webkit-user-select: none;
}

.modal__content--win .modal__body {
  color: #fef3c7;
}

.modal__content--lose .modal__body {
  color: #cbd5e1;
}

.modal__message {
  margin: 0 0 16px;
  color: var(--text);
  line-height: 1.4;
  position: relative;
  z-index: 1;
}

.modal__content--win .modal__message {
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 600;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.modal__content--lose .modal__message {
  color: #e2e8f0;
  font-size: 1.05rem;
  font-weight: 500;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.modal__score {
  margin: 4px 0 6px;
  font-family: 'Orbitron', monospace;
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--text-bright);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.modal__content--win .modal__score {
  color: #ffffff;
  text-shadow:
    0 0 20px rgba(251, 191, 36, 0.8),
    0 0 35px rgba(236, 72, 153, 0.6),
    0 4px 8px rgba(0, 0, 0, 0.5);
}

.modal__score-breakdown {
  margin: 0 0 16px;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.modal__content--win .modal__score-breakdown {
  color: #fde68a;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.modal__score-bonus {
  margin: 0 0 16px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.modal__content--win .modal__score-bonus {
  color: #fbbf24;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.6), 0 2px 4px rgba(0, 0, 0, 0.4);
}

.modal__time {
  margin: 8px 0 16px;
  font-family: 'Orbitron', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-bright);
  text-align: center;
  position: relative;
  z-index: 1;
}

.modal__content--win .modal__time {
  color: #fde68a;
  text-shadow: 0 2px 8px rgba(253, 230, 138, 0.5);
}

.modal__summary-label {
  margin: 0 0 8px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.modal__content--win .modal__summary-label {
  color: #fde68a;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.modal__content--lose .modal__summary-label {
  color: #94a3b8;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.modal__summary-text {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.modal__summary {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: center;
  margin: 0;
  padding: 0;
  position: relative;
  z-index: 1;
}

.modal__content--win .modal__summary {
  animation: float-up 0.8s ease-out;
}

.modal__content--lose .modal__summary {
  animation: fade-in-subtle 0.6s ease-out;
}

.modal-slot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--slot-empty);
  border: 2px solid rgba(148, 163, 184, 0.35);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.3),
    0 4px 10px rgba(15, 23, 42, 0.35);
  color: #f8fafc;
  overflow: hidden;
  flex-shrink: 0;
}

.modal-slot + .modal-slot {
  margin-left: 0;
}

.modal__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.modal__content--win .modal__actions .btn {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #1e293b;
  font-weight: 800;
  box-shadow:
    0 0 20px rgba(251, 191, 36, 0.6),
    0 8px 16px rgba(0, 0, 0, 0.4);
  border: 2px solid #fef3c7;
  animation: button-pulse 2s ease-in-out infinite;
}

.modal__content--win .modal__actions .btn:hover {
  transform: translateY(-2px);
  box-shadow:
    0 0 30px rgba(251, 191, 36, 0.8),
    0 12px 20px rgba(0, 0, 0, 0.5);
}

.modal__content--lose .modal__actions .btn {
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
  color: #e2e8f0;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid #64748b;
}

.modal__content--lose .modal__actions .btn:hover {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.stats-modal {
  z-index: 1300;
}

.stats-modal .stats-modal__content {
  width: min(90vw, 480px);
  max-width: 480px;
  max-height: 85vh;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.stats-modal__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
}

.stats-modal__title {
  margin: 0;
  font-family: 'Orbitron', monospace;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-bright);
  background: linear-gradient(135deg, #ffffff 0%, #3b82f6 50%, #8b5cf6 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stats-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.stats-modal__close:hover {
  background: var(--accent);
  color: var(--text-bright);
}

.stats__content {
  flex: 1;
  padding: 18px 20px 20px;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.stats__summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.stat-item__value {
  font-family: 'Orbitron', monospace;
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-bright);
  line-height: 1;
}

.stat-item__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}

.stats__distribution {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stats__section-title {
  margin: 0;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.distribution-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.distribution-row {
  display: grid;
  grid-template-columns: 20px 1fr 30px;
  gap: 8px;
  align-items: center;
}

.distribution-row__label {
  font-family: 'Orbitron', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
}

.distribution-row__bar-container {
  position: relative;
  height: 24px;
  background: var(--surface);
  border-radius: 4px;
  overflow: hidden;
}

.distribution-row__bar {
  height: 100%;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  border-radius: 4px;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  min-width: 0;
}

.distribution-row__bar[data-count="0"] {
  width: 0% !important;
}

.distribution-row__count {
  font-family: 'Orbitron', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-align: right;
}

.stats__extras {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-extra {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.stat-extra__icon {
  font-size: 1.8rem;
  line-height: 1;
}

.stat-extra__content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.stat-extra__value {
  font-family: 'Orbitron', monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-bright);
}

.stat-extra__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

@media (max-width: 767px) {
  .stats-modal .stats-modal__content {
    width: 95vw;
    max-height: 80vh;
  }

  .stats-modal__header {
    padding: 16px 18px 10px;
  }

  .stats-modal__title {
    font-size: 1.5rem;
  }

  .stats__content {
    padding: 16px 18px 18px;
  }

  .stats__summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-item__value {
    font-size: 1.6rem;
  }
}

.help-modal {
  z-index: 1300;
}

.help-modal .help-modal__content {
  width: min(90vw, 480px);
  max-width: 480px;
  max-height: 85vh;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.help-modal__header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  background: var(--surface-strong);
  border-bottom: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
}

.help-modal__title {
  margin: 0;
  font-family: 'Orbitron', monospace;
  font-size: 1.8rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-bright);
  background: linear-gradient(135deg, #ffffff 0%, #3b82f6 50%, #8b5cf6 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.help-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: var(--surface-elevated);
  color: var(--text-muted);
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.help-modal__close:hover {
  background: var(--accent);
  color: var(--text-bright);
}

.help-modal .help__content {
  flex: 1;
  padding: 18px 20px 20px;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.help-modal-open .controls {
  display: none;
}

.help-modal-open .app__menu {
  visibility: hidden;
}

.stats-modal-open .controls {
  display: none;
}

.stats-modal-open .app__menu {
  visibility: hidden;
}

@media (max-width: 767px) {
  .help-modal .help-modal__content {
    width: 95vw;
    max-height: 80vh;
  }

  .help-modal__header {
    padding: 16px 18px 10px;
  }

  .help-modal__title {
    font-size: 1.5rem;
  }

  .help-modal .help__content {
    padding: 16px 18px 18px;
  }

  .help__heading {
    font-size: 1rem;
  }

  .help__body,
  .help__list {
    font-size: 0.9rem;
    line-height: 1.5;
  }
}

.onboarding-modal {
  display: block;
  z-index: 1100;
  background: transparent;
  backdrop-filter: none;
  padding: 0;
  animation: none;
}

.onboarding-modal__content {
  position: fixed;
  width: auto;
  max-width: min(90vw, 360px);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
  pointer-events: auto;
  z-index: 1;
  border: 2px solid #ffffff;
}

.onboarding-modal {
  pointer-events: none;
}

.onboarding-modal__title {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
}

.onboarding-modal__body {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.4;
}

.onboarding-modal__actions {
  display: flex;
  justify-content: flex-end;
}

.onboarding-modal__content::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border: 10px solid transparent;
  opacity: 0;
  pointer-events: none;
}

.onboarding-modal__content[data-placement="top"]::after {
  top: 100%;
  left: var(--arrow-x, 50%);
  transform: translateX(-50%);
  border-top-color: #ffffff;
  opacity: 1;
}

.onboarding-modal__content[data-placement="bottom"]::after {
  bottom: 100%;
  left: var(--arrow-x, 50%);
  transform: translateX(-50%);
  border-bottom-color: #ffffff;
  opacity: 1;
}

.onboarding-modal__content[data-placement="left"]::after {
  left: 100%;
  top: var(--arrow-y, 50%);
  transform: translateY(-50%);
  border-left-color: #ffffff;
  opacity: 1;
}

.onboarding-modal__content[data-placement="right"]::after {
  right: 100%;
  top: var(--arrow-y, 50%);
  transform: translateY(-50%);
  border-right-color: #ffffff;
  opacity: 1;
}

.dev-button {
  margin: 0;
  background: transparent;
  color: inherit;
}

.dev-button[aria-hidden="true"] {
  display: none;
}

@media (max-width: 767px) {
    :root {
      --slot-size: 64px;
      --color-button-size: 68px;
    }

    .guess-row {
      gap: 14px;
    }
  }

@media (min-width: 768px) {
    :root {
      --slot-size: 72px;
      --color-button-size: 76px;
    }

    .guess-row {
      gap: 18px;
    }
  }

@media (max-width: 480px) {
    :root {
      --slot-size: 56px;
      --color-button-size: 62px;
    }

    .app {
      padding: 0;
      gap: 12px;
    }

  .app--help {
    width: min(100%, 460px);
    padding: 18px 12px 26px;
    gap: 16px;
  }

  .help__content {
    padding: 18px 18px 22px;
  }

  .app__title img {
    height: 45px;
  }

    .board {
      gap: 8px;
    }

    .guess-row {
      gap: 10px;
    }

  .controls {
    gap: 10px;
  }

  .palette__buttons {
    gap: 12px;
  }

  .actions__buttons {
    gap: 8px;
  }

  .btn {
    padding: 11px;
  }

  .slot::after {
    font-size: 1.6rem;
  }
}

@media (max-width: 360px), (max-height: 720px) {
    :root {
      --slot-size: 54px;
      --color-button-size: 50px;
    }

  .app {
    width: min(100%, 420px);
    padding: 0;
    gap: 30px;
  }

  .app--help {
    width: min(100%, 360px);
    padding: 16px 10px 22px;
    gap: 16px;
  }

  .help__content {
    padding: 16px 16px 20px;
  }

  .app__title {
    font-size: 2.2rem;
  }

  .app__title img {
    height: 60px;
  }

  .controls {
    gap: 25px;
  }

  .btn__label {
    font-size: 0.7rem;
  }

  .slot::after {
    font-size: 1.4rem;
  }
}

/* Desktop responsive adjustments for different screen heights */
@media (min-height: 800px) and (min-width: 540px) {
  .app {
    min-height: auto;
    justify-content: center;
    gap: 65px;
  }
}

@media (max-height: 800px) and (min-width: 540px) {
    :root {
      --slot-size: 62px;
      --color-button-size: 66px;
    }

  .app {
    min-height: 100vh;
    gap: 50px;
    padding: 8px 12px 16px;
  }

  .app__title {
    font-size: 2.2rem;
  }

  .board {
    gap: 11px;
  }

  .guess-row {
    gap: 18px;
  }

  .controls {
    gap: 8px;
  }

  .palette__buttons {
    gap: 6px;
  }
}

@media (max-height: 700px) and (min-width: 540px) {
    :root {
      --slot-size: 58px;
      --color-button-size: 62px;
    }

  .app {
    gap: 6px;
    padding: 6px 12px 12px;
  }

  .app__title {
    font-size: 1.9rem;
  }

  .board {
    gap: 3px;
  }

  .guess-row {
    gap: 10px;
  }

  .controls {
    gap: 6px;
  }

  .btn {
    padding: 10px 12px;
  }
}

@media (max-height: 600px) and (min-width: 540px) {
    :root {
      --slot-size: 54px;
      --color-button-size: 58px;
    }

  .app {
    gap: 4px;
    padding: 4px 12px 8px;
  }

  .app__title {
    font-size: 1.6rem;
  }

  .board {
    gap: 2px;
  }

  .guess-row {
    gap: 8px;
  }

  .controls {
    gap: 4px;
  }

  .btn {
    padding: 8px 10px;
  }

  .btn__label {
    font-size: 0.7rem;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes orbit-pulse {
  0% {
    transform: scale(0.85);
    filter: brightness(1.35);
  }
  45% {
    transform: scale(1.1);
    filter: brightness(1.1);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes orbit-sparks {
  0% {
    opacity: 0.95;
    transform: scale(0.55);
  }
  60% {
    opacity: 0.6;
    transform: scale(1.05);
  }
  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}

@keyframes row-shake {
  0% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-6px);
  }
  60% {
    transform: translateX(6px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes winning-glow {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.02);
    filter: brightness(1.1);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

@keyframes winning-border {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes modal-celebrate {
  0% {
    transform: scale(0.8) rotate(-2deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.05) rotate(1deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes rainbow-border {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes victory-pulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.3;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 0.1;
  }
}

@keyframes title-glow {
  0%, 100% {
    text-shadow:
      0 0 20px rgba(251, 191, 36, 0.8),
      0 0 40px rgba(236, 72, 153, 0.6),
      0 4px 8px rgba(0, 0, 0, 0.5);
  }
  50% {
    text-shadow:
      0 0 30px rgba(251, 191, 36, 1),
      0 0 60px rgba(236, 72, 153, 0.8),
      0 0 80px rgba(167, 139, 250, 0.6),
      0 4px 8px rgba(0, 0, 0, 0.5);
  }
}

@keyframes float-up {
  0% {
    transform: translateY(20px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes button-pulse {
  0%, 100% {
    box-shadow:
      0 0 20px rgba(251, 191, 36, 0.6),
      0 8px 16px rgba(0, 0, 0, 0.4);
  }
  50% {
    box-shadow:
      0 0 30px rgba(251, 191, 36, 0.9),
      0 0 50px rgba(236, 72, 153, 0.5),
      0 8px 16px rgba(0, 0, 0, 0.4);
  }
}

@keyframes modal-appear {
  0% {
    transform: scale(0.95);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fade-in-subtle {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-slide-up {
  0% {
    opacity: 0;
    transform: translate(-50%, 20px);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes toast-fade-out {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translate(-50%, 0);
  background: rgba(30, 41, 59, 0.95);
  color: var(--text-bright);
  padding: 12px 24px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  backdrop-
  font-family: 'Orbitron', monospace;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 2000;
  animation: toast-slide-up 0.3s ease-out;
  pointer-events: none;
}

.toast[hidden] {
  display: none;
}

.toast.toast--hiding {
  animation: toast-fade-out 0.3s ease-out forwards;
}

/* Burst Flare Announcement Modal */
.burst-flare-announcement-modal {
  z-index: 1050;
  perspective: 1000px;
}

.burst-flare-announcement__content {
  position: relative;
  border-radius: 20px;
  padding: 4px;
  max-width: min(90vw, 420px);
  width: 100%;
  background: linear-gradient(
    90deg,
    #f59e0b,
    #ef4444,
    #f97316,
    #fbbf24,
    #ef4444,
    #f59e0b
  );
  background-size: 400% 100%;
  animation:
    burst-flare-announce-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    burst-flare-border-pulse 6s linear infinite;
  box-shadow:
    0 0 40px rgba(245, 158, 11, 0.5),
    0 0 80px rgba(239, 68, 68, 0.3),
    0 20px 60px rgba(0, 0, 0, 0.6);
}

.burst-flare-announcement__content > * {
  position: relative;
  z-index: 2;
}

.burst-flare-announcement__content::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 16px;
  z-index: 1;
}

.burst-flare-announcement__header {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(239, 68, 68, 0.2) 100%);
  padding: 24px;
  text-align: center;
  border-bottom: 2px solid rgba(245, 158, 11, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.burst-flare-announcement__icon {
  font-size: 2.5rem;
  animation: burst-flare-icon-pulse 1.8s ease-in-out infinite;
  filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.8));
}

.burst-flare-announcement__title {
  margin: 0;
  font-family: 'Orbitron', monospace;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(253, 186, 116, 0.8);
}

.burst-flare-announcement__body {
  padding: 28px 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.burst-flare-announcement__label {
  margin: 0;
  font-family: 'Orbitron', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #fbbf24, #f97316, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.burst-flare-announcement__text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  text-align: center;
}

.burst-flare-announcement__footer {
  padding: 16px 24px 20px;
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.5);
}

.burst-flare-announcement__footer .btn {
  min-width: 120px;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  color: #fff;
  font-weight: 700;
  border: none;
}

.burst-flare-announcement__footer .btn:hover {
  background: linear-gradient(135deg, #fbbf24 0%, #f97316 100%);
}

@keyframes burst-flare-announce-appear {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes burst-flare-border-pulse {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

@keyframes burst-flare-icon-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.7)); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.9)); }
}

@media (max-width: 480px) {
  .burst-flare-announcement__content {
    max-width: 95vw;
  }

  .burst-flare-announcement__header {
    padding: 20px;
  }

  .burst-flare-announcement__icon {
    font-size: 2rem;
  }

  .burst-flare-announcement__body {
    padding: 22px 20px 16px;
  }

  .burst-flare-announcement__text {
    font-size: 0.95rem;
    line-height: 1.55;
  }
}

/* Space Fact Modal */
.space-fact-modal {
  z-index: 1050;
  perspective: 1000px;
}

.space-fact-modal__content {
  position: relative;
  border-radius: 20px;
  padding: 4px;
  max-width: min(90vw, 420px);
  width: 100%;
  background: linear-gradient(
    90deg,
    #3b82f6,
    #8b5cf6,
    #ec4899,
    #f59e0b,
    #10b981,
    #06b6d4,
    #3b82f6
  );
  background-size: 400% 100%;
  animation:
    space-fact-appear 2s cubic-bezier(0.34, 1.56, 0.64, 1),
    cosmic-border-rotation 8s linear infinite;
  box-shadow:
    0 0 40px rgba(59, 130, 246, 0.5),
    0 0 80px rgba(139, 92, 246, 0.3),
    0 20px 60px rgba(0, 0, 0, 0.6);
}

/* Inner wrapper for content */
.space-fact-modal__content > * {
  position: relative;
  z-index: 2;
}

.space-fact-modal__content::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: 16px;
  z-index: 1;
}

.space-fact-modal__header {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(147, 51, 234, 0.2) 100%);
  padding: 24px;
  text-align: center;
  border-bottom: 2px solid var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.space-fact-modal__icon {
  font-size: 2.5rem;
  animation: space-fact-icon-spin 2s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.6));
}

.space-fact-modal__title {
  margin: 0;
  font-family: 'Orbitron', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.space-fact__content {
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  min-height: 140px;
}

.space-fact__prefix {
  margin: 0;
  font-family: 'Orbitron', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #f59e0b, #ec4899, #8b5cf6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: space-fact-prefix-fade 0.5s ease-out 0.3s both;
}

.space-fact__text {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
  text-align: center;
  animation: space-fact-text-fade 0.6s ease-out 0.5s both;
}

.space-fact-modal__footer {
  padding: 20px 24px;
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.5);
}

.space-fact-modal__footer .btn {
  min-width: 140px;
}

@keyframes cosmic-border-rotation {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

@keyframes space-fact-appear {
  0% {
    opacity: 0;
    transform: perspective(1200px) rotateX(25deg) rotateY(-8deg) scale(0.7) translateY(-60px);
  }
  40% {
    opacity: 0.8;
    transform: perspective(1200px) rotateX(-5deg) rotateY(3deg) scale(1.05) translateY(10px);
  }
  70% {
    opacity: 1;
    transform: perspective(1200px) rotateX(2deg) rotateY(-1deg) scale(1.02) translateY(0);
  }
  100% {
    opacity: 1;
    transform: perspective(1200px) rotateX(0) rotateY(0) scale(1) translateY(0);
  }
}

@keyframes space-fact-icon-spin {
  0%, 100% {
    transform: rotate(0deg) scale(1);
  }
  25% {
    transform: rotate(-10deg) scale(1.1);
  }
  75% {
    transform: rotate(10deg) scale(1.1);
  }
}

@keyframes space-fact-prefix-fade {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.9);
  }
  50% {
    transform: translateY(0) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes space-fact-text-fade {
  0% {
    opacity: 0;
    transform: translateY(15px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 480px) {
  .space-fact-modal__content {
    max-width: 95vw;
  }

  .space-fact-modal__header {
    padding: 20px;
  }

  .space-fact-modal__icon {
    font-size: 2rem;
  }

  .space-fact-modal__title {
    font-size: 1.1rem;
  }

  .space-fact__content {
    padding: 24px 20px;
    min-height: 120px;
  }

  .space-fact__text {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .space-fact-modal__footer {
    padding: 16px 20px;
  }
}
