/* ============================================ */
/* 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);
}

/* 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: #adb5bd;
  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;
}

/* ============================================ */
/* THREE COLUMN LAYOUT */
/* ============================================ */
.three-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.left-container,
.right-container {
  background: transparent;
}

/* Game Container */
.game-container {
  grid-column: 2;
  width: 100%;
  max-width: 550px;
  padding-top: 1rem;
  background: transparent;
}

/* ============================================ */
/* HEADER */
/* ============================================ */
.header-with-menu {
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 0.75rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

body.dark-mode .header-with-menu {
  border-bottom-color: #333;
}

.header-title {
  font-family: 'Nunito', sans-serif;
  font-size: 1.5rem;
  font-weight: 900;
  margin: 0;
  color: #000;
  text-align: center;
}

body.dark-mode .header-title {
  background: linear-gradient(135deg, #00b4b4, #8e24d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.header-controls {
  position: absolute;
  right: 0;
}

/* ============================================ */
/* DROPDOWN MENU */
/* ============================================ */
.dropdown {
  position: relative;
}

.menu-button {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 50%;
  width: 2.2rem;
  transition: background 0.2s ease;
  color: inherit;
}

.menu-button:hover {
  background: #e3e6e9;
}

body.dark-mode .menu-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  margin-top: 0.5rem;
  background:#e3e6e9;
  color: #000;
  border: 1px solid #000;
  border-radius: 7px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  min-width: 180px;
  z-index: 1000;
  overflow: hidden;
}

body.dark-mode .dropdown-content {
  background: #1e1e1e;
  border-color: #333;
}

.dropdown-content a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.dropdown-content a:hover {
  background: #b5b8bc;
}

body.dark-mode .dropdown-content a:hover {
  background: rgba(255, 255, 255, 0.08);
}

.dropdown.open .dropdown-content {
  display: block;
}


/* Giveup Modal */
.giveup-btn {
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: 'Nunito', sans-serif;
  background: #adb5bd;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #000;
  transition: background 0.2s ease;
}

#giveup-yes-btn {
    margin-right: 1.5rem;
  }

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

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

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

/* Add to your CSS file */
#giveup-option.disabled {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* Create Game Modal Styles */
.create-game-header {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #000;
  text-align: left;
}

body.dark-mode .create-game-header {
  border-bottom-color: #e0e0e0;
}

.create-game-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  text-align: left;
  font-family: 'Nunito', sans-serif;
}

.create-game-description {
  text-align: left;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.4;
  font-family: 'Nunito', sans-serif;
}

body.dark-mode .create-game-description {
  color: #94a3b8;
}

.create-game-form {
  width: 100%;
  margin-bottom: 1rem;
}

.form-group {
  width: 100%;
  margin-bottom: 0.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.1rem;
  margin-left: 0.3rem;
  color: #000;
  font-size: 0.9rem;
  text-align: left;
  font-family: 'Nunito', sans-serif;
}

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

.create-game-input {
  width: 100%;
  padding: 0.35rem;
  border: 2px solid #000;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  background-color: #fff;
  color: #000;
  transition: border-color 0.3s;
  box-sizing: border-box;
  font-family: 'Nunito', sans-serif;
}

.create-game-input:focus {
  border-color: #fff;
}

body.dark-mode .create-game-input {
  background-color: #2d2d44;
  color: #e0e0e0;
  border: 2px solid #e0e0e0;
}

/* Create Game Actions */
.create-game-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
  width: 100%;
}

.create-game-submit-btn {
  width: 6.5rem;
  padding: 0.35rem 0.1rem;
  background-color: #adb5bd;
  color: #000;
  border: 0px solid #adb5bd;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: 'Nunito';
}

.create-game-submit-btn:disabled {
  background-color: #62676c;
  cursor: not-allowed;
}

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

body.dark-mode .create-game-submit-btn {
  background-color: #e0e0e0;
  border: 0.1px solid #e0e0e0;
  color: #2d2d44;
}

body.dark-mode .create-game-submit-btn:hover {
  background-color: #a19e9e;
}

/* Results section - appears inline after success */
.create-game-results {
  width: 100%;
  margin-top: 0.5rem;
  font-family: 'Nunito', sans-serif;
}

.create-game-results.hidden {
  display: none;
}

/* Game link section */
.game-link-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  color: #000;
  font-weight: 600;
  font-family: 'Nunito', sans-serif;
}

