:root {
  --paper: #f3efe3;
  --paper-deep: #e9e1cf;
  --paper-light: #fbf8f0;
  --ink: #173e32;
  --ink-soft: #536a62;
  --ink-faint: #7e8d87;
  --line: rgba(23, 62, 50, 0.13);
  --line-strong: rgba(23, 62, 50, 0.23);
  --green: #1e5b47;
  --green-bright: #2e765d;
  --lime: #d5e777;
  --lime-soft: #eaf2b6;
  --yellow: #edcf65;
  --red: #c86550;
  --red-soft: #f4d7cf;
  --white: #fffdf8;
  --shadow: 0 18px 50px rgba(43, 57, 45, 0.08);
  --shadow-strong: 0 26px 80px rgba(24, 54, 42, 0.16);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 17px;
  --radius-sm: 12px;
  --display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Songti SC", "STSong", serif;
  --sans: "Avenir Next", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color-scheme: light;
  font-family: var(--sans);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  min-width: 300px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 4%, rgba(214, 232, 122, 0.2), transparent 25rem),
    radial-gradient(circle at 95% 42%, rgba(232, 201, 105, 0.12), transparent 30rem),
    var(--paper);
  overflow-x: hidden;
}

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

button {
  color: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(46, 118, 93, 0.32);
  outline-offset: 3px;
}

a {
  color: var(--green-bright);
  text-underline-offset: 3px;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[hidden] {
  display: none !important;
}

.paper-noise {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.32;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 62, 50, 0.025) 1px, transparent 1px);
  background-size: 14px 14px, 18px 18px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.wallpaper-layer {
  position: fixed;
  inset: -18px;
  z-index: 0;
  pointer-events: none;
  background-color: var(--paper);
  background-position: center;
  background-size: cover;
  opacity: 0;
  filter: blur(var(--wallpaper-blur, 3px));
  transform: scale(1.03);
  transition: opacity 0.4s ease, filter 0.2s ease;
}

.wallpaper-layer::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(243, 239, 227, 0.15), rgba(243, 239, 227, 0.28)),
    rgba(243, 239, 227, var(--wallpaper-scrim, 0.34));
  content: "";
}

body.has-wallpaper .wallpaper-layer {
  opacity: 1;
}

body.has-wallpaper .paper-noise {
  opacity: 0.16;
}

