/* ===== Variables ===== */
:root {
  --pink: #ff6b9d;
  --pink-dark: #e84a7f;
  --purple: #9b5de5;
  --purple-dark: #7b3fbf;
  --yellow: #fee440;
  --mint: #00f5d4;
  --dark: #1a1a2e;
  --dark2: #16213e;
  --light: #fff;
  --glass: rgba(255, 255, 255, 0.12);
  --radius: 16px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  --font: 'Nunito', sans-serif;
  --pixel: 'Press Start 2P', cursive;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--dark);
  color: var(--light);
  overflow-x: hidden;
  line-height: 1.6;
}

.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 24px);
}

/* ===== Preloader ===== */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 50%, #0f3460 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s, visibility 0.6s;
}

.preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-box {
  text-align: center;
  padding: 40px;
  max-width: 400px;
}

.preloader-logo {
  font-family: var(--pixel);
  font-size: clamp(14px, 3vw, 18px);
  color: var(--pink);
  margin-bottom: 24px;
  animation: pulse 1.5s ease infinite;
}

.preloader-bar {
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 16px;
}

.preloader-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--mint));
  border-radius: 99px;
  transition: width 0.3s;
}

.preloader-text {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  min-height: 1.4em;
}

.preloader-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  margin-top: 8px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ===== Tort banner ===== */
.tort-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 900;
  background: var(--dark2);
  border-top: 2px solid var(--pink);
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 14px;
  animation: slideUp 0.5s ease;
}

.tort-banner.hidden { display: none; }

.tort-banner-btns { display: flex; gap: 8px; }

.tort-banner button {
  padding: 8px 16px;
  border: none;
  border-radius: 99px;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  transition: transform 0.2s;
}

.tort-banner button:hover { transform: scale(1.05); }

#acceptTort { background: var(--pink); color: white; }
#declineTort { background: transparent; color: rgba(255,255,255,0.6); border: 1px solid rgba(255,255,255,0.2); }

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ===== Confetti ===== */
#confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 800;
}

/* ===== Header ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(26, 26, 46, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-top: env(safe-area-inset-top, 0px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  font-weight: 900;
  font-size: 1.25rem;
  color: var(--light);
  text-decoration: none;
}

.logo span { color: var(--pink); }

.nav {
  display: flex;
  gap: 24px;
}

.nav a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: color 0.2s;
}

.nav a:hover { color: var(--pink); }

.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.burger span {
  display: block;
  width: 24px;
  height: 2px;
  background: white;
  transition: 0.3s;
}

.burger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.burger.active span:nth-child(2) { opacity: 0; }
.burger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 99px;
  font-family: var(--font);
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
  transform: translateY(-2px) scale(1.02);
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: white;
  box-shadow: 0 4px 20px rgba(255, 107, 157, 0.4);
}

.btn-secondary {
  background: var(--glass);
  color: white;
  border: 2px solid rgba(255,255,255,0.2);
}

.btn-small {
  padding: 10px 20px;
  font-size: 13px;
}

.btn-big {
  padding: 18px 36px;
  font-size: 17px;
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  position: relative;
  padding: clamp(88px, 14vw, 100px) 0 clamp(40px, 8vw, 60px);
  background:
    radial-gradient(ellipse at 20% 50%, rgba(155, 93, 229, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(255, 107, 157, 0.2) 0%, transparent 50%),
    radial-gradient(ellipse at 60% 80%, rgba(0, 245, 212, 0.1) 0%, transparent 50%),
    var(--dark);
  overflow: hidden;
}

.hero-inner { position: relative; z-index: 2; }

.hero-badge {
  display: inline-block;
  background: rgba(254, 228, 64, 0.15);
  border: 1px solid var(--yellow);
  color: var(--yellow);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 20px;
  animation: shake 3s ease infinite;
}

@keyframes shake {
  0%, 90%, 100% { transform: rotate(0); }
  92% { transform: rotate(-2deg); }
  94% { transform: rotate(2deg); }
  96% { transform: rotate(-1deg); }
}

.hero-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 20px;
}

.hero-small {
  display: block;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem);
  font-weight: 600;
  color: rgba(255,255,255,0.6);
  margin-bottom: 8px;
}

.hero-name-wrap {
  display: block;
  min-height: 1.15em;
  margin-top: 2px;
}

.hero-name {
  display: inline-block;
  background: linear-gradient(135deg, var(--pink), var(--yellow), var(--mint));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s ease infinite;
  background-size: 200% auto;
  line-height: 1.1;
  transition: opacity 0.2s, transform 0.2s;
}

.hero-name.is-swapping {
  opacity: 0;
  transform: translateY(6px) scale(0.97);
}

@keyframes shimmer {
  0% { background-position: 0% center; }
  50% { background-position: 100% center; }
  100% { background-position: 0% center; }
}

.hero-sub {
  font-size: clamp(1rem, 2.5vw, 1.15rem);
  color: rgba(255,255,255,0.75);
  max-width: 560px;
  margin-bottom: 32px;
}

.hero-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

/* ===== Hero HUD (game card) ===== */
.hero-hud {
  background: linear-gradient(160deg, rgba(155, 93, 229, 0.25), rgba(255, 107, 157, 0.12));
  border: 2px solid rgba(255, 107, 157, 0.45);
  border-radius: 20px;
  padding: 14px 16px 16px;
  max-width: 520px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 12px 40px rgba(255, 107, 157, 0.15);
  position: relative;
}

