/* =============================================
   Naru2day — Wordle Game Styles
   ============================================= */

/* --- TITLE BAR --- */
.wn-wordle-title-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 16px 8px;
  margin-bottom: 14px;
  margin-top: 15px;
  text-align: center;
}

.wn-wordle-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.wn-coming-soon {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--wn-orange);
  opacity: 0.65;
}

.wn-wordle-h1 {
  font-family: 'Reggae One', cursive;
  font-size: 1.8rem;
  color: var(--wn-orange);
  text-shadow: 0 0 16px var(--wn-orange-glow);
  margin: 0;
  line-height: 1;
  letter-spacing: 1px;
}

.wn-wordle-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 107, 0, 0.15);
  border: 2px solid var(--wn-orange);
  color: var(--wn-orange);
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.wn-wordle-help-btn:hover {
  background: rgba(255, 107, 0, 0.3);
  transform: scale(1.1);
}

/* --- MAIN LAYOUT --- */
.wn-container-wordle {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 570px;
  margin: 0 auto;
  padding: 0 12px;
}

/* --- GAME CARD --- */
.wn-game-container {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat,
    linear-gradient(160deg, #e8d5b0, #d4b882);
  border: 2px solid #A07840;
  border-radius: 18px;
  padding: 24px 20px;
  margin-bottom: 20px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}

/* --- PERGAMINO: ink overrides (dark text on papyrus) --- */
.wn-game-container .wn-wordle-category-hint {
  color: #1A0A00;
  font-size: 1.45rem;
  -webkit-text-stroke: 0.5px #1A0A00;
}

.wn-game-container .wn-wordle-category-hint span {
  color: #1A0A00;
}

.wn-game-container .wn-wordle-cat-info-btn {
  color: #1A0A00;
  border-color: rgba(26, 10, 0, 0.35);
  background: rgba(26, 10, 0, 0.08);
}

.wn-game-container .wn-wordle-cat-info-btn:hover {
  background: rgba(26, 10, 0, 0.16);
}

/* --- CATEGORY HINT --- */
.wn-wordle-category-hint {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font-family: 'Reggae One', cursive;
  font-size: 1.3rem;
  color: var(--wn-orange);
  letter-spacing: 0.5px;
}

.wn-wordle-category-hint.visible {
  display: flex;
}

.wn-wordle-category-hint span {
  color: var(--wn-text);
}

.wn-category-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--wn-orange);
  border-radius: 50%;
  animation: wn-spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes wn-spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- BOARD --- */
.wn-wordle-board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 5px;
  margin-bottom: 20px;
}

.wn-wordle-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.wn-cell {
  width: 54px;
  height: 54px;
  border: 2px solid rgba(100, 70, 30, 0.5);
  background: rgba(10, 8, 5, 0.55);
  font-family: 'Reggae One', cursive;
  font-size: 1.7rem;
  font-weight: normal;
  display: flex;
  justify-content: center;
  align-items: center;
  text-transform: uppercase;
  color: var(--wn-text);
  user-select: none;
  border-radius: 6px;
  transition: border-color 0.15s;
}

/* Flip animation */
.wn-cell.flip {
  animation: wn-cell-flip 0.4s ease forwards;
}

@keyframes wn-cell-flip {
  0% {
    transform: rotateX(0);
  }

  50% {
    transform: rotateX(90deg);
  }

  100% {
    transform: rotateX(0);
  }
}

/* Cell states */
.wn-cell.correct {
  background: var(--wn-green) !important;
  border-color: #1d7a31 !important;
  color: #fff !important;
}

.wn-cell.present {
  background: var(--wn-orange) !important;
  border-color: var(--wn-orange-dark) !important;
  color: #fff !important;
}

.wn-cell.absent {
  background: #252D3B !important;
  border-color: #1A2030 !important;
  color: var(--wn-text-muted) !important;
}

/* --- KEYBOARD --- */
.wn-keyboard {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px;
}

.wn-key-row {
  display: flex;
  justify-content: center;
  gap: 4px;
}

.wn-key {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
  height: 42px;
  padding: 0 8px;
  border: 1.5px solid rgba(100, 70, 30, 0.45);
  border-radius: 6px;
  background: rgba(10, 8, 5, 0.55);
  color: var(--wn-text);
  cursor: pointer;
  text-transform: uppercase;
  min-width: 30px;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  transition: all 0.1s ease;
  flex: 1;
  touch-action: manipulation;
}

.wn-key:active {
  transform: translateY(3px);
  box-shadow: none;
}