body.has-wallpaper .stat-card,
body.has-wallpaper .library-preview-card,
body.has-wallpaper .chart-block,
body.has-wallpaper .settings-group,
body.has-wallpaper .word-row,
body.has-wallpaper .search-field,
body.has-wallpaper .word-card,
body.has-wallpaper .detail-dialog,
body.has-wallpaper dialog {
  background-color: rgba(255, 253, 248, 0.74);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

body.has-wallpaper .daily-card {
  background:
    radial-gradient(circle at 85% 10%, rgba(213, 231, 119, 0.17), transparent 15rem),
    linear-gradient(145deg, rgba(34, 95, 75, 0.9), rgba(20, 60, 48, 0.93));
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  background: var(--paper);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.loading-screen.is-done {
  opacity: 0;
  visibility: hidden;
}

.loading-mark {
  display: grid;
  width: 68px;
  height: 68px;
  place-items: center;
  border-radius: 50% 50% 45% 55%;
  color: var(--lime);
  background: var(--green);
  font: 700 34px/1 var(--display);
  transform: rotate(-5deg);
}

.loading-screen p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.loading-line {
  width: 150px;
  height: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.loading-line i {
  display: block;
  width: 45%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  animation: loading 1.2s ease-in-out infinite;
}

@keyframes loading {
  from { transform: translateX(-100%); }
  to { transform: translateX(330%); }
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(100%, 1120px);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: 108px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) clamp(18px, 4vw, 36px) 12px;
  background: rgba(243, 239, 227, 0.82);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50% 50% 43% 57%;
  color: var(--lime);
  background: var(--green);
  font: 700 23px/1 var(--display);
  transform: rotate(-6deg);
  box-shadow: 0 7px 18px rgba(30, 91, 71, 0.2);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font: 700 19px/1.1 var(--display);
  letter-spacing: 0.08em;
}

.brand small {
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.62);
  font-size: 12px;
}

.streak-pill span {
  color: #b78018;
  font-size: 14px;
}

.streak-pill b {
  color: var(--ink);
  font-size: 14px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.7);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.icon-button:hover {
  background: var(--white);
  transform: translateY(-1px);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.main-content {
  padding: 6px clamp(18px, 4vw, 36px) 40px;
}

.view {
  animation: view-in 0.35s ease;
}

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

.eyebrow {
  margin: 0 0 9px;
  color: var(--green-bright);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.welcome-block {
  padding: clamp(22px, 5vw, 54px) 4px clamp(26px, 4vw, 38px);
}

.welcome-block h1,
.page-heading h1,
.session-complete h1 {
  margin: 0;
  color: var(--ink);
  font: 500 clamp(42px, 8vw, 74px) / 0.98 var(--display);
  letter-spacing: -0.045em;
}

.welcome-block h1 em,
.page-heading h1 em,
.session-complete h1 em {
  color: var(--green-bright);
  font-weight: 500;
}

.welcome-copy {
  max-width: 340px;
  margin: 20px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.8;
}

.daily-card {
  position: relative;
  overflow: hidden;
  padding: clamp(22px, 4vw, 34px);
  border-radius: var(--radius-xl);
  color: var(--white);
  background:
    radial-gradient(circle at 85% 10%, rgba(213, 231, 119, 0.17), transparent 15rem),
    linear-gradient(145deg, #225f4b, #143c30);
  box-shadow: var(--shadow-strong);
}

.daily-card::after {
  position: absolute;
  right: -60px;
  bottom: -85px;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 47% 53% 41% 59%;
  content: "";
  transform: rotate(12deg);
}

.daily-card-top,
.daily-card-main,
.daily-copy,
.primary-button {
  position: relative;
  z-index: 1;
}

.daily-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.card-kicker {
  margin: 0 0 7px;
  color: currentColor;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  opacity: 0.68;
}

.daily-card h2 {
  margin: 0;
  font: 500 26px/1.2 var(--display);
}

.book-badge {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 999px;
  color: var(--lime-soft);
  background: rgba(255, 255, 255, 0.07);
  font-size: 11px;
}

.daily-card-main {
  display: flex;
  align-items: center;
  gap: clamp(20px, 6vw, 42px);
  padding: 30px 0 26px;
}

.progress-orb {
  display: grid;
  flex: 0 0 auto;
  width: 106px;
  height: 106px;
  padding: 8px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--lime) calc(var(--progress) * 1%), rgba(255, 255, 255, 0.13) 0);
  transition: background 0.4s ease;
}

.progress-orb > div {
  display: grid;
  width: 100%;
  height: 100%;
  place-content: center;
  border-radius: 50%;
  background: #1a4b3b;
  text-align: center;
}

.progress-orb strong {
  font: 600 27px/1 var(--display);
}

.progress-orb span {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.63);
  font-size: 10px;
}

.daily-copy p {
  margin: 0 0 14px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  line-height: 1.65;
}

.task-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-counts span {
  padding: 7px 10px;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
}

.task-counts b {
  color: var(--white);
  font-size: 13px;
}

.primary-button {
  display: flex;
  width: 100%;
  min-height: 53px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 20px;
  border: 0;
  border-radius: 16px;
  color: var(--ink);
  background: var(--lime);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(8, 28, 20, 0.18);
  transition: background 0.2s ease, transform 0.2s ease;
}

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

.primary-button svg {
  width: 19px;
  height: 19px;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 14px;
}

.stat-card {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 248, 0.58);
}

