@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("Assets/fonts/inter-latin-400-800.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("Assets/fonts/poppins-latin-400.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("Assets/fonts/poppins-latin-700.woff2") format("woff2");
}

@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("Assets/fonts/poppins-latin-900.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --ink: #2F2F2F;
  --muted: #6C7A89;
  --gray: #8A8F94;
  --white: #FEFDFC;
  --warm-white: #FEFCF5;
  --line: rgba(47, 47, 47, 0.14);
  --line-strong: rgba(47, 47, 47, 0.22);
  --red: #C96A6A;
  --orange: #DFA05A;
  --yellow: #EAD66B;
  --green: #7FAF8C;
  --blue: #7EA8C9;
  --indigo: #6F7FB8;
  --purple: #9A86C7;
  --pink: #E8A6A6;
  --brown: #B89264;
  --soft-blue: #DCEAF4;
  --soft-blue-2: #EEF4F8;
  --soft-green: #DEECDF;
  --soft-green-2: #EEF5EF;
  --soft-yellow: #F8F3CF;
  --soft-yellow-2: #FBF8E6;
  --soft-purple: #E7DFF3;
  --soft-purple-2: #F3EFF8;
  --soft-pink: #F7E3E3;
  --soft-pink-2: #FBF1F1;
  --soft-brown: #D8BE9A;
  --soft-gray: #DEE2E3;
  --deep-gray: #6C7A89;
  --control-blue: #4f82b2;
  --control-green: #4f8b61;
  --control-purple: #7763a8;
  --control-red: #9f4646;
  --shadow: 0 18px 42px rgba(47, 47, 47, 0.10);
  --shadow-soft: 0 10px 26px rgba(47, 47, 47, 0.08);
  --radius: 8px;
  --font: Inter, "Segoe UI", Arial, sans-serif;
  --display: Poppins, "Century Gothic", "Comic Sans MS", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: clip;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  overflow-x: clip;
  font-family: var(--font);
  color: var(--ink);
  background: var(--warm-white);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.page-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(254, 253, 252, 0.96);
  box-shadow: 0 6px 18px rgba(47, 47, 47, 0.05);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  min-height: 74px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.site-logo-frame {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
}

.site-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.site-name {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
  color: var(--blue);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.nav-link {
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-weight: 750;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.is-active {
  background: var(--soft-blue-2);
  color: var(--control-blue);
  outline: 0;
}

.app {
  flex: 1 1 auto;
  width: 100%;
}

.app-footer {
  border-top: 1px solid var(--line);
  background: var(--white);
  padding: 12px 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  text-align: center;
}

.dashboard,
.view {
  padding: 34px 0 42px;
}

.view-header {
  margin-bottom: 24px;
}

.dashboard-shell {
  display: grid;
  align-content: center;
  gap: clamp(18px, 2.4vh, 28px);
  width: min(1120px, calc(100% - 32px));
}

.dashboard-hero {
  overflow: hidden;
  min-height: clamp(188px, 24vh, 236px);
  padding: clamp(24px, 4vh, 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-soft);
}

.dashboard-hero .eyebrow {
  width: fit-content;
  padding: 7px 13px;
  border: 1px solid rgba(126, 168, 201, 0.32);
  border-radius: 999px;
  background: var(--soft-blue-2);
  box-shadow: 0 8px 20px rgba(47, 47, 47, 0.06);
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--display);
  letter-spacing: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: 48px;
  line-height: 1.1;
}

.dashboard-hero h1 {
  max-width: 920px;
  font-size: clamp(38px, 5vw, 58px);
  line-height: 1.02;
}

.dashboard-copy {
  max-width: 640px;
  margin: 14px 0 0;
  font-size: 17px;
}

h2 {
  font-size: 26px;
  line-height: 1.2;
}

h3 {
  font-size: 22px;
  line-height: 1.2;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.text-blue {
  color: var(--control-blue);
}

.text-green {
  color: var(--control-green);
}

.text-purple {
  color: var(--control-purple);
}

.dashboard-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.section-card {
  display: flex;
  flex-direction: column;
  min-height: 218px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface, var(--white));
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.section-card:hover {
  transform: translateY(-3px);
  border-color: var(--ring, rgba(126, 168, 201, 0.32));
  box-shadow: 0 18px 34px rgba(47, 47, 47, 0.12);
}

.section-stripe {
  flex: 0 0 auto;
  height: 7px;
  background: var(--accent, var(--blue));
}

.section-card-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  min-height: 0;
  padding: 24px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.section-card-main:hover,
.section-card-main:focus-visible {
  outline: 0;
  background: rgba(254, 253, 252, 0.34);
}

.section-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  background: var(--accent-soft, var(--soft-blue));
  color: var(--accent-deep, var(--control-blue));
  border: 1px solid var(--ring, rgba(126, 168, 201, 0.28));
}

.section-icon svg {
  width: 32px;
  height: 32px;
}

.section-copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
}

.section-copy strong {
  font-family: var(--display);
  font-size: 30px;
  line-height: 1.08;
}

.section-copy span {
  color: var(--muted);
  line-height: 1.45;
}

.section-copy .section-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  color: var(--accent-deep, var(--control-blue));
  font-weight: 900;
}

.section-link svg {
  width: 18px;
  height: 18px;
}

.view-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface, var(--white));
}

.view-header.has-actions {
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
}

.view-header-copy {
  min-width: 0;
}

.view-header h1 {
  margin-bottom: 5px;
  font-size: clamp(32px, 3.1vw, 46px);
  overflow-wrap: anywhere;
}

.view-header p {
  max-width: 920px;
  margin-bottom: 0;
  overflow-wrap: break-word;
}

.view-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.back-button,
.detail-controls button,
.audio-bank button,
.tile-actions button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  border-radius: var(--radius);
  background: var(--accent-deep, var(--control-blue));
  color: var(--white);
  font-weight: 800;
}

