:root {
  --ef-bg: #eef2f6;
  --ef-card: #ffffff;
  --ef-text: #17233a;
  --ef-muted: #46516a;
  --ef-accent: #ff7a00;
  --ef-accent-strong: #e56d00;
  --ef-border: #d6deea;
  --ef-success: #146a2e;
  --ef-error: #8a1d1d;
  --ef-shape-fill: #ff9228;
  --ef-shape-empty: #f8f8f8;
  --ef-shape-stroke: #101010;
}

* {
  box-sizing: border-box;
}

.equivalent-fractions-page {
  margin: 1rem auto 0;
  width: min(100%, 64rem);
  font-family: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ef-text);
}

.equivalent-fractions-page .card {
  width: 100%;
  background: var(--ef-card);
  border: 1px solid var(--ef-border);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 0.75rem 2rem rgba(23, 35, 58, 0.12);
}

.equivalent-fractions-page h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2.6vw, 2rem);
  text-align: center;
}

.page-subtitle {
  margin: 0.3rem 0 0 0;
  text-align: center;
  font-size: clamp(0.8rem, 1.5vw, 0.95rem);
  color: var(--ef-muted);
}

.status-row {
  margin-top: 0.8rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

#progress {
  display: none;
}

.status-item {
  margin: 0;
  border: 1px solid var(--ef-border);
  border-radius: 0.65rem;
  padding: 0.4rem 0.55rem;
  font-weight: 600;
  text-align: center;
  background: #fbfdff;
}

.milestone {
  margin: 0.6rem 0 0 0;
  color: var(--ef-muted);
  min-height: 1.4rem;
}

.activity-layout {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto minmax(12rem, 1fr);
  gap: 0.85rem;
  align-items: center;
  justify-items: center;
}

.equals-sign {
  font-size: clamp(3.2rem, 6vw, 5rem);
  line-height: 1;
  font-weight: 700;
}

.equation-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.fraction-display,
.fraction-input-wrap {
  width: 6rem;
  display: grid;
  justify-items: center;
  align-items: center;
}

.fraction-number {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  font-weight: 700;
}

.fraction-line {
  width: 100%;
  border-top: 5px solid #111111;
  margin: 0.22rem 0;
}

.shape-host {
  width: min(100%, 15rem);
  min-height: 15rem;
  display: grid;
  place-items: center;
}

.shape-host svg {
  width: 100%;
  height: auto;
  max-height: 18rem;
}

.shape-update-btn {
  border: 1px solid var(--ef-border);
  border-radius: 0.9rem;
  background: #fff;
  padding: 0.6rem;
  width: min(100%, 16.5rem);
  cursor: pointer;
}

.shape-update-btn:hover,
.shape-update-btn:focus-visible {
  border-color: var(--ef-accent);
}

.shape-help {
  margin: 0.45rem 0 0 0;
  text-align: center;
  color: var(--ef-muted);
}

#right-numerator {
  width: 100%;
  text-align: center;
  border: 1px solid var(--ef-border);
  border-radius: 0.55rem;
  padding: 0.45rem 0.55rem;
  font-size: clamp(1.5rem, 3.4vw, 2.15rem);
  font-weight: 700;
}

#right-numerator:focus,
#right-numerator:focus-visible {
  border-color: #777777;
  outline: 2px solid #777777;
  outline-offset: 2px;
  box-shadow: none;
}

.denominator-note {
  margin: 0.2rem auto 0 auto;
  max-width: 22rem;
  text-align: center;
  color: var(--ef-muted);
}

#question-form {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
}

button {
  font: inherit;
}

#next-btn,
#feedback-ok-btn {
  border: 1px solid var(--ef-accent);
  border-radius: 999px;
  padding: 0.55rem 1.2rem;
  background: var(--ef-accent);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

#next-btn:hover,
#feedback-ok-btn:hover,
#next-btn:focus-visible,
#feedback-ok-btn:focus-visible {
  background: var(--ef-accent-strong);
  border-color: var(--ef-accent-strong);
}

.result {
  margin: 0.35rem 0 0.45rem 0;
  min-height: 2rem;
  text-align: center;
  color: var(--ef-muted);
  font-weight: 600;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
}

.result.ok {
  color: var(--ef-success);
  font-size: 1.2rem;
  font-weight: 800;
}

.result.error {
  color: var(--ef-error);
  font-size: 1.05rem;
  width: 100%;
}

.ef-modal[hidden] {
  display: none;
}

.ef-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
}

.ef-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.ef-modal__dialog {
  position: relative;
  width: min(94vw, 28rem);
  background: #fff;
  border: 1px solid var(--ef-border);
  border-radius: 0.85rem;
  padding: 1rem;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.2);
}

.ef-modal__dialog h2 {
  margin: 0;
  font-size: 1.2rem;
}

.ef-modal__dialog p {
  margin: 0.6rem 0 0 0;
}

.feedback-equation {
  position: relative;
  margin-top: 0.9rem;
  min-height: 15.5rem;
  display: grid;
  place-items: center;
}

.feedback-arrow-layer {
  position: absolute;
  inset: 0.7rem 1.2rem 1rem 1.2rem;
  width: calc(100% - 2.4rem);
  height: calc(100% - 1.7rem);
}

.feedback-op {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 2px solid #222222;
  border-radius: 0.75rem;
  background: #ffffff;
  padding: 0.15rem 0.8rem;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.15;
}

.feedback-op-top {
  top: 0.45rem;
}

.feedback-op-bottom {
  bottom: 0.35rem;
}

.feedback-equation-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.15rem;
  margin-top: 0.2rem;
}

.feedback-fraction {
  width: 7rem;
  display: grid;
  justify-items: center;
  align-items: center;
}

.feedback-fraction-number {
  font-size: 2.7rem;
  line-height: 1;
  font-weight: 800;
  color: #111111;
}

.feedback-highlight {
  color: var(--ef-accent);
}

.feedback-fraction-line {
  width: 82%;
  border-top: 8px solid #111111;
  margin: 0.18rem 0;
}

.feedback-equals {
  font-size: 4.8rem;
  line-height: 1;
  font-weight: 800;
  color: #111111;
}

.ef-modal__actions {
  margin-top: 0.9rem;
  display: flex;
  justify-content: flex-end;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .activity-layout {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.55rem;
  }

  .equation-center {
    order: 2;
  }

  .status-row {
    grid-template-columns: 1fr;
  }

  .shape-host {
    width: min(100%, 13rem);
    min-height: 13rem;
  }

  .shape-update-btn {
    width: min(100%, 14.5rem);
  }
}

@media (max-width: 560px) {
  .equation-center {
    gap: 0.3rem;
  }

  .fraction-display,
  .fraction-input-wrap {
    width: 4.8rem;
  }

  .fraction-number {
    font-size: 2rem;
  }

  #right-numerator {
    font-size: 1.75rem;
  }

  .equals-sign {
    font-size: 2.8rem;
  }

  .feedback-equation {
    min-height: 13.3rem;
  }

  .feedback-op {
    font-size: 1.4rem;
    padding: 0.15rem 0.6rem;
  }

  .feedback-fraction {
    width: 5.5rem;
  }

  .feedback-fraction-number {
    font-size: 2.4rem;
  }

  .feedback-fraction-line {
    border-top-width: 6px;
  }

  .feedback-equals {
    font-size: 4.2rem;
  }
}