body.dark-mode .game-link-section h3 {
  color: #e0e0e0;
}

.link-label {
  color: #64748b;
  font-size: 0.9rem;
  margin: 0;
  font-weight: 500;
  font-family: 'Nunito', sans-serif;
}

body.dark-mode .link-label {
  color: #94a3b8;
}

.game-link-container {
  display: flex;
  background: #fff;
  border: 2px solid #000;
  border-radius: 8px;
  align-items: center;
}

body.dark-mode .game-link-container {
  background: #3a3a52;
  border: 2px solid #e0e0e0;
}

.game-link-input {
  flex: 1;
  border: none;
  background: transparent;
  color: #000;
  font-size: 0.95rem;
  padding: 0.35rem;
  outline: none;
  font-family: 'Nunito', sans-serif;
  font-weight: 500;
}

body.dark-mode .game-link-input {
  color: #e0e0e0;
}

.copy-link-btn {
  background: #000;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 0.4rem 1.2rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  font-family: 'Nunito', sans-serif;
  font-weight: 500;
  min-width: 80px;
}

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

.create-game-message.hidden {
  display: none;
}

/* ============================================ */
/* GAME INFO ROW */
/* ============================================ */
.game-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 2rem 0;
    color: #000;
    font-weight: 800;
    font-size: 0.9rem;
    padding: 0 2px;
    gap: 1rem;
}

/* Left - Game Date */
#game-date {
    flex: 1;
    text-align: left;
    color: #000;
    font-weight: 800;
    font-size: 0.9rem;
    padding: 0;
    margin: 0;
}

/* Center - Guess Count */
#guess-count {
    flex: 1;
    text-align: center;
    color: #000;
    font-weight: 800;
    font-size: 0.9rem;
    padding: 0;
    margin: 0;
}

/* Right - Game Number */
#game-number {
    flex: 1;
    text-align: right;
    color: #000;
    font-weight: 800;
    font-size: 0.9rem;
    padding: 0;
    margin: 0;
}

/* Dark mode styles */
body.dark-mode #game-date,
body.dark-mode #guess-count,
body.dark-mode #game-number {
    color: #e0e0e0;
}

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

/* Responsive adjustments */
@media (max-width: 550px) {
    #game-date,
    #guess-count,
    #game-number {
        font-size: 0.85rem;
    }
}

.game-info-row.hidden {
    display: none;
}

/* ============================================ */
/* GAME CONTAINER - FLEXBOX LAYOUT */
/* ============================================ */
.game-rows {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  position: relative;
}

.game-rows.hidden {
  display: none;
}

/* ============================================ */
/* DISTANCE BAR SECTION - LEFT SIDE */
/* ============================================ */
.distance-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 70px;
  flex-shrink: 0;
}

/* Vertical Line Container */
.vertical-line-container {
  position: relative;
  width: 4px;
  height: 220px;
  display: flex;
  justify-content: center;
}

.vertical-line {
  width: 4px;
  top: 25%;
  height: 50%;
  background: var(--box-bg-light);
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  position: relative;
}

