/* ============================================ */
/* VARIABLES & RESET */
/* ============================================ */
:root {
  --nyt-green: #6aaa64;
  --nyt-gray: #787c7e;
  --nyt-light-gray: #d3d6da;
  --nyt-dark: #121213;
  --nyt-white: #f7f7f7;
  --border-light: #e0e0e0;
  --box-bg-light: #3498db;
  --bg-light: #f7f7f7;
  --text-dark: #121213;
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  --error-bg: #f8d7da;
  --error-text: #842029;
  --available-key-bg: #666;
  --coffee-light: #f4ede2;
  --coffee-dark: #423232;
  --coffee-accent: #8B7355;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg-light);
  margin: 0;
  padding: 0;
  color: var(--text-dark);
  transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
  background: #18181a;
  color: var(--nyt-white);
}

.page-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 3rem;
  /* padding: 1rem; */
  /* min-height: calc(100vh - 80px); */
}

.signin-container {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 6px 15px rgba(0,0,0,0.08);
  width: 350px;
  transition: all 0.3s ease;
}

body.dark-mode .signin-container {
  background: #2f3247;
  border-color: #333;
  box-shadow: 0 6px 15px rgba(0,0,0,0.4);
}

.title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 900;
  margin-bottom: 1.5rem;
  color: #000;
  transition: color 0.3s ease;
}

body.dark-mode .title {
  color: #e0e0e0;
}

.form-group {
  margin-bottom: 1.2rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #000;
  transition: color 0.3s ease;
}

body.dark-mode label {
  color: #e0e0e0;
}

input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid #000;
  border-radius: 7px;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.3s ease;
  background: #fff;
  color: #000;
}

body.dark-mode input {
  background: #1a1a2e;
  border-color: #333;
  color: #e0e0e0;
}

input:focus {
  border-color: #000;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.2);
}

body.dark-mode input:focus {
  border-color: #1a1a2e;
  box-shadow: 0 0 0 3px rgba(224,224,224,0.1);
}

.btn-submit {
  width: 100%;
  padding: 0.5rem;
  background: #adb5bd;
  color: #000;
  font-size: 1rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.3s ease;
}

body.dark-mode .btn-submit {
  background: #fffbf5;
  color: #1a1a2e;
}

.btn-submit:hover {
  background: #62676c;
}

body.dark-mode .btn-submit:hover {
  background: #8f8f8f;
}

.error {
  margin-top: 1rem;
  color: #dc2626;
  font-weight: 600;
  text-align: center;
  transition: color 0.3s ease;
}

body.dark-mode .error {
  color: #f87171;
}

.extra-links {
  margin-top: 1.5rem;
  text-align: center;
}

.extra-links p {
  margin: 0.5rem 0;
  font-size: 0.9rem;
  color: #000;
  transition: color 0.3s ease;
}

body.dark-mode .extra-links p {
  color: #e0e0e0;
}

.extra-links a {
  color: #000;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.3s ease;
}

body.dark-mode .extra-links a {
  color: #e0e0e0;
}

body.dark-mode .extra-links a:hover {
  color: #60a5fa;
}

/* Responsive design */
@media (max-width: 700px) {
  .page-wrapper {
    margin-top: 3rem;
    padding: 1rem;
  }
  
  .signin-container {
    width: 100%;
    max-width: 350px;
    padding: 1.5rem;
  }
  
  .title {
    font-size: 1.4rem;
  }
}

/* ============================================ */
/* HOW TO PLAY MODAL - TUTORIAL STYLES */
/* ============================================ */

/* Modal Base */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; 
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  font-size: 0.96rem;
  line-height: 1.5rem;
  padding: 1.2rem 1.15rem;
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #e3e6e9;
  color: #000;
  padding: 1.5rem;
  border-radius: 15px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
  position: relative;
}

body.dark-mode .modal-content {
  background: #1e1e1e;
  color: #e0e0e0;
}

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