.stat-icon {
  display: grid;
  flex: 0 0 auto;
  width: 33px;
  height: 33px;
  place-items: center;
  border-radius: 50%;
  font: 700 12px/1 var(--display);
}

.tone-green { color: #194d3b; background: var(--lime-soft); }
.tone-yellow { color: #6c5311; background: #f3e5b5; }
.tone-red { color: #7e3426; background: var(--red-soft); }

.stat-card b,
.stat-card small {
  display: block;
}

.stat-card b {
  font: 600 20px/1 var(--display);
}

.stat-card small {
  margin-top: 5px;
  color: var(--ink-faint);
  font-size: 9px;
  white-space: nowrap;
}

.section-block {
  margin-top: clamp(32px, 7vw, 64px);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin: 0;
  font: 500 clamp(22px, 3vw, 30px) / 1.2 var(--display);
}

.text-button {
  flex: 0 0 auto;
  padding: 6px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--green-bright);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.library-preview-card {
  display: flex;
  align-items: center;
  gap: clamp(24px, 7vw, 60px);
  padding: clamp(22px, 4vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 13% 25%, rgba(213, 231, 119, 0.2), transparent 10rem),
    rgba(255, 253, 248, 0.66);
}

.preview-ring {
  display: grid;
  flex: 0 0 auto;
  width: 132px;
  height: 132px;
  place-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 47% 53% 51% 49%;
  text-align: center;
  transform: rotate(-3deg);
}

.preview-ring span {
  font: 500 31px/1 var(--display);
  transform: rotate(3deg);
}

.preview-ring small {
  margin-top: 7px;
  color: var(--ink-faint);
  font-size: 10px;
  transform: rotate(3deg);
}

.preview-meta {
  display: grid;
  flex: 1;
  gap: 14px;
}

.preview-meta div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.preview-meta div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.preview-meta span {
  color: var(--ink-soft);
  font-size: 12px;
}

.preview-meta b {
  font: 600 19px/1 var(--display);
}

.personal-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 34px 0 0;
  color: var(--ink-faint);
  font-size: 11px;
}

.personal-note span {
  color: #b5811a;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(24px, 5vw, 52px) 4px clamp(24px, 4vw, 38px);
}

.page-heading h1 {
  font-size: clamp(38px, 7vw, 62px);
}

.library-total {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
}

.library-total b {
  font: 500 31px/1 var(--display);
}

.library-total span {
  margin-top: 5px;
  color: var(--ink-faint);
  font-size: 10px;
}

.search-field {
  display: flex;
  height: 56px;
  align-items: center;
  gap: 12px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: rgba(255, 253, 248, 0.72);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-field:focus-within {
  border-color: rgba(46, 118, 93, 0.45);
  box-shadow: 0 0 0 4px rgba(46, 118, 93, 0.07);
}

.search-field svg {
  width: 20px;
  height: 20px;
  color: var(--ink-faint);
}

.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 15px;
}

.search-field input::placeholder {
  color: #9aa49f;
}

.search-clear {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--ink-soft);
  background: var(--paper-deep);
  font-size: 18px;
  cursor: pointer;
}

.filter-scroll {
  display: flex;
  gap: 8px;
  margin: 16px -18px 20px;
  padding: 0 18px 3px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  background: rgba(255, 253, 248, 0.5);
  font-size: 12px;
  cursor: pointer;
}

.filter-chip.is-active {
  border-color: var(--green);
  color: var(--white);
  background: var(--green);
}

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

.word-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  width: 100%;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.58);
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.word-row:hover {
  border-color: var(--line-strong);
  background: var(--paper-light);
  transform: translateY(-1px);
}

.word-row-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.word-row-title strong {
  font: 600 22px/1.05 var(--display);
  letter-spacing: -0.01em;
}

.word-row-title span {
  color: var(--ink-faint);
  font-size: 10px;
}

