body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    text-align: center;
    background-color: #f0f8ff;
    margin: 0;
    padding: 20px 20px 140px;

  }

[data-router-slot] {
  display: contents;
}
html, body {
  touch-action: pan-x pan-y;
  overscroll-behavior: none;
}

html {
  scroll-padding-bottom: 140px;
}

* {
  touch-action: manipulation;
}


  h1 {
    color: #ff6347;
    margin-bottom: 10px;
  }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

  #developerCredit {
    font-size: 15px;
    margin-top: 15px;
    color: #555;
    font-style: italic;
  }
  canvas {
    border: 5px solid #4682b4;
    border-radius: 50%;
    background: #e0ffff;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    margin-bottom: 10px;
    display: block;
    margin-left: auto;
    margin-right: auto;

  }
  .home-welcome {
    max-width: 520px;
    margin: 18px auto 28px;
    font-size: 16px;
    color: #455a64;
  }

  .practice-page {
    max-width: 960px;
    margin: 0 auto;
    padding-bottom: 20px;
  }

  .practice-subtitle {
    max-width: 520px;
    margin: 12px auto 28px;
    font-size: 16px;
    color: #455a64;
  }

  .practice-note {
    max-width: 520px;
    margin: 20px auto 0;
    font-size: 15px;
    color: #546e7a;
    font-style: italic;
  }
  #answerDisplay {
  width: 100%;
  max-width: 335px;               /* Match typing input width */
  height: 50px;              /* Fixed height */
  display: flex;
  align-items: center;        /* Center vertically */
  justify-content: center;    /* Center horizontally */
  font-weight: bold;
  color: #2c3e50;
  background: #fefefe;
  border-radius: 10px;
  border: 2px solid #2c3e50;
  margin: 15px auto;
  box-shadow: 0 3px 6px rgba(0,0,0,0.2);
  overflow: hidden;           /* Prevent text overflow */
  text-align: center;
  padding: 10px;
  box-sizing: border-box;
}

  /* NEW: slightly larger and spaced letters for hyphenated view */
  .letters {
  letter-spacing: 0.05em;
  font-size: 30px;
  display: block;
  width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
  .control-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 700px;
    margin: 0 auto 15px auto;
    flex-wrap: wrap;
  }
  .control-left, .control-right {text-align: center; }
  .control-left { text-align: left; }
  .control-right { text-align: center; }
  
/* Base button style */
button {
  margin: 5px;
  padding: 12px 20px;
  font-size: 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  min-width: 140px;   /* consistent width */
  min-height: 45px;   /* consistent height */
  color: white;
  text-align: center;
}

#spinButton{
min-width: 335px;
min-height: 60px;

}  

select {
  padding: 6px 10px;
  font-size: 15px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background-color: white;
}

.footer-icon-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
  margin: 0 auto 4px auto;
  border-radius: 50%;
}

/* === Active Footer Button Highlight === */
.footer-item.active-page {
  position: relative;
  color: #00b56a;
  font-weight: 600;
  transform: translateY(-2px);
  border: 2px solid #00b56a;
  border-radius: 12px;
  background-color: rgba(0, 181, 106, 0.08);
  transition: all 0.25s ease;
}

.footer-item.active-page .footer-icon,
.footer-item.active-page .footer-icon-img {
  filter: drop-shadow(0 0 6px rgba(0, 181, 106, 0.5));
  transform: scale(1.05);
}

.footer-item.active-page .footer-label {
  color: #00b56a;
}

/* Optional subtle hover effect for the active one */
.footer-item.active-page:hover {
  background-color: rgba(0, 181, 106, 0.15);
  box-shadow: 0 0 6px rgba(0, 181, 106, 0.4);
}

/* Keep the two definition buttons on one line (even on phones) */
.definition-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
}

/* Style only those two buttons inside .definition-buttons */
.definition-buttons .green-btn {
  flex: 0 1 auto;
  max-width: 168px;
  padding: 10px 10px;
  font-size: 15px;
  white-space: nowrap;
}

