/* ===== Fonts ===== */
@font-face {
  font-family: "Press Start 2P";
  src: url("https://fonts.gstatic.com/s/pressstart2p/v15/e3t4euO8T-267oIAQAu6jDQyK3nVivM.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "Ubuntu";
  src: url("https://fonts.gstatic.com/s/ubuntu/v20/4iCs6KVjbNBYlgo6eA.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Ubuntu";
  src: url("https://fonts.gstatic.com/s/ubuntu/v20/4iCv6KVjbNBYlgoCxCvTtw.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* ===== Tokens ===== */
:root {
  --sky-top: oklch(.78 .12 230);
  --sky-bottom: oklch(.62 .14 235);
  --sea: oklch(.46 .12 230);
  --habbo-yellow: oklch(.86 .18 90);
  --habbo-orange: oklch(.72 .21 50);
  --habbo-green: oklch(.72 .22 130);
  --habbo-green-dark: oklch(.55 .20 135);
  --bg: oklch(.62 .14 235);
  --fg: oklch(.98 .01 100);
  --card: oklch(.46 .12 230);
  --popover: oklch(.30 .06 235);
  --muted: oklch(.40 .06 235);
  --muted-fg: oklch(.85 .02 230);
  --border: oklch(.30 .06 230);
  --input: oklch(.36 .08 235);
  --font-pixel: "Press Start 2P", system-ui, monospace;
  --font-display: "Ubuntu", system-ui, sans-serif;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #app { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-display);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; }

/* ===== Layout ===== */
.app-frame {
  width: 100%;
  min-height: 100dvh;
  position: relative;
  background: var(--bg);
  overflow: hidden;
}
.screen {
  position: relative;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ===== Sky Background ===== */
.bg-habbo-sky {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    var(--sky-top) 0%,
    var(--sky-bottom) 50%,
    var(--sea) 50%,
    oklch(.40 .10 230) 100%
  );
}
.horizon {
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 2px;
  background: oklch(.95 .05 230 / .5);
}
.pixel-cloud {
  width: 64px;
  height: 32px;
  background: #fff;
  border-radius: 32px;
  position: absolute;
  box-shadow: 0 -8px 0 -4px #fff, 16px -12px 0 -4px #fff, -16px -8px 0 -4px #fff;
  image-rendering: pixelated;
  opacity: .85;
}
@keyframes drift {
  from { transform: translateX(-15vw); }
  to { transform: translateX(115vw); }
}
.anim-drift-slow { animation: drift 60s linear infinite; }
.anim-drift-med  { animation: drift 40s linear infinite; }
.anim-drift-fast { animation: drift 25s linear infinite; }

/* ===== Logo ===== */
.habbo-logo {
  font-family: var(--font-pixel);
  font-size: clamp(2.2rem, 9vw, 3.8rem);
  color: var(--habbo-yellow);
  letter-spacing: .08em;
  line-height: 1;
  text-shadow:
    3px 0 0 #000, -3px 0 0 #000, 0 3px 0 #000, 0 -3px 0 #000,
    3px 3px 0 #000, -3px -3px 0 #000, 3px -3px 0 #000, -3px 3px 0 #000,
    4px 6px 0 var(--habbo-orange), 5px 7px 0 var(--habbo-orange), 6px 8px 0 var(--habbo-orange),
    7px 9px 0 #000, 8px 10px 0 #000;
}
.logo-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  user-select: none;
}
.logo-sub {
  font-family: var(--font-pixel);
  font-size: .7rem;
  color: #fff;
  opacity: .9;
  letter-spacing: .4em;
  margin-top: .9rem;
}

/* ===== Pixel Buttons ===== */
.pixel-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.5rem;
  border: 3px solid oklch(.20 .05 140);
  background: linear-gradient(to bottom, var(--habbo-green) 0 50%, var(--habbo-green-dark) 50% 100%);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .02em;
  box-shadow: inset 0 2px 0 oklch(.85 .18 130), inset 0 -3px 0 oklch(.45 .18 135), 0 4px 0 oklch(.20 .05 140);
  transition: transform .08s ease, box-shadow .08s ease;
  cursor: pointer;
  text-shadow: 1px 1px 0 oklch(.30 .10 140);
  border-radius: 0;
}
.pixel-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.pixel-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: inset 0 2px 0 oklch(.65 .18 135), inset 0 -2px 0 oklch(.40 .18 135), 0 1px 0 oklch(.20 .05 140);
}
.pixel-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(.3);
}
.pixel-btn-yellow {
  background: linear-gradient(to bottom, var(--habbo-yellow) 0 50%, var(--habbo-orange) 50% 100%);
  border-color: oklch(.25 .08 50);
  color: oklch(.20 .05 50);
  text-shadow: 1px 1px 0 oklch(.95 .12 95);
  box-shadow: inset 0 2px 0 oklch(.95 .12 95), inset 0 -3px 0 oklch(.55 .20 50), 0 4px 0 oklch(.25 .08 50);
}
.pixel-btn-yellow:active:not(:disabled) {
  box-shadow: inset 0 2px 0 oklch(.95 .12 95), inset 0 -1px 0 oklch(.55 .20 50), 0 1px 0 oklch(.25 .08 50);
}

/* ===== Inputs ===== */
.pixel-input {
  width: 100%;
  padding: .85rem 1rem;
  background: var(--input);
  color: #fff;
  border: 3px solid oklch(.20 .04 240);
  font-family: var(--font-display);
  font-size: 1rem;
  box-shadow: inset 0 2px 0 oklch(0 0 0 / .25);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.pixel-input:focus {
  border-color: var(--habbo-yellow);
  box-shadow: inset 0 2px 0 oklch(0 0 0 / .25), 0 0 0 1px var(--habbo-yellow);
}
.pixel-input::placeholder {
  color: oklch(.85 .02 230 / .55);
}

/* ===== NFT Cards ===== */
.nft-card {
  position: relative;
  background: linear-gradient(160deg, oklch(.30 .08 235), oklch(.22 .06 240));
  border: 3px solid oklch(.95 .10 95);
  padding: 1.25rem;
  overflow: hidden;
  box-shadow: inset 0 0 0 2px oklch(.20 .05 240), 0 8px 0 oklch(.15 .04 240), 0 0 30px oklch(.86 .18 90 / .25);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  transition: transform .2s ease, box-shadow .2s ease;
}
.nft-card:hover {
  transform: translateY(-4px);
  box-shadow: inset 0 0 0 2px oklch(.20 .05 240), 0 12px 0 oklch(.15 .04 240), 0 0 40px oklch(.86 .18 90 / .35);
}
.nft-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(45deg, transparent 0 8px, oklch(1 0 0 / .04) 8px 9px);
}
.nft-img {
  width: 100%;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, oklch(.30 .10 235), oklch(.20 .08 240));
  border: 2px solid oklch(.20 .05 240);
  position: relative;
  overflow: hidden;
}
.nft-img .emoji {
  font-size: 64px;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.4));
  animation: floatY 3s ease-in-out infinite;
}
.nft-img .nft-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  animation: floatY 3s ease-in-out infinite;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.4));
}