body.dark-mode .vertical-line {
  background: #44474a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Distance Boxes */
.distance-box {
  position: absolute;
  width: 75%;
  height: 20%;
  background: var(--box-bg-light);
  color: #f7f7f7;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  z-index: 2;
  left: 50%;
  transform: translateX(-50%);
}

body.dark-mode .distance-box {
  background: #232323;
  color: #d3d6da;
  border-color: #44474a;
}

.top-distance-box {
  top: 5%;
}

.bottom-distance-box {
  bottom: 5%;
}

/* Moving Circle Indicator */
.distance-indicator {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  background: #ff5722;
  border: 2px solid white;
  border-radius: 50%;
  z-index: 3;
  transition: top 0.35s cubic-bezier(0.2, 0.9, 0.4, 1.1);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  pointer-events: none;
}

body.dark-mode .distance-indicator {
  background: #ff7043;
  border-color: #121212;
}

/* ============================================ */
/* WORD GRIDS SECTION - RIGHT SIDE */
/* ============================================ */
.grids-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Word Rows */
.game-row {
  display: flex;
  gap: 2px;
}

/* Word Boxes */
.game-box {
  width: 50px;
  height: 50px;
  background: var(--box-bg-light);
  border-radius: 4px;
  color: #f7f7f7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  transition: all 0.2s;
  text-transform: uppercase;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

body.dark-mode .game-box {
  background: #232323;
  color: #d3d6da;
}

/* Guess Inputs */
.guess-input {
    width: 50px;
    height: 50px;
    border: 2px solid var(--nyt-light-gray);
    border-radius: 4px;
    background: #fff;
    text-align: center;
    align-items: center;
    justify-self: center;
    font-family: 'Nunito', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    color: #f7f7f7;
    outline: none;
    text-transform: uppercase;
    transition: background-color 0.05s ease; /* Very fast transition */
    caret-color: transparent;
}

body.dark-mode .guess-input {
    background: #1e1e1e;
    color: #e0e0e0;
    border-color: #3a3a3c;
}

.guess-input:focus {
  border-color: #000;
  caret-color: transparent;
  outline: none;
}

/* Guess Row */
.guess-row {
  margin: 8px 0;
}

#guess-boxes {
  display: flex;
  gap: 2px;
}

/* Flash background for guess inputs - Coffee themed */
.guess-input.invalid-flash {
  animation: invalidShake 0.3s ease-in-out 0s 2;
  background-color: #ffebee;
  border-color: #f44336;
}

body.dark-mode .guess-input.invalid-flash {
  background-color: #4a1a1a !important;
}

/* Prevent any flash during animation */
.guess-input {
    transition: background-color 0.1s ease, color 0.1s ease, opacity 0.1s ease;
}

.guess-input.guess-submitted {
    background-color: #1b6291;
    color: #f7f7f7;
}

.guess-input.guess-input-active {
    background-color: #e67e22 !important;
    color: white !important;
}

.guess-input.blur{
    opacity: 0.5;
}

/* Flying box should start opaque and match exactly */
.flying-box {
    position: fixed;
    background-color: #1b6291;
    color: white;
    font-size: 2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    pointer-events: none;
    opacity: 1; /* Start fully opaque */
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.game-box.temp-blue {
    background-color: #1b6291;
    color: #f7f7f7;
    transition: none;
}

/* ============================================ */
/* ANIMATIONS */
/* ============================================ */
@keyframes popIn {
  0% {
    transform: scale(0.85);
    opacity: 0;
  }
  80% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeSlide {
  0% {
    opacity: 0;
    transform: translateY(-20%) scale(0.95);
  }
  60% {
    opacity: 0.7;
    transform: translateY(10%) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes colorPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(66, 50, 50, 0.3);
  }
  50% {
    box-shadow: 0 0 16px 6px rgba(66, 50, 50, 0.5);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(66, 50, 50, 0);
  }
}

@keyframes winPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.08);
  }
}

@keyframes invalidShake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

/* Animation Classes */
.guess-input.winner {
  background: #2ecc71;
  color: #fff;
}

/* Empty Placeholder block */
.empty-placeholder {
  height: 500px;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
}

.empty-placeholder.hidden {
  display: none;
}

.loader-text {
  font-weight: 500;
  font-size: 1rem;
  color: inherit;
}

.wave-loader span {
  display: inline-block;
  animation: waviy 1.5s infinite;
  animation-delay: calc(0.05s * var(--i));
  position: relative;
  margin-right: -0.15rem;
}

#game-loader{
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#game-loader.hidden{
  display: none;
}

@keyframes waviy {
  0%, 40%, 100% {
    transform: translateY(0);
  }
  20% {
    transform: translateY(-10px);
  }
}

/* ============================================ */
/* WIN MODAL */
/* ============================================ */
/* 🎉 WIN SCREEN STYLE */
#win-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  z-index: 1000;
}

body.dark-mode #win-screen {
  background: #1a1a2e;
}

.win-card {
  background: #e3e6e9;
  border-radius: 0.5rem;
  padding: 1.5rem 2rem;
  max-width: 450px;
  width: 100%;
  text-align: center;
  animation: fadeInScale 0.4s ease forwards;
}

body.dark-mode .win-card {
  background: #2f3247;
  border-color: #e0e0e0;
}

.win-card h2 {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 1rem;
  color: inherit;
}

.win-card p {
  font-size: 1rem;
  margin: 0.6rem 0;
  color: inherit;
  font-weight: 400;
  line-height: 1.5;
}

.win-card strong {
  font-weight: 700;
  color: inherit;
}

.play-again-text {
  font-weight: 600;
  font-size: 0.9rem;
  color: #423232;
  padding-top: 0.5rem;
}