/* Color variations */
.blue-btn { background-color: #007bff; }
.blue-btn:hover { background-color: #0056b3; }

.teal-btn { background-color: #17a2b8; }
.teal-btn:hover { background-color: #117a8b; }

.green-btn { background-color: #28a745; }
.green-btn:hover { background-color: #218838; }

.red-btn { background-color: #dc3545; }
.red-btn:hover { background-color: #b52a37; }

  .dropdown-section { margin: 10px auto; width: 320px; text-align: left; }
  details {
    background: #ffffff;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 5px 10px rgba(0,0,0,0.1);
  }

.word-delete-btn {
  background-color: #dc3545;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 14px;
  margin-left: 10px;
  cursor: pointer;
  min-width: auto;
  min-height: auto;
}

.word-delete-btn:hover {
  background-color: #b52a37;
}

  summary { font-weight: bold; cursor: pointer; outline: none; }
  ul { list-style: none; padding: 0; margin-top: 8px; }
  li { margin: 4px 0; }
  li button { background: red; color: white; padding: 2px 6px; font-size: 12px; margin-left: 8px; }
  #wordCountLabel { font-weight: bold; color: #333; margin-top: 5px; display: block; font-size: 14px; }
  #categoryCountLabel { font-weight: bold; color: #666; margin-top: 5px; display: block; font-size: 12px; }
  .developer-info {
  bottom: 30px;
  font-size: 18px;
  color: #333;
  margin-bottom: 60px;
}
  .developer-info a { color: #007BFF; text-decoration: none; margin-left: 5px; cursor: pointer; }
  .developer-info a:hover { text-decoration: underline; }

  .modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); z-index: 999; }

  .modal-box {
    background: #fff; width: 65%; max-width: 750px; margin: 80px auto; padding: 20px; border-radius: 20px;
    text-align: left; position: relative; max-height: 75%; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    display: flex; flex-direction: column; align-items: center;
  }
  .close-btn { position: absolute; top: 15px; right: 20px; font-size: 30px; font-weight: bold; cursor: pointer; color: #333; }
  .close-btn:hover { color: red; }
  .modal-box h2 { text-align: center; margin-top: 0; }
  .modal-content { display: flex; gap: 20px; margin-top: 15px; align-items: flex-start; }
  .modal-content img { width: 180px; height: auto; border-radius: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.2); }
  .text-column { flex: 1; line-height: 1.6; font-size: 16px; color: #333; }
.message { padding: 10px; margin: 10px 0; border-radius: 5px; font-weight: bold; }

/* --- Category manager redesign --- */
.category-manager {
  max-width: 360px;
  width: 100%;
}

.category-manager details {
  background: #ffffff;
  padding: 15px 20px;
  border-radius: 12px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.category-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  font-size: 16px;
  list-style: none;
}

.category-stats {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  font-size: 13px;
  color: #444;
}

.category-stats span {
  display: block;
  font-weight: 500;
}

.category-manager-body {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.word-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.word-input-row input {
  flex: 1;
}

.category-input-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.category-input-row input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.category-manager details button {
  min-width: auto;
  min-height: auto;
  padding: 8px 12px;
  font-size: 14px;
}

.category-manager ul {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 180px;
  overflow-y: auto;
}

.category-manager li {
  background: #f9f9f9;
  margin: 0 0 6px 0;
  padding: 8px 12px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s ease;
  cursor: pointer;
}

.category-manager li:hover {
  background: #e8f5e9;
}

.category-manager li.selected {
  background-color: #c8e6c9;
  border: 1px solid #4caf50;
}

.category-delete-btn {
  background: transparent;
  border: none;
  color: #dc3545;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 8px;
}

.category-delete-btn:hover {
  color: #b52a37;
}

.category-footer {
  display: flex;
  justify-content: flex-end;
}
  .success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
  .error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
  .warning { background-color: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }

/* Mobile adjustments */
@media (max-width: 600px) {
  .modal-box {
    width: 90%;        /* take more space */
    margin: 40px auto; /* reduce margin */
    padding: 15px;     /* slightly smaller padding */
    border-radius: 15px;
  }

  .modal-box h2 {
    font-size: 25px;   /* shrink heading */
  }

  .text-column {
    font-size: 14px;   /* make text more compact */
    line-height: 1.4;
  }
}

.timer-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
  margin-top: 10px;
}

.timer-buttons button {
  min-width: 80px !important;  
  max-width: 100px;
  padding: 8px 12px;           
  font-size: 14px;
}

#minutesInput,
#secondsInput {
  width: 72px;
  height: 56px;
  font-size: 28px;
  text-align: center;
  border: 2px solid #00c853;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
/* Custom Popup Styles */
.popup-overlay {
  display: none; /* hidden by default */
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

.popup-box {
  background: #fff;
  padding: 20px 25px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
  animation: fadeIn 0.3s ease-in-out;
}

.popup-box h2 {
  margin-bottom: 15px;
  color: #e63946;
  font-size: 20px;
}

.popup-box button {
  padding: 8px 16px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.popup-box button:hover {
  background: #0056b3;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}
/* Limit the word list height and make it scrollable */
#wordList {
  max-height: 200px;   
  overflow-y: auto;    
  padding-right: 5px;  
}

/* Optional: nicer scroll */
#wordList::-webkit-scrollbar {
  width: 6px;
}
#wordList::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}
#wordList::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 1.3rem;         /* make it bigger */
  font-weight: 600;          /* make it bolder */
  color: #4a148c;            /* deep purple tone */
  text-decoration: none;
  margin-top: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

.back-link:hover {
  color: #7b1fa2;            
  transform: translateY(-2px);
  text-decoration: underline;
}

.manager-panel {
  max-width: 335px;
  width: 100%;
  margin: 0 auto;
}

#tipsButton {
  display: block;
  width: 100%;
  max-width: 335px;
  margin: 10px auto;
}

.small-btn {
  padding: 6px 10px;
  font-size: 14px;
  min-width: 44px !important;   
  min-height: 32px !important;  
  width: auto;                   
}
/* --- Countdown message + circle style (text left, circle+speaker right) --- */
.countdown-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  box-sizing: border-box;
  padding: 0 42px 0 10px; /* reserve space for speaker on the right */
}

.countdown-message {
  font-size: 17px;
  font-weight: 600;
  color: #2c3e50;

  flex: 1 1 auto;          /* key: message takes remaining space */
  min-width: 0;            /* key: allows ellipsis to work */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  padding-left: 12px;      /* gives it breathing room from border */
  text-align: left;
}

.countdown-circle {
  position: relative;
  width: 45px;
  height: 45px;
  flex: 0 0 auto;          /* never squish */
}

.countdown-circle svg {
  width: 45px;
  height: 45px;
  transform: rotate(-90deg);
  display: block;
}

.countdown-circle circle {
  fill: none;
  stroke-width: 4;
  transition: stroke-dashoffset 1s linear;
}

.countdown-circle circle.bg {
  stroke: #ddd;
}

.countdown-circle circle.progress {
  stroke: #007bff;
  stroke-linecap: round;
}

.countdown-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  font-weight: bold;
  color: #333;
}
.countdown-speak-btn {
  min-width: 0 !important;
  min-height: 0 !important;
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  margin: 0 !important;

  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);

  border-radius: 50% !important;
  border: 2px solid #cfd8dc !important;
  background: #fff !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  font-size: 14px !important;
  line-height: 1 !important;
  cursor: pointer;
  flex-shrink: 0;
}

.countdown-speak-btn:active {
  transform: translateY(-50%) scale(0.96);
}

/* --- Fade-in animation for revealed word --- */
.fade-in {
  opacity: 0;
  animation: fadeIn 1.2s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.word-interaction-wrapper {
  position: relative;
  width: 100%;
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#typingBoxContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
  width: 100%;
}

.typing-box {
  background: #fff;
  border: 2px solid #333;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px 56px 14px 16px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  box-sizing: border-box;
  min-height: 68px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  width: 100%;
  max-width: 335px;
}

.typing-box input[type="text"],
#spellingInput {
  font-size: 20px;
  padding: 10px 12px;
  border: 2px solid #888;
  border-radius: 8px;
  outline: none;
  text-align: center;
  width: 100%;
  max-width: 335px;
  transition: border-color 0.3s ease, background-color 0.3s ease;
  z-index: 1;
  box-sizing: border-box;
}

.correct-input {
  border-color: #28a745 !important;
  background-color: #d4edda !important;
}

.wrong-input {
  border-color: #dc3545 !important;
  background-color: #f8d7da !important;
}

#feedbackMessage {
  font-family: "Segoe UI", sans-serif;
  font-weight: 600;
  margin-top: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  text-align: center;
  line-height: 1.25;
  width: calc(100% - 72px);
  max-width: 100%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 2;
  box-sizing: border-box;
}

#feedbackMessage.success {
  color: #28a745;
}

#feedbackMessage.error {
  color: #dc3545;
}

.typing-box .typing-streak-badge {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #1f1f1f;
  pointer-events: none;
  transform: translateY(-50%);
  z-index: 3;
}

#dogOverlay {
  position: fixed;
  transform: translate(-50%, -50%);
  display: none;
  z-index: 9999;
  pointer-events: none;
}

/* 🐾 Dog glow and fade animation */
#dogOverlay img {
  width: 130px;
  height: auto;
  border-radius: 50%;
  animation: dogFade 2s ease-in-out, dogGlow 2s ease-in-out;
  box-shadow: 0 0 0 rgba(255, 255, 255, 0);
}

