/* cooling-webgl-game.css · Estils per al joc WebGL Pixel Art de refrigeració de PC */
:root {
  --gl-bg: #070b14;
  --gl-panel: #0f172a;
  --gl-panel-border: #1e293b;
  --gl-accent: #0284c7;
  --gl-accent-glow: rgba(2, 132, 199, 0.45);
  --gl-hot: #ef4444;
  --gl-hot-glow: rgba(239, 68, 68, 0.55);
  --gl-warm: #f59e0b;
  --gl-cool: #38bdf8;
  --gl-optimal: #10b981;
  --gl-text: #f8fafc;
  --gl-muted: #94a3b8;
  --gl-pixel-border: #334155;
  --font-pixel: 'Fira Code', monospace;
}

.cooling-game-wrapper {
  background: var(--gl-bg);
  border: 3px solid #0284c7;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55), 0 0 20px rgba(2, 132, 199, 0.2);
  color: var(--gl-text);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  margin: 1.8rem 0;
}

/* CAPÇALERA RETRO */
.cooling-game-header {
  background: linear-gradient(90deg, #091322 0%, #06243d 100%);
  padding: 0.9rem 1.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  border-bottom: 2px solid #1e3a5f;
}

.cooling-game-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.25rem;
  font-weight: 800;
  color: #e0f2fe;
}

.cooling-game-title span.badge {
  background: #0284c7;
  color: #fff;
  font-size: 0.72rem;
  font-family: var(--font-pixel);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.cooling-game-telemetry {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.telemetry-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.telemetry-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gl-muted);
  font-family: var(--font-pixel);
}

.telemetry-value {
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-pixel);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s ease;
}

.telemetry-value.is-hot { color: var(--gl-hot); text-shadow: 0 0 10px var(--gl-hot-glow); }
.telemetry-value.is-warm { color: var(--gl-warm); }
.telemetry-value.is-cool { color: var(--gl-cool); }
.telemetry-value.is-optimal { color: var(--gl-optimal); text-shadow: 0 0 10px rgba(16, 185, 129, 0.45); }

/* PANTALLA RETRO PIXEL ART */
.cooling-game-viewport {
  position: relative;
  width: 100%;
  height: 420px;
  background: #040810;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 2px solid #1e293b;
}

.cooling-webgl-canvas {
  width: 100%;
  height: 100%;
  max-width: 840px;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  cursor: crosshair;
}

