@import url("https://fonts.googleapis.com/css2?family=Averia+Serif+Libre:wght@400;700&family=Nunito+Sans:wght@400;600;700&family=Playpen+Sans+Hebrew:wght@400&family=Rubik:wght@400;700&display=swap");

:root {
  --bg: #FDFDFC;
  --surface: #FFFFFF;
  --surface-muted: #F5F5F2;
  --surface-hover: #ECECE7;
  --control-track: #D6D8D2;
  --primary: #8CB65A;
  --primary-hover: #7AA34C;
  --primary-tint: #F3F7EC;
  --primary-wash: #E4F0D2;
  --reader-intro: var(--primary-wash);
  --text: #20251F;
  /* Use one foreground for headings, body copy, labels, and metadata. */
  --ink: var(--text);
  --text-muted: var(--text);
  --text-disabled: #969A92;
  --border: #E2E2DC;
  --border-rgb: 226, 226, 220;
  --accent: #C4A35A;
  /* Vocab status palette. Fills are muted enough for the off-white page and keep
     ≥7:1 contrast with --ink; lines are the stronger companion used for rings. */
  --status-unsaved-fill: #ECE9E0;
  --status-unsaved-line: #C9C4B6;
  --status-new-fill: #FBE9A8;
  --status-new-line: #D9B143;
  --status-recognized-fill: #D3E6F3;
  --status-recognized-line: #6FA7CC;
  --status-learned-fill: #D4EBC2;
  --status-learned-line: var(--primary);
  --radius-btn: 0.5rem;
  --font-sans: "Nunito Sans", sans-serif;
  --font-display: "Averia Serif Libre", serif;
  --grain:
    radial-gradient(rgba(61, 74, 50, 0.07) 0.55px, transparent 0.7px),
    radial-gradient(rgba(61, 74, 50, 0.045) 0.55px, transparent 0.7px);
}

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

img,
svg {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: var(--grain);
  background-size: 6px 6px, 10px 10px;
  background-position: 0 0, 2px 4px;
  color: var(--text);
  font-family: var(--font-sans);
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.layout {
  display: flex;
  min-height: 100vh;
  align-items: flex-start;
}

.sidebar {
  position: sticky;
  top: 0;
  width: 256px;
  height: 100vh;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--border);
  background: transparent;
}

.sidebar-brand {
  padding: 1.5rem 0.75rem 1rem;
}

.sidebar-logo {
  padding: 0 0.5rem 0.75rem;
}

.sidebar-logo a {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
}

.sidebar-logo img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.sidebar-logo span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--ink);
}

.lang-select {
  position: relative;
}

.lang-select__btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.7rem 0.5rem 0.9rem;
  border: 0;
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.lang-select__btn .icon--chevron {
  margin-left: auto;
  color: var(--text-muted);
}

.lang-select.is-open .lang-select__btn .icon--chevron {
  transform: rotate(180deg);
}

.lang-select__menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 6;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--surface-muted);
  border-radius: 1rem;
}

