/**
 * Words-Snoopy — Snoopy & Woodstock Pastel Comic Stylesheet
 */

:root {
  /* Snoopy Comic Palette extracted from fondo.jpeg */
  --bg-cream: #fffdf7;
  --bg-panel: rgba(255, 253, 247, 0.84);
  --bg-panel-strong: rgba(255, 252, 242, 0.94);
  --bg-card: #fef9ec;

  --ink-dark: #3b2818;
  --ink-medium: #5c4028;
  --ink-muted: #7c624c;
  --border-comic: #cbb89d;
  --border-ink: #4a3525;

  /* Pastel & Vibrant Accents */
  --sky-light: #e0f2fe;
  --sky-pastel: #7dd3fc;
  --sky-strong: #0284c7;
  --sky-deep: #0c4a6e;

  --yellow-light: #fef9c3;
  --yellow-woodstock: #facc15;
  --yellow-border: #ca8a04;

  --red-pastel: #fecdd3;
  --red-coral: #ef4444;
  --red-border: #b91c1c;

  --green-meadow: #22c55e;
  --green-border: #15803d;

  --absent-stone: #8c7b6c;
  --absent-border: #6e5d4f;
}

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

html,
body {
  min-height: 100dvh;
  position: relative;
  background-color: #d8effa;
  background-image:
    linear-gradient(180deg, rgba(255, 253, 247, 0.12) 0%, rgba(254, 249, 236, 0.22) 100%),
    url("./fondo.jpeg");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--ink-dark);
  font-family: "Trebuchet MS", "Avenir Next", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  transition: background-image 0.5s ease-in-out;
}

/* Pseudo-element for smooth cross-fade transition to fondo2.jpeg in Extreme mode */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: #e5f0ea;
  background-image:
    linear-gradient(180deg, rgba(255, 253, 247, 0.14) 0%, rgba(254, 249, 236, 0.24) 100%),
    url("/fuentes/fondo2.jpeg");
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  opacity: 0;
  transition: opacity 0.5s ease-in-out;
  pointer-events: none;
}

body.variant-extreme::before {
  opacity: 1;
}

body.variant-extreme {
  background-image:
    linear-gradient(180deg, rgba(255, 253, 247, 0.14) 0%, rgba(254, 249, 236, 0.24) 100%),
    url("/fuentes/fondo2.jpeg");
}

.hidden {
  display: none !important;
}

