.game-page {
  min-height: 100svh;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  -webkit-user-select: none;
  user-select: none;
  background: #05070c;
  color: #ffffff;
}

.game-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.power-icon {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
}

.game-page .site-header {
  position: fixed;
  top: 18px;
  right: auto;
  left: 24px;
  z-index: 8;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  backdrop-filter: none;
  color: #ffffff;
}

.game-page .brand {
  color: #ffffff;
}

.game-shell {
  width: 100vw;
  min-height: 100svh;
  margin: 0;
  padding: 0;
  background: #05070c;
}

.game-stage {
  position: relative;
  width: 100vw;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  touch-action: manipulation;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  background: #05070c;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#game.is-attacking {
  animation: attackPulse 220ms ease;
}

.game-funding {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  z-index: 7;
  width: 240px;
  transform: translateX(-50%);
  pointer-events: none;
  font: 750 0.78rem/1.3 Inter, ui-sans-serif, system-ui, sans-serif;
  text-align: center;
  color: #ffffff;
  text-shadow: 0 1px 4px #05070c;
}

.game-funding-track {
  position: relative;
  height: 26px;
  margin-top: 4px;
  overflow: hidden;
  border: 1px solid #f4bf45;
  border-radius: 999px;
  background: #111722;
}

.game-funding-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 87.59%;
  background: linear-gradient(90deg, #a46b16, #f4bf45);
}

.game-funding-track strong {
  position: relative;
  display: grid;
  height: 100%;
  place-items: center;
}

@media (max-width: 760px), (pointer: coarse) {
  .game-funding {
    top: max(10px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    left: auto;
    width: 140px;
    transform: none;
    font-size: 0.65rem;
  }
}

.game-sound-toggle {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  right: max(24px, env(safe-area-inset-right));
  z-index: 7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-width: 98px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(5, 7, 12, 0.78);
  color: #ffffff;
  cursor: pointer;
  font: 850 0.78rem/1 Inter, ui-sans-serif, system-ui, sans-serif;
  padding: 0.6rem 0.8rem;
  backdrop-filter: blur(18px);
}

.game-sound-toggle:hover,
.game-sound-toggle:focus-visible {
  border-color: #f4bf45;
  background: rgba(34, 39, 53, 0.9);
}

.game-sound-toggle:focus-visible {
  outline: 2px solid #f4bf45;
  outline-offset: 3px;
}

.game-sound-toggle[aria-pressed="true"] {
  color: rgba(255, 255, 255, 0.64);
}

@keyframes attackPulse {
  0%,
  100% {
    filter: none;
  }

  45% {
    filter: brightness(1.18) saturate(1.2);
  }
}

/* HUD */

.game-hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  pointer-events: none;
  padding: 92px 24px 24px;
}

.hud-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1120px, 100%);
  margin: 0 auto;
}

.hud-topline > div,
.hud-card,
.hud-toast {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 7, 12, 0.56);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(18px);
}

.hud-topline > div:first-child {
  min-width: 220px;
  padding: 12px 14px;
}

.hud-kicker,
.hud-card p:first-child,
.panel-kicker {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hud-topline strong {
  display: block;
  color: #ffffff;
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.05;
}

.hud-progress {
  display: grid;
  gap: 7px;
  min-width: 210px;
  padding: 12px 14px;
}

.hud-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.hud-vitals {
  min-height: 30px;
}

.hud-hearts {
  display: flex;
  align-items: center;
  gap: 3px;
  color: #ff657d;
  font-size: 1.12rem;
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 101, 125, 0.48);
}

.hud-hearts b {
  font-weight: 900;
  font-style: normal;
  transition: opacity 180ms ease, transform 180ms ease;
}

.hud-hearts b.is-empty {
  opacity: 0.2;
  transform: scale(0.88);
  text-shadow: none;
}

.hud-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
}

.hud-stat b {
  color: #f4bf45;
  font-size: 1rem;
  font-style: normal;
  line-height: 1;
}

.hud-stat-nodes b {
  color: #8bd3ff;
}

.hud-stat-health b {
  color: #fb7185;
}

.hud-stat i {
  font-style: normal;
  min-width: 2ch;
  text-align: right;
}

.hud-progress-count {
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  text-align: right;
}

.hud-health-track,
.hud-progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.hud-health-track i,
.hud-progress-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  transition: width 260ms ease;
}

