*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #111;
  background: #fafafa;
}

.symbol-text {
  font-family: "Noto Sans Symbols 2", "Noto Sans Symbols", "Segoe UI Symbol",
    "Apple Symbols", "Arial Unicode MS", sans-serif;
  font-size: 1.75rem;
  line-height: 1.6;
  font-variant-ligatures: none;
  letter-spacing: 0;
  word-spacing: 0;
  white-space: pre-wrap;
}

.fallback-banner {
  flex-shrink: 0;
  background: #fef3c7;
  border-bottom: 1px solid #f59e0b;
  color: #92400e;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.9rem;
}

.site-header {
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #ddd;
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-brand {
  min-width: 0;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}

.site-brand:hover .site-name {
  color: #2563eb;
}

.site-name {
  display: block;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
}

.tagline {
  margin: 0.15rem 0 0;
  color: #666;
  font-size: 0.8rem;
  line-height: 1.3;
}

.main-nav {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
  gap: 0;
}

.main-nav-primary {
  display: flex;
  align-items: stretch;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-dropdown-chevron {
  font-size: 0.65rem;
  opacity: 0.6;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 11rem;
  margin-top: -1px;
  padding: 0.35rem 0;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.nav-dropdown-menu[hidden] {
  display: none;
}

.nav-dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  border-bottom: none;
  border-radius: 0;
}

.nav-dropdown-item:hover {
  background: #fafafa;
}

.nav-dropdown-item.tab-btn--active {
  background: #f5f5f5;
}

.nav-dropdown--open .nav-dropdown-trigger,
.nav-dropdown--child-active .nav-dropdown-trigger {
  color: #111;
}

.nav-dropdown--child-active .nav-dropdown-trigger {
  font-weight: 600;
  border-bottom-color: #111;
}

.server-note {
  margin: 0.75rem 0 0;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.85rem;
  color: #555;
}

code {
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, monospace;
  font-size: 0.9em;
  background: #f0f0f0;
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

.tab-btn {
  flex-shrink: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.875rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #555;
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #111;
  background: #fafafa;
}

.tab-btn--active {
  color: #111;
  font-weight: 600;
  border-bottom-color: #111;
}

.main-content {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

.site-footer {
  flex-shrink: 0;
  border-top: 1px solid #e5e7eb;
  background: #fff;
}

.site-footer-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem 1.5rem;
  text-align: center;
}

.site-footer-copy,
.site-footer-links {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #6b7280;
}

.site-footer-links {
  margin-top: 0.35rem;
}

.site-footer a {
  color: #4b5563;
  text-decoration: none;
}

.site-footer a:hover {
  color: #2563eb;
  text-decoration: underline;
}

.site-footer-sep {
  margin: 0 0.35rem;
}

.panel {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

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

/* Home page */
.home-page {
  --home-prose-width: 38rem;
  margin-bottom: 2rem;
}

.home-page > .home-section {
  margin-bottom: 0;
  padding-bottom: 3rem;
}

.home-page > .home-section + .home-section {
  padding-top: 3rem;
  border-top: 1px solid #e5e7eb;
}

.home-section--intro {
  padding-top: 0.5rem;
  border-top: none;
}

.home-intro-header {
  margin-bottom: 1.75rem;
  max-width: var(--home-prose-width);
}

.home-intro-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2.25rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: #0f172a;
}

.home-subtitle {
  margin: 0;
  font-size: 1.125rem;
  color: #64748b;
  font-weight: 500;
  line-height: 1.45;
}

.home-prose {
  max-width: var(--home-prose-width);
}

.home-prose p {
  margin: 0 0 1.1rem;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: #334155;
}

.home-prose p:last-child {
  margin-bottom: 0;
}

.home-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.home-section > p,
.home-section > .home-list {
  max-width: var(--home-prose-width);
}

.home-section p {
  margin: 0 0 0.9rem;
  font-size: 1rem;
  line-height: 1.65;
  color: #334155;
}

.home-how-subheading {
  margin: 2rem 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.home-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.home-symbol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.75rem;
  margin: 0.5rem 0 1.5rem;
  max-width: 44rem;
}

.home-symbol-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  padding: 1rem 0.65rem 0.85rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.home-symbol-card--place {
  border-top: 3px solid #3b82f6;
}

.home-symbol-card--manner {
  border-top: 3px solid #8b5cf6;
}

.home-symbol-glyph {
  font-size: 2.25rem;
  line-height: 1.2;
}

.home-symbol-glyph--empty {
  color: #94a3b8;
}

.home-symbol-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.3;
}

.home-symbol-note {
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.25;
}

.home-principles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.85rem;
  max-width: 52rem;
}

.home-principle {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.1rem 1.15rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.home-principle h3 {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
}

.home-principle p {
  margin: 0;
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.55;
  max-width: none;
}

.home-list {
  margin: 0;
  padding-left: 1.35rem;
  line-height: 1.65;
  color: #334155;
}

.home-list li {
  margin-bottom: 0.4rem;
}

.home-list--goals {
  list-style: none;
  padding-left: 0;
}

.home-list--goals li {
  position: relative;
  padding-left: 1.35rem;
  margin-bottom: 0.55rem;
}

.home-list--goals li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: #94a3b8;
}

.home-status-emphasis {
  margin-top: 1rem;
  max-width: var(--home-prose-width);
  font-size: 1rem;
  line-height: 1.65;
  color: #0f172a;
}

.home-section--sample {
  padding-top: 2.5rem;
}

.home-section--sample > h2 {
  margin-bottom: 1.25rem;
}

.home-sample-preview {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.35rem 1.5rem 1.25rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.home-sample-preview__header {
  margin-bottom: 1.15rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid #f1f5f9;
}

.home-sample-preview__lang {
  margin: 0 0 0.2rem;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #0f172a;
}

.home-sample-preview__source {
  margin: 0;
  font-size: 0.8125rem;
  color: #64748b;
}

.home-sample-preview__block {
  margin-bottom: 1.1rem;
}

.home-sample-preview__block:last-of-type {
  margin-bottom: 0;
}

.home-sample-preview__label {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.home-sample-preview__original {
  margin: 0;
  font-size: 1rem;
  line-height: 1.65;
  color: #0f172a;
}

.home-sample-preview__fonora {
  margin: 0;
  padding: 1rem 1.1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1.25rem;
  line-height: 1.75;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
}

.home-sample-preview__fonora--loading,
.home-sample-preview__fonora.sample-card__fonora--loading {
  opacity: 0.45;
}

.home-sample-preview__fonora .tts-word {
  border-radius: 4px;
  padding: 0.05em 0.1em;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.home-sample-preview__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid #f1f5f9;
}

.home-sample-preview__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.85rem;
  min-width: 0;
}

.home-sample-more-btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.home-section--status {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.5rem 1.5rem 1.35rem;
}

.home-section--status p:last-child {
  margin-bottom: 0;
}

.panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
}

.panel h3 {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
}

.section-desc {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: #555;
}

.symbol-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  resize: vertical;
  min-height: 6rem;
  background: #fff;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.btn {
  padding: 0.45rem 0.85rem;
  font-size: 0.875rem;
  border: 1px solid #bbb;
  border-radius: 4px;
  background: #fff;
  color: #111;
  cursor: pointer;
}