@keyframes dogFade {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
}

@keyframes dogGlow {
  0% { box-shadow: 0 0 0 rgba(255, 255, 255, 0); }
  20% { box-shadow: 0 0 30px rgba(255, 255, 255, 0.8); }
  80% { box-shadow: 0 0 30px rgba(255, 255, 255, 0.8); }
  100% { box-shadow: 0 0 0 rgba(255, 255, 255, 0); }
}
#spinButton:disabled {
  background: #5b8efc !important;
  opacity: 0.7 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.setting-group {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 130px;
}

.setting-group label {
  margin-bottom: 6px;
  font-weight: 600;
  text-align: left;
}

.setting-group select {
  width: 100%;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background-color: #fff;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  width: 100%;
}


@media (max-width: 480px) {
  .setting-row {
    flex-wrap: nowrap;
    gap: 10px;
  }

  .setting-group {
    flex: 1;
  }

  .setting-group select {
    font-size: 14px;
    padding: 5px;
  }
}

#resetButton {
  background-color: #dc3545 !important; /* red */
  flex: 0 0 auto !important;            /* don't stretch */
  min-width: auto !important;
  width: 80px !important;               /* compact size */
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1.1;
  height: auto;
  border-radius: 6px;
  text-align: center;
  cursor: pointer;
  margin-top: 5px;
  margin-left: auto;                    /* push to the right */
  margin-right: 0;
  display: block;                       /* ensure margin works */
}

