:root {
  color-scheme: light;
  --ink: #132a33;
  --ink-soft: #496068;
  --paper: #f4f1ea;
  --paper-deep: #eae6dc;
  --card: #fffdf8;
  --white: #ffffff;
  --lime: #c9ff63;
  --lime-dark: #9dcd3f;
  --coral: #ff775f;
  --blue: #82b5ff;
  --gold: #f3c755;
  --line: rgba(19, 42, 51, 0.11);
  --shadow: 0 24px 70px rgba(35, 50, 48, 0.12);
  --font: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-family: var(--font);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  background: #dcd9d2;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at 18% 5%, rgba(255, 255, 255, 0.84), transparent 26rem),
    #dcd9d2;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

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

.skip-link {
  position: fixed;
  z-index: 1000;
  inset-block-start: 0.75rem;
  inset-inline-start: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  transform: translateY(-150%);
  transition: transform 180ms ease;
}

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

.app-shell {
  position: relative;
  width: min(100%, 32rem);
  min-height: 100dvh;
  margin-inline: auto;
  overflow: visible;
  background: var(--paper);
  box-shadow: 0 0 80px rgba(20, 35, 40, 0.13);
}

.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.8rem;
  padding: max(0.85rem, env(safe-area-inset-top)) 1.25rem 0.7rem;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 0.87rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  cursor: pointer;
}

.brand-mark,
.modal-brand-mark {
  display: grid;
  width: 2.35rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 0.78rem;
  background: var(--ink);
  color: var(--lime);
  box-shadow: 0 8px 20px rgba(19, 42, 51, 0.15);
}

.brand-mark svg,
.modal-brand-mark svg {
  width: 1.65rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.streak-chip {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  height: 2.45rem;
  padding-inline: 0.78rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.streak-chip svg {
  width: 1.1rem;
  fill: var(--coral);
}

.avatar-button {
  position: relative;
  display: grid;
  width: 2.55rem;
  aspect-ratio: 1;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--blue);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.avatar-dot {
  position: absolute;
  inset: auto 0 0 auto;
  width: 0.7rem;
  aspect-ratio: 1;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--lime-dark);
}

main {
  min-height: calc(100dvh - 10rem);
}

.view {
  padding: 0.45rem 1.25rem 7.5rem;
  animation: view-in 260ms ease both;
}

.view[hidden] {
  display: none;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(0.3rem); }
  to { opacity: 1; transform: translateY(0); }
}

.game-heading,
.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-block: 1rem 1.15rem;
}

.eyebrow {
  margin: 0 0 0.38rem;
  color: #566966;
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  line-height: 1.4;
}

h1,
h2,
p {
  margin-block-start: 0;
}

h1 {
  margin-block-end: 0;
  font-size: clamp(1.75rem, 7vw, 2.25rem);
  letter-spacing: -0.05em;
  line-height: 1;
}

h2 {
  letter-spacing: -0.035em;
}

.score-block {
  display: flex;
  flex-direction: column;
  align-items: end;
}

.score-block span,
.journey-summary span,
.result-stats span {
  color: #596b68;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.13em;
}

.score-block strong {
  font-family: var(--mono);
  font-size: 1.1rem;
  letter-spacing: 0.03em;
}

.game-card {
  position: relative;
  padding: 1rem 1rem 1.1rem;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 2rem;
  background: var(--card);
  box-shadow: var(--shadow);
}

.game-card::before {
  position: absolute;
  width: 9rem;
  aspect-ratio: 1;
  inset: -5rem -4rem auto auto;
  border-radius: 50%;
  background: rgba(201, 255, 99, 0.18);
  content: "";
}

.game-card-topline {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2rem;
  padding-inline: 0.2rem;
}

.heart-row {
  display: flex;
  gap: 0.24rem;
}

.heart-pressure {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.heart-countdown {
  display: inline-grid;
  min-width: 2.45rem;
  min-height: 1.55rem;
  place-items: center;
  padding-inline: 0.42rem;
  border: 1px solid color-mix(in oklab, var(--coral) 45%, transparent);
  border-radius: 99px;
  background: color-mix(in oklab, var(--coral) 16%, transparent);
  color: #9f3828;
  font-family: var(--mono);
  font-size: 0.55rem;
  letter-spacing: 0.03em;
}

.heart-countdown.is-paused {
  border-color: var(--line);
  background: var(--paper-deep);
  color: var(--ink-soft);
}

.heart-countdown.is-hit {
  animation: heart-timer-hit 520ms ease both;
}

.heart {
  width: 1.1rem;
  color: var(--coral);
  fill: currentColor;
  transition: transform 220ms ease, opacity 220ms ease;
}

.heart.is-lost {
  opacity: 0.18;
  transform: scale(0.72);
}

@keyframes heart-timer-hit {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.16); background: var(--coral); color: var(--ink); }
}

