:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --bg-soft: #e9eef1;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-muted: #f3f7fa;
  --ink: #0d1f2d;
  --muted: #607282;
  --line: #d7e2e9;
  --accent: #0d7eb7;
  --accent-strong: #075f99;
  --accent-soft: #e4f4fb;
  --good: #117a57;
  --bad: #b33343;
  --warning: #a26800;
  --shadow: 0 18px 42px rgba(16, 32, 43, 0.13);
  --card-shadow: 0 22px 54px rgba(16, 32, 43, 0.16);
  --bottom-space: 94px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #06101d;
  --bg-soft: #0a1a2c;
  --surface: #101b29;
  --surface-raised: #142337;
  --surface-muted: #0b1726;
  --ink: #f0f6fb;
  --muted: #a6b6c7;
  --line: #25415f;
  --accent: #24b7ff;
  --accent-strong: #5ecbff;
  --accent-soft: rgba(36, 183, 255, 0.13);
  --good: #20a979;
  --bad: #f25569;
  --warning: #f0b84b;
  --shadow: 0 20px 46px rgba(0, 0, 0, 0.32);
  --card-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 16% 0%, var(--accent-soft), transparent 34%),
    linear-gradient(180deg, var(--bg), var(--bg-soft));
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.app-shell {
  width: min(560px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) 12px calc(var(--bottom-space) + env(safe-area-inset-bottom));
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 7px;
  backdrop-filter: blur(18px);
}

.brand-mark {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: min(230px, calc(100vw - 168px));
  height: 42px;
  object-fit: contain;
  object-position: left center;
}

.brand-logo-dark {
  display: none;
}

html[data-theme="dark"] .brand-logo-light {
  display: none;
}

html[data-theme="dark"] .brand-logo-dark {
  display: block;
}

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

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.42rem;
  line-height: 1;
}

h2 {
  font-size: 1.2rem;
}

.theme-toggle,
.icon-button,
.quick-menu button,
.action-button,
.choice-button,
.primary-button,
.secondary-button,
.nav-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 0.86rem;
}

.theme-toggle-icon {
  color: var(--accent-strong);
  font-size: 1.1rem;
}

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

.score-strip span,
.session-bar,
.data-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.score-strip span {
  min-height: 40px;
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 5px 4px;
  color: var(--muted);
  font-size: 0.68rem;
  text-align: center;
}

.score-strip strong {
  color: var(--ink);
  font-size: 1rem;
}

.quick-menu-shell {
  position: relative;
  margin-bottom: 7px;
  overflow: hidden;
}

.quick-menu-shell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 2px;
  z-index: 2;
  width: 44px;
  background: linear-gradient(270deg, transparent, var(--bg) 72%, var(--bg));
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  display: none;
}

.quick-menu-shell::after {
  content: "›";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 2px;
  z-index: 2;
  width: 28px;
  display: grid;
  place-items: center;
  background: linear-gradient(90deg, transparent, var(--bg) 78%);
  color: var(--accent-strong);
  font-size: 1.2rem;
  font-weight: 950;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.quick-menu-shell.has-more::after {
  opacity: 0.82;
}

.quick-menu {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 2px 3px;
  scroll-padding-inline: 2px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  user-select: none;
  overscroll-behavior-x: contain;
  touch-action: pan-x pan-y;
}

.quick-menu::-webkit-scrollbar {
  display: none;
}

.quick-menu.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}

.quick-menu-arrow {
  position: absolute;
  top: 0;
  bottom: 2px;
  z-index: 4;
  width: 36px;
  min-height: 50px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 42%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-raised) 96%, var(--accent-soft));
  color: var(--accent-strong);
  font-size: 1.72rem;
  font-weight: 950;
  line-height: 1;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--shadow), transparent 58%);
  transition: opacity 150ms ease, transform 150ms ease, background 150ms ease;
}

.quick-menu-arrow-left {
  left: 0;
}

.quick-menu-arrow-right {
  right: 0;
}

.quick-menu-arrow[hidden] {
  display: none;
}

