/* ========================================
   PUNDAZE - Modern Redesign CSS
   ======================================== */

/* ---- CSS Variables (Custom Properties) ---- */
:root {
  /* Primary Colors - New sophisticated palette */
  --primary: #000000; /* Black for primary elements */
  --primary-light: #333333; /* Dark gray for lighter elements */
  --accent: #6b46c1; /* Royal Purple for interactive elements */
  --accent-light: #805ad5; /* Lighter purple for hover states */
  --success: #6aaa64; /* Green for correct answers */
  --warning: #c9b458; /* Yellow for hints */
  --error: #dc4c64; /* Red for errors */
  /* Add new variables for subtle backgrounds */
  --accent-bg-subtle: rgba(107, 70, 193, 0.05);
  --accent-bg-medium: rgba(107, 70, 193, 0.1);

  /* Neutral Colors */
  --background: #f6f7f8; /* Off-white background */
  --card-bg: #ffffff; /* White for card backgrounds */
  --text: #1a1a1a; /* Near black for text */
  --text-light: #787c7e; /* Medium gray for secondary text */
  --border: #d3d6da; /* Light gray for borders */
  --divider: #eeeeee; /* Very light gray for dividers */

  /* Shadows & Effects */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-input: 0 0 0 1px var(--border);
  --shadow-input-focus: 0 0 0 1px var(--accent),
    0 0 0 3px rgba(74, 144, 226, 0.2);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Spacing (based on 8px grid) */
  --space-xxs: 0.25rem; /* 4px */
  --space-xs: 0.5rem; /* 8px */
  --space-sm: 1rem; /* 16px */
  --space-md: 1.5rem; /* 24px */
  --space-lg: 2rem; /* 32px */
  --space-xl: 3rem; /* 48px */
  --space-xxl: 4rem; /* 64px */

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Font Sizes */
  --text-xs: 1.2rem; /* 12px */
  --text-sm: 1.4rem; /* 14px */
  --text-base: 1.6rem; /* 16px */
  --text-lg: 1.8rem; /* 18px */
  --text-xl: 2rem; /* 20px */
  --text-2xl: 2.4rem; /* 24px */
  --text-3xl: 3rem; /* 30px */
  --text-4xl: 3.6rem; /* 36px */

  /* Game-specific dimensions */
  --header-height: 6rem;
  --game-max-width: 54rem;
  --modal-max-width: 50rem;
}

/* ---- Reset & Base Styles ---- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 62.5%; /* 10px base for easy rem calculation */
  height: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: var(--text-base);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  background-color: var(--background);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  margin: 0;
  overflow-x: hidden;
}

/* ---- Typography ---- */
h1,
h2,
h3 {
  font-family: "Georgia", "Times New Roman", serif;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--primary);
  letter-spacing: -0.02em;
}

h1 {
  font-size: var(--text-3xl);
}

p {
  font-size: var(--text-base);
  margin-bottom: var(--space-md);
  color: var(--text);
}

.date-display {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: var(--text-lg);
  color: var(--text-light);
  font-weight: 400;
}

/* Dark mode variables */
body.dark-mode {
  --primary: #ffffff;
  --primary-light: #cccccc;
  --accent: #9f7aea; /* Dark mode Royal Purple */
  --accent-light: #b794f4; /* Dark mode hover state */
  --success: #6aaa64;
  --warning: #c9b458;
  --error: #dc4c64;
  /* Dark mode subtle backgrounds */
  --accent-bg-subtle: rgba(159, 122, 234, 0.1);
  --accent-bg-medium: rgba(159, 122, 234, 0.2);

  --background: #121212;
  --card-bg: #1e1e1e;
  --text: #e0e0e0;
  --text-light: #a0a0a0;
  --border: #444444;
  --divider: #333333;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-input: 0 0 0 1px var(--border);
  --shadow-input-focus: 0 0 0 1px var(--accent),
    0 0 0 3px rgba(74, 144, 226, 0.3);
}

body.dark-mode .guess-input,
body.dark-mode .hard-mode-input {
  color: white; /* Make text white instead of inheriting black */
}

/* Fix for submit button in dark mode */
body.dark-mode .submit-guess,
body.dark-mode .share-button {
  background-color: var(--accent);
  color: white;
}

body.dark-mode .submit-guess:hover,
body.dark-mode .share-button:hover {
  background-color: var(--accent-light); /* Slightly lighter on hover */
}

/* Also fix any other buttons that may have visibility issues */
body.dark-mode .view-results {
  background-color: #5d9958; /* Keep success color but ensure contrast */
  color: white;
}

body.dark-mode .hint-button {
  background-color: #c9b458; /* Maintain hint button color */
  color: black; /* Ensure contrast with yellow background */
}

body.dark-mode .hint-button.active-hint-mode {
  background-color: #a0a0a0; /* Lighter gray in active mode */
  color: black;
}

/* Fix for hinted and locked inputs to ensure text remains visible */
body.dark-mode .guess-input.hinted {
  color: #c9b458; /* Yellow text for hinted letters */
  background-color: rgba(
    201,
    180,
    88,
    0.2
  ); /* Slightly transparent yellow background */
}

body.dark-mode .guess-input.locked {
  color: #6aaa64; /* Green text for correct letters */
  background-color: rgba(
    106,
    170,
    100,
    0.2
  ); /* Slightly transparent green background */
}

body.dark-mode .guess-input.locked-incorrect {
  color: #dc4c64; /* Red text for incorrect letters */
  background-color: rgba(
    220,
    76,
    100,
    0.2
  ); /* Slightly transparent red background */
}