.back-button {
  flex: 0 0 auto;
  width: 48px;
  min-width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
}

.back-button svg {
  width: 26px;
  height: 26px;
}

.back-button:hover,
.detail-controls button:hover,
.audio-bank button:hover,
.tile-actions button:hover,
.icon-button:hover,
.back-button:focus-visible,
.detail-controls button:focus-visible,
.audio-bank button:focus-visible,
.tile-actions button:focus-visible,
.icon-button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px var(--ring, rgba(126, 168, 201, 0.25));
}

.consonant-page {
  width: min(1560px, calc(100% - 32px));
  --chart-panel-pad: clamp(10px, min(1vw, 1.7vh), 18px);
  --chart-gap: clamp(4px, min(0.55vw, 0.9vh), 8px);
  --chart-side-gutter: clamp(22px, 2.1vw, 34px);
  --chart-axis-left: clamp(7px, 0.7vw, 10px);
  --chart-row-label-col: clamp(110px, 7.8vw, 134px);
  --chart-min-col: 72px;
  --chart-corner-height: clamp(58px, min(5.2vw, 8vh), 78px);
  --chart-row-height: clamp(52px, min(4.2vw, 7vh), 64px);
  --chart-title-size: clamp(14px, min(1.08vw, 2.35vh), 18px);
  --chart-column-size: clamp(11px, min(0.85vw, 1.85vh), 14px);
  --chart-row-title-size: clamp(12px, min(0.9vw, 2vh), 15px);
  --chart-row-note-size: clamp(8px, min(0.66vw, 1.45vh), 10px);
  --chart-cell-pad: clamp(2px, 0.25vw, 4px);
  --chart-cell-gap: clamp(2px, 0.2vw, 3px);
  --chart-phoneme-width: clamp(30px, min(2.25vw, 4.1vh), 38px);
  --chart-phoneme-height: clamp(22px, min(1.6vw, 2.8vh), 25px);
  --chart-phoneme-size: clamp(13px, min(0.95vw, 2vh), 16px);
  --chart-phoneme-pad-x: 8px;
  --chart-axis-top-gap: 10px;
  --chart-row-band-top: calc(1.2em + var(--chart-axis-top-gap) + var(--chart-corner-height) + var(--chart-gap));
  --chart-row-band-height: calc(var(--chart-row-height) + var(--chart-gap) + var(--chart-row-height) + var(--chart-gap) + var(--chart-row-height) + var(--chart-gap) + var(--chart-row-height) + var(--chart-gap) + var(--chart-row-height) + var(--chart-gap) + var(--chart-row-height));
}

.view.consonant-page {
  padding-top: clamp(14px, 2vh, 22px);
  padding-bottom: 14px;
}

.consonant-page .view-header {
  margin-bottom: clamp(12px, 1.8vh, 18px);
}

.consonant-page.consonant-scale-medium {
  --chart-panel-pad: clamp(16px, 2vw, 28px);
  --chart-gap: clamp(8px, 0.9vw, 13px);
  --chart-side-gutter: clamp(32px, 3vw, 48px);
  --chart-axis-left: clamp(9px, 0.9vw, 14px);
  --chart-row-label-col: clamp(130px, 9.8vw, 156px);
  --chart-corner-height: clamp(82px, 8vw, 118px);
  --chart-row-height: clamp(78px, 7.2vw, 106px);
  --chart-title-size: clamp(17px, 1.42vw, 23px);
  --chart-column-size: clamp(13px, 1.05vw, 16px);
  --chart-row-title-size: clamp(14px, 1.15vw, 18px);
  --chart-row-note-size: clamp(10px, 0.82vw, 12px);
  --chart-cell-pad: clamp(5px, 0.6vw, 8px);
  --chart-cell-gap: clamp(4px, 0.45vw, 7px);
  --chart-phoneme-width: clamp(44px, 4vw, 58px);
  --chart-phoneme-height: clamp(30px, 2.7vw, 39px);
  --chart-phoneme-size: clamp(17px, 1.45vw, 23px);
  --chart-phoneme-pad-x: clamp(6px, 0.55vw, 9px);
}

.consonant-page.consonant-scale-large {
  --chart-panel-pad: clamp(18px, 2.25vw, 32px);
  --chart-gap: clamp(9px, 1vw, 14px);
  --chart-side-gutter: clamp(36px, 3.4vw, 56px);
  --chart-axis-left: clamp(10px, 1vw, 16px);
  --chart-row-label-col: clamp(140px, 10.6vw, 168px);
  --chart-corner-height: clamp(88px, 8.5vw, 126px);
  --chart-row-height: clamp(84px, 7.8vw, 116px);
  --chart-title-size: clamp(18px, 1.5vw, 25px);
  --chart-column-size: clamp(14px, 1.12vw, 17px);
  --chart-row-title-size: clamp(15px, 1.22vw, 19px);
  --chart-row-note-size: clamp(10px, 0.88vw, 13px);
  --chart-cell-pad: clamp(5px, 0.68vw, 8px);
  --chart-cell-gap: clamp(4px, 0.5vw, 7px);
  --chart-phoneme-width: clamp(48px, 4.2vw, 62px);
  --chart-phoneme-height: clamp(32px, 2.85vw, 41px);
  --chart-phoneme-size: clamp(18px, 1.52vw, 24px);
  --chart-phoneme-pad-x: clamp(6px, 0.6vw, 10px);
}