.quick-menu-arrow:active {
  transform: scale(0.96);
}

.quick-menu button {
  flex: 0 0 clamp(124px, 34vw, 152px);
  display: grid;
  align-content: center;
  min-height: 50px;
  gap: 3px;
  padding: 8px 10px;
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  scroll-snap-align: start;
  text-align: left;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
  white-space: nowrap;
}

.filter-icon {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  line-height: 1;
}

.quick-menu strong {
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-bar {
  display: grid;
  gap: 2px;
  padding: 6px 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
}

.session-bar strong {
  color: var(--ink);
  font-size: 0.84rem;
}

#filterSummary {
  display: none;
}

.progress-line {
  display: grid;
  gap: 5px;
  margin-top: 3px;
}

.progress-line span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line), transparent 32%);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transition: width 220ms ease;
}

.study-stage {
  min-height: 58vh;
}

.notice {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--warning), transparent 42%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--warning), transparent 86%);
  color: var(--warning);
  font-weight: 800;
}

.card-stage {
  display: grid;
}

.memory-card {
  min-height: min(660px, calc(100vh - 216px));
  display: grid;
  gap: 13px;
  align-content: start;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--card-shadow);
  touch-action: pan-y;
  transition: transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
  user-select: none;
}

.memory-card.is-dragging {
  transition: none;
  will-change: transform;
}

.memory-card.swipe-out-left {
  opacity: 0;
  transform: translateX(-130%) rotate(-6deg);
}

.memory-card.swipe-out-right {
  opacity: 0;
  transform: translateX(130%) rotate(6deg);
}

.memory-card.enter-next {
  opacity: 0;
  transform: translateX(28px);
}

.memory-card.enter-previous {
  opacity: 0;
  transform: translateX(-28px);
}

.memory-card.enter-next.is-settled,
.memory-card.enter-previous.is-settled {
  opacity: 1;
  transform: none;
}

.memory-card.swipe-boundary {
  animation: boundary-bounce 180ms ease;
}

@keyframes boundary-bounce {
  0% {
    transform: translateX(0);
  }

  42% {
    transform: translateX(12px);
  }

  100% {
    transform: translateX(0);
  }
}

.card-header {
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.card-meta {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.card-meta > span:nth-child(2) {
  grid-column: 1;
}

.favorite-button {
  grid-row: 1 / span 2;
  grid-column: 2;
  width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 58%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-muted) 82%, transparent);
  color: var(--muted);
  font-size: 1.55rem;
  line-height: 1;
  transition: background 150ms ease, color 150ms ease, transform 150ms ease;
}

.favorite-button.active {
  border-color: color-mix(in srgb, #f6c744, transparent 18%);
  background: color-mix(in srgb, #f6c744 18%, var(--surface-raised));
  color: #f4b400;
}

.favorite-button:active {
  transform: scale(0.96);
}

.review-indicator {
  grid-row: 1 / span 2;
  grid-column: 3;
  width: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  align-self: center;
  border: 1px solid color-mix(in srgb, #f59f00, transparent 35%);
  border-radius: 999px;
  background: color-mix(in srgb, #f59f00 15%, var(--surface-raised));
  color: #d97706;
  font-size: 1.05rem;
  font-weight: 900;
}

.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: -5px;
}

.status-chip {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  line-height: 1;
}

.status-chip.known {
  border-color: color-mix(in srgb, var(--good), transparent 54%);
  color: var(--good);
}

.status-chip.missed {
  border-color: color-mix(in srgb, var(--bad), transparent 54%);
  color: var(--bad);
}

.status-chip.favorite {
  border-color: color-mix(in srgb, #f6c744, transparent 42%);
  color: #d99a00;
}

.status-chip.review {
  border-color: color-mix(in srgb, #f59f00, transparent 42%);
  color: #d97706;
}

.quick-card {
  align-content: start;
  gap: 15px;
}

.quick-card .card-header {
  padding-bottom: 8px;
}

.quick-card .card-meta {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: start;
}

.quick-card .card-meta span:nth-child(2) {
  grid-column: 1;
}

.quick-card .favorite-button {
  grid-row: 1 / span 2;
  grid-column: 2;
}

.quick-card .review-indicator {
  grid-row: 1 / span 2;
  grid-column: 3;
}

.quick-progress {
  grid-row: 1 / span 2;
  grid-column: 4;
  min-width: 52px;
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 50%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent-soft) 72%, transparent);
  color: var(--accent-strong);
  font-size: 0.95rem;
  font-weight: 900;
}

.quick-prompt {
  min-height: 248px;
  display: grid;
  align-content: center;
  gap: 12px;
  padding: 22px 16px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 54%);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent), transparent 86%), transparent 48%),
    var(--surface-muted);
  text-align: center;
}