.hud-health-track i {
  background: linear-gradient(90deg, #fb7185, #f4bf45);
}

.hud-progress-track i {
  background: linear-gradient(90deg, #f4bf45, #e65f3f, #8bd3ff);
}

.hud-toast {
  justify-self: start;
  max-width: min(560px, 100%);
  margin: 10px 0 0;
  padding: 0.5rem 0.75rem;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.3;
  transition: opacity 200ms ease, transform 200ms ease;
}

.hud-toast.is-hidden {
  opacity: 0;
  transform: translateY(-6px);
}

.hud-card {
  align-self: end;
  width: min(460px, 100%);
  margin: 0 auto 0 0;
  padding: clamp(16px, 2.8vw, 24px);
  border-left: 4px solid var(--castle-color, rgba(255, 255, 255, 0.4));
  max-height: 100%;
  overflow: hidden;
  transition: opacity 220ms ease, transform 220ms ease;
}

.hud-card.is-hidden {
  opacity: 0;
  transform: translateY(16px);
}

.hud-card h1 {
  max-width: none;
  margin-bottom: 10px;
  color: #ffffff;
  font-size: clamp(1.7rem, 4.2vw, 3rem);
  line-height: 0.96;
}

.hud-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-weight: 650;
  line-height: 1.45;
}

.hud-card ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.hud-card li {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.82rem;
  font-weight: 850;
  padding: 0.42rem 0.62rem;
}

.hud-card li.is-done {
  border-color: rgba(111, 209, 140, 0.5);
  background: rgba(111, 209, 140, 0.16);
}

/* PC controls */

.pc-controls-panel {
  display: none;
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 2;
  width: 260px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 7, 12, 0.56);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.32);
  padding: 14px;
  pointer-events: none;
  backdrop-filter: blur(18px);
}

@media (min-width: 761px) and (pointer: fine) {
  .game-stage[data-phase="play"][data-near-castle="true"] .pc-controls-panel {
    display: block;
  }
}

.pc-controls-panel p {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pc-controls-panel ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pc-controls-panel li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.82rem;
  font-weight: 750;
}

.pc-controls-panel kbd,
.artifact-choice kbd {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font: 850 0.72rem/1 Inter, ui-sans-serif, system-ui, sans-serif;
  padding: 0 0.42rem;
}

/* Overlay panels: intro, discovery, ending */

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: calc(84px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  pointer-events: none;
}

.game-panel {
  grid-area: 1 / 1;
  width: min(580px, 100%);
  max-height: calc(100dvh - 120px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-top: 4px solid var(--castle-color, #ffffff);
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 100% 0, rgba(255, 255, 255, 0.07), transparent 44%),
    rgba(5, 7, 12, 0.94);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 0 34px rgba(255, 255, 255, 0.035);
  color: #ffffff;
  padding: clamp(18px, 3vw, 28px);
  pointer-events: auto;
  touch-action: pan-y;
  backdrop-filter: blur(22px);
  transition: opacity 240ms ease, transform 240ms ease, visibility 240ms;
  -webkit-user-select: text;
  user-select: text;
}

.game-panel.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(0.985);
  pointer-events: none;
}

.game-intro {
  border-color: rgba(244, 191, 69, 0.28);
  border-top-color: #f4bf45;
  background:
    radial-gradient(ellipse at 100% 0, rgba(244, 191, 69, 0.12), transparent 48%),
    linear-gradient(145deg, rgba(14, 18, 29, 0.97), rgba(5, 7, 12, 0.96));
}

.game-intro .panel-kicker {
  color: #f4bf45;
  letter-spacing: 0.1em;
}

.game-intro h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 5vw, 3.1rem);
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.game-intro .panel-role {
  color: #ffffff;
}

.game-intro .intro-rule {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.76rem;
}

.game-intro .intro-rule strong {
  color: #ff8b9b;
}

.game-intro .panel-actions {
  margin-top: 22px;
}

.game-intro .panel-button.primary {
  border-color: rgba(244, 191, 69, 0.8);
  background: #f4bf45;
  color: #17120a;
}

.game-panel h1,
.game-panel h2 {
  max-width: none;
  margin: 0 0 10px;
  color: #ffffff;
  font-size: clamp(1.7rem, 4.6vw, 2.7rem);
  line-height: 0.98;
}