#resetButton:hover {
  background-color: #a71d2a !important;
}

.floating-gear {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: #007bff;
  color: white;
  font-size: 1.5rem;
  padding: 10px 12px;
  border-radius: 50%;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: transform 0.2s ease, background 0.2s ease;
  z-index: 1000;
}

.floating-gear:hover {
  background: #0056b3;
  transform: rotate(30deg);
}
input[type="text"],
input[type="number"],
textarea {
  font-size: 16px;
}

#tutorialOverlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  pointer-events: none;
  display: none;
}

#tutorialOverlay.active {
  display: block;
  pointer-events: auto;
}

#tutorialBackdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: auto;
  z-index: 0;
}

#tutorialOverlay.active #tutorialBackdrop {
  opacity: 1;
}

#tutorialBubble {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.98);
  max-width: min(92vw, 340px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  padding: 24px 28px;
  color: #1f2937;
  font-size: 17px;
  line-height: 1.5;
  opacity: 0;
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: auto;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 13000;
  text-align: center;
  max-height: min(90vh, 420px);
}

#tutorialOverlay.active #tutorialBubble {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.tutorial-message {
  font-weight: 500;
  color: #1f2937;
  text-align: center;
}

.tutorial-controls {
  display: flex;
  justify-content: flex-end;
}