.quick-label {
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.quick-title {
  color: var(--ink);
  font-size: clamp(2rem, 9vw, 3.1rem);
  line-height: 1.08;
}

.quick-context {
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 800;
}

.quick-reveal-block {
  min-height: 96px;
}

.card-topic {
  color: var(--ink);
  font-size: 1.48rem;
  line-height: 1.15;
}

.card-block {
  width: 100%;
  min-height: 126px;
  display: grid;
  align-content: start;
  gap: 9px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--ink);
  text-align: left;
  animation: reveal-rise 150ms ease both;
  transition: background 180ms ease, border-color 180ms ease;
}

.card-block.hidden {
  place-content: center;
  border-style: dashed;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent), transparent 90%) 25%, transparent 25%) 0 0 / 18px 18px,
    var(--surface-muted);
  color: var(--muted);
  text-align: center;
}

.block-title {
  color: var(--accent-strong);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.block-text {
  font-size: 1.08rem;
  line-height: 1.45;
}

.article-anchor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 38%);
  align-items: center;
  gap: 12px;
  overflow: visible;
}

.article-anchor-layout .block-text {
  margin: 0;
  min-width: 0;
}

.visual-anchor {
  min-width: 0;
  width: 100%;
  max-width: 118px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  margin-top: 0;
  padding: 4px 0;
  color: var(--ink);
  text-align: center;
  overflow: visible;
  justify-self: end;
}

.visual-anchor-icons {
  display: block;
  max-width: 100%;
  font-size: clamp(1.28rem, 4.15vw, 1.53rem);
  line-height: 1.18;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: visible;
}

.visual-anchor-label {
  display: block;
  max-width: 100%;
  color: var(--ink);
  font-size: clamp(0.78rem, 3vw, 0.92rem);
  font-weight: 950;
  line-height: 1.14;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  overflow: visible;
}

.card-block.hidden .block-text {
  font-weight: 900;
}

@keyframes reveal-rise {
  from {
    opacity: 0.96;
  }

  to {
    opacity: 1;
  }
}

.card-nav {
  display: none;
}

