:root {
  color-scheme: light dark;
  --bg: linear-gradient(135deg, #f3e5f5, #ede7f6 40%, #e3f2fd);
  --surface: rgba(255, 255, 255, 0.8);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --border: rgba(81, 45, 168, 0.2);
  --accent: #673ab7;
  --accent-strong: #512da8;
  --text: #1f1a33;
  --text-muted: rgba(31, 26, 51, 0.7);
  --shadow: 0 20px 40px rgba(31, 26, 51, 0.18);
  font-family: "Inter", "Noto Sans Tamil", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-image: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.hero {
  padding: clamp(3rem, 6vw, 6rem) clamp(1.5rem, 5vw, 6rem) 2rem;
  text-align: left;
}

.hero__content {
  max-width: 52rem;
  background: var(--surface);
  padding: clamp(1.5rem, 3vw, 2.75rem);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(103, 58, 183, 0.12);
  color: var(--accent-strong);
  font-weight: 600;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.hero h1 {
  font-size: clamp(2.4rem, 4vw, 3.4rem);
  margin: 1rem 0 0.75rem;
  line-height: 1.1;
}

.hero p {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  margin: 0;
  color: var(--text-muted);
}

.hero__status {
  margin-top: 1.25rem;
  font-size: 0.95rem;
  color: var(--accent-strong);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.layout {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  padding: 0 clamp(1.5rem, 5vw, 6rem) clamp(3rem, 6vw, 5rem);
  flex: 1;
}

.layout__panel {
  background: var(--surface-strong);
  border-radius: 24px;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.layout__panel h2 {
  margin: 0;
  font-size: 1.25rem;
}

.layout__panel--controls {
  max-width: 420px;
  justify-self: center;
}

.mode-toggle {
  display: grid;
  gap: 0.75rem;
}

.mode-toggle__option {
  display: flex;
  align-items: center;
  background: rgba(103, 58, 183, 0.08);
  border-radius: 16px;
  padding: 0.75rem 1rem;
  border: 1px solid transparent;
  transition: border 0.2s ease, background 0.2s ease;
}

.mode-toggle__option input {
  margin-right: 0.75rem;
  accent-color: var(--accent);
}

.mode-toggle__label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.mode-toggle__label strong {
  font-size: 1rem;
}

.mode-toggle__label small {
  color: var(--text-muted);
}

.mode-toggle__option:focus-within,
.mode-toggle__option:hover {
  border-color: rgba(81, 45, 168, 0.45);
  background: rgba(103, 58, 183, 0.12);
}

.helper-card {
  background: rgba(81, 45, 168, 0.08);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  color: var(--text-muted);
}

.helper-card h3 {
  margin: 0 0 0.6rem;
  font-size: 1rem;
  color: var(--accent-strong);
}

.helper-card ul {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.5rem;
}

.helper-card kbd {
  font-family: "Fira Code", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  background: rgba(255, 255, 255, 0.7);
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  border: 1px solid rgba(81, 45, 168, 0.2);
  box-shadow: inset 0 -2px 0 rgba(81, 45, 168, 0.15);
}

.typing {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.typing label {
  font-weight: 600;
}

.typing__area {
  min-height: 180px;
  border-radius: 18px;
  border: 1px solid rgba(31, 26, 51, 0.1);
  padding: 1rem 1.25rem;
  font-size: 1.1rem;
  line-height: 1.5;
  resize: vertical;
  font-family: "Noto Sans Tamil", "Hind Vadodara", "Inter", sans-serif;
  background: rgba(255, 255, 255, 0.9);
  color: inherit;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.typing__area:focus {
  outline: none;
  border-color: rgba(81, 45, 168, 0.45);
  box-shadow: 0 0 0 4px rgba(103, 58, 183, 0.2);
}

.typing__area--output {
  background: rgba(255, 255, 255, 0.75);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.actions button {
  border: none;
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 18px rgba(81, 45, 168, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.actions button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(81, 45, 168, 0.28);
}

.actions button:active {
  transform: translateY(0);
  box-shadow: 0 8px 16px rgba(81, 45, 168, 0.2);
}

.actions button.secondary {
  background: rgba(103, 58, 183, 0.08);
  color: var(--accent-strong);
  box-shadow: none;
  border: 1px solid rgba(81, 45, 168, 0.25);
}

.stats {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.layout__panel--features {
  gap: 1rem;
}

.layout__panel--features ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.layout__panel--features li {
  background: rgba(103, 58, 183, 0.08);
  border-radius: 16px;
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  border: 1px solid rgba(81, 45, 168, 0.15);
}

.layout__panel--features h3 {
  margin: 0 0 0.4rem;
  color: var(--accent-strong);
  font-size: 1.05rem;
}

.footer {
  text-align: center;
  padding: 2rem 1.5rem 3rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-strong);
  color: white;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  box-shadow: 0 18px 32px rgba(81, 45, 168, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -0.5rem);
}

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

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .layout__panel--controls {
    order: -1;
    max-width: none;
  }

  .layout__panel {
    box-shadow: 0 12px 24px rgba(31, 26, 51, 0.14);
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: linear-gradient(135deg, #1c1633, #1f193b 45%, #14213d);
    --surface: rgba(30, 24, 55, 0.75);
    --surface-strong: rgba(25, 21, 45, 0.95);
    --border: rgba(255, 255, 255, 0.06);
    --text: #f1eafa;
    --text-muted: rgba(241, 234, 250, 0.7);
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  }

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

  .actions button.secondary {
    background: rgba(255, 255, 255, 0.08);
  }
}