/* ---- Main Container ---- */
.main-container {
  width: 100%;
  max-width: 100%;
  margin: 0;
  background: var(--card-bg);
  box-shadow: none;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Layout Components ---- */
.previewPage,
.adPage,
.gamePage {
  display: none;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  text-align: center;
}

/* Override display property when pages are active */
.previewPage[style*="display: block"],
.adPage[style*="display: block"],
.gamePage[style*="display: block"] {
  position: relative;
  display: flex !important;
  flex-direction: column;
  align-items: center;
}

.previewPage,
.adPage {
  justify-content: center;
  padding: var(--space-xl);
  min-height: 100vh;
}

.gamePage {
  padding: 0;
  min-height: 100vh;
}

/* Page Transition */
.fade-in-page {
  animation: fadeInPage 0.6s ease-out forwards;
  opacity: 0;
}

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

/* Add this to style the logo with a subtle underline */
.logo-container h1 {
  position: relative;
  display: inline-block;
}

.logo-container h1::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background-color: var(--accent);
  border-radius: 2px;
}

/* ---- Game Header ---- */
.game-header {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: var(--header-height);
  padding: 0 var(--space-md);
  border-bottom: 1px solid var(--border);
  background-color: var(--card-bg);
}

.game-header h1 {
  margin: 0;
  font-size: var(--text-2xl);
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  max-width: calc(100% - 10rem);
}

.game-header .date-display {
  font-size: var(--text-base);
  color: var(--text-light);
}

/* ---- Archive Game Toolbar ---- */
.toolbar-left {
  display: flex;
  align-items: center;
  position: absolute;
  left: 0;
  z-index: 3;
}

.back-to-archive-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.back-to-archive-link:hover {
  background-color: var(--divider);
  color: var(--accent);
}

.back-to-archive-link svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Responsive adjustments for archive toolbar */
@media (max-width: 768px) {
  .back-to-archive-link {
    padding: 6px 12px;
    font-size: var(--text-xs);
  }

  .back-to-archive-link svg {
    width: 18px;
    height: 18px;
  }
}

@media (max-width: 576px) {
  .back-to-archive-link span {
    display: none; /* Hide "Back to Archive" text on very small screens */
  }

  .back-to-archive-link {
    padding: 6px 8px;
  }
}

/* Other headers */
/* Add subtle purple underline to modal headers */
.modal h1,
.result-modal h1,
#statsModalTitle,
#settingsModalTitle,
#hardModeInfoModal h1,
#resultModalTitle,
#helpModalTitle {
  position: relative;
  padding-bottom: var(--space-sm);
}

.modal h1::after,
.result-modal h1::after,
#statsModalTitle::after,
#settingsModalTitle::after,
#hardModeInfoModal h1::after,
#resultModalTitle::after,
#helpModalTitle::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background-color: var(--accent);
  border-radius: 2px;
}

/* Toolbar CSS for Pundaze */

/* Reset any existing toolbar styles */
.game-controls-row {
  display: none;
}

/* Updated toolbar styles to properly center the title */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 16px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  background-color: var(--card-bg);
  position: relative; /* Add position relative */
}

/* Revised toolbar title styling to ensure it's truly centered */
.toolbar-title {
  font-family: "Georgia", "Times New Roman", serif;
  font-weight: 700;
  font-size: var(--text-2xl);
  color: var(--primary);
  text-align: center;
  margin: 0;
  width: 100%; /* Ensure title spans the full width */
  position: absolute; /* Position absolutely within the toolbar */
  left: 0; /* Align to left edge */
  z-index: 1; /* Ensure title stays above other elements */
}

/* Adjust toolbar icons container to ensure it doesn't interfere with centered title */
.toolbar-icons {
  display: flex;
  align-items: center;
  gap: 2px;
  position: relative; /* Position relative to ensure it stays above the centered title */
  z-index: 2; /* Higher z-index than the title */
  margin-left: auto; /* Push to the right */
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .toolbar-title {
    font-size: var(--text-xl);
  }
}

@media (max-width: 375px) {
  .toolbar-title {
    font-size: var(--text-lg);
  }
}

/* Icon button styling */
.icon-btn {
  background: none;
  border: none;
  padding: 8px;
  margin: 0;
  cursor: pointer;
  color: var(--text);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.icon-btn:hover {
  background-color: var(--divider);
}

.icon-btn:focus {
  outline: none;
}

/* SVG icons styling */
.icon-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* Date display styling */
.date-display {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: var(--text-base);
  color: var(--text-light);
  font-weight: 400;
  margin-left: 8px;
}

/* Dark mode support */
body.dark-mode .toolbar {
  background-color: var(--card-bg);
  border-color: var(--border);
}

body.dark-mode .toolbar-title {
  color: var(--primary);
}

body.dark-mode .icon-btn {
  color: var(--text);
}

body.dark-mode .icon-btn:hover {
  background-color: var(--divider);
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .toolbar {
    padding: 0 12px;
    height: 48px;
  }

  .toolbar-title {
    font-size: var(--text-xl);
  }

  .date-display {
    display: none;
  }

  .icon-btn {
    padding: 6px;
  }

  .icon-btn svg {
    width: 22px;
    height: 22px;
  }

  .toolbar-icons {
    gap: 0px;
  }
}

@media (max-width: 375px) {
  .toolbar {
    padding: 0 8px;
    height: 44px;
  }

  .toolbar-title {
    font-size: var(--text-lg);
  }

  .icon-btn svg {
    width: 20px;
    height: 20px;
  }
}

/* Comprehensive fix for game-controls-row and icon buttons */

/* ---- Game Controls Row & Icon Buttons ---- */
.game-controls-row {
  position: absolute;
  right: var(--space-md);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px; /* Consistent fixed gap */
  height: var(--header-height); /* Match header height */
}

/* Standardize all icon buttons */
.icon-button {
  position: relative; /* Create positioning context */
  background: none;
  border: none;
  width: 36px; /* Fixed pixel width for consistency */
  height: 36px; /* Fixed pixel height for consistency */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible; /* Allow SVG to overflow if needed */
  cursor: pointer;
  color: var(--text);
  padding: 0; /* Remove any default padding */
  margin: 0; /* Remove any default margin */
  transition: background-color 0.2s ease;
}

.icon-button:hover {
  background-color: var(--divider);
}

/* Make all SVGs conform to a standard box */
.icon-button svg {
  position: absolute; /* Position within the button */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%); /* Center perfectly */
  width: 24px;
  height: 24px;
  display: block; /* Important for alignment */
  fill: currentColor; /* Ensure color inheritance */
}

