:root {
  color-scheme: light;
  --paper: #f2f6f4;
  --ink: #1e211f;
  --muted: #65716c;
  --line: rgba(30, 33, 31, 0.12);
  --soft: rgba(255, 255, 255, 0.62);
  --panel: rgba(255, 255, 255, 0.9);
  --accent: #1f7668;
  --accent-strong: #155e53;
  --accent-soft: rgba(31, 118, 104, 0.12);
  --warm: #d78238;
  --danger: #b2473c;
  --shadow: 0 18px 44px rgba(24, 45, 40, 0.12);
  --exam-font: "Times New Roman", Times, "Nimbus Roman No9 L", serif;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
  touch-action: manipulation;
}

html {
  height: 100%;
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(250, 252, 251, 0.96), rgba(227, 237, 233, 0.96)),
    var(--paper);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  height: 100%;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

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

button:not(:disabled):active {
  transform: translateY(1px);
}

button:focus-visible,
.import-button:focus-visible,
.backup-import-button:focus-visible {
  outline: 2px solid rgba(31, 118, 104, 0.32);
  outline-offset: 2px;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.topbar,
.review-head,
.progress-row,
.panel-heading,
.bottom-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  padding: 0 2px 6px;
}

.collection-switch {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.collection-button {
  min-width: 0;
  min-height: 40px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.collection-button.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 24px rgba(31, 118, 104, 0.14);
}

.library-bar {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 10px;
}

.library-select-wrap {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.library-select-wrap span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.library-select-wrap select {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.library-select-wrap:focus-within,
.jump-field:focus-within,
.search-row input:focus,
.setup-field select:focus,
.setup-field input:focus {
  border-color: rgba(31, 118, 104, 0.38);
  box-shadow: 0 0 0 3px rgba(31, 118, 104, 0.08);
}

.import-button {
  min-width: 68px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(31, 118, 104, 0.28);
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 850;
}

.tool-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.backup-import-button {
  display: grid;
  place-items: center;
}

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

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: 1.34rem;
  line-height: 1.1;
}

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

.icon-button {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--warm);
  box-shadow: 0 8px 22px rgba(24, 45, 40, 0.08);
}

.global-sound-button,
.phrase-sound-button {
  color: var(--accent-strong);
}

.speaker-icon {
  position: relative;
  width: 24px;
  height: 18px;
  display: block;
  margin: 0 auto;
}

.speaker-core::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 6px;
  width: 5px;
  height: 6px;
  border-radius: 2px 0 0 2px;
  background: currentColor;
}

.speaker-core::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
}

.speaker-wave::before,
.speaker-wave::after {
  content: "";
  position: absolute;
  border: 2px solid currentColor;
  border-left: 0;
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-radius: 0 999px 999px 0;
}

.speaker-wave::before {
  left: 16px;
  top: 5px;
  width: 4px;
  height: 8px;
}

.speaker-wave::after {
  left: 18px;
  top: 2px;
  width: 6px;
  height: 14px;
  opacity: 0.72;
}

.global-sound-button.muted,
.phrase-sound-button.muted {
  color: var(--danger);
}

.global-sound-button.muted .speaker-wave,
.phrase-sound-button.muted .speaker-wave {
  display: none;
}

.global-sound-button.muted .speaker-icon::after,
.phrase-sound-button.muted .speaker-icon::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 8px;
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(-38deg);
  transform-origin: center;
}

