:root {
  --color-primary: #4f46e5;
  --color-primary-strong: #3730a3;
  --color-accent: #ea580c;
  --color-background: #eef2ff;
  --color-surface: #ffffff;
  --color-foreground: #1e1b4b;
  --color-muted: #475569;
  --color-border: #c7d2fe;
  --color-success: #15803d;
  --color-error: #dc2626;
  --color-focus: #1d4ed8;
  --color-soft-indigo: #e0e7ff;
  --color-accent-strong: #c2410c;
  --color-surface-muted: #f8fafc;
  --color-surface-hover: #fafaff;
  --color-border-subtle: #e2e8f0;
  --color-warning-surface: #fff7ed;
  --color-warning: #9a3412;
  --color-warning-border: #fdba74;
  --shadow-soft: 0 14px 38px rgba(55, 48, 163, 0.12);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--color-foreground);
  background: var(--color-background);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  scroll-padding-top: 20px;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--color-background);
  color: var(--color-foreground);
  font-size: 16px;
  line-height: 1.5;
}

button {
  font: inherit;
}

.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;
}

button:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

.page-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 20px 16px 48px;
}

.page-header {
  display: grid;
  gap: 20px;
  align-items: end;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--color-primary-strong);
  font-size: 0.875rem;
  font-weight: 700;
}

h1 {
  max-width: 680px;
  margin: 0;
  color: var(--color-foreground);
  font-size: clamp(2rem, 7vw, 3.6rem);
  line-height: 1.12;
  letter-spacing: 0;
}

.intro {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--color-muted);
}

.goal {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 4px solid var(--color-accent);
  background: var(--color-surface);
  color: var(--color-foreground);
}

.goal strong {
  color: var(--color-primary-strong);
}

.learning-panel {
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
}

.toolbar-copy {
  flex: 1 1 220px;
  color: var(--color-muted);
}

.toolbar-copy strong {
  color: var(--color-foreground);
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-button,
.speak-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.action-button {
  padding: 9px 14px;
  font-weight: 700;
}

.action-button.primary {
  background: var(--color-accent);
  color: var(--color-surface);
}

.action-button.primary:hover,
.action-button.primary:focus-visible {
  background: var(--color-accent-strong);
}

.action-button.secondary {
  border-color: var(--color-border);
  background: var(--color-surface);
  color: var(--color-primary-strong);
}

.action-button.secondary:hover,
.action-button.secondary:focus-visible {
  background: var(--color-soft-indigo);
}

.action-button:active,
.speak-button:active {
  transform: translateY(1px);
}

.action-button:disabled,
.speak-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.speech-status {
  flex: 1 1 100%;
  min-height: 24px;
  margin: 0;
  color: var(--color-muted);
  font-size: 0.9375rem;
}

.speech-support {
  flex: 1 1 100%;
  margin: 0;
  padding: 10px 12px;
  background: var(--color-warning-surface);
  color: var(--color-warning);
  border: 1px solid var(--color-warning-border);
  border-radius: 8px;
}

.table-wrap {
  overflow-x: auto;
}

.verb-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.verb-table th,
.verb-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border-subtle);
  vertical-align: middle;
}

.verb-table th {
  background: var(--color-surface-muted);
  color: var(--color-primary-strong);
  font-size: 0.875rem;
  font-weight: 700;
}

.verb-table tbody tr:last-child td {
  border-bottom: 0;
}

.verb-table tbody tr:hover {
  background: var(--color-surface-hover);
}

.word-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.word {
  min-width: 0;
  color: var(--color-foreground);
  font-family: "Trebuchet MS", "Noto Sans SC", sans-serif;
  font-size: 1.08rem;
  overflow-wrap: anywhere;
}

.speak-button {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-color: var(--color-border);
  background: var(--color-surface);
  color: var(--color-primary-strong);
  font-size: 0.875rem;
  white-space: nowrap;
}

.speak-button:hover,
.speak-button:focus-visible,
.speak-button.is-speaking {
  border-color: var(--color-primary);
  background: var(--color-soft-indigo);
  color: var(--color-primary-strong);
}

.speak-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.meaning-cell {
  color: var(--color-muted);
}

@media (min-width: 700px) {
  .page-shell {
    padding: 32px 24px 64px;
  }

  .page-header {
    grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.6fr);
    gap: 32px;
    margin-bottom: 28px;
  }

  .page-header > :last-child {
    justify-self: end;
  }

  .goal {
    margin-top: 0;
  }
}

@media (min-width: 1024px) {
  .page-shell {
    padding-top: 48px;
  }

  .verb-table th,
  .verb-table td {
    padding: 15px 20px;
  }
}

@media (max-width: 699px) {
  .verb-table,
  .verb-table tbody,
  .verb-table tr,
  .verb-table td {
    display: block;
  }

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

  .verb-table tbody {
    padding: 8px;
  }

  .verb-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 10px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--color-border-subtle);
  }

  .verb-table tr:last-child {
    border-bottom: 0;
  }

  .verb-table td {
    padding: 0;
    border: 0;
  }

  .verb-table td::before {
    display: block;
    margin-bottom: 3px;
    color: var(--color-muted);
    content: attr(data-label);
    font-size: 0.75rem;
    font-weight: 700;
  }

  .verb-table .meaning-cell {
    grid-column: 1 / -1;
    padding-top: 3px;
  }

  .word-cell {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .speak-button {
    min-width: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