/* Ensure paths within SVGs inherit the color */
.icon-button svg path {
  fill: currentColor;
}

/* Dark mode specific styling to ensure icons are visible */
body.dark-mode .icon-button {
  color: var(--text);
}

body.dark-mode .icon-button:hover {
  background-color: var(--divider);
}

/* Archive Button Dropdown */
.archive-button {
  position: relative;
  display: inline-block;
}

.archive-button .dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--space-sm) var(--space-md);
  white-space: nowrap;
  font-size: var(--text-sm);
  color: var(--text);
  margin-top: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-5px);
  transition: all var(--transition-normal);
  z-index: 1000;
}

.archive-button .dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.archive-button .dropdown::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-right: none;
  transform: translateX(-50%) rotate(45deg);
}

/* Dark mode support */
body.dark-mode .archive-button .dropdown {
  background-color: var(--card-bg);
  border-color: var(--border);
  color: var(--text);
}

body.dark-mode .archive-button .dropdown::before {
  background-color: var(--card-bg);
  border-color: var(--border);
}

/* Responsive adjustments for different screen sizes */
@media (max-width: 768px) {
  .game-controls-row {
    right: var(--space-md);
    gap: 16px; /* Maintain consistent gap */
  }

  .icon-button {
    width: 34px;
    height: 34px;
  }

  .icon-button svg {
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 576px) {
  .game-controls-row {
    right: var(--space-sm);
    gap: 14px; /* Slight reduction for smaller screens */
  }

  .icon-button {
    width: 32px;
    height: 32px;
  }

  .icon-button svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 375px) {
  .game-controls-row {
    right: 8px; /* Fixed right margin on very small screens */
    gap: 12px; /* Further reduce gap on very small screens */
  }

  .icon-button {
    width: 30px;
    height: 30px;
  }

  .icon-button svg {
    width: 18px;
    height: 18px;
  }
}

/* ---- Puzzle Container ---- */
#puzzleContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: var(--game-max-width);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
  flex-grow: 1;
}

/* ---- Puzzle Image ---- */
.puzzle-image-container {
  position: relative;
  width: 100%;
  max-width: 44rem;
  margin-bottom: var(--space-xl);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background-color: var(--card-bg);
  aspect-ratio: 1/1; /* This makes it square */
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-loading-spinner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.9);
  z-index: 5;
  transition: opacity 0.3s ease-out;
}

.puzzle-image-container.loaded .image-loading-spinner {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 1s ease-in-out infinite;
  margin-bottom: var(--space-sm);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#puzzleImage,
#resultImage {
  max-width: 100%;
  height: auto;
  max-height: 100%;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform var(--transition-normal);
  display: block;
  object-fit: contain;
}

#puzzleImage:hover,
#resultImage:hover {
  transform: scale(1.02);
}

/* ---- Guess Container & Inputs ---- */
.guessContainer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-lg); /* Spacing between words - 24px */
  margin: var(--space-lg) 0;
  width: 100%;
  /* Apply mobile scaling when set */
  transform: scale(var(--mobile-scale, 1));
  transform-origin: center;
}

.word-container {
  display: flex;
  gap: 8px; /* Gap between individual letters */
  margin-bottom: var(--space-md);
}

.guess-input {
  height: 6rem;
  width: 5rem;
  font-size: var(--text-2xl);
  text-align: center;
  font-weight: 700;
  font-family: "Helvetica Neue", Arial, sans-serif;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--card-bg);
  transition: all var(--transition-fast);
  caret-color: var(--accent);
  box-shadow: var(--shadow-input);
  line-height: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

.guess-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: var(--shadow-input-focus);
}

.guess-input.hinted {
  background-color: rgba(201, 180, 88, 0.15);
  border-color: var(--warning);
  color: var(--warning);
  cursor: not-allowed;
}

.guess-input.locked {
  background-color: rgba(106, 170, 100, 0.15);
  border-color: var(--success);
  color: var(--success);
  display: flex;
  justify-content: center;
  align-items: center;
  transform-style: preserve-3d;
}

.guess-input.locked-incorrect {
  background-color: rgba(220, 76, 100, 0.15);
  border-color: var(--error);
  color: var(--error);
}

/* Active hint mode styling for input boxes */
.hint-mode-active
  .guess-input:not(.hinted):not(.locked):not(.locked-incorrect) {
  border-color: var(--warning);
  box-shadow: 0 0 0 1px var(--warning), 0 0 0 3px rgba(201, 180, 88, 0.2);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 1px var(--warning), 0 0 0 3px rgba(201, 180, 88, 0.2);
  }
  70% {
    box-shadow: 0 0 0 1px var(--warning), 0 0 0 5px rgba(201, 180, 88, 0);
  }
  100% {
    box-shadow: 0 0 0 1px var(--warning), 0 0 0 3px rgba(201, 180, 88, 0);
  }
}

/* ---- Button Styles ---- */
.action-button {
  font-size: var(--text-base);
  font-weight: 600;
  padding: 1.2rem 2.4rem;
  margin: var(--space-md);
  border: none;
  background-color: var(--accent);
  color: white;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}