.word-row-meaning {
  margin: 7px 0 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-row-tags {
  display: flex;
  align-items: center;
  gap: 5px;
}

.tiny-tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 3px 7px;
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--paper-deep);
  font-size: 8px;
  white-space: nowrap;
}

.tiny-tag.favorite {
  color: #7d5b0b;
  background: #f3e5b5;
}

.word-row-state {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-faint);
  background: var(--paper);
  font: 600 11px/1 var(--display);
}

.word-row-state.is-learned {
  color: var(--white);
  background: var(--green-bright);
}

.load-more,
.outline-button {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  cursor: pointer;
}

.load-more {
  width: 100%;
  margin-top: 14px;
}

.empty-state {
  padding: 56px 20px;
  text-align: center;
}

.empty-state > span {
  font: 500 58px/1 var(--display);
  color: var(--line-strong);
}

.empty-state h2 {
  margin: 16px 0 0;
  font: 500 25px/1.2 var(--display);
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--ink-faint);
  font-size: 12px;
}

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

.large-stat {
  display: flex;
  min-height: 135px;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 253, 248, 0.62);
}

.large-stat > span {
  color: var(--ink-faint);
  font-size: 11px;
}

.large-stat strong {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font: 500 42px/1 var(--display);
}

.large-stat small {
  color: var(--ink-soft);
  font: 500 11px/1 var(--sans);
}

.large-stat.accent {
  color: var(--lime);
  border-color: var(--green);
  background:
    radial-gradient(circle at 80% 10%, rgba(213, 231, 119, 0.2), transparent 8rem),
    var(--green);
}

.large-stat.accent > span,
.large-stat.accent small {
  color: rgba(255, 255, 255, 0.66);
}

.chart-block {
  padding: clamp(20px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.58);
}

.chart-total {
  color: var(--ink-faint);
  font-size: 10px;
}

.chart-total b {
  color: var(--ink);
  font: 600 17px/1 var(--display);
}

.week-chart {
  display: grid;
  height: 168px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: clamp(7px, 2vw, 14px);
  padding-top: 18px;
}

.chart-day {
  display: grid;
  height: 100%;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 8px;
  text-align: center;
}

.chart-bar-wrap {
  display: flex;
  height: 100%;
  align-items: end;
  justify-content: center;
}

.chart-bar {
  width: min(100%, 34px);
  min-height: 5px;
  border-radius: 8px 8px 4px 4px;
  background: #d6d9cd;
  transition: height 0.5s ease;
}

.chart-day.is-today .chart-bar {
  background: var(--green);
}

.chart-day.has-data .chart-bar {
  background: var(--lime);
}

.chart-day.is-today.has-data .chart-bar {
  background: var(--green);
}

.chart-day span {
  color: var(--ink-faint);
  font-size: 9px;
}

.chart-day.is-today span {
  color: var(--ink);
  font-weight: 700;
}

.insight-card {
  display: flex;
  gap: 20px;
  padding: clamp(22px, 4vw, 32px);
  border-radius: var(--radius-lg);
  color: var(--white);
  background: var(--green);
}

.insight-mark {
  display: grid;
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  color: var(--lime);
  font-size: 20px;
}

.insight-card h2 {
  margin: 4px 0 7px;
  font: 500 clamp(22px, 3.5vw, 31px) / 1.2 var(--display);
}

.insight-card p:last-child {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  line-height: 1.7;
}

.settings-group {
  margin-bottom: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.58);
}

.settings-heading {
  margin-bottom: 15px;
}

.settings-heading h2 {
  margin: 0;
  font: 500 24px/1.2 var(--display);
}