/* Modal Header */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1rem;
  border-bottom: 1.5px solid #000;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #000;
  margin: 0;
}

body.dark-mode .modal-title {
  color: var(--coffee-light);
}

.modal-close-btn, .modal-close-hint-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 2rem;
  font-weight: bold;
  color: #333;
  cursor: pointer;
  background: transparent;
  border: none;
}

.modal-intro {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: #000;
}

body.dark-mode .modal-intro {
  color: var(--coffee-light);
}

/* Tutorial Steps & Dividers */
.tutorial-step {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
}

.tutorial-divider {
  border: 0;
  height: 1px;
  background: var(--coffee-light);
}

body.dark-mode .tutorial-divider {
  background: #333;
}

.step-content {
  flex: 1;
}

.step-title {
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: #000;
  line-height: 1.4;
}

body.dark-mode .step-title {
  color: var(--coffee-light);
}

.step-note {
  font-size: 0.85rem;
  margin-top: 0.8rem;
  color: #000;
  line-height: 1.5;
}

body.dark-mode .step-note {
  color: #aaa;
}

.step-description {
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
  color: #000;
  line-height: 1.5;
}

body.dark-mode .step-description {
  color: #bbb;
}

/* Orange Dot Indicators */
.orange-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: #e67e22;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.orange-dot-inline {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #e67e22;
  border-radius: 50%;
}

/* Modal Footer */
.modal-footer {
  padding: 0.5rem;
  display: flex;
  justify-content: center;
}

.got-it-btn {
  background: #e67e22;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: 'Nunito', sans-serif;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.got-it-btn:hover {
  background: #d35400;
}

/* ============================================ */
/* DEMO GAME UI - MATCHES MAIN GAME */
/* ============================================ */

.demo-game-ui {
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: center;
  width: 50%;
  margin: 15px auto;
}

/* Distance Side Line and Bubbles */
.demo-distance-side {
  position: relative;
  width: 50px;
  height: 150px;
  flex-shrink: 0;
}

.demo-distance-line {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 100%;
  background: #3498db; /* Default UI track line */
  border-radius: 2px;
}

