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

body {
  font-family: "Inter", sans-serif;
  background: var(--color-background);
  color: var(--color-text);
}

.statistics-button {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 100;

  padding: 10px 16px;

  background: var(--color-surface);
  color: var(--color-text);

  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);

  font-size: 0.9rem;
  font-weight: 700;

  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    border-color 0.2s;
}

.statistics-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-primary);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-xl) 20px;
}

.user-avatar {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 2rem;
  height: 2rem;
  font-size: 1.5rem;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#app-title {
  text-align: center;
  margin: 24px 0 4px;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.1;
  color: var(--color-text);
}

#app-slogan {
  text-align: center;
  margin: 10px 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-primary);
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
}

#hero {
  margin: 0 auto;
  padding: 0;
  max-width: 620px;
  text-align: center;
}

#hero p {
  text-align: center;
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text-muted);
}

.hero-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.hero-actions .button {
  text-decoration: none;
}

#highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 620px;
  margin: 20px auto 24px;
}

.highlight {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.highlight strong {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-primary);
}

.highlight span {
  margin-top: 3px;

  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

@media (max-width: 600px) {
  #highlights {
    grid-template-columns: 1fr;
  }
}

.tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.tab {
  flex: 1;
  min-width: 120px;
  padding: 12px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-border);
  cursor: pointer;
  font-size: 16px;
  transition: 0.2s;
}

.tab.active {
  background: var(--color-primary);
  color: var(--color-surface);
}

.question {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 15px;
}

.result {
  margin-top: 10px;
  font-weight: bold;
}

.stats {
  background: var(--color-surface);
  padding: 20px;
  border-radius: var(--radius-lg);
  margin-top: 20px;
  box-shadow: var(--shadow-md);
  text-align: center;
  display: none;
}

.progress {
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: bold;
  text-align: center;
}

@media (max-width: 600px) {
  .question {
    font-size: 16px;
  }

  .option {
    font-size: 15px;
    padding: 12px;
  }
}

#back-button {
  display: none;
  margin-bottom: 20px;
  padding: 0;
  background: transparent;
  border: none;
  color: #2563eb;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s;
}

#back-button:hover {
  color: #1d4ed8;
}

.home-tools {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1001;

  display: flex;
  align-items: center;
  gap: 10px;
}

#visit-counter {
  padding: 10px 14px;

  background: rgba(17, 24, 39, 0.9);
  color: white;

  border-radius: 999px;
  box-shadow: var(--shadow-md);

  font-size: 13px;
  font-weight: 600;

  user-select: none;
  white-space: nowrap;
}

.feedback-button {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 46px;
  height: 46px;
  padding: 0;
  flex-shrink: 0;

  border: 1px solid var(--color-border);
  border-radius: 50%;

  background: var(--color-primary);
  box-shadow: var(--shadow-md);

  font-size: 1.2rem;
  line-height: 1;

  cursor: pointer;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.feedback-button:hover {
  transform: translateY(-2px);
}

.feedback-button:active {
  transform: translateY(0);
}

.feedback-panel {
  position: fixed;
  right: 20px;
  bottom: 78px;
  z-index: 1000;

  width: min(390px, calc(100vw - 32px));
  max-height: calc(100vh - 110px);
  box-sizing: border-box;

  padding: 20px;
  overflow-y: auto;

  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

.feedback-panel[hidden] {
  display: none;
}

/* Header */
.feedback-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;

  margin-bottom: 18px;
}

.feedback-panel-header > div {
  min-width: 0;
}

.feedback-panel-header strong {
  display: block;

  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.3;

  color: var(--color-text);
}

.feedback-panel-header p {
  margin: 6px 0 0;

  font-size: 0.85rem;
  line-height: 1.5;

  color: var(--color-text-muted);
}

/* Close button */
.feedback-close {
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 32px;
  height: 32px;
  padding: 0;

  border: 0;
  border-radius: 50%;

  background: transparent;
  color: var(--color-text-muted);

  font-size: 1rem;
  line-height: 1;

  cursor: pointer;

  transition:
    background 0.2s ease,
    color 0.2s ease;
}

.feedback-close:hover {
  background: var(--color-background);
  color: var(--color-text);
}

/* Form */
#feedback-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#feedback-form label {
  margin-top: 6px;

  font-size: 0.85rem;
  font-weight: 700;

  color: var(--color-text);
}

/* Inputs */
#feedback-form input,
#feedback-form textarea {
  width: 100%;
  box-sizing: border-box;

  padding: 11px 12px;

  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);

  background: var(--color-background);
  color: var(--color-text);

  font: inherit;
  font-size: 0.9rem;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

#feedback-form input:focus,
#feedback-form textarea:focus {
  outline: none;

  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px
    color-mix(in srgb, var(--color-primary) 15%, transparent);
}

#feedback-form textarea {
  min-height: 130px;

  line-height: 1.5;

  resize: vertical;
}

/* Status / success / error message */
.feedback-status {
  min-height: 20px;
  margin-top: 4px;

  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Send button */
#send-feedback {
  align-self: flex-end;

  min-width: 140px;
  margin-top: 6px;
  padding: 11px 18px;

  border: 0;
  border-radius: var(--radius-md);

  background: var(--color-primary);
  color: white;

  font-size: 0.9rem;
  font-weight: 700;

  cursor: pointer;

  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

#send-feedback:hover:not(:disabled) {
  transform: translateY(-1px);
}