/* Top Header */
.top-header {
  border-bottom: 2px solid rgba(74, 53, 37, 0.22);
  background: rgba(255, 253, 247, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: 0 4px 16px rgba(59, 40, 24, 0.08);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 0.75rem;
  padding: 0.2rem 0.45rem;
  margin: -0.2rem -0.45rem;
  transition: transform 0.12s ease, opacity 0.15s ease, background-color 0.15s ease;
  touch-action: manipulation;
}

.brand-group:hover {
  background-color: rgba(254, 240, 138, 0.35);
  transform: translateY(-1px);
}

.brand-group:active {
  transform: translateY(1.5px);
  background-color: rgba(254, 240, 138, 0.5);
}

.brand-group:focus-visible {
  outline: 2.5px solid var(--sky-strong);
  outline-offset: 2px;
}

.brand-icon {
  font-size: 1.75rem;
  background: var(--yellow-woodstock);
  border: 2px solid var(--border-ink);
  border-radius: 0.7rem;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 var(--border-ink);
}

.brand-title {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--ink-dark);
  line-height: 1.1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.brand-subtitle {
  font-size: 0.74rem;
  color: var(--sky-strong);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Variant Switcher (Classic vs Extreme) */
.variant-switcher {
  display: flex;
  background: #f5ebe0;
  border: 2px solid var(--border-ink);
  border-radius: 999px;
  padding: 0.2rem;
  gap: 0.25rem;
  box-shadow: 0 3px 0 rgba(74, 53, 37, 0.2);
}

.variant-tab {
  background: transparent;
  border: none;
  color: var(--ink-medium);
  font-size: 0.84rem;
  font-weight: 800;
  padding: 0.4rem 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.variant-tab:hover {
  color: var(--ink-dark);
  background: rgba(255, 255, 255, 0.55);
}

.variant-tab.active {
  background: var(--yellow-woodstock);
  color: var(--ink-dark);
  border: 1.5px solid var(--border-ink);
  box-shadow: 0 2px 0 var(--border-ink);
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.tool-btn {
  background: var(--bg-cream);
  border: 2px solid var(--border-ink);
  color: var(--ink-dark);
  font-size: 0.86rem;
  font-weight: 800;
  padding: 0.4rem 0.7rem;
  border-radius: 0.65rem;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--border-ink);
  transition: transform 0.1s ease, background-color 0.15s ease;
}

.tool-btn:hover {
  background: var(--yellow-light);
}

.tool-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--border-ink);
}

/* Sub-header Controls Bar */
.controls-bar {
  border-bottom: 1.5px solid rgba(74, 53, 37, 0.16);
  background: rgba(254, 249, 236, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.controls-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.mode-pills {
  display: flex;
  gap: 0.4rem;
}

.mode-pill {
  background: var(--bg-cream);
  border: 2px solid var(--border-comic);
  color: var(--ink-medium);
  font-size: 0.8rem;
  font-weight: 800;
  padding: 0.36rem 0.82rem;
  border-radius: 0.6rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-pill:hover {
  border-color: var(--border-ink);
  color: var(--ink-dark);
}

.mode-pill.active {
  background: var(--sky-pastel);
  border-color: var(--border-ink);
  color: var(--ink-dark);
  box-shadow: 0 2px 0 var(--border-ink);
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.action-chip {
  background: var(--bg-cream);
  border: 2px solid var(--border-ink);
  color: var(--ink-dark);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.35rem 0.72rem;
  border-radius: 0.6rem;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(74, 53, 37, 0.85);
  transition: all 0.15s ease;
}

.action-chip:hover {
  background: var(--yellow-light);
}

.action-chip:active {
  transform: translateY(1px);
}

.action-chip.active-blue {
  background: var(--sky-pastel);
  border-color: var(--sky-deep);
  color: var(--sky-deep);
}

/* Main Game Area */
.game-main {
  max-width: 620px;
  margin: 0 auto;
  padding: 0.85rem 0.75rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

/* Extreme Mode Legend */
.extreme-legend {
  width: 100%;
  max-width: 530px;
  background: var(--bg-panel-strong);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2px solid var(--border-ink);
  border-radius: 0.9rem;
  padding: 0.65rem 0.9rem;
  text-align: center;
  box-shadow: 0 6px 18px rgba(59, 40, 24, 0.12);
}

.legend-badges {
  display: flex;
  justify-content: center;
  gap: 1.1rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-dark);
  margin-bottom: 0.3rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.dot {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  display: inline-block;
  border: 1.5px solid var(--border-ink);
}

.dot-green {
  background: var(--green-meadow);
}
.dot-amber {
  background: var(--yellow-woodstock);
}
.dot-red {
  background: var(--red-coral);
}

.extreme-tip {
  font-size: 0.76rem;
  color: var(--ink-medium);
  font-weight: 600;
  line-height: 1.35;
}

/* Semi-Transparent Overlay Panel around Board Grid */
.board-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  perspective: 1000px;
  background: var(--bg-panel);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2.5px solid var(--border-ink);
  border-radius: 1.15rem;
  padding: 0.9rem;
  box-shadow:
    0 8px 0 rgba(74, 53, 37, 0.18),
    0 14px 32px rgba(59, 40, 24, 0.16);
  transition: max-width 0.35s ease, padding 0.35s ease, background-color 0.35s ease;
}

.board-classic {
  max-width: 375px;
}

.board-extreme {
  max-width: 530px;
}

body.variant-extreme .board-container {
  background: rgba(255, 253, 247, 0.91);
  box-shadow:
    0 8px 0 rgba(74, 53, 37, 0.22),
    0 16px 36px rgba(59, 40, 24, 0.18);
}

body.variant-extreme .keyboard-container {
  background: rgba(255, 253, 247, 0.91);
  box-shadow:
    0 6px 0 rgba(74, 53, 37, 0.22),
    0 14px 30px rgba(59, 40, 24, 0.18);
}

.board-row-wrapper {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}

.letters-row {
  flex: 5;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.42rem;
}

.clues-row {
  flex: 3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.38rem;
}

.letter-cell,
.clue-cell {
  aspect-ratio: 1 / 1;
  border-radius: 0.65rem;
  border: 2px solid var(--border-comic);
  background: rgba(255, 255, 255, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1.25rem, 4.5vw, 1.72rem);
  font-weight: 900;
  color: var(--ink-dark);
  text-transform: uppercase;
  box-shadow: 0 2px 0 rgba(74, 53, 37, 0.15);
  transition: border-color 0.15s ease, transform 0.12s ease, background-color 0.2s ease;
  cursor: pointer;
  position: relative;
}

.clue-cell {
  cursor: default;
  background: rgba(254, 249, 236, 0.9);
  border: 2px dashed var(--border-comic);
  font-size: clamp(1.05rem, 4vw, 1.45rem);
  color: var(--ink-medium);
}

.letter-cell.has-letter {
  border-color: var(--border-ink);
  background: #ffffff;
}

.letter-cell.active-cursor {
  border-color: var(--sky-strong);
  background: var(--sky-light);
  box-shadow: 0 0 0 3.5px rgba(56, 189, 248, 0.45);
}

/* Cell Evaluation States (High Contrast Comic Style) */
.letter-cell.state-correct {
  background-color: var(--green-meadow);
  border-color: var(--green-border);
  color: #ffffff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
  box-shadow: 0 3px 0 var(--green-border);
}

.letter-cell.state-wrong-position {
  background-color: var(--yellow-woodstock);
  border-color: var(--yellow-border);
  color: var(--ink-dark);
  box-shadow: 0 3px 0 var(--yellow-border);
}

.letter-cell.state-absent {
  background-color: var(--absent-stone);
  border-color: var(--absent-border);
  color: #ffffff;
  box-shadow: 0 3px 0 var(--absent-border);
}

.letter-cell.state-blue {
  background-color: var(--sky-pastel);
  border-color: var(--sky-strong);
  color: var(--sky-deep);
  box-shadow: 0 3px 0 var(--sky-strong);
}

.letter-cell.state-extreme-neutral {
  background-color: var(--bg-card);
  border-color: var(--border-ink);
  color: var(--ink-dark);
  box-shadow: 0 3px 0 rgba(74, 53, 37, 0.35);
}

/* Extreme Mode Clue Counters */
.clue-cell.clue-correct {
  background: #dcfce7;
  border: 2px solid var(--green-border);
  color: #166534;
  box-shadow: 0 2px 0 var(--green-border);
}

.clue-cell.clue-wrong-position {
  background: var(--yellow-light);
  border: 2px solid var(--yellow-border);
  color: #854d0e;
  box-shadow: 0 2px 0 var(--yellow-border);
}

.clue-cell.clue-absent {
  background: var(--red-pastel);
  border: 2px solid var(--red-border);
  color: #991b1b;
  box-shadow: 0 2px 0 var(--red-border);
}

/* Detective Notepad Diagonal Stripes in Extreme Mode */
.letter-cell.note-green {
  background-image: repeating-linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.38) 0px,
    rgba(34, 197, 94, 0.38) 9px,
    rgba(255, 253, 247, 0.95) 9px,
    rgba(255, 253, 247, 0.95) 18px
  ) !important;
  border-color: var(--green-border) !important;
  color: var(--ink-dark) !important;
}

.letter-cell.note-amber {
  background-image: repeating-linear-gradient(
    135deg,
    rgba(250, 204, 21, 0.55) 0px,
    rgba(250, 204, 21, 0.55) 9px,
    rgba(255, 253, 247, 0.95) 9px,
    rgba(255, 253, 247, 0.95) 18px
  ) !important;
  border-color: var(--yellow-border) !important;
  color: var(--ink-dark) !important;
}

.letter-cell.note-red {
  background-image: repeating-linear-gradient(
    135deg,
    rgba(248, 113, 113, 0.42) 0px,
    rgba(248, 113, 113, 0.42) 9px,
    rgba(255, 253, 247, 0.95) 9px,
    rgba(255, 253, 247, 0.95) 18px
  ) !important;
  border-color: var(--red-border) !important;
  color: var(--ink-dark) !important;
}

/* Animations */
@keyframes popIn {
  0% {
    transform: scale(0.86);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

.pop-in {
  animation: popIn 0.14s ease-out;
}

@keyframes flipTile {
  0% {
    transform: rotateX(0deg);
  }
  50% {
    transform: rotateX(90deg);
  }
  100% {
    transform: rotateX(0deg);
  }
}

.flipping-cell {
  animation: flipTile 0.48s ease-in-out forwards;
}

.flip-reveal {
  animation: flipTile 0.55s ease-in-out;
}

@keyframes shakeRow {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-7px);
  }
  40%,
  80% {
    transform: translateX(7px);
  }
}

.row-shake {
  animation: shakeRow 0.42s ease-in-out;
}

/* Semi-Transparent Overlay Panel around Virtual Keyboard */
.keyboard-container {
  width: 100%;
  max-width: 540px;
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  background: var(--bg-panel);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 2.5px solid var(--border-ink);
  border-radius: 1.1rem;
  padding: 0.75rem 0.65rem;
  box-shadow:
    0 6px 0 rgba(74, 53, 37, 0.18),
    0 12px 28px rgba(59, 40, 24, 0.15);
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 0.34rem;
  width: 100%;
}

.key-btn {
  flex: 1;
  min-width: 0;
  height: 3.1rem;
  border-radius: 0.55rem;
  border: 2px solid var(--border-ink);
  background: #ffffff;
  color: var(--ink-dark);
  font-size: 0.96rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 rgba(74, 53, 37, 0.8);
  transition: background-color 0.15s ease, transform 0.08s ease, box-shadow 0.08s ease;
  touch-action: manipulation;
}

.key-btn:hover {
  background: var(--yellow-light);
}

.key-btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 rgba(74, 53, 37, 0.8);
}

.key-wide {
  flex: 1.55;
  font-size: 0.78rem;
  padding: 0 0.4rem;
}

.key-enter {
  background: var(--sky-pastel);
  color: var(--ink-dark);
}

.key-enter:hover {
  background: #38bdf8;
}

.key-backspace {
  background: var(--red-pastel);
  color: #881337;
}

.key-backspace:hover {
  background: #fda4af;
}

.key-btn.key-correct {
  background: var(--green-meadow);
  border-color: var(--green-border);
  color: #ffffff;
  box-shadow: 0 3px 0 var(--green-border);
}

.key-btn.key-wrong-position {
  background: var(--yellow-woodstock);
  border-color: var(--yellow-border);
  color: var(--ink-dark);
  box-shadow: 0 3px 0 var(--yellow-border);
}

.key-btn.key-absent {
  background: #d6ccc2;
  border-color: #9c8978;
  color: #6e5d4f;
  box-shadow: 0 2px 0 #9c8978;
  opacity: 0.82;
}

.key-btn.key-blue {
  background: var(--sky-pastel);
  border-color: var(--sky-strong);
  color: var(--sky-deep);
  box-shadow: 0 3px 0 var(--sky-strong);
}

/* Outcome Banner */
.outcome-banner {
  width: 100%;
  max-width: 530px;
}

.outcome-card {
  position: relative;
  border-radius: 1.1rem;
  padding: 1.2rem 1.35rem;
  border: 2.5px solid var(--border-ink);
  background: var(--bg-panel-strong);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  text-align: center;
  box-shadow:
    0 6px 0 rgba(74, 53, 37, 0.2),
    0 14px 30px rgba(59, 40, 24, 0.2);
}

.outcome-close-btn {
  position: absolute;
  top: 0.7rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border-radius: 0.55rem;
  border: 2px solid var(--border-ink);
  background: var(--red-pastel);
  color: var(--ink-dark);
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 0 var(--border-ink);
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.1s ease;
}

.outcome-close-btn:hover {
  background: #fda4af;
}

.outcome-close-btn:active {
  transform: translateY(1.5px);
  box-shadow: 0 1px 0 var(--border-ink);
}

/* Full-Screen Defeat (Game Over) Modal */
.defeat-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: defeatFadeIn 0.25s ease-out;
}

.defeat-box {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  background: #fffdf7; /* solid light backdrop so multiply blending dissolves the video's white background */
  border: 3px solid var(--border-ink);
  border-radius: 1.25rem;
  padding: 1.4rem 1.35rem 1.25rem;
  text-align: center;
  box-shadow:
    0 8px 0 rgba(74, 53, 37, 0.35),
    0 24px 60px rgba(0, 0, 0, 0.45);
  animation: defeatPopIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.defeat-box .outcome-close-btn {
  z-index: 2;
}

.defeat-video-wrap {
  display: flex;
  justify-content: center;
  margin: 0.25rem auto 0.6rem;
}

.defeat-video {
  display: block;
  width: 100%;
  max-width: 260px;
  max-height: 34dvh;
  height: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
  pointer-events: none;
}

body.no-scroll {
  overflow: hidden;
}

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

@keyframes defeatPopIn {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(12px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ==========================================================================
   Main Menu (Welcome Screen) & OK Confirmation Popups
   ========================================================================== */

.start-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  animation: defeatFadeIn 0.25s ease-out;
}

.start-menu-overlay.hidden {
  display: none !important;
}

.start-menu-card {
  position: relative;
  width: 100%;
  max-width: 490px;
  background: #fffdf7;
  border: 3.5px solid var(--border-ink);
  border-radius: 1.4rem;
  padding: 1.8rem 1.6rem 1.6rem;
  box-shadow:
    0 10px 0 rgba(74, 53, 37, 0.35),
    0 24px 60px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  text-align: left;
  animation: defeatPopIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.start-menu-title {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--ink-dark);
  margin-top: 0;
  margin-bottom: 0.85rem;
  line-height: 1.25;
}

.start-menu-desc {
  font-size: 0.95rem;
  color: #4a3525;
  line-height: 1.55;
  margin-top: 0;
  margin-bottom: 1.5rem;
  max-width: 76%;
  position: relative;
  z-index: 2;
}

.start-menu-desc strong {
  color: var(--ink-dark);
}

.start-menu-actions {
  display: flex;
  align-items: center;
  position: relative;
  z-index: 2;
  margin-top: 0.5rem;
}

.btn-start-game {
  background: var(--yellow-woodstock);
  color: #451a03;
  border: 3px solid var(--border-ink);
  border-radius: 0.85rem;
  padding: 0.75rem 1.7rem;
  font-size: 1.12rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 var(--border-ink);
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  touch-action: manipulation;
}

.btn-start-game:hover {
  background: #facc15;
  transform: translateY(-1.5px);
  box-shadow: 0 5.5px 0 var(--border-ink);
}

.btn-start-game:active {
  transform: translateY(2.5px);
  box-shadow: 0 1.5px 0 var(--border-ink);
}

.start-menu-snoopy-img {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 155px;
  height: 155px;
  object-fit: contain;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 1;
}

/* OK Confirmation Popup Overlay */
.ok-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: defeatFadeIn 0.2s ease-out;
}

.ok-popup-overlay.hidden {
  display: none !important;
}

.ok-popup-card {
  position: relative;
  background: #fffdf7;
  border: 3.5px solid var(--border-ink);
  border-radius: 1.5rem;
  padding: 1.1rem 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 10px 0 rgba(74, 53, 37, 0.4),
    0 24px 50px rgba(0, 0, 0, 0.45);
  animation: okPopIn 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.snoopy-ok-img {
  display: block;
  max-width: 220px;
  max-height: 220px;
  width: auto;
  height: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
  pointer-events: none;
}

@keyframes okPopIn {
  from {
    opacity: 0;
    transform: scale(0.65) rotate(-3deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}


.outcome-won {
  border-color: var(--green-border);
  background: linear-gradient(180deg, rgba(220, 252, 231, 0.95) 0%, rgba(255, 253, 247, 0.96) 100%);
}

.outcome-lost {
  border-color: var(--red-border);
  background: linear-gradient(180deg, rgba(254, 205, 211, 0.94) 0%, rgba(255, 253, 247, 0.96) 100%);
}

.outcome-title {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--ink-dark);
  margin-bottom: 0.4rem;
}

.outcome-word-line {
  font-size: 0.96rem;
  color: var(--ink-medium);
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.secret-word-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: 0.45rem;
  background: var(--yellow-woodstock);
  border: 2px solid var(--border-ink);
  color: var(--ink-dark);
  font-weight: 900;
  text-decoration: none;
  letter-spacing: 0.06em;
  box-shadow: 0 2px 0 var(--border-ink);
}

.secret-word-badge:hover {
  background: #fde047;
}

.outcome-score-box {
  background: rgba(255, 255, 255, 0.88);
  border: 2px solid var(--border-ink);
  border-radius: 0.75rem;
  padding: 0.65rem 0.9rem;
  margin-bottom: 0.9rem;
}

.score-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.3rem;
}

.score-label {
  font-size: 0.84rem;
  color: var(--ink-medium);
  font-weight: 800;
}

.score-value {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--green-border);
}

.score-breakdown {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-weight: 700;
}

.outcome-actions {
  display: flex;
  justify-content: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn-primary,
.btn-secondary,
.btn-danger {
  border: 2px solid var(--border-ink);
  border-radius: 0.65rem;
  padding: 0.55rem 1.05rem;
  font-size: 0.88rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--border-ink);
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--yellow-woodstock);
  color: var(--ink-dark);
}

.btn-primary:hover {
  background: #fde047;
}

.btn-secondary {
  background: var(--sky-pastel);
  color: var(--ink-dark);
}

.btn-secondary:hover {
  background: #bae6fd;
}

.btn-danger {
  background: var(--red-coral);
  color: #ffffff;
}

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--border-ink);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(59, 40, 24, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 60;
}