.settings-heading p {
  margin: 7px 0 0;
  color: var(--ink-faint);
  font-size: 11px;
  line-height: 1.6;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

.setting-row strong,
.setting-row span {
  display: block;
}

.setting-row strong {
  font-size: 13px;
}

.setting-row span {
  margin-top: 4px;
  color: var(--ink-faint);
  font-size: 9px;
}

.segmented-control {
  display: flex;
  flex: 0 0 auto;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: var(--paper-deep);
}

.segmented-control button {
  min-width: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.segmented-control button.is-active {
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 3px 10px rgba(23, 62, 50, 0.09);
}

.select-control {
  max-width: 150px;
  padding: 9px 28px 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--white);
  font-size: 11px;
}

.setting-action {
  display: grid;
  width: 100%;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.setting-action.danger {
  color: var(--red);
}

.action-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 10px;
  background: var(--paper-deep);
  font-size: 14px;
}

.setting-action strong,
.setting-action small {
  display: block;
}

.setting-action strong {
  font-size: 12px;
}

.setting-action small {
  margin-top: 3px;
  color: var(--ink-faint);
  font-size: 9px;
}

.chevron {
  color: var(--ink-faint);
  font-size: 20px;
}

.offline-note {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 10px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--yellow);
}

.status-dot.is-online {
  background: #68a679;
}

.version-note {
  margin: 34px 0 0;
  color: var(--ink-faint);
  font-size: 10px;
  text-align: center;
  letter-spacing: 0.08em;
}

.wallpaper-editor {
  display: grid;
  gap: 12px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.wallpaper-live-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(213, 231, 119, 0.18), rgba(255, 253, 248, 0.4)),
    var(--paper);
}

.wallpaper-live-icon {
  display: grid;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 14px;
  color: var(--lime);
  background: var(--green);
  font: 700 11px/1 var(--display);
  letter-spacing: 0.05em;
}

.wallpaper-live-banner div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.wallpaper-live-banner b {
  font-size: 11px;
}

.wallpaper-live-banner small {
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.6;
}

.wallpaper-actions {
  display: grid;
  gap: 8px;
}

.wallpaper-upload-button {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--white);
  background: var(--green);
  font-size: 11px;
  cursor: pointer;
}

.wallpaper-upload-button span {
  font-size: 18px;
  line-height: 1;
}

.wallpaper-upload-button b {
  font-weight: 600;
}

.wallpaper-remove-button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid rgba(200, 101, 80, 0.25);
  border-radius: 10px;
  color: var(--red);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.wallpaper-controls {
  display: grid;
  gap: 14px;
  margin-top: 17px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.range-setting {
  display: grid;
  gap: 9px;
}

.range-setting > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.range-setting b {
  font-size: 10px;
}

.range-setting output {
  color: var(--ink-faint);
  font-size: 9px;
}

.range-setting input[type="range"] {
  width: 100%;
  height: 4px;
  margin: 5px 0;
  accent-color: var(--green);
}

.wallpaper-status {
  margin: 14px 0 0;
  color: var(--ink-faint);
  font-size: 9px;
  line-height: 1.6;
}

.bottom-nav {
  position: fixed;
  z-index: 40;
  right: max(12px, calc((100vw - 720px) / 2));
  bottom: max(12px, env(safe-area-inset-bottom));
  left: max(12px, calc((100vw - 720px) / 2));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 7px;
  border: 1px solid rgba(23, 62, 50, 0.1);
  border-radius: 21px;
  background: rgba(255, 253, 248, 0.89);
  box-shadow: 0 15px 45px rgba(37, 52, 43, 0.16);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.nav-item {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 7px 4px 6px;
  border: 0;
  border-radius: 14px;
  color: var(--ink-faint);
  background: transparent;
  font-size: 9px;
  cursor: pointer;
}

.nav-item svg {
  width: 20px;
  height: 20px;
}

.nav-item.is-active {
  color: var(--ink);
  background: var(--lime-soft);
}

.study-view {
  max-width: 720px;
  min-height: calc(100vh - 165px);
  margin: 0 auto;
}

.study-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 16px;
  padding: 6px 0 18px;
}

.study-progress {
  display: grid;
  gap: 8px;
}

.study-progress > span {
  color: var(--ink-faint);
  font-size: 9px;
  text-align: center;
}

.study-progress > span b:first-child {
  color: var(--ink);
  font-size: 11px;
}

.study-progress > div {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.study-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.35s ease;
}

#studyFavoriteButton.is-active {
  color: #7d5b0b;
  border-color: #d8be6f;
  background: #f3e5b5;
}

