:root {
  color-scheme: light;
  --bg-top: #eef4fb;
  --bg-bottom: #d9e6f5;
  --panel: rgba(249, 251, 255, 0.84);
  --panel-strong: rgba(255, 255, 255, 0.96);
  --line: rgba(27, 50, 79, 0.1);
  --line-strong: rgba(27, 50, 79, 0.18);
  --ink: #17263a;
  --muted: #63748a;
  --accent: #153b67;
  --accent-soft: rgba(21, 59, 103, 0.08);
  --gold: #efc14e;
  --shadow-lg: 0 24px 52px rgba(28, 57, 92, 0.12);
  --shadow-md: 0 8px 22px rgba(28, 57, 92, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  min-height: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.74), transparent 30%),
    radial-gradient(circle at bottom left, rgba(255, 226, 130, 0.18), transparent 28%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

body.platform-android {
  background: linear-gradient(180deg, #eef4fb 0%, #d9e6f5 100%);
}

button {
  font: inherit;
  cursor: pointer;
}

.background {
  position: fixed;
  pointer-events: none;
  filter: blur(20px);
  z-index: 0;
}

.background-top {
  top: -5rem;
  left: -5rem;
  width: 15rem;
  height: 15rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
}

.background-bottom {
  right: -3rem;
  bottom: -3rem;
  width: 12rem;
  height: 12rem;
  border-radius: 50%;
  background: rgba(239, 193, 78, 0.14);
}

body.platform-android .background {
  display: none;
}

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.15rem;
  padding: 1rem;
}

.site-footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding: 0 1rem 1.1rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}

.site-footer a:hover {
  color: var(--accent);
}

.hero-panel,
.saved-drawer {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
}

body.platform-android .hero-panel,
body.platform-android .saved-drawer {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(249, 251, 255, 0.98);
}

.hero-panel {
  border-radius: var(--radius-xl);
  padding: 1rem;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 1.2rem;
  min-height: 0;
}

.hero-header {
  display: grid;
  gap: 1rem;
  padding: 0.35rem 0.35rem 0;
  position: relative;
}

.brand-lockup {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.9rem;
  padding: 0.34rem 0.72rem 0.34rem 0.34rem;
  width: fit-content;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-md);
}

.brand-copy {
  min-width: 0;
}

.mascot-badge {
  display: grid;
  place-items: center;
  width: 3.9rem;
  height: 3.2rem;
  flex-shrink: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.brand-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0;
}

.eyebrow {
  margin: 0 0 0.18rem;
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(99, 116, 138, 0.86);
}

h1,
h2 {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(1.45rem, 4vw, 2.25rem);
  text-wrap: balance;
}

h2 {
  font-size: 1.35rem;
}

