@layer reset {
  /*
    Josh's Custom CSS Reset
    https://www.joshwcomeau.com/css/custom-css-reset/
  */

  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  *:not(dialog) {
    margin: 0;
  }

  @media (prefers-reduced-motion: no-preference) {
    html {
      interpolate-size: allow-keywords;
    }
  }

  body {
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }

  img,
  picture,
  video,
  canvas,
  svg {
    display: block;
    max-width: 100%;
  }

  input,
  button,
  textarea,
  select {
    font: inherit;
  }

  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    overflow-wrap: break-word;
  }

  p {
    text-wrap: pretty;
  }
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    text-wrap: balance;
  }

  #root,
  #__next {
    isolation: isolate;
  }
}

@layer base {
  body {
    font-family: "Segoe UI", Arial, sans-serif;
  }

  hr {
    margin-block-start: 1rem;
    margin-block-end: 0.6rem;
  }
}

@layer main {
  .heading-container {
    text-align: center;
    max-width: 30rem;
    padding: 0.5rem 2rem;
    margin-inline: auto;
  }

  .game-container {
    margin-block: 2rem;
    background-color: #ddd;
  }

  .wrapper {
    max-width: 30rem;
    padding: 1.4rem 2rem;
    margin-inline: auto;
  }

  .settings-heading {
    font-size: 1.2rem;
    margin-block-end: 0.6rem;
  }

  .prose {
    margin-block-end: 1rem;
  }

  .modes-fieldset {
    border: 0;
    padding: 0;
  }

  .modes-legend {
    float: left;
    margin-inline-end: 0.2rem;
  }

  .modes-button-container {
    display: flex;
    flex-direction: column;
  }

  .time-select-container {
    margin-block: 0.6rem;
  }

  .game-stats {
    display: flex;
    justify-content: space-between;
  }

  .score,
  .timer {
    font-weight: 700;
    font-size: 1.2rem;
  }

  .calculation-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 5rem;
    margin-inline: auto;
    font-size: 2rem;
  }

  .expression {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-inline: 0.5rem;
    width: 100%;
  }

  .bottom-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
  }

  .equals-line {
    height: 0.2rem;
    width: 100%;
    background-color: black;
    margin-block-end: 0.6rem;
  }

  .answer-submit-box {
    width: 100%;
    text-align: right;
  }

  .game-over {
    text-align: center;
  }

  .final-score {
    font-weight: 700;
    font-size: 2.4rem;
    margin-block: 3rem;
  }
}

@layer utilities {
  [hidden] {
    display: none !important;
  }

  .link-btn {
    display: inline;
    padding: 0;
    border: 0;
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
    background: transparent;
    color: #0000ee;
  }

  .monospace {
    font-family: monospace, monospace;
  }

  .visually-hidden {
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    position: absolute;
    white-space: nowrap;
  }
}

@layer media-queries {
  @media (width < 500px) {
    .mode-label {
      display: grid;
      grid-template-columns: fit-content(1rem) 1fr;
      column-gap: 0.25rem;
      align-items: center;
    }

    .mode-label-example {
      grid-column-start: 2;
    }
  }
}