.consonant-page.consonant-scale-x-large {
  --chart-panel-pad: clamp(20px, 2.5vw, 36px);
  --chart-gap: clamp(10px, 1.1vw, 16px);
  --chart-side-gutter: clamp(40px, 3.8vw, 62px);
  --chart-axis-left: clamp(11px, 1.1vw, 18px);
  --chart-row-label-col: clamp(150px, 11.4vw, 180px);
  --chart-corner-height: clamp(96px, 9.2vw, 138px);
  --chart-row-height: clamp(90px, 8.3vw, 126px);
  --chart-title-size: clamp(19px, 1.62vw, 27px);
  --chart-column-size: clamp(15px, 1.22vw, 19px);
  --chart-row-title-size: clamp(16px, 1.34vw, 21px);
  --chart-row-note-size: clamp(11px, 0.95vw, 14px);
  --chart-cell-pad: clamp(6px, 0.75vw, 9px);
  --chart-cell-gap: clamp(5px, 0.55vw, 8px);
  --chart-phoneme-width: clamp(50px, 4.35vw, 64px);
  --chart-phoneme-height: clamp(34px, 3vw, 43px);
  --chart-phoneme-size: clamp(19px, 1.58vw, 25px);
  --chart-phoneme-pad-x: clamp(7px, 0.65vw, 10px);
}

.consonant-page.consonant-scale-xx-large {
  --chart-panel-pad: clamp(22px, 2.8vw, 42px);
  --chart-gap: clamp(11px, 1.25vw, 18px);
  --chart-side-gutter: clamp(44px, 4.2vw, 70px);
  --chart-axis-left: clamp(12px, 1.2vw, 20px);
  --chart-row-label-col: clamp(160px, 12.4vw, 196px);
  --chart-corner-height: clamp(104px, 10vw, 150px);
  --chart-row-height: clamp(98px, 9vw, 138px);
  --chart-title-size: clamp(20px, 1.78vw, 30px);
  --chart-column-size: clamp(16px, 1.34vw, 21px);
  --chart-row-title-size: clamp(17px, 1.46vw, 23px);
  --chart-row-note-size: clamp(12px, 1.05vw, 15px);
  --chart-cell-pad: clamp(6px, 0.85vw, 10px);
  --chart-cell-gap: clamp(5px, 0.6vw, 8px);
  --chart-phoneme-width: clamp(54px, 4.7vw, 68px);
  --chart-phoneme-height: clamp(36px, 3.1vw, 45px);
  --chart-phoneme-size: clamp(20px, 1.68vw, 27px);
  --chart-phoneme-pad-x: clamp(7px, 0.7vw, 11px);
}

.consonant-chart-panel {
  position: relative;
  overflow: hidden;
  padding: var(--chart-panel-pad);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-soft);
}

.consonant-axis {
  color: var(--ink);
  font-size: clamp(13px, 1.1vw, 16px);
  font-weight: 650;
  line-height: 1.2;
}

.consonant-axis-top {
  margin-left: calc(var(--chart-side-gutter) + var(--chart-row-label-col) + var(--chart-gap));
  margin-bottom: var(--chart-axis-top-gap);
  text-align: center;
}

.consonant-axis-side {
  position: absolute;
  top: var(--chart-row-band-top);
  left: 0;
  display: grid;
  place-items: center;
  width: var(--chart-side-gutter);
  height: var(--chart-row-band-height);
  transform: rotate(180deg);
  transform-origin: center;
  white-space: nowrap;
  writing-mode: vertical-rl;
}

.consonant-grid {
  display: grid;
  grid-template-columns: var(--chart-row-label-col) repeat(7, minmax(var(--chart-min-col), 1fr));
  gap: var(--chart-gap);
  margin-left: var(--chart-side-gutter);
  min-width: 0;
}

.chart-corner {
  display: grid;
  place-items: center;
  height: var(--chart-corner-height);
  padding: 8px 24px 8px 8px;
  color: var(--ink);
  text-align: center;
}

.chart-corner span {
  max-width: 9ch;
  font-family: var(--display);
  font-size: var(--chart-title-size);
  font-weight: 900;
  line-height: 1.08;
  overflow-wrap: normal;
}

.chart-column-label,
.chart-row-label,
.chart-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  border: 1px solid rgba(216, 190, 142, 0.64);
  background: #F8D49A;
}

.chart-column-label {
  height: var(--chart-corner-height);
  padding: 10px;
  font-family: var(--display);
  font-size: var(--chart-column-size);
  font-weight: 850;
  line-height: 1.18;
  text-align: center;
}

.chart-row-label {
  height: var(--chart-row-height);
  padding: var(--chart-cell-pad);
  align-content: center;
  gap: clamp(2px, 0.35vw, 6px);
  font-family: var(--display);
  text-align: center;
}

.chart-row-label strong {
  font-size: var(--chart-row-title-size);
  line-height: 1.12;
}

.chart-row-note {
  display: grid;
  gap: 1px;
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--chart-row-note-size);
  font-weight: 650;
  line-height: 1;
}

.chart-row-note span {
  display: block;
}

.chart-cell {
  height: var(--chart-row-height);
  padding: var(--chart-cell-pad);
  gap: var(--chart-cell-gap);
  align-content: center;
  justify-content: center;
}

.chart-cell.is-empty {
  border-color: transparent;
  background: transparent;
}

.consonant-phoneme {
  display: inline-grid;
  place-items: center;
  max-width: 100%;
  min-width: var(--chart-phoneme-width);
  height: var(--chart-phoneme-height);
  padding: 0 var(--chart-phoneme-pad-x);
  border: 1px solid rgba(47, 47, 47, 0.14);
  border-radius: var(--radius);
  background: rgba(254, 253, 252, 0.86);
  color: #113a63;
  font-family: var(--display);
  font-size: var(--chart-phoneme-size);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  -webkit-text-stroke: 0.01em currentColor;
}

.consonant-phoneme:hover,
.consonant-phoneme:focus-visible {
  outline: 0;
  background: var(--white);
  box-shadow: 0 0 0 4px rgba(126, 168, 201, 0.26);
}