#studyFavoriteButton.is-active svg {
  fill: currentColor;
}

.study-stage {
  width: min(100%, 670px);
  margin: 0 auto;
}

.word-card {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--paper-light);
  box-shadow: var(--shadow);
  transition: border-color 0.25s ease;
}

.word-card.is-revealed {
  border-color: rgba(46, 118, 93, 0.22);
}

.card-face {
  padding: clamp(24px, 5vw, 42px);
}

.card-front {
  display: flex;
  min-height: min(57vh, 555px);
  flex-direction: column;
}

.card-back {
  display: none;
}

.word-card.is-revealed .card-front {
  display: none;
}

.word-card.is-revealed .card-back {
  display: block;
  animation: answer-in 0.3s ease both;
}

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

.word-meta-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.word-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--green);
  background: var(--lime-soft);
  font-size: 9px;
  font-weight: 600;
}

.word-tag.secondary {
  color: var(--ink-soft);
  background: var(--paper-deep);
}

.word-rank {
  color: var(--ink-faint);
  font-size: 9px;
}

.word-title-wrap {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: auto;
  padding: 32px 0 10px;
}

.word-title-wrap h1 {
  overflow-wrap: anywhere;
  margin: 0;
  font: 500 clamp(48px, 10vw, 80px) / 0.98 var(--display);
  letter-spacing: -0.045em;
}

.sound-button {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--green);
  background: rgba(255, 255, 255, 0.48);
  cursor: pointer;
}

.sound-button:hover {
  background: var(--white);
}

.sound-button svg {
  width: 20px;
  height: 20px;
}

.study-phonetic {
  margin: 0;
  color: var(--ink-soft);
  font: 400 clamp(16px, 3vw, 20px) / 1.4 var(--display);
}

.front-divider {
  width: 100%;
  height: 1px;
  margin: auto 0 22px;
  background: var(--line);
}

.front-prompt {
  margin: 0 0 14px;
  color: var(--ink-faint);
  font-size: 12px;
  text-align: center;
}

.reveal-button {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 0;
  border-radius: 15px;
  color: var(--white);
  background: var(--green);
  font-size: 13px;
  cursor: pointer;
}

.reveal-button span {
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.57);
  font-size: 8px;
}

.back-word-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.back-word-row h2 {
  overflow-wrap: anywhere;
  margin: 14px 0 5px;
  font: 500 clamp(37px, 8vw, 56px) / 1 var(--display);
  letter-spacing: -0.035em;
}

.meaning-block {
  display: grid;
  gap: 8px;
  padding: 21px 0 18px;
}

.meaning-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
}

.meaning-row:first-child .meaning-text {
  font-size: clamp(21px, 4vw, 27px);
  font-weight: 500;
}

.meaning-pos {
  color: var(--green-bright);
  font: 600 11px/1 var(--display);
}

.meaning-text {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}

.mini-heading {
  margin: 0 0 10px;
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.tips-block {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.tip-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(23, 62, 50, 0.08);
}

.tip-item:last-child {
  border-bottom: 0;
}

.tip-label {
  align-self: start;
  padding: 4px 6px;
  border-radius: 7px;
  color: var(--green);
  background: var(--lime-soft);
  font-size: 9px;
  text-align: center;
}

.tip-text {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.75;
}

.phrase-block {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.phrase-list {
  display: grid;
  gap: 7px;
}

.phrase-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--paper);
}

.phrase-item b {
  color: var(--ink);
  font: 500 12px/1.4 var(--display);
}

.phrase-item span {
  color: var(--ink-faint);
  font-size: 9px;
  text-align: right;
}