.lang-select__menu button {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  padding: 0.45rem 0.7rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.lang-select__native {
  font-family: var(--font-sans), "Segoe UI", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

.lang-select__menu button:hover,
.lang-select__menu button[aria-selected="true"] {
  background: var(--primary-wash);
  color: var(--text);
}

.lang-select__menu button:hover .lang-select__native,
.lang-select__menu button[aria-selected="true"] .lang-select__native {
  color: var(--text);
}

.sidebar-nav {
  flex: 1;
  padding: 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.95rem 1.15rem;
  border: 0;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.nav-item__shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: visible;
}

.nav-item__shape path {
  fill: var(--surface-muted);
  stroke: var(--surface-muted);
  stroke-width: 50;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.active .nav-item__shape path {
  fill: var(--primary);
  stroke: var(--primary);
}

.nav-item:hover:not(.active) .nav-item__shape path {
  fill: var(--surface-hover);
  stroke: var(--surface-hover);
}

.nav-item.active:hover .nav-item__shape path {
  fill: var(--primary-hover);
  stroke: var(--primary-hover);
}

.nav-item.active {
  color: #fff;
}

.nav-item__content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transform-origin: left center;
}

.nav-item.active .nav-item__content {
  transform: scale(1.12);
}

.nav-icon {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  background-color: var(--primary);
  -webkit-mask: var(--nav-icon) center / contain no-repeat;
  mask: var(--nav-icon) center / contain no-repeat;
}

.nav-item.active .nav-icon {
  background-color: #fff;
}

.nav-icon--home {
  --nav-icon: url("../home icon.png");
}

.nav-icon--vocab {
  --nav-icon: url("../hebrew aleph.png");
}

.nav-icon--flashcards {
  --nav-icon: url("../flashcards.png");
  background-color: #9AB744;
}

.nav-icon--settings {
  --nav-icon: url("../settings.svg");
}

.nav-icon--megaphone {
  --nav-icon: url("../megaphone.svg");
}

.nav-icon--feedback {
  --nav-icon: url("../feedback.svg");
}

html[data-language="arabic"] .nav-icon--vocab,
html[data-language="persian"] .nav-icon--vocab {
  --nav-icon: url("../arabic ayin.png");
}

html[data-language="greek"] .nav-icon--vocab {
  --nav-icon: url("../greek alpha.png");
}

html[data-language="hebrew"] .nav-icon--vocab {
  --nav-icon: url("../hebrew aleph.png");
}

html[data-language="french"] .nav-icon--vocab,
html[data-language="spanish"] .nav-icon--vocab,
html[data-language="portuguese"] .nav-icon--vocab {
  --nav-icon: url("../latin a.png");
}

.icon {
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  display: block;
}

.icon--chevron {
  width: 1.15rem;
  height: 1.15rem;
}

.sidebar-bottom {
  flex-shrink: 0;
  margin-top: auto;
  padding: 0;
}

.account {
  position: relative;
  display: flex;
  flex-direction: column;
}

.account::after {
  content: "";
  height: 3.4rem;
  margin-top: -0.7rem;
  background: var(--surface-muted);
}

.account__roof {
  display: block;
  width: 100%;
  height: auto;
}

.account__name {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 0;
  padding: 0 1.25rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

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

.account-page {
  min-height: 100vh;
}

.account-page__frame {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-width: 84rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.account-page__logo {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.account-page__logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.account-page__logo span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--ink);
}

.account-page__back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1.75rem;
  padding: 0.3rem 0.7rem 0.3rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.account-page__back svg {
  width: 1rem;
  height: 1rem;
}

.account-page__body {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
  margin-top: 1.75rem;
}

.account-page__nav {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.account-page__nav .nav-item.active .nav-item__content {
  transform: none;
}

.account-settings {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.account-card {
  padding: 1.15rem 1.25rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
}

.account-card h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
}

.account-profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.account-profile__avatar {
  display: grid;
  place-items: center;
  width: 4.25rem;
  height: 4.25rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.account-profile__avatar svg {
  width: 2rem;
  height: 2rem;
}

.account-profile__fields {
  flex: 1;
  min-width: 0;
}

.account-profile__name {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.account-profile__name input {
  flex: 1;
  min-width: 0;
  height: 2.4rem;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}

.account-profile__name button {
  height: 2.4rem;
  padding: 0 0.9rem;
  border: 0;
  border-radius: 0.55rem;
  background: var(--surface-hover);
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.account-profile__name button:not(:disabled) {
  background: var(--primary);
  color: #fff;
}

.account-profile__name button:disabled {
  cursor: default;
}

.account-profile__email {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.account-profile__error {
  margin: 0.35rem 0 0;
  color: #9a4a3a;
  font-size: 0.85rem;
}

.account-notices {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.account-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.account-notice p {
  margin: 0;
}

.account-notice__label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.account-notice__hint {
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.account-switch {
  position: relative;
  width: 2.7rem;
  height: 1.55rem;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--control-track);
  cursor: pointer;
}

.account-switch span {
  position: absolute;
  top: 0.16rem;
  left: 0.16rem;
  width: 1.23rem;
  height: 1.23rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(61, 74, 50, 0.2);
  transition: transform 120ms ease;
}

.account-switch.is-on {
  background: var(--primary);
}

.account-switch.is-on span {
  transform: translateX(1.15rem);
}

.account-logout {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.35rem;
}

.account-logout button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.15rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.account-logout svg {
  width: 1.05rem;
  height: 1.05rem;
}

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

.main {
  flex: 1;
  min-width: 0;
}

.library {
  width: 100%;
  max-width: 84rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 8rem;
}

.library-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.library-section h2 {
  position: relative;
  margin: 0;
  font-weight: 700;
  font-size: 2.25rem;
  line-height: 1.15;
  color: var(--ink);
}

.library-section--mascot {
  padding-left: 9.25rem;
}

.library-section h2 img {
  position: absolute;
  top: 50%;
  right: calc(100% + 1.15rem);
  width: 5.85rem;
  height: auto;
  transform: translateY(-50%);
  pointer-events: none;
}

.continue-lead {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.continue-lead__feature {
  grid-column: 1 / -1;
  min-width: 0;
  display: flex;
}

.continue-lead__feature .story-card {
  flex: 1;
}

.continue-lead__item {
  min-width: 0;
  display: flex;
}

.continue-lead__item .story-card {
  flex: 1;
}

@media (min-width: 1024px) {
  .continue-lead {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .continue-lead__feature {
    grid-column: span 2;
    grid-row: span 2;
  }
}

.story-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.story-filters {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  margin-left: auto;
}

.story-dropdown {
  position: relative;
  width: 9.5rem;
  flex-shrink: 0;
}

.story-dropdown__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
  height: 100%;
  padding: 0.5rem 0.75rem 0.5rem 1rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--surface-muted);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.story-dropdown__btn .icon--chevron {
  color: var(--text-muted);
}

.story-dropdown.is-open .story-dropdown__btn .icon--chevron {
  transform: rotate(180deg);
}

.story-dropdown__menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 5;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--surface-muted);
  border-radius: 0.5rem;
}

.story-dropdown__menu button {
  display: block;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.story-dropdown__menu button:hover,
.story-dropdown__menu button[aria-selected="true"] {
  background: var(--primary-wash);
  color: var(--text);
}

.story-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 16rem;
  padding: 0.5rem 0.85rem;
  border-radius: 0.5rem;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.story-search .icon {
  width: 1.15rem;
  height: 1.15rem;
}

.story-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  outline: none;
}

.story-search input::placeholder {
  color: var(--text-muted);
}

.story-search input::-webkit-search-cancel-button {
  display: none;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
}

.story-card[hidden] {
  display: none;
}

.story-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  text-decoration: none;
  color: inherit;
  background: var(--surface-muted);
  border-radius: 0.5rem;
}

.story-card--featured .story-card__image {
  flex: none;
  aspect-ratio: 5 / 3;
  min-height: 0;
}

.story-card--featured .story-card__title {
  font-size: 1.75rem;
  line-height: 1.15;
}

.story-card__desc {
  margin: 0.5rem 0 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-card--featured .story-card__body {
  flex: 0;
}

.story-card__image {
  position: relative;
  margin: 0.5rem 0.5rem 0;
  aspect-ratio: 16 / 9;
  border-radius: 0.375rem;
  background: var(--surface-hover);
  overflow: hidden;
}

.story-card__olive {
  position: absolute;
  z-index: 1;
  width: 3.15rem;
  height: auto;
  right: 0.55rem;
  bottom: 0.4rem;
  pointer-events: none;
}

.story-card__image img:not(.story-card__olive) {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story-card__image .story-card__olive {
  width: 3.15rem;
  height: auto;
  object-fit: contain;
}

.story-card__body {
  padding: 0.75rem 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.story-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 1.25;
  color: var(--ink);
}

.story-card__meta {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.story-card__progress {
  margin-top: 0.5rem;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.story-card__progress span {
  display: block;
  height: 100%;
  background: #C5D9A4;
  border-radius: inherit;
}

.path-level-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.path-level-tab {
  padding: 0.375rem 0.875rem;
  border: 0;
  border-radius: 999px;
  background: var(--surface-muted);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.path-level-tab.active {
  background: var(--primary-wash);
  color: var(--text);
  box-shadow: inset 0 0 0 1.5px var(--primary);
}

.path-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.path-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.625rem 1.25rem 0.625rem 0.625rem;
  text-decoration: none;
  color: inherit;
  background: var(--surface-muted);
  border-radius: 999px;
}

.path-row__icon-wrap {
  --progress: 0;
  position: relative;
  width: 4rem;
  height: 4rem;
  flex-shrink: 0;
}

.path-row__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.path-row__ring-track,
.path-row__ring-progress {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.path-row__ring-track {
  stroke: var(--ink);
  opacity: 0.22;
}

.path-row__ring-progress {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: calc(1 - var(--progress));
}

.path-row__icon {
  position: absolute;
  inset: 0.5rem;
  border-radius: 50%;
  background: var(--surface-hover);
  border: 1px dashed var(--border);
  overflow: hidden;
}

.path-row__icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.path-row__text {
  min-width: 0;
  padding: 0.25rem 0;
}

.path-row__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--ink);
}

.path-row__subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.collection-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.collection-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: inherit;
  background: var(--surface-muted);
  border-radius: 1rem;
  padding: 0.75rem;
}

.collection-card__cover {
  position: relative;
  width: 8rem;
  height: 6rem;
  flex-shrink: 0;
  border-radius: 0.75rem;
  overflow: hidden;
  background: var(--surface-hover);
}

.collection-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.collection-card__text {
  min-width: 0;
  padding: 0.25rem 0.25rem 0.25rem 0;
}

.collection-card__meta {
  margin: 0 0 0.35rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.collection-card__title {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--ink);
}

.collection-card__desc {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.library-empty,
.page-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.library-empty {
  min-height: 12rem;
}

.library-empty[hidden] {
  display: none;
}

.page-empty {
  min-height: 100vh;
}

.library-empty img,
.page-empty img {
  width: 4.5rem;
  height: auto;
}

.library-empty p,
.page-empty p {
  margin: 0;
  font-size: 1.05rem;
}

.reader-back {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.reader {
  --gender-masculine: #2C6F97;
  --gender-feminine: #C75B78;
  width: 100%;
  max-width: 84rem;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.reader-clip-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.reader__intro {
  position: relative;
  z-index: 5;
  width: 100vw;
  margin: 0 calc(50% - 50vw) 5rem;
  padding-top: 2rem;
  padding-bottom: 2.5rem;
  background: var(--reader-intro);
}

.reader__intro::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% - 2px);
  height: calc(5rem + 2px);
  background: var(--reader-intro);
  clip-path: url(#readerIntroClip);
}

.reader__intro-inner {
  position: relative;
  max-width: 84rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.reader h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2.5rem;
  line-height: 1.15;
  color: var(--ink);
}

.reader__image {
  display: block;
  width: 100%;
  max-width: 40rem;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin: 1.25rem 0 0;
  border-radius: 0.75rem;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.reader__level,
.reader__blurb {
  max-width: 40rem;
  margin: 1.25rem 0 0;
  font-family: var(--font-sans);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text);
}

.reader__level {
  font-weight: 700;
}

.reader__level + .reader__blurb {
  margin-top: 0.35rem;
}

.reader__stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(10rem, 27.6rem);
  column-gap: 2rem;
  align-items: start;
}

.reader__hebrew {
  --reader-size: 1.625rem;
  width: 100%;
  max-width: 40rem;
  margin-top: 2rem;
  font-family: "Rubik", sans-serif;
  color: var(--text);
}

.reader-float {
  position: sticky;
  top: 1.5rem;
  justify-self: center;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  width: min(27.6rem, 100%);
  height: auto;
  margin-top: 2rem;
}

.reader-float__box {
  position: relative;
  flex: 0 0 auto;
  height: 39rem;
}

.reader-float img {
  display: block;
  width: 100%;
  height: 100%;
}

.reader-float__box > img {
  transform: scaleY(-1);
}

.reader-float__card {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 3rem 2.15rem 1.6rem 2.45rem;
  text-align: left;
  pointer-events: none;
}

.reader-float__card[hidden] {
  display: none;
}

.reader-float__head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
}

.reader-float__hebrew {
  margin: 0;
  min-width: 0;
  flex: 1;
  color: var(--text);
  font-family: "Rubik", sans-serif;
  font-size: 3.75rem;
  font-weight: 700;
  line-height: 1.45;
  white-space: nowrap;
}

.reader-float__speaker {
  flex-shrink: 0;
  margin-inline-start: auto;
  margin-inline-end: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.15rem;
  height: 3.15rem;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  transition: opacity 0.15s ease, transform 180ms cubic-bezier(0.2, 0, 0, 1);
}

.reader-float__speaker:hover {
  opacity: 0.85;
}

.reader-float__speaker:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.reader-float__speaker img {
  display: block;
  width: 4.6rem;
  height: 4.6rem;
}

.reader-float__roman {
  margin: 0.45rem 0 0;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 1.4rem;
  line-height: 1.3;
}

.reader-float__gloss {
  margin: 1.05rem 0 0;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.25;
}

.reader-float__tags {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 1.05rem 0 0;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.35;
}

.reader-float__tags:empty {
  display: none;
}

.reader-float__tag-line {
  margin: 0;
}

.reader-float__gender--masculine {
  color: var(--gender-masculine);
  font-weight: 600;
}

.reader-float__gender--feminine {
  color: var(--gender-feminine);
  font-weight: 600;
}

@keyframes reader-float-fly-in-up {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes reader-float-fly-out-up {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-4px); }
}

@keyframes reader-float-fly-in-down {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes reader-float-fly-out-down {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(4px); }
}

@keyframes reader-float-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* The action block pulls out past the card's text padding so the buttons can be
   larger without touching the word details above. */
.reader-float__actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 23.25rem;
  max-width: 100%;
  align-self: center;
  margin: auto 0 0;
  /* The blob narrows on the bottom left, so a geometric center looks left of
     the opening. This shift puts the buttons in the middle of that opening. */
  transform: translateX(0.45rem);
  pointer-events: auto;
}

/* Fixed height so swapping between the Save button and the four status circles
   never changes the layout; both states fill the same box. */
.reader-float__save-area {
  --save-area-h: 4.9rem;
  display: grid;
  grid-template: 1fr / 1fr;
  width: 100%;
  height: var(--save-area-h);
}

.reader-float__save,
.reader-float__statuses {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
}

.reader-float__save[hidden],
.reader-float__statuses[hidden] {
  display: none;
}

.is-fly-in-up {
  animation: reader-float-fly-in-up 180ms cubic-bezier(0, 0, 0.2, 1) both;
}

.is-fly-out-up {
  animation: reader-float-fly-out-up 180ms cubic-bezier(0, 0, 0.2, 1) both;
}

.is-fly-in-down {
  animation: reader-float-fly-in-down 180ms cubic-bezier(0, 0, 0.2, 1) both;
}

.is-fly-out-down {
  animation: reader-float-fly-out-down 180ms cubic-bezier(0, 0, 0.2, 1) both;
}

.is-fade-in {
  animation: reader-float-fade-in 180ms ease 70ms both;
  opacity: 0;
}

.reader-float__statuses {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
}

.reader-float__status {
  --status-fill: var(--status-unsaved-fill);
  --status-line: var(--status-unsaved-line);
  --status-stroke: var(--status-fill);
  --status-stroke-w: 14;
  position: relative;
  height: 100%;
  aspect-ratio: 1;
  justify-self: center;
  /* The blob sits inside the square, so the painted top starts lower than
     Save word. Scaling from the center lifts that edge onto Save word's top. */
  transform: scale(1.13);
  transform-origin: center;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  pointer-events: auto;
  transition: color 160ms ease;
}

.reader-float__status-shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: visible;
}

.reader-float__status-shape path {
  fill: var(--status-fill);
  stroke: var(--status-stroke);
  stroke-width: var(--status-stroke-w);
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: fill 160ms ease, stroke 160ms ease, stroke-width 160ms ease;
}

.reader-float__status-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
}

.reader-float__status[data-status="1"] {
  --status-fill: var(--status-new-fill);
  --status-line: var(--status-new-line);
}

.reader-float__status[data-status="2"] {
  --status-fill: var(--status-recognized-fill);
  --status-line: var(--status-recognized-line);
}

.reader-float__status[data-status="3"] {
  --status-fill: var(--status-learned-fill);
  --status-line: var(--status-learned-line);
}

/* Hover shows a thin ring in the status's own colour; pressed thickens it. */
.reader-float__status:hover {
  --status-stroke: var(--status-line);
  --status-stroke-w: 8;
}

.reader-float__status[aria-pressed="true"] {
  --status-stroke: var(--status-line);
  --status-stroke-w: 14;
}

.reader-float__status--delete {
  --status-fill: var(--status-unsaved-fill);
  --status-line: #B5584F;
}

.reader-float__status--delete:hover {
  --status-fill: #F6E3DF;
  color: #8E3A33;
}

.reader-float__status-num {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
}

.reader-float__status-label {
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-align: center;
}

.reader-float__links {
  --links-gap: 0.6rem;
  position: relative;
  display: grid;
  grid-template-columns: 0fr 1fr;
  gap: 0;
  width: 100%;
}

.reader-float__card.is-animating-save .reader-float__links {
  transition: grid-template-columns 240ms cubic-bezier(0.2, 0.8, 0.2, 1), gap 240ms ease;
}

.reader-float__links.is-saved {
  grid-template-columns: 1fr 1fr;
  gap: var(--links-gap);
}

.reader-float__vocab-slot {
  min-width: 0;
}

.reader-float__links .reader-float__action--secondary {
  --btn-h: 3.6rem;
  min-width: 0;
  height: var(--btn-h);
  padding: 0;
  white-space: nowrap;
}

/* Buttons that change width use a 9-sliced brushstroke instead of a stretched SVG:
   the left/right caps (25% of the artwork, 305/488 of the height) are drawn at a
   fixed width so their curves never distort; only the near-straight middle stretches. */
.reader-float__action--sliced::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border: 0 solid transparent;
  border-image-source: url("../button-wash.svg");
  border-image-slice: 0 25% fill;
  border-image-width: 0 calc(var(--btn-h) * 305 / 488);
  border-image-repeat: stretch;
  transition: filter 160ms ease;
}

.reader-float__action--sliced:hover::before {
  filter: brightness(0.96) saturate(1.08);
}

/* My Vocab is always its final size and sits beneath Pealim. Pealim's brushstroke
   shrinking to the right is what reveals it, so there is never a hard clip edge. */
.reader-float__vocab {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(50% - var(--links-gap) / 2);
  z-index: 0;
}

.reader-float__pealim {
  position: relative;
  z-index: 1;
}

.reader-float__links .reader-float__action-label {
  position: absolute;
  inset: 0;
  justify-content: center;
}

.reader-float__links:not(.is-saved) .reader-float__vocab .reader-float__action-label {
  opacity: 0;
  animation: none;
}

.reader-float__action {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  border: 0;
  background: transparent;
  appearance: none;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.reader-float__action--primary {
  padding: 0 1.25rem;
  font-size: 1.3rem;
  color: #fff;
}

.reader-float__action--secondary {
  padding: 0.95rem 1.25rem;
  font-size: 1.12rem;
  color: var(--text);
}

.reader-float__action-shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: visible;
}

.reader-float__action-shape path {
  stroke-width: 50;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reader-float__action--primary .reader-float__action-shape path {
  fill: var(--primary);
  stroke: var(--primary);
}

.reader-float__action--primary:hover .reader-float__action-shape path {
  fill: var(--primary-hover);
  stroke: var(--primary-hover);
}

.reader-float__action--secondary .reader-float__action-shape path {
  fill: var(--primary-wash);
  stroke: var(--primary-wash);
}

.reader-float__action--secondary:hover .reader-float__action-shape path {
  fill: #d8e8c4;
  stroke: #d8e8c4;
}

.reader-float__action-label {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.reader-float__action-label img {
  width: 1.35rem;
  height: 1.35rem;
  object-fit: contain;
}

.reader-float__action:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .reader-float__card.is-animating-save .reader-float__links,
  .reader-float__status,
  .reader-float__action {
    transition: none;
  }

  .is-fly-in-up,
  .is-fly-out-up,
  .is-fly-in-down,
  .is-fly-out-down,
  .is-fade-in {
    animation: none;
    opacity: 1;
    transform: none;
  }
}


.reader-audio {
  position: relative;
  z-index: 2;
  order: -1;
  flex: 0 0 auto;
  width: 100%;
  height: 7.5rem;
  pointer-events: auto;
  background: transparent;
}

.reader-audio__body {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.reader-audio__body path {
  fill: var(--surface-muted);
  stroke: var(--surface-muted);
  stroke-width: 50;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reader-audio__controls {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  height: 100%;
  padding: 0.85rem 1.45rem 1rem 1.2rem;
  pointer-events: auto;
}

.reader-audio__play {
  position: relative;
  flex: 0 0 4rem;
  width: 4rem;
  height: 4rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  appearance: none;
  cursor: pointer;
  pointer-events: auto;
  color: var(--ink);
}

.reader-audio__play:hover .reader-audio__play-shape path,
.reader-audio__play:focus-visible .reader-audio__play-shape path {
  stroke: var(--primary);
  stroke-width: 8;
}

.reader-audio__play:disabled {
  cursor: wait;
}

.reader-audio__play:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.reader-audio__play-shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.reader-audio__play-shape path {
  fill: var(--primary-wash);
  stroke: var(--primary-wash);
  stroke-width: 14;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 160ms ease, stroke-width 160ms ease;
}

.reader-audio__play.is-playing .reader-audio__play-shape path,
.reader-audio__play.is-playing:hover .reader-audio__play-shape path,
.reader-audio__play.is-playing:focus-visible .reader-audio__play-shape path {
  stroke: var(--primary);
  stroke-width: 14;
}

.reader-audio__glyph {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  pointer-events: none;
  color: var(--ink);
}

.reader-audio__glyph svg {
  width: 1.32rem;
  height: 1.32rem;
  display: block;
}

.reader-audio__speaker {
  width: 1.9rem;
  height: 1.9rem;
  background-color: var(--ink);
  -webkit-mask: url("/speaker.png") center / contain no-repeat;
  mask: url("/speaker.png") center / contain no-repeat;
}

.reader-audio__meter {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.reader-audio__track {
  position: relative;
  height: 0.65rem;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.reader-audio__track.is-dragging {
  cursor: grabbing;
}

.reader-audio__track:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}

.reader-audio__range {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 999px;
  background: rgba(102, 112, 92, 0.28);
  pointer-events: none;
}

.reader-audio__fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--primary);
  pointer-events: none;
  transition: width 0.1s ease;
}

.reader-audio__track.is-dragging .reader-audio__fill {
  transition: none;
}

.reader-audio__times {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  .reader-audio__fill {
    transition: none;
  }
}

.reader__sentence {
  margin: 0;
  padding: 0.5rem 1rem 0.25rem;
}

.reader__sentence + .reader__sentence {
  margin-top: 4.5rem;
}

.reader__line {
  margin: 0;
  direction: rtl;
  text-align: right;
  line-height: 1.625;
}

.reader__roman-slot,
.reader__english-slot {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
}

.reader__roman-slot > .reader__roman,
.reader__english-slot > .reader__english {
  min-height: 0;
  overflow: hidden;
}

.reader__english {
  margin: 0;
  padding-top: 0.7rem;
  direction: ltr;
  text-align: right;
  text-wrap: pretty;
  font-family: var(--font-sans);
  font-size: calc(var(--reader-size) * 0.6);
  line-height: 1.45;
  color: var(--text);
}

.reader__token {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: bottom;
  white-space: nowrap;
  font-weight: 400;
  margin: 0.18rem;
  padding: 0.08rem 0.35rem 0.22rem;
  background: var(--surface-muted);
  border-radius: 0.45rem;
  outline: 2px solid transparent;
  outline-offset: 2px;
  cursor: pointer;
  position: relative;
  transform: scale(1);
  transform-origin: center;
  transition: outline-color 0.15s linear;
}

.reader__token:hover:not(.is-selected) {
  outline-color: rgba(120, 113, 108, 0.45);
}

.reader__token.is-selected {
  outline-color: var(--text-muted);
}

.reader__roman {
  font-size: calc(var(--reader-size) * 0.48);
  line-height: 1.2;
  white-space: nowrap;
  color: var(--text-muted);
  direction: ltr;
  unicode-bidi: isolate;
}

.reader__word {
  position: relative;
  display: inline-grid;
  direction: rtl;
  unicode-bidi: isolate;
  font-size: var(--reader-size);
  line-height: calc(var(--reader-size) * 1.4);
  white-space: nowrap;
  transition: opacity 150ms ease;
}

.reader__word-sizer,
.reader__word-face {
  grid-area: 1 / 1;
  justify-self: center;
}

.reader__word-sizer {
  visibility: hidden;
  font-family: "Rubik", sans-serif;
  white-space: nowrap;
}

.reader__word-face {
  position: relative;
  direction: rtl;
  white-space: nowrap;
  line-height: inherit;
  opacity: 1;
}

.reader__word-ink.is-covered {
  visibility: hidden;
}

.reader__word-anim {
  position: absolute;
  inset: 0;
  text-align: center;
  direction: rtl;
  line-height: inherit;
  pointer-events: none;
}

.reader__word-face.is-off {
  opacity: 0;
}

.reader__stage.is-handwriting .reader__word-face,
.reader__stage.is-handwriting .reader__punct {
  font-family: "Playpen Sans Hebrew", "Rubik", sans-serif;
}

.reader__token[data-gender]::after {
  content: "";
  position: absolute;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 0 0 0.45rem 0.45rem;
  pointer-events: none;
  transform: scaleY(1);
  transform-origin: center bottom;
  opacity: 1;
}

.reader__token[data-gender="masculine"]::after {
  background: #4C9AE8;
}

.reader__token[data-gender="feminine"]::after {
  background: #F278A0;
}

.reader__hebrew.is-gender-off .reader__token[data-gender]::after {
  opacity: 0;
  transform: scaleY(0);
}

.reader__token.is-ahead .reader__word {
  opacity: 0.22;
}

.reader__token.is-speaking .reader__word {
  opacity: 1;
  transition: none;
}

.playback-letter {
  color: inherit;
}

.playback-letter.is-sweeping {
  background-repeat: no-repeat;
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.reader__token--punct {
  margin-inline-end: 0;
}

.reader__punct {
  display: inline-block;
  vertical-align: bottom;
  font-size: var(--reader-size);
  line-height: 1;
  padding-bottom: 0.25em;
  color: var(--text-muted);
}

.reader__controls {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  gap: 0;
  margin-bottom: 1.75rem;
  overflow-x: auto;
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
}

.reader__rule {
  flex: 1 1 0.75rem;
  display: flex;
  justify-content: center;
  align-self: stretch;
  min-width: 0.75rem;
}

.reader__rule::before {
  content: "";
  width: 1px;
  margin-block: 0.7rem;
  background: color-mix(in srgb, var(--text-muted) 36%, var(--border));
}

.reader__sizes {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  justify-content: flex-start;
  align-self: stretch;
  min-width: max-content;
  min-height: 3.5rem;
  gap: 0.2rem;
  padding: 0.45rem 0 0.55rem;
  border-radius: 0;
  background: transparent;
}

.reader__sizes button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.65rem;
  padding: 0;
  border: 0;
  border-radius: 0.4rem;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.reader__sizes button:nth-child(1) { font-size: 1.05rem; }
.reader__sizes button:nth-child(2) { font-size: 1.4rem; }
.reader__sizes button:nth-child(3) { font-size: 1.75rem; }

.reader__sizes button[aria-pressed="true"] {
  background: var(--border);
  color: var(--text);
}

.reader__sizes button:focus-visible,
.reader__toggle-input:focus-visible + .reader__switch {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.reader__toggle {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-width: max-content;
  min-height: 3.5rem;
  gap: 0.7rem;
  margin: 0;
  padding: 0.7rem 0;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
}

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

.reader__switch {
  position: relative;
  flex-shrink: 0;
  width: 2.75rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--control-track);
  transform: scale(1);
  transform-origin: center;
  transition:
    background-color 180ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 180ms cubic-bezier(0.2, 0, 0, 1);
}

.reader__toggle-text {
  display: inline-block;
  transform: scale(1);
  transform-origin: center;
  transition: transform 180ms cubic-bezier(0.2, 0, 0, 1);
}

.reader__toggle:active .reader__switch,
.reader__toggle:active .reader__toggle-text {
  transform: scale(0.96);
}

.reader__switch::after {
  content: "";
  position: absolute;
  top: 0.175rem;
  left: 0.175rem;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.reader__toggle-input:checked + .reader__switch {
  background: var(--ink);
}

.reader__toggle-input:checked + .reader__switch::after {
  transform: translateX(1.25rem);
}

.reader__hebrew.is-roman-off .reader__roman-slot,
.reader__hebrew.is-english-off .reader__english-slot {
  grid-template-rows: 0fr;
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .reader__switch::after,
  .reader__word,
  .playback-letter,
  .reader__roman-slot,
  .reader__english-slot,
  .reader__roman,
  .reader__english {
    transition: none;
  }
}

.vocab-page {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.vocab-word-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.vocab-word-page .vocab-forms,
.vocab-word-page .vocab-form,
.vocab-word-page .vocab-form__card,
.vocab-word-page .vocab-excerpt-slot {
  flex: 1;
}

.vocab-page h1 {
  margin: 0 0 1.5rem;
  font-weight: 700;
  font-size: 2.25rem;
  line-height: 1.15;
  color: var(--ink);
}

.vocab-tools {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.vocab-search {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 0.95rem;
  border-radius: 0.65rem;
  background: var(--surface-muted);
  color: var(--text-muted);
}

.vocab-search svg {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
}

.vocab-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  outline: none;
}

.vocab-search input::placeholder {
  color: var(--text-muted);
  font-weight: 600;
}

.vocab-filters {
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: stretch;
}

.vocab-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  height: 2.75rem;
  padding: 0 0.45rem;
  border: 0;
  border-radius: 0.65rem;
  background: var(--surface-muted);
  color: var(--text);
  font-size: clamp(0.75rem, 2.6cqi, 0.95rem);
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
}

.vocab-pill.is-active,
.vocab-type.is-active .vocab-type__btn {
  background: var(--primary);
  color: #fff;
}

.vocab-type {
  position: relative;
  min-width: 0;
}

.vocab-type__btn {
  justify-content: space-between;
  gap: 0.35rem;
  padding-right: 0.7rem;
}

.vocab-type__btn span {
  min-width: 0;
  white-space: nowrap;
}

.vocab-type__btn svg,
.vocab-status__btn svg {
  width: 0.85rem;
  height: 0.85rem;
  flex-shrink: 0;
}

.vocab-type.is-open .vocab-type__btn svg,
.vocab-status.is-open .vocab-status__btn svg {
  transform: rotate(180deg);
}

.vocab-menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 6;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--surface-muted);
  border-radius: 0.5rem;
}

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

.vocab-menu button {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.45rem 0.65rem;
  border: 0;
  border-radius: 0.375rem;
  background: transparent;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.vocab-menu button[aria-selected="true"],
.vocab-menu button[aria-checked="true"],
.vocab-menu button:hover {
  background: var(--primary-wash);
  color: var(--text);
}

.vocab-list {
  list-style: none;
  margin: 1.75rem 0 0;
  padding: 0;
}

.vocab-row {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch;
  column-gap: 0.75rem;
  min-width: 0;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.vocab-row:has(.is-open) {
  z-index: 2;
}

.vocab-row:last-child {
  border-bottom: 1px solid var(--border);
}

.vocab-speaker {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  width: auto;
  height: auto;
  aspect-ratio: 1;
  min-height: 3.25rem;
  padding: 0;
  border: 0;
  border-radius: 0.7rem;
  background: var(--surface-muted);
  cursor: pointer;
}

.vocab-speaker--mini {
  align-self: center;
  flex: 0 0 auto;
  width: 2.5rem;
  height: 2.5rem;
  min-height: 0;
  aspect-ratio: auto;
}

.vocab-speaker:disabled {
  opacity: 0.45;
  cursor: default;
}

.vocab-speaker img {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52%;
  height: 52%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  filter: brightness(0);
  opacity: 0.55;
}

.vocab-word {
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

a.vocab-word::after {
  content: "";
  position: absolute;
  inset: 0;
}

.vocab-hebrew {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  color: var(--text);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  unicode-bidi: isolate;
}

.vocab-gloss {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  margin: 0.15rem 0 0;
  min-width: 0;
}

.vocab-rom {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.vocab-en {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.4;
}

.vocab-status {
  position: relative;
  z-index: 1;
  align-self: center;
  justify-self: end;
  width: 9.5rem;
}

.vocab-status__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
  min-height: 2.6rem;
  padding: 0.5rem 0.75rem 0.5rem 1rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.vocab-status__btn span:nth-child(2) {
  flex: 1;
  text-align: left;
}

.vocab-status__dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--status-new-line);
  flex-shrink: 0;
}

.vocab-status__dot[data-status="learning"] {
  background: var(--status-recognized-line);
}

.vocab-status__dot[data-status="known"] {
  background: var(--primary);
}

.vocab-menu--status {
  left: auto;
  right: 0;
  min-width: 11rem;
}

.vocab-empty {
  margin: 2rem 0 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
}

.vocab-empty p {
  margin: 0;
}

.vocab-back {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.vocab-word-head {
  cursor: default;
  border-top: 0;
  padding-top: 0;
}

.vocab-word-head .vocab-hebrew {
  font-size: 2.5rem;
}

.vocab-forms {
  display: flex;
  flex-direction: column;
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.vocab-forms__label {
  margin: 0 0 1.35rem;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}

.vocab-form {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}

.vocab-form:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.vocab-form__card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.vocab-form__lead {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  column-gap: 0.75rem;
  min-width: 0;
}

.vocab-form__lines {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.12rem;
  min-width: 0;
}

.vocab-form__hebrew {
  width: fit-content;
  max-width: 100%;
  margin: 0;
  color: var(--text);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
  unicode-bidi: isolate;
}

.vocab-form__rom,
.vocab-form__en {
  margin: 0;
  line-height: 1.4;
}

.vocab-form__rom {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.vocab-form__en {
  color: var(--text);
  font-size: 1rem;
}

.vocab-pealim {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 0.45rem;
  width: auto;
  margin-top: 0.7rem;
  padding: 0.45rem 0.9rem;
  border: 0;
  border-radius: 0.7rem;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.vocab-pealim img {
  width: 1.35rem;
  height: 1.35rem;
  object-fit: contain;
}

.vocab-excerpt-slot {
  display: grid;
  grid-template-rows: 1fr;
  margin-top: 0.85rem;
}

.vocab-excerpt {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  grid-area: 1 / 1;
  min-width: 0;
  height: 100%;
  padding: 0.9rem 1rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--surface);
}

.vocab-excerpt[inert] {
  visibility: hidden;
  pointer-events: none;
}

.vocab-story {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
  min-height: 4.75rem;
  color: #1B6CA8;
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.25;
  text-decoration: none;
}

.vocab-story img,
.vocab-story__cover {
  width: 7.5rem;
  height: 4.75rem;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 0.5rem;
  background: var(--surface-muted);
}

.vocab-sentence {
  --reader-size: 1.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "line play"
    "english play-gap";
  column-gap: 0.35rem;
  row-gap: 0.75rem;
  align-items: start;
  min-width: 0;
}

.vocab-sentence__play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  grid-area: play;
  width: 2.5rem;
  height: 2.5rem;
  margin-top: calc(0.26rem + var(--reader-size) * 0.48 * 1.2);
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.vocab-sentence__play svg {
  width: 1.15rem;
  height: 1.15rem;
}

.vocab-sentence__play:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.vocab-sentence__line {
  grid-area: line;
  color: var(--text);
  min-width: 0;
  margin: 0;
  font-family: "Rubik", sans-serif;
  direction: rtl;
  text-align: right;
  line-height: 1.6;
}

.vocab-sentence__line .reader__token {
  border: 0;
  background: var(--surface-muted);
  color: inherit;
  font: inherit;
}

.vocab-sentence__line .reader__token[data-gender]::after {
  display: none;
}

.vocab-sentence__line .reader__token.is-marked[data-status="new"] {
  background: var(--status-new-fill);
}

.vocab-sentence__line .reader__token.is-marked[data-status="learning"] {
  background: var(--status-recognized-fill);
}

.vocab-sentence__line .reader__token.is-marked[data-status="known"] {
  background: var(--status-learned-fill);
}

.vocab-english {
  grid-area: english;
  min-width: 0;
  margin: 0;
  direction: ltr;
  text-align: left;
  text-wrap: pretty;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
}

.vocab-english .is-highlighted {
  border-radius: 0.2rem;
  background-color: rgba(255, 200, 0, 0.3);
  color: var(--text);
}

.vocab-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0;
}

.vocab-pages button {
  min-height: 2.1rem;
  padding: 0.35rem 0.75rem;
  border: 0;
  border-radius: 0.5rem;
  background: var(--surface-muted);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.vocab-pages button:disabled {
  background: var(--surface-muted);
  color: var(--text-disabled);
  cursor: default;
}

.vocab-pages span {
  padding: 0 0.35rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.vocab-empty button {
  margin-top: 0.6rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

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

@media (max-width: 720px) {
  .vocab-filters {
    gap: 0.35rem;
  }

  .vocab-pill {
    height: 2.35rem;
    padding: 0 0.3rem;
    font-size: 0.72rem;
  }

  .vocab-status__btn {
    min-width: 0;
  }
}

/* Press and hover for clickable chrome. The scale is visual only, so the
   row around a control does not reflow. Hover darkens whatever colour is
   already there, without painting a new background. Reader words, the story
   player, and the 1/2/3/delete marks keep the hover they already have. */
button,
a[href],
label {
  -webkit-tap-highlight-color: transparent;
  transform: scale(1);
  transform-origin: center;
  filter: brightness(1);
  transition:
    transform 180ms cubic-bezier(0.2, 0, 0, 1),
    filter 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

button:not(.reader__token):not(.story-search):active,
a[href]:not(.reader__token):not(.vocab-word):not(.vocab-story):active,
label:not(.reader__token):not(.story-search):not(.vocab-search):not(.reader__toggle):active {
  transform: scale(0.96);
}

@media (hover: hover) and (pointer: fine) {
  button:not(.reader__token):not(.reader-float__status):not(.reader-audio__play):not(.reader-float__action):not(.reader-float__speaker):not(.pub-home-language):hover,
  a[href]:not(.reader__token):not(.nav-item):not(.reader-float__action):not(.pub-home-language):hover,
  label:not(.reader__token):not(.story-search):not(.vocab-search):hover {
    filter: brightness(0.92);
  }
}

@media (prefers-reduced-motion: reduce) {
  button,
  a[href],
  label,
  .reader-float__speaker,
  .vocab-row {
    transition: none;
  }
}

/* Shared public/portal reader surfaces and brand audio colours. */
.reader:not(.reader--demo) .reader-float__box,
.reader:not(.reader--demo) .reader-audio { background: var(--surface-muted); border-radius: 24px; }
.reader:not(.reader--demo) .reader-float__box > img,
.reader:not(.reader--demo) .reader-audio__body { display: none; }
.reader-float__speaker-icon { display: block; width: 100%; height: 100%; background: var(--primary); mask: url('/speaker.png') center / contain no-repeat; -webkit-mask: url('/speaker.png') center / contain no-repeat; }
.reader-audio__glyph { color: var(--primary); }
.reader-audio__speaker { background-color: var(--primary); }
.reader:not(.reader--demo) .reader__sentence { padding: 8px 60px 4px 0; }
.reader:not(.reader--demo) .reader__sentence-play { left: auto; right: 0; top: 8px; width: 52px; height: 52px; color: var(--primary); }
.reader--portal { max-width: 82rem; }
.reader--portal .reader__stage { grid-template-columns: minmax(0, 1fr) minmax(20rem, 25rem); gap: 2rem; }
.reader--portal .reader__hebrew { max-width: none; border: 1px solid var(--border); border-radius: 12px; padding: 32px; }
.reader--portal .reader-float { width: 100%; }
.reader--portal .reader__intro--compact { width: 100vw; margin: 0 calc(50% - 50vw) 48px; padding: 40px 24px; background: var(--reader-intro); border-radius: 0; }
.reader--portal .reader__intro--compact::after { display: none; }
.reader--portal .reader__intro-inner { display: grid; grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: auto auto auto 1fr; gap: 14px 36px; padding: 0; max-width: 79rem; }
.reader--portal .reader-back { grid-column: 1 / -1; justify-self: start; margin: 0 0 8px; }
.reader--portal .reader__intro h1 { grid-column: 2; margin: 0; }
.reader--portal .reader__image { grid-column: 1; grid-row: 2 / span 3; width: 320px; height: 240px; margin: 0; object-fit: cover; }
.reader--portal .reader__level, .reader--portal .reader__blurb { grid-column: 2; margin: 0; }
.reader--portal .reader__intro-inner:not(:has(.reader__image)) { grid-template-columns: minmax(0, 1fr); }
.reader--portal .reader__intro-inner:not(:has(.reader__image)) > * { grid-column: 1; }
@media (max-width: 1000px) {
  .reader--portal .reader__stage { grid-template-columns: minmax(0, 1fr) 20rem; gap: 24px; }
  .reader--portal .reader__hebrew { padding: 20px; }
}
@media (max-width: 760px) {
  .reader--portal .reader__stage { grid-template-columns: minmax(0, 1fr); }
  .reader--portal .reader-float { position: static; width: min(100%, 28rem); }
  .reader--portal .reader__hebrew { padding: 16px; }
  .reader--portal .reader__intro--compact { padding: 24px; }
  .reader--portal .reader__intro-inner { grid-template-columns: minmax(0, 1fr); }
  .reader--portal .reader__intro h1, .reader--portal .reader__image, .reader--portal .reader__level, .reader--portal .reader__blurb { grid-column: 1; grid-row: auto; }
  .reader--portal .reader__image { width: 100%; height: auto; }
}

/* Rounded panels no longer need the old blob's optical offset. */
.reader:not(.reader--demo) .reader-float__actions { transform: none; }
.reader:not(.reader--demo) .reader-float__card { padding-inline: 2.15rem; }
@media (max-width: 700px) {
  .reader:not(.reader--demo) .reader-float__card { padding-inline: 22px; }
}

.reader .reader__sentence-play { border-radius: 14px; transition: background-color 140ms ease, transform 140ms ease; }
.reader .reader__sentence-play:hover { background: var(--primary-wash); }
.reader .reader__sentence-play:active { transform: scale(.94); }
.reader .reader__sentence-play svg { width: 28px; height: 28px; }
.reader__sentence-icon-play, .reader__sentence-icon-stop { transform-origin: 12px 12px; transition: opacity 140ms ease, transform 140ms ease; }
.reader__sentence-icon-stop { opacity: 0; transform: scale(.65) rotate(-15deg); }
.is-playing .reader__sentence-icon-play { opacity: 0; transform: scale(.65) rotate(15deg); }
.is-playing .reader__sentence-icon-stop { opacity: 1; transform: scale(1) rotate(0); }
@media (prefers-reduced-motion: reduce) {
  .reader .reader__sentence-play, .reader__sentence-icon-play, .reader__sentence-icon-stop { transition: none; }
}

/* Reserve the play gutter only when a sentence actually has a control. */
.reader:not(.reader--demo) .reader__sentence.reader__sentence--no-audio { padding-right: 0; }
.reader__hebrew { overflow-anchor: none; }
.reader-float__hebrew { min-height: 1.3em; }
.reader--locked .reader__sentence .reader__line,
.reader--locked .reader__sentence .reader__english-slot { filter: blur(var(--premium-blur)); user-select: none; pointer-events: none; }
.reader--locked [data-premium-control] { opacity: .45; cursor: not-allowed; }
.reader--locked .reader__sentence { margin-top: 24px; }
.reader--locked .reader__sentence:first-child { margin-top: 0; }
.reader--locked .reader-float__vocab-slot { display: none; }
.premium-reader-gate { padding: 36px 8px 16px; text-align: center; }
.premium-reader-gate h2 { font: 700 30px/1.2 var(--font-display); margin: 0 0 14px; }
.premium-reader-gate p { font: 600 17px/1.6 var(--font-sans); margin: 0 auto 24px; max-width: 440px; }
.premium-button { display: flex; align-items: center; justify-content: center; width: 100%; max-width: 380px; min-height: 56px; margin: 24px auto 0; padding: 14px 24px; border: 0; border-radius: 26px 23px 30px 20px / 24px 28px 20px 26px; background: var(--primary); color: #fff; font: 800 17px/1.4 var(--font-sans); text-decoration: none; cursor: pointer; }
.premium-button:disabled { opacity: .6; cursor: wait; }
.premium-tooltip { position: fixed; z-index: 10000; width: 300px; max-width: calc(100vw - 24px); padding: 12px 16px; border-radius: 12px; background: #3d4633; color: white; font: 600 14px/1.5 var(--font-sans); pointer-events: none; box-shadow: 0 4px 18px #20251f20; }
.premium-mobile-notice { width: min(420px, calc(100% - 32px)); margin: auto; padding: 48px 24px 28px; border: 1px solid var(--border); border-radius: 24px; color: var(--text); background: var(--bg); font: 600 17px/1.6 var(--font-sans); }
.premium-mobile-notice::backdrop { background: #20251f66; }
.premium-notice-close { position: absolute; right: 16px; top: 12px; border: 0; background: transparent; color: var(--text); font-size: 26px; }
.sidebar-upgrade { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 12px 18px 22px; padding: 14px 20px; border-radius: 26px 23px 30px 20px; color: var(--text); background: var(--primary-wash); font-weight: 800; text-decoration: none; }
.premium-page { max-width: 700px; margin: 0 auto; padding: 80px 24px 100px; color: var(--text); font-family: var(--font-sans); }
.premium-page__close { position: fixed; top: 20px; left: 20px; z-index: 10; display: grid; place-items: center; width: 44px; height: 44px; background: var(--surface-muted); border-radius: 50%; color: var(--text); text-decoration: none; font-size: 26px; }
.premium-page h1, .premium-page h2 { font-family: var(--font-display); line-height: 1.2; }
.premium-page h1 { font-size: clamp(30px, 5vw, 40px); margin: 24px auto 32px; max-width: 560px; }
.premium-page h2 { font-size: 30px; }
.premium-page__hero, .premium-library-heading { text-align: center; }
.premium-avatar { display: grid; place-items: center; width: 72px; height: 72px; margin: auto; border-radius: 50%; background: var(--primary-wash); color: #3d4633; font: 700 32px var(--font-display); }
.premium-carousel { overflow: hidden; padding: 16px 0; mask-image: linear-gradient(to right, transparent, #000 8%, #000 92%, transparent); }
.premium-carousel__track { display: flex; width: max-content; animation: premium-covers 45s linear infinite; }
.premium-carousel__group { display: flex; gap: 14px; padding-right: 14px; }
.premium-carousel img { width: 135px; height: 180px; object-fit: cover; border-radius: 14px; }
.premium-library-heading { margin: 20px 0 28px; font-size: 24px !important; }
.premium-offer { max-width: 480px; margin: auto; padding: 28px; background: var(--surface-muted); border-radius: 24px; text-align: center; }
.premium-plan-toggle { display: flex; padding: 4px; border-radius: 999px; background: var(--surface, #fff); }
.premium-plan-toggle button { flex: 1; border: 0; padding: 14px 8px; background: transparent; color: var(--text); border-radius: 999px; font: 700 15px var(--font-sans); cursor: pointer; }
.premium-plan-toggle button[aria-pressed='true'] { background: #3d4633; color: white; }
.premium-plan-toggle small { display: inline-block; margin-left: 4px; border-radius: 20px; padding: 4px 6px; background: var(--primary-wash); color: var(--text); font-size: 10px; }
.premium-price { font-size: 64px; line-height: 1; font-weight: 800; margin: 36px 0 16px; }
.premium-price span { font-size: 17px; font-weight: 600; }
.premium-fineprint { font-size: 13px; margin: 14px 0 0; }
.premium-error { color: #9c3832; }
.premium-proof { margin-top: 80px; }
.premium-proof__intro { font-size: 18px; line-height: 1.65; }
.premium-proof article { display: grid; grid-template-columns: 105px 1fr; gap: 24px; padding: 28px 0; border-bottom: 1px solid var(--border); }
.premium-stat { color: #3d4633; font: 700 36px var(--font-display); }
.premium-proof h3 { margin: 0 0 10px; font-size: 18px; }
.premium-proof p, .premium-faq p { line-height: 1.65; }
.premium-proof a { color: var(--text-muted); font-size: 13px; }
.premium-faq { margin-top: 64px; }
.premium-faq details { border-bottom: 1px solid var(--border); padding: 20px 0; }
.premium-faq summary { font-weight: 800; cursor: pointer; }
@keyframes premium-covers { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .premium-carousel__track { animation: none; } }
@media (max-width: 480px) { .premium-proof article { grid-template-columns: 1fr; gap: 10px; } .premium-offer { padding: 20px; } }
.premium-avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.reader-float__hebrew { --definition-font-max: 3.75; }
.reader-float__hebrew .reader__word { font-size: inherit; line-height: inherit; }
.reader-float__hebrew .reader__word-face { font-family: inherit; }
@media (max-width: 700px) { .reader-float__hebrew { --definition-font-max: 2.25; } }
/* Keep Pealim in the full-width column when the hidden Vocab slot is removed. */
.reader--locked .reader-float__links { grid-template-columns: 1fr; gap: 0; }
.reader--locked .reader-float__pealim { grid-column: 1; width: 100%; }
.premium-page { max-width: 620px; }
.premium-page__hero h1, .premium-offer, .premium-proof, .premium-faq, .premium-carousel { max-width: none; width: 100%; box-sizing: border-box; }
.library-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.library-section-heading h2 { margin: 0; }
.library-section-heading a { color: var(--text); font-weight: 700; }
.library--no-continue { padding-top: 110px; }
.story-dropdown__btn.is-selected { background: var(--primary); color: white; }
.continue-page { gap: 24px; }
.continue-page > a { color: var(--text); width: fit-content; }
.continue-page h1 { font-family: var(--font-display); margin: 0; }
.continue-tools { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 24px; }
.continue-tools button { padding: 12px 20px; border: none; border-radius: 24px; background: var(--primary); color: white; font-weight: 800; cursor: pointer; }
.continue-tools button:disabled { background: var(--surface-muted); color: var(--text-muted); cursor: default; }
.continue-select-card { position: relative; }
.continue-select-card > label { position: absolute; top: 10px; left: 10px; z-index: 2; cursor: pointer; }
/* Native inputs retain keyboard and screen-reader behaviour; the face is shared. */
.continue-select-all { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; font-weight: 600; }
.continue-checkbox { position: relative; display: inline-grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; vertical-align: middle; }
.continue-checkbox input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.continue-checkbox__face { display: grid; place-items: center; width: 28px; height: 28px; box-sizing: border-box; border: 1.5px solid #a6aaa1; border-radius: 8px; background: var(--surface); color: white; transition: background 140ms ease, border-color 140ms ease; }
.continue-checkbox__face svg { width: 20px; height: 20px; opacity: 0; }
.continue-checkbox input:checked + .continue-checkbox__face,
.continue-checkbox input:indeterminate + .continue-checkbox__face { background: var(--primary); border-color: var(--primary); }
.continue-checkbox input:checked + .continue-checkbox__face svg,
.continue-checkbox input:indeterminate + .continue-checkbox__face svg { opacity: 1; }
.continue-checkbox input:focus-visible + .continue-checkbox__face { outline: 2px solid var(--text); outline-offset: 3px; }
.continue-checkbox input:disabled { cursor: default; }
.continue-checkbox input:disabled + .continue-checkbox__face { opacity: .55; }
.continue-select-card > label .continue-checkbox__face { box-shadow: 0 1px 5px rgb(0 0 0 / 12%); }
.continue-select-card.is-selected > .story-card { box-shadow: 0 0 0 2px var(--primary); }
@media (hover: hover) { .continue-checkbox input:not(:disabled):hover + .continue-checkbox__face { border-color: var(--primary); } }
.reader-completion { padding: 32px 0 16px; text-align: center; }
.story-complete { position: fixed; inset: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; border: none; margin: 0; padding: 60px 24px; overflow-y: auto; background: var(--bg); color: var(--text); font-family: var(--font-sans); }
.story-complete__content { max-width: 650px; margin: auto; text-align: center; }
.story-complete h1, .story-complete h2 { font-family: var(--font-display); }
.story-complete h1 { font-size: 38px; }
.story-complete__mascot { width: 110px; height: 140px; object-fit: contain; }
.story-complete__close { position: fixed; top: 16px; right: 20px; border: none; background: var(--surface-muted); border-radius: 50%; width: 44px; height: 44px; font-size: 26px; color: var(--text); }
.story-complete__suggestions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.story-complete__suggestions a { display: block; text-decoration: none; padding: 8px; border: 2px solid transparent; border-radius: 16px; background: var(--surface-muted); text-align: left; color: var(--text); cursor: pointer; }
.story-complete__suggestions button[aria-pressed='true'] { border-color: var(--primary); background: var(--primary-wash); }
.story-complete__suggestions img { display: block; width: 100%; height: 110px; object-fit: cover; border-radius: 10px; }
.story-complete__suggestions span, .story-complete__suggestions small { display: block; margin-top: 8px; }
.story-complete__suggestions span { font-weight: 800; }
.story-complete__home { display: inline-block; margin-top: 24px; color: var(--text); }
@media (max-width: 500px) { .story-complete__suggestions { gap: 8px; } .story-complete { padding-inline: 16px; } .story-complete__suggestions span { font-size: 14px; } }
.account-billing p { line-height: 1.6; margin: 10px 0; }
.account-billing .premium-button { margin: 18px 0 0; width: fit-content; }
.account-billing__manage { display: inline-block; padding: 12px 20px; border: 1px solid var(--border); border-radius: 24px; background: var(--surface-muted); color: var(--text); font-weight: 700; margin-top: 16px; cursor: pointer; }
.billing-confirmation { max-width: 560px; margin: 80px auto; padding: 24px; text-align: center; color: var(--text); }
.billing-confirmation > img { width: 120px; height: 150px; object-fit: contain; }
.billing-confirmation h1 { font-family: var(--font-display); }
.billing-confirmation p { line-height: 1.65; }
.billing-confirmation > a:last-child { display: inline-block; margin-top: 24px; color: var(--text); }
.reader__token-unit { display: inline-flex; align-items: baseline; white-space: nowrap; direction: rtl; unicode-bidi: isolate; }
.reader__token-unit .reader__punct { font-size: var(--reader-size); margin: 0; }
.reader__foreign { display: inline; direction: ltr; unicode-bidi: isolate; font-size: var(--reader-size); margin-inline: .18rem; white-space: normal; }
.premium-offer .premium-button { max-width: none; }

/* Completion keeps recommendations above the persistent library action. */
.story-complete { padding: 24px 24px 120px; }
.story-complete__content { max-width: 560px; }
.story-complete__mascot { width: 72px; height: 90px; }
.story-complete h1 { font-size: 30px; margin: 8px 0; }
.story-complete h2 { font-size: 22px; margin: 12px 0 20px; }
.story-complete__suggestions a:hover { background: var(--surface-hover); }
.story-complete__suggestions a:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.story-complete__footer { position: fixed; bottom: 0; left: 0; right: 0; background: var(--bg); border-top: 1px solid var(--border); padding: 16px 24px max(16px, env(safe-area-inset-bottom)); }
.story-complete__footer .premium-button { width: 100%; max-width: 560px; margin: 0 auto; box-sizing: border-box; }
.premium-stat--levels { font-size: 28px; white-space: nowrap; }

.continue-lead--compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.story-card__title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; min-height: 2.5em; max-height: 2.5em; overflow-wrap: anywhere; }
.story-card__meta { min-height: 2.8em; max-height: 2.8em; line-height: 1.4; overflow: hidden; }
.story-card__desc { height: 4.2em; }
.story-card__image { flex-shrink: 0; }
.empty-clear { border: 0; background: none; color: var(--text); font: inherit; text-decoration: underline; cursor: pointer; margin-top: 12px; }
@media (max-width: 700px) { .continue-lead--compact { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.vocab-guide { margin: 32px auto; max-width: 500px; text-align: center; }
.vocab-guide__mascot { width: 110px; height: 100px; object-fit: contain; }
.vocab-guide h2 { margin: 8px 0 0; font-size: 22px; }
.vocab-guide__demo { width: 100%; max-width: 420px; margin: 48px auto 32px; }
.vocab-guide__demo > svg { display: block; width: 100%; height: auto; }
.vocab-guide__card { box-sizing: border-box; height: 100%; border: 1px solid var(--border); border-radius: 24px; padding: 20px; background: var(--surface-muted); text-align: left; }
.vocab-guide__word { font-family: "Rubik", sans-serif; font-size: 42px; line-height: 1.2; }
.vocab-guide__card p { margin: 4px 0; }
.vocab-guide__save { margin-top: 16px; width: 100%; border-radius: 24px 28px 22px 26px; padding: 12px; color: white; background: var(--primary); text-align: center; font-weight: 700; }
.vocab-guide__choices { display: flex; justify-content: center; gap: 12px; }
.vocab-guide__copy { text-align: left; font-weight: 400; line-height: 1.65; }
.vocab-guide__copy h3 { font-size: 19px; margin: 0 0 8px; }
.vocab-guide__copy ul { padding-left: 22px; margin: 12px 0; }
.vocab-guide__copy li { margin: 6px 0; }

.vocab-guide__choices .reader-float__status { flex: 0 0 80px; width: 80px; height: 80px; pointer-events: none; }
.vocab-guide__demo .meaning-pointer { pointer-events: none; }
.vocab-guide__demo.is-static .meaning-pointer { opacity: 0 !important; }

.vocab-guide--after-list { margin-top: 72px; }
.vocab-guide__copy p { margin: 14px 0; }
.vocab-guide__save { box-sizing: border-box; }
.reader-save-help { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.vocab-tutorial-trigger { background: none; border: 0; padding: 6px 0; color: var(--text); font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.vocab-tutorial-modal { width: min(620px, calc(100% - 32px)); max-height: calc(100dvh - 48px); box-sizing: border-box; padding: 24px; border: 1px solid var(--border); border-radius: 24px; background: var(--bg); color: var(--text); font-family: var(--font-sans); overscroll-behavior: contain; }
.vocab-tutorial-modal::backdrop { background: rgb(32 37 31 / 45%); }
.vocab-tutorial-modal > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.vocab-tutorial-modal h2 { margin: 0; font-size: 24px; }
.vocab-tutorial-modal > header button { flex-shrink: 0; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--surface-muted); color: var(--text); font-size: 26px; cursor: pointer; }
.vocab-tutorial-modal .vocab-guide { margin: 0 auto; }
.vocab-tutorial-modal .vocab-guide__demo { margin-top: 16px; }
.vocab-guide__tip { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.vocab-guide__tip h4 { margin: 0; font-size: 16px; }
.vocab-guide kbd { display: inline-block; padding: 1px 7px; border: 1px solid var(--border); border-bottom-width: 3px; border-radius: 6px; background: var(--surface-muted); font: 600 13px var(--font-sans); line-height: 1.5; white-space: nowrap; }
@media (max-width: 600px) { .vocab-tutorial-modal { inset: 0; margin: 0; width: 100%; max-width: none; height: 100dvh; max-height: none; border: 0; border-radius: 0; padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); } }
.continue-tools__actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.continue-tools .continue-remove:not(:disabled) { background: #b5584f; color: white; }
.brand-confirm { box-sizing: border-box; width: min(480px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 28px; border: 1px solid var(--border); border-radius: 24px; color: var(--text); background: var(--bg); font-family: var(--font-sans); }
.brand-confirm::backdrop { background: rgb(32 37 31 / 45%); }
.brand-confirm h2 { font-family: var(--font-display); font-size: 26px; line-height: 1.25; margin: 0 0 16px; }
.brand-confirm p { line-height: 1.6; margin: 0 0 24px; }
.brand-confirm__actions { display: flex; gap: 12px; }
.brand-confirm__actions button { flex: 1; padding: 14px 16px; border-radius: 25px 29px 23px 27px; font: 700 14px var(--font-sans); cursor: pointer; }
.brand-confirm__cancel { background: var(--surface-muted); color: var(--text); border: 1px solid var(--border); }
.brand-confirm__confirm { border: 1px solid transparent; background: var(--primary); color: white; }
.brand-confirm__confirm.is-danger { background: #b5584f; }
.brand-confirm__actions button:disabled { opacity: .6; cursor: wait; }
.brand-confirm__actions button:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.brand-confirm__error { color: #a34038; }
@media (max-width: 600px) { .continue-tools { flex-wrap: wrap; } .continue-tools__actions { width: 100%; } .continue-tools__actions button { flex: 1; } .brand-confirm { padding: 24px; } .brand-confirm__actions { flex-direction: column-reverse; } }

/* Both bulk confirmations retain the same dimensions as their wording changes. */
.brand-confirm h2 { min-height: 2.5em; }
.brand-confirm #confirm-description { min-height: 4.8em; }
.brand-confirm__actions button { min-width: 0; min-height: 64px; }

.continue-tools__actions button, .brand-confirm__actions button { white-space: nowrap; }
.brand-confirm__cancel { flex: 0 0 auto !important; }
.brand-confirm__confirm { flex: 1 0 auto !important; }
@media (max-width: 600px) {
  .continue-tools__actions { display: grid; grid-template-columns: 1fr; }
  .brand-confirm__actions button { flex: none !important; width: 100%; }
}

.continue-page--empty { min-height: 100dvh; box-sizing: border-box; }
.continue-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 0 80px; }
.continue-empty > img { width: 125px; height: 160px; object-fit: contain; margin-bottom: 24px; }
.continue-empty h2 { margin: 0 0 12px; font-size: 24px; }
.continue-empty p { margin: 0; color: var(--text-muted); }
.continue-empty .premium-button { width: auto; min-width: 180px; margin-top: 24px; }
@media (max-width: 700px) { .continue-page--empty { min-height: calc(100dvh - 100px); } }

.reader__speaker-label {
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--primary);
}
