:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #17201b;
  --muted: #637066;
  --line: #dce3e1;
  --green: #17825b;
  --green-soft: #dff4ea;
  --red: #c83e43;
  --red-soft: #fae3e4;
  --blue: #2d7188;
  --blue-soft: #e3f1f5;
  --yellow: #f4c95d;
  --shadow: 0 18px 40px rgba(32, 44, 38, 0.09);
  --shadow-soft: 0 7px 20px rgba(32, 44, 38, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 0%, rgba(45, 113, 136, 0.1), transparent 34%),
    radial-gradient(circle at 86% 8%, rgba(244, 201, 93, 0.13), transparent 28%),
    var(--bg);
  font-family: "Segoe UI", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(200, 62, 67, 0.1), transparent 32%),
    radial-gradient(circle at 86% 8%, rgba(244, 201, 93, 0.2), transparent 30%),
    #f1ece1;
  transition: opacity 180ms ease;
}

body.challenge-active::before {
  opacity: 1;
}

.app-shell {
  position: relative;
  z-index: 1;
}

body.dialog-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
}

body.word-detail-open {
  overflow: hidden;
  overscroll-behavior: contain;
}

body.dialog-open .app-shell {
  min-height: 100dvh;
}

body.dialog-open .screen {
  filter: blur(4px);
}

body.challenge-active {
  color: #26312d;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  transition:
    transform 170ms cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 170ms ease,
    border-color 170ms ease,
    background 170ms ease,
    opacity 170ms ease,
    filter 170ms ease;
}

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

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

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(45, 113, 136, 0.28);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  transform: none;
}

body:not(.study-active) button:hover:not(:disabled) {
  transform: translateY(-1px);
}

body:not(.study-active) button:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
  filter: brightness(0.97);
}

body:not(.study-active) .text-button:active:not(:disabled) {
  transform: translateY(0) scale(0.98);
}

.app-shell {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 52px;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
  animation: screen-enter 280ms cubic-bezier(0.18, 0.86, 0.24, 1) both;
}

body.study-active .app-shell {
  display: flex;
  flex-direction: column;
  padding-top: 10px;
}

body.study-active #study-screen.is-active {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
  animation: none;
}

body.study-active.study-input-active #study-screen.is-active {
  display: block;
  overflow: visible;
}

@keyframes screen-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.992);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen.is-active {
    animation: none;
  }

  .bookmark-current-button.is-bouncing,
  .result-summary span,
  .deck-card,
  .settings-block,
  .dialog-panel,
  .dialog-backdrop,
  .word-list-card {
    animation: none;
  }

  button {
    transition: none;
  }
}

