.site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  width: 100%;
  min-height: 78px;
  padding: 14px 24px;
  color: white;
  background: linear-gradient(rgb(2 10 8 / 84%), transparent);
  pointer-events: none;
}

.site-header > * { pointer-events: auto; }

body.game-active .site-header .brand { display: none; }

body.game-active .site-header .header-actions { margin-left: auto; }

.site-header .brand small { color: rgb(255 255 255 / 52%); }

.site-header .account-link {
  border-color: rgb(255 255 255 / 18%);
  color: white;
  background: rgb(5 24 19 / 64%);
  backdrop-filter: blur(12px);
}

body {
  height: 100%;
  color: white;
  background: #06100d;
  overflow: hidden;
}

main {
  width: 100%;
  height: 100dvh;
}

body > footer { display: none; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: var(--green-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.menu-button i,
.menu-button i::before,
.menu-button i::after {
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.menu-button i {
  position: relative;
}

.menu-button i::before,
.menu-button i::after {
  position: absolute;
  left: 0;
  content: "";
}

.menu-button i::before { top: -6px; }
.menu-button i::after { top: 6px; }

.game-stage {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
}

.game-heading {
  display: none;
}

.game-kicker {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .16em;
}

.game-heading h1 {
  margin-top: 8px;
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1;
}

.game-lead {
  color: var(--muted);
  font-size: clamp(14px, 1.6vw, 18px);
  font-weight: 800;
  line-height: 1.8;
}

.game-frame {
  position: relative;
  width: 100%;
  height: 100dvh;
  max-height: none;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 50%, rgb(17 110 85 / 22%), transparent 27%),
    linear-gradient(135deg, rgb(255 255 255 / 2%), transparent 52%),
    #0b1512;
  box-shadow: none;
  overflow: hidden;
  isolation: isolate;
  touch-action: none;
}

.game-frame::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgb(255 255 255 / 3%) 1px, transparent 1px),
    linear-gradient(rgb(0 0 0 / 18%) 2px, transparent 2px);
  background-size: 52px 42px;
  content: "";
}

.game-frame::after {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    radial-gradient(circle at 50% 50%, transparent 42%, rgb(0 0 0 / 28%) 100%),
    linear-gradient(90deg, rgb(0 0 0 / 26%), transparent 14% 86%, rgb(0 0 0 / 26%));
  box-shadow: inset 0 0 0 8px rgb(0 0 0 / 24%);
  pointer-events: none;
  content: "";
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#gameCanvas:focus-visible {
  outline: 2px solid rgb(99 245 255 / 72%);
  outline-offset: -5px;
}

.game-dash {
  --dash-progress: 100%;
  position: absolute;
  bottom: 22px;
  left: 24px;
  z-index: 8;
  display: grid;
  grid-template-columns: auto auto;
  gap: 1px 8px;
  align-items: center;
  min-width: 142px;
  padding: 10px 14px 9px;
  border: 1px solid rgb(99 245 255 / 32%);
  border-radius: 12px;
  color: white;
  background: rgb(4 28 23 / 82%);
  box-shadow: 0 12px 30px rgb(0 0 0 / 30%);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.game-dash span {
  color: #63f5ff;
  font: 900 10px "SFMono-Regular", Consolas, monospace;
  letter-spacing: .12em;
}

.game-dash small {
  color: rgb(255 255 255 / 52%);
  font: 800 7px "SFMono-Regular", Consolas, monospace;
}

.game-dash i {
  grid-column: 1 / -1;
  display: block;
  height: 3px;
  margin-top: 4px;
  border-radius: 999px;
  background: rgb(255 255 255 / 12%);
  overflow: hidden;
}

.game-dash i b {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #63f5ff;
  transform-origin: left;
}

.game-dash[data-ready="false"] {
  filter: saturate(.35);
  opacity: .68;
}

.game-hud {
  position: absolute;
  top: 88px;
  left: 24px;
  z-index: 5;
  display: flex;
  gap: 8px;
  pointer-events: none;
}

body.game-active .game-hud {
  top: max(14px, env(safe-area-inset-top));
}

.game-hud p {
  display: grid;
  gap: 2px;
  min-width: 76px;
  padding: 9px 12px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 11px;
  color: white;
  background: rgb(5 22 18 / 72%);
  backdrop-filter: blur(10px);
}

.game-hud span {
  color: #91dfbe;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .13em;
}

.game-hud strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
}