.level-progress {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.progress-track {
  appearance: none;
  width: 3.2rem;
  height: 0.3rem;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 99px;
  background: var(--paper-deep);
}

.progress-track::-webkit-progress-bar {
  border-radius: inherit;
  background: var(--paper-deep);
}

.progress-track::-webkit-progress-value {
  border-radius: inherit;
  background: var(--ink);
  transition: width 300ms ease;
}

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

.board-wrap {
  position: relative;
  contain: layout style paint;
  width: 100%;
  aspect-ratio: 0.93;
  margin-block: 0.75rem 0.55rem;
  overflow: hidden;
  border-radius: 1.35rem;
  background:
    radial-gradient(circle, rgba(19, 42, 51, 0.13) 1.1px, transparent 1.2px) 0 0 / var(--dot-size, 14.285%) var(--dot-size-y, 12.5%),
    radial-gradient(circle at 50% -20%, rgba(255, 255, 255, 0.9), transparent 58%),
    linear-gradient(145deg, #f7f5ef, #e9e6dd);
  box-shadow:
    inset 0 0 0 1px rgba(19, 42, 51, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1.2rem 2.8rem rgba(19, 42, 51, 0.035);
}

.board {
  --arrow-hue: 195;

  position: absolute;
  inset: 5%;
}

.board[data-arrow-palette="1"] { --arrow-hue: 216; }
.board[data-arrow-palette="2"] { --arrow-hue: 252; }
.board[data-arrow-palette="3"] { --arrow-hue: 18; }
.board[data-arrow-palette="4"] { --arrow-hue: 176; }
.board[data-arrow-palette="5"] { --arrow-hue: 226; }
.board[data-arrow-palette="6"] { --arrow-hue: 150; }
.board[data-arrow-palette="7"] { --arrow-hue: 278; }
.board[data-arrow-palette="8"] { --arrow-hue: 322; }
.board[data-arrow-palette="9"] { --arrow-hue: 204; }
.board[data-arrow-palette="10"] { --arrow-hue: 348; }
.board[data-arrow-palette="11"] { --arrow-hue: 82; }
.board[data-arrow-palette="12"] { --arrow-hue: 42; }
.board[data-arrow-palette="13"] { --arrow-hue: 164; }
.board[data-arrow-palette="14"] { --arrow-hue: 232; }
.board[data-arrow-palette="15"] { --arrow-hue: 290; }
.board[data-arrow-palette="16"] { --arrow-hue: 6; }
.board[data-arrow-palette="17"] { --arrow-hue: 188; }
.board[data-arrow-palette="18"] { --arrow-hue: 264; }
.board[data-arrow-palette="19"] { --arrow-hue: 132; }
.board[data-arrow-palette="20"] { --arrow-hue: 304; }
.board[data-arrow-palette="21"] { --arrow-hue: 30; }
.board[data-arrow-palette="22"] { --arrow-hue: 212; }
.board[data-arrow-palette="23"] { --arrow-hue: 336; }
.board[data-arrow-palette="24"] { --arrow-hue: 104; }
.board[data-arrow-palette="25"] { --arrow-hue: 58; }

.arrow-piece {
  --arrow-hue-shift: 0;
  --arrow-piece-hue: calc(var(--arrow-hue) + var(--arrow-hue-shift));

  position: absolute;
  display: grid;
  width: calc(100% / var(--grid-cols));
  height: calc(100% / var(--grid-rows));
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
  touch-action: manipulation;
}

.arrow-piece:nth-child(3n + 2) { --arrow-hue-shift: 9; }
.arrow-piece:nth-child(3n) { --arrow-hue-shift: -7; }

.arrow-piece::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(2.8rem, 78%);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.65);
  transition: opacity 160ms ease, transform 160ms ease;
  content: "";
}

.arrow-piece:hover::before,
.arrow-piece:focus-visible::before,
.arrow-piece.is-hint::before {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.arrow-piece.is-hint::before {
  background: var(--lime);
  animation: hint-pulse 1s ease infinite;
}

.arrow-shape {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 0.11rem 0.13rem rgba(10, 29, 36, 0.2));
  pointer-events: none;
  transition: filter 180ms ease;
}

.arrow-hit-path,
.arrow-shadow,
.arrow-tail,
.arrow-highlight,
.arrow-head-shadow,
.arrow-head,
.arrow-head-highlight {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.arrow-color-light { stop-color: hsl(var(--arrow-piece-hue) 34% 56%); }
.arrow-color-mid { stop-color: hsl(var(--arrow-piece-hue) 48% 31%); }
.arrow-color-dark { stop-color: hsl(var(--arrow-piece-hue) 58% 17%); }
.arrow-glint-light { stop-color: hsl(var(--arrow-piece-hue) 42% 94%); }
.arrow-glint-mid { stop-color: hsl(var(--arrow-piece-hue) 34% 78%); }
.arrow-glint-white { stop-color: white; }

.arrow-hit-path {
  stroke: transparent;
  stroke-width: 1rem;
  pointer-events: stroke;
}

.arrow-shadow,
.arrow-head-shadow {
  stroke: rgba(7, 26, 33, 0.22);
}

.arrow-shadow {
  stroke-width: 0.5rem;
}

.arrow-head-shadow {
  stroke-width: 0.54rem;
}

.arrow-tail {
  stroke-width: 0.34rem;
}

.arrow-head {
  stroke-width: 0.37rem;
}

.arrow-highlight,
.arrow-head-highlight {
  opacity: 0.78;
}

.arrow-highlight {
  stroke-width: 0.075rem;
}

.arrow-head-highlight {
  stroke-width: 0.08rem;
}

.arrow-piece:is(:hover, :focus-visible) .arrow-shape,
.arrow-piece.is-hint .arrow-shape {
  filter:
    drop-shadow(0 0.13rem 0.16rem rgba(10, 29, 36, 0.24))
    drop-shadow(0 0 0.2rem rgba(130, 181, 255, 0.22));
}

.arrow-piece.is-blocked {
  animation: blocked-shake 380ms ease;
}

.arrow-piece.is-blocked :is(.arrow-tail, .arrow-head) {
  stroke: var(--coral);
}

.arrow-piece.is-blocked :is(.arrow-highlight, .arrow-head-highlight) {
  stroke: rgba(255, 255, 255, 0.4);
}

.arrow-piece.is-queued {
  pointer-events: none;
}

.arrow-piece.is-queued .arrow-hit-path,
.arrow-piece.is-exiting .arrow-hit-path {
  pointer-events: none;
}

.arrow-piece.is-queued :is(.arrow-tail, .arrow-head) {
  stroke: #6485a8;
}

.arrow-piece.is-queued :is(.arrow-highlight, .arrow-head-highlight) {
  stroke: #dcecff;
}

.arrow-piece.is-queued::before {
  background: rgba(130, 181, 255, 0.35);
  opacity: 1;
  transform: translate(-50%, -50%) scale(0.82);
}

.arrow-piece.is-exiting {
  pointer-events: none;
}

@keyframes hint-pulse {
  50% { box-shadow: 0 0 0 0.55rem rgba(201, 255, 99, 0); transform: scale(1.1); }
}

@keyframes blocked-shake {
  20% { transform: translate(calc(-50% - 0.35rem), -50%); }
  40% { transform: translate(calc(-50% + 0.35rem), -50%); }
  60% { transform: translate(calc(-50% - 0.2rem), -50%); }
  80% { transform: translate(calc(-50% + 0.2rem), -50%); }
}

.board-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
  pointer-events: none;
  opacity: 0;
}

.board-message.is-visible {
  animation: message-pop 800ms ease both;
}

@keyframes message-pop {
  0%, 100% { opacity: 0; transform: scale(0.9); }
  18%, 70% { opacity: 1; transform: scale(1); }
}

.game-tip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.65rem;
  padding: 0.65rem 0.8rem;
  border-radius: 1rem;
  background: #f2f0e9;
  color: var(--ink-soft);
  font-size: 0.72rem;
  line-height: 1.35;
}

