/* ── Base ── */
* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

body {
  background: #0A374F;
  min-height: 100dvh;
  font-family: 'Bricolage Grotesque', sans-serif;
}

/* ── Main container ── */
main {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

/* ── Overlay ── */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
}
.overlay.open { opacity: 1; pointer-events: auto; }

/* ── Drawer ── */
.drawer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  transform: translateY(100%);
  transition: transform .42s cubic-bezier(.32,.72,0,1);
}
.drawer.open { transform: translateY(0); }

/* ── No-copy text ── */
.no-copy {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* ── Card square ── */
.card-sq { aspect-ratio: 2 / 3; }

/* ── Card full-width (seconda riga) ── */
.card-full { aspect-ratio: 3 / 1; }

/* ── Testo non selezionabile nelle card ── */
.card-sq,
.card-full {
  user-select: none;
  -webkit-user-select: none;
}

/* ── Dado preview nella card 4 ── */
.dice-preview {
  position: relative;
  aspect-ratio: 1 / 1;
  height: calc(100% - 1rem);
  flex-shrink: 0;
  margin: 0.5rem;
  padding: 5%;
  border-radius: 0.75rem;
  border: 1px solid rgba(255,255,255,.15);
}

.card4-plus {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.8rem;
  font-weight: 300;
}

.dice-preview .dice-face {
  gap: 6px;
}

/* ── Gradient text ── */
.grad-text {
  background: linear-gradient(90deg, #93c5fd, #c4b5fd, #fca5a5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Prompt section reveal ── */
#prompt-section {
  display: none;
}
#prompt-section.visible {
  display: block;
  animation: fadeSlideIn .5s ease forwards;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── CTA shimmer ── */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}
.cta-btn {
  background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 30%, #ef4444 60%, #8b5cf6 80%, #3b82f6 100%);
  background-size: 200% auto;
  animation: shimmer 4s linear infinite;
}

/* ── Hero section ── */
.hero-section {
  background: #0A374F;
  background-image: url('../img/hero.png');
  background-size: 150%;
  background-position: center -20px;
  background-repeat: no-repeat;
  max-width: 1024px;
  margin: 0 auto;
}

@media only screen and (min-width: 768px) {
  .hero-section {
    background-size: 100%;
  }
}

/* ── Hero bottom fade ── */
.hero-fade {
  background: linear-gradient(to top, #030712, transparent);
}

/* ── Cards section ── */
.cards-section {
  min-height: 40dvh;
  background: #0A374F;
}

/* ── Progress dots — initial state ── */
.dot {
  width: 6px;
  background: rgba(255,255,255,.18);
}

/* ── Card colors ── */
.card-stile {
  /* background: linear-gradient(160deg, #1e3a8a, #3730a3); */
  background-image: url("../img/bg_soggetto.png");
  background-size: cover;
  background-position: center;
  border-color: rgba(96,165,250,.55);
}
.card-tema {
  /* background: linear-gradient(160deg, #4c1d95, #6d28d9); */
  background-image: url("../img/bg_ambientazione.png");
  background-size: cover;
  background-position: center;
  border-color: rgba(167,139,250,.55);
}
.card-tono {
  /* background: linear-gradient(160deg, #6b21a8, #a21caf); */
  background-image: url("../img/bg_stile.png");
  background-size: cover;
  background-position: center;
  border-color: rgba(217,70,239,.55);
}
.card-forma {
  background: #0A374F;
  border-color: rgba(167,139,250,.55);
}

/* ── Card shine overlay ── */
.card-shine {
  background: linear-gradient(135deg, rgba(255,255,255,.14), transparent);
}

/* ── Prompt section ── */
.prompt-section-bg {
  background: #0A374F;
}

/* ── Prompt chip ── */
.prompt-chip {
  background: rgba(139,92,246,.12);
  border-color: rgba(139,92,246,.3);
  color: #c4b5fd;
}

/* ── Prompt box ── */
.prompt-box-bg {
  background: linear-gradient(135deg, rgba(255,255,255,.06), rgba(255,255,255,.025));
  border: 1px solid rgba(255,255,255,.1);
}

#generated-text {
  white-space: pre-line;
}

@keyframes promptFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.prompt-text-fade {
  animation: promptFadeIn 800ms ease-out forwards;
}

/* ── Number drawer ── */
.num-drawer-height { height: auto; }

#num-drawer,
#dice-drawer {
  left: 50%;
  right: auto;
  width: 100%;
  max-width: 480px;
  transform: translateX(-50%) translateY(100%);
}
#num-drawer.open,
#dice-drawer.open {
  transform: translateX(-50%) translateY(0);
}

