:root {
  --irv-coral: #e56f64;
  --irv-coral-soft: #fff0ed;
  --irv-teal: #1e8f82;
  --irv-teal-soft: #e3f5f1;
  --irv-purple: #7252a3;
  --irv-purple-soft: #f0eafb;
  --irv-gold: #b47a12;
  --irv-gold-soft: #fff4d7;
  --irv-ink: #23272f;
  --irv-muted: #5d6878;
  --irv-line: rgba(56, 69, 79, 0.16);
  --irv-surface: rgba(255, 255, 255, 0.82);
}

.irregular-exercise-page {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--irv-ink);
  background: #edf3f2;
}

.irregular-exercise-page button,
.irregular-exercise-page input {
  font: inherit;
}

.irv-topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  grid-template-columns: minmax(92px, 1fr) auto minmax(92px, 1fr);
  align-items: center;
  min-height: 76px;
  padding: 8px clamp(12px, 3vw, 36px);
  border-bottom: 1px solid rgba(229, 111, 100, 0.26);
  background: rgba(255, 246, 244, 0.82);
  box-shadow: 0 8px 24px rgba(52, 61, 70, 0.08);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.irv-topbar__back,
.irv-topbar__table,
.irv-text-button {
  width: fit-content;
  border: 0;
  color: var(--irv-ink);
  background: transparent;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.irv-topbar__back {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--irv-line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.76);
}

.irv-topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--irv-ink);
  text-decoration: none;
}

.irv-topbar__brand img {
  width: 76px;
  height: 44px;
  object-fit: contain;
}

.irv-topbar__brand span {
  display: grid;
  gap: 1px;
}

.irv-topbar__brand small {
  color: var(--irv-coral);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.irv-topbar__brand strong {
  font-size: 0.96rem;
  white-space: nowrap;
}

.irv-topbar__table {
  justify-self: end;
  min-height: 42px;
  padding: 11px 15px;
  border: 1px solid var(--irv-line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.76);
}

.irv-topbar__back:hover,
.irv-topbar__table:hover,
.irv-topbar__back:focus-visible,
.irv-topbar__table:focus-visible,
.irv-text-button:hover,
.irv-text-button:focus-visible {
  color: var(--irv-coral);
}

.irv-main {
  min-height: calc(100dvh - 76px);
}

[data-irregular-app] [hidden] {
  display: none !important;
}

.irv-screen {
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100dvh - 76px);
  margin: 0 auto;
  padding: clamp(24px, 4vw, 54px) 0;
}

.irv-home {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(430px, 1.22fr);
  align-items: center;
  gap: clamp(28px, 6vw, 82px);
}

.irv-home__intro {
  align-self: center;
}

.irv-home__intro .eyebrow,
.irv-screen-heading .eyebrow,
.irv-result .eyebrow {
  margin: 0 0 10px;
  color: var(--irv-coral);
  font-weight: 900;
}

.irv-home__intro h1,
.irv-screen-heading h1,
.irv-result h1 {
  max-width: 680px;
  margin: 0;
  color: var(--irv-ink);
  font-size: 4.2rem;
  line-height: 1.02;
  letter-spacing: 0;
}