.demo-distance-bubble {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 32px;
  background: #2ecc71; /* Matched game colors */
  background: #3498db;
  color: white;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.top-bubble { top: -5px; }
.bottom-bubble { bottom: -5px; }

.demo-indicator-dot {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  background: #e67e22;
  border: 2px solid white;
  border-radius: 50%;
  transition: top 0.3s;
}

/* Words Side Rows */
.demo-words-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.demo-word-row, .demo-guess-row {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.demo-game-box {
  width: 42px;
  height: 42px;
  background: #3498db;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  border-radius: 4px;
  text-transform: uppercase;
}

.demo-guess-input {
  width: 42px;
  height: 42px;
  background: #f3f3f3;
  border: 2px solid #bdc3c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  border-radius: 4px;
  text-transform: uppercase;
  color: #2c3e50;
}

body.dark-mode .demo-guess-input {
  background: #2a2a2a;
  border-color: #555;
  color: #e0e0e0;
}

/* Specific Step Styling Modifications */
.demo-updated {
  background: #3498db !important;
}

.demo-flash {
  background: #e67e22 !important;
  color: white !important;
  border-color: #e67e22 !important;
}

.demo-winner {
  background: #2ecc71 !important;
  color: white !important;
  border-color: #2ecc71 !important;
}

/* Responsive Handling */
@media (max-width: 550px) {
  .demo-game-ui {
    gap: 8px;
  }
  .demo-game-box, .demo-guess-input {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
  .demo-distance-bubble {
    width: 32px;
    height: 26px;
    font-size: 0.75rem;
  }
  .demo-distance-side {
    width: 36px;
    height: 115px;
  }
}

/* profile modal logout button */
.logout-btn {
  padding: 0.5rem 0.7rem;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
  background: #e9c257;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #000;
  transition: background 0.2s ease;
}

.logout-btn:hover {
  background: #62676c;
}

body.dark-mode .logout-btn {
  background: #e0e0e0;
  color: #2d2d44;
}

body.dark-mode .logout-btn:hover {
  background: #a19e9e;
}

/* ---------------------------------------------- */
/* Feedback Modal Styles */
.feedback-content {
  padding: 5px;
}

.feedback-header {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #b3bcc2;
}

.feedback-icon {
  background-color: #e0e3e5;
  color: #000;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 1.1rem;
}

.feedback-title {
  font-size: 1.4rem;
  font-weight: 900;
  margin: 0;
  color: #000;
}

.feedback-body {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 15px;
}

.feedback-options {
  margin: 15px 0;
  background-color: var(--bg-light, #f8f9fa);
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--border-color, #e0e0e0);
}

.feedback-option {
  display: flex;
  align-items: flex-start;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light, rgba(0,0,0,0.05));
}

.feedback-option:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.feedback-option i {
  color: #000;
  margin-right: 10px;
  margin-top: 2px;
  font-size: 1.1rem;
  min-width: 20px;
}

.feedback-option p {
  margin: 0;
  font-size: 0.9rem;
}

.feedback-note {
  background-color: #e0e3e5;
  padding: 10px;
  border-radius: 6px;
  margin: 15px 0;
  border-left: 3px solid #000;
  font-size: 0.9rem;
}

.feedback-actions {
  display: flex;
  justify-content: center;
  margin: 20px 0 10px;
}

.feedback-btn {
  padding: 12px 30px;
  border: 2px solid #000;
  border-radius: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #adb5bd;
  color: #000;
  min-width: 200px;
}

.feedback-btn:hover {
  background-color: #62676c;
}

.feedback-btn:active {
  transform: translateY(0);
}

/* Dark mode specific styles */
.dark-mode .feedback-title {
  color: var(--text-color-dark, #f0f0f0);
}

.dark-mode .feedback-icon {
  background-color: #fff;
  color: #2d2d44;
}

.dark-mode .feedback-icon i{
  color: #2d2d44;
}

.dark-mode .feedback-option i{
  color: #fff;
}

.dark-mode .feedback-options {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--border-dark, #4a5568);
}

.dark-mode .feedback-option {
  border-bottom-color: var(--border-dark-light, rgba(255,255,255,0.05));
}

.dark-mode .feedback-note {
  background-color: rgba(255, 255, 255, 0.1);
  border-left-color: var(--primary-color-dark, #4299e1);
}

.dark-mode .feedback-btn {
  background-color: #2d2d44;
  border: 2px solid #fff;
  color: #fff;
}

.dark-mode .feedback-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
}


/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 3px;
  transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.5);
}

body.dark-mode ::-webkit-scrollbar-thumb {
  background: rgba(224, 224, 224, 0.3);
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
  background: rgba(224, 224, 224, 0.5);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.3) transparent;
}

body.dark-mode * {
  scrollbar-color: rgba(224, 224, 224, 0.3) transparent;
}


/* Migration Overlay Styles */
.migration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.migration-loader {
    background: #ffffff;
    border-radius: 16px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.4s ease;
}

body.dark-mode .migration-loader {
    background: #2f3247;
    color: #e0e0e0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid #383737;
    border-top: 4px solid #aaa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

body.dark-mode .spinner {
    border: 4px solid rgba(224, 224, 224, 0.2);
    border-top: 4px solid #e0e0e0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

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

.migration-text h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.migration-text p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: #666;
}

body.dark-mode .migration-text p {
    color: #aaa;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    margin: 1rem 0;
    overflow: hidden;
}

body.dark-mode .progress-bar-container {
    background: #1a1a2e;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: #adb5bd;
    border-radius: 3px;
    transition: width 0.3s ease;
}

body.dark-mode .progress-bar {
    background: #e0e0e0;
}

.migration-note {
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
}

body.dark-mode .migration-note {
    color: #777;
}

.migration-overlay.hidden {
    display: none;
}