/* Ivory / signal orange: the supplied art direction, drawn as resolution-independent UI. */
html {
  background: #faf8f3;
  color: #171817;
  color-scheme: light;
}
body,
body[data-chapter] {
  --accent: #ff6b0a;
  --sky: #faf8f3;
  background: radial-gradient(ellipse at 45% 30%, #fff 0, #faf8f3 75%);
}
header {
  border-color: #ddd7cd;
}
.brand {
  color: #111;
  font-weight: 650;
}
.brand svg {
  stroke: #ff6b0a;
  filter: none;
}
.brand svg circle {
  fill: #faf8f3;
}
.brand small,
.eyebrow,
.rule,
.muted,
.lesson,
footer,
.legend,
#counter small {
  color: #676861;
}
.eyebrow {
  letter-spacing: 3px;
  font-weight: 500;
}
h1,
.win h2,
dialog h2 {
  font-family: system-ui, sans-serif;
  font-weight: 780;
  letter-spacing: -1.4px;
}
h1 {
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
}
h1::after {
  content: ".";
  color: var(--accent);
}
#counter {
  font: 700 26px system-ui;
  white-space: nowrap;
}
button {
  background: #ffffff70;
  border-color: #bdb8ae;
  border-radius: 15px;
  transition:
    background 0.18s,
    box-shadow 0.18s,
    transform 0.18s;
}
button:hover {
  background: #fff0df;
}
button:active {
  transform: translateY(1px);
  background: #ffe4cb;
}
nav {
  gap: 6px;
}
nav button {
  border-radius: 50%;
}
.journey {
  background: #e9e5de;
  height: 3px;
  border-radius: 8px;
}
.journey span {
  box-shadow: 0 0 12px #ff6b0a55;
  border-radius: 8px;
}
.board-frame {
  border: 0;
  background: none;
  box-shadow: none;
  border-radius: 0;
}
#board .orbit-art {
  pointer-events: none;
  fill: none;
  stroke: #d9cbb8;
  stroke-width: 0.65;
  opacity: 0.55;
}
#board .orbit-inner {
  stroke-dasharray: 1 6;
}
#board .tile .surface,
#board .tile:nth-child(3n) .surface {
  fill: url(#facet);
  stroke: #aba395;
  stroke-width: 1.1;
  filter: drop-shadow(0 1px 1px #67584013);
}
#board .tile:hover .surface {
  fill: #fff2e4;
  stroke: #c9793f;
}
#board .tile.selected .surface,
#board .tile.related .surface {
  fill: #fff1df;
  stroke: #ea8843;
  stroke-width: 1.7;
}
#board .inlay {
  stroke: #fff;
  stroke-width: 1.2;
}
#board .facet-shine {
  stroke: #fff;
  stroke-width: 1.4;
}
#board .digit {
  fill: #1b1a18;
  stroke: none;
  font-weight: 650;
}
#board .rotor {
  fill: #aaa194;
  opacity: 0.65;
}
#board .node .lens {
  fill: url(#beacon);
  stroke: #b1a797;
  stroke-width: 1.2;
  filter: drop-shadow(0 2px 2px #76694b18);
}
#board .node .aura {
  fill: none;
  stroke: #c6bdaf;
  stroke-width: 0.8;
}
#board .node text,
#board .node .goal {
  fill: #191917;
}
#board .node.good .lens {
  fill: #ff720f;
  stroke: #ff8a35;
  filter: drop-shadow(0 0 7px #ff79099c) drop-shadow(0 0 17px #ff8a3440);
}
#board .node.good .aura {
  stroke: #ff720f;
  stroke-width: 1.3;
}
#board .node.good text,
#board .node.good .goal {
  fill: #fff;
}
#board .node.active .aura {
  stroke: #b44900;
  stroke-width: 2;
}
#board .node .ripple {
  fill: none;
  stroke: #ff7a1b;
  stroke-width: 1.5;
  opacity: 0;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
}
#board .node.ignited .ripple {
  animation: signal-ring 0.8s ease-out both;
}
#board .node.ignited .lens {
  animation: ignition 0.55s ease-out;
}
#board .tile.turned .surface {
  animation: turn-light 0.32s ease-out;
}
#board .tile.turned .digit {
  animation: digit-arrive 0.24s ease-out;
}
#board .beam {
  stroke: #de650e;
  animation: flow 1s linear infinite;
}
#board.won {
  filter: none;
}
#board.won .tile .surface {
  fill: #fff0df;
  stroke: #f4a060;
}
#board.celebrate {
  animation: constellation-bloom 1.1s ease-out;
}
.dot {
  background: #ff720f;
  box-shadow: 0 0 9px #ff720f66;
}
.legend {
  border: 1px solid #dfd9cf;
  border-radius: 15px;
  padding: 10px 12px;
  color: #62615d;
}
.card {
  background: #ffffff66;
  border-color: #e0dad0;
  box-shadow: none;
}
#status {
  color: #282823;
}
.motif {
  color: #ea6e15;
}
.motif span {
  color: #a29685;
}
.actions button {
  background: #ffffffb0;
  border-color: #b7b1a7;
  font-weight: 550;
}
.actions button:not(:disabled):hover {
  background: #fff0df;
}
.primary {
  color: #fff;
  background: #20211f;
  box-shadow: 0 7px 18px #25211a16;
}
.primary:hover {
  background: #3c3b36;
}
.win {
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(135deg, #fff5e6, #ffffff);
  border: 1px solid #f3c7a0;
}
.win p {
  color: #6a6258;
}
dialog {
  background: #fcfaf6;
  color: #20211f;
  border-color: #d6cfc3;
  box-shadow: 0 25px 100px #43332130;
}
dialog::backdrop {
  background: #37302355;
  backdrop-filter: blur(8px);
}
.demo path {
  fill: #f5eee3;
  stroke: #aa9d87;
}
.demo text {
  fill: #24231f;
  font-family: system-ui;
}
.level-grid .done {
  background: #fff0df;
  color: #a54500;
  border-color: #e9bd99;
}
.level-grid .current {
  border: 2px solid #ff720f;
}
#update {
  background: #fff7eb;
  border-color: #d1bba6;
  box-shadow: 0 6px 24px #38260c22;
}
.transfer {
  border-color: #ded6c9;
}
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 0;
  border-block: 1px solid #e0d9cd;
  margin: 25px 0;
}
.setting-row p {
  margin-bottom: 0;
}
.setting-row button[aria-pressed="true"] {
  background: #ff720f;
  color: #fff;
  border-color: #ff720f;
}
@keyframes signal-ring {
  from {
    opacity: 0.8;
    transform: scale(0.9);
  }
  to {
    opacity: 0;
    transform: scale(1.9);
  }
}
@keyframes ignition {
  30% {
    filter: drop-shadow(0 0 13px #ff7909) drop-shadow(0 0 24px #ff8a3466);
  }
}
@keyframes turn-light {
  0% {
    fill: #ffd9ac;
    stroke: #ff720f;
  }
  100% {
    fill: #fff1df;
  }
}
@keyframes digit-arrive {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 1;
  }
}
@keyframes flow {
  to {
    stroke-dashoffset: -14;
  }
}
@keyframes constellation-bloom {
  30% {
    filter: drop-shadow(0 0 16px #ff960b55);
  }
}
body[data-effects="off"] *,
body[data-effects="off"] *::after {
  animation: none !important;
}
@media (max-width: 700px) {
  .brand {
    font-size: 18px;
    letter-spacing: 3px;
    gap: 8px;
  }
  .brand small {
    font-size: 5px;
    letter-spacing: 1.8px;
  }
  nav {
    gap: 4px;
  }
  nav button {
    width: 36px;
    padding: 4px;
    min-height: 44px;
    font-size: 18px;
  }
  .brand svg {
    width: 26px;
  }
  h1 {
    font-size: clamp(28px, 7.4vw, 40px);
  }
  .heading {
    gap: 8px;
  }
  #counter {
    font-size: 21px;
    padding: 0;
  }
  .rule {
    font-size: 13px;
  }
  .legend {
    padding: 7px 9px;
  }
  .board-frame {
    padding: 12px 0;
  }
  .card {
    padding: 14px;
  }
  footer {
    border-top: 1px solid #e4dfd5;
    padding-top: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

#home {
  max-width: 520px;
  min-height: 100dvh;
  margin: auto;
  padding: max(20px, env(safe-area-inset-top)) 28px
    max(22px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  text-align: center;
}
.home-identity {
  width: 100%;
}
.home-logo {
  display: block;
  width: min(100%, 300px);
  height: clamp(165px, 29dvh, 250px);
  margin: 0 auto 12px;
}
#home h1 {
  font: 700 clamp(36px, 10vw, 54px) / 1.1 system-ui;
  letter-spacing: 0.2em;
  padding-left: 0.2em;
}
#home h1::after {
  content: none;
}
.home-tagline {
  font-size: 10px;
  letter-spacing: 0.32em;
  color: #686863;
  margin: 13px 0 0;
}
.home-navigation {
  width: 100%;
  display: grid;
  gap: 12px;
}
.home-navigation button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 14px 22px;
  font-size: 19px;
  font-weight: 600;
  border-radius: 18px;
}
.home-navigation button span {
  font-size: 23px;
  font-weight: 400;
}
#home-progress {
  font-size: 12px;
  color: #716e66;
  margin: 0 0 8px;
}
#home-status {
  font-size: 11px;
  line-height: 1.5;
  color: #716e66;
  margin: 7px 0 0;
}
.home-footer {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  font-size: 9px;
  letter-spacing: 2.6px;
  color: #716e66;
  margin: 0;
  white-space: nowrap;
}
.home-footer::before,
.home-footer::after {
  content: "";
  height: 1px;
  background: #ddd7cd;
  flex: 1;
}
@media (min-width: 701px) {
  #home {
    padding-top: 30px;
    padding-bottom: 30px;
    justify-content: center;
    gap: 35px;
  }
  .home-logo {
    height: 240px;
  }
}
@media (max-height: 650px) {
  .home-logo {
    height: 145px;
    margin-bottom: 5px;
  }
  #home {
    gap: 18px;
    padding-top: 12px;
  }
  .home-navigation {
    gap: 8px;
  }
  .home-navigation button {
    min-height: 50px;
  }
  #home h1 {
    font-size: 36px;
  }
}