.irv-home__intro > p:not(.eyebrow),
.irv-screen-heading > p:not(.eyebrow),
.irv-result > p:not(.eyebrow) {
  max-width: 620px;
  margin: 20px 0 0;
  color: var(--irv-muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.irv-home__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 30px;
}

.irv-home__stats span {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 13px 10px;
  border: 1px solid var(--irv-line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--irv-muted);
  font-size: 0.78rem;
  text-align: center;
}

.irv-home__stats strong {
  color: var(--irv-ink);
  font-size: 1.35rem;
}

.irv-mode-list {
  display: grid;
  gap: 12px;
}

.irv-mode {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-height: 126px;
  padding: 20px 22px;
  overflow: hidden;
  border: 1px solid var(--irv-line);
  border-radius: 8px;
  color: var(--irv-ink);
  background: var(--irv-surface);
  box-shadow: 0 16px 38px rgba(47, 60, 67, 0.08);
  text-align: left;
  cursor: pointer;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.irv-mode:hover,
.irv-mode:focus-visible {
  transform: translateY(-2px);
  border-color: currentColor;
  box-shadow: 0 18px 42px rgba(47, 60, 67, 0.13);
}

.irv-mode--study { color: var(--irv-purple); }
.irv-mode--simple { color: var(--irv-teal); }
.irv-mode--hard { color: var(--irv-coral); }

.irv-mode > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.irv-mode strong {
  color: var(--irv-ink);
  font-size: 1.28rem;
}

.irv-mode small {
  color: var(--irv-muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.irv-mode__number {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 50%;
  background: currentColor;
  color: #fff;
  font-weight: 900;
}

.irv-mode__action {
  padding: 10px 12px;
  border-radius: 6px;
  background: currentColor;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
}

.irv-groups {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.irv-screen-heading {
  text-align: center;
}

.irv-screen-heading h1 {
  margin-inline: auto;
  font-size: 2.7rem;
}

.irv-screen-heading > p:not(.eyebrow) {
  margin-inline: auto;
}

.irv-group-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(70px, 1fr));
  gap: 10px;
  margin: 34px 0 24px;
}

.irv-group-button {
  display: grid;
  min-height: 82px;
  place-content: center;
  gap: 4px;
  border: 1px solid var(--irv-line);
  border-radius: 7px;
  color: var(--irv-ink);
  background: var(--irv-surface);
  cursor: pointer;
}

.irv-group-button strong {
  color: var(--irv-purple);
  font-size: 1.45rem;
}

.irv-group-button span {
  color: var(--irv-muted);
  font-size: 0.76rem;
}

.irv-group-button:hover,
.irv-group-button:focus-visible {
  border-color: var(--irv-purple);
  background: var(--irv-purple-soft);
}

.irv-groups > .irv-text-button {
  align-self: center;
  min-height: 44px;
  padding: 8px 14px;
}

.irv-quiz {
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: min(920px, calc(100% - 32px));
}

.irv-quiz-status {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  color: var(--irv-muted);
  font-weight: 800;
}

.irv-quiz-status > strong {
  min-width: 72px;
  color: var(--irv-ink);
  text-align: right;
}

.irv-progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(56, 69, 79, 0.12);
}

.irv-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--irv-teal);
  transition: width 220ms ease;
}