body.study-active {
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

body.study-active.study-input-active {
  overflow: auto;
  overscroll-behavior: auto;
}

body.study-active .app-shell {
  height: 100dvh;
  overflow: hidden;
  padding-bottom: 10px;
}

body.study-active.study-input-active .app-shell {
  height: auto;
  min-height: 100dvh;
  overflow: visible;
}

body.study-active.study-cloze-active.study-input-active .app-shell {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
}

.topbar,
.study-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar.compact {
  justify-content: flex-start;
}

.topbar-title {
  min-width: 0;
}

.setup-header-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.setup-list-button {
  white-space: nowrap;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 4rem;
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  font-size: 1rem;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.icon-button,
.primary-button,
.secondary-button,
.danger-button,
.text-button,
.quit-button,
.choice-button,
.mode-button {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
}

.icon-button {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--surface);
  background: var(--ink);
  font-size: 1.35rem;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.file-button input {
  display: none;
}

.primary-button,
.secondary-button,
.danger-button {
  padding: 12px 18px;
  font-weight: 800;
}

.primary-button {
  color: white;
  background: linear-gradient(180deg, #233129, var(--ink));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 10px 24px rgba(23, 32, 27, 0.18);
}

.deck-actions .primary-button {
  border: 1px solid rgba(23, 130, 91, 0.26);
  background: linear-gradient(180deg, #1f8b65, #146d4e);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 11px 24px rgba(23, 130, 91, 0.2);
}

.deck-actions .primary-button:hover:not(:disabled) {
  background: linear-gradient(180deg, #259a72, #147452);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 13px 28px rgba(23, 130, 91, 0.24);
}

.primary-button.is-disabled,
.primary-button:disabled {
  color: #7a8780;
  background: #d9dfdc;
  box-shadow: none;
}

.secondary-button {
  border: 1px solid rgba(181, 193, 187, 0.9);
  color: var(--ink);
  background: linear-gradient(180deg, #fbfdfc, #e4ebe8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    0 8px 18px rgba(32, 44, 38, 0.08);
}

.secondary-button:hover:not(:disabled) {
  border-color: rgba(126, 143, 134, 0.85);
  background: linear-gradient(180deg, #ffffff, #dce6e2);
}

.secondary-button:disabled {
  color: #7a8780;
  background: #edf1ef;
  box-shadow: none;
}

.danger-button {
  color: white;
  background: linear-gradient(180deg, #d14c51, var(--red));
  box-shadow: 0 10px 24px rgba(200, 62, 67, 0.2);
}

.danger-button:disabled {
  color: #9a7e80;
  background: #eadcdf;
  box-shadow: none;
}

.dialog-actions .danger-button {
  order: 1;
}

.dialog-actions .secondary-button {
  order: 2;
}

.small {
  min-height: 38px;
  padding: 8px 12px;
}

.wide {
  width: 100%;
  margin-top: 20px;
}

.text-button {
  padding: 9px 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.quit-button {
  min-width: 86px;
  padding: 9px 14px;
  border: 1px solid rgba(200, 62, 67, 0.28);
  color: #9f2f34;
  background: rgba(250, 227, 228, 0.72);
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}

.quit-button:hover:not(:disabled) {
  border-color: rgba(200, 62, 67, 0.48);
  background: var(--red-soft);
}

.import-panel,
.deck-card,
.settings-block,
.question-card,
.result-summary,
.wrong-section {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(212, 220, 216, 0.92);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

body.challenge-active .import-panel,
body.challenge-active .deck-card,
body.challenge-active .question-card,
body.challenge-active .result-summary,
body.challenge-active .wrong-section {
  border-color: rgba(176, 132, 56, 0.26);
  background: rgba(255, 252, 244, 0.92);
  box-shadow: 0 16px 38px rgba(91, 63, 28, 0.12);
}

body.challenge-active .study-status {
  background: rgba(241, 236, 225, 0.94);
}

body.challenge-active .eyebrow,
body.challenge-active .start-note,
body.challenge-active .wrong-list,
body.challenge-active .result-summary p,
body.challenge-active .answer-note,
body.challenge-active .challenge-toggle small {
  color: #6f665b;
}

body.challenge-active .mode-button,
body.challenge-active .range-toggle,
body.challenge-active .range-all-button,
body.challenge-active .secondary-button,
body.challenge-active .choice-button,
body.challenge-active .answer-input {
  border-color: rgba(146, 104, 42, 0.42);
  color: #26312d;
  background: linear-gradient(180deg, #fffaf0, #f4ead6);
  box-shadow: 0 8px 20px rgba(91, 63, 28, 0.12);
}

body.challenge-active .mode-button.is-selected {
  border-color: rgba(123, 67, 45, 0.72);
  color: #ffffff;
  background: linear-gradient(180deg, #a86942, #7b432d);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 9px 22px rgba(91, 63, 28, 0.2);
}

body.challenge-active #mode-options .mode-button.is-selected,
body.challenge-active #count-options .mode-button.is-selected {
  filter: none;
}

body.challenge-active .range-summary-card,
body.challenge-active .range-stage {
  border-color: rgba(176, 132, 56, 0.28);
  background: rgba(255, 252, 244, 0.9);
  box-shadow: 0 10px 24px rgba(91, 63, 28, 0.1);
}

body.challenge-active .dialog-panel,
body.challenge-active .bookmark-item {
  border-color: rgba(176, 132, 56, 0.28);
  background: rgba(255, 252, 244, 0.96);
}

body.challenge-active .dialog-panel {
  box-shadow: 0 28px 70px rgba(91, 63, 28, 0.24);
}

body.challenge-active .bookmark-group h3 {
  color: #7b432d;
}

body.challenge-active .bookmark-dialog-head,
body.challenge-active .range-dialog-head,
body.challenge-active .favorite-preset-dialog-head {
  background: transparent;
}

body.challenge-active .range-dialog-head h2,
body.challenge-active .bookmark-dialog-head h2,
body.challenge-active .favorite-preset-dialog-head h2 {
  color: #5a2f22;
}

body.challenge-active .range-toolbar {
  border-color: rgba(176, 132, 56, 0.24);
  background: linear-gradient(180deg, rgba(255, 252, 244, 0.94), rgba(248, 238, 216, 0.82));
}

body.challenge-active .setup-list-button {
  border-color: rgba(146, 104, 42, 0.42);
  color: #26312d;
  background: linear-gradient(180deg, #fffaf0, #f4ead6);
  box-shadow: 0 8px 20px rgba(91, 63, 28, 0.12);
}

body.challenge-active .study-metrics span,
body.challenge-active .study-metrics strong,
body.challenge-active .bookmark-current-button {
  border-color: rgba(176, 132, 56, 0.32);
  color: #5a2f22;
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.96), rgba(244, 234, 214, 0.9));
  box-shadow: 0 9px 22px rgba(91, 63, 28, 0.14);
}

body.challenge-active .bookmark-current-button span {
  color: #8d765f;
}

body.challenge-active .study-metrics strong {
  color: #7b3026;
}

body.challenge-active .bookmark-current-button.is-bookmarked {
  border-color: rgba(180, 100, 56, 0.56);
  color: #5a2f22;
  background: linear-gradient(180deg, #f8dcc8, #efc0aa);
  box-shadow: 0 10px 24px rgba(91, 63, 28, 0.18);
}

body.challenge-active .bookmark-current-button.is-bookmarked span {
  color: #5a2f22;
}

body.challenge-active .range-stage-options .mode-button.is-selected {
  border-color: rgba(180, 100, 56, 0.58);
  color: #5a2f22;
  background: #f8dcc8;
  box-shadow: inset 0 0 0 1px rgba(180, 100, 56, 0.16);
}

body.challenge-active .range-all-button.is-selected,
body.challenge-active .range-toggle.is-selected {
  border-color: rgba(123, 67, 45, 0.72);
  color: #ffffff;
  background: linear-gradient(180deg, #a86942, #7b432d);
  box-shadow: 0 9px 22px rgba(91, 63, 28, 0.2);
}

body.challenge-active .range-stage-options .mode-button.is-selected::before {
  border-color: #8d5a38;
  background: #8d5a38;
}

body.challenge-active .primary-button {
  color: #ffffff;
  background: linear-gradient(180deg, #8d5a38, #683d2b);
  box-shadow: 0 10px 24px rgba(91, 63, 28, 0.18);
}

body.challenge-active .danger-button {
  color: #ffffff;
  background: linear-gradient(180deg, #b84f48, #8f342f);
  box-shadow: 0 10px 24px rgba(91, 63, 28, 0.18);
}

body.challenge-active .danger-button:disabled {
  color: #9b8276;
  background: #eadfd5;
  box-shadow: none;
}

body.challenge-active .choice-button.correct,
body.challenge-active .answer-display.is-correct {
  color: #0d5f42;
  background: #dff4ea;
}

body.challenge-active .choice-button.wrong,
body.challenge-active .answer-display.is-wrong {
  color: #9f2f34;
  background: #fae3e4;
}

.import-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 18px;
}

.import-panel p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.7;
}

.import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.import-actions .secondary-button {
  min-width: 132px;
}

code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #eef1ed;
}

.deck-list {
  display: grid;
  gap: 14px;
}

.deck-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  animation: panel-rise 260ms cubic-bezier(0.18, 0.86, 0.24, 1) both;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.deck-card:nth-child(2) {
  animation-delay: 35ms;
}

.deck-card:nth-child(3) {
  animation-delay: 70ms;
}

.deck-card:hover {
  transform: translateY(-2px);
  border-color: rgba(45, 113, 136, 0.24);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.deck-card p {
  margin-top: 6px;
  color: var(--muted);
}

.deck-actions,
.result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.empty-state {
  padding: 36px 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.settings-grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

#setup-screen {
  overflow-anchor: none;
}

.detail-settings-grid {
  padding-bottom: 12px;
}

.settings-block {
  padding: 20px;
  min-width: 0;
  animation: panel-rise 260ms cubic-bezier(0.18, 0.86, 0.24, 1) both;
  transition:
    border-color 170ms ease,
    box-shadow 170ms ease;
}

#setup-screen .settings-block {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(212, 220, 216, 0.92);
  box-shadow: var(--shadow-soft);
}

body.challenge-active #setup-screen .settings-block {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(212, 220, 216, 0.92);
  box-shadow: var(--shadow-soft);
}

.settings-block:nth-child(2) {
  animation-delay: 35ms;
}

.settings-block:nth-child(3) {
  animation-delay: 70ms;
}

.settings-block:nth-child(4) {
  animation-delay: 105ms;
}

.settings-block:nth-child(5) {
  animation-delay: 140ms;
}

.settings-block:nth-child(6) {
  animation-delay: 175ms;
}

.settings-block:nth-child(7) {
  animation-delay: 210ms;
}

.settings-block:nth-child(8) {
  animation-delay: 245ms;
}

.settings-block h2 {
  margin-bottom: 12px;
}

.range-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(212, 220, 216, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.range-summary-card > div {
  min-width: 0;
}

.range-summary-card strong {
  display: block;
  margin-top: 2px;
  font-size: 1.2rem;
  line-height: 1.2;
}

.range-summary-card p:last-child {
  margin-top: 5px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.range-summary-card .secondary-button {
  flex: 0 0 auto;
}

.bookmark-panel-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.bookmark-panel-head h2 {
  margin-bottom: 4px;
}

.bookmark-panel-head p {
  color: var(--muted);
  font-weight: 800;
}

.bookmark-panel-head p strong {
  color: var(--ink);
  font-size: 1.15rem;
}

.bookmark-panel-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.dialog-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.bookmark-panel-actions .secondary-button {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 10px 12px;
  border-color: rgba(181, 193, 187, 0.9);
  color: var(--ink);
  background: linear-gradient(180deg, #fbfdfc, #e4ebe8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    0 8px 18px rgba(32, 44, 38, 0.08);
  font-size: 0.92rem;
  line-height: 1.2;
}

.bookmark-list-open-button {
  width: 100%;
  margin-top: 10px;
  min-height: 48px;
}

.bookmark-panel-actions .secondary-button:hover:not(:disabled) {
  border-color: rgba(126, 143, 134, 0.85);
  background: linear-gradient(180deg, #ffffff, #dce6e2);
}

.bookmark-panel.is-filtered {
  position: relative;
  border-color: rgba(200, 62, 67, 0.24);
  background: linear-gradient(90deg, rgba(250, 227, 228, 0.72), rgba(255, 255, 255, 0.86) 34%);
}

.bookmark-panel.is-filtered::before {
  content: "復習セット";
  position: absolute;
  top: -11px;
  left: 14px;
  padding: 3px 9px;
  border-radius: 999px;
  color: #9f2f34;
  background: #fae3e4;
  font-size: 0.72rem;
  font-weight: 900;
}

.bookmark-panel.is-filtered .bookmark-panel-actions .secondary-button.is-selected {
  color: #9f2f34;
  border-color: rgba(200, 62, 67, 0.38);
  background: rgba(250, 227, 228, 0.9);
  box-shadow: inset 0 0 0 1px rgba(200, 62, 67, 0.12), var(--shadow-soft);
}

body.challenge-active .bookmark-panel-actions .secondary-button {
  border-color: rgba(146, 104, 42, 0.42);
  color: #26312d;
  background: linear-gradient(180deg, #fffaf0, #f4ead6);
  box-shadow: 0 8px 20px rgba(91, 63, 28, 0.12);
}

body.challenge-active .bookmark-panel.is-filtered {
  border-color: rgba(157, 77, 54, 0.36);
  background: linear-gradient(90deg, rgba(248, 220, 200, 0.84), rgba(255, 252, 244, 0.94) 40%);
}

body.challenge-active .bookmark-panel.is-filtered .bookmark-panel-actions .secondary-button.is-selected {
  border-color: rgba(157, 77, 54, 0.48);
  color: #7b3026;
  background: linear-gradient(180deg, #f8dcc8, #efc0aa);
  box-shadow: inset 0 0 0 1px rgba(157, 77, 54, 0.12), 0 8px 20px rgba(91, 63, 28, 0.12);
}

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

.review-list-tabs .secondary-button.is-selected {
  border-color: var(--blue);
  color: #163846;
  background: linear-gradient(180deg, #eff9fb, var(--blue-soft));
  box-shadow:
    inset 0 0 0 1px rgba(45, 113, 136, 0.18),
    0 8px 18px rgba(45, 113, 136, 0.1);
}

body.challenge-active .review-list-tabs .secondary-button.is-selected {
  border-color: rgba(123, 67, 45, 0.72);
  color: #ffffff;
  background: linear-gradient(180deg, #a86942, #7b432d);
  box-shadow: 0 8px 18px rgba(91, 63, 28, 0.18);
}

.bookmark-list {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 112, 102, 0.56) transparent;
}

.bookmark-list::-webkit-scrollbar {
  width: 8px;
}

.bookmark-list::-webkit-scrollbar-track {
  background: transparent;
}

.bookmark-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(99, 112, 102, 0.52);
}

body.challenge-active .bookmark-list {
  scrollbar-color: rgba(141, 90, 56, 0.58) transparent;
}

body.challenge-active .bookmark-list::-webkit-scrollbar-thumb {
  background: rgba(141, 90, 56, 0.54);
}

.bookmark-dialog-head,
.range-dialog-head,
.favorite-preset-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.bookmark-dialog-head h2,
.range-dialog-head h2,
.favorite-preset-dialog-head h2 {
  font-size: 1.35rem;
}

.bookmark-group {
  display: grid;
  gap: 8px;
}

.bookmark-group h3 {
  margin: 0;
  color: var(--blue);
  font-size: 0.9rem;
}

.bookmark-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 180px);
  gap: 8px;
}

.bookmark-item {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  height: 132px;
  min-height: 132px;
  padding: 10px;
  border: 1px solid rgba(217, 223, 216, 0.86);
  border-radius: 8px;
  background: #fbfcfc;
  overflow: hidden;
}

.bookmark-item.has-answer {
  height: 148px;
  min-height: 148px;
}

.bookmark-item > div {
  min-width: 0;
  overflow: hidden;
}

.bookmark-item strong,
.bookmark-item span {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
}

.bookmark-item strong {
  line-height: 1.25;
  -webkit-line-clamp: 2;
}

.bookmark-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.32;
  -webkit-line-clamp: 1;
}

.bookmark-item .bookmark-item-answer {
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  -webkit-line-clamp: 1;
}

body.challenge-active .bookmark-item .bookmark-item-answer {
  color: #7b432d;
}

.bookmark-item .secondary-button {
  min-height: 32px;
  padding: 5px 10px;
}

.word-list-screen {
  min-width: 0;
  overflow-anchor: none;
}

.word-list-topbar {
  align-items: center;
}

.word-list-search {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0;
  gap: 10px;
  padding: 10px 0 14px;
  margin-bottom: 8px;
  background: rgba(244, 246, 248, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.word-search-close-button {
  width: 0;
  min-width: 0;
  min-height: 48px;
  padding: 0;
  border-radius: 999px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  white-space: nowrap;
  transition:
    opacity 160ms ease,
    width 180ms ease,
    padding 180ms ease;
}

.word-list-screen.is-searching .word-list-search {
  grid-template-columns: minmax(0, 1fr) auto;
}

.word-list-screen.is-searching .word-search-close-button {
  width: auto;
  min-width: 74px;
  padding: 0 14px;
  opacity: 1;
  pointer-events: auto;
}

body.challenge-active .word-list-search {
  background: rgba(241, 236, 225, 0.94);
}

.word-search-field {
  position: relative;
  min-width: 0;
}

.word-list-search input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 42px 0 14px;
  border: 1px solid rgba(188, 199, 194, 0.95);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  font-weight: 800;
}

.word-list-search input::-webkit-search-cancel-button,
.word-list-search input::-webkit-search-decoration {
  display: none;
}

.word-search-clear-button {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 32px;
  height: 32px;
  min-height: 32px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(220, 227, 225, 0.78);
  box-shadow: none;
  font-size: 1rem;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(0.92);
  transition:
    opacity 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.word-list-screen.is-searching.has-search-query .word-search-clear-button {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}

body.challenge-active .word-list-search input {
  border-color: rgba(146, 104, 42, 0.42);
  color: #26312d;
  background: rgba(255, 250, 240, 0.96);
  box-shadow: 0 8px 20px rgba(91, 63, 28, 0.12);
}

body.challenge-active .word-search-clear-button {
  color: #6f665b;
  background: rgba(244, 234, 214, 0.92);
}

.word-search-filters {
  display: grid;
  gap: 10px;
  margin: -2px 0 12px;
  animation: list-panel-enter 180ms ease both;
}

.word-search-filter-group {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(217, 223, 216, 0.82);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 7px 18px rgba(32, 44, 38, 0.06);
}

body.challenge-active .word-search-filter-group {
  border-color: rgba(176, 132, 56, 0.26);
  background: rgba(255, 252, 244, 0.9);
  box-shadow: 0 8px 18px rgba(91, 63, 28, 0.08);
}

.word-search-filter-group h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.word-search-filter-options {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 112, 102, 0.5) transparent;
}

.word-search-filter-options::-webkit-scrollbar {
  height: 7px;
}

.word-search-filter-options::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(99, 112, 102, 0.45);
}

body.challenge-active .word-search-filter-options {
  scrollbar-color: rgba(141, 90, 56, 0.5) transparent;
}

body.challenge-active .word-search-filter-options::-webkit-scrollbar-thumb {
  background: rgba(141, 90, 56, 0.48);
}

.word-search-filter-button {
  flex: 0 0 112px;
  width: 112px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(188, 199, 194, 0.95);
  border-radius: 999px;
  color: var(--ink);
  background: linear-gradient(180deg, #f7faf8, #dfe8e4);
  box-shadow: 0 6px 16px rgba(32, 44, 38, 0.08);
  font-size: 0.86rem;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.word-search-filter-button.is-selected {
  border-color: var(--blue);
  color: #ffffff;
  background: linear-gradient(180deg, #327f98, #25677d);
  box-shadow: 0 8px 18px rgba(45, 113, 136, 0.18);
}

body.challenge-active .word-search-filter-button {
  border-color: rgba(146, 104, 42, 0.42);
  color: #26312d;
  background: linear-gradient(180deg, #fffaf0, #f4ead6);
  box-shadow: 0 6px 16px rgba(91, 63, 28, 0.1);
}

body.challenge-active .word-search-filter-button.is-selected {
  border-color: rgba(123, 67, 45, 0.72);
  color: #ffffff;
  background: linear-gradient(180deg, #a86942, #7b432d);
  box-shadow: 0 8px 18px rgba(91, 63, 28, 0.18);
}

.word-list-content,
.word-search-results {
  display: grid;
  gap: 12px;
}

.word-list-content,
.word-search-results {
  animation: list-panel-enter 180ms ease both;
}

.word-search-results.is-refreshing .word-list-card,
.word-search-results.is-refreshing .empty-state {
  animation: search-result-enter 140ms ease both;
}

.word-stage,
.word-part {
  border: 1px solid rgba(217, 223, 216, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
  overflow: visible;
  overflow-anchor: none;
}

.word-stage {
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.word-stage.is-open {
  border-color: rgba(45, 113, 136, 0.24);
  box-shadow: var(--shadow);
}

.word-stage.is-closing {
  border-color: rgba(217, 223, 216, 0.9);
  box-shadow: var(--shadow-soft);
  transition: none;
}

body.challenge-active .word-stage,
body.challenge-active .word-part {
  border-color: rgba(176, 132, 56, 0.28);
  background: rgba(255, 252, 244, 0.92);
  box-shadow: 0 10px 24px rgba(91, 63, 28, 0.1);
}

.word-stage-summary,
.word-part-summary {
  width: 100%;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

.word-stage-summary,
.word-part-summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 12px 44px 12px 14px;
  font-weight: 900;
  transition:
    background 170ms ease,
    color 170ms ease,
    border-color 170ms ease,
    transform 150ms ease;
}

.word-stage-summary:active,
.word-part-summary:active {
  transform: scale(0.995);
}

.word-stage-summary::after,
.word-part-summary::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  opacity: 0.62;
  transform: translateY(-62%) rotate(45deg);
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.word-stage.is-open > .word-stage-summary::after,
.word-stage.is-closing > .word-stage-summary::after,
.word-part.is-open > .word-part-summary::after {
  opacity: 0.9;
  transform: translateY(-35%) rotate(225deg);
}

.word-stage-summary {
  position: sticky;
  top: 72px;
  z-index: 6;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #eef3f1);
}

.word-stage.is-open > .word-stage-summary {
  border-bottom: 1px solid rgba(217, 223, 216, 0.9);
  border-radius: 8px 8px 0 0;
}

.word-stage.is-closing > .word-stage-summary {
  border-bottom: 0;
  border-radius: 8px;
}

.word-part-summary {
  position: sticky;
  top: 126px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.94);
}

body.challenge-active .word-stage-summary {
  color: #5a2f22;
  background: linear-gradient(180deg, #fffaf0, #f4ead6);
}

body.challenge-active .word-part-summary {
  color: #5a2f22;
  background: rgba(255, 252, 244, 0.96);
}

.word-stage-summary span,
.word-part-summary span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.word-stage-summary strong,
.word-part-summary strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
}

.word-stage-body {
  box-sizing: border-box;
  display: grid;
  gap: 10px;
  padding: 10px;
}

.word-stage-body[hidden],
.word-card-grid[hidden] {
  display: none;
}

.word-stage.is-animating > .word-stage-body,
.word-part.is-animating > .word-card-grid {
  min-height: 0;
  overflow: hidden;
  will-change: height, opacity;
  transition:
    height 220ms cubic-bezier(0.22, 0.72, 0.18, 1),
    opacity 160ms ease;
}

.word-stage.is-closing > .word-stage-body,
.word-part.is-closing > .word-card-grid {
  transition:
    height 220ms cubic-bezier(0.32, 0, 0.24, 1),
    opacity 150ms ease;
}

.word-stage.is-closing > .word-stage-body {
  transition:
    height 260ms cubic-bezier(0.32, 0, 0.24, 1),
    opacity 170ms ease;
}

.word-stage.is-stage-closing > .word-stage-body {
  overflow: hidden;
  pointer-events: none;
  transition:
    height 230ms cubic-bezier(0.28, 0, 0.18, 1),
    opacity 120ms ease;
}

.word-stage.is-stage-fading > .word-stage-body {
  transition: opacity 120ms ease;
}

.word-stage.is-stage-compact-closing > .word-stage-body {
  overflow: hidden;
  pointer-events: none;
  transition:
    height 130ms cubic-bezier(0.32, 0, 0.2, 1),
    opacity 90ms ease;
}

.word-part.is-open > .word-part-summary {
  border-bottom: 1px solid rgba(217, 223, 216, 0.9);
}

.word-card-grid {
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  padding: 10px;
}

.word-card-grid-search {
  padding: 0;
}

.word-list-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  height: 146px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(212, 220, 216, 0.9);
  border-radius: 8px;
  background: #fcfdfd;
  box-shadow: 0 6px 16px rgba(32, 44, 38, 0.055);
  contain: content;
  content-visibility: auto;
  contain-intrinsic-size: 146px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.word-list-card:active {
  transform: scale(0.992);
}

body.challenge-active .word-list-card {
  border-color: rgba(176, 132, 56, 0.28);
  background: rgba(255, 252, 244, 0.96);
  box-shadow: 0 8px 18px rgba(91, 63, 28, 0.1);
}

.word-list-card-body {
  min-width: 0;
  overflow: hidden;
}

.word-list-card strong,
.word-list-card span {
  display: block;
  overflow-wrap: anywhere;
}

.word-list-card strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.22;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.word-list-card span {
  display: -webkit-box;
  margin-top: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.32;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.word-list-card .word-list-answer {
  margin-top: 6px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 900;
  -webkit-line-clamp: 1;
}

.word-list-card .word-list-range {
  display: block;
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.15;
  -webkit-line-clamp: 1;
}

body.challenge-active .word-list-card .word-list-range {
  color: #7b432d;
}

.word-list-bookmark-button {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  white-space: nowrap;
}

.word-detail-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.word-detail-panel-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.dialog-panel.word-detail-panel {
  align-self: center;
  justify-self: center;
  width: min(620px, calc(100vw - 32px));
  max-height: min(720px, calc(100dvh - 36px));
  display: grid;
  gap: 14px;
  overflow-y: auto;
  touch-action: pan-y;
}

#word-detail-panel {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  align-items: center;
  justify-items: center;
  background: rgba(18, 27, 23, 0.18);
  touch-action: none;
}

.word-detail-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(217, 223, 216, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

body.challenge-active .word-detail-card {
  border-color: rgba(176, 132, 56, 0.28);
  background: rgba(255, 252, 244, 0.94);
  box-shadow: 0 12px 28px rgba(91, 63, 28, 0.12);
}

.word-detail-range {
  width: fit-content;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--blue);
  background: rgba(229, 241, 238, 0.9);
  font-size: 0.78rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

body.challenge-active .word-detail-range {
  color: #7b432d;
  background: rgba(244, 234, 214, 0.9);
}

.word-detail-block {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(247, 250, 248, 0.78);
}

body.challenge-active .word-detail-block {
  background: rgba(252, 244, 226, 0.68);
}

.word-detail-block h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.word-detail-block p {
  margin: 0;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 850;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.word-detail-main {
  font-size: 1.04rem;
}

.word-detail-bookmark-button {
  width: 100%;
  min-height: 46px;
}

.word-list-bookmark-button.is-bookmarked {
  border-color: rgba(23, 130, 91, 0.34);
  color: #0d5f42;
  background: linear-gradient(180deg, #eefaf4, #dff4ea);
}

body.challenge-active .word-list-bookmark-button.is-bookmarked {
  border-color: rgba(180, 100, 56, 0.56);
  color: #5a2f22;
  background: linear-gradient(180deg, #f8dcc8, #efc0aa);
}

.word-search-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 0;
  color: var(--muted);
  font-weight: 900;
}

.word-search-head span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
}

@keyframes list-panel-enter {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes search-result-enter {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes panel-rise {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.992);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

#mode-options {
  min-height: 70px;
  contain: layout paint;
}

#mode-options .mode-button {
  backface-visibility: hidden;
  transform: translateZ(0);
}

.range-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(217, 223, 216, 0.9);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72));
  box-shadow: var(--shadow-soft);
}

.range-toolbar div {
  display: grid;
  gap: 2px;
}

.range-toolbar span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.range-toolbar strong {
  font-size: 1.15rem;
  line-height: 1;
}

.range-all-button {
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: linear-gradient(180deg, #fbfcfc, #e7eeeb);
  box-shadow: 0 7px 18px rgba(32, 44, 38, 0.09);
  font-weight: 900;
}

.range-all-button.is-selected {
  border-color: rgba(200, 62, 67, 0.28);
  color: #9f2f34;
  background: rgba(250, 227, 228, 0.72);
}

.range-group {
  flex: 0 0 320px;
  max-width: calc(100% - 4px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  scroll-snap-align: start;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.range-group:hover {
  border-color: rgba(45, 113, 136, 0.24);
  background: rgba(255, 255, 255, 0.94);
}

.range-group summary {
  min-height: 60px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  font-weight: 900;
  user-select: none;
}

.range-dialog-panel .range-dialog-head {
  flex: 0 0 auto;
  margin: 0 0 14px;
  padding: 0;
  border-bottom: 0;
  background: var(--surface);
}

.range-dialog-panel .range-toolbar {
  top: auto;
}

.range-dialog-panel .range-group summary {
  grid-template-columns: minmax(0, 1fr) auto auto;
  cursor: default;
}

.range-dialog-panel .range-group summary::before {
  display: none;
}

.range-group summary::-webkit-details-marker {
  display: none;
}

.range-group summary::before {
  content: "›";
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  transform: rotate(90deg);
  transition: transform 140ms ease;
}

.range-group:not([open]) summary::before,
.range-group.is-collapsed summary::before {
  transform: rotate(0deg);
}

.range-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.range-count {
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.range-group summary.is-selected .range-count {
  color: var(--blue);
}

.range-group summary.is-partial .range-count {
  color: var(--green);
}

.range-toggle {
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: linear-gradient(180deg, #fbfcfc, #e7eeeb);
  box-shadow: 0 6px 16px rgba(32, 44, 38, 0.08);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.range-toggle.is-selected {
  border-color: rgba(200, 62, 67, 0.28);
  color: #9f2f34;
  background: rgba(250, 227, 228, 0.72);
}

.range-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 14px 14px 52px;
  max-height: 520px;
  opacity: 1;
  transform: translateY(0);
  transition:
    max-height 220ms ease,
    opacity 160ms ease,
    transform 160ms ease,
    padding 220ms ease;
}

.range-group:not([open]) .range-options,
.range-group.is-collapsed .range-options {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  transform: translateY(-4px);
}

.range-options .mode-button {
  width: 100%;
  min-height: 50px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #eef3f1);
}

.range-options .mode-button::before {
  width: 10px;
  height: 10px;
  left: 14px;
}

#count-options.count-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#count-options.count-grid .mode-button {
  width: 100%;
  min-height: 56px;
}

.time-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 10px;
}

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

.question-order-actions {
  margin-top: 10px;
}

.question-order-actions .secondary-button {
  width: 100%;
}

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

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

.preset-grid .secondary-button {
  width: 100%;
  min-height: 52px;
}

.favorite-preset-menu {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 7px;
  margin-top: 0;
  padding: 8px;
  border: 1px solid rgba(212, 220, 216, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  overflow: auto;
  overscroll-behavior: contain;
}

.favorite-preset-menu.is-hidden {
  display: none;
}

.favorite-preset-menu p {
  margin: 0;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-weight: 850;
}

.favorite-preset-card {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid rgba(181, 193, 187, 0.9);
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(180deg, #fbfdfc, #e4ebe8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    0 8px 20px rgba(32, 44, 38, 0.08);
  text-align: left;
}

.favorite-preset-card strong,
.favorite-preset-card span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-preset-card strong {
  font-weight: 950;
}

.favorite-preset-card span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
}

.favorite-preset-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.favorite-preset-form input {
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(181, 193, 187, 0.9);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  font-weight: 800;
}

.favorite-preset-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.favorite-preset-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(212, 220, 216, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.favorite-preset-item div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.favorite-preset-item strong,
.favorite-preset-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-preset-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.data-management-grid .secondary-button {
  width: 100%;
  min-height: 50px;
  line-height: 1.25;
}

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

.setting-toggle {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(212, 220, 216, 0.9);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(247, 250, 248, 0.78));
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.setting-toggle:hover {
  border-color: rgba(45, 113, 136, 0.26);
  box-shadow: var(--shadow-soft);
}

.setting-toggle input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--green);
}

.setting-toggle span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.setting-toggle strong {
  line-height: 1.35;
}

.setting-toggle small {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
}

body.challenge-active .setting-toggle {
  border-color: rgba(176, 132, 56, 0.28);
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.94), rgba(248, 238, 216, 0.82));
}

body.challenge-active .setting-toggle input {
  accent-color: #8d5a38;
}

body.challenge-active .setting-toggle small {
  color: #6f665b;
}

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

.goal-record-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(212, 220, 216, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.goal-record-panel > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.goal-record-panel strong {
  font-weight: 950;
}

.goal-record-panel span {
  color: var(--muted);
  font-weight: 850;
}

.goal-record-panel.is-complete {
  border-color: rgba(23, 130, 91, 0.32);
  background: linear-gradient(180deg, rgba(223, 244, 234, 0.86), rgba(255, 255, 255, 0.8));
}

.goal-progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(212, 220, 216, 0.82);
}

.goal-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width 220ms ease;
}

.goal-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.goal-options .mode-button {
  min-height: 48px;
}

.result-goal-panel {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.result-goal-panel > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.result-goal-panel p {
  color: var(--muted);
  font-weight: 900;
}

.result-goal-panel.is-complete {
  border-color: rgba(23, 130, 91, 0.32);
  background: linear-gradient(180deg, rgba(223, 244, 234, 0.9), rgba(255, 255, 255, 0.88));
}

.record-summary div,
.weakness-card {
  border: 1px solid rgba(212, 220, 216, 0.9);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 250, 248, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.64);
}

.record-summary div {
  padding: 14px 10px;
  text-align: center;
}

.record-summary span {
  display: block;
  font-size: 1.8rem;
  font-weight: 950;
  line-height: 1.05;
}

.record-summary p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

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

.empty-state.compact {
  padding: 20px 12px;
}

.weakness-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.weakness-card div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.weakness-card span {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: var(--blue);
  font-size: 0.82rem;
  font-weight: 950;
}

.weakness-card strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.weakness-card p,
.weakness-card small {
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
}

body.challenge-active .record-summary div,
body.challenge-active .weakness-card,
body.challenge-active .favorite-preset-item,
body.challenge-active .favorite-preset-menu,
body.challenge-active .goal-record-panel {
  border-color: rgba(176, 132, 56, 0.28);
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.94), rgba(248, 238, 216, 0.82));
}

body.challenge-active .favorite-preset-card {
  border-color: rgba(146, 104, 42, 0.42);
  color: #26312d;
  background: linear-gradient(180deg, #fffaf0, #f4ead6);
  box-shadow: 0 8px 20px rgba(91, 63, 28, 0.12);
}

body.challenge-active .goal-record-panel.is-complete {
  border-color: rgba(141, 90, 56, 0.34);
  background: linear-gradient(180deg, rgba(248, 220, 200, 0.84), rgba(255, 252, 244, 0.9));
}

body.challenge-active .weakness-card span {
  background: #8d5a38;
}

body.challenge-active .goal-progress-fill {
  background: linear-gradient(90deg, #8d5a38, #b88146);
}

.time-grid .mode-button {
  min-height: 54px;
}

.mode-button {
  min-height: 70px;
  padding: 12px;
  border: 1px solid rgba(212, 220, 216, 0.95);
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #edf4f1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 7px 18px rgba(32, 44, 38, 0.07);
  font-weight: 800;
}

.mode-button.is-selected {
  border-color: var(--blue);
  color: #163846;
  background: linear-gradient(180deg, #eff9fb, var(--blue-soft));
  box-shadow:
    inset 0 0 0 1px rgba(45, 113, 136, 0.18),
    0 8px 18px rgba(45, 113, 136, 0.1);
}

.challenge-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  cursor: pointer;
}

.challenge-toggle input {
  width: 22px;
  height: 22px;
  accent-color: var(--red);
}

.challenge-toggle span {
  display: grid;
  gap: 2px;
}

.challenge-toggle strong {
  font-size: 1rem;
}

.challenge-toggle small {
  color: var(--muted);
  font-weight: 800;
}

.start-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  align-items: center;
  gap: 14px;
  margin-top: 0;
}

.continue-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border-color: rgba(45, 113, 136, 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(227, 241, 245, 0.62));
}

.continue-panel p {
  margin-top: 5px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
}

.continue-actions {
  display: flex;
  gap: 8px;
}

.continue-actions button {
  min-width: 94px;
}

body.challenge-active .continue-panel {
  border-color: rgba(176, 132, 56, 0.28);
  background: linear-gradient(180deg, rgba(255, 252, 244, 0.96), rgba(244, 234, 214, 0.72));
}

.start-copy {
  display: grid;
  gap: 10px;
}

.start-panel .primary-button {
  width: 100%;
  min-height: 52px;
}

.start-note {
  min-height: 24px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.5;
  transition:
    color 140ms ease,
    opacity 140ms ease,
    transform 140ms ease;
}

.start-note.is-warning {
  color: var(--red);
}

.floating-start-bar {
  display: none;
}

.study-screen {
  min-height: auto;
}

.study-status {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 12px 0 14px;
  background: rgba(244, 246, 248, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

body.study-active .study-status {
  position: static;
  margin-bottom: 0;
}

.time-bar {
  position: relative;
  height: 10px;
  margin: 0 0 14px;
  padding-right: 34px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(217, 223, 216, 0.82);
  box-shadow: inset 0 0 0 1px rgba(188, 199, 194, 0.6);
}

.time-bar-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.time-bar span {
  position: absolute;
  top: 50%;
  right: 10px;
  color: rgba(23, 32, 27, 0.72);
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-50%);
}

.time-bar.is-low .time-bar-fill {
  background: linear-gradient(90deg, #d6a636, #f4c95d);
}

.time-bar.is-critical .time-bar-fill {
  background: linear-gradient(90deg, #d14c51, var(--red));
}

body.challenge-active .time-bar {
  background: rgba(244, 234, 214, 0.9);
  box-shadow: inset 0 0 0 1px rgba(176, 132, 56, 0.22);
}

body.challenge-active .time-bar-fill {
  background: linear-gradient(90deg, #2d7188, #17825b);
}

body.challenge-active .time-bar.is-low .time-bar-fill {
  background: linear-gradient(90deg, #f0b13a, #f4c95d);
}

body.challenge-active .time-bar.is-critical .time-bar-fill {
  background: linear-gradient(90deg, #e05256, #c83e43);
}

body.challenge-active .time-bar.is-low {
  box-shadow:
    inset 0 0 0 1px rgba(214, 166, 54, 0.42),
    0 0 0 2px rgba(244, 201, 93, 0.12);
}

body.challenge-active .time-bar.is-critical {
  box-shadow:
    inset 0 0 0 1px rgba(200, 62, 67, 0.42),
    0 0 0 2px rgba(200, 62, 67, 0.14);
}

.study-metrics {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  color: var(--ink);
  font-weight: 800;
}

.study-metrics .study-hint-button {
  flex: 0 0 auto;
}

.study-metrics span,
.study-metrics strong {
  min-height: 40px;
  display: grid;
  place-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(217, 223, 216, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
}

.study-metrics strong {
  color: var(--blue);
}

.question-card {
  position: relative;
  height: clamp(285px, 38vh, 360px);
  display: grid;
  grid-template-rows: 1fr;
  align-items: center;
  gap: 10px;
  padding: 34px 22px;
  text-align: center;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.question-card.is-cloze-question {
  height: clamp(390px, 50vh, 470px);
}

.question-card .eyebrow {
  position: absolute;
  top: 26px;
  left: 22px;
  right: 22px;
}

.bookmark-current-button {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 1;
  display: inline-flex;
  width: auto;
  height: 46px;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 13px;
  border: 1px solid rgba(217, 223, 216, 0.95);
  border-radius: 8px;
  color: #8b948e;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
  font-size: 0.92rem;
  font-weight: 900;
}

.bookmark-current-button span {
  position: relative;
  width: 12px;
  height: 17px;
  border-radius: 2px 2px 1px 1px;
  color: #8b948e;
  background: currentColor;
}

.bookmark-current-button span::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 7px;
  height: 7px;
  background: inherit;
  transform: translateX(-50%) rotate(45deg);
}

.bookmark-current-button.is-bookmarked {
  border-color: rgba(23, 130, 91, 0.34);
  color: #0d5f42;
  background: linear-gradient(180deg, #eefaf4, #dff4ea);
  box-shadow: 0 10px 24px rgba(23, 130, 91, 0.12);
}

.bookmark-current-button.is-bookmarked span {
  color: #0d5f42;
}

.bookmark-current-button.is-bouncing {
  animation: bookmark-bounce 420ms cubic-bezier(0.2, 0.9, 0.2, 1.2);
}

.study-hint-button {
  position: static;
  height: 40px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid rgba(217, 223, 216, 0.95);
  border-radius: 8px;
  color: #2d7188;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.study-hint-button:disabled {
  opacity: 1;
  color: var(--muted);
  background: rgba(245, 247, 246, 0.9);
}

.study-hint-button.is-active {
  color: #0d5f42;
  background: linear-gradient(180deg, #eefaf4, #dff4ea);
  box-shadow: 0 10px 24px rgba(23, 130, 91, 0.12);
}

body.challenge-active .study-hint-button {
  border-color: rgba(146, 104, 42, 0.42);
  color: #7b432d;
  background: rgba(255, 250, 240, 0.9);
  box-shadow: 0 8px 20px rgba(91, 63, 28, 0.12);
}

body.challenge-active .study-hint-button.is-active {
  color: #5a2f22;
  background: linear-gradient(180deg, #f8dcc8, #efc0aa);
  box-shadow: 0 10px 24px rgba(91, 63, 28, 0.18);
}

.question-text {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 1.18em;
  display: grid;
  place-items: center;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: 4.6rem;
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0;
}

.question-text.is-single-token {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.question-text.is-japanese {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  line-break: strict;
  font-size: 3.35rem;
  line-height: 1.22;
}

.question-text.is-long {
  font-size: 3.7rem;
}

.question-text.is-very-long {
  font-size: 3rem;
}

.question-text.is-extra-long {
  font-size: 2.45rem;
}

.question-text.is-japanese.is-long {
  font-size: 2.72rem;
}

.question-text.is-japanese.is-very-long {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  font-size: 2.38rem;
}

.question-text.is-japanese.is-extra-long {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
  font-size: 2rem;
  line-height: 1.28;
}

.question-text.is-cloze {
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  justify-items: stretch;
  padding: 54px 4px 50px;
  overflow: hidden;
  font-size: clamp(1.52rem, 3.35vw, 2.58rem);
  line-height: 1.35;
  text-align: center;
}

.cloze-layout {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-content: stretch;
  gap: 8px;
  padding: 4px 10px 8px;
  overflow: hidden;
}

.cloze-layout.without-japanese {
  grid-template-rows: minmax(0, 1fr);
}

.cloze-english-scroll,
.cloze-japanese-scroll {
  min-height: 0;
  display: grid;
  align-content: center;
  align-content: safe center;
  overflow: hidden;
  overscroll-behavior: contain;
}

.cloze-english-scroll {
  min-height: calc(2.7em + 12px);
  padding: 4px 10px;
}

.cloze-japanese-scroll {
  min-height: 42px;
  max-height: 64px;
  padding: 0 10px 4px;
}

.cloze-english,
.cloze-japanese {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.cloze-english {
  color: var(--ink);
  font-weight: 950;
  width: min(100%, 34ch);
  margin-inline: auto;
  text-align: left;
}

.cloze-english.is-long {
  font-size: 0.82em;
  line-height: 1.28;
}

.cloze-english.is-very-long {
  font-size: 0.68em;
  line-height: 1.24;
}

.cloze-english.is-extra-long {
  font-size: 0.58em;
  line-height: 1.2;
}

.cloze-japanese {
  color: var(--muted);
  font-size: 0.58em;
  font-weight: 850;
  line-height: 1.5;
  line-break: strict;
  text-align: center;
}

.cloze-japanese.is-long {
  font-size: 0.51em;
  line-height: 1.36;
}

.cloze-japanese.is-very-long {
  font-size: 0.45em;
  line-height: 1.32;
}

.cloze-blank {
  display: inline-block;
  min-width: 3.2em;
  height: 0.9em;
  margin: 0 0.12em;
  padding: 0 0.18em;
  border-bottom: 0.16em solid currentColor;
  color: var(--blue);
  line-height: 1;
  text-align: center;
  vertical-align: -0.02em;
}

.feedback {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 48px;
  height: 62px;
  font-size: 3rem;
  font-weight: 900;
  transform: scale(0.96);
  transition:
    color 140ms ease,
    transform 180ms ease;
}

.feedback.correct {
  color: var(--green);
  -webkit-text-stroke: 1.4px currentColor;
  paint-order: stroke fill;
  transform: scale(1);
}

.feedback.wrong {
  color: var(--red);
  transform: scale(1);
}

.question-card.is-cloze-question .feedback {
  bottom: 54px;
  height: 32px;
  font-size: 1.9rem;
}

.question-card.is-cloze-question .answer-note {
  bottom: 16px;
  min-height: 30px;
}

.answer-note {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 18px;
  min-height: 38px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.35;
  display: grid;
  place-items: center;
  overflow: visible;
  overflow-wrap: anywhere;
  white-space: normal;
  max-width: 100%;
}

.answer-area {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  min-height: 188px;
  align-content: start;
}

body.study-active .answer-area {
  margin-top: 16px;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  gap: 16px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 176px;
}

.choice-button {
  min-height: 82px;
  padding: 14px;
  border: 2px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f1f5f3);
  color: var(--ink);
  font-weight: 850;
  line-height: 1.45;
  box-shadow: 0 9px 22px rgba(32, 44, 38, 0.09);
  overflow-wrap: anywhere;
}

.choice-button.is-long {
  font-size: 0.96rem;
}

.choice-button.is-very-long {
  font-size: 0.9rem;
  line-height: 1.38;
}

.choice-button.is-extra-long {
  font-size: 0.84rem;
  line-height: 1.32;
}

.choice-button.correct {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: 0 12px 26px rgba(23, 130, 91, 0.14);
}

.choice-button.wrong {
  border-color: var(--red);
  background: var(--red-soft);
  box-shadow: 0 12px 26px rgba(200, 62, 67, 0.12);
}

.choice-button.dimmed {
  opacity: 0.45;
}

.choice-button:disabled,
.answer-input:disabled {
  cursor: default;
}

.input-row {
  display: flex;
  gap: 14px;
  min-height: 92px;
  align-items: stretch;
  transition:
    padding-bottom 160ms ease,
    opacity 160ms ease;
}

.input-row.is-answered {
  padding-bottom: 10px;
}

.answer-input {
  width: 100%;
  height: 56px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 1.2rem;
  font-weight: 750;
  box-shadow: var(--shadow-soft);
}

.answer-input:focus,
.answer-input:focus-visible {
  outline: none;
  border-color: rgba(45, 113, 136, 0.46);
  box-shadow:
    0 0 0 3px rgba(45, 113, 136, 0.12),
    var(--shadow-soft);
}

body.challenge-active .answer-input:focus,
body.challenge-active .answer-input:focus-visible {
  border-color: rgba(123, 67, 45, 0.5);
  box-shadow:
    0 0 0 3px rgba(123, 67, 45, 0.12),
    0 8px 20px rgba(91, 63, 28, 0.12);
}

.answer-input:disabled {
  color: var(--muted);
  background: #f5f7f6;
}

.answer-display {
  display: flex;
  align-items: center;
  color: var(--muted);
  background: #f5f7f6;
  user-select: none;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.answer-display.is-correct {
  border-color: var(--green);
  color: #0d5f42;
  background: var(--green-soft);
}

.answer-display.is-wrong {
  border-color: var(--red);
  color: #9f2f34;
  background: var(--red-soft);
}

.input-row .primary-button {
  height: 56px;
  flex: 0 0 112px;
  padding-block: 0;
}

.result-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  margin-bottom: 12px;
}

.result-summary.is-challenge-result {
  grid-template-columns: repeat(2, 1fr);
}

.result-summary.is-challenge-result div:nth-child(3) {
  display: none;
}

.result-summary.is-challenge-result div {
  display: grid;
  min-height: 132px;
  place-items: center;
}

.result-summary.is-challenge-result div p:empty {
  display: none;
}

.result-summary.is-challenge-result div.is-cleared span {
  color: var(--green);
}

.result-summary.is-challenge-result div.is-failed span {
  color: var(--red);
}

.result-actions {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 0 12px;
  border-bottom: 1px solid rgba(217, 223, 216, 0.62);
  margin-bottom: 18px;
  background: rgba(244, 246, 248, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.result-actions button {
  width: 100%;
  min-height: 50px;
  padding-inline: 12px;
}

.result-actions button.is-placeholder {
  visibility: hidden;
  pointer-events: none;
}

.result-actions .secondary-button {
  border-color: rgba(181, 193, 187, 0.9);
  color: var(--ink);
  background: linear-gradient(180deg, #fbfdfc, #e4ebe8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.74),
    var(--shadow-soft);
}

.result-actions .secondary-button:hover:not(:disabled) {
  border-color: rgba(126, 143, 134, 0.85);
  background: linear-gradient(180deg, #ffffff, #dce6e2);
}

body.challenge-active .result-actions .secondary-button {
  border-color: rgba(146, 104, 42, 0.42);
  color: #26312d;
  background: linear-gradient(180deg, #fffaf0, #f4ead6);
  box-shadow: 0 8px 20px rgba(91, 63, 28, 0.12);
}

body.challenge-active .result-actions .secondary-button:hover:not(:disabled) {
  border-color: rgba(117, 83, 33, 0.6);
  background: #f4ead6;
}

body.challenge-active .result-actions {
  background: rgba(241, 236, 225, 0.94);
}

.result-summary div {
  padding: 24px 12px;
  text-align: center;
  background: var(--surface);
}

body.challenge-active .result-summary div {
  background: rgba(255, 252, 244, 0.94);
}

.result-summary span {
  display: block;
  font-size: 3.4rem;
  font-weight: 900;
  animation: result-number-pop 420ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.result-summary div:nth-child(2) span {
  animation-delay: 70ms;
}

.result-summary div:nth-child(3) span {
  animation-delay: 140ms;
}

.result-summary p,
.wrong-list {
  color: var(--muted);
}

.wrong-section {
  padding: 14px;
}

.wrong-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wrong-section-head h2 {
  margin: 0;
}

.wrong-section-head .secondary-button {
  flex: 0 0 auto;
  min-height: 38px;
}

.wrong-section-head .secondary-button.is-removing {
  border-color: rgba(200, 62, 67, 0.28);
  color: #9f2f34;
  background: rgba(250, 227, 228, 0.72);
}

body.challenge-active .wrong-section-head .secondary-button.is-removing {
  border-color: rgba(180, 100, 56, 0.56);
  color: #5a2f22;
  background: linear-gradient(180deg, #f8dcc8, #efc0aa);
}

.wrong-list {
  display: grid;
  gap: 0;
  margin-top: 8px;
}

.wrong-item {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(230px, 1.35fr);
  gap: 12px;
  min-height: 96px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 0.94rem;
  line-height: 1.35;
}

.wrong-item > div:first-child {
  min-width: 0;
  overflow: hidden;
}

.wrong-item strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.wrong-item span {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.wrong-item dl {
  display: grid;
  gap: 3px;
  margin: 0;
}

.wrong-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: center;
}

.wrong-item dl div {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 24px;
}

.wrong-item dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
}

.wrong-item dd {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.wrong-bookmark-button {
  min-height: 36px;
  padding: 7px 10px;
  white-space: nowrap;
}

.is-hidden {
  display: none;
}

#next-button {
  min-height: 52px;
  margin-top: 6px;
  transform: translateY(0);
  transition:
    opacity 170ms ease,
    transform 170ms ease;
}

#next-button.is-hidden {
  display: block;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  width: 100%;
  min-height: 100dvh;
  place-items: center;
  padding: 18px;
  background: rgba(18, 27, 23, 0.46);
  overscroll-behavior: contain;
  overflow: hidden;
  animation: backdrop-fade 160ms ease both;
}

#quit-dialog {
  z-index: 32;
}

.dialog-backdrop::before {
  display: none;
}

.dialog-backdrop.is-hidden {
  display: none;
}

.dialog-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: calc(100dvh - 36px);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 22px;
  border: 1px solid rgba(217, 223, 216, 0.92);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 28px 70px rgba(18, 27, 23, 0.24);
  animation: dialog-pop 220ms cubic-bezier(0.18, 0.86, 0.24, 1) both;
}

.dialog-panel.bookmark-dialog-panel {
  width: min(980px, calc(100vw - 32px));
  height: min(720px, calc(100dvh - 36px));
  max-height: calc(100dvh - 36px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
}

.dialog-panel.range-dialog-panel {
  width: min(860px, calc(100vw - 32px));
  height: min(720px, calc(100dvh - 36px));
  max-height: calc(100dvh - 36px);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
}

.dialog-panel.favorite-preset-dialog-panel {
  width: min(560px, calc(100vw - 32px));
  height: min(620px, calc(100dvh - 36px));
  max-height: calc(100dvh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  overflow: hidden;
}

.range-dialog-panel .range-toolbar {
  position: static;
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  margin: 0 0 16px;
  border-color: rgba(217, 223, 216, 0.78);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 22px rgba(32, 44, 38, 0.08);
}

.range-list {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 12px;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0;
  padding: 2px 2px 8px;
  scroll-snap-type: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 112, 102, 0.56) transparent;
}

.range-list::-webkit-scrollbar {
  width: 8px;
}

.range-list::-webkit-scrollbar-track {
  background: transparent;
}

.range-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(99, 112, 102, 0.52);
}

.range-stage {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(217, 223, 216, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
}

.range-stage-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.range-stage-head > div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.range-stage-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.range-dialog-panel .range-group {
  flex: none;
  width: 100%;
  max-width: none;
}

.range-stage-options .mode-button {
  position: relative;
  width: 100%;
  height: 56px;
  min-height: 56px;
  display: -webkit-box;
  padding: 12px 14px 12px 36px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #eef3f1);
  box-shadow: 0 7px 18px rgba(32, 44, 38, 0.08);
  line-height: 1.18;
  text-align: center;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.range-stage-options .mode-button::before {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  left: 14px;
  border: 2px solid #aebbb5;
  border-radius: 999px;
  background: white;
  box-shadow: inset 0 0 0 2px white;
  transform: translateY(-50%);
}

.range-stage-options .mode-button.is-selected::before {
  border-color: var(--blue);
  background: var(--blue);
}

.range-stage-options .mode-button {
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease,
    filter 160ms ease;
}

.range-stage-options .mode-button:active:not(:disabled) {
  filter: brightness(0.97);
  box-shadow: inset 0 0 0 1px rgba(45, 113, 136, 0.1);
}

.dialog-panel h2 {
  font-size: 1.25rem;
}

.dialog-panel p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.7;
}

.dialog-actions {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 30;
  width: max-content;
  max-width: min(420px, calc(100% - 36px));
  padding: 12px 14px;
  border: 1px solid rgba(23, 130, 91, 0.24);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(223, 244, 234, 0.96);
  box-shadow: 0 18px 42px rgba(32, 44, 38, 0.18);
  font-weight: 850;
  line-height: 1.5;
  transform: translateX(-50%);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-error {
  border-color: rgba(200, 62, 67, 0.28);
  background: rgba(250, 227, 228, 0.96);
}

.toast.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
}

@keyframes bookmark-bounce {
  0%,
  100% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.08);
  }

  72% {
    transform: scale(0.98);
  }
}

@keyframes result-number-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dialog-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes backdrop-fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes selected-button-press {
  from {
    filter: brightness(0.96);
    transform: scale(0.985);
  }

  to {
    filter: brightness(1);
    transform: scale(1);
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 22px, 980px);
    padding: 14px 0 28px;
  }

  h1 {
    font-size: 2.6rem;
  }

  .import-panel,
  .deck-card {
    align-items: stretch;
    flex-direction: column;
  }

  .import-actions {
    justify-content: stretch;
  }

  .import-actions .secondary-button {
    flex: 1 1 130px;
  }

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

  .deck-actions .small {
    min-height: 48px;
    padding: 10px 12px;
    font-size: 0.98rem;
  }

  .topbar {
    margin-bottom: 18px;
  }

  .topbar.compact {
    flex-wrap: wrap;
  }

  .setup-header-actions {
    width: 100%;
    margin-left: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .setup-list-button {
    min-height: 42px;
    padding-inline: 12px;
  }

  .settings-block {
    padding: 16px;
  }

  .range-summary-card {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .range-summary-card .secondary-button {
    width: 100%;
  }

  .range-group {
    flex-basis: min(74%, 260px);
    max-width: min(74%, 260px);
  }

  .range-toolbar {
    margin-inline: -4px;
  }

  .range-group summary {
    min-height: 54px;
    grid-template-columns: 26px minmax(0, 1fr) auto;
    padding: 10px;
  }

  .range-dialog-panel .range-dialog-head {
    margin: 0 0 12px;
    padding: 0;
  }

  .range-dialog-panel .range-group summary {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .range-dialog-panel .range-toggle {
    grid-column: auto;
    justify-self: end;
    margin-top: 0;
  }

  .range-stage {
    padding: 12px;
  }

  .range-stage-head {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .range-stage-head > div {
    justify-content: space-between;
  }

  .range-stage-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .range-stage-options .mode-button {
    height: 60px;
    min-height: 60px;
    padding: 10px 12px 10px 34px;
    font-size: 0.92rem;
  }

  .range-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .range-all-button {
    width: 100%;
  }

  .range-count {
    font-size: 0.78rem;
  }

  .range-toggle {
    grid-column: 2 / -1;
    justify-self: stretch;
    margin-top: -2px;
  }

  .range-options {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 0 10px 10px 10px;
  }

  .range-options .mode-button {
    width: 100%;
  }

  .bookmark-panel-head,
  .bookmark-panel-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .bookmark-panel-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .bookmark-panel-actions button {
    width: 100%;
    min-height: 50px;
  }

  .dialog-panel.bookmark-dialog-panel {
    height: calc(100dvh - 36px);
  }

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

  .word-list-search {
    grid-template-columns: minmax(0, 1fr) 0;
    gap: 8px;
    padding: 8px 0 12px;
  }

  .word-list-screen.is-searching .word-list-search {
    grid-template-columns: minmax(0, 1fr) 64px;
  }

  .word-list-screen.is-searching .word-search-close-button {
    min-width: 0;
    padding-inline: 8px;
    font-size: 0.82rem;
  }

  .word-list-search input {
    min-height: 46px;
    font-size: 0.95rem;
  }

  .word-stage-summary {
    top: 66px;
  }

  .word-part-summary {
    top: 120px;
  }

  .word-stage-body {
    gap: 8px;
    padding: 8px;
  }

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

  .word-card-grid-search {
    padding: 0;
  }

  .word-list-card {
    height: 148px;
    padding: 9px;
  }

  .word-list-card strong {
    font-size: 0.9rem;
  }

  .word-list-card span {
    font-size: 0.74rem;
  }

  .word-list-card .word-list-answer {
    font-size: 0.72rem;
  }

  .word-detail-card {
    padding: 12px;
  }

  .word-detail-block {
    padding: 10px;
  }

  .word-detail-block p {
    font-size: 0.92rem;
    line-height: 1.5;
  }

  .word-detail-main {
    font-size: 0.98rem;
  }

  .word-list-bookmark-button {
    min-height: 34px;
    padding-inline: 6px;
    font-size: 0.78rem;
  }

  .option-grid,
  .choice-grid {
    grid-template-columns: 1fr;
  }

  #mode-options {
    min-height: 194px;
  }

  .result-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .result-summary.is-challenge-result {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-summary div {
    padding: 14px 6px;
  }

  .result-summary span {
    font-size: 2rem;
    line-height: 1.05;
  }

  .result-summary p {
    font-size: 0.78rem;
    font-weight: 800;
  }

  #count-options.count-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    overflow: visible;
    padding: 0;
  }

  #count-options.count-grid .mode-button {
    min-height: 52px;
  }

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

  .question-order-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .data-management-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .preset-grid,
  .record-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .favorite-preset-menu {
    grid-template-columns: 1fr;
  }

  .favorite-preset-form,
  .favorite-preset-item {
    grid-template-columns: 1fr;
  }

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

  .weakness-card {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .weakness-card p,
  .weakness-card small {
    white-space: normal;
  }

  .time-grid .mode-button {
    min-height: 50px;
  }

  .question-order-grid .mode-button {
    min-height: 50px;
  }

  .question-order-actions .secondary-button {
    min-height: 44px;
  }

  .mode-button {
    min-height: 58px;
  }

  .start-panel {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 14px;
    padding: 12px;
  }

  .continue-panel {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }

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

  .continue-actions button {
    width: 100%;
    min-width: 0;
  }

  .challenge-toggle {
    width: 100%;
    padding-bottom: 2px;
  }

  .start-note {
    text-align: left;
    font-size: 0.92rem;
  }

  #setup-screen {
    padding-bottom: 86px;
  }

  .floating-start-bar {
    position: fixed;
    left: 9px;
    right: 9px;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 112px;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid rgba(188, 199, 194, 0.85);
    border-radius: 12px;
    background: rgba(247, 250, 248, 0.96);
    box-shadow: 0 14px 34px rgba(23, 32, 27, 0.2);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px);
    transition:
      opacity 180ms ease,
      transform 180ms ease;
  }

  .floating-start-bar.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  body.dialog-open .floating-start-bar {
    display: none;
  }

  .floating-start-bar strong,
  .floating-start-bar span {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .floating-start-bar strong {
    color: var(--ink);
    font-size: 0.94rem;
    font-weight: 900;
  }

  .floating-start-bar strong.is-warning {
    color: var(--red);
  }

  .floating-start-bar span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
  }

  .floating-start-bar .primary-button {
    min-height: 48px;
    width: 100%;
    padding-inline: 10px;
  }

  body.challenge-active .floating-start-bar {
    border-color: rgba(146, 104, 42, 0.36);
    background: rgba(255, 250, 240, 0.96);
    box-shadow: 0 14px 34px rgba(91, 63, 28, 0.18);
  }

  .study-screen {
    min-height: auto;
  }

  .study-status {
    margin-bottom: 12px;
    padding: 8px 0 10px;
  }

  .time-bar {
    flex: 0 0 auto;
    height: 12px;
    margin: 0 0 10px;
    padding-right: 38px;
  }

  .time-bar span {
    right: 11px;
    font-size: 0.72rem;
  }

  .quit-button {
    min-width: 78px;
    min-height: 40px;
    padding: 8px 10px;
  }

  .question-card {
    height: clamp(238px, 35dvh, 310px);
    grid-template-rows: 1fr;
    gap: 8px;
    padding: 24px 16px;
  }

  .question-card .eyebrow {
    top: 18px;
    left: 16px;
    right: 16px;
  }

  .question-text {
    font-size: 2.8rem;
  }

  .feedback {
    height: 56px;
    font-size: 2.7rem;
  }

  .answer-note {
    height: 34px;
    font-size: 0.92rem;
  }

  .answer-area {
    min-height: 312px;
    margin-top: 12px;
  }

  body.study-active .app-shell {
    width: min(100% - 18px, 980px);
    display: flex;
    flex-direction: column;
    height: 100dvh;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  body.study-active.study-input-active .app-shell {
    height: auto;
    min-height: 100dvh;
  }

  body.study-active.study-cloze-active.study-input-active .app-shell {
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  body.study-active #study-screen.is-active {
    display: flex;
  }

  body.study-active.study-input-active #study-screen.is-active {
    display: block;
  }

  body.study-active.study-cloze-active.study-input-active #study-screen.is-active {
    display: grid;
    overflow: hidden;
  }

  body.study-active.study-cloze-active #study-screen.is-active {
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr) auto auto;
    gap: 6px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }

  body.study-active.study-cloze-active .study-status {
    grid-row: 1;
  }

  body.study-active.study-cloze-active .time-bar {
    grid-row: 2;
  }

  body.study-active .question-card {
    height: clamp(218px, 32dvh, 280px);
    min-height: 218px;
    padding: 16px 14px;
    grid-template-rows: 1fr;
  }

  body.study-active .question-card.is-cloze-question {
    height: clamp(296px, 40dvh, 346px);
    min-height: 296px;
  }

  body.study-active.study-choice-active .question-card.is-cloze-question {
    height: clamp(262px, 34dvh, 310px);
    min-height: 262px;
  }

  body.study-active.study-cloze-active .question-card.is-cloze-question {
    grid-row: 3;
    align-self: stretch;
    height: 100%;
    min-height: 0;
    margin: 0;
  }

  body.study-active .question-card .eyebrow {
    top: 14px;
    left: 14px;
    right: 14px;
  }

  body.study-active .bookmark-current-button {
    top: 10px;
    right: 10px;
    width: auto;
    height: 40px;
    min-height: 40px;
    padding-inline: 10px;
    font-size: 0.82rem;
  }

  body.study-active .study-hint-button {
    height: 32px;
    min-height: 32px;
    padding-inline: 9px;
    font-size: 0.76rem;
  }

  body.study-active .question-text {
    height: 100%;
    box-sizing: border-box;
    padding: 42px 4px 74px;
    font-size: 2.35rem;
  }

  body.study-active .question-text.is-long {
    font-size: 1.96rem;
  }

  body.study-active .question-text.is-very-long {
    font-size: 1.58rem;
  }

  body.study-active .question-text.is-extra-long {
    font-size: 1.32rem;
  }

  body.study-active .question-text.is-japanese {
    font-size: 2rem;
    line-height: 1.24;
  }

  body.study-active .question-text.is-japanese.is-long {
    font-size: 1.68rem;
  }

  body.study-active .question-text.is-japanese.is-very-long {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    font-size: 1.5rem;
  }

  body.study-active .question-text.is-japanese.is-extra-long {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    font-size: 1.32rem;
    line-height: 1.28;
  }

  body.study-active .question-text.is-cloze {
    padding: 42px 0 32px;
    font-size: clamp(1.28rem, 5.5vw, 1.8rem);
    line-height: 1.32;
  }

  body.study-active.study-writing-active .question-text.is-cloze {
    padding-right: 0;
  }

  body.study-active .cloze-layout {
    grid-template-rows: auto auto;
    align-content: center;
    gap: 7px;
    padding: 2px 8px 4px;
  }

  body.study-active .cloze-layout.without-japanese {
    grid-template-rows: auto;
  }

  body.study-active .cloze-english-scroll,
  body.study-active .cloze-japanese-scroll {
    align-content: center;
    align-content: safe center;
  }

  body.study-active .cloze-english-scroll {
    min-height: calc(2.76em + 10px);
    padding: 2px 6px;
  }

  body.study-active .cloze-japanese-scroll {
    min-height: 34px;
    max-height: 58px;
    padding: 0 6px 1px;
  }

  body.study-active .cloze-japanese {
    font-size: 0.82em;
    line-height: 1.34;
  }

  body.study-active .cloze-japanese.is-long {
    font-size: 0.71em;
    line-height: 1.28;
  }

  body.study-active .cloze-japanese.is-very-long {
    font-size: 0.64em;
    line-height: 1.24;
  }

  body.study-active .feedback {
    left: 14px;
    right: 14px;
    bottom: 42px;
    height: 46px;
    font-size: 2.25rem;
  }

  body.study-active .question-card.is-cloze-question .feedback {
    bottom: 38px;
    height: 30px;
    font-size: 1.62rem;
  }

  body.study-active .answer-note {
    left: 14px;
    right: 14px;
    bottom: 10px;
    min-height: 38px;
    font-size: 0.78rem;
  }

  body.study-active .question-card.is-cloze-question .answer-note {
    bottom: 6px;
    min-height: 24px;
    font-size: 0.72rem;
    line-height: 1.25;
  }

  body.study-active .answer-area {
    margin-top: 12px;
    min-height: 0;
    overflow: hidden;
    gap: 12px;
  }

  body.study-active.study-cloze-active .answer-area {
    grid-row: 4;
    flex: 0 0 auto;
    align-self: end;
    height: max-content;
    margin-top: 0;
    padding: 10px;
    border: 1px solid rgba(217, 223, 216, 0.82);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow-soft);
  }

  body.challenge-active.study-cloze-active .answer-area {
    border-color: rgba(176, 132, 56, 0.28);
    background: rgba(255, 252, 244, 0.78);
    box-shadow: 0 8px 20px rgba(91, 63, 28, 0.1);
  }

  body.study-active.study-cloze-active .choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    height: auto;
    min-height: 0;
  }

  body.study-active .choice-grid {
    min-height: 0;
    gap: 8px;
  }

  body.study-active .choice-button {
    min-height: 56px;
    padding: 10px 12px;
  }

  body.study-active .choice-button.is-long {
    font-size: 0.92rem;
  }

  body.study-active .choice-button.is-very-long {
    font-size: 0.84rem;
  }

  body.study-active .choice-button.is-extra-long {
    font-size: 0.78rem;
  }

  body.study-active .input-row {
    min-height: 124px;
  }

  body.study-active.study-cloze-active .input-row {
    min-height: 72px;
    gap: 10px;
  }

  body.study-active.study-cloze-active .answer-input,
  body.study-active.study-cloze-active .input-row .primary-button {
    height: 52px;
  }

  body.study-active.study-cloze-active #next-button {
    grid-row: 5;
    align-self: end;
    flex: 0 0 auto;
    margin-top: 0;
  }

  body.study-active .input-row.is-answered {
    padding-bottom: 14px;
  }

  .choice-grid {
    gap: 10px;
    min-height: 300px;
  }

  body.study-active .choice-grid {
    min-height: 0;
    gap: 8px;
  }

  .choice-button {
    min-height: 66px;
    padding: 12px 14px;
    font-size: 1rem;
  }

  .input-row {
    flex-direction: column;
    min-height: 134px;
    gap: 12px;
  }

  .answer-input,
  .input-row .primary-button {
    height: 54px;
  }

  .input-row .primary-button {
    width: 100%;
    flex-basis: auto;
  }

  #next-button {
    position: static;
    bottom: auto;
    z-index: 3;
    min-height: 54px;
    margin-top: 6px;
    box-shadow: 0 10px 24px rgba(23, 32, 27, 0.2);
  }

  .study-status {
    align-items: flex-start;
  }

  .study-metrics {
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
  }

  .study-metrics span,
  .study-metrics strong {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.88rem;
  }

  .result-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
    padding: 8px 0 10px;
  }

  .result-actions button {
    min-height: 58px;
    padding: 9px 6px;
    font-size: 0.78rem;
    line-height: 1.25;
    white-space: normal;
  }

  .result-actions [data-result-action="repeat-same"] {
    font-size: 0.7rem;
    white-space: nowrap;
  }

  .dialog-actions {
    display: flex;
    flex-direction: column;
  }

  .dialog-actions button {
    width: 100%;
  }

  .wrong-item {
    grid-template-columns: 1fr;
    gap: 3px;
    min-height: 132px;
    padding: 7px 0;
  }

  .wrong-item dl div {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 6px;
  }

  .wrong-detail {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .wrong-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .wrong-section-head .secondary-button {
    width: 100%;
  }

  .wrong-bookmark-button {
    width: 100%;
  }

  .dialog-panel {
    padding: 18px;
  }

  .dialog-panel.range-dialog-panel {
    height: calc(100dvh - 36px);
  }

  .range-dialog-panel .range-toolbar {
    top: auto;
    margin: 0 0 14px;
  }

  .range-list {
    margin: 0;
    padding: 2px 2px 2px;
  }

  .toast {
    left: 50%;
    bottom: calc(11px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100% - 22px);
  }
}

@media (hover: none) and (pointer: coarse) {
  button:hover:not(:disabled),
  .deck-card:hover {
    transform: none;
  }

  .secondary-button:hover:not(:disabled),
  .bookmark-panel-actions .secondary-button:hover:not(:disabled),
  .result-actions .secondary-button:hover:not(:disabled) {
    border-color: rgba(181, 193, 187, 0.9);
    background: linear-gradient(180deg, #fbfdfc, #e4ebe8);
  }

  body.challenge-active .secondary-button:hover:not(:disabled),
  body.challenge-active .mode-button:hover:not(:disabled):not(.is-selected),
  body.challenge-active .range-all-button:hover:not(:disabled):not(.is-selected),
  body.challenge-active .range-toggle:hover:not(:disabled):not(.is-selected),
  body.challenge-active .choice-button:hover:not(:disabled),
  body.challenge-active .result-actions .secondary-button:hover:not(:disabled),
  body.challenge-active .bookmark-panel-actions .secondary-button:hover:not(:disabled) {
    border-color: rgba(146, 104, 42, 0.42);
    background: linear-gradient(180deg, #fffaf0, #f4ead6);
  }
}