.phrase-sound-button.global-muted {
  opacity: 0.45;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.search-panel {
  margin-bottom: 12px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.search-row input {
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
  font-weight: 760;
}

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

.search-results {
  display: grid;
  gap: 8px;
  max-height: 290px;
  margin-top: 9px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  contain: content;
}

.search-result-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 3px;
  padding: 0;
  background: transparent;
  text-align: left;
}

.search-word,
.search-prompt {
  overflow-wrap: anywhere;
}

.search-source {
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.2;
}

.search-word {
  font-family: var(--exam-font);
  font-size: 1.12rem;
  font-weight: 850;
  line-height: 1.16;
}

.search-prompt {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.search-title {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.difficulty-chip {
  justify-self: start;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(31, 118, 104, 0.1);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 850;
}

.search-add-button {
  min-width: 82px;
  min-height: 40px;
  padding: 0 9px;
  border: 1px solid rgba(31, 118, 104, 0.22);
  background: rgba(31, 118, 104, 0.08);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 850;
}

.search-add-button.selected {
  background: var(--accent);
  color: white;
}

.search-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-weight: 750;
}

.tab-button {
  min-height: 40px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.tab-button.active {
  background: var(--ink);
  color: #fffaf0;
  box-shadow: 0 10px 24px rgba(30, 33, 31, 0.14);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.progress-row {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.progress-track {
  height: 7px;
  margin-bottom: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(30, 33, 31, 0.1);
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
  will-change: width;
}

.jump-row {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.jump-field {
  min-width: 0;
  min-height: 36px;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
}

.jump-field span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.jump-field input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 850;
}

.learn-free-fall-button {
  width: 100%;
  min-height: 38px;
  margin-bottom: 12px;
}

.word-stage {
  min-height: 218px;
  display: grid;
  grid-template-rows: auto minmax(112px, 1fr);
  padding: 15px;
  border: 1px solid rgba(30, 33, 31, 0.09);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(232, 241, 237, 0.52)),
    var(--panel);
  box-shadow: var(--shadow);
  user-select: none;
}

.word-index {
  justify-self: start;
  min-width: 42px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 850;
  text-align: center;
}

.word-main {
  align-self: center;
  text-align: center;
}

.part {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 750;
}

#wordText {
  margin-top: 10px;
  font-family: var(--exam-font);
  font-size: 3.08rem;
  font-weight: 700;
  line-height: 1;
  overflow-wrap: anywhere;
}

.phonetic {
  margin-top: 10px;
  color: var(--accent-strong);
  font-size: 1.05rem;
  font-weight: 750;
}

.tap-hint {
  display: none;
}

.meaning-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.panel-heading {
  margin-bottom: 10px;
}

.panel-heading h3,
.review-head h2 {
  font-size: 0.98rem;
}

.ghost-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 800;
}

.ghost-button.danger {
  color: var(--danger);
}

.meaning-list,
.review-list,
.review-meanings {
  display: grid;
  gap: 9px;
}

.meaning-card {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  text-align: left;
  contain: content;
}

.meaning-card.selected {
  border-color: rgba(31, 118, 104, 0.44);
  background: var(--accent-soft);
}

.check-button {
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  align-self: start;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.meaning-toggle {
  min-height: 32px;
  padding: 0;
  background: transparent;
  text-align: left;
}

.check-dot {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(30, 33, 31, 0.24);
  border-radius: 50%;
}

.meaning-card.selected .check-dot {
  border-color: var(--accent);
  background:
    radial-gradient(circle at center, var(--accent) 0 42%, transparent 44%),
    #fff;
}

.meaning-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.meaning-prompt,
.review-prompt {
  font-family: var(--exam-font);
  font-size: 1.14rem;
  line-height: 1.25;
}

.meaning-hidden {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.meaning-hidden:empty,
.hidden-line:empty,
.free-fall-hidden:empty {
  display: none;
}

.meaning-details {
  display: grid;
  gap: 6px;
}

.meaning-card:not(.revealed) .meaning-details {
  display: none;
}

.meaning-card.revealed .meaning-hidden {
  display: none;
}

.meaning-title {
  font-size: 1rem;
  line-height: 1.42;
}

.meaning-card .note-toggle,
.meaning-card .note-panel,
.meaning-card .difficulty-control {
  grid-column: 2;
}

.note-toggle {
  justify-self: start;
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid rgba(31, 118, 104, 0.18);
  background: rgba(31, 118, 104, 0.07);
  color: rgba(21, 94, 83, 0.82);
  font-size: 0.78rem;
  font-weight: 850;
}

.note-toggle:active {
  background: rgba(31, 118, 104, 0.12);
}

.note-panel {
  width: 100%;
  padding: 8px 10px;
  border-left: 2px solid rgba(31, 118, 104, 0.28);
  border-radius: 6px;
  background: rgba(31, 118, 104, 0.06);
  color: var(--accent-strong);
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-line;
}

.difficulty-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 2px;
}

.difficulty-button {
  min-height: 30px;
  padding: 0 6px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.difficulty-button.active {
  border-color: rgba(31, 118, 104, 0.42);
  background: var(--accent);
  color: white;
}

.meaning-card:not(.revealed) .difficulty-control {
  display: none;
}

.meaning-explain,
.meaning-example,
.meaning-notes,
.review-explain,
.review-example,
.review-notes {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.meaning-example,
.meaning-notes,
.review-example,
.review-notes {
  color: var(--accent-strong);
}

.meaning-title:empty,
.meaning-explain:empty,
.meaning-example:empty,
.meaning-notes:empty,
.review-title:empty,
.review-explain:empty,
.review-example:empty,
.review-notes:empty {
  display: none;
}

.bottom-actions {
  position: sticky;
  bottom: 0;
  margin: 14px -18px -18px;
  padding: 10px 18px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(242, 246, 244, 0.86);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.nav-button,
.primary-button {
  flex: 1;
  font-weight: 850;
}

.nav-button {
  border: 1px solid var(--line);
  background: var(--soft);
}

.primary-button {
  background: var(--accent);
  color: white;
}

.review-head {
  margin: 2px 0 10px;
}

.review-stats {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.review-stats:empty {
  display: none;
}

.review-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.task-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.task-stats article {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.task-stats strong {
  color: var(--accent-strong);
  font-family: var(--exam-font);
  font-size: 1.68rem;
  line-height: 1;
}

.task-stats span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.task-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(30, 33, 31, 0.1);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.88), rgba(232, 241, 237, 0.58)),
    var(--panel);
  box-shadow: var(--shadow);
}

.task-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-progress {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.task-reveal {
  min-height: 260px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 18px 8px;
  background: transparent;
  text-align: center;
}

.task-reveal:active {
  transform: none;
}

#taskWordText {
  font-family: var(--exam-font);
  font-size: 3rem;
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.task-prompt {
  margin-top: 4px;
  font-family: var(--exam-font);
  font-size: 1.22rem;
  font-weight: 850;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.task-title {
  margin-top: 4px;
  font-size: 1.08rem;
  font-weight: 850;
  line-height: 1.42;
}

.task-explain,
.task-example {
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.5;
}

.task-example {
  color: var(--accent-strong);
}

.task-note-panel {
  width: min(100%, 380px);
  text-align: left;
}

.task-rating {
  display: grid;
  gap: 8px;
}

.task-rating-control .difficulty-button {
  min-height: 42px;
  font-size: 0.86rem;
}

.task-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.review-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 28px rgba(24, 45, 40, 0.08);
  contain: content;
}

.review-word {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px;
  border-radius: 0;
  background: rgba(30, 33, 31, 0.94);
  color: #fffaf0;
  text-align: left;
}

.review-word strong {
  display: block;
  font-family: var(--exam-font);
  font-size: 1.42rem;
}

.review-word small {
  display: block;
  margin-top: 4px;
  color: rgba(255, 250, 240, 0.72);
}

.review-meanings {
  padding: 11px;
}

.review-meaning {
  width: 100%;
  min-height: 68px;
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px dashed rgba(30, 33, 31, 0.18);
  background: rgba(255, 255, 255, 0.58);
  text-align: left;
}

.review-meaning-toggle {
  width: 100%;
  min-height: 0;
  display: grid;
  gap: 5px;
  padding: 0;
  background: transparent;
  text-align: left;
}

.review-meaning .difficulty-control {
  margin-top: 4px;
}

.review-title {
  font-weight: 850;
  line-height: 1.45;
}

.review-prompt {
  font-size: 1.1rem;
  font-weight: 850;
}

.remove-meaning-button {
  justify-self: start;
  min-height: 34px;
  margin-top: 6px;
  padding: 0 11px;
  border: 1px solid rgba(178, 71, 60, 0.28);
  background: rgba(178, 71, 60, 0.08);
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 850;
}

.review-note-toggle {
  margin-top: 2px;
}

.hidden-line {
  align-self: center;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  line-height: 1.55;
}

.hidden {
  display: none !important;
}

.free-fall-setup,
.free-fall-mode {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(242, 246, 244, 0.94);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.free-fall-setup {
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 16px;
}

.free-fall-sheet {
  width: min(100%, 520px);
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.setup-field {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.setup-field select,
.setup-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  font: inherit;
}

.setup-start-button {
  width: 100%;
  margin-top: 14px;
}

.free-fall-mode {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  padding: max(14px, env(safe-area-inset-top)) 18px max(10px, env(safe-area-inset-bottom));
}

.free-fall-top {
  width: min(100%, 520px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 auto 12px;
}

.free-fall-elapsed {
  min-width: 52px;
  color: var(--muted);
  font-family: var(--exam-font);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.free-fall-stage {
  width: min(100%, 520px);
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: grid;
  grid-template-rows: auto minmax(140px, auto) 1fr;
  gap: 14px;
  margin: 0 auto;
  padding: 16px;
  border: 1px solid rgba(30, 33, 31, 0.09);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.82), rgba(232, 241, 237, 0.52)),
    var(--panel);
  box-shadow: var(--shadow);
  contain: layout paint;
}

#freeFallWordText {
  margin-top: 10px;
  font-family: var(--exam-font);
  font-size: 3.24rem;
  font-weight: 700;
  line-height: 1;
  overflow-wrap: anywhere;
}

.free-fall-meaning-list {
  display: grid;
  align-content: start;
  gap: 9px;
}

.free-fall-meaning {
  position: relative;
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(30, 33, 31, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  animation: meaningIn 180ms ease;
  contain: content;
}

.free-fall-meaning.revealed {
  border-color: rgba(31, 118, 104, 0.26);
  background: rgba(31, 118, 104, 0.08);
}

.free-fall-meaning.clickable {
  cursor: pointer;
}

.free-fall-meaning.clickable:active {
  transform: translateY(1px);
  will-change: transform;
}

.free-fall-meaning.selected {
  border-color: rgba(31, 118, 104, 0.52);
  background: rgba(31, 118, 104, 0.14);
}

.free-fall-meaning.rolling-selectable {
  padding-right: 38px;
}

.free-fall-meaning .free-fall-round-mark {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(31, 118, 104, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.56);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1;
}

.free-fall-meaning .free-fall-round-mark:empty {
  display: grid;
}

.free-fall-meaning.removable {
  padding-right: 34px;
}

.free-fall-meaning strong {
  font-family: var(--exam-font);
  font-size: 1.12rem;
}

.free-fall-meaning span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.free-fall-hidden {
  font-weight: 800;
  opacity: 0.68;
}

.free-fall-detail {
  animation: meaningIn 180ms ease;
}

.free-fall-difficulty {
  margin-top: 4px;
}

.free-fall-difficulty .difficulty-button {
  min-height: 28px;
  font-size: 0.74rem;
}

.free-fall-note-toggle {
  margin-top: 2px;
}

.free-fall-note-panel {
  width: auto;
  font-size: 0.86rem;
}

.free-fall-note-panel.auto {
  margin-top: 2px;
  padding: 7px 9px;
  border-left-color: rgba(31, 118, 104, 0.18);
  background: rgba(255, 255, 255, 0.42);
  color: rgba(16, 94, 82, 0.78);
  font-size: 0.8rem;
  line-height: 1.48;
}

.free-fall-add {
  justify-self: start;
  margin-top: 2px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(31, 118, 104, 0.12);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 850;
}

.free-fall-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  min-width: 24px;
  min-height: 24px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(178, 71, 60, 0.16);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.42);
  color: rgba(178, 71, 60, 0.52);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1;
}

.free-fall-remove:active {
  color: var(--danger);
  background: rgba(178, 71, 60, 0.08);
}

.rolling-round-summary {
  min-height: 76px;
  display: grid;
  place-items: center;
  padding: 18px;
  border: 1px dashed rgba(31, 118, 104, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
  color: var(--accent-strong);
  font-weight: 850;
  text-align: center;
}

.free-fall-meaning span:empty {
  display: none;
}

.free-fall-meaning .free-fall-round-mark,
.free-fall-meaning .free-fall-round-mark:empty {
  display: grid;
  color: var(--accent-strong);
  font-size: 0.82rem;
  line-height: 1;
}

.free-fall-actions {
  position: static;
  width: min(100%, 520px);
  margin: 10px auto 0;
  padding: 10px 0 0;
  transform: none;
}

@keyframes meaningIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 370px) {
  .app-shell {
    padding-inline: 12px;
  }

  #wordText {
    font-size: 2.92rem;
  }

  #freeFallWordText {
    font-size: 2.92rem;
  }

  #taskWordText {
    font-size: 2.74rem;
  }

  .word-stage {
    min-height: 226px;
  }

  .review-controls,
  .task-stats {
    grid-template-columns: 1fr 1fr;
  }

  .bottom-actions {
    margin-inline: -12px;
    padding-inline: 12px;
  }
}

@media (max-width: 430px) {
  .search-result {
    grid-template-columns: minmax(0, 1fr);
  }

  .search-add-button {
    width: 100%;
  }
}

.focus-exit-button {
  position: fixed;
  top: max(10px, env(safe-area-inset-top));
  right: 12px;
  z-index: 40;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(31, 118, 104, 0.18);
  background: rgba(255, 255, 255, 0.76);
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 850;
  box-shadow: 0 10px 24px rgba(24, 45, 40, 0.08);
}

body.focus-mode .topbar,
body.focus-mode .collection-switch,
body.focus-mode .library-bar,
body.focus-mode .tool-strip,
body.focus-mode .segmented,
body.focus-mode .search-panel,
body.focus-mode .progress-row,
body.focus-mode .progress-track,
body.focus-mode .jump-row,
body.focus-mode .learn-free-fall-button {
  display: none;
}

body.focus-mode .app-shell {
  padding-top: max(12px, env(safe-area-inset-top));
}

body.focus-mode .word-stage {
  min-height: 238px;
}

body.focus-mode .meaning-panel {
  margin-top: 12px;
}

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