.btn:hover {
  background: #f5f5f5;
}

.btn--primary {
  background: #111;
  color: #fff;
  border-color: #111;
}

.btn--primary:hover {
  background: #333;
}

.btn--small {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
}

.symbol-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1rem;
}

.symbol-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 4.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.symbol-btn:hover {
  background: #f5f5f5;
  border-color: #999;
}

.symbol-btn--place {
  border-color: #aaa;
}

.symbol-btn--modifier {
  border-style: dashed;
}

.symbol-btn .symbol-text {
  font-size: 2rem;
  line-height: 1.2;
}

.symbol-btn-label {
  font-size: 0.7rem;
  color: #666;
  margin-top: 0.25rem;
  text-align: center;
}

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

.table-wrap--scroll {
  -webkit-overflow-scrolling: touch;
}

.data-table,
.sound-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td,
.sound-grid th,
.sound-grid td {
  border: 1px solid #ddd;
  padding: 0.5rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

.data-table th,
.sound-grid th {
  background: #f5f5f5;
  font-weight: 600;
}

.sound-grid .grid-cell {
  min-width: 7rem;
  cursor: default;
}

.grid-cell--defined {
  cursor: pointer;
}

.grid-cell--defined:hover,
.grid-cell--defined:focus {
  background: #f0f7ff;
  outline: 2px solid #999;
  outline-offset: -2px;
}

.grid-cell--undefined {
  background: #f5f5f5;
  border-style: dashed;
  color: #666;
}

.grid-cell--reserved {
  background: #f8f8f8;
  border-style: dashed;
  color: #777;
}

.grid-cell--empty {
  color: #aaa;
  text-align: center;
}

.grid-cell-symbols {
  font-size: 1.5rem;
  line-height: 1.4;
}

.grid-cell-sound {
  font-weight: 600;
  margin-top: 0.25rem;
}

.grid-cell-ipa {
  font-size: 0.8rem;
  color: #555;
}

.grid-cell-explanation {
  font-size: 0.75rem;
  color: #666;
  margin-top: 0.25rem;
}

.grid-cell-status {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #888;
  margin-top: 0.35rem;
}

.derived-row--defined {
  cursor: pointer;
}

.derived-row--defined:hover,
.derived-row--defined:focus {
  background: #f0f7ff;
  outline: 2px solid #999;
  outline-offset: -2px;
}

.derived-row--undefined {
  color: #666;
  background: #fafafa;
}

.derived-row--reserved {
  color: #777;
  background: #f8f8f8;
}

#derived-sounds-section h3 {
  margin-top: 1.5rem;
}

