body {
  font-family: system-ui, Arial, sans-serif;
  margin: 0;
  background: #f7f9fa;
  color: #222;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
header {
  background: #2d6cdf;
  color: #fff;
  padding: 2rem 1rem 1rem 1rem;
  text-align: center;
}
main {
  flex: 1;
  padding: 2rem 1rem;
  max-width: 600px;
  margin: 0 auto;
}
section[aria-label="Text Input"] {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  padding: 1.5rem;
  margin-bottom: 2rem;
}
label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.5rem;
}
textarea {
  width: 100%;
  min-height: 120px;
  border: 1px solid #bfc9d1;
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 1rem;
  resize: vertical;
  margin-bottom: 1rem;
}
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
button {
  background: #2d6cdf;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}
button:active, button.speaking {
  background: #174a96;
}
#clear-btn {
  background: #e74c3c;
}
#clear-btn:active {
  background: #b93a2b;
}
input[type="range"] {
  accent-color: #2d6cdf;
  margin: 0 0.5rem;
}
#speed-value {
  min-width: 2.5em;
  display: inline-block;
  text-align: right;
}
#lang-display {
  margin-left: 1rem;
  font-size: 0.98em;
}
#switch-lang-btn {
  background: #27ae60;
}
#switch-lang-btn:active {
  background: #1e874b;
}
section[aria-label="Instructions"] {
  background: #f0f4f8;
  border-radius: 8px;
  padding: 1rem;
  font-size: 1.05em;
}
footer {
  background: #222;
  color: #fff;
  text-align: center;
  padding: 1rem 0;
  font-size: 0.98em;
}
select#lang-select {
  min-width: 160px;
  padding: 0.4rem 1.5rem 0.4rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #bfc9d1;
  font-size: 1rem;
  background: #fff url('data:image/svg+xml;utf8,<svg fill="%232d6cdf" height="16" viewBox="0 0 24 24" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>') no-repeat right 0.5rem center/1em;
  appearance: none;
  cursor: pointer;
  margin-left: 0.5rem;
}
select#lang-select:focus {
  outline: 2px solid #2d6cdf;
}
#tts-highlighted {
  min-height: 2em;
  background: #f8fafc;
  border-radius: 6px;
  padding: 0.75rem;
  font-size: 1.08em;
  margin-top: 0.5rem;
  border: 1px solid #e0e6ed;
  color: #222;
  word-break: break-word;
}
.tts-current-sentence {
  background: #ffe066;
  border-radius: 4px;
  padding: 0.1em 0.2em;
  color: #222;
  transition: background 0.2s;
}
.top-menu {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #e0e6ed;
  padding: 0.5rem 1.5rem 0.5rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.top-menu ul {
  list-style: none;
  display: flex;
  gap: 1.2rem;
  margin: 0;
  padding: 0;
}
.top-menu li {
  margin: 0;
}
.top-menu a {
  color: #2d6cdf;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}
.top-menu a:hover {
  color: #174a96;
  text-decoration: underline;
}
#dark-mode-toggle {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  margin-left: 1.5rem;
  color: #2d6cdf;
  transition: color 0.2s;
}
#dark-mode-toggle:hover {
  color: #174a96;
}
.menu-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}
#lang-switch {
  font-size: 1rem;
  border-radius: 4px;
  border: 1px solid #bfc9d1;
  padding: 0.3rem 1.5rem 0.3rem 0.5rem;
  background: #fff url('data:image/svg+xml;utf8,<svg fill="%232d6cdf" height="16" viewBox="0 0 24 24" width="16" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>') no-repeat right 0.5rem center/1em;
  appearance: none;
  cursor: pointer;
  min-width: 120px;
}
#lang-switch:focus {
  outline: 2px solid #2d6cdf;
}
body.dark-mode {
  background: #181c1f;
  color: #e0e6ed;
}
body.dark-mode header {
  background: #232a36;
  color: #e0e6ed;
}
body.dark-mode main {
  background: #181c1f;
  color: #e0e6ed;
}
body.dark-mode section[aria-label="Text Input"] {
  background: #232a36;
  color: #e0e6ed;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
body.dark-mode section[aria-label="Instructions"] {
  background: #232a36;
  color: #e0e6ed;
}
body.dark-mode textarea {
  background: #181c1f;
  color: #e0e6ed;
  border: 1px solid #3a4250;
}
body.dark-mode .controls {
  color: #e0e6ed;
}
body.dark-mode button {
  background: #2d6cdf;
  color: #fff;
}
body.dark-mode button:active, body.dark-mode button.speaking {
  background: #174a96;
}
body.dark-mode #clear-btn {
  background: #e74c3c;
}
body.dark-mode #clear-btn:active {
  background: #b93a2b;
}
body.dark-mode select#lang-select {
  background: #232a36;
  color: #e0e6ed;
  border: 1px solid #3a4250;
}
body.dark-mode #tts-highlighted {
  background: #181c1f;
  color: #ffe066;
  border: 1px solid #3a4250;
}
body.dark-mode .tts-current-sentence {
  background: #ffe066;
  color: #232a36;
}
body.dark-mode footer {
  background: #232a36;
  color: #e0e6ed;
}
body.dark-mode .top-menu {
  background: #232a36;
  border-bottom: 1px solid #3a4250;
}
body.dark-mode .top-menu a {
  color: #ffe066;
}
body.dark-mode .top-menu a:hover {
  color: #fff;
}
body.dark-mode #dark-mode-toggle {
  color: #ffe066;
}
body.dark-mode #dark-mode-toggle:hover {
  color: #fff;
}
body.dark-mode #lang-switch {
  background: #232a36;
  color: #ffe066;
  border: 1px solid #3a4250;
}
@media (max-width: 600px) {
  main {
    padding: 1rem 0.5rem;
  }
  section[aria-label="Text Input"] {
    padding: 1rem;
  }
  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
} 