.game-panel h3 {
  margin: 0 0 8px;
  color: #ffffff;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  line-height: 1.05;
}

.game-panel p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
  line-height: 1.45;
}

.game-panel .panel-kicker {
  margin: 0 0 4px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.game-panel .panel-kicker-spaced {
  margin-top: 18px;
}

.panel-hint {
  margin-top: 14px !important;
  color: rgba(255, 255, 255, 0.5) !important;
  font-size: 0.78rem;
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.panel-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  cursor: pointer;
  font: 850 0.9rem/1 Inter, ui-sans-serif, system-ui, sans-serif;
  padding: 0.7rem 1.05rem;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.panel-button:hover,
.panel-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.18);
}

.panel-button:focus-visible,
.artifact-choice:focus-visible,
.hud-cv-button:focus-visible {
  outline: 2px solid var(--castle-color, #ffffff);
  outline-offset: 3px;
}

.panel-button.primary {
  border-color: #ffffff;
  background: #ffffff;
  color: #05070c;
}

.panel-button.primary:hover,
.panel-button.primary:focus-visible {
  background: #f4f4f4;
  border-color: #f4f4f4;
}

.panel-button.ghost {
  border-color: transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
}

.panel-button.ghost:hover,
.panel-button.ghost:focus-visible {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.panel-button.danger {
  border-color: rgba(251, 113, 133, 0.7);
  background: rgba(251, 113, 133, 0.18);
}

.artifact-choices {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.artifact-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "key lane"
    "key title"
    "key project"
    "key teaser"
    "key cv";
  column-gap: 12px;
  row-gap: 5px;
  align-items: start;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-left: 3px solid var(--castle-color, #ffffff);
  border-radius: 13px;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.09), transparent 64%), rgba(255, 255, 255, 0.045);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  padding: 12px 14px;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  -webkit-tap-highlight-color: transparent;
}

.artifact-choice kbd {
  grid-area: key;
  align-self: start;
  min-width: 30px;
  min-height: 30px;
  justify-content: center;
  border-radius: 50%;
  border-color: var(--castle-color, rgba(255, 255, 255, 0.3));
  background: rgba(255, 255, 255, 0.12);
}

.artifact-choice b {
  grid-area: title;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.1;
}

.artifact-choice span {
  grid-area: teaser;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.3;
}

.artifact-choice .artifact-project {
  grid-area: project;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.7rem;
  font-weight: 850;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.artifact-choice .artifact-effect {
  color: rgba(255, 255, 255, 0.9);
}

.artifact-choice:hover,
.artifact-choice:focus-visible {
  border-color: var(--castle-color, #ffffff);
  background: rgba(255, 255, 255, 0.13);
  transform: translateX(2px);
}

.artifact-choice.is-selected {
  border-color: var(--castle-color, #ffffff);
  border-left-width: 5px;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.18), transparent 75%), rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px var(--castle-color, #ffffff);
}

.artifact-reveal {
  margin-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 16px;
}

.artifact-reveal.is-hidden {
  display: none;
}

.artifact-collection {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.artifact-collection li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 4px solid var(--castle-color, #ffffff);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  padding: 7px 12px;
}

.artifact-collection strong {
  font-size: 0.95rem;
  font-weight: 900;
}

.artifact-collection span {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.artifact-collection a {
  margin-left: auto;
  color: #8bd3ff;
  font-size: 0.82rem;
  font-weight: 850;
  text-decoration: none;
}

.artifact-collection a:hover,
.artifact-collection a:focus-visible {
  text-decoration: underline;
}

.panel-social {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  padding-top: 14px;
  font-size: 0.84rem;
  font-weight: 800;
}

.panel-social span {
  color: rgba(255, 255, 255, 0.55);
}

.panel-social a {
  color: #ffffff;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.panel-social a:hover,
.panel-social a:focus-visible {
  border-bottom-color: #ffffff;
}

/* Touch controls */

.touch-controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 3;
  display: none;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 0.75rem;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: opacity 200ms ease;
}

.game-stage[data-phase="discovery"] .touch-controls,
.game-stage[data-phase="ending"] .touch-controls,
.game-stage[data-phase="intro"] .touch-controls,
.game-stage[data-phase="gameover"] .touch-controls {
  opacity: 0;
  pointer-events: none;
}

.game-stage[data-phase="discovery"] .hud-card,
.game-stage[data-phase="ending"] .hud-card,
.game-stage[data-phase="gameover"] .hud-card,
.game-stage[data-phase="intro"] .hud-card {
  opacity: 0;
}

.action-controls {
  grid-column: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  grid-template-areas:
    "weapon weapon"
    "attack attack";
  gap: 0.5rem;
  justify-items: stretch;
}

.game-stage[data-dash="true"] .action-controls {
  grid-template-areas:
    "weapon weapon"
    "dash attack";
}

.game-stage[data-dash="false"] .dash-button {
  display: none;
}

.touch-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 4.8rem;
  min-height: 3.35rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.38), transparent 28%),
    rgba(255, 255, 255, 0.16);
  color: #ffffff;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font: 900 1.05rem/1 Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
  padding: 0;
  touch-action: none;
  backdrop-filter: blur(16px);
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.touch-button:active,
.touch-button.is-pressed {
  transform: translateY(3px) scale(0.98);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.weapon-button {
  grid-area: weapon;
  min-width: 4.4rem;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.5), transparent 28%),
    rgba(244, 191, 69, 0.56);
  font-size: 0.74rem;
}

.weapon-button small {
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.66rem;
  font-weight: 850;
}

.weapon-button small[hidden] {
  display: none;
}

.dash-button {
  grid-area: dash;
  min-height: 4.6rem;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.45), transparent 28%),
    conic-gradient(from -90deg, rgba(139, 211, 255, 0.78) calc(var(--cd, 1) * 1turn), rgba(139, 211, 255, 0.18) 0);
  font-size: 0.82rem;
  transition: opacity 160ms ease;
}

