/* styles.css - Zaggle (Dark Mode) */
:root {
  --fixed-height: 72px;
  --primary: #e3443f;
  --primary-hover: #d13a35;
  --primary-light: #eb6b66;
  --primary-dark: #c4332e;
  --background: #0a0a0a;
  --background-center: #1a1a1a;
  --surface: #1e1e1e;
  --surface-light: #2a2a2a;
  --darker-surface: #0f0f0f;
  --correct: #da5950;
  --text-primary: #FFFFFF;
  --text-secondary: #888888;
  --disabled: #555555;
  /* Grid size considers both width and height to fit viewport */
  --grid-size: min(85vw, 38vh, 360px);
  --cell-size: calc(var(--grid-size) / 4);
  --path-color: #000;
  /* Responsive card padding */
  --card-padding-sm: clamp(12px, 3vw, 16px);
  --card-padding-lg: clamp(20px, 4vw, 36px);
}

*, *::before, *::after {
  box-sizing: border-box;
}

.fullscreen-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  display: flex;
  flex-direction: column;
  z-index: 9999;
  margin: 0;
  padding: 0;
}

.modal-content-container {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  color: #FFFFFF;
}

.landing-title {
  font-size: 3em;
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
}

.landing-logo {
  max-width: 280px;
  width: 80%;
  height: auto;
}

.header-logo {
  height: 120px;
  width: auto;
}

.landing-subheader {
  font-size: 1.5em;
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  font-weight: normal;
}

.landing-small-text-bold {
  font-size: 1.25em;
  font-weight: bold;
  margin: 12px 0 0 0;
  height: 32px;
}

.landing-small-text {
  font-size: 1.25em;
  font-weight: normal;
  margin: 0;
  padding: 0;
  height: 32px;
}

/* Landing loading state */
.landing-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.25em;
  color: var(--text-primary);
  min-height: 170px;
}

.grid-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  background-color: var(--primary);
  animation: grid-pulse 0.5s ease-in-out infinite alternate;
  border-radius: 4px;
}

@keyframes grid-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.1); opacity: 1; }
}

#landing-modal {
  display: flex;
}

/* Hide game UI until modal is dismissed */
.header,
.date-nav-row,
.game-content {
  visibility: hidden;
}

body.game-ready .header,
body.game-ready .date-nav-row,
body.game-ready .game-content {
  visibility: visible;
}

html.skip-landing #landing-modal {
  display: none;
}

html.skip-landing .header,
html.skip-landing .date-nav-row,
html.skip-landing .game-content {
  visibility: visible;
}

html {
  height: 100%;
}

body {
  font-family: 'Montserrat', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  margin: 0;
  padding: 0;
  background: linear-gradient(
    135deg,
    #1a1a1a 0%,
    #141414 50%,
    #0f0f0f 100%
  );
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  height: calc(var(--vh, 1vh) * 100);
  overflow: hidden;
}

/* Header styles */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(8px, 1.5vh, 15px) 10px;
  background-color: transparent;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  position: relative;
}

.header-spacer {
  display: flex;
  gap: 8px;
  width: calc(3 * 2.5rem + 2 * 8px);
}

.header-buttons {
  display: flex;
  gap: 8px;
}

