:root {
  --ink: #07091d;
  --panel: #111632;
  --cyan: #52f7ff;
  --violet: #9e5cff;
  --yellow: #ffd84d;
  --magenta: #ff4fd8;
  --paper: #f7f4ff;
  --muted: #a7abc8;
  color-scheme: dark;
  font-family: ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--ink);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--paper);
  background:
    radial-gradient(circle at 50% -15%, rgb(82 247 255 / 13%), transparent 39rem),
    linear-gradient(145deg, #080a21 0%, #050717 58%, #0c0920 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  content: "";
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgb(82 247 255 / 5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(82 247 255 / 5%) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 30;
  padding: 0.75rem 1rem;
  color: var(--ink);
  background: var(--yellow);
  border-radius: 999px;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 18rem;
  aspect-ratio: 1;
  pointer-events: none;
  border: 1px solid rgb(158 92 255 / 25%);
  border-radius: 50%;
  filter: blur(1px);
  animation: float 9s ease-in-out infinite;
}

.ambient::before,
.ambient::after {
  position: absolute;
  inset: 18%;
  content: "";
  border: inherit;
  border-color: rgb(82 247 255 / 18%);
  border-radius: inherit;
}

.ambient::after {
  inset: 36%;
}

.ambient-one {
  top: 18%;
  left: -12rem;
}

.ambient-two {
  right: -12rem;
  bottom: 7%;
  animation-delay: -4s;
}

.app-shell {
  width: min(100%, 66rem);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 0.65rem;
}

.game-header,
.scoreboard {
  width: min(100%, 59.5rem);
  margin-inline: auto;
}

.game-header {
  min-height: 2.7rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
}

.game-header .brand {
  justify-self: start;
}

.dorak-back {
  justify-self: start;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-decoration: none;
  transition: color 140ms ease;
}

.dorak-back:hover,
.dorak-back:focus-visible {
  color: var(--yellow);
  outline: none;
}

.brand {
  display: inline-flex;
  gap: 0.65rem;
  align-items: center;
  color: var(--paper);
  font-size: clamp(0.8rem, 2.8vw, 1rem);
  font-weight: 900;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  width: 1.85rem;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--yellow);
  border-radius: 50%;
  box-shadow: 0 0 1.25rem rgb(255 216 77 / 32%);
}

.brand-mark::after {
  position: absolute;
  right: -1px;
  content: "";
  width: 58%;
  height: 58%;
  background: var(--ink);
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}

.status-chip,
.eyebrow,
.direction-label,
.stat-label {
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.status-chip {
  padding: 0.42rem 0.72rem;
  color: var(--cyan);
  background: rgb(82 247 255 / 8%);
  border: 1px solid rgb(82 247 255 / 27%);
  border-radius: 999px;
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(4rem, 1fr)) auto;
  align-items: center;
  min-height: 4rem;
  overflow: hidden;
  background: linear-gradient(115deg, rgb(17 22 50 / 90%), rgb(11 15 38 / 78%));
  border: 1px solid rgb(167 171 200 / 16%);
  border-radius: 1.1rem;
  box-shadow: 0 1rem 3rem rgb(0 0 0 / 22%);
  backdrop-filter: blur(14px);
}

.stat {
  min-width: 0;
  padding: 0.68rem clamp(0.65rem, 3vw, 1.3rem);
  display: grid;
  gap: 0.18rem;
  border-right: 1px solid rgb(167 171 200 / 10%);
}

.stat-label {
  color: var(--muted);
}