.wn-key-action {
  background: rgba(20, 14, 8, 0.65);
  border-color: rgba(100, 70, 30, 0.55);
  flex: 1.5;
}

.wn-key-action svg {
  stroke: var(--wn-text);
}

/* Keyboard states */
.wn-key.correct {
  background: var(--wn-green);
  border-color: #1d7a31;
  color: #fff;
  box-shadow: 0 3px 0 #155923;
}

.wn-key.present {
  background: var(--wn-orange);
  border-color: var(--wn-orange-dark);
  color: #fff;
  box-shadow: 0 3px 0 var(--wn-orange-dark);
}

.wn-key.absent {
  background: #1A1E26;
  border-color: #111520;
  color: var(--wn-text-muted);
  box-shadow: 0 3px 0 #0A0D14;
}

/* --- TUTORIAL OVERLAY --- */
.wn-tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.wn-tutorial-overlay.hidden {
  display: none;
}

.wn-tutorial-content {
  background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
  background-color: #CE9D66;
  border: 1.5px solid #C19A6B;
  border-radius: 16px;
  padding: 28px 24px 24px;
  max-width: 380px;
  width: 100%;
  position: relative;
  color: #1a0f0a;
}

.wn-tutorial-content h2 {
  font-family: 'Reggae One', cursive;
  color: #4A2E15;
  text-align: center;
  margin-bottom: 12px;
}

.wn-tutorial-content p {
  text-align: center;
  color: #5c4033;
  margin-bottom: 16px;
  font-size: 0.95rem;
}

.wn-tutorial-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: #8B5A2B;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color 0.15s;
}

.wn-tutorial-close:hover {
  color: #4A2E15;
}

.wn-tutorial-examples {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
  background: rgba(139, 90, 43, 0.1);
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(139, 90, 43, 0.3);
}

.wn-example-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.wn-example-row p {
  margin: 0;
  font-size: 0.88rem;
  color: #5c4033;
  font-weight: 600;
}

.wn-tut-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  font-weight: 900;
  font-size: 0.9rem;
  vertical-align: middle;
  line-height: 1;
}

.wn-tut-letter.correct {
  background: #558B6E;
  color: #fff;
}

.wn-tut-letter.present {
  background: #C17F3B;
  color: #fff;
}

.wn-tut-letter.absent {
  background: #252D3B;
  color: #8B949E;
}

.wn-small-row {
  display: flex;
  gap: 5px;
}

.wn-small-row .wn-cell {
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
  border-width: 2px;
}

/* --- CATEGORY INFO BUTTON / POPOVER --- */
.wn-wordle-cat-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 107, 0, 0.15);
  border: 2px solid var(--wn-orange);
  color: var(--wn-orange);
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
}

.wn-wordle-cat-info-btn:hover {
  background: rgba(255, 107, 0, 0.3);
  transform: scale(1.1);
}

.wn-wordle-cat-info-btn.hidden {
  visibility: hidden;
  pointer-events: none;
}

.wn-wordle-cat-info-popover {
  display: none;
  position: fixed;
  width: 240px;
  background: var(--wn-bg-card);
  border: 1px solid var(--wn-orange-dark);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.87rem;
  color: var(--wn-text-muted);
  text-align: center;
  line-height: 1.6;
  z-index: 9999;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.wn-wordle-cat-info-popover::before {
  content: '';
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 7px solid var(--wn-orange-dark);
}

.wn-wordle-cat-info-popover.above::before {
  top: auto;
  bottom: -7px;
  border-bottom: none;
  border-top: 7px solid var(--wn-orange-dark);
}

.wn-wordle-cat-info-popover.open {
  display: block;
  pointer-events: auto;
  animation: wn-popover-in 0.15s ease;
}

@keyframes wn-popover-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Yesterday banner: styles in common.css (.wn-yesterday-banner) */

/* .wn-btn-back → common.css */

/* --- RESULT MODAL (within wordle) --- */
/* Override common.css max-width/margin so cards fill the wordle container */
.wn-container-wordle .game-result-wrapper {
  max-width: none;
  margin: 0;
  width: 100%;
}

.wn-container-wordle .game-result-modal {
  max-width: none;
  margin: 0;
  width: 100%;
  border-radius: 18px;
}

.wn-container-wordle .wn-wordle-stats {
  max-width: none;
  margin: 0;
  border-radius: 18px;
  padding: 20px 18px;
}

/* --- STATS DISTRIBUTION --- */
.wn-wordle-stats {
  padding: 14px 16px;
  background: url('../img/Fondo_Pergamino.webp') center center / cover no-repeat;
  background-color: #CE9D66;
  border: 2px solid #C19A6B;
  border-radius: 12px;
}

.wn-wordle-stats.hidden {
  display: none;
}

.wn-stats-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}