.tip-icon {
  display: grid;
  width: 1.6rem;
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.55rem;
  background: var(--lime);
  color: var(--ink);
}

.game-controls {
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  gap: 0.7rem;
  margin-block-start: 1rem;
}

.control-button {
  display: flex;
  min-height: 3.3rem;
  align-items: center;
  justify-content: center;
  gap: 0.38rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.45);
  font-size: 0.72rem;
  font-weight: 750;
  cursor: pointer;
}

.control-button svg {
  width: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.control-primary {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.control-button kbd {
  display: none;
  padding: 0.1rem 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 0.25rem;
  font-family: var(--mono);
  font-size: 0.56rem;
}

.bottom-nav {
  position: fixed;
  z-index: 30;
  inset: auto 0 0;
  display: grid;
  width: min(100%, 32rem);
  grid-template-columns: repeat(4, 1fr);
  margin-inline: auto;
  padding: 0.55rem 0.65rem max(0.7rem, env(safe-area-inset-bottom));
  border-block-start: 1px solid var(--line);
  background: color-mix(in srgb, #fbf9f4 92%, transparent);
  backdrop-filter: blur(22px);
}

.nav-item {
  position: relative;
  display: flex;
  min-height: 3.25rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  border: 0;
  border-radius: 1rem;
  background: transparent;
  color: #596b68;
  font-size: 0.61rem;
  font-weight: 700;
  cursor: pointer;
}

.nav-item svg {
  width: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.nav-item.is-active {
  color: var(--ink);
}

.nav-item.is-active::before {
  position: absolute;
  inset: -0.56rem 27% auto;
  height: 0.18rem;
  border-radius: 99px;
  background: var(--ink);
  content: "";
}

.section-heading {
  align-items: center;
  margin-block-end: 1.5rem;
}

.completion-ring {
  --percent: 0deg;
  position: relative;
  display: grid;
  width: 3.8rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background:
    conic-gradient(var(--lime-dark) var(--percent), var(--paper-deep) 0);
  box-shadow: inset 0 0 0 1px rgba(19, 42, 51, 0.04), 0 10px 24px rgba(19, 42, 51, 0.08);
  font-family: var(--mono);
  font-size: 0.65rem;
}

.completion-ring::before {
  position: absolute;
  width: 2.85rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--paper);
  content: "";
}

.completion-ring strong {
  position: relative;
}

.journey-hero {
  --chapter-hue: 195;
  position: relative;
  display: grid;
  width: 100%;
  min-height: 10.2rem;
  grid-template-columns: minmax(0, 1fr) 5.4rem;
  align-items: center;
  gap: 0.8rem;
  margin-block-end: 0.8rem;
  padding: 1.25rem 1.2rem 3.25rem;
  overflow: hidden;
  border: 0;
  border-radius: 1.6rem;
  background:
    radial-gradient(circle at 82% 18%, hsl(var(--chapter-hue) 82% 67% / 0.35), transparent 9rem),
    linear-gradient(135deg, #10272f, #1e4149);
  color: white;
  box-shadow: 0 20px 45px rgba(19, 42, 51, 0.2);
  text-align: start;
  cursor: pointer;
  transition: box-shadow 180ms ease, transform 180ms ease;
}

.journey-hero::before,
.journey-hero::after {
  position: absolute;
  aspect-ratio: 1;
  border: 1px solid hsl(var(--chapter-hue) 80% 80% / 0.18);
  border-radius: 50%;
  content: "";
}

.journey-hero::before {
  width: 12rem;
  inset: -6rem -3rem auto auto;
}

.journey-hero::after {
  width: 7rem;
  inset: auto 1rem -5rem auto;
}

.journey-hero:hover {
  box-shadow: 0 24px 52px rgba(19, 42, 51, 0.26);
  transform: translateY(-0.12rem);
}

.journey-hero-copy,
.journey-hero-orbit,
.journey-hero-action {
  position: relative;
  z-index: 1;
}

.journey-hero-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.journey-hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-block-end: 0.65rem;
  color: hsl(var(--chapter-hue) 90% 80%);
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.12em;
}

.journey-hero-eyebrow > span {
  width: 0.45rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 0.28rem rgba(201, 255, 99, 0.12);
}

.journey-hero-copy > strong {
  font-size: clamp(1.45rem, 7vw, 2rem);
  letter-spacing: -0.045em;
}

.journey-hero-copy > small {
  max-width: 15rem;
  margin-block-start: 0.3rem;
  overflow: hidden;
  color: #b8cacb;
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.journey-hero-orbit {
  display: grid;
  width: 5.25rem;
  aspect-ratio: 1;
  place-items: center;
}

.journey-hero-orbit > span {
  display: grid;
  width: 3.2rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: hsl(var(--chapter-hue) 78% 72%);
  color: var(--ink);
  box-shadow: 0 0 0 0.45rem hsl(var(--chapter-hue) 60% 80% / 0.12);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 800;
}

.journey-hero-orbit svg {
  position: absolute;
  inset: 0;
  width: 100%;
  fill: none;
  stroke: hsl(var(--chapter-hue) 80% 82% / 0.52);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.journey-hero-action {
  position: absolute;
  inset: auto auto 1.05rem 1.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--lime);
  font-size: 0.68rem;
  font-weight: 800;
}

.journey-hero-action > span {
  font-size: 1rem;
  transition: transform 180ms ease;
}

.journey-hero:hover .journey-hero-action > span {
  transform: translateX(0.2rem);
}

.journey-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin-block-end: 1.35rem;
}

.journey-summary > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.8rem 0.25rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: 0 8px 18px rgba(19, 42, 51, 0.04);
}

.journey-summary > div + div {
  border-inline-start: 1px solid var(--line);
}

.journey-summary strong {
  font-family: var(--mono);
  font-size: 0.78rem;
}

.chapter-block {
  --chapter-hue: 195;
  position: relative;
  margin-block-end: 1rem;
  padding: 1rem;
  overflow: hidden;
  border: 1px solid hsl(var(--chapter-hue) 28% 50% / 0.18);
  border-radius: 1.45rem;
  background:
    radial-gradient(circle at 100% 0%, hsl(var(--chapter-hue) 75% 72% / 0.16), transparent 8rem),
    rgba(255, 255, 255, 0.58);
  box-shadow: 0 12px 28px rgba(19, 42, 51, 0.055);
}

.chapter-block::before {
  position: absolute;
  width: 0.24rem;
  inset: 1rem auto 1rem 0;
  border-radius: 0 99px 99px 0;
  background: hsl(var(--chapter-hue) 62% 54%);
  content: "";
}

.chapter-block.is-active {
  border-color: hsl(var(--chapter-hue) 56% 42% / 0.48);
  box-shadow: 0 16px 34px hsl(var(--chapter-hue) 35% 30% / 0.13);
}

.chapter-block.is-complete::before {
  background: var(--lime-dark);
}

.chapter-block:nth-child(n + 4) {
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 15rem;
}

.chapter-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  margin-block-end: 0.7rem;
}

.chapter-number {
  display: flex;
  width: 3rem;
  aspect-ratio: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid hsl(var(--chapter-hue) 50% 42% / 0.22);
  border-radius: 0.95rem;
  background: hsl(var(--chapter-hue) 70% 88% / 0.58);
}

.chapter-number span,
.chapter-title p,
.chapter-stars span {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.48rem;
  letter-spacing: 0.06em;
}

.chapter-number strong {
  margin-block-start: 0.1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.chapter-title {
  min-width: 0;
}

.chapter-title p {
  margin-block-end: 0.18rem;
  overflow: hidden;
  color: hsl(var(--chapter-hue) 44% 35%);
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.chapter-title h2 {
  margin: 0;
  overflow: hidden;
  font-size: 0.9rem;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-stars {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.chapter-stars strong {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.chapter-progress {
  display: block;
  width: 100%;
  height: 0.35rem;
  margin-block-end: 0.85rem;
  overflow: hidden;
  border: 0;
  border-radius: 99px;
  background: hsl(var(--chapter-hue) 18% 50% / 0.12);
  accent-color: hsl(var(--chapter-hue) 60% 48%);
}

.chapter-progress::-webkit-progress-bar {
  border-radius: 99px;
  background: hsl(var(--chapter-hue) 18% 50% / 0.12);
}

.chapter-progress::-webkit-progress-value {
  border-radius: 99px;
  background: hsl(var(--chapter-hue) 60% 48%);
}

.chapter-progress::-moz-progress-bar {
  border-radius: 99px;
  background: hsl(var(--chapter-hue) 60% 48%);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
}

.level-button {
  position: relative;
  display: flex;
  aspect-ratio: 0.92;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding-block-start: 0.55rem;
  border: 1px solid hsl(var(--chapter-hue) 25% 45% / 0.17);
  border-radius: 1.05rem;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 7px 15px rgba(19, 42, 51, 0.045);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.level-button:hover:not(:disabled) {
  border-color: hsl(var(--chapter-hue) 48% 42% / 0.5);
  box-shadow: 0 10px 20px hsl(var(--chapter-hue) 30% 35% / 0.12);
  transform: translateY(-0.1rem);
}

.level-button strong {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.level-stars {
  min-height: 0.75rem;
  color: var(--gold);
  font-size: 0.6rem;
  letter-spacing: 0.04em;
}

.level-badge {
  position: absolute;
  inset: 0.42rem auto auto 50%;
  min-height: 0;
  padding: 0.12rem 0.3rem;
  border-radius: 99px;
  background: hsl(var(--chapter-hue) 45% 90%);
  color: hsl(var(--chapter-hue) 45% 28%);
  font-family: var(--mono);
  font-size: 0.4rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  transform: translateX(-50%);
}

.level-button.is-complete {
  background: hsl(var(--chapter-hue) 60% 94% / 0.88);
}

.level-button.is-current {
  border-color: hsl(var(--chapter-hue) 55% 38%);
  background:
    radial-gradient(circle at 80% 20%, white, transparent 3.5rem),
    hsl(var(--chapter-hue) 74% 75%);
  color: var(--ink);
  box-shadow: 0 12px 24px hsl(var(--chapter-hue) 40% 30% / 0.2);
}

.level-button.is-current .level-badge {
  background: var(--ink);
  color: var(--lime);
}

.level-button.is-locked {
  border-style: dashed;
  background: hsl(var(--chapter-hue) 10% 94% / 0.58);
  color: #8c9693;
  cursor: not-allowed;
}

.level-button:disabled {
  opacity: 1;
}

.achievement-count {
  display: flex;
  align-items: baseline;
  color: var(--ink-soft);
}

.achievement-count strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 1.6rem;
}

.achievement-count span {
  font-family: var(--mono);
  font-size: 0.72rem;
}

.featured-achievement {
  position: relative;
  display: flex;
  min-height: 8rem;
  align-items: center;
  gap: 1rem;
  margin-block-end: 1rem;
  padding: 1.2rem;
  overflow: hidden;
  border-radius: 1.5rem;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
}

.featured-achievement::after {
  position: absolute;
  width: 8rem;
  aspect-ratio: 1;
  inset: -3rem -2rem auto auto;
  border: 1px solid rgba(201, 255, 99, 0.25);
  border-radius: 50%;
  content: "";
}

.featured-orbit {
  display: grid;
  width: 4.2rem;
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(201, 255, 99, 0.4);
  border-radius: 50%;
}

.featured-orbit span {
  display: grid;
  width: 2.8rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: var(--lime);
  color: var(--ink);
  font-size: 1.3rem;
}

.featured-achievement p {
  margin-block-end: 0.3rem;
  color: var(--lime);
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
}

.featured-achievement h2 {
  margin-block-end: 0.25rem;
  font-size: 1.1rem;
}

.featured-achievement > div:last-child > span {
  color: #b8c1bf;
  font-size: 0.68rem;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.achievement-card {
  min-height: 10.2rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: rgba(255, 255, 255, 0.55);
}

.achievement-card:nth-child(n + 7) {
  content-visibility: auto;
  contain-intrinsic-size: auto 10.2rem;
}

.achievement-card.is-locked {
  filter: grayscale(1);
  opacity: 0.55;
}

.achievement-badge {
  display: grid;
  width: 2.8rem;
  aspect-ratio: 1;
  margin-block-end: 1rem;
  place-items: center;
  border-radius: 0.9rem;
  background: var(--badge, var(--lime));
  font-size: 1.05rem;
}

.achievement-card h2 {
  margin-block-end: 0.35rem;
  font-size: 0.82rem;
}

.achievement-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.65rem;
  line-height: 1.45;
}

.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-block: 1.2rem 1.35rem;
  text-align: center;
}

.profile-avatar {
  display: grid;
  width: 4.8rem;
  aspect-ratio: 1;
  margin-block-end: 0.9rem;
  place-items: center;
  border: 0.45rem solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 14px 34px rgba(51, 86, 112, 0.17);
  font-size: 1.4rem;
  font-weight: 800;
  cursor: pointer;
}

.profile-hero h1 {
  margin-block-end: 0.55rem;
}

.profile-hero > p:not(.eyebrow) {
  max-width: 19rem;
  margin-block-end: 1.1rem;
  color: var(--ink-soft);
  font-size: 0.75rem;
  line-height: 1.55;
}

.button {
  display: inline-flex;
  min-height: 3rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 1.1rem;
  border: 0;
  border-radius: 0.95rem;
  font-size: 0.76rem;
  font-weight: 800;
  cursor: pointer;
}

.button-dark {
  background: var(--ink);
  color: white;
}

.button-lime {
  background: var(--lime);
  color: var(--ink);
}

.button-soft {
  background: var(--paper-deep);
  color: var(--ink);
}

.button-danger {
  background: var(--coral);
  color: #341711;
}

.button-full {
  width: 100%;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.stat-grid article {
  min-height: 8.2rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  background: rgba(255, 255, 255, 0.56);
}

.stat-grid strong {
  display: block;
  margin-block-start: 0.75rem;
  font-family: var(--mono);
  font-size: 1.25rem;
}

.stat-grid p {
  margin: 0.18rem 0 0;
  color: var(--ink-soft);
  font-size: 0.66rem;
}

.stat-icon {
  display: grid;
  width: 2rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 0.65rem;
  font-size: 0.8rem;
}

.stat-icon-coral { background: rgba(255, 119, 95, 0.25); }
.stat-icon-lime { background: rgba(201, 255, 99, 0.55); }
.stat-icon-blue { background: rgba(130, 181, 255, 0.38); }
.stat-icon-gold { background: rgba(243, 199, 85, 0.32); }

.settings-card {
  margin-block-start: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1.45rem;
  background: rgba(255, 255, 255, 0.56);
}

.settings-card h2 {
  margin: 0.25rem 0 0.65rem;
  font-size: 0.8rem;
}

.setting-row {
  display: grid;
  width: 100%;
  min-height: 4rem;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0;
  border: 0;
  background: transparent;
  text-align: start;
  cursor: pointer;
}

.setting-row[hidden],
.form-field[hidden] {
  display: none;
}

.setting-row + .setting-row {
  border-block-start: 1px solid var(--line);
}

.setting-icon {
  display: grid;
  width: 2.3rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 0.8rem;
  background: var(--paper-deep);
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row strong {
  font-size: 0.72rem;
}

.setting-row small {
  margin-block-start: 0.18rem;
  color: var(--ink-soft);
  font-size: 0.59rem;
}

.switch {
  width: 2.7rem;
  height: 1.55rem;
  padding: 0.18rem;
  border-radius: 99px;
  background: var(--ink);
  transition: background 180ms ease;
}

.switch span {
  display: block;
  width: 1.18rem;
  aspect-ratio: 1;
  margin-inline-start: auto;
  border-radius: 50%;
  background: var(--lime);
  transition: transform 180ms ease;
}

.setting-row[aria-pressed="false"] .switch {
  background: #c9c9c3;
}

.setting-row[aria-pressed="false"] .switch span {
  margin-inline-start: 0;
  background: white;
}

.chevron {
  color: var(--ink-soft);
  font-size: 1.4rem;
}

.modal {
  width: min(calc(100% - 1.25rem), 30rem);
  max-height: calc(100dvh - 1.25rem);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 1.7rem;
  background: transparent;
  color: var(--ink);
}

.modal::backdrop {
  background: rgba(12, 25, 29, 0.58);
  backdrop-filter: blur(7px);
}

.modal[open] {
  animation: modal-in 230ms ease both;
}

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

.modal-card {
  position: relative;
  max-height: calc(100dvh - 1.25rem);
  padding: 1.35rem;
  overflow-y: auto;
  border-radius: 1.7rem;
  background: var(--card);
  box-shadow: 0 35px 90px rgba(0, 0, 0, 0.3);
}

.modal-close {
  position: absolute;
  inset: 0.9rem 0.9rem auto auto;
  display: grid;
  width: 2.65rem;
  aspect-ratio: 1;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--paper-deep);
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-brand-mark {
  width: 3.1rem;
  margin-block-end: 1.15rem;
  border-radius: 1rem;
}

.modal-card h2 {
  margin-block-end: 0.55rem;
  font-size: 1.75rem;
  line-height: 1.05;
}

.modal-copy {
  margin-block-end: 1rem;
  color: var(--ink-soft);
  font-size: 0.74rem;
  line-height: 1.55;
}

.account-benefits {
  margin-block-end: 1rem;
  padding: 0;
}

.account-benefits li {
  display: inline-block;
  margin: 0 0.25rem 0.35rem 0;
  padding: 0.38rem 0.55rem;
  border-radius: 99px;
  background: rgba(201, 255, 99, 0.34);
  font-size: 0.57rem;
  font-weight: 700;
}

.form-field {
  margin-block-end: 0.8rem;
}

.form-field label {
  display: block;
  margin-block-end: 0.35rem;
  font-size: 0.68rem;
  font-weight: 750;
}

.form-field input {
  width: 100%;
  min-height: 3.2rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(19, 42, 51, 0.19);
  border-radius: 0.85rem;
  background: #f6f3ec;
  color: var(--ink);
  font-size: 1rem;
}

.form-field input::placeholder {
  color: #929b98;
  font-size: 0.72rem;
}

.form-field input:user-invalid {
  border-color: var(--coral);
}

.form-field small {
  display: block;
  margin-block-start: 0.28rem;
  color: var(--ink-soft);
  font-size: 0.58rem;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-inline-end: 4rem;
}

.password-wrap button {
  position: absolute;
  inset: 0 0.45rem 0 auto;
  min-width: 3.3rem;
  border: 0;
  background: transparent;
  font-size: 0.62rem;
  font-weight: 800;
  cursor: pointer;
}

.form-error {
  min-height: 1rem;
  margin-block-end: 0.35rem;
  color: #a73726;
  font-size: 0.64rem;
}

.privacy-note {
  margin: 0.75rem 0 0;
  color: #7b8986;
  font-size: 0.55rem;
  line-height: 1.45;
  text-align: center;
}

.account-mode-toggle {
  display: block;
  margin-inline: auto;
}

.result-card,
.confirm-card {
  text-align: center;
}

.celebration-mark,
.confirm-icon {
  display: grid;
  width: 4.6rem;
  aspect-ratio: 1;
  margin: 0.3rem auto 1.1rem;
  place-items: center;
  border: 1px solid rgba(19, 42, 51, 0.08);
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 0.65rem rgba(201, 255, 99, 0.22);
  font-size: 1.6rem;
}

.result-stars {
  margin-block: 1rem;
  color: var(--gold);
  font-size: 1.7rem;
  letter-spacing: 0.15em;
}

.result-stars .star-off {
  color: #dedbd3;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-block: 1rem 1.2rem;
  border-block: 1px solid var(--line);
}

.result-stats div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 0.3rem;
}

.result-stats div + div {
  border-inline-start: 1px solid var(--line);
}

.result-stats strong {
  font-family: var(--mono);
  font-size: 0.8rem;
}

.result-countdown {
  min-width: 2.5rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  opacity: 0.68;
  text-align: end;
}

.text-button {
  min-height: 2.6rem;
  margin-block-start: 0.45rem;
  padding-inline: 1rem;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
}

.confirm-card p {
  max-width: 21rem;
  margin: 0 auto 1.2rem;
  color: var(--ink-soft);
  font-size: 0.74rem;
  line-height: 1.55;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.achievement-splash {
  --award-color: var(--lime);

  width: 100dvw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 1.5rem;
  overflow: hidden;
  border: 0;
  background:
    radial-gradient(circle at 50% 46%, color-mix(in oklab, var(--award-color) 22%, transparent), transparent 38%),
    rgba(10, 28, 34, 0.72);
  color: white;
}

.achievement-splash[open] {
  display: grid;
  place-items: center;
  animation: achievement-splash-screen 2400ms ease both;
}

.achievement-splash::backdrop {
  background: rgba(10, 28, 34, 0.5);
  backdrop-filter: blur(6px);
  animation: achievement-splash-screen 2400ms ease both;
}

.achievement-splash-card {
  position: relative;
  z-index: 2;
  width: min(100%, 24rem);
  padding: 2rem 1.5rem 1.55rem;
  border: 1px solid color-mix(in oklab, var(--award-color) 38%, transparent);
  border-radius: 2rem;
  background: var(--ink);
  background: linear-gradient(145deg, color-mix(in oklab, var(--award-color) 18%, var(--ink)), var(--ink) 48%);
  box-shadow:
    0 2rem 6rem rgba(0, 0, 0, 0.42),
    0 0 0 0.55rem color-mix(in oklab, var(--award-color) 13%, transparent);
  text-align: center;
  animation: achievement-splash-card 2400ms cubic-bezier(.2, .85, .25, 1) both;
}

.achievement-splash-card > p {
  margin: 0 0 1rem;
  color: var(--award-color);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
}

.achievement-splash-icon {
  display: grid;
  width: 6.2rem;
  aspect-ratio: 1;
  margin: 0 auto 1.2rem;
  place-items: center;
  border: 0.45rem solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: var(--award-color);
  color: var(--ink);
  box-shadow:
    0 0 0 0.65rem color-mix(in oklab, var(--award-color) 22%, transparent),
    0 1.1rem 2.2rem rgba(0, 0, 0, 0.3);
  font-family: var(--mono);
  font-size: 1.65rem;
  font-weight: 800;
  animation: achievement-splash-icon 2400ms ease both;
}

.achievement-splash-card h2 {
  margin: 0;
  font-size: clamp(1.5rem, 6vw, 2.2rem);
  line-height: 1.05;
  text-wrap: balance;
}

.achievement-splash-card > span {
  display: block;
  max-width: 18rem;
  margin: 0.65rem auto 1.2rem;
  color: #c0cac7;
  font-size: 0.75rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.achievement-splash-card > small {
  display: inline-flex;
  min-height: 1.9rem;
  align-items: center;
  padding-inline: 0.75rem;
  border-radius: 99px;
  background: color-mix(in oklab, var(--award-color) 16%, transparent);
  color: var(--award-color);
  font-family: var(--mono);
  font-size: 0.52rem;
  letter-spacing: 0.1em;
}

.achievement-splash-rays,
.achievement-splash-particles {
  position: fixed;
  z-index: 1;
  inset: 50% auto auto 50%;
  width: min(38rem, 135vmin);
  aspect-ratio: 1;
  translate: -50% -50%;
  pointer-events: none;
}

.achievement-splash-rays {
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 4deg,
    color-mix(in oklab, var(--award-color) 18%, transparent) 0 7deg,
    transparent 7deg 22deg
  );
  mask-image: radial-gradient(circle, transparent 0 25%, black 62%, transparent 74%);
  animation: achievement-splash-rays 2400ms ease-out both;
}

.achievement-splash-particles span {
  --particle-angle: 0deg;

  position: absolute;
  inset: 50% auto auto 50%;
  width: 0.7rem;
  height: 1.35rem;
  border-radius: 99px;
  background: var(--award-color);
  transform: translate(-50%, -50%) rotate(var(--particle-angle)) translateY(-3.6rem) scale(0.25);
  animation: achievement-splash-particle 1600ms cubic-bezier(.15, .75, .25, 1) 180ms both;
}

.achievement-splash-particles span:nth-child(2n) {
  width: 0.45rem;
  background: var(--blue);
}

.achievement-splash-particles span:nth-child(3n) {
  height: 0.7rem;
  background: var(--coral);
}

.achievement-splash-particles span:nth-child(1) { --particle-angle: 0deg; }
.achievement-splash-particles span:nth-child(2) { --particle-angle: 30deg; }
.achievement-splash-particles span:nth-child(3) { --particle-angle: 60deg; }
.achievement-splash-particles span:nth-child(4) { --particle-angle: 90deg; }
.achievement-splash-particles span:nth-child(5) { --particle-angle: 120deg; }
.achievement-splash-particles span:nth-child(6) { --particle-angle: 150deg; }
.achievement-splash-particles span:nth-child(7) { --particle-angle: 180deg; }
.achievement-splash-particles span:nth-child(8) { --particle-angle: 210deg; }
.achievement-splash-particles span:nth-child(9) { --particle-angle: 240deg; }
.achievement-splash-particles span:nth-child(10) { --particle-angle: 270deg; }
.achievement-splash-particles span:nth-child(11) { --particle-angle: 300deg; }
.achievement-splash-particles span:nth-child(12) { --particle-angle: 330deg; }

@keyframes achievement-splash-screen {
  0%, 100% { opacity: 0; }
  10%, 82% { opacity: 1; }
}

@keyframes achievement-splash-card {
  0% { opacity: 0; transform: translateY(1.8rem) scale(0.72) rotate(-5deg); }
  14% { opacity: 1; transform: translateY(0) scale(1.06) rotate(1deg); }
  22%, 80% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
  100% { opacity: 0; transform: translateY(-0.8rem) scale(1.04); }
}

@keyframes achievement-splash-icon {
  0% { transform: scale(0.4) rotate(-30deg); }
  18% { transform: scale(1.14) rotate(7deg); }
  27%, 82% { transform: scale(1) rotate(0); }
  100% { transform: scale(0.92); }
}

@keyframes achievement-splash-rays {
  0% { opacity: 0; transform: scale(0.45) rotate(-20deg); }
  22% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.18) rotate(26deg); }
}

@keyframes achievement-splash-particle {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--particle-angle)) translateY(-3.6rem) scale(0.25); }
  18% { opacity: 1; }
  72% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--particle-angle)) translateY(-12.5rem) scale(1); }
}

