@layer components {
  /* Full-page error layout — used by Symfony's exception templates at
   * templates/bundles/TwigBundle/Exception/error{code}.html.twig.
   *
   * The visual language is consistent with the inline match-list error:
   * a centered red-card / goal SVG, a code label, a short heading and a
   * one-line message. Where the inline error replaces the match list,
   * this fills the viewport between header and bottom nav. */
  .error-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 200px);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    color: var(--color-text);
  }

  .error-page__icon {
    width: 120px;
    height: 120px;
    margin-bottom: var(--space-6);
    color: var(--color-text-muted);
  }

  .error-page__icon svg {
    width: 100%;
    height: 100%;
  }

  /* Red card sway — same wave the inline match-list error uses, but
   * exposed under its own keyframe name so error-page.css doesn't
   * depend on league-group.css being loaded. */
  .error-page__card {
    transform-origin: center bottom;
    animation: error-page-card-wave 2s ease-in-out infinite;
  }

  @keyframes error-page-card-wave {
    0%,
    100% {
      transform: rotate(-5deg);
    }

    50% {
      transform: rotate(5deg);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .error-page__card {
      animation: none;
    }
  }

  .error-page__title {
    font-family: var(--font-title);
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 var(--space-3);
    color: var(--color-text);
  }

  .error-page__message {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    line-height: 1.6;
    max-width: 32ch;
    margin: 0 0 var(--space-6);
  }

  .error-page__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
  }

  .error-page__btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    background: var(--color-accent);
    color: var(--color-on-accent);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    text-decoration: none;
    cursor: pointer;
    transition:
      transform var(--duration-fast) var(--easing-default),
      box-shadow var(--duration-fast) var(--easing-default);
  }

  .error-page__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px color-mix(in oklab, var(--color-accent) 35%, transparent);
  }

  .error-page__btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
  }

  .error-page__btn--secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
  }

  .error-page__btn--secondary:hover {
    background: var(--color-surface-hover, var(--color-surface));
    border-color: var(--color-accent);
    box-shadow: none;
  }

  .error-page__btn svg {
    width: 16px;
    height: 16px;
    stroke: currentcolor;
    fill: none;
  }

  /* === 404 — empty goal with code on the line =======================
   * The composition keeps a single subtle motion: a horizontal scan
   * line sweeps the goal area like a VAR review monitor. Everything
   * else is static — the "404" sits inside the frame where the
   * phantom ball would have crossed.
   * =================================================================== */
  .error-page__goal-frame {
    fill: none;
    stroke: var(--color-text-muted);
    stroke-width: 2.5;
  }

  .error-page__goal-line {
    stroke: var(--color-accent);
    stroke-width: 3;
    stroke-linecap: round;
  }

  .error-page__goal-scan {
    stroke: var(--color-accent);
    stroke-width: 1.4;
    opacity: 0.55;
    animation: error-page-goal-scan 2.6s ease-in-out infinite;
  }

  @keyframes error-page-goal-scan {
    0% {
      transform: translateY(0);
      opacity: 0.55;
    }

    50% {
      transform: translateY(48px);
      opacity: 0.25;
    }

    100% {
      transform: translateY(0);
      opacity: 0.55;
    }
  }

  .error-page__goal-code {
    text-anchor: middle;
    font-family: var(--font-title);
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 4px;
    fill: var(--color-text);
    stroke: none;
  }

  @media (prefers-reduced-motion: reduce) {
    .error-page__goal-scan {
      animation: none;
      opacity: 0.25;
    }
  }
}