.tutorial-next-btn {
  background: linear-gradient(135deg, #ff9f43, #1fb6ff);
  border: none;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(255, 132, 75, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tutorial-next-btn:hover,
.tutorial-next-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(255, 132, 75, 0.38);
  outline: none;
}

.page-tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 14000;
  display: none;
  pointer-events: none;
}

body.page-tutorial-locked {
  overflow: hidden;
}

.page-tutorial-overlay.is-visible {
  display: block;
  pointer-events: auto;
}

.page-tutorial-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.page-tutorial-overlay.is-visible .page-tutorial-backdrop {
  opacity: 1;
}

.page-tutorial-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  max-width: min(92vw, 360px);
  width: calc(100% - 40px);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
  padding: 28px 26px 22px;
  opacity: 0;
  transition: opacity 0.28s ease, transform 0.28s ease;
  display: flex;
  flex-direction: column;
  gap: 18px;
  color: #1f2937;
  z-index: 15000;
  text-align: center;
}

.page-tutorial-overlay.is-visible .page-tutorial-dialog {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.page-tutorial-progress {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #2563eb;
  text-transform: uppercase;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.page-tutorial-progress.is-transitioning {
  opacity: 0;
  transform: translateY(6px);
}

.page-tutorial-message {
  font-size: 17px;
  line-height: 1.55;
  font-weight: 500;
  color: #1f2937;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.page-tutorial-message.is-transitioning {
  opacity: 0;
  transform: translateY(6px);
}

.page-tutorial-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.page-tutorial-skip {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 10px;
  transition: color 0.2s ease;
}

.page-tutorial-skip:hover,
.page-tutorial-skip:focus-visible {
  color: #1f2937;
  outline: none;
}

.page-tutorial-close {
  background: transparent;
  border: none;
  color: #2563eb;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  align-self: center;
  padding: 6px 12px 4px;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.page-tutorial-close:hover,
.page-tutorial-close:focus-visible {
  color: #1f2937;
  border-color: rgba(37, 99, 235, 0.4);
  outline: none;
}

@media (max-width: 420px) {
  .page-tutorial-dialog {
    padding: 24px 22px 20px;
    gap: 16px;
  }

  .page-tutorial-message {
    font-size: 16px;
  }

  .page-tutorial-controls {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 10px;
  }

  .page-tutorial-skip {
    align-self: center;
  }
}


.tutorial-highlight {
  position: relative;
  z-index: 12005 !important;
  animation: soft-glow 2s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes soft-glow {
  0%, 100% {
    box-shadow: 0 0 0px 0px rgba(255, 215, 0, 0);
  }
  50% {
    box-shadow: 0 0 20px 6px rgba(255, 215, 0, 0.6);
  }
}

#tutorialTriggerBtn {
  position: fixed;
  bottom: 25px;
  right: -40px;
  border: none;
  background: none;
  color: #ffd700;
  font-size: 36px;
  cursor: pointer;
  transition: transform 0.2s ease, color 0.2s ease;
  z-index: 9999;
  padding: 0;
  line-height: 1;
}

#tutorialTriggerBtn:hover,
#tutorialTriggerBtn:focus-visible {
  transform: scale(1.2);
  color: #ffea00;
  outline: none;
}

#tutorialTriggerBtn:active {
  transform: scale(0.95);
}

.tutorial-pointer {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 12009;
}

.tutorial-pointer-line {
  stroke: rgba(255, 188, 66, 0.8);
  stroke-width: 3;
  stroke-linecap: round;
}

.tutorial-pointer-arrow {
  fill: rgba(255, 188, 66, 0.8);
}

@media (max-width: 480px) {
  #tutorialBubble {
    top: 45%;
    font-size: 15px;
    padding: 18px 20px;
  }

  #tutorialTriggerBtn {
    bottom: 15px;
    font-size: 24px;
  }

  #spellingInput,
  .typing-box input[type="text"] {
    font-size: 18px;
  }
}