.modal-card {
  width: 100%;
  max-width: 490px;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--bg-cream);
  border: 3px solid var(--border-ink);
  border-radius: 1.2rem;
  padding: 1.3rem;
  color: var(--ink-dark);
  box-shadow:
    0 8px 0 rgba(74, 53, 37, 0.35),
    0 20px 50px rgba(59, 40, 24, 0.35);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px dashed var(--border-comic);
}

.modal-header h3 {
  font-size: 1.18rem;
  font-weight: 900;
  color: var(--ink-dark);
}

.modal-close-btn {
  background: var(--red-pastel);
  border: 2px solid var(--border-ink);
  color: var(--ink-dark);
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.55rem;
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 2px 0 var(--border-ink);
}

.modal-close-btn:hover {
  background: #fda4af;
}

/* Stats Modal */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}

.stat-card {
  background: var(--bg-card);
  border: 2px solid var(--border-ink);
  border-radius: 0.8rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  box-shadow: 0 3px 0 rgba(74, 53, 37, 0.15);
}

.stat-card.highlight-fire {
  background: var(--yellow-light);
  border-color: var(--yellow-border);
}

.stat-card.stat-wide {
  grid-column: span 2;
  background: var(--sky-light);
}

.stat-val {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--ink-dark);
}

.stat-lbl {
  font-size: 0.76rem;
  color: var(--ink-medium);
  font-weight: 800;
}

