:root {
  color-scheme: light;
  --background: #FFFFFF;
  --surface: #F7F7F5;
  --surface-strong: #EFEFED;
  --text: #202124;
  --muted: #666A70;
  --line: #CFCFC9;
  --accent: #CE1628;
  --accent-strong: #A90F1F;
  --accent-soft: #FFF2F0;
  --button-text: #FFF7F7;
  --panel-text: #242629;
  --shadow: 0 28px 80px rgb(70 61 62 / 12%);
  --radius: 16px;
  font-family: Lato, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, transparent 0 71%, rgb(206 22 40 / 4%) 71% 100%),
    var(--background);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent);
  outline-offset: 4px;
}

.page-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: calc(100% - 48px);
  max-width: 1180px;
  min-height: 100dvh;
  margin-inline: auto;
}

.site-header,
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header {
  min-height: 76px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.045em;
  text-decoration: none;
}

.brand span span {
  color: var(--accent);
}

.brand-mark {
  display: block;
  width: 27px;
  height: 36px;
  object-fit: contain;
}

.service-state {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.service-state__dot {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
}

.service-state__dot::after {
  position: absolute;
  inset: -5px;
  border: 1px solid var(--accent);
  border-radius: inherit;
  content: "";
  opacity: 0.28;
}

.maintenance-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.72fr);
  gap: clamp(48px, 8vw, 112px);
  align-items: center;
  padding-block: 40px;
}

.maintenance-layout > * {
  min-width: 0;
}

.message {
  padding-block: 24px;
}

.eyebrow {
  margin: 0 0 22px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(42px, 6.1vw, 76px);
  font-weight: 750;
  letter-spacing: -0.055em;
  line-height: 0.99;
  overflow-wrap: break-word;
  text-wrap: balance;
}

.message__body {
  max-width: 510px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.65;
}

.actions {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 36px;
}

.retry-button {
  min-width: 132px;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent);
  box-shadow: 0 9px 26px rgb(206 22 40 / 20%);
  color: var(--button-text);
  cursor: pointer;
  font-weight: 750;
  white-space: nowrap;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    box-shadow 160ms ease;
}

.retry-button:hover {
  background: var(--accent-strong);
  box-shadow: 0 12px 32px rgb(206 22 40 / 27%);
  transform: translateY(-2px);
}

.retry-button:active {
  transform: translateY(1px) scale(0.98);
}

.retry-button:disabled {
  cursor: wait;
  opacity: 0.7;
  transform: none;
}

.next-check {
  display: grid;
  gap: 3px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.next-check strong {
  color: var(--text);
  font-weight: 700;
}

.status-panel {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: min(56vh, 510px);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgb(255 255 255 / 35%), transparent 42%),
    var(--accent-soft);
  box-shadow: var(--shadow);
}

.status-panel::before {
  position: absolute;
  top: 0;
  right: 0;
  width: 42%;
  height: 8px;
  background: var(--accent);
  content: "";
}

.status-panel__code {
  position: absolute;
  top: 18px;
  left: -18px;
  z-index: -1;
  color: color-mix(in srgb, var(--accent) 10%, transparent);
  font-size: clamp(128px, 17vw, 220px);
  font-weight: 850;
  letter-spacing: -0.09em;
  line-height: 1;
}

.status-panel__visual {
  display: grid;
  place-items: center;
  min-height: 400px;
  padding: 54px 52px 82px;
}

.status-panel__visual img {
  display: block;
  width: min(72%, 236px);
  height: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
  filter: drop-shadow(0 24px 30px rgb(103 25 33 / 16%));
}

.status-panel__caption {
  position: absolute;
  right: 28px;
  bottom: 25px;
  left: 28px;
  display: grid;
  gap: 5px;
  padding-top: 16px;
  border-top: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--panel-text);
}

.status-panel__caption span {
  font-size: 12px;
  letter-spacing: 0.03em;
  opacity: 0.64;
}

.status-panel__caption strong {
  font-size: 14px;
  font-weight: 750;
  text-transform: uppercase;
}

.site-footer {
  min-height: 74px;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.site-footer p {
  margin: 0;
}

.noscript-message {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  margin: 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--background);
  text-align: center;
}

@media (max-width: 800px) {
  body {
    background: var(--background);
  }

  .page-shell {
    width: calc(100% - 32px);
    max-width: 620px;
  }

  .maintenance-layout {
    grid-template-columns: 1fr;
    gap: 18px;
    align-content: center;
    padding-block: 36px;
  }

  .message {
    padding-block: 8px 24px;
  }

  h1 {
    font-size: clamp(40px, 12vw, 64px);
    line-height: 1.02;
    text-wrap: pretty;
  }

  .status-panel {
    min-height: 320px;
  }

  .status-panel__visual {
    min-height: 320px;
    padding: 40px 40px 74px;
  }

  .status-panel__visual img {
    width: min(52%, 170px);
  }
}

@media (max-width: 520px) {
  .site-header {
    min-height: 68px;
  }

  .brand {
    font-size: 16px;
  }

  .brand-mark {
    width: 23px;
    height: 31px;
  }

  .service-state {
    gap: 7px;
    font-size: 12px;
    flex-shrink: 0;
  }

  .maintenance-layout {
    padding-block: 28px;
  }

  .eyebrow {
    margin-bottom: 17px;
  }

  h1 {
    font-size: clamp(38px, 12vw, 52px);
    hyphens: auto;
  }

  .message__body {
    margin-top: 22px;
    font-size: 16px;
  }

  .actions {
    align-items: stretch;
    flex-direction: column;
    gap: 15px;
    margin-top: 28px;
  }

  .retry-button {
    width: 100%;
  }

  .next-check {
    grid-template-columns: auto auto;
    justify-content: center;
    gap: 5px;
    text-align: center;
  }

  .status-panel {
    min-height: 280px;
  }

  .status-panel__visual {
    min-height: 280px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    min-height: 96px;
    gap: 6px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .message > * {
    animation: enter 560ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .message > :nth-child(2) {
    animation-delay: 70ms;
  }

  .message > :nth-child(3) {
    animation-delay: 130ms;
  }

  .message > :nth-child(4) {
    animation-delay: 190ms;
  }

  .status-panel {
    animation: enter-panel 680ms 100ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .service-state__dot::after {
    animation: status-pulse 2.4s ease-out infinite;
  }
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes enter-panel {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes status-pulse {
  0% {
    opacity: 0.34;
    transform: scale(0.7);
  }

  70%,
  100% {
    opacity: 0;
    transform: scale(1.65);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