.header-buttons button {
  background-color: var(--primary);
  color: white;
  border: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

.header-buttons button:hover {
  background-color: var(--primary-hover);
}

.header-button {
  background-color: var(--primary);
  color: white;
  border: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

.header-button:hover {
  background-color: var(--primary-hover);
}

@media (max-width: 480px) {
  .header-spacer {
    display: none !important;
    width: 0 !important;
  }

  .title {
    flex-grow: 0 !important;
    justify-content: flex-start !important;
    font-size: 1.5em;
  }
}

@media (max-width: 400px) {
  .header {
    padding: 15px 8px;
  }

  .header-buttons {
    gap: 6px;
  }

  .header-buttons button {
    width: 2rem;
    height: 2rem;
    font-size: 12px;
  }

  .header-button-icon {
    width: 14px;
    height: 14px;
  }

  .title {
    font-size: 1.3em;
  }
}

/* Date Navigation Row */
.date-nav-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  padding: clamp(2px, 0.5vh, 4px) 20px;
  background-color: transparent;
  flex-shrink: 0;
}

.date-nav-button {
  background: transparent;
  border: none;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.date-nav-button.hidden {
  visibility: hidden;
}

.date-nav-icon {
  width: 100%;
  height: 100%;
  opacity: 0.6;
  transition: opacity 0.15s;
  filter: brightness(0) invert(1);
}

.date-nav-button:hover .date-nav-icon {
  opacity: 0.4;
}

.date-nav-button:active .date-nav-icon {
  opacity: 0.3;
}

.date-nav-button:disabled .date-nav-icon {
  opacity: 0.2;
}

.date-nav-date {
  font-size: clamp(0.7rem, 3vw, 1rem);
  color: var(--text-primary);
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

/* Title styles */
.title {
  margin: 0;
  font-size: 1.8em;
  color: var(--text-primary);
  text-align: center;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.title:hover {
  opacity: 0.8;
}

.title img.header-logo {
  height: clamp(40px, 8vh, 72px);
  width: auto;
  margin-right: 0;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .title {
    position: static;
    transform: none;
    flex-grow: 1;
  }
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 2vh, 16px);
  width: 100%;
  max-width: 600px;
  padding: 5px 10px clamp(8px, 2vh, 16px) 10px;
  box-sizing: border-box;
  text-align: center;
  flex: 1;
  min-height: 0;
}

/* Game Cards - shared styles */
.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: calc(var(--grid-size) + 20px);
  padding: var(--card-padding-sm);
  background: linear-gradient(
    135deg,
    rgba(45, 45, 45, 0.95) 0%,
    rgba(28, 28, 28, 0.95) 50%,
    rgba(18, 18, 18, 0.95) 100%
  );
  border-radius: 12px;
  box-shadow:
    6px 12px 40px rgba(0, 0, 0, 0.7),
    3px 6px 16px rgba(0, 0, 0, 0.5),
    inset 1px 1px 0 rgba(255, 255, 255, 0.08),
    inset -1px -1px 0 rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
}

/* Card 1: Clue card (timer + clue) */
.game-card-clue {
  gap: clamp(4px, 1vh, 8px);
}

.clue-header-row {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
}

.game-card-clue .timer-display {
  margin-bottom: 0;
}

.game-card-clue .clue-display {
  margin-bottom: 0;
  min-height: auto;
}

/* Hint Icon */
.hint-icon {
  width: 28px;
  height: 28px;
  position: absolute;
  right: 0;
  cursor: pointer;
  filter: brightness(0) invert(1);
  opacity: 0.7;
  transition: opacity 0.3s, transform 0.2s;
}

.hint-icon:hover {
  opacity: 1;
  transform: scale(1.1);
}

.hint-icon.disabled {
  opacity: 0.2;
  cursor: not-allowed;
  pointer-events: none;
}

.puzzle-completed .hint-icon {
  display: none;
}

.hint-penalty-text {
  color: var(--primary);
  font-style: italic;
  font-size: 0.9em;
  margin-top: 0;
}

/* Hint outline on grid cells */
.letter-cell.hinted {
  box-shadow: inset 0 0 0 2px #fff;
}

/* Card 2: Board card (main interaction - larger) */
.game-card-board {
  max-width: calc(var(--grid-size) + 110px);
  padding: var(--card-padding-lg);
  border-radius: 18px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.game-card-board .current-word-display {
  margin-top: clamp(8px, 2vh, 16px);
  max-width: calc(var(--grid-size) - 30px);
  flex-shrink: 0;
}

/* Completion panel: the board is empty by the time the puzzle ends, so this replaces it
   rather than sitting under it. The clue card already reads "Congratulations!" at this
   point, which is why the current-word readout goes too instead of saying "You won!". */
.board-complete {
  display: none;
  flex: 1;
  min-height: 0;
  width: 100%;
  flex-direction: column;
  align-items: center;
}

body.puzzle-completed .board-complete {
  display: flex;
}

body.puzzle-completed .grid-wrapper,
body.puzzle-completed .current-word-display {
  display: none;
}

.board-complete-byline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 6px 0;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85em;
  color: var(--text-secondary);
}

.board-complete-logo {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: contain;
}

.board-complete-title {
  margin: 0 0 clamp(12px, 3vh, 20px) 0;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 1.05em;
  color: var(--text-primary);
}

/* Wrap rather than a fixed column count, so adding an is_fpg game to game-promos.js just
   works: rows fill and centre themselves at any card count, and the list scrolls instead
   of overflowing the card once it outgrows the space. */
.next-games-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  /* `safe` keeps centring only while the cards fit; once they overflow it aligns to the
     top instead, because plain `center` pushes the first row out of reach of the scroll */
  align-content: center;
  align-content: safe center;
}

/* Sits against the bottom of the board card whatever the card count */
.board-complete .share-button {
  margin-top: clamp(12px, 3vh, 20px);
  flex-shrink: 0;
}

/* On mobile widths, make all cards the same width */
@media (max-width: 500px) {
  .game-card,
  .game-card-board {
    max-width: calc(var(--grid-size) + 40px);
  }

  .game-card-board {
    padding: var(--card-padding-sm);
    border-radius: 12px;
  }

  .game-card-board .current-word-display {
    max-width: 100%;
  }
}

/* Card 3: Progress card */
.game-card-progress {
  padding: var(--card-padding-sm);
}

.game-card-progress .progress-container {
  margin-top: 0;
}

.game-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  padding-top: clamp(5px, 1vh, 10px);
}