.num-drawer-inner {
  background: linear-gradient(180deg, #1e1b4b 0%, #0f0c2e 100%);
  border-top: 1px solid rgba(255,255,255,.1);
}

/* ── Drawer handle bar ── */
.drawer-handle {
  background: rgba(255,255,255,.2);
}

/* ── Keypad grid ── */
.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  flex: 1;
}

/* ── Keypad buttons ── */
.key-btn {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-color: rgba(255,255,255,.1);
}
.key-btn-1 { background: linear-gradient(135deg, #1d4ed8, #6d28d9); }
.key-btn-2 { background: linear-gradient(135deg, #2563eb, #7c3aed); }
.key-btn-3 { background: linear-gradient(135deg, #6d28d9, #7c3aed); }
.key-btn-4 { background: linear-gradient(135deg, #7c3aed, #9d174d); }
.key-btn-5 { background: linear-gradient(135deg, #9d174d, #be123c); }
.key-btn-6 { background: linear-gradient(135deg, #be123c, #991b1b); }

/* ── Dice button ── */
.dice-btn {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-color: rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18%;
}

/* ── Dice face — griglia 3×3 di pip ── */
.dice-face {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.pip {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  visibility: hidden;
}

/* ── Facce del dado ── */
/* 1 — centro */
.dice-1 .pip:nth-child(5) { visibility: visible; }

/* 2 — angolo alto-destra, angolo basso-sinistra */
.dice-2 .pip:nth-child(3),
.dice-2 .pip:nth-child(7) { visibility: visible; }

/* 3 — angolo alto-destra, centro, angolo basso-sinistra */
.dice-3 .pip:nth-child(3),
.dice-3 .pip:nth-child(5),
.dice-3 .pip:nth-child(7) { visibility: visible; }

/* 4 — quattro angoli */
.dice-4 .pip:nth-child(1),
.dice-4 .pip:nth-child(3),
.dice-4 .pip:nth-child(7),
.dice-4 .pip:nth-child(9) { visibility: visible; }

/* 5 — quattro angoli + centro */
.dice-5 .pip:nth-child(1),
.dice-5 .pip:nth-child(3),
.dice-5 .pip:nth-child(5),
.dice-5 .pip:nth-child(7),
.dice-5 .pip:nth-child(9) { visibility: visible; }

/* 6 — colonna sinistra + colonna destra */
.dice-6 .pip:nth-child(1),
.dice-6 .pip:nth-child(3),
.dice-6 .pip:nth-child(4),
.dice-6 .pip:nth-child(6),
.dice-6 .pip:nth-child(7),
.dice-6 .pip:nth-child(9) { visibility: visible; }

/* ── Gemini drawer ── */
.gem-drawer-height { height: 90dvh; }

.gem-drawer-inner {
  background: linear-gradient(180deg, #0f172a 0%, #060610 100%);
  border-top: 1px solid rgba(255,255,255,.1);
}

/* ── Gemini iframe container ── */
.iframe-container {
  border: 1px solid rgba(255,255,255,.08);
}

/* ── Gemini iframe background ── */
.iframe-bg {
  background: #111827;
}

.max-w-xs {
  max-width: 480px !important;
}