:root {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: rgba(255, 255, 255, 0.9);
  --card: rgba(255, 255, 255, 0.96);
  --card-strong: #ffffff;
  --ink: #101828;
  --muted: rgba(16, 24, 40, 0.62);
  --faint: rgba(16, 24, 40, 0.08);
  --line: rgba(16, 24, 40, 0.12);
  --accent: #22c55e;
  --accent-2: #38bdf8;
  --danger: #ff6b7f;
  --success: #55e6a5;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.45);
  --accent-glow: 0 18px 52px rgba(34, 197, 94, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -10%, rgba(34, 197, 94, 0.16), transparent 32%),
    radial-gradient(circle at 85% 12%, rgba(56, 189, 248, 0.14), transparent 26%),
    var(--bg);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(16, 24, 40, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 24, 40, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, black 0%, black 62%, transparent 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #11131a;
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: var(--accent-glow);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 62px rgba(34, 197, 94, 0.38);
}

button:active {
  transform: translateY(0);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.file-picker:focus-visible {
  outline: 3px solid rgba(34, 197, 94, 0.28);
  outline-offset: 3px;
}

.secondary,
.ghost,
.tab-button,
.special-key {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  box-shadow: none;
}

.secondary:hover,
.ghost:hover,
.tab-button:hover,
.special-key:hover {
  border-color: rgba(16, 24, 40, 0.2);
  background: #ffffff;
  box-shadow: none;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px;
}

.hero-panel {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 0 42px;
  animation: panelIn 520ms ease both;
}

.hero-copy {
  max-width: 900px;
  margin: 0 auto 24px;
  text-align: center;
}

.eyebrow,
.label,
.stat-label,
.paste-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy .eyebrow {
  margin-bottom: 10px;
  color: rgba(16, 24, 40, 0.66);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  color: var(--ink);
  font-size: clamp(3.2rem, 8vw, 7.3rem);
  font-weight: 950;
  line-height: 0.9;
}

h1 span {
  color: var(--accent-2);
}

h2 {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 950;
  line-height: 1;
}

.hero-subtitle {
  max-width: 760px;
  margin: 24px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.45rem);
  font-weight: 750;
  line-height: 1.45;
}

.feature-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.feature-pills span,
.view-tabs {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
}

.feature-pills span {
  padding: 10px 18px;
  color: rgba(16, 24, 40, 0.72);
  font-weight: 850;
}

.view-tabs {
  display: flex;
  width: fit-content;
  gap: 6px;
  margin: 0 auto 18px;
  padding: 6px;
}

.tab-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
}

.tab-button.active {
  border-color: transparent;
  background: #101828;
  color: #ffffff;
}

.trainer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.practice-card,
.import-card {
  width: min(880px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.82)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.practice-card,
.import-card {
  padding: 20px;
}

.hidden {
  display: none !important;
}

.practice-card.hidden,
.import-card:not(.hidden) {
  animation: panelIn 260ms ease both;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  min-height: 72px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.stat strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 1.65rem;
  line-height: 1;
}

.accent-stat {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.18), rgba(56, 189, 248, 0.12));
}

.word-card {
  position: relative;
  overflow: hidden;
  min-height: 220px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 92% 12%, rgba(34, 197, 94, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.86)),
    var(--card-strong);
}

.word-card::after {
  position: absolute;
  right: 18px;
  bottom: 8px;
  color: rgba(16, 24, 40, 0.045);
  content: "DE";
  font-size: clamp(7rem, 20vw, 14rem);
  font-weight: 950;
  line-height: 0.8;
}

.word-card.is-changing {
  animation: wordPulse 280ms ease both;
}

.word-card-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.meaning {
  position: relative;
  z-index: 1;
  max-width: 760px;
  min-height: 92px;
  margin: 30px 0 0;
  color: var(--ink);
  font-size: clamp(2rem, 4.2vw, 4rem);
  font-weight: 950;
  line-height: 1.05;
}

.letter {
  display: inline-grid;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: #101828;
  color: #ffffff;
  font-size: 1.8rem;
  font-weight: 950;
}

.feedback {
  min-height: 30px;
  margin: 12px 0 0;
  font-weight: 900;
}

.feedback.correct {
  color: var(--success);
}

.feedback.wrong {
  color: var(--danger);
}

.voice-status {
  min-height: 22px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.answer-form {
  margin-top: 12px;
}

.answer-form label,
.paste-label {
  display: block;
  margin-bottom: 8px;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

input {
  min-height: 54px;
  padding: 0 16px;
  font-size: 1.05rem;
}

textarea {
  min-height: 150px;
  padding: 14px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: rgba(34, 197, 94, 0.65);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.special-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.special-key {
  min-width: 44px;
  min-height: 40px;
  padding: 0 12px;
  font-size: 1.08rem;
}

.actions,
.import-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.import-actions {
  flex-wrap: wrap;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.compact-button {
  min-height: 40px;
  padding: 0 12px;
}

.template-box {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
}

.template-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 900;
  text-transform: uppercase;
}

pre {
  overflow-x: auto;
  margin: 0;
  color: var(--ink);
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.45;
}

.file-picker {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  cursor: pointer;
  font-weight: 850;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease;
}

.file-picker:hover {
  transform: translateY(-1px);
  border-color: rgba(16, 24, 40, 0.2);
  background: #ffffff;
}

.file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.import-feedback {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 850;
}

.import-feedback.success {
  color: var(--success);
}

.import-feedback.wrong {
  color: var(--danger);
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes wordPulse {
  0% {
    opacity: 0.76;
    transform: translateY(6px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .hero-panel {
    padding-top: 10px;
  }

  .hero-copy {
    text-align: left;
  }

  h1 {
    font-size: clamp(3rem, 16vw, 4.4rem);
  }

  .hero-subtitle {
    margin-top: 18px;
    font-size: 1rem;
  }

  .feature-pills,
  .view-tabs {
    justify-content: flex-start;
  }

  .feature-pills {
    gap: 8px;
  }

  .feature-pills span {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  .view-tabs {
    width: 100%;
  }

  .tab-button {
    flex: 1;
  }

  .practice-card,
  .import-card {
    padding: 14px;
  }

  .input-row,
  .actions,
  .import-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .word-card {
    min-height: 210px;
    padding: 18px;
  }

  .meaning {
    min-height: 84px;
    margin-top: 26px;
    font-size: clamp(1.65rem, 9vw, 2.65rem);
  }

  .letter {
    width: 50px;
    height: 50px;
  }

  .special-key {
    flex: 1 1 44px;
  }
}

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