.phoneme-underline {
  text-decoration-line: underline;
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.12em;
}

.phoneme-label {
  display: inline-block;
  line-height: 1;
}

.consonant-phone-fallback {
  display: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.consonant-phone-groups {
  display: grid;
  gap: 12px;
}

.phone-consonant-group {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.phone-consonant-group h3 {
  margin: 0;
  color: #113a63;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 900;
}

.phone-consonant-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 8px;
}

.phone-consonant-button {
  display: inline-grid;
  place-items: center;
  min-width: 0;
  min-height: 52px;
  padding: 8px 10px;
  border: 1px solid rgba(216, 190, 142, 0.72);
  border-radius: var(--radius);
  background: #F8D49A;
  color: #113a63;
  font-family: var(--display);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  -webkit-text-stroke: 0.01em currentColor;
}

.phone-consonant-button:hover,
.phone-consonant-button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px rgba(126, 168, 201, 0.26);
}

.group-stack,
.vowel-valley {
  display: grid;
  gap: 18px;
}

.sound-group {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface, var(--white));
  box-shadow: var(--shadow-soft);
}

.group-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.group-heading h2 {
  margin-bottom: 6px;
}

.group-heading p {
  margin-bottom: 0;
}

.group-heading > span {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: var(--radius);
  background: var(--accent-soft, var(--soft-blue));
  color: var(--accent-deep, var(--control-blue));
  font-weight: 800;
}

.sound-grid,
.resource-grid {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.sound-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.resource-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.sound-tile {
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--tile-bg, var(--white));
}

.thumb-button {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
}

.thumb-button:focus-visible {
  outline: 0;
  box-shadow: inset 0 0 0 4px var(--ring, rgba(126, 168, 201, 0.25));
}

.thumb-frame {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  width: 100%;
  overflow: hidden;
  background: var(--accent-soft, var(--soft-blue));
}

.thumb-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.thumb-frame img.thumb-picture {
  object-fit: contain;
  padding: 6px;
  transform: translateY(-8%) scale(1.16);
  transform-origin: center;
}

.fallback-phoneme {
  font-family: var(--display);
  font-size: 42px;
  font-weight: 900;
  color: var(--accent-deep, var(--control-blue));
}

.tile-copy {
  padding: 14px 14px 0;
}

.tile-copy h3 {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.tile-copy p {
  margin-bottom: 0;
  min-height: 24px;
}

.tile-actions {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 14px;
}

.tile-actions.has-three-actions button:last-child {
  grid-column: 1 / -1;
}

.tile-actions button {
  min-width: 0;
  padding: 0 8px;
  font-size: 14px;
}

.tile-actions span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-tools {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 230px) minmax(220px, 280px);
  gap: 12px;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.library-tools label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.library-tools input,
.library-tools select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--white);
  padding: 0 12px;
  color: var(--ink);
}

.search-box {
  position: relative;
}

.search-box > span {
  position: absolute;
  left: 12px;
  bottom: 12px;
  color: var(--muted);
}

.search-box input {
  padding-left: 42px;
}

.library-count {
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 800;
}

.library-accordion {
  display: grid;
  gap: 18px;
}

.library-section {
  display: grid;
  gap: 10px;
}

.library-section > h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(24px, 2vw, 34px);
  line-height: 1;
}

.library-category-list {
  display: grid;
  gap: 10px;
}

.library-accordion-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-soft);
}

.library-category-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 18px;
  border: 0;
  border-left: 7px solid var(--accent-deep, var(--control-blue));
  border-radius: 0;
  background: var(--surface, var(--white));
  color: var(--ink);
  text-align: left;
}

.library-category-toggle:hover,
.library-category-toggle:focus-visible {
  background: var(--accent-soft, var(--soft-blue));
}

.library-category-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.library-category-copy strong {
  font-family: var(--display);
  font-size: clamp(19px, 1.6vw, 24px);
  line-height: 1.05;
}

.library-category-copy span {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

.library-category-meta {
  padding: 8px 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-deep, var(--control-blue));
  font-weight: 900;
  white-space: nowrap;
}

.accordion-chevron {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  color: var(--accent-deep, var(--control-blue));
  transition: transform 160ms ease;
}

.accordion-chevron svg {
  width: 20px;
  height: 20px;
}

.library-category-toggle[aria-expanded="true"] .accordion-chevron {
  transform: rotate(90deg);
}

.library-category-panel {
  border-top: 1px solid var(--line);
  background: var(--white);
}

.library-page.library-scale-small {
  --library-card-min: 158px;
  --library-card-max: 190px;
  --library-thumb-height: 266px;
  --library-card-min-height: 356px;
  --library-grid-gap: 10px;
  --library-grid-pad: 12px;
  --library-image-padding: 64px 8px 6px;
  --library-overlay-min-height: 58px;
  --library-overlay-padding: 7px 9px 7px;
  --library-label-main-size: 15px;
  --library-label-word-size: 13px;
  --library-action-height: 32px;
  --library-action-font-size: 12px;
}

.library-page.library-scale-medium {
  --library-card-min: 172px;
  --library-card-max: 202px;
  --library-thumb-height: 292px;
  --library-card-min-height: 382px;
  --library-grid-gap: 12px;
  --library-grid-pad: 14px;
  --library-image-padding: 66px 10px 7px;
  --library-overlay-min-height: 62px;
  --library-overlay-padding: 7px 10px 8px;
  --library-label-main-size: 16px;
  --library-label-word-size: 14px;
  --library-action-height: 34px;
  --library-action-font-size: 12px;
}