/* ===========================================
   ZAGGLE SPECIFIC STYLES - 4x4 GRID
   =========================================== */

/* Clue Display */
.clue-display {
  width: 100%;
  max-width: var(--grid-size);
  padding: clamp(4px, 1vh, 8px) 10px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.clue-text {
  font-size: clamp(0.9em, 2.5vw, 1.1em);
  font-family: 'Montserrat', sans-serif;
  line-height: 1.3;
  color: var(--text-primary);
}

.clue-text em {
  display: block;
  font-size: 0.85em;
  color: var(--text-secondary);
  margin-top: 4px;
}

.clue-number {
  font-size: 0.8em;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

/* Grid Container */
.grid-wrapper {
  position: relative;
  max-width: var(--grid-size);
  max-height: var(--grid-size);
  aspect-ratio: 1;
  flex: 1;
  min-height: 0;
  margin: -6px auto;
  overflow: visible;
  padding: 6px;
}

.letter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 0;
  position: relative;
  z-index: 1;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: visible;
}

/* SVG Path Canvas */
.path-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* Letter Cell */
.letter-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: url('images/tile.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  border-radius: 8px;
  font-size: calc(var(--cell-size) * 0.5);
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, opacity 0.3s ease;
  position: relative;
  text-transform: uppercase;
}

.letter-cell:hover:not(.selected):not(.empty) {
  filter: brightness(1.1);
  transform: scale(1.05);
}

.letter-cell.selected {
  filter: brightness(1.2);
  transform: scale(1.1);
  z-index: 10;
}

.letter-cell.empty {
  background-image: none;
  background-color: transparent;
  cursor: default;
  pointer-events: none;
}

.letter-cell.falling {
  animation: letterFall 0.3s ease-out forwards;
  transition: none;
  will-change: transform;
}

.letter-cell.new-letter {
  animation: letterAppear 0.3s ease-out forwards;
}

.letter-cell.matched {
  animation: letterMatched 0.4s ease-out forwards;
  transition: none;
  will-change: transform, opacity;
}

@keyframes letterFall {
  0% { transform: translateY(calc(-1 * var(--fall-distance))); }
  100% { transform: translateY(0); }
}

@keyframes letterAppear {
  0% {
    opacity: 0;
    transform: translateY(-50px) scale(0.5);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes letterMatched {
  0% {
    transform: scale(1);
    opacity: 1;
    filter: brightness(1.3);
  }
  50% {
    transform: scale(1.3);
    opacity: 1;
    filter: brightness(1.3);
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

/* Current Word Display */
.current-word-display {
  width: 100%;
  max-width: var(--grid-size);
  padding: clamp(4px, 1vh, 8px) 14px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.current-word-text {
  font-size: clamp(1.1em, calc(var(--grid-size) * 0.058), 1.8em);
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  white-space: nowrap;
}

.current-word-text.valid {
  color: var(--primary);
}

.current-word-text.empty {
  color: rgba(255, 255, 255, 0.2);
}

.current-word-text.flyout {
  animation: wordFlyout 0.3s ease-out forwards;
}

@keyframes wordFlyout {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(2.5);
    opacity: 0;
  }
}

/* Timer Display */
.timer-display {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
  line-height: 1;
  padding: 4px 0;
}

.timer-display.hidden {
  visibility: hidden;
}

.timer-digits {
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(0.9em, 2.5vw, 1.2em);
  color: var(--text-secondary);
  letter-spacing: 0.05em;
}

.timer-separator {
  font-family: 'Share Tech Mono', monospace;
  font-size: clamp(0.9em, 2.5vw, 1.2em);
  color: var(--text-secondary);
}

/* Progress Indicator */
.progress-container {
  width: 100%;
  max-width: var(--grid-size);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(
    to right,
    #b84039 0%,
    #da5950 50%,
    #e57a73 100%
  );
  border-radius: 5px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: clamp(0.75em, 2vw, 0.9em);
  color: var(--text-secondary);
  text-align: center;
}

/* Buttons */
.button {
  padding: 10px 20px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  background-color: var(--primary);
  color: var(--text-primary);
  transition: background-color 0.3s;
}

.button:disabled {
  background-color: var(--disabled);
  cursor: not-allowed;
}

.button:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

.secondary-button {
  background-color: transparent;
  border: 2px solid var(--primary);
  border-radius: 8px;
  color: var(--primary);
  cursor: pointer;
}

.secondary-button:hover:not(:disabled) {
  background-color: transparent !important;
  border: 2px solid var(--primary-hover);
  color: var(--primary-hover);
}

/* Share button */
.share-button {
  width: 100%;
  max-width: var(--grid-size);
  padding: 15px 20px;
  font-size: 1.25em;
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  text-align: center;
  border: none;
  border-radius: 12px;
  background-color: var(--primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.3s;
  margin-top: 15px;
}

.share-button:hover {
  background-color: var(--primary-hover);
}

/* Win Modal Button */
.win-modal-button {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  padding: 0.5rem;
  text-align: center;
  border: 3px solid var(--primary);
  border-radius: 8px;
  background-color: transparent;
  cursor: pointer;
  transition: background-color 0.3s;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.8rem;
  text-decoration: none;
  color: inherit;
}

.win-modal-button:hover {
  background-color: var(--primary-hover);
}

.win-modal-button img[src$=".svg"] {
  filter: invert(1);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
}

.modal.show {
  display: flex;
}

.modal.fade-in {
  animation: modal-fade-in 0.5s ease-out;
}

@keyframes modal-fade-in {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.modal-content {
  background-color: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin: auto;
  padding: 0;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
  position: relative;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

.modal-header {
  width: 100%;
  padding: 20px 20px 10px 20px;
  flex-shrink: 0;
  position: relative;
  text-align: center;
  z-index: 1;
}

.modal-header h2 {
  margin: 0;
}

.modal-header .close-button {
  position: absolute;
  top: 10px;
  right: 20px;
  z-index: 2;
}

.modal-body {
  width: 100%;
  padding: 10px 20px 20px 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  scrollbar-width: thin;
  scrollbar-color: var(--disabled) transparent;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-track {
  background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
  background-color: var(--disabled);
  border-radius: 3px;
}

h2 {
  font-family: 'Montserrat', sans-serif;
}

.modal-content h2 {
  color: var(--text-primary);
}

.modal-content p,
.modal-content pre {
  width: 100%;
  text-align: center;
}

.close-button {
  position: absolute;
  top: 10px;
  right: 20px;
  cursor: pointer;
  font-size: 32px;
  color: var(--text-primary);
}

.button-container {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
}

/* Stats Container */
.stats-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
}

.stat-header {
  flex: 1 1 72px;
  text-align: center;
  font-size: 1rem;
  font-family: 'Montserrat', sans-serif;
}

.stat {
  flex: 1 1 72px;
  text-align: center;
  font-size: 1.25rem;
  font-family: 'Montserrat', sans-serif;
}

.stat hr {
  border: none;
  border-top: 2px solid #ccc;
  max-width: 100px;
}

/* Distribution Chart */
.distribution-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.3em;
}

.distribution-label {
  width: 50px;
  text-align: right;
  margin-right: 0.5em;
  font-weight: bold;
  font-size: 0.9rem;
}

.distribution-bar-container {
  flex: 1;
  background-color: #eee;
  height: 20px;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
}

.distribution-bar {
  background-color: var(--primary);
  height: 100%;
  display: flex;
  align-items: center;
  transition: width 1s ease;
  border-radius: 4px 0 0 4px;
  white-space: nowrap;
}

.distribution-count {
  margin-left: 8px;
  color: #fff;
  font-weight: bold;
  font-size: 1rem;
}

/* Settings rows */
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-label {
  font-size: 1em;
  color: var(--text-primary);
}

.hide-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.6);
}

.hide-toggle input {
  display: none;
}

.toggle-slider {
  width: 36px;
  height: 20px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  position: relative;
  transition: background-color 0.2s;
}

.toggle-slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background-color: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}

.hide-toggle input:checked + .toggle-slider {
  background-color: var(--primary);
}

.hide-toggle input:checked + .toggle-slider::after {
  transform: translateX(16px);
}

/* Share text */
#share-text {
  text-align: center;
  white-space: pre-wrap;
  font-size: 18px;
  color: var(--text-primary);
  width: 100%;
}

#copy-button {
  margin-bottom: 20px;
}

/* Copy Notice */
.copy-notice {
  visibility: hidden;
  min-width: 160px;
  max-width: 300px;
  width: fit-content;
  background-color: var(--surface);
  color: var(--text-primary);
  text-align: center;
  border-radius: 4px;
  padding: 10px 20px;
  position: fixed;
  z-index: 1000;
  top: 30px;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  font-family: 'Montserrat', sans-serif;
  font-size: 1em;
}

.copy-notice.show {
  visibility: visible;
  opacity: 1;
}

/* Hamburger Menu Button */
.hamburger-button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 2.5rem;
  height: 2.5rem;
  background-color: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 5px;
  transition: background-color 0.2s;
}

.hamburger-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.landing-hamburger {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
}

.hamburger-icon {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

.header-button-icon {
  width: 20px;
  height: 20px;
  filter: brightness(0) invert(1);
}

/* Slide-out Menu Overlay */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.menu-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Slide-out Menu */
.slide-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  max-width: 80vw;
  height: 100%;
  background-color: var(--surface);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10001;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.slide-menu.open {
  transform: translateX(0);
}

.slide-menu-header {
  display: flex;
  justify-content: flex-end;
  padding: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.close-menu-button {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 28px;
  cursor: pointer;
  padding: 5px 10px;
  line-height: 1;
  border-radius: 5px;
  transition: background-color 0.2s;
}

.close-menu-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.slide-menu-nav {
  display: flex;
  flex-direction: column;
  padding: 15px;
  gap: 5px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 8px;
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  transition: background-color 0.2s;
}

.menu-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.menu-link-primary {
  font-weight: 600;
  font-size: 1.1rem;
}

.menu-divider {
  height: 1px;
  background-color: rgba(255, 255, 255, 0.15);
  margin: 10px 0;
}

.menu-section-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 15px 5px;
  margin: 0;
  font-family: 'Montserrat', sans-serif;
}

.menu-link-logo {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: contain;
}

.menu-link-logo[src$=".svg"] {
  filter: invert(1);
}

.slide-menu-footer {
  margin-top: auto;
  padding: 15px;
}

.menu-link-secondary {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.menu-link-secondary:hover {
  color: var(--text-primary);
}

/* Mode Selection (Landing Screen) */
#landing-mode-selection {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#landing-continue-button {
  display: block;
  margin: 0 auto;
}

.mode-toggle-container {
  display: flex;
  justify-content: center;
}

.mode-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-label {
  font-size: 0.9em;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.mode-label-competitive.active,
.mode-label-casual.active {
  color: var(--text-primary);
  -webkit-text-stroke: 0.5px currentColor;
}

.mode-toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.mode-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.mode-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--primary);
  transition: 0.3s;
  border-radius: 26px;
  box-sizing: border-box;
  border: 2px solid transparent;
}

.mode-toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.mode-toggle-switch input:checked + .mode-toggle-slider {
  background-color: var(--surface-light);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.mode-toggle-switch input:checked + .mode-toggle-slider:before {
  transform: translateX(26px);
}

.mode-help-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background-color: transparent;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.mode-help-button:hover {
  opacity: 1;
}

/* Casual Mode - Hide timer and stats */
body.casual-mode .timer-display {
  display: none;
}

body.casual-mode #stats-button {
  display: none;
}

/* Archive Container */
#archive-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 10px;
}