.wins-previous-games {
  font-family: 'Nunito', sans-serif;
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.55rem 1rem;
  background: #1d9bf0;
  border: 0px;
  border-radius: 6px;
  color: #f7f7f7;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

body.dark-mode .wins-previous-games {
  background: #e0e0e0;
  color: #2d2d44;
  border: 2px solid #2d2d44;
}

.wins-previous-games:hover {
  background-color: #1170b0
}

body.dark-mode .wins-previous-games:hover {
  transform: scale(1.03);
  transition: none;
}

/* Secret Word Bold Styling */
.secret-word-bold {
    font-weight: 900;
    font-size: 1em;
    text-transform: uppercase;
}

/* Share Results Section */
.share-text {
    font-size: 0.9rem;
    color: #423232;
    font-weight: 600;
}

/* Dark Mode Styles */
body.dark-mode .share-results {
    background: rgba(148, 163, 184, 0.08);
    border-color: #fff;
}

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

.share-btn {
  font-family: 'Nunito', sans-serif;
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.55rem 1rem;
  background: #1d9bf0;
  border: 0px;
  border-radius: 6px;
  color: #f7f7f7;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

body.dark-mode .share-btn {
  background: #e0e0e0;
  color: #2d2d44;
  border: 2px solid #2d2d44;
}

.share-btn:hover {
  background-color: #1170b0
}

body.dark-mode .share-btn:hover {
  transform: scale(1.03);
  transition: none;
}

/* ---------------------------- */
/* Next game timer */
.next-game-timer {
  text-align: center;
  padding-top: 0.5rem;
}

body.dark-mode .next-game-timer {
  background: rgba(45, 45, 68, 0.3);
  border-color: #fff;
}

.timer-title {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: #423232;
  font-weight: 600;
}

.timer-display {
  font-family: 'Courier New', monospace;
  font-size: 1.5rem;
  font-weight: bold;
  color: #423232;
  letter-spacing: 2px;
}

.dark-mode .timer-display {
  color: #4ecdc4;
}

.dark-mode .timer-title {
  color: #ccc;
}

.next-game-timer.hidden {
  display: none;
}

/* 🎬 animation */
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

#win-screen.hidden { display: none;}

/* ------- */
/* Other Games Section */
.other-games-section {
  margin: 1.5rem 0;
}

.other-games-section.hidden {
  display: none;
}

.other-games-card {
  background: #e3e6e9;
  border: 1px solid #000;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  max-width: 80%;
  margin: 0 auto;
}

body.dark-mode .other-games-card {
  background: #2d2d44;
  border-color: #e0e0e0;
}

.other-games-header {
  font-size: 0.9rem;
  font-weight: 500;
  color: #423232;
  padding-bottom: 0.5rem;
}

body.dark-mode .other-games-header {
  color: #e0e0e0;
}

.other-games-list {
  display: flex;
  flex-direction: row;
  gap: 2.5rem;
  align-items: center;
  justify-content: center;
}

.other-game-item {
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  width: 30%;
  box-sizing: border-box;
  cursor: pointer;
}

.other-game-logo img {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
}

.other-game-title {
  font-weight: 900;
  font-size: 0.9rem;
  color: #4f4b4b;
}

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

/* Responsive */
@media (max-width: 600px) {
  .other-games-card {
    max-width: 80%;
    padding: 0.8rem;
  }
  
  .other-game-logo img {
    width: 35px;
    height: 35px;
  }
  
  .other-game-title {
    font-size: 0.9rem;
  }
}

/* ============================================ */
/* GAME MESSAGE */
/* ============================================ */
#game-message {
  font-size: 1rem;
  text-align: center;
  color: #d32f2f;
  background: #f8d7da;
  max-width: 400px;
  font-weight: 700;
  padding: 0.5rem;
  border-radius: 10px;
  transition: opacity 0.3s;
  min-height: 2.5em;
  opacity: 1;
  pointer-events: auto;
}

#game-message.hidden {
  opacity: 0;
  pointer-events: none;
}

#game-message.win-hidden{
  display: none;
}

