/* ==========================================================================
   SPIDEY MONEY LAB - DESIGN SYSTEM & STYLESHEET
   Ottimizzato per Tablet & Touch (Simone) - High Contrast & No-Slop Taste UI
   ========================================================================== */

:root {
  /* Spidey Theme Tokens */
  --spidey-red: #e2263d;
  --spidey-red-glow: rgba(226, 38, 61, 0.45);
  --spidey-blue: #1d63d6;
  --spidey-blue-glow: rgba(29, 99, 214, 0.4);
  --spidey-dark: #090c15;
  --spidey-surface: #141928;
  --spidey-surface-elevated: #1e253c;
  --spidey-surface-card: #192033;
  --spidey-border: rgba(255, 255, 255, 0.14);
  --spidey-border-bright: rgba(255, 255, 255, 0.28);

  /* Transaction 3-Area Colors */
  --area-cost-bg: rgba(239, 68, 68, 0.12);
  --area-cost-border: rgba(239, 68, 68, 0.45);
  --area-cost-accent: #f87171;

  --area-given-bg: rgba(59, 130, 246, 0.14);
  --area-given-border: rgba(59, 130, 246, 0.45);
  --area-given-accent: #60a5fa;

  --area-tray-bg: radial-gradient(circle at 50% 25%, #1e2d4d 0%, #111828 100%);
  --area-tray-border: #38bdf8;
  --area-tray-accent: #38bdf8;

  /* Typography Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --bubble-bg: #fffdf7;
  --bubble-text: #0f172a;

  /* Spacing & Radii */
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 9999px;
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: 'Lexend', system-ui, -apple-system, sans-serif;
  background-color: var(--spidey-dark);
  background-image: 
    radial-gradient(circle at 10% 10%, var(--spidey-red-glow) 0%, transparent 40%),
    radial-gradient(circle at 90% 90%, var(--spidey-blue-glow) 0%, transparent 45%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  padding: 14px;
}

/* Accessibilità e Focus */
:focus-visible {
  outline: 3px solid #facc15;
  outline-offset: 3px;
}

/* Contenitore App per Tablet */
.app-wrapper {
  width: 100%;
  max-width: 1360px;
  min-height: 94vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--spidey-surface);
  border: 1px solid var(--spidey-border);
  padding: 12px 20px;
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.spidey-badge-icon {
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 4px 10px var(--spidey-red-glow));
}

.mini-spidey-svg {
  width: 100%;
  height: 100%;
}

.brand-text .sub-title {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  font-weight: 800;
  color: var(--spidey-red);
  display: block;
}

.app-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Tabs Modalità */
.modes-nav {
  display: flex;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--spidey-border);
  gap: 4px;
}

.mode-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Lexend', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  transition: var(--transition);
}

.mode-tab.active {
  background: var(--spidey-blue);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--spidey-blue-glow);
}

.mode-tab:hover:not(.active) {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

/* Tool Header: Voce, Suoni, Impostazioni e Punti */
.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--spidey-border);
  color: #ffffff;
  font-family: 'Lexend', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  transition: var(--transition);
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--spidey-border-bright);
}

.settings-btn {
  background: rgba(234, 179, 8, 0.15);
  border-color: rgba(234, 179, 8, 0.35);
  color: #fef08a;
}
.settings-btn:hover {
  background: rgba(234, 179, 8, 0.3);
}

.score-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(234, 179, 8, 0.2), rgba(202, 138, 4, 0.35));
  border: 1px solid rgba(234, 179, 8, 0.5);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  min-height: 44px;
}

.score-value {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 1.25rem;
  color: #fde047;
}

/* ==========================================================================
   BENTO GRID LAYOUT (TABLET FIRST)
   ========================================================================== */
.game-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 18px;
  flex: 1;
}

.bento-card {
  background: var(--spidey-surface);
  border: 1px solid var(--spidey-border);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ==========================================================================
   COLONNA SINISTRA: L'AVATAR DI SPIDEY & LE DUE AREE (COSTA, HAI DATO)
   ========================================================================== */
.spidey-hero-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--spidey-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  position: relative;
}

.spidey-avatar-container {
  width: 130px;
  height: 142px;
  cursor: pointer;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.spidey-avatar-container:hover {
  transform: scale(1.05) rotate(-2deg);
}

.spidey-face-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 18px rgba(226, 38, 61, 0.35));
}

.spidey-eye {
  transform-origin: center;
  transition: transform 0.2s ease;
}