.game-level-stat i {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgb(255 255 255 / 12%);
  overflow: hidden;
}

.game-level-stat i b {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #63f5ff, #91dfbe);
  transition: width 180ms ease;
}

.game-quest {
  position: absolute;
  top: 88px;
  right: 24px;
  z-index: 5;
  display: grid;
  justify-items: end;
  gap: 3px;
  padding: 9px 12px;
  border: 1px solid rgb(255 190 74 / 26%);
  border-radius: 10px;
  color: white;
  background: rgb(22 18 8 / 76%);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.game-quest span {
  color: #ffc45a;
  font: 900 8px "SFMono-Regular", Consolas, monospace;
  letter-spacing: .12em;
}

.game-quest p {
  font-size: 10px;
  font-weight: 800;
}

.game-boss-bar {
  position: absolute;
  top: 146px;
  left: 50%;
  z-index: 6;
  display: grid;
  gap: 6px;
  width: min(420px, calc(100% - 36px));
  padding: 10px 14px;
  border: 1px solid rgb(255 179 63 / 36%);
  border-radius: 10px;
  color: white;
  background: rgb(17 12 5 / 82%);
  box-shadow: 0 14px 40px rgb(0 0 0 / 34%);
  backdrop-filter: blur(10px);
  transform: translateX(-50%);
  pointer-events: none;
}

.game-boss-bar[hidden] { display: none; }

.game-boss-bar div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.game-boss-bar div span {
  color: #ffc45a;
  font: 900 8px "SFMono-Regular", Consolas, monospace;
  letter-spacing: .12em;
}

.game-boss-bar strong { font-size: 11px; }

.game-boss-bar > i {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: rgb(255 255 255 / 12%);
  overflow: hidden;
}

.game-boss-bar > i span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f27b53, #ffbd42);
  transition: width 180ms ease;
}

