@font-face {
  font-family: "Arcade";
  src: url("../fonts/arcade_font.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --fg: #535353;
  --muted: #8d9297;
  --soft: #d9dde0;
  --switch-shell: #f0f1f2;
  --switch-active: #5c6064;
  --switch-disc: #ffffff;
}

:root[data-theme="dark"] {
  --bg: #202225;
  --fg: #acacac;
  --muted: #85898d;
  --soft: #44474a;
  --switch-shell: #2c2f32;
  --switch-active: #c4c7c9;
  --switch-disc: #222529;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: Arial, Helvetica, sans-serif;
  transition: background-color .35s ease, color .35s ease;
}

.svg-symbols {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.top-actions {
  position: fixed;
  z-index: 20;
  top: max(24px, env(safe-area-inset-top));
  right: max(30px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
}

/* Margin instead of flex `gap`: identical spacing, works on old iOS. */
.top-actions > * + * {
  margin-left: 13px;
}

.github-link {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--fg);
  border-radius: 8px;
  text-decoration: none;
  transition: opacity .2s ease, transform .2s ease;
}

.github-link:hover {
  opacity: .72;
  transform: translateY(-1px);
}

.github-link svg {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

.separator {
  width: 1px;
  height: 27px;
  background: var(--soft);
}



.theme-toggle {
  --size: 36px;
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  min-width: var(--size);
  min-height: var(--size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  outline-offset: 4px;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  opacity: .76;
}

.theme-toggle__icons {
  position: relative;
  display: block;
  width: 24px;
  height: 24px;
}

.theme-toggle__sun,
.theme-toggle__moon {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 24px;
  height: 24px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Source of truth is `display`, not opacity: exactly one icon is rendered
 * at full size even where opacity/transforms misbehave (old iOS). */
.theme-toggle__moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle__moon {
  display: block;
}

/* Entrance animation; ignored where unsupported, icon just appears. */
:root[data-theme="light"] .theme-toggle__sun,
:root[data-theme="dark"] .theme-toggle__moon {
  -webkit-animation: theme-icon-in .42s cubic-bezier(.2,.75,.25,1);
  animation: theme-icon-in .42s cubic-bezier(.2,.75,.25,1);
}

@-webkit-keyframes theme-icon-in {
  from { -webkit-transform: rotate(-90deg) scale(.5); }
  to { -webkit-transform: rotate(0deg) scale(1); }
}

@keyframes theme-icon-in {
  from { transform: rotate(-90deg) scale(.5); }
  to { transform: rotate(0deg) scale(1); }
}

@media (hover: none) {
  .theme-toggle {
    --size: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle__sun,
  .theme-toggle__moon {
    -webkit-animation: none !important;
    animation: none !important;
  }
}

.hero {
  position: fixed;
  z-index: 3;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  width: min(94vw, 1100px);
  text-align: center;
  pointer-events: none;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

.domain {
  margin: 0 0 27px;
  color: var(--muted);
  font-size: clamp(10px, .75vw, 12px);
  font-weight: 700;
  letter-spacing: .33em;
}

h1 {
  margin: 0;
  color: var(--fg);
  font-family: "Arcade", monospace;
  font-size: clamp(40px, 4.4vw, 72px);
  font-weight: 400;
  line-height: .95;
  letter-spacing: .02em;
  white-space: nowrap;
}

.subtitle {
  margin: 27px 0 0;
  color: var(--muted);
  font-family: "Arcade", monospace;
  font-size: clamp(11px, .82vw, 14px);
  letter-spacing: .055em;
}

.dino-stage {
  position: fixed;
  z-index: 1;
  left: 0;
  right: 0;
  bottom: calc(38px + env(safe-area-inset-bottom));
  width: 100%;
  height: clamp(220px, 30dvh, 320px);
  overflow: hidden;
  pointer-events: none;
}

#board {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  image-rendering: pixelated;
}

footer {
  position: fixed;
  z-index: 10;
  left: max(34px, env(safe-area-inset-left));
  right: max(34px, env(safe-area-inset-right));
  bottom: max(15px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: .06em;
}

@media (max-width: 760px) {
  .top-actions {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
  }

  .hero {
    top: 34%;
    width: 96vw;
    padding-left: 8px;
    padding-right: 8px;
  }

  .domain {
    margin-bottom: 18px;
    font-size: 11px;
    letter-spacing: .16em;
  }

  h1 {
    font-size: clamp(24px, 7.9vw, 39px);
    white-space: nowrap;
    line-height: 1.05;
    letter-spacing: 0;
  }

  .subtitle {
    margin-top: 18px;
    font-size: 13px;
    line-height: 1.4;
    letter-spacing: .04em;
  }

  .dino-stage {
    bottom: calc(34px + env(safe-area-inset-bottom));
    height: clamp(210px, 31dvh, 270px);
  }

  footer {
    left: max(14px, env(safe-area-inset-left));
    right: max(14px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    font-size: 9px;
  }

  .footer-right {
    display: none;
  }
}

@media (max-height: 700px) {
  .hero {
    top: 31%;
  }

  .dino-stage {
    height: 205px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .github-link,
  .theme-toggle,
  .sun-and-moon > .sun,
  .sun-and-moon > .sun-beams,
  .sun-and-moon .moon-cutout {
    transition: none !important;
  }
}