.hud-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.12);
}

.hud-stamp {
  font-family: var(--pixel);
  font-size: 7px;
  letter-spacing: 0.8px;
  background: var(--yellow);
  color: var(--dark);
  padding: 5px 10px;
  border-radius: 4px;
  flex-shrink: 0;
}

.hud-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.hud-avatar {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.hud-info {
  flex: 1;
  min-width: 0;
}

.hud-rank {
  display: block;
  font-family: var(--pixel);
  font-size: 7px;
  color: var(--yellow);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.hud-player {
  display: block;
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--light);
  transition: opacity 0.2s;
}

.hud-player.is-swapping {
  opacity: 0.4;
}

.hud-level {
  text-align: right;
  flex-shrink: 0;
}

.hud-level span {
  display: block;
  font-family: var(--pixel);
  font-size: 7px;
  color: rgba(255, 255, 255, 0.45);
}

.hud-level strong {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--pink);
  line-height: 1.1;
}

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

.hud-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  align-items: center;
  gap: 8px;
}

.hud-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.hud-track {
  height: 10px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hud-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--mint));
  transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hud-fill-loop {
  animation: hudPulse 1.5s ease-in-out infinite;
}

@keyframes hudPulse {
  0%, 100% { opacity: 1; filter: brightness(1); }
  50% { opacity: 0.85; filter: brightness(1.3); }
}

.hud-val {
  font-size: 11px;
  font-weight: 800;
  color: var(--mint);
  min-width: 52px;
  text-align: right;
}

.hud-note {
  margin-top: 12px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  font-style: italic;
}