.archive-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--primary);
  border: none;
  border-radius: 5px;
  color: var(--text-primary);
  padding: 10px;
  cursor: pointer;
  transition: background-color 0.3s;
  text-align: center;
}

.archive-button:hover {
  background-color: var(--primary-hover);
}

.archive-button-completed {
  background-color: var(--primary-dark);
}

.archive-button-completed:hover {
  background-color: #005a4f;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .modal {
    display: none;
    justify-content: flex-end;
    align-items: flex-end;
  }

  .modal.show {
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
  }

  .modal-content {
    margin: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 20px 20px 0 0;
    max-height: 80vh;
  }
}



/* Editor Button (shown in test mode) */
.editor-button {
  display: none !important;
}

body.test-mode .editor-button {
  display: flex !important;
  background-color: #9c27b0;
}

body.test-mode .editor-button:hover {
  background-color: #7b1fa2;
}

/* Reset Button (dev tool - red to stand out) */
.reset-button {
  background-color: #2196F3 !important;
}
.reset-button:hover {
  background-color: #1976D2 !important;
}

/* Membership modal styles - adapted from Wordsmyth */
.membership-body {
  padding: 10px 20px 20px 20px;
  text-align: left;
  overflow-y: auto;
  max-height: calc(80vh - 60px);
}