/* ============================================ */
/* KEYBOARD STYLES */
/* ============================================ */
.keyboard-container {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

.keyboard-row {
  display: flex;
  justify-content: center;
  gap: 0.2rem;
}

.key {
  width: 38px;
  height: 38px;
  background: #f7f7f7;
  border: 0px solid #bdbdbd;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: 900;
  cursor: pointer;
  transition: background 0.1s, color 0.1s, border 0.1s;
  color: var(--text-dark);
  font-family: 'Nunito', sans-serif;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  touch-action: manipulation;
}

body.dark-mode .key {
  background: #232323;
  color: #d3d6da;
  border-color: #44474a;
}

.key:hover {
  background: #6e6e6d;
  color: white;
}

.key:active {
  transform: scale(0.98);
}

.key.special {
  background: #8f8f90;
  color: white;
  width: 70px;
  font-size: 0.9rem;
}

.key.backspace {
  font-size: 1.2rem
}

.key.special:hover {
  background: #71717a;
}

.key.enter {
  background: #3b82f6;
  color: white;
}

.key.enter:hover {
  background: #2563eb;
}

.key.used {
  background: #94a3b8;
  color: #475569;
  cursor: default;
  opacity: 0.6;
}

body.dark-mode .key.used {
  background: #1e293b;
  color: #64748b;
}

/* Keyboard Letter Availability States */
.key.available-letter {
  background: var(--available-key-bg);
  color: #fff;
}

body.dark-mode .key.available-letter {
  background: #2e7d32;
  color: #fff;
  box-shadow: 0 0 6px rgba(46, 125, 50, 0.6);
}

.key.restricted-letter {
  background: #adb5bd;
  color: #6c757d;
  opacity: 0.55;
  filter: grayscale(0.2);
}

body.dark-mode .key.restricted-letter {
  background: #3a3f47;
  color: #7e8a98;
  opacity: 0.65;
}

.keyboard-container.hidden {
  display: none;
}

/* ============================================ */
/* TOAST POPUP */
/* ============================================ */
.keyboard-toast {
  position: fixed;
  background: var(--coffee-light);
  color: var(--coffee-dark);
  padding: 12px 32px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1.08rem;
  box-shadow: 0 4px 24px rgba(66, 50, 50, 0.18), 0 1.5px 8px rgba(0, 0, 0, 0.10);
  z-index: 10001;
  pointer-events: none;
  white-space: nowrap;
  font-family: 'Georgia', 'Times New Roman', serif;
  border: 2.5px solid var(--coffee-dark);
  letter-spacing: 0.01em;
  transition: opacity 0.2s, background 0.2s, color 0.2s;
}

body.dark-mode .keyboard-toast {
  background: var(--coffee-dark);
  color: var(--coffee-light);
  border-color: var(--coffee-light);
  text-shadow: none;
}

/* ============================================ */
/* RESPONSIVE DESIGN */
/* ============================================ */
@media (max-width: 700px) {
  .three-columns {
    display: flex;
    justify-content: center;
  }

  .left-container,
  .right-container {
    display: none;
  }

  .game-container {
    max-width: 100%;
  }
}

@media (max-width: 550px) {
  /* .distance-section {
    width: 55px;
  } */
  
  .distance-box {
    width: 42px;
    /* height: 42px; */
    font-size: 0.9rem;
  }
  
  /* .vertical-line-container {
    height: 180px;
  } */
  
  .game-box, .guess-input, .flying-box{
    font-size: 1.6rem;
  }

  #guess-boxes {
    gap: 2px;
  }
  
  .key {
    height: 2.4rem;
    width: 2rem;
    font-size: 1rem;
  }

  .key.special {
    width: 50px;
    font-size: 0.75rem;
  }

  .key.backspace {
    font-size: 1.4rem;
  }

  .keyboard-row {
    gap: 0.3rem;
  }
}

/* ============================================ */
/* 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;
  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.5rem 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;
  }
}

/* -------------------------------------------- */
/* FAQ Section */
/* FAQ Section */
.faq-section {
  margin-top: 2rem;
}

.faq-section.hidden {
  display: none;
}

.faq-title {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: inherit;
}
.faq-item {
  margin-bottom: 0.5rem;
  border-radius: 6px;
  overflow: hidden;
  border: 1.5px solid #000;
}

body.dark-mode .faq-item {
  border-color: #d1d5db;
}

.faq-question {
  width: 100%;
  text-align: left;
  padding: 0.8rem 1rem;
  background: #fff;
  border: none;
  outline: none;
  font-size: 0.95rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  color: inherit;
}

body.dark-mode .faq-question {
  background: #2f3247;
}