.floating-emojis {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.floating-emojis span {
  position: absolute;
  font-size: clamp(24px, 5vw, 40px);
  opacity: 0.3;
  animation: float 6s ease-in-out infinite;
}

.floating-emojis span:nth-child(1) { top: 15%; left: 8%; animation-delay: 0s; }
.floating-emojis span:nth-child(2) { top: 25%; right: 10%; animation-delay: 1s; }
.floating-emojis span:nth-child(3) { bottom: 30%; left: 15%; animation-delay: 2s; }
.floating-emojis span:nth-child(4) { top: 60%; right: 20%; animation-delay: 0.5s; }
.floating-emojis span:nth-child(5) { bottom: 15%; right: 8%; animation-delay: 1.5s; }
.floating-emojis span:nth-child(6) { top: 40%; left: 5%; animation-delay: 2.5s; }

.hero-polaroid {
  position: absolute;
  right: clamp(12px, 4vw, 40px);
  bottom: clamp(40px, 10vw, 80px);
  z-index: 3;
  background: white;
  padding: 8px 8px 24px;
  width: clamp(100px, 18vw, 140px);
  transform: rotate(8deg);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  text-decoration: none;
  transition: transform 0.3s, box-shadow 0.3s;
  animation: polaroidFloat 4s ease-in-out infinite;
}

.hero-polaroid:hover {
  transform: rotate(0deg) scale(1.08);
  box-shadow: 0 20px 50px rgba(255, 107, 157, 0.3);
}

.hero-polaroid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.hero-polaroid span {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 9px;
  font-family: 'Segoe Print', cursive;
  color: #444;
}

@keyframes polaroidFloat {
  0%, 100% { transform: rotate(8deg) translateY(0); }
  50% { transform: rotate(6deg) translateY(-10px); }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

/* ===== Certificate ===== */
.certificate {
  padding: 80px 0;
  background: var(--dark2);
}

.cert-card {
  background: linear-gradient(145deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 2px dashed rgba(255, 107, 157, 0.4);
  border-radius: 20px;
  padding: clamp(24px, 5vw, 48px);
  text-align: center;
  position: relative;
  transition: transform 0.3s;
}

.cert-card:hover { transform: scale(1.01); }

.cert-stamp {
  position: absolute;
  top: 20px;
  right: 20px;
  font-family: var(--pixel);
  font-size: 8px;
  color: var(--pink);
  border: 2px solid var(--pink);
  padding: 6px 10px;
  transform: rotate(12deg);
  opacity: 0.7;
}

.cert-card h2 {
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  margin-bottom: 16px;
}

.cert-body {
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  color: rgba(255,255,255,0.8);
  max-width: 600px;
  margin: 0 auto 12px;
}

.cert-fine {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  margin-bottom: 16px;
}

.cert-status {
  font-size: 13px;
  color: var(--mint);
  font-weight: 700;
  margin-bottom: 12px;
}

.cert-status.hidden { display: none; }

.cert-card.cert-issued {
  border-color: var(--mint);
  box-shadow: 0 0 30px rgba(0, 245, 212, 0.15);
}

.cert-card.cert-issued .cert-stamp {
  animation: stampSlam 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 1;
}

@keyframes stampSlam {
  0% { transform: rotate(12deg) scale(2); opacity: 0; }
  70% { transform: rotate(-8deg) scale(0.95); opacity: 1; }
  100% { transform: rotate(12deg) scale(1); opacity: 1; }
}

.cert-modal-content {
  max-width: 420px;
}

.cert-preview {
  background: linear-gradient(160deg, #fff 0%, #fff8fb 100%);
  color: #222;
  border: 3px dashed var(--pink);
  border-radius: 12px;
  padding: 28px 22px;
  text-align: center;
  position: relative;
  margin-bottom: 20px;
}

.cert-preview h3 {
  font-size: 1.1rem;
  margin-bottom: 14px;
  color: #1a1a2e;
}

.cert-preview p {
  font-size: 14px;
  line-height: 1.55;
  color: #444;
  margin-bottom: 10px;
}

.cert-preview-date {
  font-size: 12px;
  color: #888;
  margin-top: 16px;
}

.cert-preview-id {
  font-family: var(--pixel);
  font-size: 7px;
  color: #aaa;
  letter-spacing: 0.5px;
}

.cert-preview-stamp {
  position: absolute;
  top: 16px;
  right: 16px;
  font-family: var(--pixel);
  font-size: 8px;
  color: var(--pink);
  border: 2px solid var(--pink);
  padding: 6px 10px;
  transform: rotate(12deg) scale(0);
  opacity: 0;
}

.cert-preview-stamp.show {
  animation: stampSlam 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.cert-preview-img {
  width: 100%;
  border-radius: 8px;
  display: block;
  margin-bottom: 12px;
}

.cert-preview-img.hidden {
  display: none;
}

.cert-preview-text.hidden {
  display: none;
}

.cert-save-hint {
  margin-top: 12px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
}

/* ===== Achievements ===== */
.achievements {
  padding: 80px 0;
}

.section-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  text-align: center;
  margin-bottom: 8px;
}

.section-sub {
  text-align: center;
  color: rgba(255,255,255,0.5);
  margin-bottom: 40px;
  font-size: 14px;
}

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

.ach-card {
  background: var(--glass);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
  transition: transform 0.2s, border-color 0.2s;
}

.ach-card.unlocked:hover {
  transform: translateY(-4px);
  border-color: var(--pink);
}

.ach-card.locked {
  opacity: 0.5;
  filter: grayscale(0.5);
}

.ach-card.unlocked.secret-unlocked {
  opacity: 1;
  filter: none;
  border-color: var(--yellow);
  animation: glow 1s ease;
}

@keyframes glow {
  0% { box-shadow: 0 0 0 rgba(254, 228, 64, 0); }
  50% { box-shadow: 0 0 30px rgba(254, 228, 64, 0.4); }
  100% { box-shadow: 0 0 0 rgba(254, 228, 64, 0); }
}

.ach-icon { font-size: 2rem; display: block; margin-bottom: 12px; }

.ach-card h3 {
  font-size: 1rem;
  margin-bottom: 6px;
}

.ach-card p {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
}

.ach-rarity {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(155, 93, 229, 0.3);
  color: var(--purple);
}

.ach-card.unlocked .ach-rarity {
  background: rgba(255, 107, 157, 0.3);
  color: var(--pink);
}

/* ===== Cake ===== */
.cake-section {
  padding: 80px 0;
  background: var(--dark2);
}

.cake-wrap { text-align: center; }

.cake {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 400px;
  margin: 0 auto 20px;
}

.cake-slice {
  font-size: clamp(36px, 8vw, 52px);
  cursor: pointer;
  transition: transform 0.3s, opacity 0.3s;
  user-select: none;
}

.cake-slice:hover { transform: scale(1.2) rotate(10deg); }

.cake-slice.eaten {
  opacity: 0;
  transform: scale(0) rotate(180deg);
  pointer-events: none;
}

.cake-counter {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
}

/* ===== Gallery ===== */
.gallery-section {
  padding: 80px 0;
  background:
    radial-gradient(ellipse at 10% 20%, rgba(155, 93, 229, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 80%, rgba(255, 107, 157, 0.1) 0%, transparent 50%),
    var(--dark2);
  overflow: hidden;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 32px;
}

.gallery-filter {
  padding: 8px 18px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-family: var(--font);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s;
}

.gallery-filter:hover,
.gallery-filter.active {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  border-color: transparent;
  color: white;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 28px 24px;
  align-items: start;
  max-width: 100%;
}

.polaroid {
  --rot: 0deg;
  background: #fff;
  padding: 10px 10px 14px;
  border-radius: 4px;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: rotate(var(--rot));
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s;
  cursor: pointer;
  position: relative;
  animation: polaroidIn 0.6s ease backwards;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}

@keyframes polaroidIn {
  from { opacity: 0; transform: rotate(var(--rot)) translateY(30px) scale(0.9); }
  to { opacity: 1; transform: rotate(var(--rot)) translateY(0) scale(1); }
}

.polaroid:hover {
  transform: rotate(0deg) scale(1.04) translateY(-8px);
  box-shadow:
    0 20px 50px rgba(255, 107, 157, 0.25),
    0 8px 30px rgba(0, 0, 0, 0.4);
  z-index: 5;
}

.polaroid-tape {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 56px;
  height: 22px;
  background: rgba(254, 228, 64, 0.55);
  border: 1px solid rgba(254, 228, 64, 0.3);
  z-index: 2;
  backdrop-filter: blur(2px);
}

.polaroid-sticker {
  position: absolute;
  top: 8px;
  right: -6px;
  font-size: 9px;
  font-weight: 900;
  padding: 4px 8px;
  border-radius: 4px;
  transform: rotate(12deg);
  z-index: 3;
  letter-spacing: 0.3px;
}

.polaroid-sticker--top { background: var(--yellow); color: var(--dark); }
.polaroid-sticker--wild { background: var(--mint); color: var(--dark); }
.polaroid-sticker--cute { background: var(--pink); color: white; }

.polaroid-img-wrap {
  aspect-ratio: 1;
  overflow: hidden;
  background: #111;
}

.polaroid--tall .polaroid-img-wrap { aspect-ratio: 3/4; }
.polaroid--wide .polaroid-img-wrap { aspect-ratio: 4/3; }
.polaroid--large .polaroid-img-wrap { aspect-ratio: 1; }

.polaroid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s;
}

.polaroid:hover img {
  transform: scale(1.06);
}

.polaroid-caption {
  margin: 10px 4px 2px;
  padding: 0 2px;
  font-family: 'Segoe Print', 'Comic Sans MS', cursive;
  font-size: 11px;
  color: #333;
  text-align: center;
  line-height: 1.35;
  min-height: 2.7em;
  flex-shrink: 0;
}

@media (min-width: 769px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 32px 28px;
  }

  .polaroid--wide,
  .polaroid--large {
    grid-column: span 2;
  }

  .polaroid--tall .polaroid-img-wrap {
    aspect-ratio: 3/4;
  }
}

@media (min-width: 1100px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.polaroid--normal { grid-column: auto; }
.polaroid--tall { grid-column: auto; }
.polaroid--wide { grid-column: auto; }
.polaroid--large { grid-column: auto; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
}

.lightbox.hidden { display: none; }

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 2;
}

.lightbox-inner {
  max-width: 90vw;
  max-height: 85vh;
  text-align: center;
  animation: modalIn 0.3s ease;
}

.lightbox-inner img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-inner p {
  margin-top: 16px;
  font-family: 'Segoe Print', 'Comic Sans MS', cursive;
  font-size: clamp(14px, 3vw, 18px);
  color: var(--yellow);
}

/* Reaction popup */
.reaction-pop {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 960;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  transform: translateX(120%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.reaction-pop.hidden { display: none; }

.reaction-pop.show {
  transform: translateX(0);
}

.reaction-pop img {
  width: clamp(100px, 22vw, 140px);
  height: clamp(100px, 22vw, 140px);
  object-fit: cover;
  border-radius: 16px;
  border: 3px solid var(--pink);
  box-shadow: 0 8px 30px rgba(255, 107, 157, 0.4);
  transform: rotate(-6deg);
}

.reaction-pop span {
  background: white;
  color: var(--dark);
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  font-weight: 800;
  font-size: 13px;
  max-width: 160px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ===== Gift / runaway button ===== */
.gift-section {
  padding: 80px 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(254, 228, 64, 0.08) 0%, transparent 60%),
    var(--dark);
}

.gift-box {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: clamp(24px, 5vw, 40px);
  position: relative;
}

.gift-tag {
  display: inline-block;
  background: rgba(0, 245, 212, 0.15);
  border: 1px solid var(--mint);
  color: var(--mint);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 5px 12px;
  border-radius: 99px;
  margin-bottom: 16px;
}

.gift-text {
  color: rgba(255, 255, 255, 0.75);
  font-size: clamp(0.95rem, 2.5vw, 1.05rem);
  margin-bottom: 24px;
  line-height: 1.55;
}

.gift-btn-wrap {
  display: flex;
  justify-content: center;
  min-height: 56px;
  position: relative;
}

#btnSecretGift {
  position: relative;
  z-index: 50;
  transition: transform 0.15s ease, left 0.15s ease, top 0.15s ease;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
}

#btnSecretGift.runaway-active {
  position: fixed;
  z-index: 950;
  margin: 0;
  transition: left 0.12s ease-out, top 0.12s ease-out;
}

#btnSecretGift.is-loading {
  pointer-events: none;
  opacity: 0.85;
}

#btnSecretGift.is-caught {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  animation: caughtPop 0.5s ease;
}

@keyframes caughtPop {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.gift-hint {
  margin-top: 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
  font-style: italic;
  min-height: 1.2em;
}

/* ===== Generator ===== */
.generator { padding: 80px 0; }

.gen-box {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.gen-display {
  background: var(--glass);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: clamp(24px, 5vw, 40px);
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  transition: border-color 0.3s;
}

.gen-display.active {
  border-color: var(--pink);
  animation: popIn 0.4s ease;
}

@keyframes popIn {
  0% { transform: scale(0.95); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.gen-count {
  margin-top: 16px;
  font-size: 13px;
  color: rgba(255,255,255,0.4);
}

/* ===== FAQ ===== */
.faq {
  padding: 80px 0;
  background: var(--dark2);
}

.faq-list {
  max-width: 700px;
  margin: 0 auto;
}

.faq-item {
  background: var(--glass);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.faq-item summary {
  padding: 18px 20px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  font-size: 1.2rem;
  color: var(--pink);
  transition: transform 0.3s;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-item p {
  padding: 0 20px 18px;
  color: rgba(255,255,255,0.7);
  font-size: 14px;
}

/* ===== Reviews ===== */
.reviews { padding: 80px 0; }

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

.review-card {
  background: var(--glass);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform 0.2s;
}

.review-card:hover { transform: translateY(-4px); }

.review-stars {
  color: var(--yellow);
  font-size: 14px;
  margin-bottom: 12px;
}

.review-card p {
  font-size: 14px;
  font-style: italic;
  color: rgba(255,255,255,0.85);
  margin-bottom: 12px;
}

.review-author {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

/* ===== Finale ===== */
.finale {
  padding: 100px 0;
  text-align: center;
  background:
    radial-gradient(ellipse at center, rgba(255, 107, 157, 0.15) 0%, transparent 70%),
    var(--dark);
}

.finale h2 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  margin-bottom: 16px;
}

.finale p {
  max-width: 500px;
  margin: 0 auto 32px;
  color: rgba(255,255,255,0.75);
}

/* ===== Footer ===== */
.footer {
  padding: 32px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  text-align: center;
  font-size: 13px;
  color: rgba(255,255,255,0.4);
}

.footer-fine { margin-top: 8px; }

.footer a {
  color: var(--pink);
  text-decoration: none;
}

.footer kbd {
  background: rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal.hidden { display: none; }

.modal-content {
  background: var(--dark2);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: clamp(24px, 5vw, 40px);
  max-width: 480px;
  width: 100%;
  position: relative;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover { color: white; }

.modal-content h3 {
  margin-bottom: 20px;
  font-size: 1.2rem;
}

.age-result { text-align: center; }

.age-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--pink);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

.age-spinner.done { display: none; }

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

.terms-list {
  padding-left: 20px;
  font-size: 14px;
  color: rgba(255,255,255,0.75);
}

.terms-list li { margin-bottom: 10px; }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--pink);
  color: white;
  padding: 12px 20px;
  border-radius: 99px;
  font-weight: 700;
  font-size: clamp(12px, 3.2vw, 14px);
  z-index: 1100;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  max-width: min(92vw, 360px);
  text-align: center;
  line-height: 1.35;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.hidden { display: block; opacity: 0; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .reviews-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-polaroid {
    width: 90px;
    right: 12px;
    bottom: 24px;
  }
}

@media (max-width: 768px) {
  .hero-polaroid {
    display: none;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 16px;
  }

  .polaroid--wide,
  .polaroid--large {
    grid-column: span 2;
  }

  .polaroid {
    padding-bottom: 12px;
  }

  .polaroid-caption {
    margin-top: 12px;
    font-size: 10px;
    min-height: 3em;
    line-height: 1.4;
  }

  .polaroid:hover {
    transform: rotate(0deg) scale(1.02);
  }

  .reaction-pop {
    bottom: 16px;
    right: 16px;
    left: 16px;
    justify-content: center;
  }

  .reaction-pop img {
    width: 90px;
    height: 90px;
  }
}

@media (max-width: 768px) {
  .hero-polaroid {
    display: none;
  }

  .header-inner {
    height: 56px;
  }

  .nav {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--dark);
    flex-direction: column;
    padding: 16px 20px 20px;
    gap: 12px;
    transform: translateY(-120%);
    opacity: 0;
    transition: 0.3s;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    max-height: calc(100dvh - 56px);
    overflow-y: auto;
  }

  .nav.open {
    transform: translateY(0);
    opacity: 1;
  }

  .nav a {
    padding: 10px 0;
    font-size: 15px;
  }

  .burger { display: flex; }

  .hero-title {
    word-break: break-word;
  }

  .hero-hud {
    padding: 12px 12px 14px;
  }

  .hud-stamp {
    font-size: 6px;
    padding: 4px 8px;
  }

  .hud-row {
    grid-template-columns: 72px 1fr auto;
    gap: 6px;
  }

  .hud-label {
    font-size: 10px;
  }

  .hud-val {
    font-size: 10px;
    min-width: 44px;
  }

  .hud-avatar {
    width: 42px;
    height: 42px;
    font-size: 22px;
  }

  .hud-level strong {
    font-size: 1.2rem;
  }

  .hero-btns {
    flex-direction: column;
  }

  .hero-btns .btn {
    width: 100%;
  }

  .btn {
    padding: 13px 22px;
    font-size: 14px;
  }

  .btn-big {
    padding: 15px 24px;
    font-size: 15px;
    width: 100%;
  }

  .certificate,
  .achievements,
  .gallery-section,
  .cake-section,
  .generator,
  .gift-section,
  .faq,
  .reviews {
    padding: 56px 0;
  }

  .finale {
    padding: 64px 0;
  }

  .cert-stamp {
    position: static;
    display: inline-block;
    margin-bottom: 16px;
    transform: none;
  }

  .cert-card {
    padding: 24px 18px;
  }

  .tort-banner {
    flex-direction: column;
    text-align: center;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .tort-banner-btns {
    width: 100%;
    flex-direction: column;
  }

  .tort-banner button {
    width: 100%;
  }

  .gen-display {
    min-height: 100px;
    padding: 20px 16px;
  }

  .modal-content {
    max-height: 85dvh;
    overflow-y: auto;
  }

  .floating-emojis span {
    font-size: 20px;
    opacity: 0.2;
  }

  .footer kbd {
    display: none;
  }

  .footer-fine {
    line-height: 1.6;
  }

  .preloader-box {
    padding: 24px 20px;
  }
}

@media (max-width: 480px) {
  .hud-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .hud-row .hud-track {
    order: 2;
  }

  .hud-val {
    order: 3;
    text-align: left;
    min-width: 0;
  }

  .hud-label {
    order: 1;
  }

  .ach-grid,
  .reviews-grid {
    grid-template-columns: 1fr;
  }

  .cake {
    gap: 4px;
    max-width: 280px;
  }

  .cake-slice {
    font-size: 32px;
  }

  .hero-badge {
    font-size: 11px;
    padding: 5px 10px;
  }

  .faq-item summary {
    padding: 14px 16px;
    font-size: 14px;
  }

  .faq-item p {
    padding: 0 16px 14px;
  }
}

@media (max-width: 360px) {
  .logo {
    font-size: 1.05rem;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .section-title {
    font-size: 1.35rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
