*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f5f5;
  color: #222;
}

.app {
  min-height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.25rem;
}

.card {
  width: min(720px, 100%);
  background: #fff;
  border: 1px solid #e3e3e3;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
  padding: 1.25rem;
  position: relative;
}

.screen.hidden {
  display: none;
}

.title {
  margin: 0 0 0.25rem 0;
  font-size: 1.25rem;
  font-weight: 650;
}

.subtitle {
  margin: 0 0 1rem 0;
  color: #444;
  line-height: 1.35;
}

.hint {
  margin: 1rem 0 0 0;
  color: #666;
  min-height: 1.2em;
}

.row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.row.space-between {
  justify-content: space-between;
  align-items: flex-start;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.field-label {
  font-size: 0.9rem;
  color: #444;
}

.input {
  height: 44px;
  border-radius: 12px;
  border: 1px solid #cfcfcf;
  padding: 0 0.9rem;
  font-size: 1rem;
  outline: none;
}

.input:focus {
  border-color: #1976d2;
  box-shadow: 0 0 0 3px rgba(25,118,210,0.15);
}

.primary,
.ghost,
.hold-button,
.icon-button {
  height: 44px;
  border-radius: 999px;
  font-size: 1rem;
  cursor: pointer;
  border: 1px solid #bbb;
  background: #fff;
  padding: 0 1.1rem;
  transition:
    background-color 120ms ease-in-out,
    box-shadow 120ms ease-in-out,
    transform 80ms ease-in-out;
}

.primary {
  border-color: #1976d2;
  background: #1976d2;
  color: #fff;
}

.primary:active,
.ghost:active,
.hold-button:active,
.icon-button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) inset;
}

.primary:focus-visible,
.ghost:focus-visible,
.hold-button:focus-visible,
.icon-button:focus-visible {
  outline: 2px solid #1976d2;
  outline-offset: 3px;
}

.ghost {
  border-color: transparent;
  background: transparent;
  color: #1976d2;
}

.icon-button {
  width: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-color: transparent;
  background: transparent;
  color: #1976d2;
}

.icon-button .material-symbols-outlined {
  font-size: 24px;
}

.hold-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.topics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.topic-btn {
  border: 1px solid #cfcfcf;
  background: #fff;
  border-radius: 14px;
  padding: 0.9rem 1rem;
  cursor: pointer;
  text-align: left;
  transition:
    transform 80ms ease-in-out,
    box-shadow 120ms ease-in-out,
    border-color 120ms ease-in-out;
}

.topic-btn:hover {
  border-color: #bdbdbd;
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.topic-btn:active {
  transform: translateY(1px);
}

.topic-name {
  font-weight: 650;
  margin: 0;
}

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 0 0.5rem 0;
}

/* Kreis */
.circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: #ccc;
  transition: background-color 150ms ease-in-out;
}

/* Rot: PTT sendet */
.circle.active {
  background: #e53935;
}

/* Blau: Backend spricht (Audio Playback) */
.circle.speaking {
  background: #1976d2;
}

.statusline {
  min-height: 1.2em;
  color: #555;
  font-size: 0.95rem;
  text-align: center;
  max-width: 560px;
}

/* Settings Page Styles */
.settings-section {
  margin-top: 1.5rem;
}

.settings-heading {
  margin: 0 0 0.5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #222;
}

.settings-description {
  margin: 0 0 0.75rem 0;
  color: #666;
  font-size: 0.9rem;
}

.voices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.voice-btn {
  border: 2px solid #cfcfcf;
  background: #fff;
  border-radius: 12px;
  padding: 1rem 0.75rem;
  cursor: pointer;
  text-align: center;
  transition:
    transform 80ms ease-in-out,
    border-color 120ms ease-in-out,
    box-shadow 120ms ease-in-out;
  font-size: 0.95rem;
  font-weight: 500;
}

.voice-btn:hover {
  border-color: #1976d2;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.voice-btn:active {
  transform: translateY(1px);
}

.voice-btn.selected {
  border-color: #1976d2;
  background: #e3f2fd;
  color: #1976d2;
  font-weight: 600;
}

.voice-btn.playing {
  border-color: #4caf50;
  background: #e8f5e9;
  color: #4caf50;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
}

.speed-label {
  font-size: 0.9rem;
  color: #666;
  min-width: 40px;
  text-align: center;
}

.speed-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #e0e0e0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.speed-slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1976d2;
  cursor: pointer;
  transition: background 120ms ease-in-out;
}

.speed-slider::-webkit-slider-thumb:hover {
  background: #1565c0;
}

.speed-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1976d2;
  cursor: pointer;
  border: none;
  transition: background 120ms ease-in-out;
}

.speed-slider::-moz-range-thumb:hover {
  background: #1565c0;
}

.speed-value {
  margin-top: 0.5rem;
  color: #555;
  font-size: 0.95rem;
}

.speed-value strong {
  color: #1976d2;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  border-radius: 16px;
  z-index: 100;
}

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

.loading-overlay p {
  margin: 0;
  color: #555;
  font-size: 1rem;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e0e0e0;
  border-top-color: #1976d2;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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