.nav-button {
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.nav-button:disabled,
.action-button:disabled,
.choice-button:disabled {
  cursor: default;
  opacity: 0.5;
}

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

.bottom-actions {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 0.78fr 1fr;
  gap: 7px;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 8px 10px max(8px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.bottom-actions.classic-actions {
  grid-template-columns: 1fr 1fr;
}

.bottom-actions.classic-actions .action-button.reveal {
  display: none;
}

body:has(dialog[open]) .bottom-actions {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.action-button {
  min-height: 56px;
  color: #ffffff;
  font-size: 0.88rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.action-button.miss {
  background: var(--bad);
}

.action-button.reveal {
  background: var(--accent-strong);
}

.action-button.known {
  background: var(--good);
}

.answer-feedback {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bottom-space) + 12px + env(safe-area-inset-bottom));
  z-index: 12;
  min-width: 112px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 900;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 8px) scale(0.98);
  transition: opacity 150ms ease, transform 150ms ease;
}

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

.answer-feedback.is-known {
  background: color-mix(in srgb, var(--good) 92%, #000000);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--good), transparent 72%);
}

.answer-feedback.is-missed {
  background: color-mix(in srgb, var(--warning) 88%, var(--bad));
  box-shadow: 0 12px 28px color-mix(in srgb, var(--warning), transparent 70%);
}

.modal-sheet {
  width: min(560px, calc(100% - 18px));
  max-height: min(82vh, 720px);
  margin: auto auto 8px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.modal-sheet[open] {
  opacity: 1;
  transform: translateY(0);
}

@starting-style {
  .modal-sheet[open] {
    opacity: 0;
    transform: translateY(12px);
  }
}

.modal-sheet::backdrop {
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(2px);
}

.modal-sheet form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.review-dialog p {
  color: var(--muted);
  line-height: 1.42;
}

.confirm-dialog p {
  color: var(--muted);
  line-height: 1.42;
}

.review-dialog strong {
  color: var(--ink);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.icon-button {
  width: 44px;
  padding: 0;
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 1.35rem;
}

.choice-grid,
.modal-actions,
.session-stats,
.setting-group,
.check-list,
.block-options {
  display: grid;
  gap: 8px;
}

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

.session-stats span {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.session-stats strong {
  color: var(--ink);
}

.stats-panel {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-muted) 78%, transparent);
}

.stats-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stats-title strong {
  min-width: 54px;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.95rem;
  text-align: center;
}

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

.stats-grid span {
  min-height: 42px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.stats-grid strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.setting-group {
  transition: filter 160ms ease;
}

.is-disabled-setting,
.is-mode-inactive {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
  filter: saturate(0.75);
}

.is-disabled-setting *,
.is-mode-inactive * {
  cursor: not-allowed;
}

.is-disabled-setting .choice-button:disabled,
.is-disabled-setting input:disabled,
.is-mode-inactive .choice-button:disabled,
.is-mode-inactive input:disabled {
  opacity: 1;
}

.setting-disabled-note {
  display: none;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.is-disabled-setting .setting-disabled-note {
  display: block;
}

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

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

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

.choice-button,
.primary-button,
.secondary-button {
  padding: 0 12px;
}

.choice-button {
  min-height: 50px;
  background: var(--surface-muted);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.choice-button.active {
  background: var(--accent-strong);
  color: #ffffff;
  box-shadow: none;
}

.check-list label,
.block-options label {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  font-weight: 800;
}

.block-option-text {
  min-width: 0;
  display: grid;
  gap: 3px;
  line-height: 1.18;
}

.block-option-text strong {
  color: var(--ink);
  font-size: 0.96rem;
}

.block-option-text small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.block-group-option {
  background: color-mix(in srgb, var(--surface-muted) 72%, var(--accent-soft));
}

.check-list input,
.block-options input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.section-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.search-input {
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--ink);
}

.inline-check {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
}

.inline-check input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.search-status {
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 800;
}

.modal-actions {
  grid-template-columns: 1fr 1fr;
}

.primary-button {
  background: var(--accent-strong);
  color: #ffffff;
}

.secondary-button {
  background: var(--surface-muted);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.danger-outline {
  color: var(--bad);
}

.danger-button-modal {
  background: var(--bad);
}

.data-box {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.data-box strong {
  color: var(--ink);
}

.data-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.data-row {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.data-row strong {
  max-width: 56%;
  overflow: hidden;
  color: var(--ink);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-message {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--good), transparent 55%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--good), transparent 88%);
  color: var(--good);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.32;
}

.data-message.error {
  border-color: color-mix(in srgb, var(--bad), transparent 50%);
  background: color-mix(in srgb, var(--bad), transparent 88%);
  color: var(--bad);
}

.debug-note {
  padding: 9px 10px;
  border: 1px dashed color-mix(in srgb, var(--accent), transparent 42%);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 800;
}

.debug-panel {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.debug-title {
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

.debug-grid span,
.debug-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.debug-grid span {
  min-height: 42px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.debug-grid strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.94rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.debug-block {
  display: grid;
  gap: 7px;
  padding: 9px 10px;
}

.debug-block strong {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.debug-block pre {
  max-height: 190px;
  overflow: auto;
  margin: 0;
  color: var(--ink);
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.76rem;
  line-height: 1.35;
  white-space: pre-wrap;
}

#csvFileInput,
#importBaseFileInput,
#importProgressFileInput {
  display: none;
}

@media (min-width: 640px) {
  .modal-sheet {
    border-radius: 8px;
  }
}

@media (max-width: 430px) {
  .article-anchor-layout {
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 42%);
  }

  .visual-anchor {
    min-width: 0;
    max-width: 100%;
  }

  .visual-anchor-icons {
    font-size: clamp(1.36rem, 4.95vw, 1.74rem);
    line-height: 1.2;
  }

  .visual-anchor-label {
    font-size: clamp(0.76rem, 3.1vw, 0.92rem);
    line-height: 1.16;
  }
}

@media (max-width: 360px) {
  .quick-menu {
    display: flex;
  }

  .score-strip {
    grid-template-columns: 1fr;
  }

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

  .article-anchor-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .visual-anchor {
    justify-self: end;
    width: min(150px, 100%);
    max-width: 100%;
  }
}

body:not(.study-active) .app-shell {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
}

body:not(.study-active) .app-shell > :not(.side-menu):not(.side-menu-backdrop),
body:not(.study-active) .bottom-actions,
body:not(.study-active) .answer-feedback {
  display: none;
}

body.study-active .welcome-screen {
  display: none;
}

.welcome-screen {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) clamp(16px, 4vw, 42px) max(18px, env(safe-area-inset-bottom));
}

.welcome-menu-toggle {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 6;
}

.welcome-content {
  width: min(880px, calc(100vw - 32px));
  min-height: min(720px, calc(100svh - 36px));
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto minmax(0, 0.9fr);
  align-items: center;
  justify-items: center;
  gap: clamp(14px, 3svh, 28px);
}

.welcome-logo-wrap {
  width: min(760px, 100%);
  max-width: 100%;
  justify-self: center;
  opacity: 0;
  animation: welcome-fade 620ms ease forwards;
}

.welcome-logo {
  display: block;
  width: 100%;
  max-width: min(760px, 92vw);
  height: clamp(86px, 18vw, 178px);
  object-fit: contain;
  object-position: center;
}

.welcome-logo-dark {
  display: none;
}

html[data-theme="dark"] .welcome-logo-light {
  display: none;
}

html[data-theme="dark"] .welcome-logo-dark {
  display: block;
}

.welcome-tagline {
  order: 2;
  margin-top: clamp(-12px, -1svh, -4px);
  color: color-mix(in srgb, var(--muted) 82%, var(--ink));
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.02rem, 2.7vw, 1.34rem);
  font-style: italic;
  line-height: 1.25;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  animation: tagline-float 620ms ease 1080ms forwards;
}

.opposition-entry-grid {
  order: 3;
  width: min(720px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2.8vw, 18px);
  opacity: 0;
  transform: translateY(8px);
  animation: welcome-rise 620ms ease 620ms forwards;
}

.opposition-entry-card {
  min-height: clamp(72px, 10vw, 104px);
  display: grid;
  place-items: center;
  padding: clamp(6px, 1.4vw, 10px);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  transition: transform 160ms ease, filter 160ms ease;
}

.opposition-entry-card img {
  display: block;
  width: 100%;
  max-width: min(340px, 100%);
  height: clamp(54px, 9vw, 82px);
  object-fit: contain;
  pointer-events: none;
}

.opposition-entry-card:active {
  transform: translateY(1px) scale(0.99);
}

.app-shell {
  width: min(720px, 100%);
}

.app-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding-top: max(4px, env(safe-area-inset-top));
}

.header-icon-button,
.theme-toggle {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
  color: var(--ink);
  box-shadow: none;
  font-size: 1.18rem;
  font-weight: 900;
  line-height: 1;
}

.theme-toggle {
  gap: 0;
}

#themeLabel {
  display: none;
}

.theme-toggle-icon {
  color: var(--accent-strong);
  font-size: 1.08rem;
}

.brand-mark {
  justify-self: center;
  max-width: 100%;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.brand-logo {
  width: min(420px, 100%);
  height: clamp(34px, 7vw, 50px);
  max-width: 100%;
  object-fit: contain;
  object-position: center;
}

.quick-menu [data-open-modal="oppositionModal"],
.quick-menu [data-open-modal="sessionModal"],
.quick-menu [data-open-modal="statsModal"],
.quick-menu [data-open-modal="dataModal"] {
  display: none;
}

.quick-menu {
  scroll-behavior: smooth;
}

.quick-menu-arrow {
  display: none;
}

.side-menu-brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
}

.side-menu-logo {
  display: block;
  width: min(190px, 56vw);
  height: 52px;
  object-fit: contain;
  object-position: left center;
}

.side-menu-logo-dark {
  display: none;
}

html[data-theme="dark"] .side-menu-logo-light {
  display: none;
}

html[data-theme="dark"] .side-menu-logo-dark {
  display: block;
}

.side-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 29;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.side-menu {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: min(320px, 86vw);
  display: grid;
  grid-template-rows: auto 1fr;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  transform: translateX(-102%);
  transition: transform 200ms ease;
}

.side-menu-open .side-menu {
  transform: translateX(0);
}

.side-menu-open .side-menu-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.side-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-weight: 950;
}

.side-menu-nav {
  display: grid;
  align-content: start;
  gap: 8px;
  padding-top: 12px;
}

.side-menu-nav button {
  min-height: 52px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--ink);
  font-weight: 850;
  text-align: left;
}

.side-menu-nav button:disabled {
  cursor: default;
  opacity: 0.48;
}

.modal-sheet {
  max-height: min(88svh, 760px);
  margin-bottom: max(8px, env(safe-area-inset-bottom));
}

.modal-sheet form {
  max-height: min(86svh, 744px);
  overflow: auto;
  padding-bottom: max(14px, calc(env(safe-area-inset-bottom) + 14px));
}

.info-dialog p {
  color: var(--muted);
  line-height: 1.42;
}

.settings-hub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.settings-hub-card {
  min-height: 68px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--ink);
  text-align: left;
}

.settings-hub-card span {
  font-size: 1rem;
  font-weight: 900;
}

.settings-hub-card small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.form-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.form-field input,
.form-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  color: var(--ink);
  resize: vertical;
}

.contact-fallback {
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent), transparent 54%);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 850;
}