@media (max-width: 320px) {
  #tutorialBubble {
    font-size: 14px;
    padding: 16px 18px;
  }

  #tutorialTriggerBtn {
    font-size: 22px;
  }
}
/* Celebration message overlay — fixed position version */
.celebration-message-overlay {
  position: absolute;
  top: 8%;
  left: 50%;
  transform: translateX(-50%);
  width: 330px;
  min-height: 145px;
  background: rgba(255, 255, 255, 0.98);
  border: 5px solid #00c853;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0, 200, 83, 0.6);
  text-align: center;
  font-family: "Poppins", "Segoe UI", sans-serif;
  font-weight: 600;
  font-size: 1.4rem;
  color: #1a1a1a;
  line-height: 1.4;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: auto;
}
.celebration-message-overlay button {
  pointer-events: auto;
}

.celebration-message-overlay.show {
  opacity: 1;
  animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
  0% { box-shadow: 0 0 10px rgba(0, 200, 83, 0.4); }
  50% { box-shadow: 0 0 25px rgba(0, 200, 83, 0.7); }
  100% { box-shadow: 0 0 10px rgba(0, 200, 83, 0.4); }
}


.footer-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  border-top: 3px solid #00c853;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(6px);
  z-index: 1200;
}

.footer-buttons {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 6px;
  padding: 8px 12px;
}

.footer-item {
  flex: 1 1 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  color: #444;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px 4px;
  min-width: 0;
  transition: transform 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  border-radius: 14px;
}

.footer-icon {
  font-size: 26px;
  line-height: 1;
}

.footer-label {
  font-size: 11px;
  letter-spacing: 0.02em;
}

.footer-item:hover,
.footer-item:focus-visible {
  color: #2979ff;
  background: rgba(41, 121, 255, 0.08);
  box-shadow: 0 0 12px rgba(41, 121, 255, 0.35);
  transform: translateY(-2px) scale(1.05);
  outline: none;
}

.footer-item:active {
  transform: translateY(0) scale(0.98);
}

@media (max-width: 520px) {
  .footer-buttons {
    gap: 2px;
    padding: 6px 4px 4px;
  }

  .footer-item {
    font-size: 11px;
    padding: 6px 2px;
  }

  .footer-icon {
    font-size: 24px;
  }
}

#studyTimerCard.footer-timer-highlight {
  box-shadow: 0 0 0 3px rgba(41, 121, 255, 0.25), 0 0 14px rgba(41, 121, 255, 0.45);
  animation: footerTimerPulse 1.6s ease-in-out 2;
}

@keyframes footerTimerPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

body.page-fade-in,
body.page-fade-out {
  animation: none !important;
  opacity: 1 !important;
}

#typingBoxContainer {
  min-height: 90px;
}

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

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

.version-label {
  max-width: 900px;
  margin: 40px auto 110px;
  text-align: right;
  font-size: 12px;
  color: #888;
  font-weight: 500;
}

.timer-message {
  max-width: 320px;
  margin: 12px auto 0;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(41, 121, 255, 0.08);
  color: #1a3b7a;
  text-align: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  transition: opacity 0.3s ease;
}

.timer-message.error {
  background: rgba(220, 53, 69, 0.12);
  color: #7a1c24;
}

#timeUpPopup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

#timeUpPopup .popup-box {
  background: #fff;
  padding: 24px 28px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

#timeUpPopup button {
  margin-top: 16px;
  padding: 10px 20px;
  font-size: 15px;
  border-radius: 8px;
  border: none;
  background: #00c853;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s ease;
}

#timeUpPopup button:hover,
#timeUpPopup button:focus-visible {
  background: #00a444;
  outline: none;
}

