:root {
  --bg: #1c1c2e;
  --accent: #FF007F;
  --card: rgba(255, 255, 255, .06);
  --text: #fff;
  --muted: rgba(255, 255, 255, .7);
  --shadow: 0 20px 80px rgba(0, 0, 0, .55);
  --r: 22px;
}

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700;800&display=swap");

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: linear-gradient(135deg, #1c1c2e 0%, #2a1b3d 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px 16px 100px;
}

.hero {
  text-align: center;
  max-width: 720px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 38px;
  letter-spacing: .3px;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.card {
  width: min(520px, 92vw);
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 14px;
  font-family: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.scratch-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .10);
}

.scratch-wrap.loading .under-img {
  visibility: hidden;
}

.under-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.scratch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.guide {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .45);
  border: 1px solid rgba(255, 255, 255, .12);
  font-size: 12.5px;
  color: rgba(255, 255, 255, .85);
  backdrop-filter: blur(8px);
}

.complete {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
}

.complete.is-hidden {
  display: none;
}

.complete-card {
  width: min(420px, 92vw);
  background: rgba(0, 0, 0, .75);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  padding: 18px 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.complete-title {
  font-size: 20px;
  margin-bottom: 8px;
}

.complete-text {
  font-size: 14px;
  color: #fff;
  margin-bottom: 14px;
}

.actions {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .16);
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
}

.btn:active {
  transform: translateY(1px);
}

.btn-close {
  margin-top: 10px;
  width: 100%;
  background: linear-gradient(135deg, #ff2d8a, #ff5fa3);
  color: #fff;
  border: 0;
}

.install-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
  text-decoration: none;
}

.install-icon {
  width: 70px;
  height: 70px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Crect x='10' y='10' width='76' height='76' rx='10' fill='%23111'/%3E%3Crect x='22' y='18' width='40' height='24' rx='4' fill='%23ffe61d'/%3E%3Crect x='66' y='18' width='8' height='24' rx='2' fill='%23ffe61d'/%3E%3Crect x='24' y='50' width='48' height='30' rx='6' fill='%23ffffff'/%3E%3Crect x='34' y='56' width='28' height='16' rx='3' fill='%23d9d9d9'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  animation: install-bounce 1.8s ease-in-out infinite;
  transform-origin: center bottom;
}

@keyframes install-bounce {

  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  40% {
    transform: translateY(-6px) scale(1.03);
  }

  70% {
    transform: translateY(0) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .install-icon {
    animation: none;
  }
}

@media (max-width: 520px) {
  .hero h1 {
    font-size: 30px;
  }
}

/* Modem Effect Styles */
.grid-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: grid;
  /* Columns and rows will be set via JS */
  z-index: 2;
}

.grid-cell {
  background-color: #bfbfbf;
  /* Cover color */
  width: 100%;
  height: 100%;
  border: 1px solid rgba(0, 0, 0, 0.05);
  /* Slight grid definition */
  transition: opacity 0.2s;
  /* Fade out effect */
}

.grid-cell.revealed {
  opacity: 0;
  visibility: hidden;
}

.status-bar {
  margin-top: 10px;
  font-family: monospace;
  font-size: 14px;
  color: #333;
  text-align: left;
  background: rgba(255, 255, 255, 0.4);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Banners (Full Width) */
.banner-card {
  grid-column: span 2;
  aspect-ratio: auto;
  min-height: 100px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-radius: 20px;
  text-decoration: none;
  margin-top: 16px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.banner-card .banner-content {
  flex: 1;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: left;
}

.banner-content .card-title {
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 4px;
}

.banner-content .card-subtitle {
  font-size: 14px;
  opacity: 0.8;
}

.banner-card.image-left {
  flex-direction: row;
  justify-content: flex-start;
}

.banner-card img {
  position: relative;
  width: 85px;
  height: 85px;
  object-fit: contain;
  margin: 0;
}

/* Patreon: White */
.banner-patreon {
  background: #FFFFFF !important;
  color: #000000 !important;
}

.banner-patreon .card-title {
  color: #000000 !important;
}

.banner-patreon .card-subtitle {
  color: #666666 !important;
}

/* Telegram: Azzurro (Blue) */
.banner-telegram {
  background: #2AABEE !important;
  color: #FFFFFF !important;
}

.banner-telegram .card-subtitle {
  color: rgba(255, 255, 255, 0.9) !important;
}

/* Archivio Segreto */
.archivio-section {
  width: min(520px, 92vw);
  margin-top: 20px;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px;
}

.archivio-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 12px 0;
  text-align: center;
  letter-spacing: 0.5px;
}

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

.archivio-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.archivio-card.active {
  border: 2px solid var(--accent);
  box-shadow: 0 0 15px rgba(255, 0, 127, 0.5);
  transform: scale(0.98);
}

.archivio-card:active {
  transform: scale(0.95);
}

.archivio-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.archivio-tag {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}