/* ===== Rarity Colors ===== */
.rarity-common    { color: oklch(.85 .02 230); }
.rarity-rare      { color: oklch(.78 .18 230); }
.rarity-epic      { color: oklch(.78 .22 320); }
.rarity-legendary { color: var(--habbo-yellow); }
.rarity-badge-common    { background: oklch(.40 .04 230); border-color: oklch(.55 .04 230); }
.rarity-badge-rare      { background: oklch(.35 .10 230); border-color: oklch(.55 .15 230); }
.rarity-badge-epic      { background: oklch(.30 .12 320); border-color: oklch(.50 .15 320); }
.rarity-badge-legendary { background: oklch(.40 .12 80); border-color: var(--habbo-yellow); }

/* ===== Animations ===== */
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.anim-float { animation: floatY 3s ease-in-out infinite; }

@keyframes glow {
  0%, 100% { filter: drop-shadow(0 0 8px var(--habbo-yellow)); }
  50% { filter: drop-shadow(0 0 24px var(--habbo-yellow)); }
}
.anim-glow { animation: glow 2s ease-in-out infinite; }

@keyframes spin {
  to { transform: rotate(360deg); }
}
.spinner {
  width: 48px;
  height: 48px;
  border: 6px solid oklch(1 0 0 / .2);
  border-top-color: var(--habbo-yellow);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}