.dash-button.is-cooling {
  color: rgba(255, 255, 255, 0.7);
}

.attack-button {
  grid-area: attack;
  min-height: 4.6rem;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.52), transparent 28%),
    rgba(230, 95, 63, 0.62);
  font-size: 0.9rem;
}

.joystick {
  position: relative;
  grid-column: 1;
  width: 8.6rem;
  height: 8.6rem;
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.joystick-base {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05) 68%, rgba(255, 255, 255, 0.02) 100%);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(14px);
}

.joystick-arrow {
  position: absolute;
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.7rem;
  line-height: 1;
}

.joystick-arrow.is-up {
  top: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
}

.joystick-arrow.is-down {
  bottom: 0.55rem;
  left: 50%;
  transform: translateX(-50%);
}

.joystick-arrow.is-left {
  top: 50%;
  left: 0.55rem;
  transform: translateY(-50%);
}

.joystick-arrow.is-right {
  top: 50%;
  right: 0.55rem;
  transform: translateY(-50%);
}

.joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3.6rem;
  height: 3.6rem;
  margin: -1.8rem 0 0 -1.8rem;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.5), transparent 32%),
    rgba(255, 255, 255, 0.28);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transition: transform 140ms ease, background 140ms ease;
  will-change: transform;
}

.joystick.is-active .joystick-knob {
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.6), transparent 32%),
    rgba(255, 255, 255, 0.4);
  transition: background 140ms ease;
}

:fullscreen .game-page .site-header,
:fullscreen .site-header {
  display: none;
}

:fullscreen .game-hud {
  padding-top: 24px;
}

:fullscreen .game-overlay {
  padding-top: 24px;
}