.header-actions {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.mobile-language {
  display: none;
  position: relative;
  z-index: 5;
}

.mobile-language-toggle {
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 1px solid rgba(27, 50, 79, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 16px rgba(28, 57, 92, 0.06);
}

.mobile-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
}

.mobile-language-menu {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  min-width: 11rem;
  padding: 0.4rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(27, 50, 79, 0.08);
  box-shadow: 0 18px 38px rgba(28, 57, 92, 0.14);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    visibility 160ms ease;
  z-index: 20;
}

.mobile-language-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mobile-language-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.8rem;
  border: 0;
  border-radius: 0.8rem;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.mobile-language-option.is-active {
  background: rgba(21, 59, 103, 0.08);
}

.mobile-language-emoji {
  font-size: 1.05rem;
  line-height: 1;
}

.language-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.language-pill,
.saved-toggle,
.action-button,
.ghost-button,
.saved-item-actions button {
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.language-pill,
.saved-toggle,
.ghost-button,
.saved-item-actions button {
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(28, 57, 92, 0.05);
}

body.platform-android .brand-lockup,
body.platform-android .saved-toggle,
body.platform-android .action-button,
body.platform-android .ghost-button,
body.platform-android .saved-item-actions button {
  box-shadow: 0 2px 8px rgba(28, 57, 92, 0.04);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.platform-android .phrase-stage,
body.platform-android .phrase-card,
body.platform-android .phrase-card-inner,
body.platform-android .phrase-face,
body.platform-android .primary-actions,
body.platform-android .saved-toggle,
body.platform-android .action-button {
  filter: none !important;
  transform: none !important;
  animation: none !important;
  transition: none !important;
  isolation: isolate;
}

body.platform-android .phrase-face,
body.platform-android .phrase-face-front,
body.platform-android .phrase-face-back,
body.platform-android .saved-toggle,
body.platform-android .action-button,
body.platform-android .button-dot {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.language-pill,
.saved-toggle {
  min-height: 3rem;
  padding: 0.72rem 1.05rem;
  font-size: 0.96rem;
  font-weight: 600;
}

.language-pill.is-active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 16px 30px rgba(21, 59, 103, 0.22);
}

.saved-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  justify-content: center;
}

.saved-toggle span:last-child {
  display: inline-flex;
}

.button-dot {
  display: inline-flex;
  min-width: 1.65rem;
  min-height: 1.65rem;
  justify-content: center;
  align-items: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border-radius: 50%;
  background: rgba(239, 193, 78, 0.18);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}

.button-dot-icon svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.phrase-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  gap: 0.85rem;
  min-height: 0;
}

.phrase-card {
  position: relative;
  min-height: 29rem;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.phrase-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 29rem;
}

.phrase-card-inner.is-animating {
  animation: card-rise 260ms ease;
}

@keyframes card-rise {
  0% {
    opacity: 0.35;
    transform: translateY(12px) scale(0.99);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.phrase-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.6rem;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 255, 0.96));
  border: 1px solid rgba(27, 50, 79, 0.09);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 12px 32px rgba(28, 57, 92, 0.08);
  overflow: hidden;
  transition:
    opacity 260ms ease,
    transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.phrase-face::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(216, 230, 245, 0.7));
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
}

.phrase-face::after {
  content: "";
  position: absolute;
  right: -2rem;
  bottom: -2rem;
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 193, 78, 0.18), transparent 67%);
}

.phrase-face-back {
  opacity: 0;
  transform: rotateY(-90deg) scale(0.98);
  pointer-events: none;
}

.phrase-face-front {
  opacity: 1;
  transform: rotateY(0deg) scale(1);
}

.phrase-card.is-flipped .phrase-face-front {
  opacity: 0;
  transform: rotateY(90deg) scale(0.98);
  pointer-events: none;
}

.phrase-card.is-flipped .phrase-face-back {
  opacity: 1;
  transform: rotateY(0deg) scale(1);
  pointer-events: auto;
}

.phrase-card-top {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  display: flex;
  justify-content: flex-start;
}