.action-button:hover {
  background-color: var(--accent-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.action-button:active {
  transform: translateY(0);
}

/* Preview page buttons */
.help-modal,
.go-to-game,
.login-button {
  background-color: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 1.2rem 2.4rem;
}

.help-modal:hover,
.go-to-game:hover,
/*.go-to-ad:hover,*/
.login-button:hover {
  background-color: var(--background);
  border-color: var(--text-light);
}

/* Start Game button enhancement - Light Mode */
.go-to-ad.action-button {
  background-color: var(
    --accent
  ); /* color from your existing accent variable */
  color: white;
  border: none;
  font-weight: 700; /* Make text slightly bolder */
  box-shadow: 0 4px 6px rgba(74, 144, 226, 0.25); /* Add a subtle shadow */
  transform: translateY(0); /* Prepare for hover effect */
  transition: all var(--transition-normal);
}

.go-to-ad.action-button:hover {
  background-color: var(--accent-light);
  transform: translateY(-2px); /* Slightly more pronounced lift effect */
  box-shadow: 0 6px 12px rgba(74, 144, 226, 0.3); /* Enhanced shadow on hover */
}

/* Dark Mode specific styles */
body.dark-mode .go-to-ad.action-button {
  background-color: var(
    --accent
  ); /* Use a lighter blue in dark mode for better contrast */
  color: white;
  /* Reduced shadow opacity and blur radius */
  box-shadow: 0 4px 4px rgba(114, 182, 255, 0.15);
}

body.dark-mode .go-to-ad.action-button:hover {
  background-color: var(--accent-light);
  box-shadow: 0 5px 8px rgba(114, 182, 255, 0.2);
}

.submit-button-container {
  position: relative;
  display: inline-block;
  width: 100%;
  margin-top: var(--space-md);
}

.submit-guess,
.view-results {
  position: relative;
  width: 100%;
  font-weight: 700;
  margin-top: 0;
  min-width: 12rem;
}

.submit-guess {
  background-color: var(--primary);
  color: white;
  font-weight: 700;
  min-width: 12rem;
}

.submit-guess:hover {
  background-color: var(--primary-light);
}

.hint-button {
  background-color: var(--warning);
  color: white;
  min-width: 12rem;
}

.hint-button.active-hint-mode {
  background-color: var(--text-light);
}

.hint-button:hover {
  background-color: #b19f4c;
}

.view-results {
  background-color: #5d9958;
  display: none;
}

.view-results:hover {
  background-color: #5d9958;
}

.share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  background-color: var(--accent);
  color: white;
  padding: 1.2rem 2.4rem;
  border-radius: var(--radius-full);
  margin-top: var(--space-md);
  font-weight: 600;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.share-button:hover {
  background-color: var(--accent-light);
  transform: translateY(-2px);
}

.share-button svg path {
  fill: white;
}

/* Help Modal */
.modal-content p {
  text-align: center;
}

/* If you want to keep the "For example:" paragraph left-aligned */
.modal-content p.text-left {
  text-align: left;
}

.help-example-image {
  max-width: 320px;
  width: 100%; /* Add this */
  height: auto;
  border-radius: var(--radius-sm);
  display: block;
  margin: 12px auto;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  object-fit: contain; /* Add this */
  object-position: center; /* Add this */
}

/* Create a container for the example image to control its size better */
.example-image-container {
  width: 100%;
  max-width: 320px;
  margin: 12px auto;
  text-align: center;
}

/* Make the image responsive on smaller screens */
@media (max-width: 576px) {
  .help-example-image {
    max-width: 240px;
  }

  .example-image-container {
    max-width: 240px;
  }
}

/* Example section styling */
.example-container {
  background-color: rgba(107, 70, 193, 0.05);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1rem 0 2rem;
  border-left: 3px solid #6b46c1;
}

body.dark-mode .example-container {
  background-color: rgba(159, 122, 234, 0.1);
  border-left: 3px solid #9f7aea;
}

.instruction-text {
  text-align: center;
  font-size: 1.8rem;
}

.example-text {
  text-align: center;
  margin-top: 1rem;
}

.happy-message {
  text-align: center;
  font-weight: 600;
  margin-top: 2rem;
  font-size: 1.8rem;
}

.example-section-heading {
  font-size: 1.8rem;
  font-weight: 600;
  margin: 2rem 0 1rem;
  color: #1a1a1a;
}

body.dark-mode .example-section-heading {
  color: #cccccc;
}

.instruction-list {
  list-style-type: disc;
  padding-left: 2rem;
  margin-bottom: 1.5rem;
}

.instruction-list li {
  margin-bottom: 0.8rem;
  line-height: 1.5;
  font-size: 1.6rem;
}

.exampleGuessContainer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin: 16px 0;
  width: 100%;
}

.example-word-container {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

/* Non-interactive input box for examples */
.guess-input-example {
  height: 4.5rem; /* Reduced from 6rem */
  width: 3.8rem;
  font-size: 2rem;
  text-align: center;
  font-weight: 700;
  font-family: "Helvetica Neue", Arial, sans-serif;
  border: 1px solid #d3d6da;
  border-radius: 4px;
  background-color: #ffffff;
  transition: all 150ms cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 0 1px #d3d6da;
  line-height: 1;
  display: block;
}

body.dark-mode .guess-input-example {
  background-color: #1e1e1e;
  border-color: #444444;
  color: #e0e0e0;
  box-shadow: 0 0 0 1px #444444;
}

/* Success styling for example input boxes */
.guess-input-example.success {
  background-color: rgba(106, 170, 100, 0.15);
  border-color: #6aaa64;
  color: #6aaa64;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

body.dark-mode .guess-input-example.success {
  background-color: rgba(106, 170, 100, 0.2);
  border-color: #6aaa64;
  color: #6aaa64;
}

/* Add letters inside the success boxes using content */
.guess-input-example.success::before {
  content: attr(data-letter);
  font-size: inherit;
  font-weight: 700;
  color: inherit;
}

/* Help example image styling */
.help-example-image {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border: 1px solid #d3d6da;
}

body.dark-mode .help-example-image {
  border-color: #444444;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Responsive adjustments */
@media (max-width: 576px) {
  .exampleGuessContainer {
    gap: 12px; /* Further reduced for small screens */
  }

  .example-word-container {
    gap: 4px; /* Further reduced for small screens */
  }

  .guess-input-example {
    height: 4rem;
    width: 3.2rem;
    font-size: 1.8rem;
  }

  .section-heading {
    font-size: 1.6rem;
  }

  .instruction-text,
  .happy-message {
    font-size: 1.6rem;
  }
}

@media (max-width: 387px) {
  .guess-input-example {
    height: 3.5rem;
    width: 2.8rem;
    font-size: 1.6rem;
  }
}

/* ---- Help & Icon Buttons ---- */
.help-button {
  position: relative;
  right: 0;
  width: 3.6rem;
  height: 3.6rem;
  background: none;
  color: var(--text);
  border: none;
  border-radius: var(--radius-full);
  font-size: 0; /* Hide text */
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background-color var(--transition-normal);
}

.help-button:hover {
  background-color: var(--divider);
}

/* Use SVG for question mark icon instead of text */
.help-button::before {
  display: none;
}

/* Alternative question mark fix if SVG doesn't work */
.help-button.text-fallback {
  font-size: var(--text-xl);
  font-family: Georgia, serif;
  line-height: 1;
  padding-bottom: 2px; /* Fix vertical alignment */
}

/* ---- Game Status Elements ---- */
.guess-counter {
  font-size: var(--text-base);
  margin: var(--space-md) 0 var(--space-xxl);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
  transition: opacity var(--transition-slow);
  color: var(--text-light);
  width: 100%;
  text-align: center;
}

#guessNumber {
  font-weight: 700;
  color: var(--primary);
  margin-left: var(--space-xs);
  transition: opacity var(--transition-normal);
}

.error-message {
  color: var(--error);
  font-size: var(--text-base);
  font-weight: 500;
  margin-top: var(--space-sm);
  text-align: center;
  min-height: 2.4rem;
  transition: opacity var(--transition-normal);
}

/* ---- Hint Instructions ---- */
.hint-instructions {
  width: 100%;
  margin: var(--space-sm) 0 var(--space-md);
  padding: var(--space-md);
  background-color: rgba(201, 180, 88, 0.1);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
  text-align: center;
  animation: fadeIn 0.3s ease-out;
}

.hint-instructions p {
  font-size: var(--text-sm);
  color: var(--text);
  margin: 0;
  font-weight: 500;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Modals ---- */
.modal,
.result-modal,
.expand-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateY(20px);
  background-color: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  width: 90vw;
  max-width: var(--modal-max-width);
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--space-xl);
  border: 1px solid var(--border);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
}

.modal:not(.hidden),
.result-modal:not(.hidden),
.expand-modal:not(.hidden) {
  transform: translate(-50%, -50%);
  opacity: 1;
  visibility: visible;
}

.modal h1,
.result-modal h1 {
  color: var(--primary);
  margin-bottom: var(--space-lg);
  text-align: center;
}

.close-modal,
.close-result-modal,
.close-expand {
  position: absolute;
  top: 1.6rem;
  right: 1.6rem;
  font-size: 2.4rem;
  color: var(--text-light);
  cursor: pointer;
  border: none;
  background: none;
  transition: color var(--transition-fast);
  width: 3.6rem;
  height: 3.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  z-index: 10;
}

.close-modal:hover,
.close-result-modal:hover,
.close-expand:hover {
  color: var(--error);
  background-color: var(--divider);
}

.overlay,
.result-overlay,
.expand-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay:not(.hidden),
.result-overlay:not(.hidden),
.expand-overlay:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

/* Hide every little scrollbar but keep scrolling enabled */
/* Firefox */
.modal,
.result-modal,
.expand-modal {
  scrollbar-width: none;
}
/* WebKit */
.modal .modal-content::-webkit-scrollbar,
.result-modal .modal-content::-webkit-scrollbar,
.expand-modal .modal-content::-webkit-scrollbar {
  display: none;
}

/* ---- Result Modal Specific ---- */
.result-modal .modal-content {
  text-align: center;
}

.result-modal #resultImage {
  max-width: 100%;
  height: auto;
  margin: var(--space-md) 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.result-stats {
  display: flex;
  justify-content: space-around;
  margin: var(--space-lg) 0;
  width: 100%;
  border-top: 1px solid var(--divider);
  border-bottom: 1px solid var(--divider);
  padding: var(--space-md) 0;
  background-color: var(
    --accent-bg-subtle
  ); /* Added subtle purple background */
  border-left: 3px solid var(--accent); /* Add accent border */
  border-radius: var(--radius-md);
}

.result-stats p {
  font-size: var(--text-lg);
  margin: 0;
  color: var(--text-light);
}

.result-stats span {
  font-weight: 700;
  color: var(--primary);
}

/* Hard Mode Input Styling */
.hard-mode-input {
  width: 100%;
  max-width: 80%;
  padding: 1rem 2rem;
  height: 6rem;
  font-size: var(--text-2xl);
  text-align: center;
  font-weight: 700;
  font-family: "Helvetica Neue", Arial, sans-serif;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--card-bg);
  transition: all var(--transition-fast);
  caret-color: var(--accent);
  box-shadow: var(--shadow-input);
  margin: 0 auto;
  display: block;
}

.hard-mode-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: var(--shadow-input-focus);
}