.library-page.library-scale-large {
  --library-card-min: 190px;
  --library-card-max: 224px;
  --library-thumb-height: 324px;
  --library-card-min-height: 424px;
  --library-grid-gap: 14px;
  --library-grid-pad: 16px;
  --library-image-padding: 72px 12px 8px;
  --library-overlay-min-height: 68px;
  --library-overlay-padding: 8px 12px 9px;
  --library-label-main-size: 18px;
  --library-label-word-size: 15px;
  --library-action-height: 38px;
  --library-action-font-size: 13px;
}

.library-page.library-scale-x-large {
  --library-card-min: 208px;
  --library-card-max: 246px;
  --library-thumb-height: 358px;
  --library-card-min-height: 466px;
  --library-grid-gap: 16px;
  --library-grid-pad: 18px;
  --library-image-padding: 78px 14px 10px;
  --library-overlay-min-height: 74px;
  --library-overlay-padding: 9px 13px 10px;
  --library-label-main-size: 20px;
  --library-label-word-size: 16px;
  --library-action-height: 42px;
  --library-action-font-size: 14px;
}

.library-page.library-scale-xx-large {
  --library-card-min: 230px;
  --library-card-max: 272px;
  --library-thumb-height: 396px;
  --library-card-min-height: 512px;
  --library-grid-gap: 18px;
  --library-grid-pad: 20px;
  --library-image-padding: 84px 16px 12px;
  --library-overlay-min-height: 80px;
  --library-overlay-padding: 10px 15px 11px;
  --library-label-main-size: 22px;
  --library-label-word-size: 18px;
  --library-action-height: 46px;
  --library-action-font-size: 15px;
}

.library-category-panel .resource-grid {
  grid-template-columns: repeat(auto-fill, minmax(var(--library-card-min), var(--library-card-max)));
  justify-content: start;
  gap: var(--library-grid-gap);
  padding: var(--library-grid-pad);
}

.library-category-panel .sound-tile {
  grid-template-rows: var(--library-thumb-height) 1fr;
  width: 100%;
  min-height: var(--library-card-min-height);
}

.library-category-panel .thumb-button {
  height: var(--library-thumb-height);
}

.library-category-panel .thumb-frame {
  position: relative;
  aspect-ratio: auto;
  height: 100%;
}

.library-category-panel .thumb-frame img {
  padding: var(--library-image-padding);
}

.library-category-panel .thumb-frame img.library-picture {
  object-fit: contain;
  padding: var(--library-image-padding);
  transform: none;
  transform-origin: center;
}

.library-category-panel .fallback-phoneme {
  font-size: 30px;
}

.thumb-label-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  gap: 3px;
  justify-items: start;
  min-height: var(--library-overlay-min-height);
  padding: var(--library-overlay-padding);
  background: rgba(254, 253, 252, 0.94);
  color: var(--ink);
  font-family: var(--display);
  text-align: left;
  box-shadow: 0 1px 0 var(--line);
  z-index: 1;
}

.thumb-label-main {
  display: flex;
  justify-self: stretch;
  min-width: 0;
  width: 100%;
  align-items: baseline;
  gap: 9px;
  font-size: var(--library-label-main-size);
  font-weight: 900;
  line-height: 1.08;
  text-align: left;
  white-space: nowrap;
}

.label-pattern,
.label-phoneme {
  display: inline-block;
}

.label-phoneme {
  min-width: 0;
}

.thumb-label-word {
  justify-self: stretch;
  width: 100%;
  color: var(--muted);
  font-family: var(--body);
  font-size: var(--library-label-word-size);
  font-weight: 800;
  line-height: 1;
  text-align: left;
}

.precomposed-phoneme {
  display: inline-block;
  font-family: var(--display);
  line-height: 1;
}

.marked-phoneme,
.marked-oo {
  position: relative;
  display: inline-block;
  padding: 0 1px;
}

.marked-phoneme::before,
.marked-oo::before {
  position: absolute;
  left: 50%;
  top: -0.23em;
  transform: translateX(-50%);
  font-family: var(--body);
  font-size: 0.72em;
  font-weight: 800;
  line-height: 1;
}

.marked-phoneme-macron::before,
.marked-oo-macron::before {
  content: "\00AF";
}

.marked-phoneme-breve::before,
.marked-oo-breve::before {
  content: "\02D8";
  top: -0.29em;
}

.library-category-panel .tile-copy {
  padding: 9px 10px 0;
}

.library-category-panel .tile-copy h3 {
  margin-bottom: 2px;
  font-size: 20px;
  line-height: 1.05;
}

.library-category-panel .tile-copy p {
  min-height: 19px;
  font-size: 15px;
  line-height: 1.25;
}

.library-category-panel .tile-actions {
  gap: 6px;
  padding: 9px 10px 10px;
}

.library-category-panel .tile-actions button {
  min-height: var(--library-action-height);
  padding: 0 6px;
  font-size: var(--library-action-font-size);
}

.library-category-panel .tile-actions svg {
  width: 15px;
  height: 15px;
}

.valley-scroll {
  overflow: visible;
  padding-bottom: 0;
}

.vowel-page {
  --vowel-card-width: clamp(44px, min(3.9vw, 6.7vh), 68px);
  --vowel-row-height: clamp(28px, min(2vw, 3.8vh), 36px);
  --vowel-title-size: clamp(24px, min(2.35vw, 4.2vh), 34px);
  --vowel-card-label-size: clamp(14px, min(1.2vw, 2.4vh), 18px);
  --support-card-min-height: 96px;
  --support-image-max-height: 58px;
  --support-label-size: 18px;
  padding-top: clamp(14px, 1.7vw, 22px);
  padding-bottom: 16px;
}

.vowel-page.vowel-scale-medium {
  --vowel-card-width: clamp(54px, min(4.9vw, 8vh), 84px);
  --vowel-row-height: clamp(43px, min(3.1vw, 5.6vh), 56px);
  --vowel-title-size: clamp(30px, min(3vw, 5.6vh), 46px);
  --vowel-card-label-size: clamp(16px, min(1.45vw, 3vh), 22px);
  --support-card-min-height: 138px;
  --support-image-max-height: 100px;
  --support-label-size: 21px;
}