.draft-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  background: #fef3c7;
  color: #92400e;
  vertical-align: middle;
}

.draft-badge--reserved {
  background: #f3f4f6;
  color: #6b7280;
}

#vowels-section h3 {
  margin-top: 1.5rem;
}

.data-table .recipe-cell {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  white-space: normal;
  color: #444;
}

.examples-heading {
  margin: 1rem 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: #444;
}

.vowel-table-row {
  cursor: pointer;
}

.vowel-table-row:hover,
.vowel-table-row:focus {
  background: #fffbeb;
  outline: 2px solid #f59e0b;
  outline-offset: -2px;
}

.encode-step {
  margin: 0.35rem 0;
  font-size: 0.875rem;
}

.encode-list {
  margin: 0.25rem 0 0 1.25rem;
  padding: 0;
  font-size: 0.85rem;
  color: #555;
}

.encode-list li {
  margin-bottom: 0.15rem;
}

.decode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.decode-field h3 {
  margin-top: 0;
}

.decode-value {
  padding: 0.75rem;
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  min-height: 2.5rem;
  font-size: 0.9rem;
}

.decode-pronunciation {
  font-size: 1.25rem;
  font-weight: 600;
}

.decode-group {
  margin-bottom: 0.35rem;
}

.warning-item {
  color: #92400e;
  margin-bottom: 0.25rem;
}

.no-warnings {
  color: #666;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.text-input {
  padding: 0.45rem 0.65rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.95rem;
  min-width: 10rem;
  flex: 1;
}

.text-input--full {
  width: 100%;
  flex: none;
  display: block;
  box-sizing: border-box;
}

.reverse-output,
.translate-result {
  padding: 0.75rem;
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  min-height: 2rem;
}

.reverse-result {
  margin-bottom: 0.5rem;
}

.reverse-meta {
  display: block;
  font-size: 0.85rem;
  color: #555;
  margin-top: 0.25rem;
}

.quiz-stats {
  font-size: 0.9rem;
  color: #444;
  margin-bottom: 0.75rem;
}