/* Disabled Hint Button */
.hint-button.disabled-hint {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--text-light);
}

/* Tooltip for disabled hint button */
.hint-button.disabled-hint:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--primary);
  color: white;
  text-align: center;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  white-space: nowrap;
  z-index: 10;
  margin-bottom: 5px;
  pointer-events: none;
}

body.dark-mode .hint-button.disabled-hint:hover::after {
  background-color: #555555; /* Lighter background in dark mode */
  color: white; /* Ensure text is white for contrast */
  border: 1px solid #777777; /* Add border for better visibility */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); /* Add shadow for depth */
}

/* Center the 'Got it!' button in the Hard Mode info modal */
.gotit-button-container {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: var(--space-md);
}

/* Hard Mode Info Modal List */
#hardModeInfoModal ul {
  text-align: left;
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

#hardModeInfoModal li {
  margin-bottom: var(--space-xs);
}

/* Modal Action Button */
#hardModeInfoModal .action-button {
  margin-top: var(--space-md);
}

/* Hard Mode win/loss animations */
.hard-mode-input.locked {
  background-color: rgba(106, 170, 100, 0.15);
  border-color: var(--success);
  color: var(--success);
}

.hard-mode-input.locked-incorrect {
  background-color: rgba(220, 76, 100, 0.15);
  border-color: var(--error);
  color: var(--error);
}

