:root {
  color-scheme: dark;
  --ink: var(--syllvanic-color-ink, #f2eaf2);
  --muted: var(--syllvanic-color-muted, #afa2af);
  --faint: var(--syllvanic-color-faint, #8f8190);
  --page: var(--syllvanic-color-black, #050306);
  --plum: var(--syllvanic-color-plum, #1b0b1f);
  --plum-raised: var(--syllvanic-color-plum-raised, #24102a);
  --violet: var(--syllvanic-color-violet, #8c4bb4);
  --violet-bright: var(--syllvanic-color-violet-bright, #c47bea);
  --lilac: var(--syllvanic-color-lilac, #d8b5e7);
  --ember: var(--syllvanic-color-ember, #a72d35);
  --ember-bright: var(--syllvanic-color-ember-bright, #db5961);
  --line: var(--syllvanic-color-line, rgb(228 195 234 / 15%));
  --line-strong: var(--syllvanic-color-line-strong, rgb(228 195 234 / 28%));
  --display: var(--syllvanic-font-display, Georgia, "Times New Roman", serif);
  --body: var(--syllvanic-font-body, Aptos, "Segoe UI", sans-serif);
  --mono: var(--syllvanic-font-mono, "Cascadia Mono", Consolas, monospace);
  --game-panel: #0d1218;
  --game-panel-raised: #141d27;
  --game-line: #344656;
  --wall: #718596;
  --teal: #71dfd1;
  --teal-deep: #143b3c;
  --gold: #ffd166;
  --waystone: #c8a6ff;
  --green: #8ee7a5;
  --focus: #fff0a8;
  --shadow: 0 1.4rem 4.5rem rgb(0 0 0 / 38%);
  --page-max: 100rem;
  --page-gutter: clamp(1rem, 3vw, 3rem);
  font-family: var(--body);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--page);
  overflow-x: clip;
}

body {
  min-height: 100vh;
  margin: 0;
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 2%, rgb(140 75 180 / 17%), transparent 31rem),
    radial-gradient(circle at 96% 30%, rgb(167 45 53 / 10%), transparent 27rem),
    linear-gradient(180deg, #0a040c 0, var(--page) 36rem);
}

body::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  opacity: 0.13;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 4.5rem 4.5rem;
  content: "";
  pointer-events: none;
  mask-image: linear-gradient(to bottom, black, transparent 54rem);
}

button,
input {
  font: inherit;
}

a {
  color: var(--lilac);
  text-underline-offset: 0.23em;
}

a:hover {
  color: #f2d8ff;
}

button,
.button-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0.72rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.3rem;
  color: var(--ink);
  background: var(--plum-raised);
  cursor: pointer;
  font-weight: 750;
  letter-spacing: 0.01em;
  text-align: center;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  border-color: var(--violet-bright);
  color: #fff;
  background: #32163a;
}

button.primary,
.button-link.primary {
  border-color: #d597f1;
  color: #17071c;
  background: var(--lilac);
}

button.primary:hover,
.button-link.primary:hover {
  color: #100412;
  background: #eed7f7;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: max(0.75rem, env(safe-area-inset-top));
  left: max(0.75rem, env(safe-area-inset-left));
  z-index: 200;
  padding: 0.72rem 0.9rem;
  border-radius: 0.25rem;
  color: #130d00;
  background: var(--focus);
  font-weight: 800;
  transform: translateY(-180%);
}

.skip-link:focus {
  color: #130d00;
  transform: translateY(0);
}

.page-width,
.site-header {
  width: min(var(--page-max), calc(100% - var(--page-gutter) - var(--page-gutter)));
  margin-inline: auto;
}

.site-header {
  display: flex;
  min-height: 5rem;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding-block: max(0.75rem, env(safe-area-inset-top)) 0.75rem;
  border-bottom: 1px solid var(--line);
}

.brand-lockup {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-lockup:hover {
  color: var(--ink);
}

.brand-lockup img {
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand-lockup strong,
.brand-lockup small {
  display: block;
  overflow-wrap: anywhere;
}

.brand-lockup strong {
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.015em;
}

.brand-lockup small {
  margin-top: 0.1rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 1rem;
  flex-wrap: wrap;
  font-size: 0.88rem;
}

.site-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav .support-link {
  color: var(--lilac);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.75fr);
  gap: clamp(2rem, 7vw, 7rem);
  align-items: end;
  padding-block: clamp(2.5rem, 6vw, 5rem) clamp(2.5rem, 5vw, 4.5rem);
}

.hero-copy {
  min-width: 0;
}

.title-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.eyebrow {
  margin: 0;
  color: var(--violet-bright);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  min-height: 1.8rem;
  align-items: center;
  padding-inline: 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 99rem;
  color: var(--muted);
  background: rgb(36 16 42 / 72%);
  font-family: var(--mono);
  font-size: 0.68rem;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: var(--display);
}

h1 {
  max-width: 14ch;
  margin-bottom: 1.2rem;
  font-size: clamp(3rem, 6vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -0.055em;
  line-height: 0.9;
  text-wrap: balance;
}

h2 {
  margin-bottom: 0.85rem;
  font-size: clamp(1.8rem, 3.5vw, 3.1rem);
  letter-spacing: -0.035em;
  line-height: 0.98;
  text-wrap: balance;
}

h3 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  line-height: 1.25;
}

.lede {
  max-width: 57ch;
  margin-bottom: 1.35rem;
  color: #c3b8c4;
  font-size: clamp(1.02rem, 2.2vw, 1.24rem);
  line-height: 1.6;
}

.hero-facts {
  display: flex;
  gap: 0.55rem 1.35rem;
  flex-wrap: wrap;
  margin: 0 0 1.65rem;
  padding: 0;
  color: var(--muted);
  font-size: 0.84rem;
  list-style: none;
}

.hero-facts li {
  position: relative;
  padding-left: 0.9rem;
}

.hero-facts li::before {
  position: absolute;
  top: 0.55em;
  left: 0;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--violet-bright);
  content: "";
}

.hero-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.hero-emblem {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: center;
  padding: clamp(1.25rem, 4vw, 2rem);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 0.4rem;
  background:
    linear-gradient(135deg, rgb(140 75 180 / 18%), transparent 55%),
    var(--plum);
  box-shadow: var(--shadow);
}

.hero-emblem::after {
  position: absolute;
  right: -2rem;
  bottom: -2rem;
  width: 9rem;
  height: 9rem;
  opacity: 0.18;
  border: 1px solid var(--lilac);
  background-image:
    linear-gradient(var(--lilac) 1px, transparent 1px),
    linear-gradient(90deg, var(--lilac) 1px, transparent 1px);
  background-size: 1.5rem 1.5rem;
  content: "";
  transform: rotate(18deg);
}

.emblem-mark {
  display: grid;
  width: 4.2rem;
  height: 4.2rem;
  place-items: center;
  border: 1px solid rgb(216 181 231 / 55%);
  border-radius: 50%;
  color: #1b0b1f;
  background: var(--lilac);
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 800;
}

.hero-emblem strong,
.hero-emblem small {
  position: relative;
  z-index: 1;
  display: block;
}

.hero-emblem strong {
  font-family: var(--display);
  font-size: 1.2rem;
}

.hero-emblem small {
  margin-top: 0.35rem;
  color: var(--muted);
  line-height: 1.45;
}

.briefing,
.game-section,
.information-grid {
  scroll-margin-top: 1rem;
}

.briefing {
  padding-block: clamp(2rem, 4vw, 3.5rem);
  border-block: 1px solid var(--line);
}

.section-heading {
  max-width: 50rem;
  margin-bottom: 2rem;
}

.section-heading .eyebrow {
  margin-bottom: 0.85rem;
}

.section-heading > p:not(.eyebrow),
.game-heading > p {
  color: var(--muted);
  line-height: 1.6;
}

.briefing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 1px;
  background: var(--line);
  list-style: none;
}

.briefing-grid li {
  min-width: 0;
  padding: clamp(1.1rem, 3vw, 1.75rem);
  background: rgb(20 8 23 / 92%);
}

.briefing-grid p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.58;
}

.step-number {
  display: block;
  margin-bottom: 1.6rem;
  color: var(--violet-bright);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.game-section {
  padding-block: clamp(2.5rem, 5vw, 4.5rem);
}

.game-heading {
  display: grid;
  max-width: none;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, 28rem);
  gap: 1rem 3rem;
  align-items: end;
}

.game-heading h2 {
  margin-bottom: 0;
}

.game-heading > p {
  margin-bottom: 0.2rem;
}

.game-frame {
  min-width: 0;
  padding: clamp(0.65rem, 2vw, 1.15rem);
  border: 1px solid var(--line-strong);
  border-radius: 0.45rem;
  background:
    linear-gradient(145deg, rgb(140 75 180 / 10%), transparent 24rem),
    #080a0e;
  box-shadow: var(--shadow);
}

.hud {
  display: grid;
  grid-template-columns: 0.95fr 1.2fr 0.95fr 1.1fr 1.45fr 1.35fr;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--game-line);
  border-radius: 0.3rem;
  background: var(--game-line);
}

.hud-card {
  min-width: 0;
  padding: 0.62rem 0.78rem;
  background: var(--game-panel);
}

.hud-card > span,
.hud-card > strong {
  display: block;
}

.hud-card strong {
  overflow: hidden;
  margin: 0.12rem 0;
  font-size: clamp(1.05rem, 2vw, 1.32rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud-card > span:last-child {
  color: #aebbc5;
  font-size: 0.76rem;
}

.perfect-status,
.waystone-status,
.waystone-detail {
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.perfect-status {
  display: grid;
  gap: 0.12rem;
  margin-top: 0.22rem;
}

.perfect-status b {
  color: var(--ink);
}

.perfect-status small {
  color: #aebbc5;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
}

.perfect-status[data-perfect-state="missed"] small {
  color: var(--ember-bright);
}

.records-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem;
  margin: 0.3rem 0 0;
}

.records-list > div {
  min-width: 0;
}

.records-list dt {
  min-height: 2.3em;
  color: #aebbc5;
  font-size: 0.66rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.records-list dd {
  margin: 0.1rem 0 0;
  color: var(--ink);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  font-weight: 850;
  line-height: 1.1;
  overflow-wrap: anywhere;
  white-space: normal;
}

.waystone-card {
  position: relative;
  background:
    linear-gradient(145deg, rgb(200 166 255 / 10%), transparent 72%),
    var(--game-panel);
}

.waystone-card::before {
  position: absolute;
  inset: 0.18rem 0.22rem auto;
  border-top: 1px dashed var(--waystone);
  content: "";
  pointer-events: none;
}

.waystone-card.waystone-charging::before,
.waystone-card[data-waystone-state="charging"]::before {
  border-top: 1px dashed var(--waystone);
}

.waystone-card.waystone-charged::before,
.waystone-card.waystone-ready::before,
.waystone-card.is-charged::before,
.waystone-card.is-ready::before,
.waystone-card[data-waystone-state="ready"]::before,
.waystone-card[data-waystone-state="charged"]::before {
  border-top: 3px double var(--waystone);
}

.waystone-card.waystone-escape::before,
.waystone-card[data-waystone-state="escape"]::before {
  border-top: 3px double var(--focus);
}

.waystone-card.waystone-gameover,
.waystone-card.gameover,
.waystone-card[data-waystone-state="gameover"],
.game-frame.gameover .waystone-card,
.game-frame[data-game-state="gameover"] .waystone-card {
  outline: 2px solid var(--ember-bright);
  outline-offset: -5px;
  animation: none;
}

.waystone-card.waystone-gameover::before,
.waystone-card.gameover::before,
.waystone-card[data-waystone-state="gameover"]::before,
.game-frame.gameover .waystone-card::before,
.game-frame[data-game-state="gameover"] .waystone-card::before {
  border-top: 2px solid var(--ember-bright);
}

.hud-card > .waystone-status {
  display: inline-block;
  margin-top: 0.22rem;
  color: var(--waystone);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.hud-card > .waystone-detail {
  display: inline;
}

.waystone-detail::before {
  content: " · ";
}

.waystone-card.waystone-escape .waystone-status,
.waystone-card[data-waystone-state="escape"] .waystone-status {
  color: var(--focus);
}

.waystone-card.waystone-gameover .waystone-status,
.waystone-card.gameover .waystone-status,
.waystone-card[data-waystone-state="gameover"] .waystone-status,
.game-frame.gameover .waystone-card .waystone-status,
.game-frame[data-game-state="gameover"] .waystone-card .waystone-status {
  color: var(--ember-bright);
}

.next-shift {
  margin-top: 0.28rem;
  overflow-wrap: anywhere;
}

.next-shift.shift-warning {
  color: var(--focus);
  font-weight: 850;
  text-decoration: underline dotted 0.12em;
  text-underline-offset: 0.2em;
}

.next-shift.shift-highlight {
  color: #fff;
  text-shadow: 0 0 0.45rem var(--teal);
}

.hud-label {
  color: var(--teal);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.timer-progress,
.waystone-progress {
  display: block;
  width: 100%;
  height: 0.35rem;
  overflow: hidden;
  appearance: none;
  border: 0;
  border-radius: 1rem;
  background: #020609;
}

.timer-progress::-webkit-progress-bar,
.waystone-progress::-webkit-progress-bar {
  border-radius: inherit;
  background: #020609;
}

.timer-progress::-webkit-progress-value {
  border-radius: inherit;
  background: var(--teal);
}

.timer-progress::-moz-progress-bar {
  border-radius: inherit;
  background: var(--teal);
}

.waystone-progress::-webkit-progress-value {
  border-radius: inherit;
  background: var(--waystone);
}

.waystone-progress::-moz-progress-bar {
  border-radius: inherit;
  background: var(--waystone);
}

.timer-progress.warning::-webkit-progress-value {
  background: var(--ember-bright);
}

.timer-progress.warning::-moz-progress-bar {
  background: var(--ember-bright);
}

.action-bar {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  padding: 0.55rem 0;
}

.action-bar button {
  flex: 0 0 auto;
}

.action-bar button.primary {
  border-color: #72d8cc;
  color: #041312;
  background: var(--teal);
}

.action-bar button.primary:hover {
  background: #a1eee5;
}

.run-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.35rem 0.75rem;
  align-items: center;
  margin: 0 0 0.55rem;
  padding: 0.65rem 0.8rem;
  border-left: 4px solid var(--green);
  border-radius: 0.2rem;
  color: #e5edf1;
  background: #091319;
}

.run-result[hidden] {
  display: none;
}

.run-result strong {
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

.run-result span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.run-result[data-result="fail"] {
  border: 2px double var(--ember-bright);
  background: #19090c;
}

.run-result[data-result="fail"] strong {
  color: var(--ember-bright);
}

.run-result[data-result="pass"] {
  border-left-width: 6px;
}

.maze-code {
  min-width: 0;
  margin-left: auto;
  color: #aebbc5;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.maze-code code {
  color: #dbe6ea;
  word-break: break-all;
}

code,
kbd {
  font-family: var(--mono);
}

kbd {
  display: inline-block;
  min-width: 1.7em;
  padding: 0.08rem 0.3rem;
  border: 1px solid #526679;
  border-bottom-width: 3px;
  border-radius: 0.2rem;
  color: #eef7f6;
  background: #192633;
  font-size: 0.84em;
  text-align: center;
}

.game-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  align-items: start;
}

.maze-panel,
.field-notes {
  min-width: 0;
  border: 1px solid var(--game-line);
  border-radius: 0.35rem;
  background: rgb(13 18 24 / 96%);
}

.maze-panel {
  padding: clamp(0.55rem, 2vw, 1rem);
}

.maze-bezel {
  display: grid;
  min-height: 0;
  padding: clamp(0.55rem, 2vw, 1rem);
  place-items: center;
  border: 1px solid #263748;
  border-radius: 0.25rem;
  background:
    linear-gradient(rgb(255 255 255 / 1.8%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 1.8%) 1px, transparent 1px),
    #05080b;
  background-size: 18px 18px;
}

.maze-board {
  position: relative;
  width: min(100%, 22rem);
  max-width: 100%;
  aspect-ratio: 9 / 15;
}

.maze-grid {
  display: grid;
  grid-template-rows: repeat(15, minmax(0, 1fr));
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-right: 2px solid var(--wall);
  border-bottom: 2px solid var(--wall);
  border-radius: 0.15rem;
  background: #0e1820;
  box-shadow: 0 0 0 5px #030609, 0 0 32px rgb(101 224 208 / 9%);
  touch-action: pan-y;
}

.maze-grid:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 5px var(--focus), 0 0 35px rgb(255 240 168 / 22%);
}

.maze-row {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: repeat(9, minmax(0, 1fr));
}

.cell {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: visible;
  border-top: 2px solid var(--wall);
  border-left: 2px solid var(--wall);
  background: #111d27;
}

.cell.open-n {
  border-top-color: transparent;
}

.cell.open-w {
  border-left-color: transparent;
}

.cell.inactive-pocket {
  background: rgb(174 187 197 / 8%);
}

.cell.exit-cell {
  background:
    radial-gradient(circle, rgb(200 166 255 / 16%) 0 38%, transparent 40%),
    #111d27;
  box-shadow: inset 0 0 0 1px rgb(200 166 255 / 35%);
}

.cell.start-cell::before,
.cell.exit-cell::before {
  position: absolute;
  z-index: 1;
  color: #8295a7;
  font-size: clamp(0.5rem, 1.35vw, 0.78rem);
  font-weight: 900;
}

.cell.start-cell::before {
  content: "S";
}

.cell.exit-cell::before {
  display: grid;
  width: 72%;
  max-width: 1.85rem;
  aspect-ratio: 1;
  place-items: center;
  border: 1px dashed currentColor;
  border-radius: 50%;
  color: var(--waystone);
  content: "W";
  font-family: var(--mono);
  line-height: 1;
}

.cell.exit-cell.waystone-charging::before,
.cell.exit-cell[data-waystone-state="charging"]::before {
  border: 1px dashed currentColor;
}

.cell.exit-cell.waystone-charged::before,
.cell.exit-cell.waystone-ready::before,
.cell.exit-cell.is-charged::before,
.cell.exit-cell.is-ready::before,
.cell.exit-cell[data-waystone-state="ready"]::before,
.cell.exit-cell[data-waystone-state="charged"]::before {
  border: 3px double currentColor;
}

.cell.exit-cell.waystone-escape::before,
.cell.exit-cell[data-waystone-state="escape"]::before {
  border: 3px double currentColor;
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.cell.exit-cell.waystone-gameover::before,
.cell.exit-cell.gameover::before,
.cell.exit-cell[data-waystone-state="gameover"]::before,
.game-frame.gameover .cell.exit-cell::before,
.game-frame[data-game-state="gameover"] .cell.exit-cell::before {
  border: 2px solid currentColor;
  border-radius: 0.12rem;
  color: var(--ember-bright);
  outline: 1px solid currentColor;
  outline-offset: -4px;
  content: "×";
  animation: none;
}
.player {
  position: relative;
  z-index: 6;
  width: 55%;
  aspect-ratio: 1;
  border: max(2px, 0.12rem) solid #fff7d5;
  border-radius: 48% 48% 42% 42%;
  background: var(--gold);
  box-shadow: 0 0 0 2px #7b5811, 0 0 12px rgb(255 209 102 / 72%);
}

.player::after {
  position: absolute;
  top: 18%;
  right: 18%;
  width: 18%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #352508;
  content: "";
}

.point-token {
  position: relative;
  z-index: 4;
  color: var(--gold);
  font-size: clamp(0.75rem, 2.35vw, 1.4rem);
  line-height: 1;
  filter: drop-shadow(0 0 6px rgb(255 209 102 / 72%));
}

.point-token.far {
  color: var(--waystone);
  filter: drop-shadow(0 0 6px rgb(199 164 255 / 72%));
}

.day-0 {
  --gate-day-color: #ffd166;
}

.day-1 {
  --gate-day-color: #71dfd1;
}

.day-2 {
  --gate-day-color: #c8a6ff;
}

.day-3 {
  --gate-day-color: #ff969e;
}

.day-4 {
  --gate-day-color: #83b9ff;
}

.day-5 {
  --gate-day-color: #8ee7a5;
}

.day-6 {
  --gate-day-color: #f59ad8;
}

/* Gate geometry is rendered once in board coordinates. Each path contains two
   endpoint braces and, when closed, one restrained transverse segment. */
.gate-overlay {
  position: absolute;
  z-index: 8;
  inset: 0 2px 2px 0;
  width: calc(100% - 2px);
  height: calc(100% - 2px);
  overflow: visible;
  color: var(--teal);
  pointer-events: none;
}

.gate-overlay .gate-edge,
.gate-overlay .pocket-cue {
  color: var(--gate-day-color, var(--teal));
  pointer-events: none;
}

.gate-overlay .gate-edge {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5px;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.68;
}

.gate-overlay .gate-edge.is-next {
  opacity: 0.84;
}

.gate-overlay .gate-edge.is-today,
.gate-overlay .gate-edge.is-highlighted,
.gate-overlay .gate-edge.shift-highlight,
.gate-overlay .gate-edge.shift-warning {
  opacity: 1;
}

.gate-overlay .pocket-cue {
  fill: currentColor;
  stroke: #071016;
  stroke-width: 0.75px;
  vector-effect: non-scaling-stroke;
  paint-order: stroke fill;
  font-family: "Segoe UI Symbol", "Apple Symbols", sans-serif;
  font-size: 0.42px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: central;
}
.touch-controls {
  --dpad-row-height: clamp(3.5rem, 17vw, 4.25rem);
  --dpad-width: clamp(14rem, 70vw, 17rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.86fr) minmax(0, 1fr);
  grid-template-rows: repeat(2, var(--dpad-row-height));
  gap: 0.4rem;
  isolation: isolate;
  width: var(--dpad-width);
  max-width: 100%;
  margin: 0.85rem auto 0;
  padding: 0.4rem;
  overflow: visible;
  border: 2px solid #3f5567;
  border-radius: 0.65rem;
  background: #080d12;
}

.touch-controls button {
  position: relative;
  display: grid;
  place-items: center;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 3.5rem;
  padding: 0.5rem;
  border: 1px solid #536a79;
  border-radius: 0.45rem;
  color: #eef7f6;
  background: var(--game-panel-raised);
  font-size: 1.15rem;
  touch-action: manipulation;
  user-select: none;
}

.touch-controls [data-move="north"] { grid-column: 2; grid-row: 1; }
.touch-controls [data-move="west"] { grid-column: 1; grid-row: 1 / 3; }
.touch-controls [data-move="east"] { grid-column: 3; grid-row: 1 / 3; }
.touch-controls [data-move="south"] { grid-column: 2; grid-row: 2; }

.touch-controls button span {
  line-height: 1;
}

.touch-controls button:hover {
  background: #1e3140;
}

.touch-controls button:active {
  color: #071016;
  background: var(--teal);
}

.touch-controls button:focus-visible {
  z-index: 3;
  outline: 4px solid var(--focus);
  outline-offset: 2px;
  color: #171000;
  background: var(--focus);
  filter: drop-shadow(0 0 0.2rem var(--focus));
}

.field-notes {
  position: sticky;
  top: 0.75rem;
  padding: clamp(1rem, 3vw, 1.35rem);
}

.field-notes > .eyebrow {
  color: var(--teal);
  margin-bottom: 0.55rem;
}

.field-notes > h3 {
  margin-bottom: 1rem;
  font-family: var(--display);
  font-size: clamp(1.35rem, 3vw, 1.85rem);
}

.token-objectives {
  display: grid;
  gap: 0.5rem;
}

.token-objective {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.68rem;
  border: 1px solid var(--game-line);
  border-radius: 0.25rem;
  background: #091017;
}

.token-objective.collected {
  border-color: rgb(142 231 165 / 55%);
  background: rgb(26 70 47 / 35%);
}

.token-objective strong,
.token-objective small {
  display: block;
}

.token-objective strong {
  overflow-wrap: anywhere;
}

.token-objective small {
  margin-top: 0.1rem;
  color: #aebbc5;
}

.token-objective b {
  color: #aebbc5;
  font-size: 0.72rem;
}

.token-objective.collected b {
  color: var(--green);
}

.token-symbol {
  display: grid;
  width: 2.15rem;
  height: 2.15rem;
  place-items: center;
  border: 2px solid var(--gold);
  border-radius: 0.2rem;
  color: #171000;
  background: var(--gold);
  font-size: 1.05rem;
}

.token-symbol.near {
  border-color: var(--gold);
  color: #171000;
  background: var(--gold);
}

.token-symbol.far {
  border-color: var(--waystone);
  color: var(--waystone);
  background: transparent;
}

.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.75rem;
  margin: 1.1rem 0;
  padding: 0.85rem 0;
  border-top: 1px solid var(--game-line);
  border-bottom: 1px solid var(--game-line);
  color: #aebbc5;
  font-size: 0.78rem;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-mark {
  display: inline-grid;
  width: 0.95rem;
  height: 0.95rem;
  flex: 0 0 auto;
  place-items: center;
  border: 2px solid currentColor;
  font-style: normal;
  font-weight: 1000;
  line-height: 1;
}

.player-mark {
  border-radius: 50%;
  color: var(--gold);
  background: var(--gold);
}

.open-gate-mark {
  position: relative;
  color: var(--teal);
  border: 0;
  background: linear-gradient(currentColor 0 0) left center / 28% 35% no-repeat,
    linear-gradient(currentColor 0 0) right center / 28% 35% no-repeat;
}

.open-gate-mark::after {
  content: "";
}

.closed-gate-mark {
  position: relative;
  color: var(--ember-bright);
  border: 0;
  background: linear-gradient(currentColor 0 0) left center / 28% 55% no-repeat,
    linear-gradient(currentColor 0 0) right center / 28% 55% no-repeat,
    linear-gradient(currentColor 0 0) center / 100% 2px no-repeat;
}

.closed-gate-mark::after {
  content: "";
}

.near-gate-mark,
.far-gate-mark {
  border: 0;
}

.near-gate-mark {
  color: var(--gold);
}

.near-gate-mark::after {
  content: "◆";
}

.far-gate-mark {
  color: var(--waystone);
}

.far-gate-mark::after {
  content: "✧";
  font-size: 1.08rem;
}

.weekday-mark {
  border-color: #dce5e8;
  background: linear-gradient(
    90deg,
    #ffd166 0 14.28%,
    #71dfd1 14.28% 28.56%,
    #c8a6ff 28.56% 42.84%,
    #ff969e 42.84% 57.12%,
    #83b9ff 57.12% 71.4%,
    #8ee7a5 71.4% 85.68%,
    #f59ad8 85.68% 100%
  );
}

.exit-mark {
  border-radius: 50%;
  color: var(--waystone);
  font-family: var(--mono);
  font-size: 0.5rem;
}

.waystone-charging-mark {
  border-style: dashed;
}

.waystone-charged-mark,
.waystone-escape-mark {
  border: 3px double currentColor;
}

.waystone-escape-mark {
  outline: 1px solid var(--focus);
  outline-offset: 1px;
}

.waystone-gameover-mark {
  border: 2px solid currentColor;
  border-radius: 0.1rem;
  color: var(--ember-bright);
  font-size: 0.72rem;
}

.instructions {
  color: #aebbc5;
  font-size: 0.86rem;
  line-height: 1.55;
}

.instructions p:last-child {
  margin-bottom: 0;
}

.game-message,
.error-panel {
  margin: 1rem 0 0;
  padding: 0.8rem;
  border-left: 4px solid var(--teal);
  border-radius: 0.15rem;
  color: #d9e7e8;
  background: #071016;
  line-height: 1.45;
}

.error-panel {
  border-color: var(--ember-bright);
}

.validation-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.8rem 0.1rem 0;
  color: #98a7b3;
  font-family: var(--mono);
  font-size: 0.7rem;
}

.validation-strip > span {
  flex: 0 0 auto;
  color: var(--green);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.validation-strip p {
  margin: 0;
  text-align: right;
}

.week-gates {
  margin-top: clamp(1rem, 2.5vw, 1.6rem);
  padding: clamp(0.9rem, 2.5vw, 1.35rem);
  scroll-margin-top: 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.45rem;
  background:
    linear-gradient(135deg, rgb(113 223 209 / 5%), transparent 28rem),
    rgb(8 10 14 / 96%);
  box-shadow: var(--shadow);
}

.week-gates-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 34rem);
  gap: 0.75rem 2rem;
  align-items: end;
  margin-bottom: 0.9rem;
}

.week-gates-heading .eyebrow {
  margin-bottom: 0.45rem;
  color: var(--teal);
}

.week-gates-heading h3 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
}

#week-gates-summary {
  margin: 0;
  color: #aebbc5;
  font-size: 0.86rem;
  line-height: 1.5;
}

.week-gates-list {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.week-gates-list > li,
.week-gate-card {
  min-width: 0;
  border: 1px solid #344656;
  border-radius: 0.3rem;
  color: var(--ink);
  background: #0d151d;
}

.week-gates-list button,
.week-gate-button {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.28rem;
  align-content: start;
  justify-items: start;
  padding: 0.68rem 0.7rem 0.7rem 0.88rem;
  overflow: hidden;
  border: 0;
  border-left: 0.28rem solid var(--gate-day-color, var(--teal));
  border-radius: inherit;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.week-gates-list button::before,
.week-gate-button::before {
  position: absolute;
  inset: 0.22rem;
  border: 1px solid transparent;
  border-radius: 0.2rem;
  content: "";
  pointer-events: none;
}

.week-gates-list button:hover,
.week-gate-button:hover {
  color: #fff;
  background: rgb(49 72 89 / 48%);
}

.week-gate-day {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 800;
}

.week-gate-button.is-today > .week-gate-day::after,
.week-gate-button.is-next > .week-gate-day::after {
  flex: 0 0 auto;
  padding: 0.12rem 0.3rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.week-gate-button.is-today > .week-gate-day::after {
  content: "Today";
}

.week-gate-button.is-next > .week-gate-day::after {
  border-style: dashed;
  content: "Next";
}

.week-gate-progress {
  color: var(--gate-day-color, var(--teal));
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.025em;
  overflow-wrap: anywhere;
}

.week-gate-location,
.gate-location {
  color: #aebbc5;
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.gate-symbol {
  color: var(--gate-day-color, var(--teal));
  font-weight: 1000;
}

.week-gate-card.is-next,
.week-gates-list > li.is-next {
  border-style: dashed;
  border-width: 2px;
}

.week-gate-card.is-next .week-gate-button::before,
.week-gates-list > li.is-next button::before {
  border-style: dashed;
  border-color: currentColor;
  opacity: 0.48;
}

.week-gate-card.is-today,
.week-gates-list > li.is-today {
  border-width: 3px;
  border-color: var(--gate-day-color, var(--focus));
  box-shadow: 0 0 0 2px #081015, 0 0 0 4px var(--focus);
}

.week-gate-card.is-today .week-gate-button::before,
.week-gates-list > li.is-today button::before {
  border-color: currentColor;
}

.week-gate-card.is-highlighted,
.week-gates-list > li.is-highlighted,
.week-gate-card.shift-highlight,
.week-gates-list > li.shift-highlight {
  border-color: var(--focus);
  background:
    repeating-linear-gradient(135deg, rgb(255 240 168 / 10%) 0 4px, transparent 4px 9px),
    #10202a;
  box-shadow: 0 0 0 3px rgb(255 240 168 / 32%);
}

.week-gate-card.shift-warning,
.week-gates-list > li.shift-warning {
  outline: 2px dotted var(--focus);
  outline-offset: 2px;
}

.week-gates-list button[aria-current],
.week-gate-button[aria-current] {
  font-weight: 800;
}

.week-gates-list button[aria-pressed="true"],
.week-gate-button[aria-pressed="true"] {
  outline: 3px double var(--focus);
  outline-offset: -6px;
}

.information-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: clamp(4rem, 9vw, 8rem);
  padding: 1px;
  background: var(--line);
}

.information-card {
  min-width: 0;
  padding: clamp(1.4rem, 4vw, 2.5rem);
  background: rgb(20 8 23 / 94%);
}

.information-card .eyebrow {
  margin-bottom: 0.85rem;
}

.information-card h2 {
  font-size: clamp(2rem, 4vw, 3rem);
}

.information-card p,
.plain-list {
  color: var(--muted);
  line-height: 1.65;
}

.plain-list {
  margin: 0;
  padding-left: 1.2rem;
}

.plain-list li + li {
  margin-top: 0.4rem;
}

.quiet-button {
  margin-top: 0.35rem;
  color: #ffdadd;
  border-color: rgb(219 89 97 / 58%);
  background: rgb(87 18 27 / 42%);
}

.quiet-button:hover {
  border-color: var(--ember-bright);
  background: rgb(121 27 38 / 58%);
}

.fine-print {
  margin: 0.7rem 0 0;
  font-size: 0.78rem;
}

.confirm-dialog {
  width: min(32rem, calc(100% - 1.5rem));
  max-height: calc(100% - 1.5rem);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 0.4rem;
  color: var(--ink);
  background: var(--plum);
  box-shadow: 0 2rem 7rem rgb(0 0 0 / 70%);
}

.confirm-dialog::backdrop {
  background: rgb(3 1 4 / 82%);
  backdrop-filter: blur(3px);
}

.confirm-dialog-inner {
  padding: clamp(1.35rem, 5vw, 2.25rem);
}

.confirm-dialog .eyebrow {
  margin-bottom: 0.8rem;
}

.confirm-dialog h2 {
  margin-bottom: 0.75rem;
  font-size: clamp(1.9rem, 7vw, 2.8rem);
}

.confirm-dialog p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.6;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}

.danger-button {
  border-color: var(--ember-bright);
  color: #fff1f2;
  background: #701b27;
}

.danger-button:hover {
  background: #942535;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgb(7 3 8 / 78%);
}

.not-found {
  display: flex;
  min-height: calc(100vh - 12rem);
  max-width: 54rem;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding-block: clamp(4rem, 12vw, 9rem);
}

.not-found .eyebrow {
  margin-bottom: 1rem;
}

.not-found h1 {
  max-width: 9ch;
}

.not-found > p:not(.eyebrow) {
  max-width: 48ch;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.not-found-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.footer-inner {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.5rem max(2rem, env(safe-area-inset-bottom));
}

.footer-inner strong {
  font-family: var(--display);
}

.footer-inner p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.footer-meta {
  min-width: 0;
  text-align: right;
}

.footer-meta a {
  display: inline-block;
  min-height: 44px;
  padding-top: 0.65rem;
  font-size: 0.82rem;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

@media (max-width: 1100px) {
  .week-gates-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 901px) {
  .game-frame {
    padding: clamp(0.6rem, 1vw, 0.85rem);
  }

  .maze-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: clamp(0.7rem, 1.5vw, 1rem);
    align-items: center;
    padding: clamp(0.55rem, 1vw, 0.75rem);
  }

  .maze-bezel {
    padding: clamp(0.55rem, 1vw, 0.75rem);
  }

  .maze-board {
    width: min(100%, clamp(14rem, calc(60vh - 12.5rem), 26.4rem));
    width: min(100%, clamp(14rem, calc(60dvh - 12.5rem), 26.4rem));
  }

  .touch-controls {
    margin: 0;
  }

  .field-notes {
    position: static;
    display: grid;
    grid-template-areas:
      "eyebrow eyebrow"
      "title title"
      "objectives legend"
      "instructions message";
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem 0.8rem;
    align-content: start;
    padding: clamp(0.7rem, 1.2vw, 1rem);
  }

  .field-notes > .eyebrow {
    grid-area: eyebrow;
    margin-bottom: 0;
  }

  .field-notes > h3 {
    grid-area: title;
    margin-bottom: 0;
    font-size: clamp(1.2rem, 1.7vw, 1.55rem);
  }

  .token-objectives {
    grid-area: objectives;
  }

  .field-notes .token-objective {
    gap: 0.45rem;
    padding: 0.5rem;
  }

  .field-notes .token-symbol {
    width: 1.8rem;
    height: 1.8rem;
  }

  .field-notes .legend {
    grid-area: legend;
    margin: 0;
    padding: 0.55rem 0;
  }

  .field-notes .instructions {
    grid-area: instructions;
    font-size: 0.86rem;
    line-height: 1.4;
  }

  .field-notes .instructions h3 {
    margin-bottom: 0.35rem;
  }

  .field-notes .instructions p {
    margin-bottom: 0.45rem;
  }

  .field-notes .game-message {
    grid-area: message;
    align-self: stretch;
    margin: 0;
    padding: 0.65rem;
    font-size: 0.86rem;
  }

  .validation-strip {
    padding-top: 0.55rem;
  }
}

@media (max-width: 900px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.35rem;
  }

  .site-nav {
    width: 100%;
    justify-content: flex-start;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 2.25rem;
  }

  .hero-emblem {
    max-width: 38rem;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .maze-board {
    width: min(100%, 22rem);
  }

  .field-notes {
    position: static;
  }
}

@media (max-width: 760px) {
  .briefing-grid,
  .information-grid {
    grid-template-columns: 1fr;
  }

  .game-heading {
    grid-template-columns: 1fr;
  }

  .week-gates-heading {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .week-gates-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-inner {
    flex-direction: column;
  }

  .footer-meta {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .page-width,
  .site-header {
    width: calc(100% - 1rem);
  }

  .site-header {
    padding-top: max(0.5rem, env(safe-area-inset-top));
  }

  .brand-lockup strong {
    font-size: 0.92rem;
  }

  .site-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    border: 1px solid var(--line);
    background: var(--line);
  }

  .site-nav a {
    justify-content: center;
    padding-inline: 0.45rem;
    background: #0b050d;
  }

  .hero {
    padding-block: 3rem 3.5rem;
  }

  h1 {
    font-size: clamp(3rem, 17vw, 4.5rem);
  }

  .hero-emblem {
    grid-template-columns: 1fr;
  }

  .emblem-mark {
    width: 3.7rem;
    height: 3.7rem;
  }

  .game-frame {
    padding: 0.45rem;
  }

  .hud-card {
    padding-inline: 0.58rem;
  }

  .records-list {
    grid-template-columns: 1fr;
  }

  .records-list dt {
    min-height: 0;
  }

  .action-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .action-bar button {
    width: 100%;
  }

  .run-result {
    grid-template-columns: 1fr;
  }

  #announce-status,
  #inspect-week,
  .maze-code {
    grid-column: 1 / -1;
  }

  .maze-code {
    margin-left: 0;
    padding: 0.25rem;
  }

  .maze-panel,
  .maze-bezel {
    padding: 0.45rem;
  }

  .maze-bezel {
    min-height: 0;
  }

  .touch-controls {
    --dpad-row-height: clamp(3.5rem, 17vw, 4.1rem);
    --dpad-width: clamp(14rem, 74vw, 17rem);
  }

  .week-gates {
    padding: 0.75rem;
  }

  .week-gates-list {
    grid-template-columns: 1fr;
  }

  .token-objective {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .token-objective b {
    grid-column: 2;
  }

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

  .validation-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .validation-strip p {
    text-align: left;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  button,
  a,
  .skip-link {
    transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease, transform 140ms ease;
  }

  .timer-progress::-webkit-progress-value,
  .waystone-progress::-webkit-progress-value {
    transition: background-color 140ms ease;
  }

  .timer-progress::-moz-progress-bar,
  .waystone-progress::-moz-progress-bar {
    transition: background-color 140ms ease;
  }

  .waystone-card.waystone-escape,
  .waystone-card[data-waystone-state="escape"] {
    animation: waystone-escape-panel 2.7s ease-in-out infinite;
  }

  .cell.exit-cell.waystone-escape::before,
  .cell.exit-cell[data-waystone-state="escape"]::before {
    animation: waystone-escape-ring 2.7s ease-in-out infinite;
  }

  .waystone-card.waystone-gameover,
  .waystone-card.gameover,
  .waystone-card[data-waystone-state="gameover"],
  .game-frame.gameover .waystone-card,
  .game-frame[data-game-state="gameover"] .waystone-card,
  .cell.exit-cell.waystone-gameover::before,
  .cell.exit-cell.gameover::before,
  .cell.exit-cell[data-waystone-state="gameover"]::before,
  .game-frame.gameover .cell.exit-cell::before,
  .game-frame[data-game-state="gameover"] .cell.exit-cell::before {
    animation: none;
  }

  @keyframes waystone-escape-panel {
    0%,
    100% {
      outline: 1px solid rgb(255 240 168 / 48%);
      outline-offset: -2px;
    }
    50% {
      outline: 3px solid var(--focus);
      outline-offset: -5px;
    }
  }

  @keyframes waystone-escape-ring {
    0%,
    100% {
      outline: 1px solid rgb(255 240 168 / 55%);
      outline-offset: 1px;
    }
    50% {
      outline: 3px solid var(--focus);
      outline-offset: 3px;
    }
  }

  .point-token {
    animation: token-breathe 1.6s ease-in-out infinite alternate;
  }

  @keyframes token-breathe {
    from { transform: scale(0.9); }
    to { transform: scale(1.08); }
  }
}

@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;
  }

  .gate-overlay .gate-edge,
  .gate-overlay .pocket-cue,
  .week-gate-card,
  .week-gates-list > li {
    transition: none !important;
  }

  .waystone-card.waystone-escape,
  .waystone-card[data-waystone-state="escape"] {
    outline: 3px double var(--focus);
    outline-offset: -5px;
  }

  .cell.exit-cell.waystone-escape::before,
  .cell.exit-cell[data-waystone-state="escape"]::before {
    outline: 3px double var(--focus);
    outline-offset: 2px;
  }

  .waystone-card.waystone-gameover,
  .waystone-card.gameover,
  .waystone-card[data-waystone-state="gameover"],
  .game-frame.gameover .waystone-card,
  .game-frame[data-game-state="gameover"] .waystone-card {
    outline: 3px solid var(--ember-bright);
    outline-offset: -5px;
  }

  .cell.exit-cell.waystone-gameover::before,
  .cell.exit-cell.gameover::before,
  .cell.exit-cell[data-waystone-state="gameover"]::before,
  .game-frame.gameover .cell.exit-cell::before,
  .game-frame[data-game-state="gameover"] .cell.exit-cell::before {
    border: 2px solid currentColor;
    border-radius: 0.12rem;
    outline: 1px solid currentColor;
    outline-offset: -4px;
  }
}

@media (forced-colors: active) {
  .hero-emblem,
  .game-frame,
  .maze-panel,
  .field-notes,
  .week-gates,
  .week-gates-list > li,
  .information-card,
  .briefing-grid li {
    border: 1px solid CanvasText;
  }

  .player,
  .point-token,
  .legend-mark {
    forced-color-adjust: none;
  }

  .point-token {
    color: CanvasText;
    filter: none;
    forced-color-adjust: auto;
  }

  .token-symbol.near {
    border-color: CanvasText;
    color: Canvas;
    background: CanvasText;
    forced-color-adjust: auto;
  }

  .token-symbol.far {
    border-color: CanvasText;
    color: CanvasText;
    background: Canvas;
    forced-color-adjust: auto;
  }

  .near-gate-mark,
  .far-gate-mark {
    color: CanvasText;
    forced-color-adjust: auto;
  }

  .waystone-card {
    border: 1px solid CanvasText;
    background: Canvas;
    forced-color-adjust: auto;
  }

  .waystone-card::before {
    border-color: CanvasText;
  }

  .waystone-card.waystone-charged::before,
  .waystone-card.waystone-ready::before,
  .waystone-card.is-charged::before,
  .waystone-card.is-ready::before,
  .waystone-card[data-waystone-state="ready"]::before,
  .waystone-card[data-waystone-state="charged"]::before,
  .waystone-card.waystone-escape::before,
  .waystone-card[data-waystone-state="escape"]::before {
    border-color: Highlight;
  }

  .waystone-card.waystone-escape,
  .waystone-card[data-waystone-state="escape"] {
    outline: 3px double Highlight;
    outline-offset: -5px;
    animation: none;
  }

  .waystone-card.waystone-gameover,
  .waystone-card.gameover,
  .waystone-card[data-waystone-state="gameover"],
  .game-frame.gameover .waystone-card,
  .game-frame[data-game-state="gameover"] .waystone-card {
    outline: 3px solid CanvasText;
    outline-offset: -5px;
    animation: none;
  }

  .waystone-card.waystone-gameover::before,
  .waystone-card.gameover::before,
  .waystone-card[data-waystone-state="gameover"]::before,
  .game-frame.gameover .waystone-card::before,
  .game-frame[data-game-state="gameover"] .waystone-card::before {
    border-color: CanvasText;
  }

  .waystone-status {
    color: CanvasText;
  }

  .timer-progress,
  .waystone-progress {
    border: 1px solid CanvasText;
    background: Canvas;
    forced-color-adjust: auto;
  }

  .timer-progress::-webkit-progress-bar,
  .waystone-progress::-webkit-progress-bar {
    background: Canvas;
  }

  .timer-progress::-webkit-progress-value,
  .timer-progress::-moz-progress-bar,
  .waystone-progress::-webkit-progress-value,
  .waystone-progress::-moz-progress-bar {
    background: Highlight;
  }

  .cell.inactive-pocket {
    background: Canvas;
    outline: 1px solid CanvasText;
    outline-offset: -2px;
  }

  .cell.exit-cell {
    color: CanvasText;
    background: Canvas;
    box-shadow: inset 0 0 0 1px CanvasText;
    forced-color-adjust: auto;
  }

  .cell.exit-cell::before {
    color: CanvasText;
  }

  .cell.exit-cell.waystone-charged::before,
  .cell.exit-cell.waystone-ready::before,
  .cell.exit-cell.is-charged::before,
  .cell.exit-cell.is-ready::before,
  .cell.exit-cell[data-waystone-state="ready"]::before,
  .cell.exit-cell[data-waystone-state="charged"]::before,
  .cell.exit-cell.waystone-escape::before,
  .cell.exit-cell[data-waystone-state="escape"]::before {
    color: Highlight;
    outline-color: Highlight;
  }

  .cell.exit-cell.waystone-escape::before,
  .cell.exit-cell[data-waystone-state="escape"]::before {
    outline: 3px double Highlight;
    outline-offset: 2px;
    animation: none;
  }

  .cell.exit-cell.waystone-gameover::before,
  .cell.exit-cell.gameover::before,
  .cell.exit-cell[data-waystone-state="gameover"]::before,
  .game-frame.gameover .cell.exit-cell::before,
  .game-frame[data-game-state="gameover"] .cell.exit-cell::before {
    border-color: CanvasText;
    color: CanvasText;
    outline: 1px solid CanvasText;
    animation: none;
  }

  .exit-mark {
    color: CanvasText;
    forced-color-adjust: auto;
  }

  .waystone-charged-mark,
  .waystone-escape-mark {
    color: Highlight;
    outline-color: Highlight;
  }

  .waystone-gameover-mark {
    color: CanvasText;
  }

  .run-result {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  .run-result strong {
    color: CanvasText;
  }

  .run-result[data-result="pass"] {
    border-left: 6px solid Highlight;
  }

  .run-result[data-result="fail"] {
    border: 3px double CanvasText;
  }

  .gate-overlay .gate-edge,
  .gate-overlay .pocket-cue {
    color: CanvasText;
    filter: none;
    forced-color-adjust: auto;
  }

  .gate-overlay .gate-edge {
    stroke: currentColor;
  }

  .gate-overlay .pocket-cue {
    fill: currentColor;
    stroke: Canvas;
  }

  .gate-overlay .gate-edge.is-today,
  .gate-overlay .gate-edge.is-highlighted,
  .gate-overlay .gate-edge.shift-highlight,
  .gate-overlay .gate-edge.shift-warning,
  .gate-overlay .pocket-cue.is-today,
  .gate-overlay .pocket-cue.is-highlighted,
  .gate-overlay .pocket-cue.shift-highlight,
  .gate-overlay .pocket-cue.shift-warning {
    color: Highlight;
  }

  .week-gates-list button,
  .week-gate-button {
    border-color: ButtonText;
    color: ButtonText;
    background: ButtonFace;
  }

  .touch-controls {
    border-color: ButtonText;
    background: ButtonFace;
  }

  .touch-controls button {
    border-color: ButtonText;
    color: ButtonText;
    background: ButtonFace;
    forced-color-adjust: auto;
  }

  .touch-controls button:hover,
  .touch-controls button:active,
  .touch-controls button:focus-visible {
    outline-color: Highlight;
    color: HighlightText;
    background: Highlight;
    filter: none;
  }

  .week-gate-card.is-today,
  .week-gates-list > li.is-today,
  .week-gate-card.is-highlighted,
  .week-gates-list > li.is-highlighted,
  .week-gate-card.shift-highlight,
  .week-gates-list > li.shift-highlight {
    border: 3px solid Highlight;
    color: Highlight;
    background: Canvas;
    box-shadow: none;
  }
}