.wn-stats-header::before,
.wn-stats-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(139, 90, 43, 0.4);
}

.wn-stats-title {
  font-family: 'Reggae One', cursive;
  font-size: 0.8rem;
  color: #4A2E15;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.wn-stats-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.wn-stats-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wn-stats-label {
  font-family: 'Reggae One', cursive;
  font-size: 1rem;
  font-weight: 700;
  color: rgba(92, 64, 51, 0.45);
  width: 16px;
  text-align: center;
  flex-shrink: 0;
}

.wn-stats-row.is-mine .wn-stats-label {
  color: var(--wn-orange);
}

.wn-stats-row.is-mine .wn-stats-pct {
  color: #1a0f0a;
}

.wn-stats-bar-wrap {
  flex: 1;
  background: rgba(139, 90, 43, 0.15);
  border-radius: 4px;
  overflow: hidden;
  height: 22px;
}

.wn-stats-bar {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: rgba(139, 90, 43, 0.3);
  transition: width 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

.wn-stats-row.is-mine .wn-stats-bar {
  background: var(--wn-orange);
  box-shadow: 0 0 10px var(--wn-orange-glow);
}

.wn-stats-bar.is-fail {
  background: rgba(139, 90, 43, 0.15);
}

.wn-stats-row.is-mine .wn-stats-bar.is-fail {
  background: var(--wn-red);
}

.wn-stats-pct {
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(92, 64, 51, 0.45);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.wn-stats-row.is-mine .wn-stats-pct {
  color: var(--wn-text);
}

.wn-stats-pct.is-zero {
  color: rgba(92, 64, 51, 0.4);
  font-weight: normal;
}


.wn-howto-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.wn-howto-step {
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(160, 120, 64, 0.5);
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
}

.wn-howto-step .step-emoji {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 7px;
}

.wn-howto-step strong {
  display: block;
  color: #3E2000;
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.wn-howto-step span {
  color: #5a3200;
  font-size: 0.76rem;
  line-height: 1.4;
}

.wn-info-note {
  font-size: 0.8rem;
  color: #5a3200;
  font-style: italic;
  text-align: center;
  opacity: 0.85;
  margin-top: 12px;
  margin-bottom: 0;
}

/* Override tutorial letter badge inside howto steps — inline text, no box */
.wn-howto-step .wn-tut-letter {
  display: inline;
  width: auto;
  height: auto;
  border-radius: 0;
  font-weight: 900;
  font-size: 1em;
  vertical-align: baseline;
  line-height: inherit;
  padding: 0 1px;
}

.wn-howto-step .wn-tut-letter.correct {
  background: transparent;
  color: #1d7a31;
  border: none;
}

.wn-howto-step .wn-tut-letter.present {
  background: transparent;
  color: #C17F3B;
  border: none;
}

.wn-howto-step .wn-tut-letter.absent {
  background: transparent;
  color: #5a3200;
  border: none;
}

/* --- RESPONSIVE --- */
@media (max-width: 500px) {
  .wn-container-wordle {
    padding: 0 8px;
  }

  .wn-game-container {
    padding: 16px 6px;
  }

  .wn-wordle-category-hint {
    font-size: 1.1rem;
    margin-bottom: 8px;
  }

  .wn-cell {
    width: clamp(38px, 12vw, 54px);
    height: clamp(38px, 12vw, 54px);
    font-size: clamp(1.2rem, 4vw, 1.65rem);
    border-radius: 5px;
  }

  .wn-wordle-board {
    gap: 4px;
    margin-bottom: 14px;
  }

  .wn-key {
    padding: 0 1px;
    font-size: clamp(0.6rem, 2.5vw, 0.72rem);
    min-width: 20px;
    height: 40px;
    border-width: 1px;
  }

  .wn-wordle-h1 {
    font-size: 1.45rem;
  }

  .wn-howto-steps {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .wn-howto-step {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 16px;
    align-items: center;
    text-align: left;
    padding: 14px 18px;
  }

  .wn-howto-step .step-emoji {
    grid-row: 1 / -1;
    grid-column: 1;
    font-size: 2.2rem;
    margin-bottom: 0;
  }

  .wn-howto-step strong {
    grid-row: 1;
    grid-column: 2;
    align-self: end;
    margin-bottom: 2px;
  }

  .wn-howto-step span {
    grid-row: 2;
    grid-column: 2;
    align-self: start;
  }
}