:root {
  --phonetics-bg: #f5faf7;
  --phonetics-paper: #ffffff;
  --phonetics-text: #10251b;
  --phonetics-muted: #66766d;
  --phonetics-line: #d7e4dc;
  --phonetics-green: #08794d;
  --phonetics-green-dark: #075d3e;
  --phonetics-soft: #eef8f2;
  --phonetics-red: #c82d25;
}

body { background: var(--phonetics-bg); color: var(--phonetics-text); }
button, select { font: inherit; }
.site-nav { scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.phonetics-shell { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 42px 0 58px; }
.phonetics-shell > h1 { margin: 0 0 26px; font-size: clamp(32px, 4vw, 46px); line-height: 1.2; letter-spacing: -.03em; }

.phoneme-picker { padding: 26px 28px; border: 1px solid var(--phonetics-line); border-radius: 8px; background: var(--phonetics-paper); }
.phoneme-groups { display: grid; gap: 18px; }
.phoneme-group { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 20px; align-items: start; }
.phoneme-group h3 { margin: 8px 0 0; color: var(--phonetics-muted); font-size: 14px; line-height: 1.5; }
.phoneme-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.phoneme-option { display: inline-flex; min-width: 58px; min-height: 44px; align-items: center; justify-content: center; padding: 0 13px; border: 1px solid var(--phonetics-line); border-radius: 6px; background: #fff; color: var(--phonetics-text); cursor: pointer; font-family: "Segoe UI", Arial, sans-serif; font-size: 18px; line-height: 1; white-space: nowrap; }
.phoneme-option:hover, .phoneme-option:focus-visible { border-color: var(--phonetics-green); background: #f8fcf9; }
.phoneme-option.is-active, .phoneme-option[aria-pressed="true"] { border-color: var(--phonetics-green); background: var(--phonetics-green); color: #fff; font-weight: 700; }
.phonetics-loading { margin: 0; color: var(--phonetics-muted); }
.mobile-phoneme-switch { display: none; }

.phonetics-content-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: stretch; margin-top: 20px; }
.current-phoneme-card, .phoneme-words-card { min-width: 0; border: 1px solid var(--phonetics-line); border-radius: 8px; background: var(--phonetics-paper); }
.current-phoneme-card { padding: 26px; }
.card-eyebrow { margin: 0 0 8px; color: var(--phonetics-green); font-size: 14px; font-weight: 700; }
.current-phoneme-line { display: flex; align-items: center; gap: 14px; padding-bottom: 22px; border-bottom: 1px solid var(--phonetics-line); }
.current-phoneme-line h2 { margin: 0; font-family: "Segoe UI", Arial, sans-serif; font-size: 52px; font-weight: 650; line-height: 1.1; }
.phonetics-play-button { position: relative; display: inline-grid; width: 48px; height: 48px; flex: 0 0 48px; place-items: center; overflow: hidden; padding: 0; border: 2px solid #07945d; border-radius: 50%; background: #fff; color: #08794d; cursor: pointer; font-size: 0; line-height: 0; }
.phonetics-play-button img { display: block; width: 24px; height: 24px; object-fit: contain; }
.phonetics-play-button.is-loading img { opacity: .45; animation: phonetics-pulse .75s ease-in-out infinite alternate; }
.phonetics-play-button:hover, .phonetics-play-button:focus-visible { background: var(--phonetics-soft); }
.phonetics-play-button:disabled { cursor: wait; opacity: .7; }
@keyframes phonetics-pulse { to { opacity: .9; transform: scale(.86); } }
.phoneme-note { padding: 20px 0 0; }
.phoneme-note + .phoneme-note { margin-top: 20px; border-top: 1px solid var(--phonetics-line); }
.phoneme-note h3 { margin: 0 0 8px; font-size: 16px; }
.phoneme-note p { margin: 0; color: #42544a; line-height: 1.8; }
.spelling-list { font-family: "Segoe UI", Arial, sans-serif; font-size: 18px; }

.phoneme-words-card { padding: 24px; }
.phoneme-words-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.phoneme-words-head h2 { margin: 0; font-size: 24px; line-height: 1.35; }
.phoneme-filters { display: grid; grid-template-columns: minmax(150px, 220px) minmax(120px, 150px); gap: 10px; flex: 0 1 380px; }
.phoneme-filters label { min-width: 0; }
.phoneme-filters label > span { display: block; margin-bottom: 6px; color: var(--phonetics-muted); font-size: 12px; font-weight: 700; }
.phoneme-filters select { width: 100%; min-height: 44px; padding: 0 34px 0 11px; border: 1px solid var(--phonetics-line); border-radius: 6px; background: #fff; color: var(--phonetics-text); cursor: pointer; }
.word-result-summary { min-height: 24px; margin: 14px 0 10px; color: var(--phonetics-muted); font-size: 13px; }
.phoneme-word-scroll { height: clamp(510px, 58vh, 620px); overflow-y: auto; overscroll-behavior: contain; padding: 2px 8px 2px 2px; scrollbar-color: #aac9b8 #eef5f1; scrollbar-width: thin; }
.phoneme-word-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.phoneme-word-card { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 12px; align-items: center; min-width: 0; min-height: 98px; padding: 14px; border: 1px solid var(--phonetics-line); border-radius: 7px; background: #fff; }
.phoneme-word-card .word-copy { min-width: 0; }
.word-english { display: block; overflow-wrap: anywhere; color: #176cb5; font-family: "Segoe UI", Arial, sans-serif; font-size: 20px; line-height: 1.35; }
.word-ipa { display: block; margin-top: 2px; overflow-wrap: anywhere; color: #263b31; font-family: "Segoe UI", Arial, sans-serif; font-size: 15px; line-height: 1.45; }
.word-meaning { margin: 4px 0 0; color: #33463c; font-size: 14px; line-height: 1.55; }
.phoneme-highlight { color: var(--phonetics-red); }
.phoneme-empty { margin: 0; padding: 70px 18px; color: var(--phonetics-muted); text-align: center; }

.phoneme-sheet[hidden] { display: none; }
.phoneme-sheet { position: fixed; inset: 0; z-index: 10030; display: none; align-items: end; }
.phoneme-sheet-backdrop { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(8, 35, 25, .48); cursor: pointer; }
.phoneme-sheet-dialog { position: relative; z-index: 1; width: 100%; max-height: 85dvh; overflow: hidden; border-radius: 16px 16px 0 0; background: #fff; box-shadow: 0 -20px 60px rgba(8, 35, 25, .2); }
.phoneme-sheet-head { display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding: 0 18px; border-bottom: 1px solid var(--phonetics-line); }
.phoneme-sheet-head h2 { margin: 0; font-size: 21px; }
.phoneme-sheet-close { display: grid; width: 44px; height: 44px; place-items: center; border: 0; border-radius: 50%; background: #f2f7f4; color: var(--phonetics-text); cursor: pointer; font-size: 27px; line-height: 1; }
.phoneme-sheet-body { max-height: calc(85dvh - 64px); overflow-y: auto; overscroll-behavior: contain; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); }
.phoneme-sheet-body .phoneme-group { display: block; }
.phoneme-sheet-body .phoneme-group + .phoneme-group { margin-top: 22px; }
.phoneme-sheet-body .phoneme-group h3 { margin: 0 0 10px; color: var(--phonetics-text); font-size: 15px; }
.phoneme-sheet-body .phoneme-buttons { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.phoneme-sheet-body .phoneme-option { width: 100%; min-width: 0; padding: 0 6px; }
body.phoneme-sheet-open { overflow: hidden; }

@media (max-width: 940px) {
  .phonetics-content-grid { grid-template-columns: 280px minmax(0, 1fr); }
  .phoneme-words-head { display: block; }
  .phoneme-filters { margin-top: 14px; }
  .phoneme-word-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .phonetics-shell { width: min(100% - 28px, 620px); padding: 26px 0 38px; }
  .phonetics-shell > h1 { margin-bottom: 18px; font-size: 30px; }
  .phoneme-picker-desktop { display: none; }
  .mobile-phoneme-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 58px; padding: 8px 10px 8px 16px; border: 1px solid var(--phonetics-line); border-radius: 8px; background: #fff; }
  .mobile-phoneme-switch span { min-width: 0; color: var(--phonetics-muted); font-size: 14px; }
  .mobile-phoneme-switch strong { margin-left: 4px; color: var(--phonetics-text); font-family: "Segoe UI", Arial, sans-serif; font-size: 19px; }
  .mobile-switch-button { min-width: 98px; min-height: 44px; padding: 0 14px; border: 1px solid var(--phonetics-green); border-radius: 6px; background: #fff; color: var(--phonetics-green); cursor: pointer; font-weight: 700; }
  .phonetics-content-grid { display: block; margin-top: 12px; }
  .current-phoneme-card { padding: 20px 18px; }
  .current-phoneme-line h2 { font-size: 46px; }
  .phoneme-note { padding-top: 16px; }
  .phoneme-note + .phoneme-note { margin-top: 16px; }
  .phoneme-words-card { margin-top: 12px; padding: 18px 14px; }
  .phoneme-words-head h2 { font-size: 21px; }
  .phoneme-filters { grid-template-columns: 1fr; gap: 10px; margin-top: 16px; }
  .phoneme-filters select { min-height: 48px; }
  .phoneme-word-scroll { height: min(520px, 60dvh); padding-right: 5px; }
  .phoneme-word-card { grid-template-columns: 42px minmax(0, 1fr); min-height: 94px; padding: 12px; }
  .phonetics-play-button { width: 42px; height: 42px; flex-basis: 42px; }
  .phonetics-play-button img { width: 21px; height: 21px; }
  .phoneme-sheet { display: flex; }
  .footer { gap: 14px; padding-inline: 14px; }
}

@media (max-width: 390px) {
  .phonetics-shell { width: calc(100% - 24px); }
  .phonetics-shell > h1 { font-size: 27px; }
  .mobile-phoneme-switch { padding-left: 12px; }
  .mobile-switch-button { min-width: 92px; padding-inline: 10px; }
  .phoneme-sheet-body { padding-inline: 12px; }
  .phoneme-sheet-body .phoneme-buttons { gap: 7px; }
  .phoneme-sheet-body .phoneme-option { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