.vowel-page.vowel-scale-large {
  --vowel-card-width: clamp(62px, min(5.5vw, 9.5vh), 96px);
  --vowel-row-height: clamp(48px, min(3.4vw, 6.3vh), 64px);
  --vowel-title-size: clamp(34px, min(3.3vw, 6.2vh), 52px);
  --vowel-card-label-size: clamp(17px, min(1.6vw, 3.3vh), 24px);
  --support-card-min-height: 156px;
  --support-image-max-height: 122px;
  --support-label-size: 23px;
}

.vowel-page.vowel-scale-x-large {
  --vowel-card-width: clamp(70px, min(6.1vw, 10.7vh), 108px);
  --vowel-row-height: clamp(54px, min(3.8vw, 7vh), 72px);
  --vowel-title-size: clamp(38px, min(3.7vw, 7vh), 58px);
  --vowel-card-label-size: clamp(18px, min(1.75vw, 3.6vh), 26px);
  --support-card-min-height: 176px;
  --support-image-max-height: 144px;
  --support-label-size: 25px;
}

.vowel-page.vowel-scale-xx-large {
  --vowel-card-width: clamp(78px, min(6.8vw, 12vh), 122px);
  --vowel-row-height: clamp(60px, min(4.2vw, 7.8vh), 82px);
  --vowel-title-size: clamp(42px, min(4.1vw, 7.8vh), 64px);
  --vowel-card-label-size: clamp(19px, min(1.9vw, 4vh), 28px);
  --support-card-min-height: 198px;
  --support-image-max-height: 166px;
  --support-label-size: 27px;
}

.vowel-size-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: max-content;
  margin: 0;
}

.vowel-size-controls button {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control-blue);
  color: var(--white);
  font-family: var(--display);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
}

.vowel-size-controls button:hover,
.vowel-size-controls button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px rgba(126, 168, 201, 0.25);
}

.vowel-size-controls button:disabled {
  cursor: not-allowed;
  background: var(--soft-gray);
  color: var(--muted);
}

.valley-map {
  --valley-card-width: var(--vowel-card-width);
  --valley-row-height: var(--vowel-row-height);
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  grid-template-rows: auto repeat(8, var(--valley-row-height));
  align-items: center;
  justify-items: center;
  column-gap: clamp(4px, 0.6vw, 12px);
  row-gap: clamp(2px, 0.35vw, 6px);
  width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: clamp(8px, min(1.1vw, 1.8vh), 14px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-soft);
}

.valley-map h2 {
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: center;
  margin: 0 0 clamp(8px, min(1vw, 1.7vh), 14px);
  color: #113a63;
  font-size: var(--vowel-title-size);
  font-weight: 900;
  text-align: center;
}

.valley-node {
  grid-column: var(--col);
  grid-row: var(--row);
  z-index: 2;
  width: min(100%, var(--valley-card-width));
  min-width: 0;
  align-self: center;
}

.valley-card {
  display: grid;
  gap: 0;
  width: 100%;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft-blue-2);
  color: var(--ink);
  box-shadow: 0 6px 14px rgba(47, 47, 47, 0.10);
}

.valley-card:hover,
.valley-card:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px rgba(126, 168, 201, 0.32), 0 8px 18px rgba(47, 47, 47, 0.12);
}

.valley-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  padding: 2px;
  background: var(--soft-blue);
  transform: translateY(-4%) scale(1.3);
  transform-origin: center;
}

.valley-card span {
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: var(--vowel-card-label-size);
  font-weight: 900;
  line-height: 1.05;
  min-height: clamp(34px, 4.5vh, 42px);
  padding: 14px 4px 9px;
  border-top: 1px solid rgba(47, 47, 47, 0.06);
  background: var(--white);
  color: #113a63;
  -webkit-text-stroke: 0.01em currentColor;
}

.valley-phone-fallback {
  display: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.phone-fallback-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.phone-fallback-copy h2 {
  color: #113a63;
  font-size: clamp(22px, 7vw, 30px);
  line-height: 1.15;
  overflow-wrap: normal;
}

.phone-fallback-copy p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: break-word;
}

.phone-vowel-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  margin-top: 16px;
}

.phone-vowel-card {
  min-width: 0;
}

.phone-vowel-card button {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 116px;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft-blue-2);
  color: var(--ink);
}

.phone-vowel-card button:hover,
.phone-vowel-card button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px rgba(126, 168, 201, 0.32);
}

.phone-vowel-card img {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  padding: 3px;
  background: var(--soft-blue);
  transform: translateY(-3%) scale(1.18);
  transform-origin: center;
}

.phone-vowel-card span {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.05;
  padding: 10px 4px 9px;
  background: var(--white);
  color: #113a63;
  -webkit-text-stroke: 0.01em currentColor;
}

.vowel-support-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  margin-top: 14px;
}

.vowel-support-grid section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.vowel-support-grid h2 {
  color: #113a63;
  font-size: clamp(24px, 2vw, 30px);
  margin-bottom: 10px;
}

.mini-sound-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
}

.mini-sound-card button {
  display: grid;
  gap: 0;
  width: 100%;
  overflow: hidden;
  min-height: var(--support-card-min-height);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface, var(--soft-blue-2));
  color: var(--ink);
}

.mini-sound-card button:hover,
.mini-sound-card button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px var(--ring, rgba(126, 168, 201, 0.25));
}

.mini-sound-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: var(--support-image-max-height);
  object-fit: contain;
  padding: 3px;
  transform: translateY(-4%) scale(1.24);
  transform-origin: center;
}

