/* Base styles and variables */
:root {
  --primary-color: #bb86fc;
  --primary-dark: #9969da;
  --primary-light: #d7b7ff;
  --secondary-color: #03dac6;
  --background: #121212;
  --surface: #1e1e1e;
  --error: #cf6679;
  --on-primary: #000000;
  --on-secondary: #000000;
  --on-background: #ffffff;
  --on-surface: #e0e0e0;
  --on-error: #000000;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--background);
  color: var(--on-background);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

a {
  color: var(--on-surface);
}

footer {
  margin-top: 32px;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  padding: 16px 0;
}


/* Material Design Components */
.card {
  background-color: var(--surface);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 600px;
  margin-bottom: 24px;
}

.text-display-container {
    padding: 0 16px;
  margin-bottom: 24px;
  width: 100%;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.text-display-container:hover {
  transform: scale(1.01);
}

.text-display-header {
  display: flex;
  justify-content: flex-end;
  padding: 8px 8px 0 8px;
}

.text-display {
  padding: 16px;
  background-color: var(--surface);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(255, 255, 255, 0.1);
  min-height: 100px;
  width: 100%;
  max-width: 600px;
  overflow-wrap: break-word;
  word-wrap: break-word;
  font-size: 1.1rem;
  color: var(--on-surface);
}

/* Material Design Buttons */
button {
  border: none;
  padding: none;
  font-size: 4rem;
  cursor: pointer;
  margin: 8px 16px;
}

/* Slider controls */
.speed-controls {
  width: 100%;
  padding: 16px;
  margin-bottom: 24px;
}

.slider-container {
  margin-bottom: 16px;
}

.slider-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
  color: var(--on-background);
}

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #444444;
  outline: none;
  transition: opacity 0.2s;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary-color);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  border: none;
}

.slider:disabled {
  opacity: 0.5;
}

button:hover {
  box-shadow: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
}

button:active {
  box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);
}

button:disabled {
  background-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.38);
  box-shadow: none;
  cursor: default;
}

/* Button container */
.button-container {
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.playback-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.practice-area {
  margin-top: 24px;
  width: 100%;
}

.practice-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
  color: rgba(0, 0, 0, 0.87);
}

.practice-textarea {
  width: 100%;
  min-height: 100px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  font-family: 'Roboto', sans-serif;
  font-size: 1rem;
  resize: vertical;
  background-color: #2d2d2d;
  color: var(--on-surface);
}

.practice-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(98, 0, 238, 0.2);
}

/* Keyboard styles */
.keyboard {
  width: 100%;
  margin-top: 16px;
  background-color: #2a2a2a;
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.keyboard-row {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
  width: 100%;
}

.keyboard-key {
  background-color: #3d3d3d;
  border: 1px solid #555;
  border-radius: 4px;
  margin: 0 2px;
  padding: 8px 0;
  width: 36px;
  font-size: 0.9rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: all 0.1s;
  color: var(--on-surface);
}

.keyboard-key:active {
  background-color: var(--primary-color);
  transform: translateY(2px);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
  color: var(--on-primary);
}

.space-key {
  width: 120px;
}

.backspace-key {
  width: 80px;
}

.clear-key {
  width: 80px;
  margin-right: 20px;
}

.rss-feed-input {
  width: 100%;
  padding: 16px;
  margin-bottom: 24px;
}

.input-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
  color: var(--on-background);
}

.text-input {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  font-size: 1rem;
  margin-bottom: 8px;
  background-color: #2d2d2d;
  color: var(--on-surface);
}

.text-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(98, 0, 238, 0.2);
}

.score {
    font-size: 150%;
    font-weight: bold;
    color: var(--secondary-color);
}

.high-score {
    font-size: 150%;
    font-weight: bold;
    color: var(--primary-color);
}

.rss-button {
  background-color: var(--primary-color);
  color: var(--on-primary);
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.rss-button:hover {
  background-color: var(--primary-dark);
}

.rss-button:disabled {
  background-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.38);
}

.feed-dropdown {
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  font-size: 1rem;
  margin-bottom: 8px;
  background-color: #2d2d2d;
  color: var(--on-surface);
  cursor: pointer;
}

.feed-dropdown:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(98, 0, 238, 0.2);
}

.feed-dropdown:disabled {
  background-color: rgba(255, 255, 255, 0.05);
  cursor: not-allowed;
}

.start-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 50vh;
  width: 100%;
}

.start-button {
  background-color: var(--primary-color);
  color: var(--on-primary);
  padding: 12px 24px;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
  margin: 24px 0;
}

.check-button {
  background-color: var(--primary-dark);
  color: var(--on-primary);
  padding: 0 4px;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
  margin: 24px 0;
}


.start-button:hover {
  background-color: var(--primary-dark);
}

.start-button:disabled {
  background-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.38);
}

/* Responsive design */
@media (min-width: 768px) {
  .container {
    padding: 24px;
    max-width: 1200px;
  }

  header h1 {
    font-size: 2.125rem;
  }

  .text-display {
    padding: 24px;
    font-size: 1.25rem;
  }

  button {
    padding: 16px 32px;
    font-size: 1rem;
  }

  .keyboard-key {
    padding: 12px 0;
    font-size: 1rem;
    margin: 0 4px;
    width: 40px;
  }

  .space-key {
    width: 160px;
  }

  .backspace-key {
    width: 100px;
  }

  .clear-key {
    width: 100px;
  }
}

.settings {
  padding: 10px;
}

.settings summary {
  color:  var(--on-surface);
  font-size: 20px;
}

.game-mode input, .random-mode-options input[type="checkbox"] {
    margin-left: 15px;
    width: 30px;
    height: 30px;
}

.game-mode label, .random-mode-options label {
    margin-left: 1em;
    margin-right: 3em;
    vertical-align: 35%;
}

.game-mode, .random-mode-options {
    margin-bottom: 20px;
}

.random-mode-length {
    width: 100%;
    padding: 0 16px;
}

.progress-bar-container {
    width: 100%;
    height: 3px;
    background-color: #333;
    margin: 8px 0;
}

.progress-bar {
    height: 100%;
    background-color: var(--secondary-color);
    transition: width 0.15s ease-out;
}

.back-link {
    font-size: 1.2em;
    border: 1px solid var(--on-background);
    padding: 3px;
    color: var(--on-background);
}
