/* ============================================
   wordle.css – Wordle del Fútbol Chileno (Full Screen)
   ============================================ */

:root {
  /* Wordle Original Colors */
  --wc-bg: #121213;
  --wc-tile-empty: #121213;
  --wc-tile-border: #3a3a3c;
  --wc-tile-filled-border: #565758;

  --wc-text: #ffffff;
  --wc-text-sub: #818384;

  --wc-green: #538d4e;
  --wc-yellow: #b59f3b;
  --wc-gray: #3a3a3c;
  --wc-key-bg: #818384;

  --wc-anim: 0.5s ease;
}

[data-theme="light"] {
  --wc-bg: #ffffff;
  --wc-tile-empty: #ffffff;
  --wc-tile-border: #d3d6da;
  --wc-tile-filled-border: #878a8c;
  --wc-text: #1a1a1b;
  --wc-text-sub: #787c7e;

  --wc-green: #6aaa64;
  --wc-yellow: #c9b458;
  --wc-gray: #787c7e;
  --wc-key-bg: #d3d6da;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--wc-bg);
  color: var(--wc-text);
  font-family: 'Poppins', sans-serif;
  overflow-x: hidden;
  overflow-y: auto;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.wc-page-wrapper {
  position: relative;
  width: 100%;
  max-width: 1400px;
  /* Más espacio para que el anuncio se aleje del centro */
  margin: 0 auto;
  min-height: 100vh;
  display: block;
  /* Volvemos a block para que el margen auto del hijo funcione */
}

.wc-app {
  display: flex;
  flex-direction: column;
  max-width: 600px;
  margin: 0 auto;
  /* Centrado absoluto en el contenedor */
  min-height: 100vh;
  width: 100%;
}

.ad-wordle-side {
  position: absolute;
  top: 120px;
  right: 40px;
  /* Al extremo derecho */
  width: 300px;
  height: 600px;
  display: flex !important;
  z-index: 10;
}

@media (max-width: 1300px) {
  .ad-wordle-side {
    right: 10px;
    /* Pegarlo un poco más si la pantalla se achica */
  }
}

@media (max-width: 1100px) {
  .wc-page-wrapper {
    display: flex;
    flex-direction: column;
    padding-bottom: 30px;
    /* Espacio para el anuncio al final */
  }

  .ad-wordle-side {
    position: static;
    display: flex !important;
    width: 100%;
    max-width: 320px;
    /* Banner estándar móvil */
    height: 90px;
    margin: 20px auto 30px;
    order: 2;
    /* Después del juego */
  }

  .wc-app {
    min-height: 80vh;
    /* Asegurar que el contenedor tenga altura para los hijos absolutos */
    order: 1;
  }
}

/* HEADER */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--wc-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--wc-tile-border);
  transition: all 0.2s ease;
}

.back-btn:hover {
  filter: brightness(1.2);
  transform: translateX(-2px);
}

.theme-switch {
  position: relative;
  width: 54px;
  height: 28px;
  border-radius: 30px;
  border: 1px solid var(--wc-tile-border);
  background-color: var(--wc-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  transition: all 0.3s ease;
  flex-shrink: 0;
  outline: none;
}

.theme-switch svg {
  width: 14px;
  height: 14px;
  z-index: 1;
  transition: color 0.3s;
}

.theme-switch .sun-icon {
  color: #f59e0b;
}

.theme-switch .moon-icon {
  color: #64748b;
}

.theme-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background-color: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  transform: translateX(0);
  z-index: 0;
}

/* Light Mode Overrides */
[data-theme="light"] .theme-switch {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
}

[data-theme="light"] .theme-switch .moon-icon {
  color: #a1a1aa;
}

/* Dark Mode Overrides */
[data-theme="dark"] .theme-switch-thumb {
  transform: translateX(24px);
  background-color: #1e293b;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .theme-switch .sun-icon {
  color: #64748b;
}

[data-theme="dark"] .theme-switch .moon-icon {
  color: #fbbf24;
}


/* ── Header ── */
.wc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 60px;
  border-bottom: 1px solid var(--wc-tile-border);
  flex-shrink: 0;
  position: relative;
  gap: 10px;
}

.wc-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.help-text-mobile {
  display: none;
}

@media (max-width: 600px) {
  .help-text-pc {
    display: none;
  }

  .help-text-mobile {
    display: inline;
    font-size: 1.2rem;
  }

  .wc-help-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
  }
}


.wc-help-btn {
  background: none;
  border: 1px solid var(--wc-tile-border);
  color: var(--wc-text);
  font-family: 'Poppins', sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.wc-help-btn:hover {
  background: var(--wc-green);
  border-color: var(--wc-green);
  color: #fff;
}

/* ── Modal de Ayuda ── */
.wc-help-card {
  max-width: 380px !important;
  text-align: left;
  position: relative;
  gap: 0 !important;
}

.wc-help-title {
  text-align: center;
  font-size: 1.3rem !important;
  text-transform: none !important;
  margin-bottom: 20px;
  letter-spacing: 0;
}

.wc-help-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--wc-text-sub);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  line-height: 1;
  transition: background 0.2s, color 0.2s;
}

.wc-help-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--wc-text);
}

.wc-help-steps {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 22px;
  width: 100%;
}

.wc-help-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.wc-help-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--wc-green);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wc-help-step p {
  font-size: 0.85rem;
  color: var(--wc-text-sub);
  line-height: 1.55;
  margin-top: 2px;
}

.wc-help-step p strong {
  color: var(--wc-text);
}

.wc-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

@media (max-width: 480px) {
  .wc-title {
    font-size: 0.95rem;
  }
}