/* Make sure shake animation works for hard mode input */
.hard-mode-input.shake {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ---- Global Stats Panel ---- */
.global-stats {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  background-color: var(--accent-bg-subtle);
  border-radius: var(--radius-md);
  text-align: center;
  position: relative;
  transition: opacity 0.3s ease, transform 0.3s ease;
  border-left: 3px solid var(--accent); /* Add accent border */
}

.global-stats h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-sm);
  color: var(--accent);
}

.global-stats-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  gap: var(--space-md);
}

.global-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 70px;
  padding: var(--space-xs) 0;
}

.global-stat-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--accent);
}

.global-stat-label {
  font-size: var(--text-xs);
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: var(--space-xxs);
}

.accumulating-stats {
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-lg);
  font-size: var(--text-sm);
  font-style: italic;
  color: var(--text-light);
  background-color: var(--accent-bg-subtle);
  border-left: 3px solid var(--accent); /* Add accent border */
  border-radius: var(--radius-md);
  text-align: center;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Refresh button for global stats */
.refresh-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  margin-top: var(--space-md);
  padding: 0.8rem 1.6rem;
  font-size: var(--text-sm);
  color: var(--text-light);
  background-color: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.refresh-button:hover {
  color: var(--accent);
  border-color: var(--accent);
  background-color: rgba(107, 70, 193, 0.05);
}

.refresh-button svg {
  transition: transform 0.3s ease;
}

.refresh-button:hover svg {
  transform: rotate(180deg);
}

/* Spinning animation when refreshing */
.refresh-button.refreshing {
  pointer-events: none;
  opacity: 0.7;
}

.refresh-button.refreshing svg {
  animation: spin 1.5s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Loading indicator for stats refresh */
.stats-loading-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.stats-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
}

.stats-loading-indicator.hidden {
  display: none;
}

/* Animation for showing global stats */
.global-stats:not(.hidden),
.accumulating-stats:not(.hidden) {
  animation: slideIn 0.5s ease forwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fix for dark mode */
body.dark-mode .refresh-button {
  color: var(--text-light);
  border-color: var(--border);
}

body.dark-mode .refresh-button:hover {
  color: var(--accent-light);
  border-color: var(--accent-light);
  background-color: rgba(114, 182, 255, 0.1);
}

/* Ensure color values work well in dark mode */
body.dark-mode .result-stats,
body.dark-mode .global-stats,
body.dark-mode .accumulating-stats,
body.dark-mode .user-stats {
  background-color: var(--accent-bg-subtle); /* Dark mode subtle purple */
  border-left-color: var(--accent); /* Dark mode accent */
}

body.dark-mode .global-stat-value {
  color: var(--accent); /* Dark mode accent */
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .global-stats-content {
    gap: var(--space-xs);
  }

  .global-stat-item {
    min-width: 60px;
    padding: var(--space-xxs);
  }

  .global-stat-value {
    font-size: var(--text-lg);
  }

  .refresh-button {
    padding: 0.6rem 1.2rem;
    font-size: var(--text-xs);
  }
}

/* ---- Settings Icon & Modal ---- */
.settings-button svg {
  width: 22px;
  height: 22px;
}

.settings-button svg path {
  fill: currentColor;
}

/* ---- Toggle Switch ---- */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
  margin: 0 10px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border);
  transition: var(--transition-normal);
  border-radius: var(--radius-full);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: var(--transition-normal);
  border-radius: 50%;
}

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

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

.settings-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--divider);
}

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

.option-label {
  font-weight: 500;
}

.option-description {
  font-size: var(--text-sm);
  color: var(--text-light);
  margin-top: var(--space-xxs);
}

/* Settings About Section Styles */
.settings-about-section {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--divider);
}

.settings-about-section h2 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-sm);
  color: var(--primary);
}

.settings-about-section p {
  margin-bottom: var(--space-sm);
  font-size: var(--text-sm);
}

.settings-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.settings-link:hover {
  color: var(--accent-light);
  text-decoration: underline;
}

/* Contact Section Styles */
.settings-contact-section {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--divider);
}

.settings-contact-section h2 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-sm);
  color: var(--primary);
}

.contact-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
  padding: var(--space-xs) 0;
}

.contact-label {
  font-weight: 500;
  color: var(--text);
}

.contact-action {
  text-align: right;
}

/* Adjust the link styling to ensure consistency */
.contact-action .settings-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.contact-action .settings-link:hover {
  color: var(--accent-light);
  text-decoration: underline;
}

/* Dark mode fix for contact links */
body.dark-mode .contact-action .settings-link {
  color: var(--accent-light);
}

body.dark-mode .contact-action .settings-link:hover {
  color: var(--accent);
}

/* Dark mode adjustments */
body.dark-mode .settings-link {
  color: var(--accent-light);
}

body.dark-mode .settings-link:hover {
  color: var(--accent);
}

/* ---- Expanded Image Modal ---- */
.expand-modal {
  padding: var(--space-md);
  max-width: 80vw;
  width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.expand-modal img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-md);
}