@media (max-width: 760px), (pointer: coarse) {
  html:has(.game-page),
  body.game-page {
    width: 100%;
    height: 100%;
    min-height: 100%;
    overflow: hidden;
  }

  .game-page {
    position: fixed;
    inset: 0;
    overflow: hidden;
  }

  .game-page .site-header {
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    display: flex;
  }

  .game-sound-toggle {
    display: none;
  }

  .game-stage,
  .game-shell {
    width: 100vw;
    height: 100svh;
    min-height: 100svh;
  }

  .game-hud {
    padding: calc(72px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) calc(96px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .game-overlay {
    padding: calc(64px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  }

  .game-panel {
    max-height: calc(100svh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }

  .game-intro {
    max-height: min(58dvh, 460px);
    padding: 14px 16px;
  }

  .game-intro .panel-kicker {
    margin-bottom: 3px;
    font-size: 0.62rem;
  }

  .game-intro h1 {
    margin-bottom: 7px;
    font-size: clamp(1.2rem, 5vw, 1.55rem);
    line-height: 1.05;
  }

  .game-intro p:not(.panel-kicker, .panel-hint) {
    font-size: 0.78rem;
    line-height: 1.3;
  }

  .game-intro .panel-role {
    margin-bottom: 6px;
  }

  .game-intro .panel-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 12px;
  }

  .game-intro .panel-button {
    min-height: 40px;
    font-size: 0.76rem;
    padding: 0.58rem 0.75rem;
  }

  .game-intro .panel-hint {
    display: none;
  }

  .hud-topline {
    align-items: stretch;
  }

  .hud-zone > strong,
  .hud-chip-dash {
    display: none;
  }

  .hud-topline > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  .hud-progress {
    flex: 0 0 auto;
    min-width: 112px;
    gap: 5px;
    padding: 8px 10px;
  }

  .hud-stats {
    gap: 8px;
  }

  .hud-cv-button {
    min-height: 38px;
    padding: 5px 8px;
  }

  .hud-cv-button small {
    display: none;
  }

  .hud-card {
    width: min(100%, 390px);
    padding: 12px 14px;
    margin-right: auto;
    margin-bottom: 150px;
  }

  .hud-card h1 {
    margin-bottom: 6px;
    font-size: clamp(1.15rem, 5vw, 1.45rem);
    line-height: 1.05;
  }

  .hud-card [data-game-card-copy],
  .hud-toast {
    display: none !important;
  }

  .hud-card ul {
    gap: 4px;
    margin-top: 6px;
  }

  .hud-card li {
    font-size: 0.68rem;
    padding: 0.32rem 0.48rem;
  }

  .touch-controls {
    display: grid;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
  }

  .pc-controls-panel {
    display: none;
  }
}

@media (max-width: 420px) {
  .hud-topline {
    gap: 8px;
  }

  .hud-topline > div,
  .hud-card {
    border-radius: 7px;
  }

  .hud-progress {
    padding: 10px;
  }

  .hud-card {
    padding: 14px;
  }

  .hud-card li {
    font-size: 0.76rem;
  }

  .touch-controls {
    gap: 0.5rem;
  }

  .joystick {
    width: 7.6rem;
    height: 7.6rem;
  }

  .joystick-knob {
    width: 3.2rem;
    height: 3.2rem;
    margin: -1.6rem 0 0 -1.6rem;
  }

  .touch-button {
    min-width: 3.9rem;
    min-height: 3.1rem;
  }

  .weapon-button {
    min-width: 4rem;
    font-size: 0.68rem;
  }

  .attack-button {
    min-height: 4.1rem;
    font-size: 0.82rem;
  }
}

@media (max-height: 460px) and (pointer: coarse) {
  .game-hud {
    padding-top: calc(60px + env(safe-area-inset-top));
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .hud-topline {
    align-items: flex-start;
  }

  .hud-card {
    width: auto;
    max-width: 390px;
    margin-bottom: 0;
    margin-left: 9.6rem;
    margin-right: 10.4rem;
    padding: 12px 14px;
  }

  .hud-card h1 {
    margin-bottom: 4px;
    font-size: 1.3rem;
  }

  .hud-card p:last-of-type {
    display: none;
  }

  .hud-card ul {
    margin-top: 8px;
  }

  .hud-card li:nth-child(n + 3) {
    display: none;
  }

  .joystick {
    width: 7.2rem;
    height: 7.2rem;
  }

  .joystick-knob {
    width: 3rem;
    height: 3rem;
    margin: -1.5rem 0 0 -1.5rem;
  }

  .attack-button {
    min-height: 3.6rem;
  }

  .game-overlay {
    padding-top: calc(52px + env(safe-area-inset-top));
  }

  .game-panel {
    max-height: calc(100svh - 64px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 14px 16px;
  }

  .game-panel h1,
  .game-panel h2 {
    font-size: 1.4rem;
  }
}

/* Keep the top status row light and unboxed. */
.hud-statusline {
  align-items: flex-start;
  gap: 12px;
}

.hud-statusline > div,
.hud-statusline > div:first-child {
  min-width: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  backdrop-filter: none;
}

.hud-statusline .hud-zone {
  flex: 1 1 auto;
}

.hud-statusline .hud-chips {
  flex-wrap: nowrap;
  gap: 10px;
  margin: 0;
}

.hud-statusline .hud-chip {
  min-height: 30px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ffffff;
  font-size: 0.92rem;
  padding: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}

.hud-statusline .hud-chip .power-icon {
  width: 1.2rem;
  height: 1.2rem;
}

.hud-statusline .hud-vitals {
  flex: 0 0 auto;
  display: flex;
  min-height: 30px;
  align-items: center;
}

.hud-card [data-game-card-kicker]:empty {
  display: none;
}

.action-controls .weapon-button {
  width: 3.35rem;
  height: 3.35rem;
  min-width: 3.35rem;
  min-height: 3.35rem;
  justify-self: center;
  border-color: rgba(244, 191, 69, 0.72);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.3), transparent 34%), rgba(244, 191, 69, 0.2);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.weapon-switch-icon {
  width: 1.45rem;
  height: 1.45rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}


/* HUD chips: build, weapon, dash cooldown */

.hud-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.hud-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
  font: 850 0.72rem/1 Inter, ui-sans-serif, system-ui, sans-serif;
  padding: 0 0.6rem;
  white-space: nowrap;
}

.hud-chip b {
  position: relative;
  font-weight: 900;
}

.hud-chip .power-icon {
  position: relative;
  width: 1rem;
  height: 1rem;
}

.hud-chip i {
  font-style: normal;
}

.hud-chip-dash {
  border-color: rgba(139, 211, 255, 0.45);
}

.hud-chip-ammo {
  border-color: rgba(139, 243, 190, 0.45);
}

.hud-chip-ammo.is-hidden {
  display: none;
}

.hud-chip-dash.is-hidden {
  display: none;
}

.hud-chip-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  background: rgba(139, 211, 255, 0.32);
  transform-origin: left center;
  transform: scaleX(1);
  transition: transform 90ms linear;
}

.hud-chip-dash.is-ready {
  border-color: rgba(139, 211, 255, 0.9);
}

.hud-boss {
  justify-self: center;
  display: grid;
  gap: 5px;
  width: min(520px, 100%);
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(192, 132, 252, 0.45);
  border-radius: 8px;
  background: rgba(5, 7, 12, 0.6);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(18px);
  transition: opacity 200ms ease;
}

.hud-boss.is-hidden {
  display: none;
}

.hud-boss span {
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.hud-boss-track {
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.hud-boss-track b {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c084fc, #fb7185);
  transition: width 160ms ease;
}

.hud-boss span i {
  margin-left: 8px;
  color: rgba(255, 255, 255, 0.6);
  font-style: normal;
  font-weight: 800;
  text-transform: none;
}

.pc-locked {
  color: rgba(255, 255, 255, 0.42);
  font-size: 0.7rem;
  font-weight: 700;
}

/* Panels: role line, reveal lines, unlock block, build lists */

.panel-role {
  margin: 0 0 10px !important;
  color: rgba(255, 255, 255, 0.86) !important;
  font-weight: 650;
}

.panel-role strong {
  color: #ffffff;
  font-weight: 900;
}

.reveal-line {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  align-items: start;
  margin-top: 8px !important;
}

.reveal-label {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  width: max-content;
  min-height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.68rem;
  font-weight: 900;
  padding: 0 0.5rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.reveal-unlock {
  margin-top: 14px;
  border: 1px solid rgba(139, 211, 255, 0.45);
  border-radius: 10px;
  background: rgba(139, 211, 255, 0.1);
  padding: 12px 14px;
}

.reveal-unlock.is-hidden {
  display: none;
}

.reveal-unlock h3 {
  margin-bottom: 4px;
}

.artifact-choice small {
  grid-area: cv;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.35;
}

.artifact-choice {
  min-height: 64px;
  grid-template-areas:
    "key lane"
    "key title"
    "key project"
    "key teaser"
    "key cv";
}

.artifact-lane {
  grid-area: lane;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--castle-color, #8bd3ff);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.build-list,
.role-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.build-list li,
.role-list li {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 4px solid var(--castle-color, rgba(139, 211, 255, 0.8));
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.4;
  padding: 8px 12px;
}

.build-list li b,
.role-list li b {
  display: block;
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 900;
}

.build-list li b .power-icon {
  margin-right: 0.35rem;
}

.reveal-unlock h3 .power-icon {
  margin-right: 0.35rem;
}

.build-list li span {
  display: block;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.76rem;
  font-weight: 700;
}

.build-list li.is-empty {
  border-left-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.55);
}

.role-list li b {
  display: inline;
  margin-right: 6px;
}

.game-stage[data-phase="cv"] .touch-controls {
  opacity: 0;
  pointer-events: none;
}

.game-stage[data-phase="cv"] .hud-card {
  opacity: 0;
}

@media (max-width: 760px), (pointer: coarse) {
  .hud-chips {
    gap: 4px;
    margin-top: 6px;
  }

  .hud-chip {
    min-height: 22px;
    font-size: 0.66rem;
    padding: 0 0.5rem;
  }

  .hud-boss {
    margin-top: 8px;
    padding: 6px 10px;
  }

  .dash-button {
    min-height: 4.1rem;
  }
}

@media (max-height: 460px) and (pointer: coarse) {
  .hud-chips {
    gap: 3px;
    margin-top: 3px;
  }

  .dash-button,
  .attack-button {
    min-height: 3.6rem;
  }
}


/* CV button inside the progress box */

.hud-cv-button {
  display: grid;
  gap: 2px;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  cursor: pointer;
  font: 900 0.86rem/1.1 Inter, ui-sans-serif, system-ui, sans-serif;
  padding: 6px 10px;
  pointer-events: auto;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
}

.hud-cv-button small {
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.66rem;
  font-weight: 700;
}

.hud-cv-button:hover,
.hud-cv-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.18);
}

.hud-health-track.is-low i {
  background: linear-gradient(90deg, #fb7185, #f97316);
}

/* Screen-edge flash when the player is hurt */

.game-stage.is-hurt::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(251, 113, 133, 0.55);
  animation: hurtFlash 320ms ease-out forwards;
}

@keyframes hurtFlash {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

/* Reveal blocks and panel notes */

.reveal-grid {
  display: grid;
  gap: 4px;
}

.panel-note {
  margin-top: 8px !important;
  color: rgba(255, 255, 255, 0.6) !important;
  font-size: 0.8rem;
}

.panel-summary {
  margin-top: 14px !important;
}

.panel-actions-quiet {
  margin-top: 10px;
}

.build-list li .artifact-lane,
.artifact-collection li .artifact-lane {
  display: block;
  margin-bottom: 2px;
}

.artifact-collection li strong {
  flex-basis: 100%;
}

.artifact-collection li .artifact-lane {
  flex-basis: 100%;
  margin-bottom: 0;
}

@media (min-width: 620px) {
  .reveal-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .reveal-line {
    grid-template-columns: 1fr;
    row-gap: 6px;
  }
}

@media (max-width: 760px), (pointer: coarse) {
  .hud-kicker {
    display: none;
  }

  .hud-cv-button {
    min-height: 44px;
  }

  .hud-cv-button small {
    display: none;
  }
}

@media (max-width: 360px) {
  .hud-card p:last-of-type {
    display: none;
  }
}

/* Compact icon-led power choices for the castle selection screen. */
.game-discovery .panel-kicker {
  color: var(--castle-color, #8bd3ff);
}

.game-discovery h2 {
  margin-bottom: 6px;
}

.game-discovery [data-discovery-intro] {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.84rem;
}

.game-discovery .artifact-choices {
  gap: 7px;
  margin-top: 12px;
}

.game-discovery .artifact-choice {
  grid-template-columns: 42px minmax(0, 1fr) auto;
  grid-template-areas:
    "lane title key"
    "lane project key"
    "lane teaser key";
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  min-height: 74px;
  padding: 9px 11px;
}

.game-discovery .artifact-choice kbd {
  align-self: center;
  min-width: 26px;
  min-height: 26px;
  font-size: 0.76rem;
}

.game-discovery .artifact-lane {
  width: 38px;
  height: 38px;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--castle-color, #8bd3ff) 55%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--castle-color, #8bd3ff) 17%, transparent);
}

.game-discovery .artifact-lane .power-icon {
  width: 22px;
  height: 22px;
}

.game-discovery .artifact-choice b {
  align-self: end;
  font-size: 0.94rem;
}

.game-discovery .artifact-choice .artifact-project {
  align-self: center;
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  text-transform: none;
}

.game-discovery .artifact-choice .artifact-effect {
  align-self: start;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
  line-height: 1.2;
}