.spidey-avatar-container.talking .spidey-eye {
  animation: spideyBlink 1.8s infinite ease-in-out;
}

@keyframes spideyBlink {
  0%, 90%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.15); }
}

.spidey-avatar-container:active .spidey-eye {
  transform: scaleY(0.3);
}

.spidey-click-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 2px;
  font-weight: 600;
}

/* Balloon del fumetto */
.speech-bubble {
  background: var(--bubble-bg);
  color: var(--bubble-text);
  border-radius: 18px;
  padding: 14px 18px;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  border: 3px solid #1a1c24;
  width: 100%;
}

.speech-bubble::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 12px 12px 12px;
  border-style: solid;
  border-color: transparent transparent var(--bubble-bg) transparent;
  display: block;
}

.speech-text {
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   LE TRE AREE: 1. COSTA  2. HAI DATO AL NEGOZIANTE
   ========================================================================== */
.transaction-breakdown {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.trade-box {
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  position: relative;
  border-width: 2px;
  border-style: solid;
}

.box-tag {
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  display: inline-block;
  margin-bottom: 8px;
}

/* AREA 1: COSTA */
.box-cost {
  background: var(--area-cost-bg);
  border-color: var(--area-cost-border);
}

.tag-cost {
  background: var(--spidey-red);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--spidey-red-glow);
}

.item-visual-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.item-emoji {
  font-size: 3.5rem;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-name {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
}

.item-price-tag {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.price-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.price-amount {
  font-family: 'Outfit', sans-serif;
  font-size: 1.7rem;
  font-weight: 900;
  color: #f87171;
  text-shadow: 0 2px 10px rgba(248, 113, 113, 0.4);
}

/* AREA 2: HAI DATO AL NEGOZIANTE */
.box-given {
  background: var(--area-given-bg);
  border-color: var(--area-given-border);
}

.tag-given {
  background: var(--spidey-blue);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--spidey-blue-glow);
}

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

.given-visual-display {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.given-mini-img {
  height: 52px;
  width: auto;
  border-radius: 4px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.given-mini-coin {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

.given-text-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.given-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.given-total-highlight {
  font-family: 'Outfit', sans-serif;
  font-size: 1.55rem;
  font-weight: 900;
  color: #60a5fa;
  text-shadow: 0 2px 10px rgba(96, 165, 250, 0.35);
}

/* ==========================================================================
   GUIDA VISIVA DEI SALTI (15 -> 17 -> 19 -> 20)
   ========================================================================== */
.jump-guide-wrap {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--spidey-border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.jump-guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 0.04em;
}

.guide-toggle-btn {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: #fde68a;
  font-family: 'Lexend', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition);
}

.guide-toggle-btn:hover {
  background: rgba(251, 191, 36, 0.3);
}

.jump-path-display {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 4px 6px 4px;
}

.jump-path-display.hidden {
  display: none;
}

.jump-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 54px;
}

.jump-bubble {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 0.95rem;
  border: 2px solid;
  transition: var(--transition);
}

.node-start .jump-bubble {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #fca5a5;
}

.node-hop .jump-bubble {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #7dd3fc;
}

.node-current .jump-bubble {
  background: #38bdf8;
  border-color: #ffffff;
  color: #0c4a6e;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.7);
  transform: scale(1.12);
}

.node-target .jump-bubble {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  color: #86efac;
}

.node-reached .jump-bubble {
  background: #22c55e;
  border-color: #ffffff;
  color: #052e16;
  box-shadow: 0 0 14px rgba(34, 197, 94, 0.7);
}

.jump-tag {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center;
}

.jump-arrow {
  color: #fbbf24;
  font-size: 1.1rem;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.jump-step-val {
  font-size: 0.62rem;
  color: #fde68a;
  font-weight: 700;
}

/* Bottone Aiuto Progressivo */
.help-action-row {
  margin-top: auto;
}

.hint-btn {
  width: 100%;
  background: rgba(234, 179, 8, 0.16);
  border: 2px solid rgba(234, 179, 8, 0.45);
  color: #fef08a;
  font-family: 'Lexend', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.hint-btn:hover {
  background: rgba(234, 179, 8, 0.28);
  border-color: rgba(234, 179, 8, 0.75);
  transform: translateY(-2px);
}

/* ==========================================================================
   COLONNA DESTRA: AREA 3 (TORNA A TE) & CASSA DEL NEGOZIANTE
   ========================================================================== */
.card-cashier {
  justify-content: space-between;
  gap: 16px;
}

/* AREA 3: IL PIATTINO DI SIMONE (TORNA A TE) */
.checkout-tray {
  background: var(--area-tray-bg);
  border: 2px solid var(--area-tray-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: inset 0 4px 18px rgba(0, 0, 0, 0.55), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.tray-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.tray-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tag-tray {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
}

.tray-main-instruction {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
}

.tray-total-display {
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: rgba(0, 0, 0, 0.55);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--spidey-border);
}

.total-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.total-number {
  font-family: 'Outfit', sans-serif;
  font-size: 1.55rem;
  font-weight: 900;
  color: #38bdf8;
}

.tray-quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn {
  font-family: 'Lexend', sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  border: 1px solid;
  transition: var(--transition);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.undo-btn {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #bae6fd;
}
.undo-btn:hover {
  background: rgba(56, 189, 248, 0.3);
  color: #ffffff;
}

.clear-btn {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}
.clear-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ffffff;
}

/* Superficie del piattino */
.tray-surface {
  min-height: 110px;
  border: 2px dashed rgba(56, 189, 248, 0.35);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  position: relative;
  transition: var(--transition);
}

.tray-empty-hint {
  color: #94a3b8;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}

.tray-items-flex {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

/* Elementi visualizzati nel piattino di Simone (rimovibili al tocco) */
.tray-item {
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  transition: transform 0.15s ease, filter 0.15s ease;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: popIn 0.22s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tray-item:hover, .tray-item:focus-visible {
  transform: scale(1.1) translateY(-4px);
  filter: drop-shadow(0 6px 12px rgba(239, 68, 68, 0.6));
}

.tray-item:active {
  transform: scale(0.92);
}

.tray-item-remove-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444;
  color: #ffffff;
  font-size: 0.65rem;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.tray-bill-img {
  height: 48px;
  width: auto;
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.tray-coin-img {
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.tray-item-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  color: #f8fafc;
  margin-top: 2px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

@keyframes popIn {
  0% { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ==========================================================================
   CASSA DEL NEGOZIANTE (ASSET UFFICIALI BCE TOUCH GIGANTI)
   ========================================================================== */
.cashier-drawer-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--spidey-border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.drawer-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #94a3b8;
}

.flip-money-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--spidey-border);
  color: #e2e8f0;
  font-family: 'Lexend', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
}

.flip-money-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--spidey-border-bright);
}

/* Griglia Tagli Monete e Banconote */
.currency-group {
  display: grid;
  gap: 10px;
}

.banknotes-group {
  grid-template-columns: repeat(4, 1fr);
}

.coins-group {
  grid-template-columns: repeat(5, 1fr);
}

/* Pulsanti Denaro: Area touch generosa (> 60px) */
.money-btn {
  background: var(--spidey-surface-elevated);
  border: 2px solid var(--spidey-border);
  border-radius: var(--radius-md);
  padding: 8px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 84px;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
  position: relative;
}

.money-btn:hover, .money-btn:focus-visible {
  transform: translateY(-4px) scale(1.03);
  border-color: var(--spidey-border-bright);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
}

.money-btn:active {
  transform: scale(0.96);
}

/* Evidenziazione Aiuto Spidey */
.money-btn.pulse-hint {
  border-color: #facc15 !important;
  box-shadow: 0 0 25px rgba(250, 204, 21, 0.8), inset 0 0 10px rgba(250, 204, 21, 0.4) !important;
  animation: hintPulse 1.2s infinite alternate ease-in-out;
}

@keyframes hintPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.08) translateY(-4px); }
}

/* Wrapper Immagini e Proporzioni */
.money-img-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
}

.bill-wrapper {
  width: 100%;
  height: 54px;
}

.bill-img {
  max-width: 95%;
  max-height: 52px;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s ease;
}

/* Proporzioni Millimetriche Reali Monete */
/* 2€ = 25.75mm (~68px) */
.coin-wrapper.size-2e .coin-img {
  width: 66px;
  height: 66px;
}

/* 50c = 24.25mm (~62px) - Più grande di 1€! */
.coin-wrapper.size-50c .coin-img {
  width: 62px;
  height: 62px;
}

/* 1€ = 23.25mm (~58px) */
.coin-wrapper.size-1e .coin-img {
  width: 58px;
  height: 58px;
}

/* 20c = 22.25mm (~54px) - Fiore Spagnolo */
.coin-wrapper.size-20c .coin-img {
  width: 54px;
  height: 54px;
}

/* 10c = 19.75mm (~48px) */
.coin-wrapper.size-10c .coin-img {
  width: 48px;
  height: 48px;
}

.coin-img {
  object-fit: contain;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease;
}

/* Fiore Spagnolo (20 cent) */
.spanish-flower .coin-img {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.money-label {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.01em;
}

/* ==========================================================================
   PULSANTE DI VERIFICA (CTA SPIDEY >= 64px)
   ========================================================================== */
.action-footer {
  margin-top: 4px;
}

.cta-check-btn {
  width: 100%;
  min-height: 64px;
  background: linear-gradient(135deg, #e2263d 0%, #b91c1c 100%);
  border: 2px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 10px 25px var(--spidey-red-glow);
  transition: var(--transition);
}

.cta-check-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px var(--spidey-red-glow);
  filter: brightness(1.08);
}

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

.btn-spider-icon {
  font-size: 1.6rem;
}

/* ==========================================================================
   MODAL DIALOGS (CELEBRAZIONE, IMPOSTAZIONI, SOLDI VERI)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.88);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  animation: fadeIn 0.25s ease;
  padding: 16px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  background: radial-gradient(circle at 50% 15%, #1e293b 0%, #0f172a 100%);
  border: 2px solid var(--spidey-blue);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  max-width: 520px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 40px var(--spidey-blue-glow);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: bounceUp 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.celebrate-spidey {
  font-size: 4rem;
}

.modal-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.7rem;
  font-weight: 900;
  color: #38bdf8;
}

.modal-desc {
  font-size: 1.05rem;
  line-height: 1.55;
  color: #e2e8f0;
}

.modal-reward {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.4);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
}

.reward-highlight {
  color: #fde047;
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
}

.modal-buttons-row {
  display: flex;
  gap: 10px;
  width: 100%;
  flex-direction: column;
}

.modal-btn {
  width: 100%;
  min-height: 56px;
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-btn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}
.primary-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  border: 1px solid var(--spidey-border);
}
.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Modal Impostazioni Adulto */
.settings-card {
  max-width: 600px;
  text-align: left;
  align-items: stretch;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.settings-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #fde047;
}

.close-x-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 65vh;
  overflow-y: auto;
  padding-right: 4px;
}

.setting-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(0, 0, 0, 0.3);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--spidey-border);
}

.setting-group.row-group {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.setting-label {
  font-size: 0.92rem;
  font-weight: 600;
  color: #f8fafc;
}

.checkbox-chips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.chip-item {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--spidey-border);
  padding: 8px 10px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.chip-item input[type="checkbox"],
.row-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #38bdf8;
  cursor: pointer;
}

.setting-select {
  background: var(--spidey-surface-elevated);
  border: 1px solid var(--spidey-border-bright);
  color: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-family: 'Lexend', sans-serif;
  font-size: 0.9rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bounceUp {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* ==========================================================================
   ACCESSIBILITÀ & PREFERS-REDUCED-MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body.reduced-motion *,
body.reduced-motion *::before,
body.reduced-motion *::after {
  animation: none !important;
  transition: none !important;
}

/* ==========================================================================
   RESPONSIVE DESIGN (TABLET & SMARTPHONE)
   ========================================================================== */
@media (max-width: 1080px) {
  .game-grid {
    grid-template-columns: 1fr;
  }
  .app-wrapper {
    min-height: auto;
  }
  .spidey-hero-box {
    flex-direction: row;
    align-items: center;
  }
  .speech-bubble::before {
    top: 50%;
    left: -12px;
    transform: translateY(-50%);
    border-width: 12px 12px 12px 0;
    border-color: transparent var(--bubble-bg) transparent transparent;
  }
}

@media (max-width: 640px) {
  .main-header {
    flex-direction: column;
    align-items: stretch;
  }
  .modes-nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  .header-tools {
    justify-content: space-between;
  }
  .spidey-hero-box {
    flex-direction: column;
  }
  .speech-bubble::before {
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 12px 12px 12px;
    border-color: transparent transparent var(--bubble-bg) transparent;
  }
  .banknotes-group {
    grid-template-columns: repeat(2, 1fr);
  }
  .coins-group {
    grid-template-columns: repeat(3, 1fr);
  }
  .hide-mobile {
    display: none;
  }
}