/* ── Pantallas Generales ── */
.wc-game-container {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
}

.wc-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

.wc-screen.hidden {
  display: none;
}

/* ── Dificultad (Menu Inicial) ── */
#wcDifficultyScreen {
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.wc-screen-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 24px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.wc-btn-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 250px;
}

.wc-btn {
  padding: 14px 20px;
  border-radius: 4px;
  border: none;
  font-weight: 700;
  font-size: 16px;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  text-transform: uppercase;
  text-align: center;
}

.wc-btn:active {
  transform: scale(0.97);
}

.wc-btn.easy {
  background: var(--wc-green);
  color: white;
}

.wc-btn.normal {
  background: var(--wc-yellow);
  color: white;
}

.wc-btn.hard {
  background: var(--wc-gray);
  color: white;
}

.mt-2 {
  margin-top: 8px;
}

.mt-4 {
  margin-top: 16px;
}

/* ── Game Board ── */
.wc-board-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 12px;
  overflow: hidden;
  min-height: 0;
}

/*
 * --tile-size is calculated and injected by JS (sizeTiles())
 * so it is always pixel-perfect regardless of browser zoom or device.
 */
.wc-board {
  display: flex;
  flex-direction: column;
  gap: var(--gap, 5px);
  --tile-size: 46px; /* safe default before JS runs */
  margin: 0 auto;
}

.wc-row {
  display: flex;
  flex-direction: row;
  gap: var(--gap, 5px);
}

.wc-tile {
  width:  var(--tile-size);
  height: var(--tile-size);
  flex-shrink: 0;
  border: 2px solid var(--wc-tile-border);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  /* Font scales with tile — 55% of tile size, capped at 28px */
  font-size: min(28px, calc(var(--tile-size) * 0.55));
  font-weight: 800;
  text-transform: uppercase;
  color: var(--wc-text);
  user-select: none;
  background-color: var(--wc-tile-empty);
  line-height: 1;
  overflow: hidden;
}

/* Tile States */
.wc-tile[data-state="tbd"] {
  border-color: var(--wc-tile-filled-border);
  animation: pop 0.1s;
}

.wc-tile[data-state="correct"] {
  background-color: var(--wc-green);
  border-color: var(--wc-green);
  color: white;
}

.wc-tile[data-state="present"] {
  background-color: var(--wc-yellow);
  border-color: var(--wc-yellow);
  color: white;
}

.wc-tile[data-state="absent"] {
  background-color: var(--wc-gray);
  border-color: var(--wc-gray);
  color: white;
}

.wc-tile[data-animation="flipIn"] {
  animation: flipIn 0.25s ease-in forwards;
}

.wc-tile[data-animation="flipOut"] {
  animation: flipOut 0.25s ease-out forwards;
}

.wc-row.shake {
  animation: shake 0.6s;
}

@keyframes pop {
  50% {
    transform: scale(1.1);
  }
}

@keyframes flipIn {
  0% {
    transform: rotateX(0);
  }

  100% {
    transform: rotateX(-90deg);
  }
}

@keyframes flipOut {
  0% {
    transform: rotateX(-90deg);
  }

  100% {
    transform: rotateX(0);
  }
}

@keyframes shake {

  10%,
  90% {
    transform: translateX(-1px);
  }

  20%,
  80% {
    transform: translateX(2px);
  }

  30%,
  50%,
  70% {
    transform: translateX(-4px);
  }

  40%,
  60% {
    transform: translateX(4px);
  }
}

/* ── Teclado ── */
.wc-keyboard {
  padding: 0 8px 20px;
  /* Increased bottom padding */
  user-select: none;
  flex-shrink: 0;
  margin-bottom: env(safe-area-inset-bottom, 0px);
}

.wc-kb-row {
  display: flex;
  margin: 0 auto 8px;
  gap: 6px;
  justify-content: center;
}

.wc-key {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 13px;
  border: 0;
  padding: 0;
  height: 52px;
  min-width: 0;
  flex: 1;
  border-radius: 4px;
  cursor: pointer;
  background-color: var(--wc-key-bg);
  color: var(--wc-text);
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
}

.wc-key.wide {
  flex: 1.5;
  font-size: 12px;
}

.wc-key[data-state="correct"] {
  background-color: var(--wc-green);
  color: white;
}

.wc-key[data-state="present"] {
  background-color: var(--wc-yellow);
  color: white;
}

.wc-key[data-state="absent"] {
  background-color: var(--wc-gray);
  color: white;
}

/* ── Toast ── */
.wc-toast {
  position: fixed;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--wc-text);
  color: var(--wc-bg);
  padding: 12px 16px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 14px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  text-align: center;
}

.wc-toast.show {
  opacity: 1;
}

/* ── Pantalla Resultado Overlay ── */
.wc-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s;
}

.wc-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.wc-result-card {
  background: var(--wc-bg);
  padding: 30px 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 1px solid var(--wc-tile-border);
}

.wc-image-wrap {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 20px;
  border: 4px solid var(--wc-green);
  box-shadow: 0 0 20px rgba(83, 141, 78, 0.5);
  background: var(--wc-gray);
  flex-shrink: 0;
}

.wc-result-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.wc-res-title {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.wc-res-sub {
  font-size: 14px;
  color: var(--wc-text-sub);
  margin-bottom: 10px;
}

.wc-res-word {
  font-size: 20px;
  font-weight: 700;
  color: var(--wc-text);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.wc-link {
  color: var(--wc-text-sub);
  font-size: 14px;
  text-decoration: underline;
  cursor: pointer;
  font-weight: 600;
}

.wc-link:hover {
  color: var(--wc-text);
}