.history-section h4 {
  font-size: 0.86rem;
  color: var(--ink-medium);
  font-weight: 800;
  margin-bottom: 0.6rem;
  text-align: center;
}

.days-strip {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
}

.day-pill {
  flex: 1;
  background: #ffffff;
  border: 2px solid var(--border-ink);
  border-radius: 0.65rem;
  padding: 0.45rem 0.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.day-letter {
  font-size: 0.74rem;
  color: var(--ink-medium);
  font-weight: 800;
}

.day-badge {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.86rem;
}

.day-win .day-badge {
  background: #dcfce7;
  border: 2px solid var(--green-border);
  color: #166534;
}

.day-loss .day-badge {
  background: var(--red-pastel);
  border: 2px solid var(--red-border);
  color: #991b1b;
}

.day-missed .day-badge {
  background: #f5ebe0;
  border: 1.5px dashed var(--border-comic);
  color: var(--ink-muted);
}

/* How-To Modal */
.howto-objective {
  font-size: 0.94rem;
  color: var(--ink-dark);
  font-weight: 700;
  margin-bottom: 0.85rem;
  line-height: 1.45;
}

.howto-steps {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
  color: var(--ink-medium);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.howto-subtitle {
  font-size: 0.94rem;
  font-weight: 900;
  margin-bottom: 0.6rem;
  color: var(--ink-dark);
}

.color-guide-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.color-guide-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.85rem;
  color: var(--ink-medium);
  font-weight: 600;
}

.color-swatch {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 0.45rem;
  flex-shrink: 0;
  border: 2px solid var(--border-ink);
}

.swatch-correct {
  background: var(--green-meadow);
  border-color: var(--green-border);
}
.swatch-wrong-position {
  background: var(--yellow-woodstock);
  border-color: var(--yellow-border);
}
.swatch-absent {
  background: var(--absent-stone);
  border-color: var(--absent-border);
}
.swatch-absent-red {
  background: var(--red-coral);
  border-color: var(--red-border);
}
.swatch-blue {
  background: var(--sky-pastel);
  border-color: var(--sky-strong);
}

/* Challenge Modal */
.challenge-sections {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.challenge-box h4 {
  font-size: 0.96rem;
  font-weight: 900;
  margin-bottom: 0.45rem;
  color: var(--sky-deep);
}

.field-label {
  display: block;
  font-size: 0.84rem;
  color: var(--ink-medium);
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.input-row {
  display: flex;
  gap: 0.5rem;
}

.text-input {
  flex: 1;
  background: #ffffff;
  border: 2px solid var(--border-ink);
  border-radius: 0.6rem;
  padding: 0.5rem 0.75rem;
  color: var(--ink-dark);
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
}

.readonly-input {
  text-transform: none;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--sky-light);
  color: var(--sky-deep);
}

.generated-output {
  margin-top: 0.75rem;
  padding: 0.75rem;
  border-radius: 0.7rem;
  background: var(--bg-card);
  border: 2px solid var(--border-ink);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.86rem;
  font-weight: 700;
}

.code-pill {
  background: var(--yellow-woodstock);
  border: 2px solid var(--border-ink);
  color: var(--ink-dark);
  padding: 0.15rem 0.55rem;
  border-radius: 0.4rem;
  letter-spacing: 0.08em;
  font-weight: 900;
}

.modal-divider {
  border: none;
  border-top: 2px dashed var(--border-comic);
}

.modal-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 4.4rem;
  right: 1rem;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  pointer-events: none;
}

.toast-item {
  padding: 0.65rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.86rem;
  font-weight: 900;
  color: var(--ink-dark);
  border: 2.5px solid var(--border-ink);
  box-shadow:
    0 4px 0 rgba(74, 53, 37, 0.35),
    0 10px 25px rgba(59, 40, 24, 0.25);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.toast-error {
  background: var(--red-pastel);
  color: #7f1d1d;
}

.toast-success {
  background: #dcfce7;
  color: #14532d;
}

.toast-info {
  background: var(--yellow-light);
  color: var(--ink-dark);
}

.toast-fade-out {
  opacity: 0;
  transform: translateY(-8px);
}

/* Confetti & Celebration */
.celebration-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 55;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-10vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(105vh) rotate(540deg);
    opacity: 0;
  }
}