.custom-tip-block {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.custom-tip-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.custom-tip-toggle span {
  color: var(--green-bright);
  font-size: 13px;
}

.custom-tip-editor {
  margin-top: 10px;
}

.custom-tip-editor textarea {
  width: 100%;
  min-height: 82px;
  padding: 11px 12px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: 0;
  color: var(--ink);
  background: var(--white);
  font-size: 11px;
  line-height: 1.6;
}

.custom-tip-editor > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
}

.tip-count {
  color: var(--ink-faint);
  font-size: 8px;
}

.small-button {
  padding: 7px 12px;
  border: 0;
  border-radius: 8px;
  color: var(--white);
  background: var(--green);
  font-size: 9px;
  cursor: pointer;
}

.saved-custom-tip {
  margin: 13px 0 0;
  padding: 11px 12px;
  border-left: 3px solid var(--yellow);
  border-radius: 0 8px 8px 0;
  color: var(--ink-soft);
  background: #f4edcf;
  font-size: 10px;
  line-height: 1.7;
}

.rating-panel {
  margin-top: 16px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.rating-panel.is-visible {
  position: fixed;
  z-index: 35;
  right: 12px;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 12px;
  width: min(calc(100vw - 24px), 670px);
  margin: 12px auto 0;
  padding: 9px;
  border: 1px solid rgba(23, 62, 50, 0.11);
  border-radius: 19px;
  background: rgba(249, 246, 237, 0.94);
  box-shadow: 0 14px 42px rgba(22, 48, 37, 0.17);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.rating-panel > p {
  margin: 0 0 6px;
  color: var(--ink-faint);
  font-size: 10px;
  text-align: center;
}

.rating-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.rating-button {
  display: grid;
  min-height: 52px;
  place-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.68);
  cursor: pointer;
}

.rating-button span {
  font-size: 12px;
  font-weight: 600;
}

.rating-button small {
  color: var(--ink-faint);
  font-size: 7px;
}

.word-card.is-revealed {
  margin-bottom: 106px;
}

.rating-button.again { border-color: rgba(200, 101, 80, 0.28); }
.rating-button.hard { border-color: rgba(199, 155, 44, 0.3); }
.rating-button.good { border-color: rgba(46, 118, 93, 0.29); }
.rating-button.easy { border-color: rgba(30, 91, 71, 0.4); background: var(--lime-soft); }

.rating-button:hover {
  background: var(--white);
  transform: translateY(-1px);
}

.session-complete {
  display: grid;
  min-height: calc(100vh - 240px);
  place-content: center;
  justify-items: center;
  text-align: center;
}

.complete-burst {
  display: grid;
  width: 72px;
  height: 72px;
  margin-bottom: 25px;
  place-items: center;
  border-radius: 50% 47% 52% 48%;
  color: var(--green);
  background: var(--lime);
  font-size: 29px;
  transform: rotate(-7deg);
}

.session-complete h1 {
  font-size: clamp(38px, 8vw, 66px);
}

.complete-stats {
  display: flex;
  gap: clamp(22px, 7vw, 50px);
  margin: 30px 0;
}

.complete-stats div {
  display: grid;
  gap: 5px;
}

.complete-stats b {
  font: 500 31px/1 var(--display);
}

.complete-stats span {
  color: var(--ink-faint);
  font-size: 9px;
}

.session-complete .primary-button {
  width: min(280px, 80vw);
}

.session-complete .text-button {
  margin-top: 16px;
}

dialog {
  width: min(92vw, 620px);
  max-height: min(88vh, 820px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 26px;
  color: var(--ink);
  background: var(--paper-light);
  box-shadow: 0 30px 100px rgba(10, 32, 22, 0.34);
}

dialog::backdrop {
  background: rgba(15, 36, 27, 0.55);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.dialog-shell {
  position: relative;
  max-height: min(88vh, 820px);
  padding: clamp(24px, 5vw, 38px);
  overflow-y: auto;
}

.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--ink-soft);
  background: var(--paper-deep);
  font-size: 20px;
  cursor: pointer;
}

.detail-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 17px 0 0;
}

