/**
 * Estilos para El juego del ahorcado
 * 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;

  --key-bg: #334155;
  --key-border: #475569;
  --key-text: #f8fafc;
  --gallows-stroke: #e2e8f0;
  --slot-border: #64748b;
}

[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;

  --key-bg: #f1f5f9;
  --key-border: #cbd5e1;
  --key-text: #0f172a;
  --gallows-stroke: #334155;
  --slot-border: #94a3b8;
}

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 */
.hangman-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;
}

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

/* Ilustración SVG */
.gallows-container {
  width: 260px;
  height: 260px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gallows-svg {
  width: 90%;
  height: 90%;
  stroke: var(--gallows-stroke);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.rope-color {
  stroke: #ca8a04;
  stroke-width: 4;
}

.body-color {
  stroke: #38bdf8;
  stroke-width: 5;
}

/* Pista y palabra */
.hint-container {
  text-align: center;
  max-width: 560px;
}

.hint-text-display {
  background: rgba(56, 189, 248, 0.12);
  border: 1px dashed #38bdf8;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  color: #38bdf8;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  display: none;
}

.word-slots-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 52px;
  padding: 0.5rem;
}

.char-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 48px;
  border-bottom: 3px solid var(--slot-border);
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  text-transform: uppercase;
}

.char-slot.is-revealed {
  border-color: var(--accent-text);
  color: var(--accent-text);
}

.char-slot.is-missed {
  border-color: #ef4444;
  color: #ef4444;
}

.char-space {
  width: 18px;
}

/* Teclado virtual */
.virtual-keyboard {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  max-width: 600px;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}

.key-btn {
  flex: 1;
  max-width: 48px;
  height: 46px;
  background: var(--key-bg);
  color: var(--key-text);
  border: 1px solid var(--key-border);
  border-radius: 8px;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.25);
  transition: all 0.12s ease;
  user-select: none;
  touch-action: manipulation;
}

.key-btn:hover:not(:disabled) {
  background: #475569;
  transform: translateY(-1px);
}

.key-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
  transform: none;
}

.key-btn.key-correct {
  background: #16a34a !important;
  border-color: #15803d !important;
  color: #ffffff !important;
  opacity: 1 !important;
}

.key-btn.key-wrong {
  background: #991b1b !important;
  border-color: #7f1d1d !important;
  color: #fecaca !important;
  opacity: 0.6 !important;
}

/* Modal de Retar a un amigo */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
}

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

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.modal-card h2 {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: var(--accent-text);
}

.modal-form-group {
  margin-bottom: 1.25rem;
}

.modal-form-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.modal-input {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  color: var(--text-main);
  font-size: 0.95rem;
  font-family: var(--font-main);
}

.challenge-result-box {
  margin-top: 1.25rem;
  background: var(--bg-input);
  border: 1px solid var(--accent-text);
  border-radius: 10px;
  padding: 1rem;
}

/* 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;
}