.mini-sound-card span {
  font-family: var(--display);
  font-size: var(--support-label-size);
  font-weight: 900;
  line-height: 1.05;
  padding: 10px 4px 10px;
  background: var(--white);
  color: var(--accent-deep, var(--control-blue));
  -webkit-text-stroke: 0.01em currentColor;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: clamp(8px, 1.4vw, 18px);
  background: rgba(47, 47, 47, 0.42);
}

.detail-panel {
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: clamp(8px, 1.25vh, 14px);
  width: min(760px, 100%);
  height: auto;
  max-height: calc(100dvh - clamp(16px, 2.8vw, 36px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
  padding: clamp(10px, 1.4vw, 18px);
  --detail-card-width: clamp(230px, min(30vw, 42dvh), 400px);
}

.detail-panel:has(.practice-layout.has-mirror) {
  width: min(1120px, 100%);
  --detail-card-width: clamp(220px, min(25vw, 38dvh), 360px);
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-header h2 {
  margin-bottom: 4px;
  font-size: clamp(24px, 2.3vw, 34px);
}

.detail-header p {
  margin-bottom: 0;
}

.icon-button {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 0;
}

.practice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(8px, 1.1vw, 14px);
  min-height: 0;
  align-items: start;
  justify-items: center;
}

.practice-layout.has-mirror {
  grid-template-columns: repeat(2, minmax(0, var(--detail-card-width)));
  justify-content: center;
  gap: clamp(10px, 1.4vw, 22px);
}

.slide-panel,
.mirror-panel {
  display: grid;
  gap: 10px;
  min-height: 0;
  justify-items: center;
  width: 100%;
}

.slide-stage,
.mirror-stage {
  display: grid;
  place-items: center;
  width: min(100%, var(--detail-card-width));
  aspect-ratio: 1043 / 1500;
  height: auto;
  min-height: 0;
  padding: clamp(6px, 0.9vw, 12px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface, var(--soft-blue-2));
  overflow: hidden;
}

.detail-slide-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
}

.slide-stage.slide-type-example {
  background: color-mix(in srgb, var(--surface, var(--soft-blue-2)) 62%, var(--white));
}

.slide-stage.slide-type-example .detail-slide-image {
  max-width: 100%;
  max-height: 100%;
}

.slide-stage.slide-type-graphic .detail-slide-image,
.slide-stage.slide-type-photo .detail-slide-image {
  max-width: 100%;
  max-height: 100%;
}

.slide-fallback {
  font-family: var(--display);
  font-size: 72px;
  font-weight: 900;
  color: var(--accent-deep, var(--control-blue));
}

.mirror-stage {
  background: var(--soft-gray);
  padding: 0;
}

.mirror-stage video {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  transform: scaleX(-1);
}

.mirror-stage p {
  margin: 0;
  padding: 18px;
  text-align: center;
}

.detail-controls {
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr) auto auto;
  gap: clamp(6px, 1vw, 10px);
  align-items: center;
  min-width: 0;
}

.detail-controls.no-mirror {
  grid-template-columns: auto minmax(90px, 1fr) auto;
}

.detail-controls button,
.audio-bank button {
  min-height: clamp(38px, 5.2vh, 44px);
  padding: 0 clamp(8px, 1vw, 12px);
}

.slide-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
}

.slide-dots button {
  width: 12px;
  height: 12px;
  padding: 0;
  border-radius: 999px;
  background: var(--soft-gray);
}

.slide-dots button.is-active {
  background: var(--accent-deep, var(--control-blue));
}

.audio-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 0;
}

.accent-blue {
  --accent: var(--blue);
  --accent-deep: var(--control-blue);
  --accent-soft: var(--soft-blue);
  --surface: var(--soft-blue-2);
  --tile-bg: #FEFDFC;
  --ring: rgba(126, 168, 201, 0.32);
}

.accent-green {
  --accent: var(--green);
  --accent-deep: var(--control-green);
  --accent-soft: var(--soft-green);
  --surface: var(--soft-green-2);
  --tile-bg: #FEFDFC;
  --ring: rgba(127, 175, 140, 0.34);
}

.accent-purple {
  --accent: var(--purple);
  --accent-deep: var(--control-purple);
  --accent-soft: var(--soft-purple);
  --surface: var(--soft-purple-2);
  --tile-bg: #FEFDFC;
  --ring: rgba(154, 134, 199, 0.34);
}

.accent-orange {
  --accent: var(--orange);
  --accent-deep: #9a6429;
  --accent-soft: var(--soft-yellow);
  --surface: var(--soft-yellow-2);
  --tile-bg: #FEFDFC;
  --ring: rgba(223, 160, 90, 0.34);
}

.accent-red {
  --accent: var(--red);
  --accent-deep: var(--control-red);
  --accent-soft: var(--soft-pink);
  --surface: var(--soft-pink-2);
  --tile-bg: #FEFDFC;
  --ring: rgba(201, 106, 106, 0.32);
}

.accent-yellow {
  --accent: var(--yellow);
  --accent-deep: #886d14;
  --accent-soft: var(--soft-yellow);
  --surface: var(--soft-yellow-2);
  --tile-bg: #FEFDFC;
  --ring: rgba(234, 214, 107, 0.42);
}

.accent-pink {
  --accent: var(--pink);
  --accent-deep: #9f5757;
  --accent-soft: var(--soft-pink);
  --surface: var(--soft-pink-2);
  --tile-bg: #FEFDFC;
  --ring: rgba(232, 166, 166, 0.34);
}

.accent-brown {
  --accent: var(--brown);
  --accent-deep: #76573a;
  --accent-soft: var(--soft-brown);
  --surface: #f4eddf;
  --tile-bg: #FEFDFC;
  --ring: rgba(184, 146, 100, 0.34);
}