.game-boss-bar[data-locked="true"] > i span {
  background: repeating-linear-gradient(135deg, #887f66 0 7px, #5f594b 7px 14px);
}

.portal-actions button {
  --portal: var(--green);
  --portal-soft: var(--green-soft);
  position: absolute;
  top: var(--portal-y);
  left: var(--portal-x);
  z-index: 4;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1px 7px;
  align-items: center;
  width: 126px;
  min-height: 84px;
  padding: 15px 10px 20px;
  border: 4px solid #536058;
  border-bottom-color: #202b26;
  border-radius: 58px 58px 11px 11px;
  color: white;
  background:
    linear-gradient(90deg, transparent 48%, rgb(255 255 255 / 10%) 50%, transparent 52%),
    linear-gradient(color-mix(in srgb, var(--portal) 34%, #08130f), #07100d);
  box-shadow:
    inset 0 0 0 3px rgb(0 0 0 / 28%),
    0 0 0 5px rgb(7 14 11 / 46%),
    0 12px 24px rgb(0 0 0 / 42%),
    0 0 28px color-mix(in srgb, var(--portal) 24%, transparent);
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: scale 160ms ease, box-shadow 160ms ease;
}

.portal-actions button > * {
  position: relative;
  z-index: 1;
}

.portal-actions button::before {
  position: absolute;
  top: 8px;
  right: 8px;
  bottom: 9px;
  left: 8px;
  z-index: 0;
  border: 1px solid color-mix(in srgb, var(--portal) 54%, white);
  border-radius: 48px 48px 6px 6px;
  box-shadow: inset 0 0 24px color-mix(in srgb, var(--portal) 22%, transparent);
  content: "";
}

.portal-actions button::after {
  position: absolute;
  right: 0;
  bottom: -14px;
  left: 0;
  z-index: 2;
  color: #d1c8aa;
  font: 900 7px "SFMono-Regular", Consolas, monospace;
  letter-spacing: .12em;
  text-shadow: 0 2px 4px black;
  content: "SEALED · DEFEAT BOSS";
}

.portal-actions button[data-unlocked="true"]::after {
  color: color-mix(in srgb, var(--portal) 72%, white);
  content: "OPEN";
}

.portal-actions button[data-unlocked="false"] {
  filter: saturate(.58) brightness(.82);
}

.portal-actions button[data-visible="false"] {
  opacity: 0;
  pointer-events: none;
}

.portal-actions button[data-unlocked="true"] {
  border-color: color-mix(in srgb, var(--portal) 58%, #9a9f91);
  filter: none;
}

.portal-actions button:hover,
.portal-actions button:focus-visible,
.portal-actions button[data-near="true"] {
  box-shadow:
    inset 0 0 0 3px rgb(0 0 0 / 24%),
    0 0 0 8px color-mix(in srgb, var(--portal) 16%, transparent),
    0 0 56px color-mix(in srgb, var(--portal) 52%, transparent);
  scale: 1.06;
}

.portal-actions button[data-portal="motion"] { --portal: var(--blue); --portal-soft: var(--blue-soft); }
.portal-actions button[data-portal="layout"] { --portal: var(--orange); --portal-soft: var(--orange-soft); }
.portal-actions button[data-portal="state"] { --portal: var(--rose); --portal-soft: var(--rose-soft); }
.portal-actions button[data-portal="color"] { --portal: var(--yellow); --portal-soft: var(--yellow-soft); }
.portal-actions button[data-portal="experiment"] { --portal: #50617e; --portal-soft: #e6eaf2; }

.portal-actions span {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--portal);
  background: white;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 900;
}

.portal-actions b {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-actions small {
  color: rgb(255 255 255 / 68%);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  font-weight: 800;
}

.game-toast {
  position: absolute;
  bottom: 54px;
  left: 50%;
  z-index: 18;
  min-width: 210px;
  padding: 12px 16px;
  border: 1px solid rgb(255 196 90 / 42%);
  border-radius: 999px;
  color: white;
  background: rgb(25 19 7 / 88%);
  box-shadow: 0 16px 45px rgb(0 0 0 / 42%);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
  transform: translateX(-50%);
}

.game-toast[hidden] { display: none; }

.game-start,
.game-over,
.game-clear {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 24px;
  color: white;
  text-align: center;
  background: rgb(4 21 17 / 76%);
  backdrop-filter: blur(9px);
}

.game-start[hidden],
.game-over[hidden],
.game-clear[hidden],
.power-up-panel[hidden] {
  display: none;
}

.power-up-panel {
  position: absolute;
  inset: 0;
  z-index: 17;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 24px;
  color: white;
  text-align: center;
  background: rgb(4 16 14 / 84%);
  backdrop-filter: blur(12px);
}

.power-up-panel > p:first-child {
  color: #63f5ff;
  font: 900 10px "SFMono-Regular", Consolas, monospace;
  letter-spacing: .16em;
}

.power-up-panel h2 {
  margin-top: 7px;
  font-size: clamp(27px, 4vw, 42px);
  letter-spacing: -.055em;
}

.power-up-panel h2 + p {
  margin-top: 5px;
  color: rgb(255 255 255 / 58%);
  font-size: 11px;
  font-weight: 700;
}

.power-up-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 190px));
  gap: 10px;
  width: min(610px, calc(100vw - 36px));
  margin-top: 22px;
}

.power-up-choices button {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 150px;
  padding: 20px;
  border: 1px solid rgb(99 245 255 / 28%);
  border-radius: 14px;
  color: white;
  text-align: left;
  background: linear-gradient(145deg, rgb(21 64 55 / 92%), rgb(7 29 24 / 96%));
  box-shadow: 0 18px 48px rgb(0 0 0 / 24%);
  cursor: pointer;
  transition: translate 150ms ease, border-color 150ms ease, background 150ms ease;
}

.power-up-choices button:hover,
.power-up-choices button:focus-visible {
  border-color: #63f5ff;
  background: linear-gradient(145deg, rgb(27 84 71 / 96%), rgb(8 37 30 / 98%));
  translate: 0 -4px;
}

.power-up-choices button:disabled {
  border-color: rgb(255 255 255 / 12%);
  opacity: .58;
  cursor: wait;
  translate: none;
}

.power-up-choices button[data-advanced="true"] {
  border-color: rgb(255 196 90 / 58%);
  background: linear-gradient(145deg, rgb(91 55 14 / 96%), rgb(34 22 8 / 98%));
  box-shadow: 0 18px 52px rgb(255 160 36 / 14%);
}

.power-up-choices button[data-advanced="true"]:hover,
.power-up-choices button[data-advanced="true"]:focus-visible {
  border-color: #ffd45f;
  background: linear-gradient(145deg, rgb(116 70 16 / 98%), rgb(44 28 8 / 100%));
}

.power-up-choices button[data-advanced="true"] small { color: #ffd45f; }

.power-up-choices small {
  color: #63f5ff;
  font: 900 9px "SFMono-Regular", Consolas, monospace;
  letter-spacing: .1em;
}

.power-up-choices strong { font-size: 17px; }

.power-up-choices span {
  color: rgb(255 255 255 / 64%);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
}

.game-start img {
  width: 168px;
  height: 168px;
  object-fit: contain;
  filter: drop-shadow(0 20px 25px rgb(0 0 0 / 38%));
}

.game-start > p:first-of-type,
.game-over > p,
.game-clear > p:first-child {
  margin-top: 8px;
  color: #91dfbe;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .1em;
}

.game-start h2,
.game-over h2,
.game-clear h2 {
  margin-top: 8px;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -.055em;
}

.game-start h2 + p,
.game-clear h2 + p {
  margin-top: 8px;
  color: rgb(255 255 255 / 70%);
  font-size: 12px;
  font-weight: 700;
}

.game-over {
  overflow-y: auto;
}

.game-result-card {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  width: min(760px, calc(100vw - 40px));
  margin-top: 14px;
  padding: 22px;
  border: 1px solid rgb(145 223 190 / 38%);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgb(99 245 255 / 8%), transparent 46%),
    rgb(2 19 15 / 88%);
  box-shadow: 0 24px 80px rgb(0 0 0 / 34%);
  text-align: left;
}

.game-result-visual {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgb(99 245 255 / 22%);
  border-radius: 14px;
  background:
    radial-gradient(circle, rgb(99 245 255 / 18%), transparent 62%),
    repeating-linear-gradient(0deg, transparent 0 17px, rgb(145 223 190 / 6%) 18px),
    repeating-linear-gradient(90deg, transparent 0 17px, rgb(145 223 190 / 6%) 18px);
}

.game-result-visual span {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  color: #91dfbe;
  font: 900 9px "SFMono-Regular", Consolas, monospace;
  letter-spacing: .08em;
}

.game-result-visual img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  filter: drop-shadow(0 15px 20px rgb(0 0 0 / 42%));
}

.game-result-copy > p:first-child {
  color: #63f5ff;
  font: 900 10px "SFMono-Regular", Consolas, monospace;
  letter-spacing: .13em;
}

.game-result-copy .game-result-score {
  margin-top: 10px;
  color: rgb(255 255 255 / 52%);
  font: 900 12px "SFMono-Regular", Consolas, monospace;
  letter-spacing: .08em;
}

.game-result-score strong {
  margin-left: 8px;
  color: #63f5ff;
  font-size: clamp(30px, 5vw, 52px);
  letter-spacing: -.07em;
}

.game-result-copy h2 {
  margin-top: 7px;
  font-size: clamp(23px, 3vw, 34px);
}

.game-result-copy h2 + p {
  margin-top: 8px;
  color: rgb(255 255 255 / 68%);
  font-size: 12px;
  font-weight: 700;
}

.game-result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: min(760px, calc(100vw - 40px));
  margin-top: 12px;
}