.page-label {
  margin: 0;
  color: #5c6f88;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.phrase-text,
.phrase-meaning {
  position: relative;
  z-index: 1;
  margin: 0;
  text-align: center;
  color: #1f324b;
}

.phrase-text {
  max-width: 12ch;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: clamp(2.35rem, 6vw, 4.9rem);
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.phrase-meaning {
  max-width: 20ch;
  font-size: clamp(1.24rem, 3.7vw, 2.08rem);
  line-height: 1.16;
  letter-spacing: -0.03em;
  font-weight: 560;
  text-wrap: pretty;
}

.card-hint {
  margin: 0;
  text-align: center;
  color: rgba(99, 116, 138, 0.95);
  font-size: 0.96rem;
}

.primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  padding: 0.15rem 0;
}

.action-button,
.ghost-button {
  min-height: 2.95rem;
  padding: 0.68rem 0.95rem;
  font-size: 0.96rem;
  font-weight: 600;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  width: 100%;
  background: var(--panel-strong);
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(28, 57, 92, 0.05);
}

.action-primary {
  background: var(--accent);
  color: #fff;
  border-color: rgba(21, 59, 103, 0.92);
  box-shadow:
    0 10px 20px rgba(21, 59, 103, 0.16),
    0 0 0 3px rgba(239, 193, 78, 0.18);
}

.action-primary .button-dot {
  background: rgba(255, 247, 227, 0.92);
  color: var(--accent);
}

.feedback {
  min-height: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  text-align: center;
  color: rgba(99, 116, 138, 0.95);
  font-weight: 500;
  opacity: 0;
  transition: opacity 180ms ease;
}

.feedback.is-visible,
.drawer-feedback.is-visible {
  opacity: 1;
}

.drawer-feedback {
  display: none;
}

.saved-drawer {
  position: fixed;
  right: 1rem;
  left: 1rem;
  bottom: 1rem;
  z-index: 40;
  max-height: min(74vh, 44rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  border-radius: var(--radius-xl);
  transform: translateY(calc(100% + 2rem));
  opacity: 0;
  visibility: hidden;
  transition:
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 240ms ease,
    visibility 240ms ease;
}

.saved-drawer.is-open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.saved-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.2rem;
  flex-shrink: 0;
}

.saved-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.saved-list {
  list-style: none;
  display: grid;
  gap: 0.85rem;
  padding: 0;
  margin: 0;
  overflow: auto;
  min-height: 0;
}

.saved-item {
  padding: 0.95rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

.saved-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.saved-item-text,
.saved-item-meaning {
  margin: 0;
}

.saved-item-text {
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.35;
  font-weight: 700;
}

.saved-item-meaning {
  margin-top: 0.32rem;
  color: var(--muted);
  line-height: 1.45;
}

.saved-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.saved-item-actions button {
  min-height: 2.4rem;
  padding: 0.55rem 0.86rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.phrase-card:focus-visible,
.mobile-language-toggle:focus-visible,
.mobile-language-option:focus-visible,
.language-pill:focus-visible,
.saved-toggle:focus-visible,
.action-button:focus-visible,
.ghost-button:focus-visible,
.saved-item-actions button:focus-visible {
  outline: 3px solid rgba(239, 193, 78, 0.42);
  outline-offset: 3px;
}

.language-pill:hover,
.saved-toggle:hover,
.action-button:hover,
.ghost-button:hover,
.saved-item-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(28, 57, 92, 0.08);
}

.phrase-card:hover .phrase-card-inner {
  filter: drop-shadow(0 14px 24px rgba(28, 57, 92, 0.08));
}

@media (min-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
    gap: 1rem;
    align-items: start;
  }

  .hero-panel {
    min-height: calc(100vh - 2rem);
    height: calc(100vh - 2rem);
    min-height: calc(100dvh - 2rem);
    height: calc(100dvh - 2rem);
    padding: 0.95rem;
  }

  .hero-header {
    grid-template-columns: auto 1fr;
    align-items: start;
  }

  .phrase-stage {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    gap: 0.75rem;
  }

  .header-actions {
    justify-self: end;
    align-items: flex-end;
  }

  .saved-drawer {
    position: relative;
    inset: auto;
    align-self: start;
    height: calc(100vh - 2rem);
    height: calc(100dvh - 2rem);
    min-height: calc(100vh - 2rem);
    min-height: calc(100dvh - 2rem);
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .saved-drawer-header .ghost-button {
    display: none;
  }

  .phrase-card {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(100dvh - 18rem);
  }

  .phrase-card-inner {
    min-height: 100%;
    height: 100%;
  }

  .phrase-text {
    max-width: 13ch;
  }

  .primary-actions {
    grid-template-columns: repeat(4, minmax(0, max-content));
    justify-content: flex-start;
    gap: 0.55rem;
  }

  .action-button {
    min-height: 2.7rem;
    padding: 0.64rem 0.9rem;
    font-size: 0.92rem;
  }
}

@media (max-width: 640px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow: auto;
  }

  body.drawer-open {
    overflow: hidden;
  }

  body.drawer-open .site-footer {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .app-shell {
    min-height: auto;
    height: auto;
    display: block;
    overflow: visible;
    padding:
      max(2.8rem, calc(env(safe-area-inset-top, 0px) + 1rem))
      0.85rem
      calc(0.85rem + env(safe-area-inset-bottom, 0px));
  }

  .hero-panel {
    display: flex;
    flex-direction: column;
    min-height: auto;
    height: auto;
    overflow: visible;
    gap: 0.8rem;
    padding: 0.85rem;
  }

  .hero-header {
    display: block;
    padding-top: 0;
  }

  .brand-lockup {
    width: calc(100% - 4.65rem);
    min-width: 0;
    gap: 0.7rem;
    padding: 0.28rem 0.82rem 0.34rem 0.28rem;
  }

  .mascot-badge {
    width: 2.95rem;
    height: 2.45rem;
  }

  .eyebrow {
    display: block;
    margin: 0 0 0.18rem;
    font-size: 0.54rem;
    line-height: 1.1;
    letter-spacing: 0.16em;
  }

  h1 {
    font-size: 1.72rem;
    line-height: 0.95;
    letter-spacing: -0.055em;
  }

  .mobile-language {
    display: block;
    position: absolute;
    top: 1.7rem;
    right: 0.25rem;
    transform: translateY(-50%);
  }

  .mobile-language-toggle {
    width: 3.25rem;
    height: 3.25rem;
    min-height: 3.25rem;
    min-width: 3.25rem;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    padding: 0;
  }

  .mobile-flag {
    font-size: 1.15rem;
  }

  .language-switcher {
    display: none;
  }

  .header-actions {
    width: 100%;
  }

  .saved-toggle {
    width: 100%;
    margin-top: 0.55rem;
    min-height: 2.9rem;
  }

  .phrase-stage {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: none;
    overflow: visible;
    gap: 0.62rem;
  }

  .phrase-card,
  .phrase-card-inner {
    flex: none;
    min-height: 24rem;
    height: min(24rem, 47dvh);
  }

  .phrase-face {
    padding: 1.15rem 1.05rem 1.1rem;
    border-radius: 22px;
  }

  .phrase-card-top {
    top: 1.2rem;
    left: 1.2rem;
    right: 1.2rem;
  }

  .page-label {
    font-size: 0.88rem;
  }

  .phrase-text {
    max-width: 11.8ch;
    font-size: clamp(2rem, 11vw, 3.05rem);
  }

  .phrase-meaning {
    max-width: 18ch;
    font-size: clamp(1.08rem, 5vw, 1.48rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
    font-weight: 560;
  }

  .card-hint {
    font-size: 0.88rem;
    padding: 0 0.4rem;
  }

  .primary-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.62rem;
    flex: 0 0 auto;
  }

  .action-button {
    min-height: 2.7rem;
    padding: 0.64rem 0.9rem;
    font-size: 0.92rem;
  }

  .feedback {
    min-height: 1.2rem;
    height: 1.2rem;
    font-size: 0.92rem;
    margin-bottom: 0.35rem;
  }

  .saved-drawer {
    left: 0.85rem;
    right: 0.85rem;
    top: calc(8.35rem + env(safe-area-inset-top, 0px));
    bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    max-height: none;
    padding: 0.95rem;
    border-radius: 26px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    background: rgba(249, 251, 255, 0.98);
  }

  .saved-drawer-header {
    flex-direction: row;
    align-items: start;
    padding-bottom: 0;
  }

  .saved-list {
    flex: 0 0 auto;
    overflow: visible;
    padding-bottom: 0.25rem;
  }

  .saved-empty {
    flex-shrink: 0;
  }

  .saved-toggle:hover,
  .action-button:hover,
  .ghost-button:hover,
  .saved-item-actions button:hover {
    transform: none;
    box-shadow: 0 6px 16px rgba(28, 57, 92, 0.05);
  }

  body.platform-ios .app-shell {
    padding-top: max(3.3rem, calc(env(safe-area-inset-top, 0px) + 1.45rem));
  }

  body.platform-ios .phrase-stage {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.56rem;
    overflow: hidden;
    flex: 1 1 auto;
  }

  body.platform-ios .phrase-card,
  body.platform-ios .phrase-card {
    flex: 1 1 auto;
    min-height: var(--ios-card-min-height, 22rem);
    max-height: var(--ios-card-max-height, 28rem);
    height: auto;
  }

  body.platform-ios .phrase-card-inner {
    min-height: 100%;
    height: 100%;
    max-height: none;
  }

  body.platform-ios .feedback {
    min-height: 1.2rem;
    height: auto;
    line-height: 1.15;
    margin-bottom: 0;
    flex: 0 0 auto;
  }

  body.platform-ios .site-footer {
    display: none;
  }
}

@media (max-width: 640px) and (max-height: 930px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    min-height: 100dvh;
    height: auto;
    overflow: auto;
    padding:
      max(1.15rem, calc(env(safe-area-inset-top, 0px) + 0.5rem))
      0.75rem
      calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .hero-panel {
    min-height: auto;
    height: auto;
    overflow: visible;
    gap: 0.72rem;
    padding: 0.78rem;
  }

  .brand-lockup {
    gap: 0.62rem;
    padding: 0.28rem 0.68rem 0.28rem 0.28rem;
  }

  .mascot-badge {
    width: 2.55rem;
    height: 2.55rem;
  }

  h1 {
    font-size: 1.72rem;
  }

  .saved-toggle {
    margin-top: 0.55rem;
    min-height: 2.72rem;
  }

  .phrase-stage {
    overflow: visible;
    gap: 0.5rem;
    flex: none;
  }

  .phrase-card,
  .phrase-card-inner {
    flex: none;
    min-height: 24rem;
    height: min(24rem, 47dvh);
  }

  .phrase-face {
    padding: 1rem;
    border-radius: 20px;
  }

  .phrase-card-top {
    top: 1rem;
    left: 1rem;
    right: 1rem;
  }

  .page-label {
    font-size: 0.82rem;
  }

  .phrase-text {
    max-width: 10.5ch;
    font-size: clamp(1.7rem, 8.8vw, 2.65rem);
  }

  .phrase-meaning {
    max-width: 18ch;
    font-size: clamp(1rem, 4.65vw, 1.32rem);
    line-height: 1.14;
  }

  .card-hint {
    font-size: 0.84rem;
  }

  .primary-actions {
    gap: 0.55rem;
    padding: 0;
  }

  .action-button {
    min-height: 2.5rem;
    padding: 0.58rem 0.8rem;
    font-size: 0.88rem;
  }

  .button-dot {
    min-width: 1.5rem;
    min-height: 1.5rem;
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.82rem;
  }

  .feedback {
    min-height: 1rem;
    height: 1rem;
    font-size: 0.82rem;
    margin-bottom: 0;
  }

  .saved-drawer {
    top: calc(7.8rem + env(safe-area-inset-top, 0px));
  }

  .saved-item {
    padding: 0.85rem;
  }

  .saved-item-text {
    font-size: 0.98rem;
  }

  .saved-item-meaning {
    font-size: 0.9rem;
  }

  .saved-item-actions button {
    min-height: 2.2rem;
    padding: 0.46rem 0.74rem;
    font-size: 0.8rem;
  }

  body.platform-ios,
  body.platform-ios.drawer-open {
    overflow: hidden;
  }

  body.platform-ios .app-shell {
    min-height: var(--ios-viewport-height, 100dvh);
    height: var(--ios-viewport-height, 100dvh);
    overflow: hidden;
    padding:
      max(3rem, calc(env(safe-area-inset-top, 0px) + 1.2rem))
      0.75rem
      calc(0.55rem + env(safe-area-inset-bottom, 0px));
  }

  body.platform-ios .hero-panel {
    min-height: calc(var(--ios-viewport-height, 100dvh) - 1.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    height: calc(var(--ios-viewport-height, 100dvh) - 1.5rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow: hidden;
  }

  body.platform-ios .phrase-stage {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.5rem;
    overflow: hidden;
    flex: 1 1 auto;
  }

  body.platform-ios .phrase-card,
  body.platform-ios .phrase-card {
    flex: 1 1 auto;
    min-height: var(--ios-card-min-height, 21rem);
    max-height: var(--ios-card-max-height, 26.5rem);
    height: auto;
  }

  body.platform-ios .phrase-card-inner {
    min-height: 100%;
    height: 100%;
    max-height: none;
  }

  body.platform-ios .feedback {
    min-height: 1rem;
    height: auto;
    line-height: 1.15;
    margin-bottom: 0;
    flex: 0 0 auto;
  }

  body.platform-ios .saved-drawer {
    top: calc(8.45rem + env(safe-area-inset-top, 0px));
    bottom: calc(0.55rem + env(safe-area-inset-bottom, 0px));
  }

  body.platform-ios .site-footer {
    display: none;
  }
}
