/* ==========================================================================
   ISOLA DELLA GEOMETRIA & FORME MAGICHE (CSS Modulare)
   ========================================================================== */

#geometry-screen {
  padding-bottom: 25px;
}

.geom-header-box {
  background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
  border: 2px solid #f0abfc;
  border-radius: 20px;
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 4px 15px rgba(217, 70, 239, 0.08);
}

.geom-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.geom-icon-emblem {
  font-size: 1.8rem;
  background: #ffffff;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.geom-title-text h2 {
  font-size: 1.25rem;
  font-weight: 900;
  color: #86198f;
  margin: 0;
}

.geom-title-text p {
  font-size: 0.85rem;
  color: #a21caf;
  margin: 0;
  font-weight: 600;
}

/* Nav Submodes Bar */
.geom-nav-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.geom-nav-tabs::-webkit-scrollbar {
  display: none;
}

.geom-tab-btn {
  background: #ffffff;
  border: 2px solid #e9d5ff;
  color: #7e22ce;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(126, 34, 206, 0.06);
}

.geom-tab-btn:hover {
  transform: translateY(-2px);
  border-color: #c084fc;
}

.geom-tab-btn.active {
  background: linear-gradient(135deg, #a855f7 0%, #7e22ce 100%);
  color: #ffffff;
  border-color: #7e22ce;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.35);
}

/* Common Screen Container */
.geom-mode-content {
  background: #ffffff;
  border: 2px solid #f3e8ff;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.06);
  display: none;
}

.geom-mode-content.active {
  display: block;
  animation: geomFadeIn 0.3s ease-out;
}

@keyframes geomFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mode Banner */
.geom-banner {
  background: #faf5ff;
  border: 2px dashed #d8b4fe;
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.geom-banner-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.95rem;
  color: #6b21a8;
}

.geom-banner-speech-btn {
  background: #f3e8ff;
  border: 1px solid #c084fc;
  color: #7e22ce;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}
.geom-banner-speech-btn:hover {
  background: #e9d5ff;
}

/* ================= 1. TANGRAM ================= */
.tangram-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.tangram-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.tangram-model-pill {
  background: #f3f4f6;
  border: 2px solid #e5e7eb;
  padding: 6px 12px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.82rem;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tangram-model-pill.active {
  background: #8b5cf6;
  border-color: #6d28d9;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
}

.tangram-stage {
  position: relative;
  width: 100%;
  max-width: 380px;
  height: 260px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.04);
}

.tangram-svg-board {
  width: 100%;
  height: 100%;
}

.tangram-slot {
  fill: #e2e8f0;
  stroke: #94a3b8;
  stroke-width: 2;
  stroke-dasharray: 4 4;
  transition: all 0.25s ease;
  cursor: pointer;
}

.tangram-slot.target-highlight {
  stroke: #9333ea !important;
  stroke-width: 3 !important;
  stroke-dasharray: 6 3 !important;
  fill: rgba(168, 85, 247, 0.2) !important;
  filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.6));
  animation: geomTargetPulse 1s infinite alternate;
}

@keyframes geomTargetPulse {
  0% { fill: rgba(168, 85, 247, 0.15); stroke-width: 2.5; }
  100% { fill: rgba(168, 85, 247, 0.35); stroke-width: 4; }
}

.tangram-slot.filled {
  stroke-dasharray: none;
  stroke-width: 2;
  stroke: #ffffff;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.tangram-tray {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: #faf5ff;
  border: 2px dashed #e9d5ff;
  border-radius: 14px;
}

.tangram-piece-btn {
  background: #ffffff;
  border: 2px solid #c084fc;
  border-radius: 12px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.08);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.tangram-piece-btn:hover {
  transform: translateY(-2px) scale(1.04);
}

.tangram-piece-btn:active, .tangram-piece-btn.is-dragging {
  cursor: grabbing;
  opacity: 0.5;
  transform: scale(0.96);
}

.tangram-piece-btn.used {
  opacity: 0.4;
  pointer-events: none;
  border-color: #cbd5e1 !important;
  color: #94a3b8 !important;
  cursor: default;
}

/* ================= 2. SCANNER REALTÃ€ ================= */
.scanner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.scanner-item-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.scanner-item-card:hover {
  transform: translateY(-3px);
  border-color: #a855f7;
  box-shadow: 0 6px 16px rgba(168, 85, 247, 0.12);
}

.scanner-item-card .scanner-emoji {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}

.scanner-item-card .scanner-label {
  font-weight: 800;
  font-size: 0.8rem;
  color: #334155;
}

.scanner-item-card.correct {
  background: #f0fdf4;
  border-color: #22c55e;
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.25);
  animation: geomPulse 0.4s ease;
}

.scanner-item-card.wrong {
  background: #fef2f2;
  border-color: #ef4444;
  animation: geomShake 0.4s ease;
}

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