.page-card {
  max-width: 420px;
  margin: 0 auto 90px;
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.12);
  padding: 28px 32px 36px;
  text-align: center;
}

.timer-inputs {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 14px;
}

.timer-inputs input {
  width: 72px;
  height: 56px;
  font-size: 28px;
  border-radius: 14px;
  border: 2px solid #00c853;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.timer-inputs input:focus {
  outline: none;
  border-color: #2979ff;
  box-shadow: 0 0 0 3px rgba(41, 121, 255, 0.25);
}

.timer-card .timer-buttons {
  margin-top: 6px;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 18px;
}

.feedback-form textarea {
  min-height: 140px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #cfd8dc;
  font-size: 15px;
  resize: vertical;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.05);
}

.feedback-form textarea:focus {
  outline: none;
  border-color: #2979ff;
  box-shadow: 0 0 0 3px rgba(41, 121, 255, 0.18);
}

.feedback-links {
  margin-top: 14px;
  font-size: 14px;
  color: #555;
}

.feedback-links a {
  color: #2979ff;
  font-weight: 600;
  text-decoration: none;
}

.feedback-links a:hover,
.feedback-links a:focus-visible {
  text-decoration: underline;
  outline: none;
}

/* --- Home page guide cards --- */
.home-info {
  max-width: 960px;
  margin: 32px auto 110px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.home-card {
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
  padding: 26px 28px 32px;
  line-height: 1.7;
}

.home-card h2 {
  margin-top: 0;
  color: #0d47a1;
}

.home-card h3 {
  margin-top: 26px;
  color: #1565c0;
}

.home-step-list,
.home-tip-list,
.home-rule-list,
.home-memory-list {
  margin: 16px 0 0;
  padding-left: 22px;
  color: #2f3b52;
}

.home-step-list li,
.home-tip-list li,
.home-rule-list li,
.home-memory-list li {
  margin-bottom: 10px;
}

.home-step-list li strong,
.home-tip-list li strong,
.home-rule-list li strong,
.home-memory-list li strong {
  color: #0d47a1;
}

.home-highlight {
  margin-top: 24px;
  padding: 14px 18px;
  border-radius: 14px;
  background: #f1f7ff;
  border-left: 4px solid #1976d2;
  color: #1a2a4a;
}

@media (min-width: 900px) {
  .home-info {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* --- Tutorial modal --- */
.tutorial-guide-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 29, 57, 0.48);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 3500;
  padding: 20px;
}

.tutorial-guide-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.tutorial-guide-dialog {
  background: #ffffff;
  width: min(420px, 100%);
  border-radius: 20px;
  box-shadow: 0 22px 45px rgba(14, 35, 95, 0.22);
  padding: 28px 28px 24px;
  transform: translateY(14px);
  transition: transform 0.25s ease;
}

.tutorial-guide-overlay.is-visible .tutorial-guide-dialog {
  transform: translateY(0);
}

.tutorial-guide-title {
  margin: 0 0 14px;
  font-size: 1.4rem;
  color: #0d47a1;
}

.tutorial-guide-content {
  color: #2f3b52;
  line-height: 1.65;
}

.tutorial-guide-content p {
  margin: 0 0 14px;
}

.tutorial-guide-content ul {
  margin: 0 0 14px 20px;
  padding: 0;
}

.tutorial-guide-content li {
  margin-bottom: 8px;
}

.tutorial-guide-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 8px;
  padding: 12px;
  font-weight: 600;
  font-size: 15px;
  border-radius: 12px;
  border: none;
  background: #007bff;
  color: #ffffff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.tutorial-guide-close:hover,
.tutorial-guide-close:focus-visible {
  background: #005ecb;
  outline: none;
}

body.android[data-page="home"] h1 {
  font-size: 24px !important;
}

body.android[data-page="practice"] h1 {
  font-size: 24px !important;
}

/* Android: smaller wheel */
body.android canvas {
  width: 250px !important;
  height: 250px !important;
}