.irv-question {
  display: flex;
  flex-direction: column;
  min-height: 520px;
  padding: clamp(22px, 4vw, 46px);
  border: 1px solid rgba(229, 111, 100, 0.25);
  border-radius: 8px;
  background: var(--irv-surface);
  box-shadow: 0 22px 52px rgba(47, 60, 67, 0.11);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.irv-question__number {
  margin: 0 0 18px;
  color: var(--irv-coral);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.irv-question__prompt {
  color: var(--irv-muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.irv-question h1,
.irv-study-card h1 {
  margin: 8px 0 28px;
  color: var(--irv-ink);
  font-size: 2.55rem;
  line-height: 1.08;
  letter-spacing: 0;
}

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

.irv-form-field {
  display: grid;
  align-content: start;
  min-height: 126px;
  padding: 15px;
  border: 1px solid var(--irv-line);
  border-radius: 7px;
  background: rgba(248, 250, 250, 0.82);
}

.irv-form-field label {
  display: grid;
  gap: 2px;
  margin-bottom: 12px;
  color: var(--irv-ink);
  font-size: 0.86rem;
  font-weight: 900;
}

.irv-form-field label small {
  color: var(--irv-muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.irv-form-field input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 12px;
  border: 2px solid rgba(30, 143, 130, 0.36);
  border-radius: 6px;
  outline: none;
  color: var(--irv-ink);
  background: #fff;
  font-size: 1.04rem;
  font-weight: 800;
}

.irv-form-field input:focus {
  border-color: var(--irv-teal);
  box-shadow: 0 0 0 4px rgba(30, 143, 130, 0.12);
}

.irv-known-form {
  display: flex;
  align-items: center;
  min-height: 48px;
  color: var(--irv-ink);
  font-size: 1.18rem;
}

.irv-form-field.is-correct {
  border-color: rgba(30, 143, 130, 0.55);
  background: var(--irv-teal-soft);
}

.irv-form-field.is-wrong {
  border-color: rgba(229, 111, 100, 0.58);
  background: var(--irv-coral-soft);
}

.irv-feedback {
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid var(--irv-line);
  border-radius: 7px;
}

.irv-feedback.is-correct {
  border-color: rgba(30, 143, 130, 0.42);
  background: var(--irv-teal-soft);
}

.irv-feedback.is-wrong {
  border-color: rgba(229, 111, 100, 0.45);
  background: var(--irv-coral-soft);
}

.irv-feedback > strong {
  font-size: 1rem;
}

.irv-feedback > p {
  margin: 5px 0 12px;
  color: var(--irv-muted);
  line-height: 1.45;
}

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

.irv-feedback__details > div {
  display: grid;
  gap: 2px;
  padding-top: 9px;
  border-top: 1px solid var(--irv-line);
}

.irv-feedback__details span {
  color: var(--irv-muted);
  font-size: 0.74rem;
}

.irv-feedback__details strong {
  overflow-wrap: anywhere;
  font-size: 0.88rem;
}

.irv-feedback__details .is-correct strong { color: var(--irv-teal); }
.irv-feedback__details .is-wrong strong { color: #bd5148; }

.irv-question__actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
  padding-top: 20px;
}

.irv-question__actions .button {
  min-width: 170px;
  min-height: 50px;
  justify-content: center;
}

.irv-question__actions [data-irregular-check],
.irv-question__actions [data-irregular-next] {
  flex: 1;
}

.irv-study {
  display: grid;
  align-content: center;
  width: min(760px, calc(100% - 32px));
}

.irv-study__status {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--irv-muted);
}

.irv-study-card {
  display: grid;
  min-height: 500px;
  padding: clamp(26px, 5vw, 54px);
  border: 1px solid rgba(114, 82, 163, 0.3);
  border-radius: 8px;
  background: var(--irv-surface);
  box-shadow: 0 22px 52px rgba(47, 60, 67, 0.11);
  text-align: center;
}

.irv-study-card > p {
  margin: 0;
  color: var(--irv-muted);
  font-weight: 800;
}

.irv-study-card h1 {
  align-self: center;
  margin: 16px 0 26px;
  font-size: 3rem;
}

.irv-study-forms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-self: center;
  margin-bottom: 22px;
}

.irv-study-forms > div {
  display: grid;
  gap: 6px;
  padding: 17px 10px;
  border: 1px solid rgba(114, 82, 163, 0.22);
  border-radius: 7px;
  background: var(--irv-purple-soft);
}

.irv-study-forms span {
  color: var(--irv-muted);
  font-size: 0.76rem;
}

.irv-study-forms strong {
  overflow-wrap: anywhere;
  font-size: 1.12rem;
}

.irv-study-card > .button {
  align-self: end;
  justify-self: center;
  min-width: 220px;
}

.irv-study-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-self: end;
  gap: 10px;
}

.irv-study-actions .button {
  justify-content: center;
}

.irv-study-actions .button--secondary {
  color: var(--irv-ink);
  border-color: rgba(94, 73, 151, 0.32);
  background: rgba(240, 235, 251, 0.9);
}

.irv-study-actions .button--secondary:hover,
.irv-study-actions .button--secondary:focus-visible {
  color: #4f3a8d;
  border-color: rgba(94, 73, 151, 0.62);
  background: #ebe3fa;
}

.irv-result {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: min(760px, calc(100% - 32px));
  text-align: center;
}

.irv-result__score {
  display: grid;
  width: 136px;
  height: 136px;
  place-items: center;
  margin-bottom: 24px;
  border: 8px solid rgba(30, 143, 130, 0.18);
  border-radius: 50%;
  color: var(--irv-teal);
  background: var(--irv-teal-soft);
  font-size: 1.55rem;
  font-weight: 900;
}

.irv-result h1 {
  font-size: 2.65rem;
}

.irv-result > p:not(.eyebrow) {
  margin: 12px auto 0;
}

.irv-result__mistakes {
  width: 100%;
  max-height: 190px;
  margin-top: 24px;
  padding: 16px 18px;
  overflow: auto;
  border: 1px solid var(--irv-line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.68);
  text-align: left;
}

.irv-result__mistakes ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 18px;
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--irv-muted);
}

.irv-result__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.irv-result__actions .button {
  justify-content: center;
}

.irv-result__actions .irv-text-button {
  flex-basis: 100%;
  margin-inline: auto;
  padding: 10px;
}

@media (max-width: 820px) {
  .irv-topbar {
    grid-template-columns: auto 1fr auto;
    min-height: 68px;
    padding: 7px 10px;
  }

  .irv-topbar__brand {
    justify-self: center;
  }

  .irv-topbar__brand img {
    width: 62px;
    height: 38px;
  }

  .irv-topbar__brand small,
  .irv-topbar__brand strong {
    display: none;
  }

  .irv-topbar__back,
  .irv-topbar__table {
    min-height: 40px;
    padding: 9px 11px;
    font-size: 0.82rem;
  }

  .irv-main,
  .irv-screen {
    min-height: calc(100dvh - 68px);
  }

  .irv-screen {
    width: min(100% - 24px, 720px);
    padding: 20px 0;
  }

  .irv-home {
    grid-template-columns: 1fr;
    align-content: center;
    gap: 20px;
  }

  .irv-home__intro h1 {
    font-size: 2.5rem;
  }

  .irv-home__intro > p:not(.eyebrow) {
    margin-top: 12px;
    font-size: 0.94rem;
  }

  .irv-home__stats {
    margin-top: 16px;
  }

  .irv-mode-list {
    gap: 9px;
  }

  .irv-mode {
    min-height: 98px;
    padding: 14px;
  }

  .irv-mode strong {
    font-size: 1.08rem;
  }

  .irv-mode small {
    font-size: 0.82rem;
  }

  .irv-group-grid {
    grid-template-columns: repeat(5, minmax(56px, 1fr));
    margin-top: 24px;
  }

  .irv-question {
    min-height: min(610px, calc(100dvh - 120px));
    padding: 24px;
  }

  .irv-question h1 {
    font-size: 2.15rem;
  }
}

