/**
 * Estilos para Juego de la serpiente (Snake retro arcade)
 * Estándar canónico Fijate Tools
 */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-card-secondary: #334155;
  --bg-input: #0f172a;
  --bg-pill: rgba(15, 23, 42, 0.6);
  --border-color: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-text: #38bdf8;
  --btn-hover-bg: #475569;
}

[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-secondary: #f1f5f9;
  --bg-input: #ffffff;
  --bg-pill: #f1f5f9;
  --border-color: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #475569;
  --accent-text: #0284c7;
  --btn-hover-bg: #e2e8f0;
}

body {
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  background-color: var(--bg-body, #0f172a);
  color: var(--text-main, #f8fafc);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
}

.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Barra de mandos superior */
.snake-controls-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 14px;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.controls-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.controls-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted, #94a3b8);
}

.game-select {
  background: var(--bg-input, #0f172a);
  color: var(--text-main, #f8fafc);
  border: 1px solid var(--border-color, #334155);
  border-radius: 8px;
  padding: 0.4rem 1.8rem 0.4rem 0.65rem;
  font-size: 0.85rem;
  font-family: var(--font-main);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 0.9rem;
}

.game-select option {
  background: var(--bg-input);
  color: var(--text-main);
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-pill);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.stat-label {
  color: var(--text-muted);
}

.stat-value {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-text);
}

.btn-game-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-card-secondary);
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 38px;
}

.btn-game-action:hover {
  background: var(--btn-hover-bg);
}

.btn-game-action.btn-primary-action {
  background: #0284c7;
  border-color: #0369a1;
  color: #ffffff;
}

/* Contenedor del Canvas */
.snake-arena-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  position: relative;
}

.snake-arena-box.theme-nokia {
  background: #2b3917;
  border-color: #4b6329;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 540px;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.snake-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.canvas-overlay-message {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: #38bdf8;
  cursor: pointer;
  backdrop-filter: blur(3px);
  user-select: none;
  animation: fadeIn 0.2s ease;
}

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

/* Cruceta D-Pad para móvil */
.mobile-dpad-container {
  display: none;
  margin-top: 1.25rem;
  width: 180px;
  height: 180px;
  position: relative;
}

.dpad-btn {
  position: absolute;
  width: 54px;
  height: 54px;
  background: #334155;
  border: 2px solid #475569;
  border-radius: 12px;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.dpad-btn:active {
  background: #0284c7;
  border-color: #38bdf8;
}

.dpad-up { top: 0; left: 63px; }
.dpad-down { bottom: 0; left: 63px; }
.dpad-left { top: 63px; left: 0; }
.dpad-right { top: 63px; right: 0; }

@media (max-width: 900px) {
  .mobile-dpad-container {
    display: block;
  }
}

/* Guía de juego */
.game-guide-section {
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, #334155);
  border-radius: 14px;
  padding: 1.75rem;
  margin-top: 2rem;
}

.game-guide-section h2 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  margin-top: 0;
  margin-bottom: 1rem;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.guide-item h3 {
  font-size: 1.05rem;
  margin-top: 0;
  margin-bottom: 0.4rem;
  color: #38bdf8;
}

.guide-item p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted, #94a3b8);
  margin: 0;
}