#send-feedback:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ========================================
   MOBILE
======================================== */

@media (max-width: 600px) {
  .home-tools {
    right: 16px;
    bottom: 16px;
    gap: 8px;
  }

  #visit-counter {
    padding: 9px 12px;
    font-size: 12px;
  }

  .feedback-button {
    width: 44px;
    height: 44px;
  }

  .feedback-panel {
    right: 16px;
    bottom: 72px;

    width: calc(100vw - 32px);
  }
}

.statistics-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.statistics-modal[hidden] {
  display: none;
}

.statistics-motivation {
  margin-bottom: 24px;
  padding: 20px;
  text-align: center;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.statistics-motivation-emoji {
  margin-bottom: 6px;
  font-size: 2rem;
  line-height: 1;
}

.statistics-motivation h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-text);
}

.statistics-motivation p {
  max-width: 480px;
  margin: 6px auto 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--color-text-muted);
}

.statistics-modal-content {
  position: relative;
  width: min(680px, 100%);
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.statistics-modal-content h2 {
  margin: 0 40px 24px 0;
  font-size: 1.5rem;
  color: var(--color-text);
}

.statistics-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-background);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  transition: 0.2s;
}

.statistics-modal-close:hover {
  color: var(--color-text);
  border-color: var(--color-primary);
  transform: scale(1.05);
}

.statistics-overview {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.statistics-card {
  grid-column: span 2;
}

/* Letzte zwei Cards mittig in der zweiten Reihe */
.statistics-card:nth-child(4) {
  grid-column: 2 / span 2;
}

.statistics-card:nth-child(5) {
  grid-column: 4 / span 2;
}

.statistics-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  min-height: 110px;
  padding: 18px 14px;

  text-align: center;

  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.statistics-card strong {
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;

  color: var(--color-primary);
}

.statistics-card span {
  margin-top: 8px;

  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;

  color: var(--color-text-muted);
}

.statistics-section {
  margin-top: 28px;
}

.statistics-section h3 {
  margin: 0 0 12px;

  font-size: 1.05rem;
  font-weight: 800;
  color: var(--color-text);
}

.personal-bests-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.personal-best-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 12px 14px;

  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.personal-best-item > div {
  display: flex;
  flex-direction: column;
  gap: 3px;

  min-width: 0;
}

.personal-best-item > div > strong {
  font-size: 0.9rem;
  color: var(--color-text);
}

.personal-best-item > div > span {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.personal-best-score {
  flex-shrink: 0;

  padding: 6px 10px;

  font-size: 0.9rem;
  color: #15803d;

  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
}

.statistics-empty {
  margin: 0;
  padding: 16px;

  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);

  background: var(--color-background);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
}

.recent-activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recent-activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding: 12px 14px;

  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.recent-activity-item > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 3px;

  min-width: 0;
}

.recent-activity-item > div:first-child strong {
  font-size: 0.9rem;
  color: var(--color-text);
}

.recent-activity-item > div:first-child span {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.recent-activity-result {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;

  flex-shrink: 0;
}

.recent-activity-result strong {
  font-size: 1rem;
  font-weight: 800;
  color: var(--color-primary);
}

.recent-activity-result span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

@media (max-width: 600px) {
  .statistics-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .statistics-card,
  .statistics-card:nth-child(4),
  .statistics-card:nth-child(5) {
    grid-column: auto;
    min-width: 0;
    min-height: 95px;
    padding: 14px 8px;
  }

  .statistics-card:nth-child(5) {
    grid-column: 1 / -1;
  }
}

.topic-category-section {
  grid-column: 1 / -1;
  width: 100%;

  margin: 0;
}

#topics {
  gap: 0;
}

.topic-category {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  font-size: 1.05rem;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

.topic-category:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.topic-category-count {
  margin-left: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.topic-category-arrow {
  flex-shrink: 0;
  font-size: 1.5rem;
  line-height: 1;
  transition: transform 0.2s ease;
}

.topic-category-section.open .topic-category-arrow {
  transform: rotate(90deg);
}

.topic-category-topics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 14px 0 20px;
}

.topic-category-topics[hidden] {
  display: none;
}

.topics-loading {
  grid-column: 1 / -1;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;

  width: 100%;
  min-height: 160px;

  color: var(--color-text-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.loading-spinner {
  width: 34px;
  height: 34px;

  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;

  animation: loading-spin 0.7s linear infinite;
}

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

.site-footer {
  margin-top: 48px;
  padding: 32px 20px 24px;

  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

.footer-content {
  max-width: 700px;
  margin: 0 auto;

  display: flex;
  flex-direction: column;
  align-items: center;

  text-align: center;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.footer-brand strong {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-text);
}

.footer-brand span {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-primary);
}

.footer-message {
  margin: 14px 0 20px;

  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.footer-copyright {
  margin: 0;

  font-size: 0.75rem;
  color: var(--color-text-muted);
  opacity: 0.75;
}