.stat strong {
  overflow: hidden;
  color: var(--paper);
  font-family: "Arial Black", ui-rounded, sans-serif;
  font-size: clamp(1rem, 4.2vw, 1.45rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
}

.stat-score strong {
  color: var(--yellow);
}

.stat-lives strong {
  color: var(--cyan);
  font-size: clamp(0.86rem, 3.6vw, 1.2rem);
  letter-spacing: 0.12em;
}

.hud-actions {
  padding: 0.45rem;
  display: flex;
  gap: 0.35rem;
}

.icon-button,
.direction-button {
  display: grid;
  place-items: center;
  border: 1px solid rgb(167 171 200 / 20%);
  cursor: pointer;
  background: rgb(255 255 255 / 4%);
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.icon-button {
  width: 2.8rem;
  min-width: 2.8rem;
  height: 2.8rem;
  border-radius: 0.85rem;
  font-size: 1.15rem;
}

.icon-button:hover,
.direction-button:hover {
  background: rgb(82 247 255 / 11%);
  border-color: rgb(82 247 255 / 52%);
}

.icon-button:disabled {
  opacity: 0.34;
  cursor: not-allowed;
}

.icon-button.is-active {
  color: var(--magenta);
  border-color: rgb(255 79 216 / 44%);
}

.icon-button:active,
.direction-button:active,
.primary-button:active {
  transform: scale(0.96);
}

.play-area {
  min-height: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.55rem;
}

.canvas-frame {
  position: relative;
  width: min(100%, 63.25rem, calc((100svh - 11.5rem) * 1.353));
  overflow: hidden;
  background: #070a1b;
  border: 1px solid rgb(82 247 255 / 28%);
  border-radius: clamp(0.9rem, 2vw, 1.35rem);
  box-shadow:
    0 0 0 1px rgb(158 92 255 / 15%) inset,
    0 1.5rem 5rem rgb(0 0 0 / 46%),
    0 0 2.5rem rgb(82 247 255 / 8%);
}

.canvas-frame::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  content: "";
  pointer-events: none;
  border-radius: inherit;
  box-shadow: 0 0 0.8rem rgb(82 247 255 / 12%) inset;
}

#game-canvas {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 1012 / 748;
  outline: 0;
  touch-action: none;
}

.game-overlay,
.asset-error {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: clamp(0.8rem, 4vw, 2.2rem);
  text-align: center;
  background:
    radial-gradient(circle at 50% 40%, rgb(30 40 85 / 52%), rgb(7 9 29 / 90%) 68%),
    linear-gradient(rgb(7 9 29 / 34%), rgb(7 9 29 / 82%));
  backdrop-filter: blur(4px);
}