.toast {
  position: fixed;
  z-index: 100;
  inset: max(1rem, env(safe-area-inset-top)) 50% auto auto;
  display: flex;
  width: min(calc(100% - 2rem), 25rem);
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem;
  border-radius: 1rem;
  background: var(--ink);
  color: white;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transform: translate(50%, -130%);
  transition: opacity 200ms ease, transform 320ms cubic-bezier(.2, .8, .2, 1);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(50%, 0);
}

.toast-icon {
  display: grid;
  width: 2.3rem;
  aspect-ratio: 1;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0.75rem;
  background: var(--lime);
  color: var(--ink);
}

.toast strong,
.toast small {
  display: block;
}

.toast strong {
  font-size: 0.68rem;
}

.toast small {
  margin-block-start: 0.14rem;
  color: #bbc5c2;
  font-size: 0.6rem;
}

@media (min-width: 42rem) and (pointer: fine) {
  body {
    padding-block: 1.25rem;
  }

  .app-shell {
    min-height: calc(100dvh - 2.5rem);
    border-radius: 2rem;
  }

  .bottom-nav {
    inset-block-end: 1.25rem;
    border-radius: 0 0 2rem 2rem;
  }

  .control-button kbd {
    display: inline;
  }
}

@media (max-height: 46rem) {
  .topbar {
    min-height: 4.2rem;
  }

  .game-heading {
    margin-block: 0.35rem 0.7rem;
  }

  .board-wrap {
    aspect-ratio: 1.08;
    margin-block: 0.45rem;
  }

  .game-card {
    padding-block: 0.75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  .view,
  .arrow-piece.is-hint,
  .arrow-piece.is-blocked,
  .heart-countdown.is-hit,
  .modal[open] {
    animation: none !important;
  }

  .achievement-splash[open],
  .achievement-splash::backdrop,
  .achievement-splash-card,
  .achievement-splash-icon {
    animation: achievement-splash-reduced 1600ms ease both;
  }

  .achievement-splash-rays,
  .achievement-splash-particles {
    display: none;
  }

  .board-message.is-visible {
    animation: message-pop-reduced 420ms ease both;
  }

  .skip-link,
  .heart,
  .switch,
  .switch span,
  .toast,
  .arrow-piece::before,
  .arrow-shape {
    transition: none !important;
  }

  .progress-track::-webkit-progress-value {
    transition: none !important;
  }
}

@keyframes message-pop-reduced {
  0%, 100% { opacity: 0; }
  10%, 78% { opacity: 1; }
}

@keyframes achievement-splash-reduced {
  0%, 100% { opacity: 0; }
  10%, 82% { opacity: 1; }
}

@media (prefers-contrast: more) {
  :root {
    --line: rgba(19, 42, 51, 0.28);
  }

  .achievement-splash-card {
    border-width: 0.18rem;
  }
}

@media (forced-colors: active) {
  .achievement-splash-card,
  .achievement-splash-icon {
    border: 0.18rem solid Highlight;
  }

  .achievement-splash-rays,
  .achievement-splash-particles {
    display: none;
  }
}
