/* On very small screens, reset body zoom */
@media (max-width: 700px) {
  #ryddleAnswer {
    font-size: 1rem;
  }
  body {
    zoom: 1; 
  }
}

/* Prevent scrolling by fixing height and hiding overflow */
html, body {
  height: 100%;
  overflow-y: auto;
}

body {
  font-size: 1rem;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

@media (min-width: 576px) {
  body {
    zoom: 1.2;
  }
}

html[data-bs-theme="light"] body,
html[data-bs-theme="light"] #header-container,
html[data-bs-theme="light"] #footer,
html[data-bs-theme="light"] .modal-content {
  background-color: #e9ecef !important;
  color: #222831;
  box-shadow: none;
  border: none;
}

html[data-bs-theme="light"] .btn-dark,
html[data-bs-theme="light"] .btn-outline-light {
  background-color: #e3e6ea;
  color: #222831;
  border: 1px solid #bfc4c9;
}

html[data-bs-theme="light"] .btn-dark:hover,
html[data-bs-theme="light"] .btn-outline-light:hover {
  background-color: #d1d5db;
  color: #111;
}

body, #header-container, #footer, .modal-content {
  transition: background-color 0.3s, color 0.3s;
}

/* Fixed header for the title */
#header-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  text-align: center;
  padding: 10px 0;
  background: inherit;
  z-index: 1000;
}

#title {
  display: block;
  margin: 0;

}

#main-content {
  margin-top: 120px; /* This should provide enough space for the header */
  height: calc(100% - 120px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#content-wrapper {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* We don't need these styles anymore as the buttons are now in the header */
/* .fixed-btn {
  position: fixed;
  top: 10px;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  z-index: 1200;
  cursor: pointer;
}

#about-nav.fixed-btn {
  left: 10px;
}

#theme-toggle.fixed-btn {
  right: 10px;
} */

/* Adjust button styling for header placement */
#about-nav, #theme-toggle {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  cursor: pointer;
  z-index: 1200;
}

@media (max-width: 768px) {
  #title {
    font-size: 2.5rem; /* Smaller title on mobile */
  }
  
  #about-nav, #theme-toggle {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
  }
}

/* Play button styling */
#play-button {
  font-size: 1.5rem;
  padding: 0.75rem 1.5rem;
  transition: opacity .5s ease-out;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  touch-action: manipulation;
}

.fade-out {
  opacity: 0;
  transition: opacity 1s ease-out;
}

/* Answer container: forces enough width for full placeholder */
.answer-container {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

#ryddleAnswer::placeholder {
  font-size: 1.2rem;
  white-space: nowrap;
}

@media (max-width: 576px) {
  #ryddleAnswer::placeholder {
     font-size: 1rem;
  }
}

/* Reserve space for error/result messages */
#result-message {
  min-height: 50px;
  padding: 1rem;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
  border-radius: 5px;
  margin-bottom: 0;
  transition: all 0.3s ease;
}

/* Styles for success/error messages */
#result-message.celebrate,
#result-message.fail {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 1rem;
}

#result-message.celebrate h2,
#result-message.fail h2 {
  margin: 0;
  padding: 0;
  font-size: 1.25rem;
  font-weight: normal;
  letter-spacing: 0.4px;
  line-height: 1.5;
}

#error-counter, #incorrect-guesses {
  min-height: 30px;
}

/* Animations */
@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(calc(-1 * var(--shake-amt, 5px))); }
  50% { transform: translateX(var(--shake-amt, 5px)); }
  75% { transform: translateX(calc(-1 * var(--shake-amt, 5px))); }
  100% { transform: translateX(0); }
}

.shake {
  animation: shake 0.5s;
}

@keyframes pop {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.check-animation {
  animation: pop 0.5s ease-out;
}

.error-mark {
  font-weight: bolder;
  color: red;
  border: 2px solid red;
  background-color: inherit;
  padding: 2px 4px;
  margin-right: 0.2rem;
  display: inline-block;
  font-size: 1.5rem;
  border-radius: 0.25rem;
}

html[data-bs-theme="dark"] .incorrect-guess {
  color: #ffb3b3;
}

html[data-bs-theme="light"] .incorrect-guess {
  color: #4a0505;
}

.fail {
  background: linear-gradient(145deg, rgba(220, 53, 69, 0.7), rgba(245, 60, 60, 0.6));
  color: white;
  padding: 24px 28px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.95);
}