.quiz-type-row {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.quiz-layout {
  display: grid;
  grid-template-columns: 1fr min(16rem, 32%);
  gap: 1rem;
  align-items: start;
}

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

.quiz-hints-panel {
  padding: 1rem;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
}

.quiz-hints-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.quiz-hints {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.quiz-hints[hidden] {
  display: none;
}

.quiz-hint {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.quiz-hint-symbol {
  flex-shrink: 0;
  min-width: 1.25rem;
}

.quiz-hint-label {
  color: #444;
}

.quiz-area {
  padding: 1rem;
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
}

.quiz-prompt-label {
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quiz-prompt {
  font-size: 2rem;
  margin: 0.5rem 0 1rem;
  min-height: 2.5rem;
}

.quiz-feedback {
  margin-top: 0.75rem;
  font-size: 0.95rem;
}

.quiz-feedback--ok {
  color: #166534;
}

.quiz-feedback--miss {
  color: #991b1b;
}

.dict-form {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  gap: 0.25rem;
}

.form-row label {
  font-size: 0.85rem;
  color: #444;
}

.search-row {
  margin-bottom: 0.75rem;
}

.search-row label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.glossary-list {
  display: grid;
  gap: 0.65rem;
}

.glossary-entry {
  padding: 0.75rem;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  background: #fafafa;
}

.glossary-entry-main {
  margin-bottom: 0.35rem;
}

.glossary-spelling {
  font-size: 1.25rem;
}

.glossary-pron {
  color: #555;
  font-size: 0.9rem;
}

.glossary-notes {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.translator-block {
  margin-bottom: 1.25rem;
}

.translator-block h3 {
  margin-top: 0;
}

.translate-encode {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
}

.encode-hint {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  color: #555;
}

.translate-result--nested {
  margin-top: 0.75rem;
}

.translate-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.translate-badge--dict {
  background: #e5e5e5;
  color: #333;
}

.translate-badge--miss,
.translate-badge--decoded {
  background: #fef3c7;
  color: #92400e;
}

.translate-badge--encoded {
  background: #dbeafe;
  color: #1e40af;
}

.translate-meta {
  font-size: 0.9rem;
  color: #555;
  margin-left: 0.35rem;
}

.translate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.translate-saved {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: #166534;
}

.translate-encode label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: #444;
}

.sub-tab-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid #ddd;
  margin-bottom: 1.25rem;
}

.sub-tab-btn {
  padding: 0.55rem 0.85rem;
  font-size: 0.85rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #555;
  cursor: pointer;
  margin-bottom: -1px;
}

.sub-tab-btn:hover {
  color: #111;
}

.sub-tab-btn--active {
  color: #111;
  font-weight: 600;
  border-bottom-color: #111;
}

.translate-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 0.25rem;
}

.translate-control label {
  display: block;
  font-size: 0.85rem;
  color: #444;
  margin: 0 0 0.35rem;
}

.translate-main label,
#tab-translator > label {
  display: block;
  font-size: 0.85rem;
  color: #444;
  margin: 0.75rem 0 0.35rem;
}

#tab-translator > .section-desc + .translate-controls ~ label:first-of-type,
#tab-translator > label:first-of-type {
  margin-top: 0;
}

.translate-output {
  min-height: 3.5rem;
  font-size: 1.5rem;
}

.translate-details-section {
  margin-top: 1.25rem;
  padding: 1rem;
  background: #f5f5f5;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
}

.sub-tab-panel label {
  display: block;
  font-size: 0.85rem;
  color: #444;
  margin: 0.75rem 0 0.35rem;
}

.sub-tab-panel label:first-of-type {
  margin-top: 0;
}

.quiz-symbol-input {
  min-height: 3rem;
  font-size: 1.25rem;
}

.translate-details-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.translate-meta-panel {
  font-size: 0.875rem;
  line-height: 1.45;
}

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

.translate-meta-panel .encode-step {
  margin: 0.5rem 0;
}

.translate-meta-panel .encode-step:first-child {
  margin-top: 0;
}

.translate-meta-empty {
  color: #666;
  font-size: 0.875rem;
}

.translate-meta-row {
  margin: 0.5rem 0;
  min-height: 1.5rem;
  font-size: 0.875rem;
}

.translate-decode-preview {
  margin-top: 0.75rem;
  padding: 0.65rem 0.75rem;
  background: #fafafa;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  font-size: 0.875rem;
  color: #444;
}

.symbol-buttons--compact {
  margin-top: 0.5rem;
}

.symbol-buttons--compact .symbol-btn {
  min-width: 3.25rem;
  padding: 0.35rem 0.5rem;
}

.symbol-buttons--compact .symbol-btn .symbol-text {
  font-size: 1.5rem;
}

.symbol-buttons--compact .symbol-btn-label {
  font-size: 0.65rem;
}

/* Encoder Testing */
.encoder-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem;
  background: #f5f5f5;
  border-radius: 6px;
  border: 1px solid #e5e5e5;
}

.encoder-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.encoder-stat--wide {
  grid-column: span 2;
}

.encoder-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
}

.encoder-stat-value {
  font-size: 1rem;
  font-weight: 600;
}

