:root {
  --bg-color: #121212;
  --surface-color: #1e1e1e;
  --primary-color: #bb86fc;
  --secondary-color: #03dac6;
  --text-color: #e0e0e0;
  --highlight-color: #ffffff;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  margin: 0;
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-color);
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  width: 100%;
  height: 100%;
  max-width: none;
  padding: 0;
}

/* Sidebar Styling */
.sidebar {
  width: 300px;
  background-color: var(--surface-color);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #333;
}

.sidebar h2 {
  font-size: 1.2rem;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  letter-spacing: 1px;
}

#gamemode-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#gamemode-list li {
  padding: 1rem;
  color: #777;
  /* Greyed out */
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

#gamemode-list li:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #aaa;
}

#gamemode-list li.active {
  color: var(--highlight-color);
  background-color: rgba(187, 134, 252, 0.15);
  /* Light primary tint */
  font-weight: 600;
  border-left: 4px solid var(--primary-color);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 2rem;
  /* Prevent content from pushing sidebar */
  min-width: 0;
  overflow-y: auto;
  /* Allow scrolling if content gets too tall */
}

/* Dynamic Instructions Styling */
.mode-instructions {
  position: absolute;
  top: 2rem;
  text-align: center;
  width: 100%;
  padding: 0 1rem;
  box-sizing: border-box;
}

.mode-instructions h1 {
  font-size: 2rem;
  /* Slightly smaller to fit better */
  margin-bottom: 0.5rem;
  font-weight: 300;
  letter-spacing: 2px;
  color: var(--secondary-color);
  position: static;
  /* Remove absolute from H1 itself */
}

.mode-instructions p {
  color: #888;
  font-size: 1rem;
  margin: 0;
  max-width: 600px;
  /* Readability */
  margin-left: auto;
  margin-right: auto;
}

/* Game Display */
.game-display {
  width: 100%;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* Center by default */
}

/* Instant Display - No Animations */
.word-row {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 1rem 0;
  color: var(--highlight-color);
  opacity: 1;
  transform: none;
  text-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Specific Styles for Mode 6 (Scrolling) */
.history-container {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  height: auto;
  /* Let it grow naturally? No, needs fixed height for mask. */
  max-height: 500px;
  margin-top: -100px;
  /* Pull it up specifically as requested */
  overflow: hidden;
  /* Mask to fade out the top (oldest) words */
  mask-image: linear-gradient(to top, black 60%, transparent 100%);
  -webkit-mask-image: linear-gradient(to top, black 60%, transparent 100%);
}

.history-item {
  transition: all 0.3s ease;
  /* Keep layout transition smooth */
}

.history-item.current {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--primary-color);
  margin-top: 1rem;
  opacity: 1;
  transform: none;
}

.history-item.past {
  font-size: 1.5rem;
  color: #888;
  font-weight: 400;
  margin-bottom: 0.5rem;
  opacity: 0.6;
}

.instruction {
  position: absolute;
  bottom: 2rem;
  font-size: 0.9rem;
  color: #666;
}

/* Flag Button */
.flag-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background-color: var(--surface-color);
  color: var(--text-color);
  border: 1px solid #333;
  padding: 1rem 1.5rem;
  border-radius: 50px;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  z-index: 100;
}

.flag-btn:hover {
  background-color: #333;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.flag-btn:active {
  transform: translateY(0);
}

.flag-btn.flagged {
  background-color: rgba(255, 0, 0, 0.2);
  border-color: #ff4444;
  color: #ff4444;
}

/* Sidebar Footer & Export */
.sidebar {
  /* Existing styles... ensure flex column is set */
  justify-content: space-between;
  /* Push footer to bottom */
}

/* Fix gamemode list to take available space */
#gamemode-list {
  flex-grow: 1;
}

.sidebar-footer {
  padding-top: 1rem;
  border-top: 1px solid #333;
  margin-top: 1rem;
}

.export-btn {
  width: 100%;
  padding: 0.8rem;
  background-color: #2c2c2c;
  color: #888;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-family);
  font-size: 0.9rem;
}

.export-btn:hover {
  background-color: #383838;
  color: var(--text-color);
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
  h1 {
    font-size: 1.8rem;
  }

  .word-row {
    font-size: 1.8rem;
  }

  .history-item.current {
    font-size: 2.5rem;
  }

  .controls {
    flex-direction: column;
  }

  .flag-btn {
    bottom: 1rem;
    right: 1rem;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
  }
}