:root {
  --ink: #3d4141;
  --muted: #8d8e8a;
  --muted-deep: #6d7772;
  --paper: #fffaf7;
  --white: #ffffff;
  --line: #f0dddd;
  --pink: #ef9fa8;
  --pink-soft: #fff0f1;
  --pink-deep: #d96f7a;
  --green: #73a984;
  --green-soft: #e9f5eb;
  --yellow-soft: #fff7df;
  --blue-soft: #eef6fb;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: #f4e8e6;
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(145deg, #f7e9e8 0%, #fffaf2 48%, #f4ece8 100%);
  font-family: "Nunito", "PingFang SC", "Hiragino Sans GB", "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  color: inherit;
  font: inherit;
}

a {
  text-decoration: none;
}

button {
  border: 0;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(105, 161, 126, 0.7);
  outline-offset: 3px;
}

button:disabled {
  cursor: default;
}

[hidden] {
  display: none !important;
}

/* Small fallbacks keep this page usable when opened without a Tailwind build step. */
.min-h-screen {
  min-height: 100vh;
  min-height: 100svh;
}

.word-library-app {
  display: grid;
  min-height: 100svh;
  place-items: center;
}

.library-shell {
  position: relative;
  display: flex;
  width: 100%;
  height: 100svh;
  min-height: 100svh;
  max-width: 440px;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(155deg, #fff9f7 0%, #fffdf8 47%, #fff3f2 100%);
}

.library-shell::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #f2b4b8 0%, #f5d99a 47%, #a9d0b5 100%);
  content: "";
}

.library-content {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 16px calc(18px + env(safe-area-inset-bottom));
  scrollbar-color: #e7c6c4 transparent;
  scrollbar-width: thin;
}

.page-header {
  padding: 4px 2px 0;
}

.page-kicker,
.page-title-row,
.quick-actions,
.section-topline,
.collection-heading,
.word-card-topline,
.word-card-actions,
.home-link,
.bottom-nav,
.bottom-nav-item {
  display: flex;
}

.page-kicker {
  align-items: center;
  gap: 7px;
  color: #a8a09b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.kicker-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 10px 0 0 #f4d391;
}

.page-title-row {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
}

.page-title {
  margin: 0;
  color: #3c4543;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.page-subtitle {
  max-width: 280px;
  margin: 8px 0 0;
  color: var(--muted-deep);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.age-mark {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #e7c98a;
  border-radius: 8px;
  color: #b48b42;
  background: var(--yellow-soft);
  font-size: 14px;
  font-weight: 900;
  transform: rotate(4deg);
}

.quick-actions {
  align-items: stretch;
  gap: 8px;
  margin: 19px 0 21px;
}

.wow-entry {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid #e8c7cb;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 3px 9px rgba(201, 139, 140, 0.08);
  transition: border-color 160ms ease, transform 160ms ease;
}

.wow-entry:hover {
  border-color: #df9ea7;
  transform: translateY(-1px);
}

.wow-entry-icon {
  display: grid;
  width: 29px;
  height: 29px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: #c97b89;
  background: var(--pink-soft);
  font-size: 17px;
}

.wow-entry-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.wow-entry-copy strong {
  overflow: hidden;
  color: #575252;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wow-entry-copy small {
  overflow: hidden;
  color: #a39a96;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-arrow {
  margin-left: auto;
  color: #cf8290;
  font-size: 19px;
  line-height: 1;
}

.shuffle-button {
  display: inline-flex;
  min-width: 59px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 9px;
  border: 1px solid #bfd7c5;
  border-radius: 8px;
  color: #628a6d;
  background: var(--green-soft);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  transition: background 160ms ease, transform 160ms ease;
}

.shuffle-button:hover {
  background: #dff0e3;
  transform: translateY(-1px);
}

.shuffle-icon {
  font-size: 18px;
  line-height: 1;
}

.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 20px 0 10px;
}

.page-action {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 19px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.page-action:active {
  transform: translateY(1px);
}

.return-action {
  border-color: #efcbd0;
  color: #bc707b;
  background: #fff0f1;
}

.return-action:hover {
  background: #ffe4e6;
}

.refresh-action {
  border-color: #d56f7d;
  color: #ffffff;
  background: #d97985;
  box-shadow: 0 3px 0 rgba(181, 86, 99, 0.16);
}

.refresh-action:hover {
  background: #ca6876;
}

.category-section {
  margin: 0 -16px;
  padding: 0 16px;
}

.section-topline {
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.section-label,
.learned-summary,
.collection-kicker,
.interaction-status,
.word-meaning,
.word-phonetic,
.learned-label,
.home-link,
.empty-state p {
  margin: 0;
}

.section-label {
  color: #6d7772;
  font-size: 12px;
  font-weight: 900;
}

.learned-summary {
  color: #a19792;
  font-size: 10px;
  font-weight: 800;
}

.learned-summary strong {
  color: var(--pink-deep);
  font-size: 14px;
  font-weight: 900;
}

.category-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 1px 1px 7px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tab {
  min-height: 35px;
  flex: 0 0 auto;
  padding: 0 13px;
  border: 1px solid #eadbd8;
  border-radius: 999px;
  color: #817c79;
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.category-tab:hover {
  border-color: #e7b6ba;
  transform: translateY(-1px);
}

.category-tab.is-active {
  border-color: #e69da5;
  color: #a95361;
  background: #ffe2e4;
  box-shadow: 0 2px 0 rgba(216, 115, 126, 0.09);
}

.collection-heading {
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 2px 4px;
}

.collection-kicker {
  color: #aaa09a;
  font-size: 10px;
  font-weight: 800;
}

.collection-title {
  margin: 4px 0 0;
  color: #414846;
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
}

.collection-progress {
  min-width: 52px;
  padding: 7px 8px 6px;
  border: 1px solid #c7ddcb;
  border-radius: 8px;
  color: #669071;
  background: var(--green-soft);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.interaction-status {
  min-height: 18px;
  margin: 8px 2px 10px;
  color: #9b928f;
  font-size: 10px;
  font-weight: 700;
}

.word-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.word-card {
  display: flex;
  min-height: 187px;
  flex-direction: column;
  padding: 11px;
  border: 1px solid #f0dddd;
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 5px 14px rgba(190, 137, 140, 0.08);
  animation: card-in 240ms ease both;
  animation-delay: var(--card-delay, 0ms);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.word-card:hover {
  border-color: #e8bfc2;
  box-shadow: 0 7px 16px rgba(190, 137, 140, 0.13);
  transform: translateY(-2px);
}

.word-card.is-learned {
  border-color: #c9dfcf;
}

.word-card-topline {
  align-items: flex-start;
  justify-content: space-between;
  min-height: 53px;
}

.word-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--card-accent) 35%, #ffffff);
  border-radius: 8px;
  color: var(--card-accent);
  background: color-mix(in srgb, var(--card-accent) 14%, #ffffff);
  font-family: "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 31px;
  font-weight: 900;
  line-height: 1;
}

.word-icon.is-number {
  font-family: "Nunito", "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif;
  font-size: 29px;
}

.word-card-meta {
  display: flex;
  max-width: 72px;
  justify-content: flex-end;
}

.episode-tag {
  padding: 4px 5px;
  border: 1px solid #efced2;
  border-radius: 6px;
  color: #ba7a83;
  background: #fff6f6;
  font-size: 9px;
  font-weight: 900;
  line-height: 1.1;
  text-align: right;
}

.word-card-copy {
  min-width: 0;
  margin-top: 11px;
}

.word-name {
  overflow: hidden;
  margin: 0;
  color: #3f4846;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-card.is-sentence .word-name {
  display: -webkit-box;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.word-meaning {
  overflow: hidden;
  margin-top: 5px;
  color: #d5616d;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-phonetic {
  overflow: hidden;
  margin-top: 4px;
  color: #a4a7a1;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-card-actions {
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
}

.word-speaker,
.learned-toggle {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.word-speaker {
  width: 40px;
  height: 40px;
  border: 1px solid #abd2b5;
  border-radius: 50%;
  background: var(--green-soft);
  box-shadow: 0 3px 0 rgba(107, 158, 120, 0.12);
}

.word-speaker:hover,
.word-speaker.is-speaking {
  background: #d8efdd;
  box-shadow: 0 2px 0 rgba(107, 158, 120, 0.09);
  transform: scale(1.06);
}

.word-speaker.is-speaking {
  animation: speaker-breathe 900ms ease-in-out infinite alternate;
}

.speaker-icon {
  display: block;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 18px;
  line-height: 1;
}

.learned-label {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: #b2aaa5;
  font-size: 9px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-card.is-learned .learned-label {
  color: #7da489;
}

.learned-toggle {
  width: 35px;
  height: 35px;
  border: 1px solid #efb5bd;
  border-radius: 50%;
  color: #cf7180;
  background: #ffe7e9;
  font-size: 19px;
  line-height: 1;
}

.learned-toggle:hover {
  background: #ffdbdf;
  transform: scale(1.06);
}

.learned-toggle.is-learned {
  border-color: #e5919c;
  color: #ffffff;
  background: #e99ba5;
  box-shadow: 0 3px 0 rgba(216, 112, 125, 0.14);
}

.empty-state {
  padding: 24px 18px;
  border: 1px solid #eed3d2;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  text-align: center;
}

.empty-icon {
  display: block;
  color: #db98a3;
  font-size: 22px;
}

.empty-state strong {
  display: block;
  margin-top: 7px;
  color: #5e5a59;
  font-size: 14px;
  font-weight: 900;
}

.empty-state p {
  margin-top: 6px;
  color: #9d9490;
  font-size: 11px;
  line-height: 1.45;
}

.empty-state a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 13px;
  color: #bd6876;
  font-size: 11px;
  font-weight: 900;
}

.home-link {
  width: fit-content;
  align-items: center;
  gap: 7px;
  margin-top: 19px;
  padding: 5px 2px;
  color: #7e8b84;
  font-size: 11px;
  font-weight: 900;
}

.home-link:hover {
  color: #527b63;
}

.home-link-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid #bdd4c3;
  border-radius: 50%;
  color: #679274;
  background: var(--green-soft);
  font-size: 16px;
  line-height: 1;
}

.bottom-nav {
  position: relative;
  z-index: 2;
  min-height: 69px;
  align-items: stretch;
  justify-content: space-around;
  padding: 7px 7px calc(7px + env(safe-area-inset-bottom));
  border-top: 1px solid #f0dfdc;
  background: rgba(255, 253, 250, 0.96);
  box-shadow: 0 -5px 16px rgba(194, 147, 143, 0.06);
}

.bottom-nav-item {
  min-width: 0;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px 1px;
  border-radius: 7px;
  color: #a49d98;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.bottom-nav-item:hover:not(.is-disabled) {
  color: #c36e7a;
  background: #fff5f4;
}

.bottom-nav-item.is-active {
  color: #c4606d;
  background: #fff0f1;
}

.bottom-nav-item.is-disabled {
  color: #c2bbb7;
  cursor: default;
  opacity: 0.72;
}

.bottom-nav-icon {
  display: grid;
  min-height: 23px;
  place-items: center;
  color: currentColor;
  font-size: 20px;
  line-height: 1;
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes speaker-breathe {
  from {
    box-shadow: 0 2px 0 rgba(107, 158, 120, 0.09), 0 0 0 0 rgba(115, 169, 132, 0.12);
  }
  to {
    box-shadow: 0 2px 0 rgba(107, 158, 120, 0.09), 0 0 0 5px rgba(115, 169, 132, 0);
  }
}

@media (min-width: 600px) {
  .word-library-app {
    padding: 24px;
  }

  .library-shell {
    height: min(100svh, 780px);
    min-height: 640px;
    aspect-ratio: 9 / 16;
    border-radius: 12px;
    box-shadow: 0 20px 48px rgba(141, 100, 99, 0.18);
  }
}

@media (max-width: 350px) {
  .library-content {
    padding-right: 13px;
    padding-left: 13px;
  }

  .category-section {
    margin-right: -13px;
    margin-left: -13px;
    padding-right: 13px;
    padding-left: 13px;
  }

  .word-card {
    min-height: 180px;
    padding: 10px;
  }

  .word-icon {
    width: 48px;
    height: 48px;
    font-size: 28px;
  }

  .word-name {
    font-size: 19px;
  }

  .word-speaker {
    width: 37px;
    height: 37px;
  }

  .learned-toggle {
    width: 33px;
    height: 33px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
