/* Base styles and layout */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gradient-primary);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  transition: all 0.3s ease;
}

/* Theme-aware scrollbars for page and nested scroll areas */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-primary) var(--bg-secondary);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track,
*::-webkit-scrollbar-corner {
  background: var(--bg-secondary);
}

*::-webkit-scrollbar-thumb {
  min-width: 32px;
  min-height: 32px;
  border: 2px solid var(--bg-secondary);
  border-radius: 999px;
  background: var(--border-primary);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
  background-clip: padding-box;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding: 20px;
  border-radius: 16px;
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.header h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.controls {
  display: flex;
  align-items: center;
  gap: 15px;
}

.language-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.textarea-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.textarea-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 1.1rem;
}

textarea {
  width: 100%;
  min-height: 200px;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  box-shadow: var(--glass-shadow);
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  transition: all 0.3s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--text-secondary);
  box-shadow: var(--shadow-primary);
  transform: translateY(-2px);
}

textarea::placeholder {
  color: var(--text-secondary);
  opacity: 0.7;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.stat-card {
  padding: 25px;
  border-radius: 16px;
  background: var(--glass-bg);
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-primary);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Responsive design */
@media (max-width: 768px) {
  .header {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }

  .controls {
    flex-direction: column;
    gap: 15px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .stat-value {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 10px;
  }

  .header {
    padding: 15px;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  textarea {
    min-height: 150px;
    padding: 15px;
  }

  .stat-card {
    padding: 20px;
  }
}

/* d9911 dark UI baseline: local, dependency-free, and motion-aware. */
html {
  background-color: #080b12;
  color-scheme: dark;
  scrollbar-gutter: stable;
}

body {
  min-height: 100vh;
  background-color: #080b12;
  accent-color: #90caf9;
}

::selection {
  background: rgba(144, 202, 249, 0.28);
  color: #ffffff;
}

:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 3px solid #90caf9;
  outline-offset: 3px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #90caf9 #111722;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track,
*::-webkit-scrollbar-corner {
  background: #111722;
}

*::-webkit-scrollbar-thumb {
  min-width: 36px;
  min-height: 36px;
  border: 2px solid #111722;
  border-radius: 999px;
  background: linear-gradient(180deg, #90caf9, #ce93d8);
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #73e8f2, #c6a0ff);
  background-clip: padding-box;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 1000;
  transform: translateY(-180%);
  padding: 0.7rem 1rem;
  border: 1px solid #90caf9;
  border-radius: 10px;
  background: #111722;
  color: #e7edf7;
}

.skip-link:focus { transform: translateY(0); }
