:root {
  --bg-color: #f9fbff;
  --bg-panel: #ffffff;
  --bg-panel-alt: #f1f5fe;
  --text-primary: #22304a;
  --text-secondary: #5c6a82;
  --accent: #5a60f8;
  --accent-secondary: #f46cf8;
  --warning: #fbbc04;
  --danger: #ef476f;
  --success: #06d6a0;
  --border-radius: 18px;
  --shadow: 0 18px 45px -25px rgba(40, 60, 120, 0.35);

  --color-red: #ff6b6b;
  --color-blue: #4dabf7;
  --color-green: #69db7c;
  --color-yellow: #ffd43b;
  --color-pink: #f783ac;
  --color-purple: #845ef7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  font-family: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: radial-gradient(circle at top, rgba(90, 96, 248, 0.08), transparent 55%),
    radial-gradient(circle at bottom, rgba(94, 178, 255, 0.12), transparent 60%), var(--bg-color);
  color: var(--text-primary);
}

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 32px 16px;
}

#app {
  width: min(1100px, 100%);
  min-height: 620px;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn {
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn--primary {
  background: linear-gradient(135deg, var(--accent), #7a83ff);
  color: #fff;
  box-shadow: 0 10px 25px -15px rgba(90, 96, 248, 0.8);
}

.btn--secondary {
  background: linear-gradient(135deg, #ff8ce0, #ff6fb7);
  color: #fff;
  box-shadow: 0 10px 20px -15px rgba(244, 108, 248, 0.65);
}

.btn--tertiary {
  background: linear-gradient(135deg, var(--success), #1dd1a1);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.loading,
.loading-overlay {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

.loading {
  flex-direction: column;
  padding: 80px 16px;
}

.loading__spinner {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 6px solid rgba(90, 96, 248, 0.1);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(4px);
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--danger);
  color: #fff;
  padding: 14px 24px;
  border-radius: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.auth {
  background: var(--bg-panel);
  border-radius: 28px;
  padding: 48px 32px;
  box-shadow: var(--shadow);
  text-align: center;
}

.auth__title {
  font-size: 3rem;
  font-family: 'Fredoka One', cursive;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 10px;
}

.auth__subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.auth__switcher {
  display: inline-flex;
  background: var(--bg-panel-alt);
  padding: 6px;
  border-radius: 16px;
  gap: 6px;
  margin-bottom: 28px;
}

.auth__switch {
  padding: 8px 18px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
}

.auth__switch.is-active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 10px 20px -18px rgba(90, 96, 248, 0.8);
}

.auth__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth__field {
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 6px;
}

.auth__field > span {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.auth__field > input {
  padding: 12px 16px;
  border-radius: 12px;
  border: 2px solid rgba(90, 96, 248, 0.12);
  font-size: 1rem;
  background: #f8faff;
  transition: border 0.2s ease;
}

.auth__field > input:focus {
  border-color: var(--accent);
  outline: none;
}

.auth__error {
  margin-top: 16px;
  color: #fff;
  font-weight: 600;
  background: rgba(239, 71, 111, 0.9);
  padding: 12px 18px;
  border-radius: 12px;
}

.dashboard {
  display: grid;
  gap: 24px;
  position: relative;
}

.dashboard__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background: linear-gradient(135deg, rgba(90, 96, 248, 0.18), rgba(243, 132, 250, 0.18));
  padding: 24px 28px;
  border-radius: 26px;
}

.dashboard__title h1 {
  font-size: 2.1rem;
  margin-bottom: 6px;
}

.dashboard__title p {
  color: var(--text-secondary);
}

.dashboard__status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.level-badge {
  background: #fff;
  padding: 12px 18px;
  border-radius: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}

.level-badge span {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
}

.level-badge strong {
  font-size: 1.5rem;
  color: var(--accent);
}

.xp-bar {
  width: 160px;
  height: 8px;
  background: rgba(90, 96, 248, 0.2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.xp-bar__progress {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent), #8f94ff);
  border-radius: inherit;
  transition: width 0.3s ease;
}

.xp-bar__label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.coin-display {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  padding: 10px 16px;
  border-radius: 18px;
  box-shadow: var(--shadow);
  font-weight: 700;
  color: #d97706;
}

.notifications-trigger {
  position: relative;
  min-width: 48px;
  min-height: 48px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  justify-content: center;
  color: var(--text-secondary);
}

.notifications-trigger__icon i {
  font-size: 1.1rem;
}

.notifications-trigger__badge {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 14px -8px rgba(239, 71, 111, 0.65);
}

.pet-stage {
  background: var(--bg-panel);
  padding: 32px;
  border-radius: 28px;
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  position: relative;
}

.pet-figure {
  width: clamp(180px, 28vw, 240px);
  height: clamp(180px, 28vw, 240px);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.75), transparent 65%),
    linear-gradient(135deg, #ff9ff3, #f783ac);
  border-radius: 45% 45% 40% 40%;
  position: relative;
  display: grid;
  place-items: center;
  animation: float 4s ease-in-out infinite;
}

.pet-figure[data-mood='feliz'] {
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.8), transparent 70%),
    linear-gradient(135deg, #ff9a9e, #fecfef);
}

.pet-figure[data-mood='triste'] {
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.7), transparent 80%),
    linear-gradient(135deg, #74b9ff, #a29bfe);
}

.pet-figure[data-mood='irritado'] {
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.7), transparent 80%),
    linear-gradient(135deg, #ff7675, #e17055);
}

.pet-figure[data-mood='doente'] {
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.7), transparent 80%),
    linear-gradient(135deg, #81ecec, #74b9ff);
}

.pet-stage[data-background='background:neon'] {
  background: linear-gradient(135deg, #0f172a, #0b1224);
  color: #e5e7eb;
}

.pet-figure[data-body-color='body:aurora'] {
  background: linear-gradient(135deg, #89f7fe, #66a6ff);
}

.pet-figure[data-body-color='body:galaxy'] {
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.6), transparent 70%),
    linear-gradient(135deg, #4c1d95, #0ea5e9);
}

.pet-figure__head-accessory,
.pet-figure__body-accessory {
  position: absolute;
  pointer-events: none;
}

.pet-figure__head-accessory {
  top: 4%;
  width: 70%;
  height: 28%;
}

.pet-figure__head-accessory[data-asset='head:beanie'] {
  background: linear-gradient(135deg, #f59e0b, #f97316);
  border-radius: 50% 50% 40% 40%;
  box-shadow: 0 8px 16px -10px rgba(0, 0, 0, 0.2);
}

.pet-figure__head-accessory[data-asset='head:tiara'] {
  background: linear-gradient(135deg, #f472b6, #c084fc);
  border-radius: 999px;
  height: 18%;
  top: 10%;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

.pet-figure__body-accessory {
  bottom: 8%;
  width: 80%;
  height: 22%;
}

.pet-figure__body-accessory[data-asset='body:scarf'] {
  background: linear-gradient(135deg, #f43f5e, #f59e0b);
  border-radius: 16px;
  box-shadow: 0 8px 14px -10px rgba(0, 0, 0, 0.25);
}

.pet-figure::after {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(90, 96, 248, 0.12), transparent 70%);
  z-index: -1;
  filter: blur(6px);
}

.pet-figure__face {
  position: relative;
  width: 70%;
  height: 70%;
  display: grid;
  place-items: center;
}

.pet-figure__eyes {
  display: flex;
  justify-content: space-between;
  width: 70%;
}

.pet-figure__eyes span {
  width: 32px;
  height: 32px;
  background: #fff;
  border-radius: 50%;
  box-shadow: inset -2px -4px 0 rgba(0, 0, 0, 0.12);
  position: relative;
}

.pet-figure__eyes span::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  background: #2d3436;
  border-radius: 50%;
  top: 12px;
  left: 10px;
}

.pet-figure__mouth {
  width: 60px;
  height: 36px;
  border-radius: 0 0 60px 60px;
  background: #2d3436;
  margin-top: 12px;
  position: relative;
}

.pet-figure[data-mood='triste'] .pet-figure__mouth {
  transform: rotate(180deg);
}

.pet-figure[data-mood='feliz'] .pet-figure__mouth::after {
  content: '';
  position: absolute;
  inset: 6px 10px;
  background: #ff7675;
  border-radius: 50% 50% 45% 45%;
}

.pet-stage__mood {
  margin-top: 24px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.4px;
}

.stats-panel {
  background: var(--bg-panel);
  padding: 24px 28px;
  border-radius: 28px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 18px;
}

.stats__item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stats__label {
  font-weight: 600;
  color: var(--text-secondary);
}

.stats__bar {
  height: 16px;
  background: rgba(90, 96, 248, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.stats__progress {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), #7c8bff);
  transition: width 0.3s ease;
}

.stats__progress[data-level='100'] {
  background: linear-gradient(135deg, var(--success), #1dd1a1);
}

.actions-panel,
.missions,
.inventory,
.shop,
.customization,
.minigames {
  background: var(--bg-panel);
  padding: 24px 28px;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.actions-panel__buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.missions__header {
  gap: 12px;
  align-items: flex-start;
}

.missions__header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.missions__list {
  display: grid;
  gap: 14px;
}

.mission-card {
  background: var(--bg-panel-alt);
  padding: 18px 20px;
  border-radius: 22px;
  display: grid;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.mission-card--completed {
  background: linear-gradient(135deg, rgba(6, 214, 160, 0.18), rgba(6, 214, 160, 0.28));
}

.mission-card--ready {
  background: linear-gradient(135deg, rgba(90, 96, 248, 0.15), rgba(244, 108, 248, 0.18));
}

.mission-card__description {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.mission-card__progress-info {
  font-weight: 600;
  color: var(--text-secondary);
}

.mission-card__progress {
  height: 10px;
  background: rgba(90, 96, 248, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

.mission-card__progress-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--accent), #8187ff);
  border-radius: inherit;
  transition: width 0.3s ease;
}

.mission-card__rewards {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.mission-card__rewards i {
  color: #d97706;
}

.mission-card__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(6, 214, 160, 0.18);
  color: #059669;
}

.mission-card__status--ready {
  background: rgba(90, 96, 248, 0.15);
  color: var(--accent);
}

.mission-card__footer {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.inventory__list {
  display: grid;
  gap: 14px;
}

.inventory__item {
  background: var(--bg-panel-alt);
  padding: 16px 18px;
  border-radius: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.inventory__info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inventory__info strong {
  font-size: 1rem;
}

.inventory__info span {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.inventory__actions {
  display: flex;
  gap: 8px;
}

.shop__grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.shop__item {
  background: var(--bg-panel-alt);
  padding: 18px;
  border-radius: 20px;
  display: grid;
  gap: 12px;
}

.shop__price {
  font-weight: 700;
  color: #d97706;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.customization__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.customization__slot h3 {
  margin-bottom: 10px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.95rem;
}

.customization__list {
  display: grid;
  gap: 12px;
}

.cosmetic-card {
  background: #fff;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 28px -22px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(90, 96, 248, 0.08);
  display: grid;
  gap: 6px;
}

.cosmetic-card--owned {
  border-color: rgba(6, 214, 160, 0.3);
}

.cosmetic-card--equipped {
  border-color: rgba(90, 96, 248, 0.5);
  box-shadow: 0 12px 30px -20px rgba(90, 96, 248, 0.45);
}

.cosmetic-card--default {
  background: var(--bg-panel-alt);
}

.cosmetic-card__rarity {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.cosmetic-card__description {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.cosmetic-card__price {
  font-weight: 700;
  color: #d97706;
}

.cosmetic-card__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cosmetic-card__badge {
  background: rgba(90, 96, 248, 0.12);
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 12px;
  font-weight: 700;
}

.shop__quantity {
  display: flex;
  gap: 10px;
  align-items: center;
}

.shop__quantity input {
  width: 60px;
  padding: 8px;
  border-radius: 12px;
  border: 2px solid rgba(90, 96, 248, 0.15);
  font-weight: 600;
  text-align: center;
}

.minigames__grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.minigame-card {
  background: var(--bg-panel-alt);
  padding: 18px;
  border-radius: 22px;
  display: grid;
  gap: 10px;
}

.minigame-card__difficulty {
  font-size: 0.8rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.minigame-card__scores {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.empty-state {
  color: var(--text-secondary);
  font-style: italic;
}

.notifications-panel {
  display: grid;
  gap: 18px;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 6px;
}

.notifications-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.notifications-panel__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.notifications-panel__list {
  display: grid;
  gap: 12px;
}

.notification-card {
  background: var(--bg-panel-alt);
  border-radius: 20px;
  padding: 16px 18px;
  display: grid;
  gap: 8px;
  position: relative;
}

.notification-card--unread {
  border-left: 4px solid var(--accent);
  padding-left: 14px;
  background: rgba(90, 96, 248, 0.12);
}

.notification-card__message {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.4;
}

.notification-card__meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.notification-card__actions {
  display: flex;
  justify-content: flex-end;
}

.notification-card__actions .btn {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 24, 46, 0.45);
  display: grid;
  place-items: center;
  padding: 32px 16px;
  z-index: 20;
}

.overlay__content {
  background: var(--bg-panel);
  border-radius: 26px;
  padding: 24px;
  position: relative;
  max-width: min(800px, 100%);
  max-height: 80vh;
  width: 100%;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.overlay__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.08);
  color: var(--text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.game {
  display: grid;
  gap: 16px;
}

.game__title {
  font-size: 1.6rem;
}

.game__score {
  font-weight: 600;
  color: var(--text-secondary);
}

.game__wrapper {
  background: var(--bg-panel-alt);
  border-radius: 22px;
  padding: 18px;
  display: grid;
  place-items: center;
}

.game__footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.flow-game {
  display: grid;
  gap: 16px;
}

.flow-game__instructions {
  color: var(--text-secondary);
}

.flow-board {
  display: grid;
  gap: 6px;
  width: min(420px, 100%);
  aspect-ratio: 1;
}

.flow-board__cell {
  border-radius: 12px;
  background: rgba(90, 96, 248, 0.12);
  position: relative;
  border: 2px solid transparent;
}

.flow-board__cell[data-color-key] {
  background: var(--flow-color);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.flow-board__cell[data-anchor='start'],
.flow-board__cell[data-anchor='end'] {
  border-color: rgba(255, 255, 255, 0.7);
}

.sokoban {
  display: grid;
  gap: 16px;
  outline: none;
}

.sokoban__instructions {
  color: var(--text-secondary);
  text-align: center;
}

.sokoban__board {
  display: grid;
  gap: 4px;
}

.sokoban__tile {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(90, 96, 248, 0.12);
  position: relative;
}

.sokoban__tile[data-type='#'] {
  background: rgba(52, 73, 94, 0.25);
}

.sokoban__tile[data-target='true']::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 3px dashed rgba(90, 96, 248, 0.6);
}

.sokoban__tile[data-box='true']::before {
  content: '';
  position: absolute;
  inset: 6px;
  background: linear-gradient(135deg, #ffcd94, #f6a261);
  border-radius: 8px;
}

.sokoban__tile[data-player='true']::before {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, #78a1ff, #6c5ce7);
}

.flappy {
  width: min(420px, 100%);
  border-radius: 24px;
  box-shadow: var(--shadow);
  background: #74b9ff;
}

.bubble-pop {
  display: grid;
  gap: 18px;
}

.bubble-pop__header {
  text-align: center;
  color: var(--text-secondary);
}

.bubble-pop__grid {
  display: grid;
  gap: 6px;
  width: min(420px, 100%);
}

.bubble-pop__bubble {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.85), transparent 55%), var(--bubble-color, transparent);
  border: none;
  box-shadow: inset -4px -6px 12px rgba(0, 0, 0, 0.12);
}

.bubble-pop__bubble.is-empty {
  opacity: 0;
  pointer-events: none;
}

@media (max-width: 900px) {
  body {
    padding: 12px;
  }
  #app {
    min-height: auto;
  }
  .dashboard__header {
    flex-direction: column;
    gap: 18px;
  }
  .dashboard__status {
    flex-wrap: wrap;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