.encoder-stat-value--ok { color: #15803d; }
.encoder-stat-value--bad { color: #b91c1c; }
.encoder-stat-value--warn { color: #a16207; }

.encoder-sub-tab-nav {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid #ddd;
}

.encoder-sub-tab-btn {
  padding: 0.5rem 0.85rem;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
  color: #555;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.encoder-sub-tab-btn--active {
  color: #111;
  font-weight: 600;
  border-bottom-color: #111;
}

.encoder-sub-tab-panel[hidden] {
  display: none;
}

.encoder-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 0.35rem 1rem;
  margin-bottom: 1rem;
}

.encoder-category-label {
  font-size: 0.875rem;
  cursor: pointer;
}

.encoder-generate-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.encoder-count-input {
  width: 5rem;
}

.encoder-manual-input {
  width: 100%;
  max-width: 32rem;
  margin-bottom: 0.75rem;
}

.encoder-controls-bar,
.encoder-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.encoder-filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
}

.encoder-filter-bar select {
  min-width: 9rem;
}

.encoder-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 0.75rem;
}

.encoder-card {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0.75rem;
  background: #fff;
  font-size: 0.875rem;
}

.encoder-card--dict {
  border-color: #94a3b8;
  background: #f8fafc;
}

.encoder-card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.encoder-card-word {
  font-size: 1rem;
}

.encoder-card-set {
  font-size: 0.75rem;
  color: #666;
  background: #eee;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.encoder-pipeline {
  margin: 0 0 0.5rem;
  display: grid;
  gap: 0.25rem;
}

.encoder-pipeline > div {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.5rem;
}

.encoder-pipeline dt {
  margin: 0;
  font-size: 0.75rem;
  color: #666;
}

.encoder-pipeline dd {
  margin: 0;
  word-break: break-all;
}

.encoder-pipeline .symbol-text {
  font-size: 1.25rem;
}

.encoder-double-letter {
  font-size: 0.8rem;
  color: #92400e;
  background: #fef3c7;
  padding: 0.35rem 0.5rem;
  border-radius: 3px;
  margin-bottom: 0.5rem;
}