.membership-body p {
  margin-bottom: 0.75rem;
  line-height: 1.5;
  font-size: 0.85rem;
  color: #ccc;
}

.membership-icon {
  text-align: center;
  margin-bottom: 1rem;
}

.membership-header-icon {
  width: 48px;
  height: 48px;
  filter: invert(41%) sepia(55%) saturate(2000%) hue-rotate(336deg) brightness(90%) contrast(95%);
}

.menu-link-logo[src*="heart-partner-handshake"] {
  filter: invert(41%) sepia(55%) saturate(2000%) hue-rotate(336deg) brightness(90%) contrast(95%);
}

.membership-greeting {
  font-size: 1.1rem !important;
  text-align: center;
  color: #fff !important;
}

.membership-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.membership-buttons .button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.membership-signature {
  text-align: left;
  margin-top: 0.5rem !important;
}

.membership-company {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #999;
  font-size: 0.9rem;
}

.membership-fpg-logo {
  width: 20px;
  height: 20px;
  border-radius: 4px;
}

/* Responsive adjustments for medium-short viewports */
@media (max-height: 750px) {
  :root {
    --grid-size: min(85vw, 36vh, 320px);
  }

  .game-container {
    gap: 10px;
  }

  .game-card {
    padding: 12px;
  }

  .game-card-board {
    padding: 20px;
  }
}

/* Responsive adjustments for short viewports (mobile landscape, small phones) */
@media (max-height: 650px) {
  :root {
    --grid-size: min(85vw, 34vh, 300px);
  }

  .header {
    padding: 6px 10px;
  }

  .title img.header-logo {
    height: 36px;
  }

  .date-nav-row {
    padding: 2px 20px;
  }

  .game-card {
    padding: 10px;
    border-radius: 10px;
  }

  .game-card-board {
    padding: 16px;
    border-radius: 12px;
  }

  .clue-text {
    font-size: 0.85em;
    line-height: 1.2;
  }

  .current-word-text {
    font-size: 1.1em;
  }

  .progress-text {
    font-size: 0.8em;
  }
}

/* Extra small screens */
@media (max-height: 550px) {
  :root {
    --grid-size: min(80vw, 32vh, 260px);
  }

  .game-container {
    gap: 6px;
  }

  .game-card-board {
    padding: 12px;
  }

  .title img.header-logo {
    height: 28px;
  }
}