/* Viewport-fitted cover: only dialogs and the game scroll. */
#home {
  height: 100dvh;
  min-height: 0;
  max-width: 540px;
  padding: max(12px, env(safe-area-inset-top)) 24px
    max(12px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  gap: 12px;
}
.home-heading {
  position: relative;
  text-align: left;
  padding-top: 22px;
}
.home-heading h2 {
  font-size: clamp(22px, 6vw, 32px);
  line-height: 1.1;
  letter-spacing: -1px;
  margin: 0 0 5px;
  font-weight: 800;
}
.home-heading h2 span {
  color: #ff6b0a;
}
.home-heading p {
  font-size: 11px;
  color: #606772;
  line-height: 1.4;
  margin: 0;
  max-width: 90%;
}
#home-gear {
  position: absolute;
  right: 0;
  top: -4px;
  width: 40px;
  min-height: 40px;
  padding: 4px;
  border-radius: 50%;
  font-size: 22px;
}
.home-identity {
  min-height: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
.home-logo {
  flex: 1;
  min-height: 0;
  height: auto;
  max-height: 240px;
  width: min(100%, 290px);
  margin: 0 0 4px;
}
#home h1 {
  font-size: clamp(26px, 8vw, 42px);
  flex-shrink: 0;
}
.home-tagline {
  font-size: 8px;
  letter-spacing: 3px;
  margin: 7px 0 0;
  flex-shrink: 0;
}
.home-summary {
  width: 100%;
}
#home-progress {
  font-size: 24px;
  line-height: 1;
  margin: 0;
  color: #424a55;
}
#home-count {
  font-size: clamp(38px, 7dvh, 60px);
  font-weight: 800;
  color: #171817;
}
.home-summary > p:last-of-type {
  font-size: 8px;
  letter-spacing: 2.5px;
  margin: 8px 0 11px;
  color: #505864;
}
.home-meter {
  height: 6px;
  background: #eeeae4;
  border-radius: 9px;
  overflow: hidden;
}
#home-meter-fill {
  display: block;
  height: 100%;
  background: #ff720f;
  border-radius: 9px;
}
.home-navigation {
  gap: 6px;
}
.home-navigation button {
  min-height: 44px;
  height: clamp(44px, 5.7dvh, 58px);
  padding: 7px 18px;
  font-size: 16px;
  border-radius: 12px;
  justify-content: flex-start;
  gap: 18px;
}
.home-navigation button span:last-child {
  margin-left: auto;
}
#home-help {
  border-color: transparent;
  background: none;
  font-weight: 400;
}
#home-status:empty {
  display: none;
}
.home-footer {
  font-size: 8px;
  letter-spacing: 2px;
  gap: 12px;
}
@media (max-height: 650px) {
  #home {
    gap: 7px;
    padding-block: 10px;
  }
  .home-heading {
    padding-top: 12px;
  }
  .home-heading h2 {
    font-size: 22px;
    padding-right: 30px;
  }
  .home-heading p {
    font-size: 10px;
  }
  #home-count {
    font-size: 36px;
  }
  .home-summary > p:last-of-type {
    margin: 5px 0 7px;
  }
  .home-tagline {
    margin-top: 3px;
  }
}
@media (orientation: landscape) and (max-height: 550px) {
  #home {
    max-width: 900px;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
    column-gap: 30px;
  }
  .home-heading {
    grid-column: 1;
    grid-row: 1;
  }
  .home-identity {
    grid-column: 1;
    grid-row: 2;
  }
  .home-summary {
    grid-column: 2;
    grid-row: 1;
  }
  .home-navigation {
    grid-column: 2;
    grid-row: 2 / 4;
  }
  .home-footer {
    grid-column: 1;
    grid-row: 3;
  }
}