/* Image Expand Modal on mobile */
@media (max-width: 768px) {
  .expand-modal {
    max-width: 95vw;
    width: 95vw;
    padding: var(--space-sm);
  }

  .expanded-image-container {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .expand-modal img {
    max-width: 100%;
    width: auto;
    max-height: 80vh;
  }
}

/* ---- Preview Page ---- */
.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--space-xl);
}

.logo-container h1 {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-sm);
}

.logo-container p {
  font-size: var(--text-xl);
  color: var(--text-light);
}

.action-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
  align-items: center;
}

.action-container .action-button {
  width: 100%;
  margin: var(--space-xs) 0;
}

/* ---- Animation styles ---- */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-8px);
  }
  40%,
  80% {
    transform: translateX(8px);
  }
}

.shake {
  animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes raiseDown {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
  100% {
    transform: translateY(0);
  }
}

.guess-input.raise-down {
  animation: raiseDown 300ms ease-out;
}

@keyframes wiggle-left {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-5deg);
  }
  75% {
    transform: rotate(5deg);
  }
}

@keyframes wiggle-right {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(5deg);
  }
  75% {
    transform: rotate(-5deg);
  }
}

.guess-input.wiggle-left {
  animation: wiggle-left 500ms ease-in-out;
}

.guess-input.wiggle-right {
  animation: wiggle-right 500ms ease-in-out;
}

@keyframes raiseDownMultiple {
  0% {
    transform: translateY(0);
  }
  15% {
    transform: translateY(-8px);
  }
  30% {
    transform: translateY(0);
  }
  45% {
    transform: translateY(-5px);
  }
  60% {
    transform: translateY(0);
  }
  75% {
    transform: translateY(-3px);
  }
  100% {
    transform: translateY(0);
  }
}

/* ---- Toast Notifications ---- */
.error-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: var(--card-bg);
  color: var(--error);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  text-align: center;
  max-width: 90vw;
  border: 1px solid rgba(220, 76, 100, 0.2);
}

.error-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---- Game Controls ---- */
.game-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: var(--space-xs);
}

/* Ensure buttons are centered */
.submit-guess,
.view-results,
.hint-button {
  align-self: center;
  margin-left: auto;
  margin-right: auto;
  min-width: 50%;
  max-width: 20rem;
}

/* ---- Footer Styles ---- */
.game-footer {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background-color: transparent;
  margin-top: var(--space-xl);
  font-size: var(--text-xs);
  color: var(--text-light);
  border-top: 1px solid var(--divider);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xxs);
  max-width: var(--game-max-width);
  margin: 0 auto;
  text-align: center;
}

.copyright {
  font-size: var(--text-xs);
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
}

.footer-link {
  color: var(--text-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.footer-divider {
  color: var(--border);
}

/* ---- Utility Classes ---- */
.hidden {
  display: none !important;
  visibility: hidden;
}

.hidden-button {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity var(--transition-normal),
    transform var(--transition-normal);
}

.faded {
  opacity: 0.4;
  transition: opacity var(--transition-normal);
}

.fade {
  opacity: 0;
  transition: opacity var(--transition-normal);
}

/* ---- Responsive Designs ---- */
/* Larger Desktops */
@media (min-width: 1200px) {
  .main-container {
    max-width: 70rem;
    margin: 2rem auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-height: auto;
  }

  #puzzleContainer {
    max-width: 60rem;
    padding: var(--space-xl);
  }

  .game-footer {
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
  }
}

/* Large Tablets & Small Desktops */
@media (max-width: 992px) {
  .modal,
  .result-modal {
    width: 95vw;
    padding: var(--space-lg);
  }

  h1 {
    font-size: var(--text-2xl);
  }
}

/* Tablets */
@media (max-width: 768px) {
  .main-container {
    min-height: 100vh;
    height: auto;
    overflow-y: auto;
  }

  .previewPage,
  .adPage,
  .gamePage {
    padding: 0;
  }

  .previewPage,
  .adPage {
    padding: var(--space-lg);
  }

  .previewPage {
    padding: var(--space-xl) var(--space-md);
  }

  .guess-input {
    height: 5.6rem;
    width: 4.6rem;
    font-size: var(--text-xl);
  }

  .action-button {
    margin: var(--space-sm) var(--space-xs);
    padding: 1rem 2rem;
  }

  .game-header h1 {
    font-size: var(--text-xl);
  }

  .date-display {
    font-size: var(--text-sm);
  }

  .game-controls {
    padding: 0 var(--space-md);
  }

  .submit-guess,
  .view-results,
  .hint-button {
    min-width: 100%;
  }
}

/* Large Mobile Phones */
@media (max-width: 576px) {
  html {
    font-size: 58%; /* Slightly smaller base font size */
  }

  .previewPage,
  .adPage {
    padding: var(--space-md);
  }

  .guess-input {
    height: 5rem;
    width: 4rem;
    font-size: var(--text-xl);
  }

  .word-container {
    gap: 6px; /* Slightly reduced gap on mobile */
  }

  .modal,
  .result-modal {
    padding: var(--space-md);
    width: 95vw;
  }

  .close-modal,
  .close-result-modal,
  .close-expand {
    font-size: 2rem;
    top: 1.2rem;
    right: 1.2rem;
  }

  .action-button {
    width: 100%;
    margin: var(--space-xs) 0;
  }

  .game-header {
    height: 5rem;
    padding: 0 var(--space-sm);
  }

  .game-footer {
    padding: var(--space-xs) var(--space-sm);
  }

  .footer-content {
    gap: var(--space-xxs);
  }
}

/* Small Mobile Phones */
@media (max-width: 375px) {
  html {
    font-size: 55%; /* Even smaller base font size */
  }

  .guess-input {
    height: 4.6rem;
    width: 3.6rem;
    font-size: var(--text-lg);
  }

  h1 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-md);
  }

  .modal,
  .result-modal {
    padding: var(--space-sm);
  }

  .word-container {
    gap: 4px; /* Further reduced gap on small mobile */
  }
}