@media (max-width: 560px) {
  .irv-home {
    align-content: start;
  }

  .irv-home__intro .eyebrow {
    margin-bottom: 5px;
    font-size: 0.72rem;
  }

  .irv-home__intro h1 {
    font-size: 2.05rem;
  }

  .irv-home__intro > p:not(.eyebrow) {
    line-height: 1.45;
  }

  .irv-home__stats span {
    padding: 8px 5px;
    font-size: 0.68rem;
  }

  .irv-home__stats strong {
    font-size: 1.08rem;
  }

  .irv-mode {
    grid-template-columns: 42px minmax(0, 1fr);
    min-height: 90px;
    gap: 12px;
    padding: 12px;
  }

  .irv-mode__number {
    width: 40px;
    height: 40px;
    font-size: 0.78rem;
  }

  .irv-mode__action {
    display: none;
  }

  .irv-mode strong {
    font-size: 1rem;
  }

  .irv-mode small {
    font-size: 0.75rem;
    line-height: 1.35;
  }

  .irv-screen-heading h1,
  .irv-result h1 {
    font-size: 2rem;
  }

  .irv-screen-heading > p:not(.eyebrow) {
    margin-top: 10px;
    font-size: 0.9rem;
  }

  .irv-group-grid {
    grid-template-columns: repeat(4, minmax(54px, 1fr));
    gap: 7px;
  }

  .irv-group-button {
    min-height: 65px;
  }

  .irv-quiz {
    justify-content: flex-start;
  }

  .irv-quiz-status {
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.78rem;
  }

  .irv-question {
    min-height: 0;
    padding: 18px 14px;
  }

  .irv-question__number {
    margin-bottom: 10px;
  }

  .irv-question h1 {
    margin: 6px 0 18px;
    font-size: 1.85rem;
  }

  .irv-form-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .irv-form-field {
    grid-template-columns: minmax(104px, 0.82fr) minmax(0, 1.18fr);
    align-items: center;
    min-height: 68px;
    padding: 10px 12px;
  }

  .irv-form-field label {
    min-height: 0;
    margin: 0;
    padding-right: 10px;
    font-size: 0.78rem;
  }

  .irv-form-field label small {
    font-size: 0.66rem;
  }

  .irv-form-field input {
    height: 46px;
    padding: 0 10px;
    font-size: 0.92rem;
  }

  .irv-known-form {
    min-height: 46px;
    font-size: 0.94rem;
    overflow-wrap: anywhere;
  }

  .irv-feedback {
    padding: 12px;
  }

  .irv-feedback > p {
    font-size: 0.8rem;
  }

  .irv-feedback__details {
    gap: 5px;
  }

  .irv-feedback__details span {
    font-size: 0.62rem;
  }

  .irv-feedback__details strong {
    font-size: 0.72rem;
  }

  .irv-question__actions {
    gap: 7px;
  }

  .irv-question__actions .button {
    min-width: 0;
    min-height: 46px;
    padding-inline: 12px;
    font-size: 0.83rem;
  }

  .irv-study-card {
    min-height: calc(100dvh - 122px);
    padding: 22px 14px;
  }

  .irv-study-card h1 {
    font-size: 2.3rem;
  }

  .irv-study-forms {
    gap: 6px;
  }

  .irv-study-forms > div {
    padding: 12px 6px;
  }

  .irv-study-forms strong {
    font-size: 0.84rem;
  }

  .irv-result__score {
    width: 108px;
    height: 108px;
    margin-bottom: 16px;
  }

  .irv-result__mistakes ul {
    grid-template-columns: 1fr;
  }

  .irv-result__actions {
    display: grid;
    width: 100%;
  }
}

@media (max-height: 700px) and (min-width: 821px) {
  .irv-screen {
    padding-block: 18px;
  }

  .irv-question {
    min-height: 500px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .irv-mode,
  .irv-progress span {
    transition: none;
  }
}