.faq-question.active { 
  background: #adb5bd; 
}

body.dark-mode .faq-question.active { 
  background-color: #7c81a7;
}

.faq-question:hover { 
  background: #adb5bd; 
}

body.dark-mode .faq-question:hover { 
  background-color: #7c81a7;
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  padding: 0 1rem;
  background: #ffffff;
  font-size: 0.9rem;
  line-height: 1.4rem;
  transition: max-height 0.3s ease, padding 0.3s ease;
  color: inherit;
}

body.dark-mode .faq-answer {
  background: #2d2d44;
}

.faq-answer.open {
  padding: 0.5rem 1rem 0.8rem 1rem;
  max-height: 500px;
}

/* ---------------------------------------------- */
/* 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);
}

/* ============================================ */
/* ARCHIVE MODAL CALENDAR STYLES - CLEAN VERSION */
/* ============================================ */

.calendar-container {
  background: transparent;
  padding: 0.5rem 1rem 1rem 1rem;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 0 0.25rem;
}

.calendar-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #000;
  margin: 0;
}

body.dark-mode .calendar-header h3 {
  color: #fff;
}

.calendar-nav-btn {
  background: transparent;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  color: #666;
}

.calendar-nav-btn:hover {
  background: #bdc0c3;
}

body.dark-mode .calendar-nav-btn {
  color: #aaa;
}

body.dark-mode .calendar-nav-btn:hover {
  background: #333;
}

.calendar-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 3px solid #383737;
  border-top-color: #aaa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 15px;
}

body.dark-mode .loader-spinner {
  border-color: var(--coffee-dark);
  border-top-color: var(--coffee-light);
}

.calendar-loader.hidden {
    display: none;
}

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

.calendar-loader p {
  color: var(--coffee-dark);
  font-size: 0.9rem;
  margin: 0;
}

body.dark-mode .calendar-loader p {
  color: var(--coffee-light);
}

.calendar-content {
  transition: opacity 0.3s ease;
}

.calendar-content.hidden {
  display: none;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: #000;
  text-transform: uppercase;
  text-decoration: underline dotted;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  /* gap: 6px; */
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5%;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  transition: all 0.2s ease;
  background: transparent;
  color: #000;
  position: relative;
  width: 90%;
  height: 90%;
  margin: 0 auto;
}

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

.calendar-day:hover {
  background: #d8dadd;
}

body.dark-mode .calendar-day:hover {
  background: #333;
}

.calendar-day.empty {
  background: transparent;
  cursor: default;
  opacity: 0;
}

.calendar-day.empty:hover {
  background: transparent;
  transform: none;
}

.calendar-day.in-progress {
  background: #bdc0c3;
  font-weight: 600;
}

body.dark-mode .calendar-day.in-progress {
  background: #3e2a1f;
  color: #ffb74d;
}

.calendar-day.completed {
  background: #99c99b;
  color: #000;
  font-weight: 600;
}

body.dark-mode .calendar-day.completed {
  background: #2e7d32;
  color: #fff;
}

.calendar-day.disabled {
  background: transparent;
  color: #423232;
  cursor: not-allowed;
  opacity: 0.5;
}

.calendar-day.disabled:hover {
  background: transparent;
  transform: none;
}

/* Calendar Legend */
.calendar-legend {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin: 0.5rem 0 0.5rem;
  flex-wrap: wrap;
  border-top: 1px solid #e5e5e5;
  padding-top: 1rem;
}

body.dark-mode .calendar-legend {
  border-top-color: #333;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #666;
}

body.dark-mode .legend-item {
  color: #aaa;
}

.legend-color {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

.legend-color.available {
  background: #e8f5e9;
  border: none;
}

body.dark-mode .legend-color.available {
  background: #1b3a1f;
}

.legend-color.in-progress {
  background: #f4da92;
  border: none;
}

body.dark-mode .legend-color.in-progress {
  background: #3e2a1f;
}

.legend-color.completed {
  background: #4caf50;
}

/* Responsive */
@media (max-width: 550px) {
  .calendar-day {
    font-size: 0.75rem;
    max-width: 36px;
  }
  
  .calendar-weekdays div {
    font-size: 0.7rem;
  }
  
  .calendar-legend {
    gap: 1rem;
  }
  
  .legend-item {
    font-size: 0.7rem;
  }
  
  .legend-color {
    width: 20px;
    height: 20px;
  }
}

/* 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;
}