/* Make sure footer doesn't get hidden on small screens */
@media (max-height: 700px) {
  .game-footer {
    position: relative;
    margin-top: var(--space-lg);
  }
}

/* User Stats in Result Modal */
.user-stats {
  display: flex;
  justify-content: space-between;
  margin: var(--space-lg) 0;
  background-color: var(--accent-bg-subtle);
  border-left: 3px solid var(--accent); /* Add accent border */
  border-radius: var(--radius-md);
  padding: var(--space-md);
  width: 100%;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.user-stats:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  padding: var(--space-xs);
}

.stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--primary);
  margin-bottom: var(--space-xxs);
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Stats Modal Styles */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.stats-chart {
  border-top: 1px solid var(--divider);
  padding-top: var(--space-md);
  margin-top: var(--space-md);
}

/* .stats-chart h2 {
  font-size: var(--text-lg);
  text-align: center;
  margin-bottom: var(--space-md);
}

.average-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.average-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--accent);
} */

.stats-chart h2 {
  font-size: var(--text-lg);
  text-align: center;
  margin-bottom: var(--space-md);
  color: var(--accent); /* Changed to purple */
}

.average-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
  background-color: var(--accent-bg-subtle); /* Added subtle background */
  border-radius: var(--radius-md);
}

.average-value {
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--accent); /* Already changed to purple in your CSS */
}

.average-label {
  font-size: var(--text-sm);
  color: var(--text-light);
  margin-top: var(--space-xxs);
}

/* Add this to highlight current streak with purple */
#statCurrentStreak {
  color: var(--accent);
}

/* Auth Status Styles */
.auth-status {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--divider);
  text-align: center;
}

.auth-status p {
  margin-bottom: var(--space-sm);
  color: var(--text-light);
  font-size: var(--text-sm);
}

#userDisplayName {
  font-weight: 600;
  color: var(--text);
}

#signInOutButton {
  background-color: var(--accent);
  color: white;
  padding: 0.8rem 1.6rem;
  font-size: var(--text-sm);
  margin: 0 auto;
  min-width: 12rem;
}

#signInOutButton:hover {
  background-color: var(--accent-light);
}

/* Responsive Adjustments */
@media (max-width: 576px) {
  .user-stats {
    flex-wrap: wrap;
    padding: var(--space-sm);
  }

  .stat-item {
    flex-basis: 50%;
    margin-bottom: var(--space-sm);
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
}

/* For subtle highlighted sections */
.highlight-box {
  padding: var(--space-sm);
  border-left: 3px solid var(--accent);
  background-color: var(--accent-bg-subtle);
  border-radius: var(--radius-sm);
  margin: var(--space-md) 0;
}

/* For section headings with underlines */
.section-heading {
  position: relative;
  display: inline-block;
}

.section-heading::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 3px;
  background-color: var(--accent);
  border-radius: 2px;
}

/* For highlighted stat values */
.stat-highlight {
  color: var(--accent);
}

/* Feedback Section */
.feedback-section {
  margin-top: var(--space-lg);
  text-align: center;
}

/* Animation keyframes for feedback buttons */
@keyframes pulse-scale {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(107, 70, 193, 0.4);
  }
  70% {
    transform: scale(1.2);
    box-shadow: 0 0 0 10px rgba(107, 70, 193, 0);
  }
  100% {
    transform: scale(1.1);
    box-shadow: 0 0 0 0 rgba(107, 70, 193, 0);
  }
}

@keyframes feedback-burst {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.4);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}

/* Enhanced feedback buttons container */
.feedback-buttons {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--card-bg);
  transition: opacity 0.3s ease, transform 0.3s ease;
  position: relative;
}

/* Base button styling */
.feedback-btn {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-normal);
  position: relative;
  overflow: visible;
}

.feedback-btn svg {
  width: 2.4rem;
  height: 2.4rem;
  fill: var(--text-light);
  transition: all var(--transition-normal);
  position: relative;
  z-index: 2;
}

/* Divider between buttons */
.feedback-like {
  border-right: 1px solid var(--divider);
}

/* Hover states */
.feedback-btn:hover {
  background: var(--accent-bg-subtle);
}

.feedback-btn:hover svg {
  fill: var(--accent);
  transform: scale(1.1);
}

/* Selected state animation */
.feedback-btn.feedback-selected {
  animation: pulse-scale 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  background-color: var(--accent-bg-medium);
}

.feedback-btn.feedback-selected svg {
  fill: var(--accent);
}

/* Create a pseudo-element for the burst effect */
.feedback-btn.feedback-selected::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  background-color: var(--accent);
  border-radius: 50%;
  z-index: 1;
  opacity: 0;
  animation: feedback-burst 0.6s ease-out forwards;
}

/* Unselected button fade away */
.feedback-btn.feedback-unselected {
  opacity: 0.5;
  transform: scale(0.9);
}

/* Transition for the feedback container */
.feedback-buttons.fade-out {
  opacity: 0;
  transform: translateY(10px);
}

/* Enhanced results display */
.feedback-results {
  font-size: var(--text-base);
  color: var(--text);
  margin-top: var(--space-sm);
  background-color: var(--accent-bg-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  opacity: 0;
  transform: translateY(10px);
  transition: all var(--transition-normal);
  border-left: 3px solid var(--accent);
}

.feedback-results.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* Loading indicator for feedback submission */
.feedback-loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.feedback-loading.active {
  opacity: 1;
}

.feedback-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(74, 144, 226, 0.3);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

/* Dark mode support */
body.dark-mode .feedback-loading {
  background-color: rgba(0, 0, 0, 0.5);
}
