:root {
  color-scheme: dark;
  --bg: #030405;
  --panel: #111418;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f4f7fb;
  --muted: #838d9c;
  --blue: #4775ff;
  --violet: #826cff;
  --green: #25d67b;
  --red: #ff5d5d;
  --amber: #f3b43f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 50% 32%, rgba(71, 117, 255, 0.15), transparent 30%),
    linear-gradient(180deg, #060708 0%, var(--bg) 56%, #010101 100%);
  color: var(--text);
  overflow-x: hidden;
}

button,
a {
  cursor: pointer;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.choice-app {
  width: 100%;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 70px minmax(0, 1fr) 128px;
  padding: 0 22px;
}

.choice-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lesson-id {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dot {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: linear-gradient(135deg, #78a9ff, #735cff);
  box-shadow: 0 0 16px rgba(107, 111, 255, 0.8);
}

.lesson-id strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.lesson-id small {
  color: var(--muted);
  font-size: 12px;
}

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

.choice-actions a,
.choice-actions button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  color: #d9dee8;
  padding: 0 12px;
}

.choice-stage,
.group-complete {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.choice-stage {
  padding: 26px 0;
}

.timer-pill {
  position: absolute;
  left: 22px;
  top: 82px;
  color: #d9dee8;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  padding: 7px 10px;
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.mode-label {
  margin: 0 0 20px;
  color: #7180a6;
  font-size: 13px;
  font-weight: 760;
}

.meaning-panel {
  min-width: min(420px, 86vw);
  display: grid;
  gap: 7px;
  margin-bottom: 24px;
  padding: 16px 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(17, 20, 27, 0.72);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.3), 0 0 34px rgba(71, 117, 255, 0.18);
}

.meaning-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 740;
}

.meaning-panel strong {
  color: #f4f7fb;
  font-size: clamp(24px, 3.2vw, 42px);
  line-height: 1.15;
  font-weight: 780;
}

.meaning-panel small {
  color: rgba(213, 220, 235, 0.68);
  font-size: clamp(15px, 1.45vw, 21px);
}

.sentence-line {
  width: min(1100px, 100%);
  min-height: 122px;
  margin: 0;
  color: #f4f7fb;
  font-size: clamp(28px, 4.1vw, 52px);
  line-height: 1.35;
  font-weight: 520;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.sentence-blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3.2em;
  min-height: 1.08em;
  margin: 0 0.14em;
  border-bottom: 3px solid var(--blue);
  color: transparent;
  box-shadow: 0 12px 22px -20px rgba(71, 117, 255, 0.92);
}

.sentence-blank.is-revealed {
  min-width: auto;
  color: var(--blue);
  text-shadow: 0 0 18px rgba(71, 117, 255, 0.45);
}

.choice-note {
  margin: 16px 0 22px;
  color: rgba(222, 229, 242, 0.64);
  font-size: 15px;
}

.option-grid {
  width: min(880px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.option-button {
  min-height: 74px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.052);
  color: #edf3ff;
  font-size: clamp(20px, 2.4vw, 34px);
  font-weight: 780;
  letter-spacing: 0;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.option-button:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(71, 117, 255, 0.5);
  background: rgba(71, 117, 255, 0.16);
}

.option-button:disabled {
  cursor: default;
}

.option-button.is-correct {
  border-color: rgba(37, 214, 123, 0.55);
  background: rgba(37, 214, 123, 0.14);
  color: #dfffee;
  box-shadow: 0 0 30px rgba(37, 214, 123, 0.13);
}

.option-button.is-wrong {
  border-color: rgba(255, 93, 93, 0.58);
  background: rgba(255, 93, 93, 0.13);
  color: #ffd5d5;
  animation: choiceShake 180ms ease;
}

.option-button.is-muted {
  opacity: 0.44;
}

.option-index {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: rgba(222, 229, 242, 0.68);
  font-size: 13px;
  font-weight: 760;
}

.feedback-line {
  min-height: 30px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
}

.feedback-line.is-good {
  color: var(--green);
}

.feedback-line.is-bad {
  color: var(--red);
}

.next-button {
  min-height: 44px;
  min-width: 132px;
  margin-top: 4px;
  border: 1px solid rgba(71, 117, 255, 0.52);
  border-radius: 6px;
  background: rgba(71, 117, 255, 0.18);
  color: #f3f7fb;
  padding: 0 16px;
  font-weight: 760;
}

.next-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.group-complete {
  padding: 32px 18px;
}

.group-complete h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 92px);
  line-height: 0.98;
  letter-spacing: 0;
  text-shadow: 0 0 34px rgba(71, 117, 255, 0.34);
}

.group-complete p:not(.mode-label) {
  max-width: 620px;
  margin: 18px 0 0;
  color: rgba(222, 229, 242, 0.74);
  font-size: clamp(16px, 1.7vw, 22px);
  line-height: 1.55;
}

.complete-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.complete-actions button,
.complete-actions a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(71, 117, 255, 0.46);
  border-radius: 6px;
  background: rgba(71, 117, 255, 0.16);
  color: #edf3ff;
  padding: 0 16px;
  font-weight: 760;
}

.complete-actions button:first-child {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.055);
}

.choice-footer {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 12px;
  padding-bottom: 18px;
}

.choice-progress {
  width: min(760px, 72vw);
  height: 5px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.13);
}

.choice-progress span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--blue));
  transition: width 180ms ease;
}

.key-hints {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  color: #777f8a;
  font-size: 12px;
}

kbd {
  min-width: 28px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  padding: 0 7px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.08);
  color: #e8ebf1;
  font-family: inherit;
  font-size: 11px;
}

.stats-strip {
  width: min(720px, 88vw);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  overflow: hidden;
}

.stats-strip div {
  padding: 10px 12px;
  text-align: center;
}

.stats-strip div + div {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-strip strong,
.stats-strip small {
  display: block;
}

.stats-strip strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
}

.stats-strip small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

@keyframes choiceShake {
  0%,
  100% {
    transform: translateX(0);
  }

  35% {
    transform: translateX(-8px);
  }

  70% {
    transform: translateX(8px);
  }
}

@media (max-width: 760px) {
  .choice-app {
    grid-template-rows: auto minmax(480px, 1fr) auto;
    padding: 0 14px;
  }

  .choice-topbar {
    min-height: 68px;
    padding: 10px 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .choice-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .choice-actions a,
  .choice-actions button {
    min-height: 40px;
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
    padding: 0 8px;
  }

  .timer-pill {
    position: static;
    margin-bottom: 16px;
  }

  .meaning-panel {
    min-width: 0;
    width: 100%;
  }

  .sentence-line {
    min-height: 112px;
    font-size: clamp(24px, 8vw, 36px);
  }

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

  .option-button {
    min-height: 60px;
  }

  .choice-progress,
  .stats-strip {
    width: 100%;
  }
}