.encoder-actions-detail {
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.encoder-actions-detail ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.encoder-breakdown {
  margin-bottom: 0.5rem;
}

.encoder-breakdown-row {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}

.encoder-breakdown-row .symbol-text {
  font-size: 1.1rem;
}

.encoder-warnings {
  margin-bottom: 0.5rem;
}

.encoder-review {
  border-top: 1px solid #eee;
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}

.encoder-review-buttons {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.btn--sm {
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
}

.encoder-review-btn--active.encoder-review-btn--correct {
  background: #dcfce7;
  border-color: #15803d;
}

.encoder-review-btn--active.encoder-review-btn--wrong {
  background: #fee2e2;
  border-color: #b91c1c;
}

.encoder-review-btn--active.encoder-review-btn--unsure {
  background: #fef3c7;
  border-color: #a16207;
}

.encoder-issue-tags {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.25rem;
  margin-bottom: 0.5rem;
}

.encoder-issue-tags--hidden {
  display: none;
}

.encoder-issue-tag {
  font-size: 0.75rem;
  cursor: pointer;
}

.encoder-notes-label {
  display: block;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.encoder-notes {
  width: 100%;
  margin-top: 0.25rem;
  font-size: 0.8rem;
}

.encoder-glossary-promote {
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.encoder-glossary-form {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.encoder-glossary-form label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
}

.encoder-glossary-saved {
  color: #15803d;
  margin: 0;
}

.encoder-empty {
  color: #666;
  grid-column: 1 / -1;
}

.translate-status {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.translate-status--error {
  color: #b91c1c;
}

.encoder-card-lang,
.encoder-card-voice {
  font-size: 0.75rem;
  color: #1d4ed8;
  background: #dbeafe;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
}

.encoder-pipeline--compact > div {
  grid-template-columns: 7rem 1fr;
}

@media (max-width: 640px) {
  .site-header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.75rem 1rem;
  }

  .main-nav {
    border-top: 1px solid #eee;
    padding-top: 0.35rem;
  }

  .main-nav-primary {
    flex: 1;
  }

  .main-nav-primary .tab-btn,
  .nav-dropdown-trigger {
    flex: 1;
    justify-content: center;
    padding: 0.55rem 0.5rem;
    font-size: 0.8rem;
  }

  .nav-dropdown {
    flex: 1;
  }

  .nav-dropdown-trigger {
    width: 100%;
  }

  .nav-dropdown-menu {
    left: 0;
    right: 0;
    min-width: 0;
  }

  .tab-btn {
    padding: 0.65rem 0.75rem;
    font-size: 0.8rem;
  }

  .home-page > .home-section {
    padding-bottom: 2.25rem;
  }

  .home-page > .home-section + .home-section {
    padding-top: 2.25rem;
  }

  .home-intro-header h1 {
    font-size: 2.1rem;
  }

  .home-subtitle,
  .home-prose p {
    font-size: 1rem;
  }

  .home-sample-preview__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .home-sample-preview__actions {
    width: 100%;
  }

  .home-sample-more-btn {
    width: 100%;
    text-align: center;
  }

  .home-section-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .home-section-actions .btn {
    width: 100%;
    text-align: center;
  }

  .home-symbol-grid {
    grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  }

  .decode-grid {
    grid-template-columns: 1fr;
  }

  .symbol-btn {
    min-width: 3.5rem;
  }

  .inline-form {
    flex-direction: column;
    align-items: stretch;
  }

  .text-input {
    min-width: 0;
    width: 100%;
  }
}

/* Alphabet lab */
.alphabet-status {
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  background: #eff6ff;
  color: #1e40af;
}

.alphabet-status[data-kind="success"] {
  background: #dcfce7;
  color: #15803d;
}

.alphabet-actions {
  margin-bottom: 1.25rem;
}

.alphabet-primary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.alphabet-inventory-group {
  margin-bottom: 1.5rem;
}

.alphabet-inventory-group .examples-heading {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.alphabet-inventory-table .alphabet-inventory-key {
  font-weight: 600;
  font-family: ui-monospace, monospace;
}

.alphabet-inventory-table .alphabet-inventory-symbol {
  font-size: 1.35rem;
}

.alphabet-inventory-notes {
  font-size: 0.85rem;
  color: #555;
}

.keyboard-mapping-table {
  max-width: 36rem;
}

.alphabet-card {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.75rem;
  background: #fff;
  position: relative;
}

.alphabet-card--vowel_plane {
  border-color: #c4b5fd;
  background: #faf5ff;
}

.alphabet-card-head {
  margin-bottom: 0.35rem;
}

.alphabet-card-label {
  font-weight: 600;
  font-size: 0.85rem;
}

.alphabet-card-markdown {
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 0.5rem;
}

.alphabet-symbol-input {
  width: 100%;
  font-size: 1.75rem;
  text-align: center;
  padding: 0.35rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.alphabet-changed-badge {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  background: #fef3c7;
  color: #92400e;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.alphabet-preview-stack {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.alphabet-preview-block {
  min-width: 0;
}

.alphabet-preview-table td,
.alphabet-preview-table th {
  font-size: 1.1rem;
  padding: 0.35rem 0.5rem;
}

/* kept for potential reuse */

/* Pronunciation Validation Mode */
.pv-dashboard {
  margin-bottom: 1rem;
}

.pv-controls {
  margin-bottom: 1rem;
}

.pv-controls label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.pv-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

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

.pv-single-panel h3,
.pv-batch-panel h3 {
  margin-top: 0;
  font-size: 1rem;
}

.pv-input-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.pv-input-row .text-input {
  flex: 1;
}

.pv-batch-input {
  width: 100%;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.pv-empty {
  color: #666;
  font-size: 0.9rem;
}

.pv-card {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 1rem;
  background: #fafafa;
}

.pv-card--match {
  border-left: 4px solid #15803d;
}

.pv-card--mismatch {
  border-left: 4px solid #b91c1c;
}

.pv-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.pv-word {
  margin: 0;
  font-size: 1.25rem;
}

.pv-audio-row {
  display: flex;
  gap: 0.35rem;
}

.pv-section {
  margin-bottom: 0.75rem;
}

.pv-section h4 {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #555;
}

.pv-comparison-grid {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: ui-monospace, monospace;
  font-size: 0.9rem;
}

.pv-comparison-label {
  color: #555;
}

.pv-status {
  font-weight: 600;
}

.pv-status--match {
  color: #15803d;
}

.pv-status--mismatch {
  color: #b91c1c;
}

.pv-key-note {
  margin-top: 0.35rem;
  font-size: 0.85rem;
}

.pv-collision-warnings {
  margin: 0.5rem 0;
}

.pv-collision-item {
  font-size: 0.85rem;
}

.pv-investigation {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.pv-decoder-path {
  word-break: break-word;
  white-space: normal;
}

.pv-meta-note {
  font-size: 0.8rem;
  color: #666;
}

.pv-notes-list {
  margin: 0.5rem 0 0 1.25rem;
  padding: 0;
  font-size: 0.85rem;
}

.pv-batch-table-wrap {
  margin-top: 1rem;
}

.pv-batch-table .pv-word-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #2563eb;
  cursor: pointer;
  text-decoration: underline;
}

.pv-row--match {
  background: #f0fdf4;
}

.pv-row--mismatch {
  background: #fef2f2;
}

.pv-row--error {
  background: #fff7ed;
}

.tts-controls {
  margin-bottom: 1rem;
}

.tts-read-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.tts-read-mode-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
}

.tts-engine-row {
  border: none;
  padding: 0;
  margin: 0 0 1rem;
}

.tts-engine-row legend {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  padding: 0;
}

.tts-engine-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 1.25rem;
  font-size: 0.95rem;
  font-weight: 400;
  cursor: pointer;
}

.tts-controls label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.tts-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: #eff6ff;
  border: 2px solid #60a5fa;
  border-radius: 8px;
  color: #1e3a8a;
  font-size: 1rem;
  font-weight: 600;
}

.tts-loading[hidden] {
  display: none !important;
}

.tts-loading-spinner {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  border: 3px solid #bfdbfe;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: tts-spin 0.75s linear infinite;
}

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

.tts-loading-message {
  line-height: 1.4;
}

.tts-display {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  min-height: 3.5rem;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
}

.tts-display--loading {
  opacity: 0.45;
  pointer-events: none;
}

.tts-word {
  border-radius: 4px;
  padding: 0.05em 0.1em;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.tts-word--active {
  background: #fef08a;
  box-shadow: 0 0 0 2px #facc15;
}

.tts-word--done {
  background: #dcfce7;
}

.tts-empty {
  color: #666;
  font-size: 0.95rem;
}

.tts-status {
  font-size: 0.9rem;
  color: #444;
  margin-top: 0.75rem;
}

.tts-status--error {
  color: #b91c1c;
  font-weight: 600;
}

.tts-status--success {
  color: #166534;
}

/* Language Samples */
.samples-page {
  margin-bottom: 2rem;
}

.samples-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid #e5e7eb;
}

.samples-header h2 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.samples-subtitle {
  margin: 0;
  font-size: 1.1rem;
  color: #555;
  font-weight: 500;
}

.samples-intro {
  margin: 0 0 0.85rem;
  max-width: 42rem;
  line-height: 1.65;
  color: #333;
}

.samples-disclaimer {
  margin: 0 0 1.75rem;
  padding: 0.85rem 1rem;
  max-width: 42rem;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 6px;
  color: #92400e;
  font-size: 0.95rem;
  line-height: 1.55;
}

.samples-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.sample-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.25rem 1.35rem 1.15rem;
}

.sample-card__header {
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #f3f4f6;
}

.sample-card__lang {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sample-card__source {
  margin: 0;
  font-size: 0.85rem;
  color: #6b7280;
}

.sample-card__block {
  margin-bottom: 1rem;
}

.sample-card__block:last-of-type {
  margin-bottom: 0.75rem;
}

.sample-card__label {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.sample-card__original {
  margin: 0;
  max-width: 44rem;
  font-size: 1.05rem;
  line-height: 1.65;
  color: #111;
}

.sample-card__fonora {
  margin: 0;
  padding: 1rem 1.1rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 2rem;
  line-height: 1.75;
  overflow-x: auto;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: normal;
  overflow-wrap: anywhere;
}

.sample-card__fonora--loading {
  opacity: 0.45;
}

.sample-card__fonora .tts-word {
  border-radius: 4px;
  padding: 0.05em 0.1em;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.sample-card__meta {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.5;
}

.sample-card__audio {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.25rem;
}

.sample-audio-btn--disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sample-audio-engine {
  font-size: 0.8rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sample-audio-status {
  font-size: 0.9rem;
  color: #4b5563;
}

.sample-audio-status--error {
  color: #b91c1c;
  font-weight: 600;
}

.sample-loading,
.sample-error {
  font-family: inherit;
  font-size: 0.95rem;
  color: #6b7280;
}

.sample-error {
  color: #b91c1c;
}

.samples-footer {
  margin: 0;
  max-width: 42rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #6b7280;
}

@media (max-width: 640px) {
  .sample-card {
    padding: 1rem 1rem 0.9rem;
  }

  .sample-card__fonora {
    font-size: 1.65rem;
    padding: 0.85rem 0.9rem;
  }
}