.celebrate {
  background: linear-gradient(145deg, rgba(40, 167, 69, 0.7), rgba(52, 199, 89, 0.6));
  border-radius: 12px;
  padding: 24px 28px;
  color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.duplicate {
  background: rgba(255, 193, 7, 0.8);
  color: black;
  padding: 0.5rem;
  border-radius: 5px;
  transition: opacity 0.5s ease;
}

@keyframes fadeInOverlay {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

.fade-in-overlay {
  animation: fadeInOverlay 0.8s forwards;
}

@keyframes fadeOutOverlay {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

.fade-out-overlay {
  animation: fadeOutOverlay 0.8s forwards;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(52,58,64,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
}

.hint-box {
  background-color: #343a40;
  color: #fff;
  padding: 1rem;
  border-radius: 8px;
  max-width: 300px;
  text-align: center;
}

.hint-btn {
  background-color: #555;
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  margin: 0.5rem;
  cursor: pointer;
  border-radius: 4px;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  touch-action: manipulation;
}

.hint-btn:hover {
  background-color: #666;
}

.fade-in {
  opacity: 0;
  animation: fadeIn 2s ease forwards;
}

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

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

.fade-out-up {
  animation: fadeOutUp 0.8s forwards;
}

#versionNumber {
  font-size: 13px;
  padding-right: 1em;
  padding-top: 1em;
}

/* Light mode styles */
html[data-bs-theme="light"] .my-element {
  color: #223078;
  font-weight: bold;
}

/* Dark mode styles */
html[data-bs-theme="dark"] .my-element {
  color: #fff;
  font-weight: normal;
}

#footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 10px;
  background-color: transparent;
  font-size: 0.7rem;
  z-index: 1000;
}

html[data-bs-theme="light"] #footer {
  color: #222831;
}

html[data-bs-theme="dark"] #footer {
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
}

/* Optional: style the right-side text or any link inside it */
#footer .footer-right p {
  margin: 0;
}

.feedback-link {
  font-size: 0.8rem;
  text-decoration: none;
}

html[data-bs-theme="light"] .feedback-link {
  color: #222831 !important;
}

html[data-bs-theme="dark"] .feedback-link {
  color: #6c757d !important;
}

/* Top notification for clipboard copy */
.clipboard-notification {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #555;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.85rem;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

html[data-bs-theme="light"] .clipboard-notification {
  background-color: #444;
  color: white;
}

.clipboard-notification.show {
  opacity: 1;
}

/* Game layout - strict container structure */
.game-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
}

/* Score-share container - the overall flex container */
.score-share-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin: 15px auto;
  flex-wrap: nowrap;
}

/* Score container - transparent */
#score-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
  text-align: center;
  height: 36px; /* Match height with share button */
}

/* Score display without container background */
.score-display {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  padding: 4px 8px;
  margin: 10px 0;
  box-shadow: none;
}

html[data-bs-theme="light"] .score-display {
  background: none;
  box-shadow: none;
}

.score-x, .score-check, .score-empty {
  display: inline-block;
  width: 22px;
  height: 22px;
  margin: 0 3px;
  border-radius: 2px;
  border: 1px solid #555;
  background-color: transparent;
}

/* CSS for the timer container */
.timer-container {
  font-size: 0.9rem;
  color: #6c757d;
  margin: 5px 0 15px 0;
  font-weight: normal;
  letter-spacing: 0.5px;
}

#header-container .timer-container {
  margin-top: -10px;
  margin-bottom: 20px;
}

/* X styling - just a colored square */
.score-x {
  background-color: #dc3545;
  border-color: #dc3545;
  color: transparent;
}

/* Checkmark styling - just a colored square */
.score-check {
  background-color: #28a745;
  border-color: #28a745;
  color: transparent;
}

/* Empty slot - just an empty square outline */
.score-empty {
  border: 1px solid #555;
  background-color: transparent;
}

/* Light mode adjustments */
html[data-bs-theme="light"] .score-x,
html[data-bs-theme="light"] .score-check,
html[data-bs-theme="light"] .score-empty {
  border-color: #6c757d;
}

/* Share container and button styling */
#share-container {
  margin: 0;
  text-align: center;
}

/* Share button styling adjusted for inline display */
.share-score-btn {
  margin-top: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  background-color: #343a40;
  color: #adb5bd;
  border: 1px solid #6c757d;
  font-size: 0.8rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  cursor: pointer;
}

.share-score-btn:hover {
  background-color: #495057;
  color: #fff;
}

html[data-bs-theme="light"] .share-score-btn {
  background-color: #e2e2e2;
  color: #495057;
}

html[data-bs-theme="light"] .share-score-btn:hover {
  background-color: #ced4da;
}