.viewport-overlay {
  position: absolute;
  top: 10px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.viewport-chip {
  background: rgba(10, 18, 32, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: var(--font-pixel);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.viewport-controls {
  position: absolute;
  bottom: 10px;
  right: 12px;
  display: flex;
  gap: 6px;
  background: rgba(10, 18, 32, 0.85);
  backdrop-filter: blur(8px);
  padding: 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.viewport-btn {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
  padding: 0.35rem 0.65rem;
  border-radius: 5px;
  font-size: 0.76rem;
  font-family: var(--font-pixel);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.viewport-btn:hover {
  background: #0284c7;
  color: #fff;
  border-color: #38bdf8;
}

/* ZONA D'ACCIONS I REPTES MATEMÀTICS */
.cooling-game-actions {
  background: #0b1322;
  padding: 1.3rem;
}

.actions-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.actions-heading h4 {
  margin: 0;
  font-size: 1.1rem;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.actions-progress {
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font-pixel);
  color: #38bdf8;
  background: rgba(2, 132, 199, 0.15);
  padding: 0.25rem 0.75rem;
  border-radius: 6px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

@media(max-width: 820px) {
  .actions-grid { grid-template-columns: 1fr; }
  .cooling-game-viewport { height: 340px; }
}

/* TARGETA DE REPTE MATEMÀTIC DE TALLER */
.troubleshoot-card {
  background: #131f36;
  border: 2px solid #233554;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.8rem;
  transition: all 0.25s ease;
}

.troubleshoot-card.is-current {
  border-color: #38bdf8;
  background: #172642;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}

.troubleshoot-card.is-solved {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.troubleshoot-card.is-locked {
  opacity: 0.65;
  filter: grayscale(0.4);
}

.troubleshoot-header {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
}

.troubleshoot-icon {
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.4rem;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.troubleshoot-info h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 750;
  color: #f8fafc;
}

.troubleshoot-info p {
  margin: 0.25rem 0 0;
  font-size: 0.84rem;
  color: #94a3b8;
  line-height: 1.45;
}

/* CAIXA DE CÀLCUL MATEMÀTIC */
.math-challenge-box {
  background: #090e1a;
  border: 1px dashed #334155;
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  font-size: 0.84rem;
  color: #cbd5e1;
}

.math-challenge-box strong {
  color: #f1f5f9;
}

.math-formula-tag {
  display: inline-block;
  background: #1e293b;
  color: #38bdf8;
  font-family: var(--font-pixel);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  margin: 0.2rem 0;
}

.math-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.55rem;
  flex-wrap: wrap;
}

.math-input-row input {
  width: 6.5rem;
  padding: 0.45rem 0.65rem;
  border: 2px solid #334155;
  border-radius: 6px;
  background: #1e293b;
  color: #fff;
  font-family: var(--font-pixel);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
}

.math-input-row input:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.math-input-row input.is-invalid {
  border-color: #ef4444;
  background: #2d1518;
}

.math-input-row input.is-correct {
  border-color: #10b981;
  background: #0d2818;
  color: #34d399;
}

.troubleshoot-btn {
  padding: 0.48rem 0.95rem;
  background: #0284c7;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

.troubleshoot-btn:hover:not(:disabled) {
  background: #0369a1;
  transform: translateY(-1px);
}

.troubleshoot-btn:disabled {
  background: #1e293b;
  color: #64748b;
  cursor: not-allowed;
  border: 1px solid #334155;
}

.troubleshoot-btn.is-completed {
  background: #10b981;
  color: #fff;
  border: none;
}

.math-feedback {
  min-height: 1.2rem;
  font-size: 0.78rem;
  font-weight: 600;
  margin-top: 0.35rem;
}

.math-feedback.error { color: #f87171; }
.math-feedback.success { color: #34d399; }

/* BANNER DE VICTÒRIA FINAL */
.cooling-game-victory {
  display: none;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2) 0%, rgba(2, 132, 199, 0.2) 100%);
  border: 3px solid #10b981;
  border-radius: 14px;
  padding: 1.4rem;
  margin-top: 1.2rem;
  text-align: center;
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.3);
  animation: fadeInVictory 0.45s ease-out forwards;
}

@keyframes fadeInVictory {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.cooling-game-victory h3 {
  margin: 0 0 0.5rem;
  font-size: 1.4rem;
  color: #34d399;
}

.cooling-game-victory p {
  max-width: 680px;
  margin: 0.4rem auto;
  color: #e2e8f0;
  font-size: 0.95rem;
}

.victory-metrics {
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  flex-wrap: wrap;
  margin: 1.1rem 0;
}

.victory-metric-box {
  background: rgba(8, 14, 26, 0.75);
  padding: 0.7rem 1.2rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.victory-metric-box strong {
  display: block;
  font-size: 1.3rem;
  font-family: var(--font-pixel);
  color: #38bdf8;
}

.victory-metric-box span {
  font-size: 0.76rem;
  color: #94a3b8;
}

/* PEU DEL JOC */
.cooling-game-footer {
  padding: 0.85rem 1.4rem;
  background: #070c16;
  border-top: 1px solid #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.82rem;
  color: #94a3b8;
}

.footer-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: var(--font-pixel);
  transition: all 0.2s;
}

.footer-btn:hover {
  background: #0284c7;
  color: #fff;
  border-color: #38bdf8;
}