.overlay-card,
.asset-error {
  animation: overlay-in 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.overlay-card {
  width: min(100%, 31rem);
  display: grid;
  justify-items: center;
}

.overlay-main,
.nickname-setup {
  width: 100%;
  display: grid;
  justify-items: center;
}

.eyebrow {
  color: var(--magenta);
}

.overlay-card h1,
.nickname-setup h2,
.asset-error h2 {
  margin: 0.65rem 0 0;
  font-family: "Arial Black", ui-rounded, sans-serif;
  font-size: clamp(1.65rem, 6vw, 3.25rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.overlay-card p,
.nickname-setup p,
.asset-error p {
  max-width: 33rem;
  margin: 0.9rem 0 0;
  color: #c7c9df;
  font-size: clamp(0.78rem, 2.4vw, 1rem);
  line-height: 1.55;
  text-wrap: balance;
}

.control-hints {
  margin: clamp(0.7rem, 3vw, 1.25rem) 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: clamp(0.58rem, 2vw, 0.7rem);
  font-weight: 900;
  letter-spacing: 0.08em;
}

kbd {
  padding: 0.22rem 0.35rem;
  color: var(--paper);
  background: rgb(255 255 255 / 7%);
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 0.35rem;
  box-shadow: 0 2px 0 rgb(255 255 255 / 7%);
}

.hint-dot {
  width: 0.24rem;
  aspect-ratio: 1;
  background: var(--violet);
  border-radius: 50%;
}

.primary-button {
  min-width: 10.5rem;
  min-height: 3.35rem;
  padding: 0.7rem 1.15rem 0.7rem 1.45rem;
  display: inline-flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  color: #14121d;
  font-weight: 1000;
  letter-spacing: 0.08em;
  background: var(--yellow);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 0.8rem 2.2rem rgb(255 216 77 / 22%);
  cursor: pointer;
  transition: filter 140ms ease, transform 140ms ease;
}

.primary-button b {
  font-size: 1.2rem;
}

.primary-button:hover {
  filter: brightness(1.08);
}

.secondary-button,
.dialog-button {
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  background: rgb(82 247 255 / 7%);
  border: 1px solid rgb(82 247 255 / 32%);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.secondary-button {
  margin-top: 0.7rem;
}

.secondary-button:hover,
.dialog-button:hover {
  background: rgb(82 247 255 / 14%);
  border-color: rgb(82 247 255 / 64%);
}

.secondary-button:active,
.dialog-button:active {
  transform: scale(0.97);
}

.submission-status {
  margin-top: 0.7rem !important;
  color: var(--cyan) !important;
  font-size: 0.74rem !important;
  font-weight: 900;
}

.nickname-setup h2 {
  margin-bottom: 0;
}

.nickname-setup form {
  width: min(100%, 23rem);
  margin-top: 1rem;
  display: grid;
  gap: 0.5rem;
  text-align: left;
}

.nickname-setup label {
  color: var(--paper);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nickname-setup input {
  width: 100%;
  min-height: 3.15rem;
  padding: 0.75rem 0.9rem;
  color: var(--paper);
  font: inherit;
  font-size: 1rem;
  background: rgb(3 6 25 / 72%);
  border: 1px solid rgb(167 171 200 / 34%);
  border-radius: 0.8rem;
  outline: 0;
}

.nickname-setup input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgb(82 247 255 / 13%);
}

.nickname-setup input[aria-invalid="true"] {
  border-color: #ff7186;
  box-shadow: 0 0 0 3px rgb(255 113 134 / 12%);
}

.nickname-setup .nickname-rules,
.nickname-setup .nickname-error {
  margin: 0;
  font-size: 0.7rem;
  text-align: left;
}

.nickname-setup .nickname-error {
  color: #ff8b9c;
  font-weight: 900;
}

.nickname-setup .primary-button {
  margin: 0.4rem auto 0;
}

.leaderboard-dialog {
  width: min(52rem, calc(100% - 2rem));
  max-width: none;
  height: min(44rem, calc(100dvh - 2rem));
  max-height: none;
  padding: 0;
  overflow: hidden;
  color: var(--paper);
  background: #0a0e27;
  border: 1px solid rgb(82 247 255 / 35%);
  border-radius: 1.3rem;
  box-shadow: 0 2rem 8rem rgb(0 0 0 / 75%), 0 0 3rem rgb(82 247 255 / 10%);
}

.leaderboard-dialog::backdrop {
  background: rgb(3 5 18 / 82%);
  backdrop-filter: blur(7px);
}

.leaderboard-dialog[open] {
  animation: dialog-in 220ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.leaderboard-panel {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background:
    radial-gradient(circle at 15% -15%, rgb(82 247 255 / 15%), transparent 19rem),
    linear-gradient(155deg, rgb(17 22 50 / 96%), rgb(7 10 28 / 98%));
}

.leaderboard-header {
  position: relative;
  z-index: 4;
  padding: 1.25rem 1.35rem 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
  background: rgb(10 14 39 / 94%);
  border-bottom: 1px solid rgb(167 171 200 / 14%);
}

.leaderboard-header h2 {
  margin: 0.3rem 0 0;
  font-family: "Arial Black", ui-rounded, sans-serif;
  font-size: clamp(1.35rem, 4vw, 2.2rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

#leaderboard-status {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 800;
}

#leaderboard-status.is-stale {
  color: var(--yellow);
}

#leaderboard-close {
  flex: 0 0 auto;
}

#leaderboard-close span {
  margin-left: 0.3rem;
  font-size: 1rem;
}

.leaderboard-scroll {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgb(82 247 255 / 46%) transparent;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

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

.leaderboard-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: #101630;
  box-shadow: 0 1px rgb(167 171 200 / 18%);
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 0.85rem 0.8rem;
  text-align: left;
}

.leaderboard-table thead th {
  font-size: 0.62rem;
  font-weight: 1000;
  letter-spacing: 0.1em;
}

.leaderboard-row {
  border-bottom: 1px solid rgb(167 171 200 / 10%);
}

.leaderboard-row:last-child {
  border-bottom: 0;
}

.leaderboard-row.is-current {
  color: var(--paper);
  background: linear-gradient(90deg, rgb(82 247 255 / 14%), rgb(158 92 255 / 9%));
  box-shadow: 3px 0 var(--cyan) inset, 0 0 1.6rem rgb(82 247 255 / 7%) inset;
}

.leaderboard-rank,
.leaderboard-score,
.leaderboard-progress {
  font-family: "Arial Black", ui-rounded, sans-serif;
}

.leaderboard-rank {
  width: 4.5rem;
  color: var(--yellow);
}

.leaderboard-name {
  max-width: 16rem;
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-score {
  color: var(--cyan);
}

.leaderboard-progress {
  color: #d3bcff;
  font-size: 0.74rem;
  letter-spacing: 0.035em;
}

.leaderboard-date {
  color: var(--muted);
  font-size: 0.77rem;
}

.leaderboard-empty {
  max-width: 28rem;
  margin: 4rem auto;
  padding: 0 1.5rem;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

.leaderboard-footer {
  padding: 0.85rem 1.25rem max(0.85rem, env(safe-area-inset-bottom));
  display: flex;
  gap: 0.7rem;
  align-items: center;
  justify-content: space-between;
  background: rgb(10 14 39 / 96%);
  border-top: 1px solid rgb(167 171 200 / 14%);
}

.dialog-button:disabled {
  opacity: 0.42;
  cursor: wait;
}

.dialog-button-accent {
  color: var(--yellow);
  background: rgb(255 216 77 / 7%);
  border-color: rgb(255 216 77 / 34%);
}

.asset-error {
  align-content: center;
}

.asset-error .primary-button {
  margin-top: 1.15rem;
}

.countdown {
  position: absolute;
  inset: 0;
  z-index: 4;
  place-items: center;
  color: var(--yellow);
  font-family: "Arial Black", ui-rounded, sans-serif;
  font-size: clamp(4rem, 18vw, 10rem);
  text-shadow: 0 0 2rem rgb(255 216 77 / 52%);
  pointer-events: none;
}

.countdown:not([hidden]) {
  display: grid;
  animation: countdown-pop 820ms ease-out infinite;
}

.play-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

.play-hint span {
  color: var(--yellow);
}

body[data-game-state='level-cleared'] .play-hint {
  visibility: hidden;
}

.direction-pad {
  position: relative;
  width: 11.5rem;
  height: 8rem;
  margin: 0.15rem auto 0;
  display: none;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  gap: 0.32rem;
}

.direction-label {
  position: absolute;
  top: 50%;
  left: -4.1rem;
  color: var(--muted);
  transform: translateY(-50%) rotate(-90deg);
}

.direction-button {
  min-width: 3.5rem;
  min-height: 3.5rem;
  color: var(--cyan);
  font-size: 1.5rem;
  font-weight: 900;
  border-radius: 1rem;
  touch-action: manipulation;
}

.direction-up {
  grid-area: 1 / 2;
}

.direction-left {
  grid-area: 2 / 1;
}

.direction-core {
  grid-area: 2 / 2;
  width: 0.75rem;
  place-self: center;
  aspect-ratio: 1;
  background: var(--magenta);
  border-radius: 50%;
  box-shadow: 0 0 1rem rgb(255 79 216 / 50%);
}

.direction-right {
  grid-area: 2 / 3;
}

.direction-down {
  grid-area: 3 / 2;
}

button:focus-visible,
a:focus-visible,
#game-canvas:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
}

@keyframes overlay-in {
  from { opacity: 0; transform: translateY(0.8rem) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(0.8rem) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes countdown-pop {
  from { opacity: 0; transform: scale(1.35); }
  25% { opacity: 1; }
  to { opacity: 0; transform: scale(0.72); }
}

@keyframes float {
  0%, 100% { transform: translateY(-0.8rem) rotate(0); }
  50% { transform: translateY(0.8rem) rotate(8deg); }
}

@media (hover: none), (pointer: coarse) {
  .app-shell {
    grid-template-rows: auto auto auto auto;
  }

  .canvas-frame {
    width: min(100%, 46rem);
  }

  .direction-pad {
    display: grid;
  }
}

@media (max-width: 560px) {
  .app-shell {
    gap: 0.45rem;
    grid-template-rows: auto auto auto auto;
    padding-inline: 0.55rem;
  }

  .game-header {
    min-height: 2.2rem;
  }

  .brand-mark {
    width: 1.5rem;
  }

  .status-chip {
    padding: 0.34rem 0.55rem;
    font-size: 0.55rem;
  }

  .scoreboard {
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    min-height: 3.35rem;
    border-radius: 0.85rem;
  }

  .stat {
    padding: 0.5rem 0.3rem;
  }

  .stat-label {
    font-size: 0.53rem;
  }

  .hud-actions {
    padding: 0.2rem;
    gap: 0.12rem;
  }

  .icon-button {
    width: 2.75rem;
    min-width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.7rem;
  }

  .leaderboard-dialog {
    width: calc(100% - 0.7rem);
    height: calc(100dvh - max(0.7rem, env(safe-area-inset-top)) - max(0.7rem, env(safe-area-inset-bottom)));
    border-radius: 1rem;
  }

  .leaderboard-header {
    position: sticky;
    top: 0;
    padding: max(0.9rem, env(safe-area-inset-top)) 0.8rem 0.75rem;
    gap: 0.55rem;
  }

  .leaderboard-header h2 {
    font-size: clamp(1.2rem, 6vw, 1.65rem);
  }

  #leaderboard-close {
    min-width: 4.9rem;
    padding-inline: 0.65rem;
  }

  .leaderboard-table,
  .leaderboard-table thead,
  .leaderboard-table tbody {
    display: block;
  }

  .leaderboard-table thead tr,
  .leaderboard-row {
    display: grid;
    grid-template-columns: 2.7rem minmax(0, 1fr) 4.2rem 4.7rem 3.4rem;
    align-items: center;
  }

  .leaderboard-table th,
  .leaderboard-table td {
    min-width: 0;
    padding: 0.72rem 0.28rem;
    overflow: hidden;
    font-size: 0.64rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .leaderboard-table thead th {
    font-size: 0.5rem;
    letter-spacing: 0.04em;
  }

  .leaderboard-table th:first-child,
  .leaderboard-row th:first-child {
    padding-left: 0.55rem;
  }

  .leaderboard-progress {
    font-size: 0.56rem !important;
  }

  .leaderboard-footer {
    padding-inline: 0.65rem;
  }

  .leaderboard-footer .dialog-button {
    padding-inline: 0.7rem;
    font-size: 0.62rem;
  }

  .canvas-frame:has(.nickname-setup:not([hidden])) {
    min-height: 20rem;
  }

  .play-hint {
    display: none;
  }

  .overlay-card h1,
  .asset-error h2 {
    margin-top: 0.45rem;
  }

  .overlay-card p,
  .asset-error p {
    margin-top: 0.6rem;
    line-height: 1.35;
  }

  .control-hints {
    margin: 0.65rem 0;
  }

  .primary-button {
    min-height: 3rem;
  }

  .direction-pad {
    display: grid;
    width: 10.8rem;
    height: 7.4rem;
  }
}

@media (max-width: 560px) and (orientation: portrait) and (hover: none) and (pointer: coarse) {
  .play-area {
    gap: 0.3rem;
  }

  .direction-pad {
    display: block;
    width: 150px;
    height: 114px;
  }

  .direction-label {
    display: none;
  }

  .direction-button {
    position: absolute;
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
  }

  .direction-up {
    top: 0;
    left: 51px;
  }

  .direction-left {
    top: 33px;
    left: 0;
  }

  .direction-right {
    top: 33px;
    right: 0;
  }

  .direction-down {
    bottom: 0;
    left: 51px;
  }

  .direction-core {
    position: absolute;
    top: 52px;
    left: 70px;
    width: 10px;
    height: 10px;
  }
}

@media (max-height: 700px) and (orientation: landscape) {
  .app-shell {
    width: min(100%, 78rem);
    grid-template: auto 1fr / minmax(10rem, 15rem) minmax(0, 1fr);
    align-items: start;
  }

  .game-header,
  .scoreboard {
    width: 100%;
  }

  .scoreboard {
    grid-template-columns: 1fr 1fr;
  }

  .stat {
    border-bottom: 1px solid rgb(167 171 200 / 10%);
  }

  .hud-actions {
    justify-content: center;
  }

  .play-area {
    grid-area: 1 / 2 / span 2;
  }

  .canvas-frame {
    width: min(100%, calc(100svh * 1.25));
  }

  .direction-pad {
    display: none;
  }
}

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