@media (min-width: 640px) {
  .settings-hub-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@keyframes welcome-fade {
  to {
    opacity: 1;
  }
}

@keyframes welcome-rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes tagline-float {
  to {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@media (min-width: 900px) {
  .welcome-content {
    min-height: min(760px, calc(100svh - 56px));
  }

  .quick-menu {
    overflow: visible;
  }

  .quick-menu button {
    flex: 1 1 0;
    min-width: 0;
  }

  .opposition-entry-card:hover {
    filter: drop-shadow(0 12px 22px color-mix(in srgb, var(--shadow), transparent 40%));
  }
}

@media (max-width: 520px) {
  .welcome-content {
    grid-template-rows: minmax(0, 0.9fr) auto auto minmax(0, 0.55fr);
    gap: clamp(12px, 2.6svh, 20px);
  }

  .welcome-logo-wrap {
    width: min(430px, 100%);
  }

  .welcome-logo {
    width: 100%;
    height: clamp(76px, 24vw, 112px);
  }

  .opposition-entry-grid {
    grid-template-columns: 1fr;
  }

  .app-header {
    grid-template-columns: 42px minmax(0, 1fr) 42px 42px;
    gap: 5px;
  }

  .brand-logo {
    width: min(210px, 100%);
    height: 34px;
  }
}

@media (max-width: 374px) {
  .app-header {
    grid-template-columns: 40px minmax(0, 1fr) 40px 40px;
  }

  .header-icon-button,
  .theme-toggle {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
  }

  .brand-logo {
    display: block;
    width: min(178px, 100%);
    height: 30px;
  }
}

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