.pulse { animation: pulse 1.2s ease-in-out infinite; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.fade-in { animation: fadeIn .4s ease both; }

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(.9); }
  to { opacity: 1; transform: scale(1); }
}
.fade-in-scale { animation: fadeInScale .3s ease both; }

@keyframes confettiDrop {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}
.confetti-piece {
  position: absolute;
  width: 8px;
  height: 8px;
  top: -10px;
  animation: confettiDrop 2.5s ease-in forwards;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.shimmer-loading {
  background: linear-gradient(90deg, oklch(.30 .06 235) 25%, oklch(.35 .08 235) 50%, oklch(.30 .06 235) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* ===== Claim animation overlay ===== */
.claim-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: oklch(.10 .04 240 / .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: none;
}
.claim-overlay .claim-icon {
  font-size: 80px;
  animation: claimPop .5s cubic-bezier(.17,.67,.35,1.5) both;
}
.claim-overlay .claim-text {
  font-family: var(--font-pixel);
  font-size: 1.2rem;
  color: var(--habbo-yellow);
  margin-top: 1rem;
  animation: fadeInScale .4s ease both .3s;
  text-shadow: 2px 2px 0 #000;
}
.claim-overlay .claim-sub {
  font-family: var(--font-pixel);
  font-size: .55rem;
  color: #fff;
  opacity: .7;
  margin-top: .75rem;
  animation: fadeInScale .4s ease both .5s;
  letter-spacing: .2em;
}
@keyframes claimPop {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

/* ===== CRT Scanlines Overlay ===== */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  mix-blend-mode: multiply;
  background: repeating-linear-gradient(to bottom, transparent 0 2px, oklch(0 0 0 / .06) 2px 3px);
}

/* ===== Language Grid ===== */
.lang-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  width: 100%;
  max-width: 440px;
}
@media (max-width: 380px) {
  .lang-grid { grid-template-columns: repeat(2, 1fr); }
}
.lang-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  padding: 1rem .5rem;
  background: linear-gradient(to bottom, var(--habbo-green) 0 50%, var(--habbo-green-dark) 50% 100%);
  border: 3px solid oklch(.20 .05 140);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 2px 0 oklch(.85 .18 130), inset 0 -3px 0 oklch(.45 .18 135), 0 4px 0 oklch(.20 .05 140);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
  cursor: pointer;
  border-radius: 0;
  text-shadow: 1px 1px 0 oklch(.30 .10 140);
  animation: langBtnAppear .4s ease both;
}
.lang-btn:nth-child(1) { animation-delay: .05s; }
.lang-btn:nth-child(2) { animation-delay: .10s; }
.lang-btn:nth-child(3) { animation-delay: .15s; }
.lang-btn:nth-child(4) { animation-delay: .20s; }
.lang-btn:nth-child(5) { animation-delay: .25s; }
.lang-btn:nth-child(6) { animation-delay: .30s; }
.lang-btn:nth-child(7) { animation-delay: .35s; }
.lang-btn:nth-child(8) { animation-delay: .40s; }
.lang-btn:nth-child(9) { animation-delay: .45s; }
@keyframes langBtnAppear {
  from { opacity: 0; transform: translateY(12px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.lang-btn:hover {
  transform: translateY(-3px);
  box-shadow: inset 0 2px 0 oklch(.85 .18 130), inset 0 -3px 0 oklch(.45 .18 135), 0 6px 0 oklch(.20 .05 140), 0 0 18px oklch(.72 .22 130 / .4);
  filter: brightness(1.1);
}
.lang-btn:active {
  transform: translateY(3px);
  box-shadow: inset 0 2px 0 oklch(.65 .18 135), inset 0 -2px 0 oklch(.40 .18 135), 0 1px 0 oklch(.20 .05 140);
}
.lang-btn.selected {
  border-color: var(--habbo-yellow);
  background: linear-gradient(to bottom, var(--habbo-yellow) 0 50%, var(--habbo-orange) 50% 100%);
}
.lang-flag { font-size: 1.6rem; line-height: 1; }
.lang-label {
  font-family: var(--font-pixel);
  font-size: .55rem;
  letter-spacing: .1em;
}

/* ===== Login Layout ===== */
.login-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: center;
  max-width: 880px;
  margin: 0 auto;
  width: 100%;
}
@media (min-width: 768px) {
  .login-grid { grid-template-columns: 1fr 1fr; gap: 2.5rem; }
}
.avatar-frame {
  position: relative;
  width: 11rem;
  height: 14rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin: 0 auto;
  background: oklch(.25 .06 235 / .4);
  border: 2px solid oklch(.20 .04 240);
}
@media (min-width: 640px) {
  .avatar-frame { width: 14rem; height: 16rem; }
}
.avatar-img {
  max-height: 100%;
  image-rendering: pixelated;
}

/* ===== Dashboard ===== */
.dash-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1rem;
  background: oklch(.25 .06 235 / .8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 3px solid oklch(.20 .04 240);
  position: sticky;
  top: 0;
  z-index: 20;
}
.dash-avatar {
  width: 48px;
  height: 48px;
  border: 2px solid var(--habbo-yellow);
  background: oklch(.30 .08 235);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.dash-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
}

/* ===== NFT Grid ===== */
.grid-nfts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
  align-items: stretch;
}
@media (min-width: 640px) {
  .grid-nfts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .grid-nfts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ===== Progress Bar ===== */
.progress-track {
  width: 100%;
  max-width: 300px;
  height: 14px;
  background: oklch(.20 .06 240);
  border: 2px solid oklch(.15 .04 240);
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--habbo-green), var(--habbo-yellow));
  transition: width .5s cubic-bezier(.4, 0, .2, 1);
  image-rendering: pixelated;
  position: relative;
}
.progress-fill::after {
  content: "";
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, oklch(1 0 0 / .2));
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: oklch(.25 .06 235 / .95);
  border: 2px solid var(--habbo-yellow);
  padding: .75rem 1.5rem;
  color: #fff;
  font-family: var(--font-display);
  font-size: .9rem;
  z-index: 60;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  white-space: nowrap;
  box-shadow: 0 4px 20px oklch(.10 .04 240 / .5);
}
.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ===== Utility ===== */
.text-pixel-xs {
  font-family: var(--font-pixel);
  font-size: .55rem;
  letter-spacing: .1em;
  line-height: 1.4;
}
.text-pixel-sm {
  font-family: var(--font-pixel);
  font-size: .7rem;
  letter-spacing: .1em;
  line-height: 1.5;
}
.text-yellow { color: var(--habbo-yellow); }
.text-white  { color: #fff; }
.text-muted  { color: var(--muted-fg); }
.full-grow {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

/* ===== Link Button ===== */
.link-btn {
  background: none;
  border: none;
  color: var(--muted-fg);
  font-family: var(--font-display);
  font-size: .85rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  transition: color .15s ease;
}
.link-btn:hover { color: #fff; }

/* ===== Stars (background decoration) ===== */
.star-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #fff;
  border-radius: 50%;
  animation: twinkle 3s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: .2; }
  50% { opacity: .8; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: oklch(.20 .04 240); }
::-webkit-scrollbar-thumb { background: oklch(.40 .06 230); border: 1px solid oklch(.25 .04 240); }
::-webkit-scrollbar-thumb:hover { background: oklch(.50 .08 230); }

/* ===== Selection ===== */
::selection {
  background: oklch(.86 .18 90 / .3);
  color: #fff;
}