/* iOS-specific button fixes */
button {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

/* Fix for iOS input and button issues */
input, button {
  touch-action: manipulation;
}

/* Ensure buttons are actually clickable on mobile */
.btn {
  min-height: 44px; /* Apple's recommended minimum touch target size */
}

/* Fix for iOS button padding */
@supports (-webkit-touch-callout: none) {
  .btn {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }
}

/* Improved button styling for hover AND active states */
.btn-dark:hover, .btn-outline-light:hover,
.btn-dark:active, .btn-outline-light:active,
.btn-dark:focus, .btn-outline-light:focus {
  background-color: rgba(52, 58, 64, 0.8); /* Slightly lighter but still dark */
  color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
  transition: all 0.2s ease;
  border-color: rgba(255, 255, 255, 0.2); /* Subtle border */
}

/* Additional focus state to avoid white outlines */
.btn:focus, .btn:active:focus {
  outline: none !important;
  box-shadow: 0 0 0 0.2rem rgba(130, 138, 145, 0.3) !important; /* Dark subtle glow instead of white */
}

/* Target all interactive states */
.btn-dark:hover, .btn-dark:active, .btn-dark:focus,
.btn-outline-light:hover, .btn-outline-light:active, .btn-outline-light:focus,
.btn-dark:not(:disabled):not(.disabled):active,
.btn-outline-light:not(:disabled):not(.disabled):active {
  background-color: rgba(52, 58, 64, 0.8) !important;
  color: rgba(255, 255, 255, 0.95) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2) !important;
}

/* Override Bootstrap's focus styling */
.btn-dark:focus, .btn-dark:active:focus,
.btn-outline-light:focus, .btn-outline-light:active:focus,
.btn:focus, .btn.focus {
  box-shadow: 0 0 0 0.2rem rgba(52, 58, 64, 0.5) !important;
  outline: none !important;
}

/* iOS-specific styles */
body {
  /* Prevent iOS tap highlight */
  -webkit-tap-highlight-color: transparent;
  /* Prevent overscroll bounce */
  overscroll-behavior: none;
}

/* Adjust for iOS notches and safe areas */
#header-container {
  padding-top: env(safe-area-inset-top);
}

#footer {
  padding-bottom: env(safe-area-inset-bottom);
}

/* Make the footer logo black in light mode */
html[data-bs-theme="light"] #footer img {
  filter: none;
  color: #222831;
}

html[data-bs-theme="dark"] #footer img {
  filter: none;
  color: #fff;
}

/* Subtle, modern highlight for main action buttons in light mode */
html[data-bs-theme="light"] #about-nav,
html[data-bs-theme="light"] #play-button {
  background-color: #f8f9fa;
  color: #222831;
  border: 1.5px solid #d1d5db;
  box-shadow: 0 1px 4px rgba(60,60,60,0.06);
  font-weight: 500;
  transition: background 0.18s, box-shadow 0.18s, border 0.18s;
}
html[data-bs-theme="light"] #about-nav:hover,
html[data-bs-theme="light"] #play-button:hover {
  background-color: #ececec;
  border-color: #bfc4c9;
  box-shadow: 0 2px 8px rgba(60,60,60,0.10);
  color: #111;
}

html[data-bs-theme="light"] #ryddleAnswer {
  background-color: #e9ecef;
  border: 1px solid #bfc4c9;
  color: #222831;
}

html[data-bs-theme="light"] #ryddleAnswer:focus {
  background-color: #e9ecef;
  border-color: #bfc4c9;
  box-shadow: 0 0 0 0.2rem rgba(191, 196, 201, 0.25);
}

@keyframes inputFocus {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

#ryddleAnswer {
  transition: all 0.2s ease;
}

#ryddleAnswer:focus {
  animation: inputFocus 0.3s ease;
  transform-origin: center;
}

html[data-bs-theme="light"] #ryddleAnswer:focus {
  background-color: #e9ecef;
  border-color: #bfc4c9;
  box-shadow: 0 0 0 0.2rem rgba(191, 196, 201, 0.25);
}

html[data-bs-theme="dark"] #ryddleAnswer {
  background-color: #343a40;
  border: 1px solid #495057;
  color: #fff;
}

html[data-bs-theme="dark"] #ryddleAnswer:focus {
  background-color: #343a40;
  border-color: #495057;
  box-shadow: 0 0 0 0.2rem rgba(73, 80, 87, 0.25);
  animation: inputFocus 0.3s ease;
  transform-origin: center;
}

html[data-bs-theme="light"] .footer-logo {
  color: #222831;
}
html[data-bs-theme="dark"] .footer-logo {
  color: #fff;
}


/* Privacy modal styling to match your theme system */
.privacy-section {
  margin-bottom: 1.5rem;
}

.privacy-highlight {
  background-color: rgba(40, 167, 69, 0.1);
  border-left: 3px solid #28a745;
  padding: 0.75rem;
  margin: 1rem 0;
  border-radius: 0.25rem;
}

.data-type {
  font-weight: 600;
  color: #4fc3f7;
}

/* Light mode adjustments for privacy modal */
html[data-bs-theme="light"] .privacy-highlight {
  background-color: rgba(40, 167, 69, 0.05);
  border-left-color: #198754;
}

html[data-bs-theme="light"] .data-type {
  color: #0277bd;
}