.accent-gray {
  --accent: var(--gray);
  --accent-deep: var(--deep-gray);
  --accent-soft: var(--soft-gray);
  --surface: #f3f5f5;
  --tile-bg: #FEFDFC;
  --ring: rgba(108, 122, 137, 0.30);
}

@media (min-width: 1700px) {
  .page-shell {
    width: min(1840px, calc(100% - 64px));
  }

  .consonant-page {
    width: min(1840px, calc(100% - 64px));
  }

  .sound-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }

  .resource-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }

  .dashboard-actions {
    gap: 24px;
  }

  .valley-map {
    --valley-card-width: var(--vowel-card-width);
    --valley-row-height: var(--vowel-row-height);
  }
}

@media (max-width: 1100px) {
  .dashboard-actions,
  .vowel-support-grid,
  .practice-layout.has-mirror {
    grid-template-columns: 1fr;
  }

  .valley-map {
    --valley-card-width: var(--vowel-card-width);
    --valley-row-height: var(--vowel-row-height);
    column-gap: clamp(3px, 0.5vw, 8px);
    row-gap: clamp(5px, 0.8vw, 10px);
    padding: 12px;
  }

  .valley-node {
    width: min(100%, var(--valley-card-width));
  }

  .valley-card span {
    font-size: var(--vowel-card-label-size);
  }

  .library-tools {
    grid-template-columns: 1fr 1fr;
  }

  .library-tools .search-box {
    grid-column: 1 / -1;
  }

  .consonant-chart-panel {
    overflow-x: auto;
  }

  .consonant-axis-top {
    margin-left: 0;
  }

  .consonant-axis-side {
    display: none;
  }

  .consonant-grid {
    min-width: 900px;
    margin-left: 0;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 20px, 720px);
  }

  .consonant-page {
    width: min(100% - 20px, 720px);
  }

  .site-header-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 0;
  }

  .site-nav {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
    overflow: visible;
    padding-bottom: 4px;
  }

  .nav-link {
    flex: 0 0 auto;
  }

  .site-name {
    font-size: 24px;
  }

  h1 {
    font-size: 34px;
  }

  h2 {
    font-size: 23px;
  }

  .dashboard,
  .view {
    padding-top: 22px;
  }

  .vowel-page {
    padding-top: 16px;
  }

  .vowel-size-controls {
    justify-content: flex-start;
    width: 100%;
    margin: 10px 0;
  }

  .section-card-main,
  .view-header,
  .status-band,
  .group-heading {
    align-items: stretch;
  }

  .view-header,
  .view-header.has-actions {
    grid-template-columns: 1fr;
  }

  .view-header-actions {
    justify-content: flex-start;
  }

  .section-card-main {
    grid-template-columns: 48px 1fr;
  }

  .arrow-icon {
    display: none;
  }

  .status-pills {
    justify-content: flex-start;
  }

  .sound-grid,
  .resource-grid {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .sound-tile {
    min-height: 0;
  }

  .tile-actions {
    grid-template-columns: 1fr 1fr;
  }

  .library-category-toggle {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px;
  }

  .library-category-meta {
    grid-column: 1 / -1;
    width: fit-content;
    font-size: 13px;
  }

  .library-tools {
    grid-template-columns: 1fr;
  }

  .detail-overlay {
    padding: 8px;
    align-items: start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .detail-panel {
    width: min(100%, 560px);
    height: auto;
    max-height: calc(100vh - 16px);
    overflow: visible;
    padding: 12px;
    --detail-card-width: clamp(190px, min(68vw, 34dvh), 310px);
  }

  .detail-panel:has(.practice-layout.has-mirror) {
    width: min(100%, 560px);
    --detail-card-width: clamp(122px, min(42vw, 24dvh), 190px);
  }

  .detail-header {
    align-items: stretch;
  }

  .detail-header h2 {
    font-size: 28px;
  }

  .slide-stage,
  .mirror-stage,
  .mirror-stage video {
    min-height: 0;
  }

  .detail-controls {
    grid-template-columns: 1fr 1fr;
  }

  .detail-controls.no-mirror {
    grid-template-columns: 1fr 1fr;
  }

  .detail-controls.no-mirror .slide-dots {
    grid-column: 1 / -1;
    order: 3;
  }

  .audio-bank {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .consonant-chart-panel {
    padding: 14px;
  }

  .consonant-axis-top {
    text-align: left;
  }

  .chart-column-label {
    height: 82px;
  }

  .chart-row-label,
  .chart-cell {
    height: 76px;
  }

  .valley-map {
    --valley-card-width: var(--vowel-card-width);
    --valley-row-height: var(--vowel-row-height);
    column-gap: 4px;
    row-gap: 5px;
    padding: 10px;
  }

  .valley-node {
    width: min(100%, var(--valley-card-width));
  }

  .slide-dots {
    grid-column: 1 / -1;
    order: -1;
  }
}

@media (max-width: 520px) and (orientation: portrait) {
  .page-shell {
    width: min(calc(100% - 20px), 360px);
  }

  .practice-layout.has-mirror {
    grid-template-columns: repeat(2, minmax(0, var(--detail-card-width)));
    justify-content: center;
    gap: 8px;
  }

  .consonant-chart-panel {
    display: none;
  }

  .consonant-phone-fallback {
    display: grid;
  }

  .phone-consonant-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .consonant-page .view-header-actions {
    display: none;
  }

  .valley-scroll {
    display: none;
  }

  .valley-phone-fallback {
    display: grid;
  }

  .phone-vowel-list {
    grid-template-columns: 1fr;
  }

  .phone-consonant-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .site-logo-frame {
    width: 42px;
    height: 42px;
  }

  .site-name {
    font-size: 22px;
  }

  h1 {
    font-size: 30px;
  }

  .tile-actions {
    grid-template-columns: 1fr;
  }

  .tile-actions button,
  .detail-controls button,
  .audio-bank button {
    min-height: 48px;
  }
}