@keyframes geomShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ================= 3. LATI & VERTICI ================= */
.proportions-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.geom-canvas-box {
  width: 100%;
  max-width: 320px;
  height: 220px;
  background: #faf5ff;
  border: 2px solid #e9d5ff;
  border-radius: 16px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vertex-point {
  fill: #f59e0b;
  stroke: #ffffff;
  stroke-width: 3;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.vertex-point:hover {
  transform: scale(1.3);
  fill: #eab308;
}

.vertex-point.touched {
  fill: #10b981;
  stroke: #ffffff;
  animation: geomPulse 0.3s ease;
}

.vertex-count-badge {
  background: #7e22ce;
  color: #ffffff;
  font-weight: 900;
  font-size: 1rem;
  padding: 6px 16px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(126, 34, 206, 0.25);
}

/* Proportion Size Order Slots */
.size-order-dock {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}

.size-slot {
  width: 90px;
  height: 90px;
  background: #f1f5f9;
  border: 2px dashed #94a3b8;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-weight: 800;
  font-size: 0.75rem;
  color: #64748b;
}

.size-slot.filled {
  background: #f0fdf4;
  border-color: #22c55e;
  border-style: solid;
}

.size-pieces-pool {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

.size-piece-bubble {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.size-piece-bubble:hover {
  transform: scale(1.1);
}

.size-piece-bubble.used {
  opacity: 0.3;
  pointer-events: none;
}

/* ================= 4. PORTALE DELLE FORME (RUNNER) ================= */
.runner-stage {
  position: relative;
  width: 100%;
  height: 220px;
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 60%, #4338ca 100%);
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid #6366f1;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
}

.runner-stars-bg {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(2px 2px at 20px 30px, #ffffff, rgba(0,0,0,0)),
                    radial-gradient(2px 2px at 100px 70px, #ffffff, rgba(0,0,0,0)),
                    radial-gradient(1px 1px at 200px 40px, #ffffff, rgba(0,0,0,0)),
                    radial-gradient(2px 2px at 300px 150px, #ffffff, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 320px 200px;
}

.runner-player {
  position: absolute;
  left: 30px;
  top: 80px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  transition: all 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
}

.runner-gate {
  position: absolute;
  right: -60px;
  top: 40px;
  width: 50px;
  height: 130px;
  background: rgba(255, 255, 255, 0.1);
  border: 3px dashed #a855f7;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  backdrop-filter: blur(4px);
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.runner-gate-target {
  font-size: 2.2rem;
  animation: geomPulse 1s infinite alternate;
}

.runner-gate-label {
  color: #e9d5ff;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.runner-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.runner-shape-btn {
  background: #ffffff;
  border: 2px solid #c7d2fe;
  border-radius: 14px;
  padding: 8px 14px;
  font-weight: 800;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.12);
  transition: all 0.15s ease;
}

.runner-shape-btn:hover, .runner-shape-btn.active {
  background: #4f46e5;
  color: #ffffff;
  border-color: #3730a3;
  transform: translateY(-2px);
}

/* ================= 5. SOLIDI 3D ================= */
.solids-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.solid-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px 10px;
  cursor: pointer;
  text-align: center;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.solid-card:hover, .solid-card.active {
  transform: translateY(-4px);
  border-color: #8b5cf6;
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.15);
}

.solid-card .solid-icon-3d {
  font-size: 2.6rem;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.solid-card .solid-name {
  font-weight: 900;
  font-size: 0.95rem;
  color: #1e293b;
}

.solid-card .solid-2d-tag {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
}

/* Solid Details Box */
.solid-inspector {
  margin-top: 16px;
  background: #fdf4ff;
  border: 2px solid #f0abfc;
  border-radius: 16px;
  padding: 14px;
}

.solid-inspector-title {
  font-weight: 900;
  font-size: 1.1rem;
  color: #86198f;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.solid-props-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.solid-prop-pill {
  background: #ffffff;
  border: 1px solid #f5d0fe;
  border-radius: 10px;
  padding: 6px;
  text-align: center;
}

.solid-prop-num {
  font-weight: 900;
  font-size: 1.1rem;
  color: #a21caf;
}

.solid-prop-lbl {
  font-size: 0.72rem;
  color: #701a75;
  font-weight: 700;
}

.solid-examples-wrap {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.solid-example-badge {
  background: #ffffff;
  border: 1px solid #e9d5ff;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #6b21a8;
}

/* Drag Ghost & Floating Preview */
#geom-drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 999999;
  transform: translate(-50%, -50%) scale(1.15) rotate(4deg);
  filter: drop-shadow(0 12px 24px rgba(0,0,0,0.3));
  transition: transform 0.1s ease;
  will-change: transform, left, top;
}

.size-slot.drag-over {
  border-color: #8b5cf6 !important;
  background: #fdf4ff !important;
  transform: scale(1.06) !important;
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.4) !important;
}

/* Custom Geometric SVG Icons */
.geom-svg-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.geom-svg-icon svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.12));
}

.scanner-item-card .geom-svg-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 2px;
}

.solid-card .geom-svg-icon {
  width: 54px;
  height: 54px;
  margin-bottom: 4px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .geom-header-box {
    padding: 10px 12px;
  }
  .geom-icon-emblem {
    width: 38px;
    height: 38px;
    font-size: 1.4rem;
  }
  .geom-title-text h2 {
    font-size: 1.05rem;
  }
  .tangram-stage {
    height: 220px;
  }
  .runner-stage {
    height: 190px;
  }
  .solid-props-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}