.detail-title-row h2 {
  margin: 0 0 6px;
  font: 500 clamp(40px, 10vw, 60px) / 1 var(--display);
  letter-spacing: -0.04em;
}

.detail-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 22px;
  padding-top: 19px;
  border-top: 1px solid var(--line);
}

.detail-footer .outline-button {
  min-height: 40px;
}

.detail-footer span {
  color: var(--ink-faint);
  font-size: 10px;
}

.about-dialog {
  width: min(92vw, 600px);
}

.about-dialog h2 {
  margin: 4px 0 18px;
  font: 500 clamp(32px, 7vw, 45px) / 1.1 var(--display);
}

.about-copy {
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.9;
}

.about-copy p {
  margin: 0 0 13px;
}

.about-dialog .primary-button {
  margin-top: 12px;
}

.toast {
  position: fixed;
  z-index: 200;
  right: 50%;
  bottom: max(90px, calc(env(safe-area-inset-bottom) + 80px));
  max-width: calc(100vw - 40px);
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--white);
  background: rgba(20, 49, 38, 0.94);
  box-shadow: 0 10px 35px rgba(19, 48, 37, 0.22);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, 8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(50%, 0);
}

.hidden {
  display: none !important;
}

@media (min-width: 760px) {
  .app-shell {
    padding-bottom: 60px;
  }

  .topbar {
    width: min(100%, 880px);
    margin: 0 auto;
  }

  #homeView,
  #statsView,
  #settingsView {
    max-width: 880px;
    margin: 0 auto;
  }

  .welcome-block {
    display: grid;
    grid-template-areas:
      "eyebrow eyebrow"
      "title copy";
    grid-template-columns: minmax(0, 1fr) 250px;
    grid-template-rows: auto auto;
    align-items: end;
    column-gap: 30px;
    row-gap: 0;
  }

  .welcome-block .eyebrow {
    grid-area: eyebrow;
  }

  .welcome-block h1 {
    grid-area: title;
  }

  .welcome-copy {
    grid-area: copy;
    margin: 0 0 8px;
  }

  .daily-card {
    padding: 34px 38px;
  }

  .daily-card-main {
    justify-content: space-between;
  }

  .daily-copy {
    flex: 1;
  }

  .daily-card .primary-button {
    width: 240px;
    margin-left: auto;
  }

  .stat-strip {
    gap: 12px;
  }

  .stat-card {
    padding: 18px;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
  }

  .stat-card b {
    font-size: 26px;
  }

  .library-preview-card {
    min-height: 230px;
  }

  .preview-ring {
    width: 155px;
    height: 155px;
  }

  .bottom-nav {
    right: 50%;
    bottom: 18px;
    left: auto;
    width: 480px;
    transform: translateX(50%);
  }

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

  .word-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .stats-overview {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .large-stat {
    min-height: 165px;
  }

  .settings-group {
    padding: 26px;
  }

  .setting-row {
    padding: 18px 0;
  }

  .segmented-control button {
    min-width: 43px;
  }

  .study-view {
    padding-top: 8px;
  }

  .card-front {
    min-height: min(54vh, 590px);
  }

  .rating-button {
    min-height: 66px;
  }

  .rating-panel.is-visible {
    right: 50%;
    bottom: max(17px, env(safe-area-inset-bottom));
    width: 670px;
    transform: translateX(50%);
  }
}

@media (min-width: 1080px) {
  .main-content {
    padding-right: 52px;
    padding-left: 52px;
  }

  .welcome-block {
    grid-template-columns: minmax(0, 1fr) 310px;
  }

  .daily-card h2 {
    font-size: 31px;
  }

  .progress-orb {
    width: 124px;
    height: 124px;
  }
}

@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;
  }
}