.confetti-piece {
  position: absolute;
  top: -20px;
  width: 11px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(74, 53, 37, 0.35);
  animation: confettiFall 2.9s linear forwards;
}

.loss-drop {
  position: absolute;
  top: -30px;
  font-size: 1.4rem;
  animation: confettiFall 2.6s ease-in forwards;
}

@media (max-width: 520px) {
  .header-inner {
    padding: 0.5rem 0.65rem;
  }
  .brand-title {
    font-size: 1.08rem;
  }
  .board-container {
    padding: 0.65rem;
  }
  .board-extreme {
    max-width: 100%;
    padding: 0.55rem 0.4rem;
    gap: 0.32rem;
  }
  .board-extreme .board-row-wrapper {
    gap: 0.35rem;
  }
  .board-extreme .letters-row {
    gap: 0.25rem;
  }
  .board-extreme .clues-row {
    gap: 0.22rem;
  }
  .board-extreme .letter-cell,
  .board-extreme .clue-cell {
    border-radius: 0.45rem;
    font-size: clamp(0.95rem, 3.6vw, 1.35rem);
  }
  .keyboard-container {
    padding: 0.55rem 0.45rem;
  }
  .key-btn {
    height: 2.85rem;
    font-size: 0.85rem;
  }
  .start-menu-card {
    padding: 1.4rem 1.15rem 1.25rem;
  }
  .start-menu-title {
    font-size: 1.22rem;
  }
  .start-menu-desc {
    font-size: 0.88rem;
    max-width: 72%;
  }
  .btn-start-game {
    font-size: 1rem;
    padding: 0.65rem 1.3rem;
  }
  .start-menu-snoopy-img {
    width: 120px;
    height: 120px;
  }
  .snoopy-ok-img {
    max-width: 175px;
    max-height: 175px;
  }
}