.game-result-actions a,
.game-result-actions button {
  display: inline-grid;
  place-items: center;
  min-height: 44px;
  margin: 0;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--green-dark);
  background: #91dfbe;
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.game-result-actions #downloadGameScore {
  color: white;
  border-color: rgb(255 255 255 / 20%);
  background: rgb(255 255 255 / 10%);
}

.game-result-actions .game-restart-button {
  margin-top: 0;
  color: rgb(255 255 255 / 66%);
  border-color: transparent;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.game-result-actions .game-title-button {
  margin-top: 0;
  color: rgb(255 255 255 / 72%);
  border-color: rgb(255 255 255 / 16%);
  background: rgb(255 255 255 / 6%);
}

.game-start kbd {
  padding: 3px 6px;
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 5px;
  color: white;
  background: rgb(255 255 255 / 10%);
  font: inherit;
}

.game-start button,
.game-over button,
.game-clear button,
.portal-list-button {
  min-height: 46px;
  margin-top: 20px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  color: var(--green-dark);
  background: #91dfbe;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.game-clear .new-run-button {
  min-height: auto;
  margin-top: 10px;
  padding: 6px 12px;
  color: rgb(255 255 255 / 68%);
  background: transparent;
  font-size: 10px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.portal-panel {
  --panel-color: var(--green);
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 15;
  width: min(560px, calc(100% - 36px));
  max-height: calc(100% - 36px);
  padding: 28px;
  border: 1px solid color-mix(in srgb, var(--panel-color) 58%, white);
  border-radius: 20px;
  color: white;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--panel-color) 22%, #081c18), #081c18 62%);
  box-shadow: 0 30px 90px rgb(0 0 0 / 48%);
  transform: translate(-50%, -50%);
  overflow-y: auto;
}

.portal-panel[hidden] { display: none; }

.portal-panel > p:first-of-type {
  color: color-mix(in srgb, var(--panel-color) 60%, white);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .12em;
}

.portal-panel h2 {
  margin-top: 5px;
  font-size: clamp(26px, 4vw, 38px);
  letter-spacing: -.055em;
}

.portal-panel h2 + p {
  margin-top: 7px;
  color: rgb(255 255 255 / 65%);
  font-size: 12px;
  font-weight: 700;
}

.portal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 50%;
  color: white;
  background: rgb(255 255 255 / 8%);
  font-size: 20px;
  cursor: pointer;
}


.portal-list-button {
  color: white;
  background: var(--panel-color);
}

.game-hint {
  position: absolute;
  right: auto;
  bottom: 78px;
  left: 24px;
  z-index: 5;
  color: rgb(255 255 255 / 48%);
  font-size: 9px;
  font-weight: 800;
  pointer-events: none;
}

.game-footer {
  display: none;
  align-items: center;
  gap: 10px 24px;
  padding: 18px 4px 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.game-footer b {
  margin-right: 5px;
  color: var(--green);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  letter-spacing: .08em;
}

.game-footer a {
  margin-left: auto;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid currentColor;
  color: var(--green-dark);
  background: transparent;
  font-size: 11px;
  font-weight: 900;
}


@media (max-width: 820px) {
  .account-link { display: none; }
  .site-header { min-height: 68px; padding: 10px 12px; }
  .game-stage { padding-top: 0; }
  .game-frame {
    height: 100dvh;
    max-height: none;
    min-height: 0;
  }
  .game-dash {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    left: auto;
    display: grid;
    grid-template-columns: 1fr;
    place-items: center;
    gap: 0;
    width: 84px;
    height: 84px;
    min-width: 84px;
    padding: 0;
    border-color: rgb(99 245 255 / 44%);
    border-radius: 50%;
    overflow: visible;
  }

  .game-dash::before {
    position: absolute;
    inset: -5px;
    border-radius: inherit;
    background: conic-gradient(#63f5ff var(--dash-progress), rgb(255 255 255 / 10%) 0);
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0);
    mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 0);
    pointer-events: none;
    content: "";
  }

  .game-dash > * { position: relative; z-index: 1; }
  .game-dash span { font-size: 11px; }
  .game-dash small,
  .game-dash i { display: none; }
  .portal-actions button {
    width: 106px;
    min-height: 76px;
    padding: 7px 8px;
  }
  .portal-actions span { width: 24px; height: 24px; }
  .portal-actions b { font-size: 9px; }
  .game-footer { align-items: flex-start; flex-direction: column; }
  .game-footer a { margin-left: 0; padding-left: 0; }
}

@media (max-width: 520px) {
  .menu-button { padding-inline: 13px; }
  .menu-button > span { font-size: 0; }
  .menu-button > span::after { font-size: 10px; content: "一覧"; }
  .game-heading h1 {
    font-size: 36px;
  }
  .game-lead { font-size: 13px; }
  .game-frame { min-height: 0; border-radius: 0; }
  .game-hud { top: 76px; left: 10px; gap: 4px; }
  .game-hud p { min-width: 62px; padding: 7px 8px; }
  .game-hud .game-zone-stat { display: none; }
  .game-dash {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: auto;
    width: 78px;
    height: 78px;
    min-width: 78px;
    padding: 0;
  }
  .game-dash small { display: none; }

  .power-up-choices {
    grid-template-columns: 1fr;
    gap: 7px;
    width: min(380px, calc(100vw - 28px));
  }

  .power-up-choices button {
    min-height: 0;
    padding: 13px 15px;
  }
  .game-quest { display: none; }
  .game-boss-bar { top: 126px; width: calc(100% - 22px); }
  .portal-actions button {
    grid-template-columns: 1fr;
    justify-items: center;
    width: 82px;
    min-height: 66px;
  }
  .portal-actions span { display: none; }
  .portal-actions small { display: none; }
  .portal-actions b { width: 100%; text-align: center; }
  .portal-actions button[data-portal="generator"],
  .portal-actions button[data-portal="state"] { --portal-x: 17% !important; }
  .portal-actions button[data-portal="layout"],
  .portal-actions button[data-portal="experiment"] { --portal-x: 83% !important; }
  .portal-panel { padding: 24px 18px; }
  .game-start img { width: 142px; height: 142px; }
  .game-over { place-content: center; padding: 14px; }
  .game-result-card {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 13px;
    width: calc(100vw - 24px);
    padding: 12px;
    border-radius: 12px;
  }
  .game-result-copy .game-result-score { margin-top: 5px; }
  .game-result-score strong { display: block; margin: 2px 0 0; font-size: 30px; }
  .game-result-copy h2 { margin-top: 4px; font-size: 19px; }
  .game-result-copy h2 + p { margin-top: 5px; font-size: 10px; }
  .game-result-visual span { top: 6px; left: 6px; font-size: 7px; }
  .game-result-actions { width: calc(100vw - 24px); }
  .game-result-actions a,
  .game-result-actions button { flex: 1 1 135px; padding-inline: 10px; }
  .game-result-actions .game-restart-button { flex-basis: 100%; }
  .game-result-actions .game-title-button { flex-basis: 100%; }
  .game-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .portal-actions button {
    transition: none;
  }
}
