:root {
  --void: #0d0e0f;
  --ink: #07090a;
  --paper: #f6f6f2;
  --paper-muted: #d7d8d5;
  --seam: #ffffff;
  --dim: #b7babd;
  --graphite: #777c81;
  --panel: rgba(20, 22, 24, 0.82);
  --panel-strong: rgba(20, 22, 24, 0.94);
  --hairline: rgba(246, 246, 242, 0.32);
  --hairline-strong: rgba(246, 246, 242, 0.68);
  --safe: env(safe-area-inset-top);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--void);
  color: var(--paper);
  font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#game {
  position: relative;
  width: 100%;
  height: 100%;
}

#game::before,
#game::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

#game::before {
  box-shadow: inset 0 0 120px 18px rgba(0, 0, 0, 0.18);
}

#game::after {
  display: none;
}

#view {
  display: block;
  width: 100%;
  height: 100%;
}

#boot-screen {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  gap: 8px;
  background: #0c0e10;
  color: var(--paper);
  text-align: center;
  transition: opacity 360ms ease;
}

#boot-screen strong { font-size: 34px; font-weight: 500; }
#boot-screen span { color: var(--dim); font-size: 12px; }
#boot-screen.ready { opacity: 0; pointer-events: none; }

#boot-screen::after {
  content: "";
  width: 54px;
  height: 2px;
  margin: 10px auto 0;
  background: var(--paper);
  box-shadow: 12px 4px 0 -1px var(--graphite);
}

.no-script {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-content: center;
  margin: 0;
  background: #0c0e10;
  color: var(--paper);
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  background: rgba(8, 10, 12, 0.8);
  backdrop-filter: grayscale(1) contrast(0.96) blur(2px);
  -webkit-backdrop-filter: grayscale(1) contrast(0.96) blur(2px);
  z-index: 8;
  touch-action: manipulation;
}

.overlay.open { display: flex; }

.overlay.open > * {
  animation: paper-arrive 260ms ease-out both;
}

.overlay:not(.hero) {
  background: #0c0e10;
}

.overlay:not(.hero)::before {
  content: "";
  position: absolute;
  inset: 24px;
  border: 1px solid rgba(246, 246, 242, 0.12);
  pointer-events: none;
}

.overlay:not(.hero)::after {
  content: "";
  position: absolute;
  top: 24px;
  left: 24px;
  width: 8px;
  height: 8px;
  border-top: 1px solid var(--paper-muted);
  border-left: 1px solid var(--paper-muted);
  opacity: 0.58;
  pointer-events: none;
}

.overlay:not(.hero) > * {
  position: relative;
  z-index: 1;
}

@keyframes paper-arrive {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.overlay.hero {
  background: var(--hero, transparent) center / cover no-repeat;
}

.overlay.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(7, 8, 9, 0.08);
  box-shadow:
    inset -420px 0 240px -220px rgba(5, 6, 7, 0.68),
    inset 0 -300px 220px -190px rgba(5, 6, 7, 0.8);
  pointer-events: none;
}

.overlay.hero > * {
  position: relative;
  z-index: 1;
}

#title {
  align-items: flex-end;
  justify-content: flex-end;
}

#title::after {
  content: "";
  position: absolute;
  right: 4.8vw;
  bottom: max(32px, 5vh);
  width: min(620px, 56vw);
  height: 1px;
  background: rgba(246, 246, 242, 0.3);
  box-shadow: -92px -7px 0 -0.4px rgba(246, 246, 242, 0.62), -18px 7px 0 -0.4px rgba(119, 124, 129, 0.72);
  pointer-events: none;
}

.title-card,
.guide-card {
  padding: 36px 28px 28px;
  text-align: center;
}

.title-card {
  width: min(580px, 94vw);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 0;
  background: transparent;
  box-shadow: none;
  margin: 0 max(4.8vw, env(safe-area-inset-right)) max(72px, 12vh) 0;
  text-align: right;
  text-shadow: 0 2px 0 #050607, 0 5px 22px rgba(0, 0, 0, 0.86);
}

.guide-card {
  width: min(620px, calc(100vw - 48px));
  position: relative;
  border: 1px solid var(--hairline);
  border-top: 1px solid var(--hairline);
  border-left: 3px solid var(--paper);
  background: var(--panel-strong);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(0, 0, 0, 0.45);
  padding: 32px 38px 30px;
  text-align: left;
}

.guide-card::before {
  content: "";
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 1px;
  background: var(--paper-muted);
  box-shadow: -10px 4px 0 -0.5px var(--graphite);
  opacity: 0.72;
}

.guide-card::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 12px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--paper-muted);
  transform: rotate(45deg);
  opacity: 0.72;
}

.screen-overline {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(246, 246, 242, 0.18);
  color: var(--dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-align: left;
}

.screen-overline::before {
  content: "";
  width: 24px;
  height: 1px;
  margin-right: auto;
  background: var(--paper-muted);
  box-shadow: 8px 4px 0 -0.5px var(--graphite);
  order: 2;
}

.screen-overline span:last-child {
  color: var(--graphite);
  order: 3;
}

.guide-card .screen-overline { margin-bottom: 22px; }
.guide-card .eyebrow { margin-bottom: 8px; color: var(--paper-muted); }

.title-card::before,
.title-card::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.title-card::before {
  top: 20px;
  right: 30px;
  width: 56px;
  height: 1px;
  background: var(--paper-muted);
  box-shadow: -14px 4px 0 -0.4px var(--graphite);
}

.title-card::after {
  top: 16px;
  right: 16px;
  width: 8px;
  height: 8px;
  border: 1px solid var(--paper-muted);
  transform: rotate(45deg);
}

.eyebrow {
  margin: 0 0 10px;
  letter-spacing: 0.34em;
  font-size: 11px;
  color: var(--dim);
}

.mark {
  font-size: 72px;
  letter-spacing: 0.42em;
  margin: 0 0 8px;
  font-weight: 600;
  line-height: 0.98;
  text-shadow: 2px 2px 0 #08090a, 0 8px 24px rgba(0, 0, 0, 0.74);
}

.tag {
  margin: 0 0 24px;
  letter-spacing: 0.28em;
  color: var(--dim);
  font-size: 15px;
}

.title-signal {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  width: min(420px, 88vw);
  margin: 0 0 13px auto;
  color: var(--graphite);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  line-height: 1;
  white-space: nowrap;
}

.title-signal-rule {
  width: 34px;
  height: 1px;
  margin-right: auto;
  background: var(--paper-muted);
  box-shadow: 7px 4px 0 -0.5px var(--graphite);
}

.title-signal b {
  margin-right: 4px;
  color: var(--paper-muted);
  font-weight: 500;
}

.sub {
  margin: -16px 0 24px;
  max-width: 28em;
  color: var(--dim);
  letter-spacing: 0.12em;
  line-height: 1.8;
  text-align: center;
  font-size: 13px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(320px, 86vw);
  margin: 0 auto;
}

.title-card .menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(420px, 88vw);
  margin: 0 0 0 auto;
}

button {
  position: relative;
  min-height: 48px;
  min-width: 48px;
  padding: 12px 18px;
  border: 1px solid var(--hairline);
  background: var(--panel);
  color: var(--paper);
  font: inherit;
  font-weight: 500;
  letter-spacing: 0.18em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), inset 0 -1px 0 rgba(0, 0, 0, 0.55);
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

button:active {
  transform: translate(1px, 1px);
  background: rgba(240, 240, 237, 0.16);
  box-shadow: none;
}
button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

body.using-gamepad button:focus,
body.using-gamepad input:focus {
  outline: 2px solid #f4f4f1;
  outline-offset: 3px;
}

button.primary {
  background: var(--paper);
  color: var(--void);
  border-color: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(7, 9, 10, 0.72), 4px 4px 0 rgba(0, 0, 0, 0.34);
}

button.primary:hover { background: #fff; }

button:disabled {
  cursor: not-allowed;
  filter: grayscale(1);
}

.menu > button {
  overflow: hidden;
  padding-right: 48px;
  text-align: left;
}

.menu > button::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 18px;
  height: 1px;
  background: var(--paper-muted);
  transform: translateY(-50%);
  transition: width 120ms ease;
}

.menu > button.primary::after { background: var(--void); }

.title-card .menu > button {
  min-height: 58px;
  padding: 10px 34px 10px 48px;
  border: 0;
  border-left: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  background: rgba(8, 10, 12, 0.58);
  box-shadow: inset 10px 0 0 rgba(246, 246, 242, 0.018), inset 0 1px 0 rgba(246, 246, 242, 0.04);
  font-size: 14px;
  text-align: right;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
  transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.title-card .menu > button::before {
  content: attr(data-menu-index) "  /  " attr(data-menu-note);
  position: absolute;
  left: 14px;
  top: 50%;
  color: var(--graphite);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 8px;
  font-weight: 500;
  transform: translateY(-50%);
}

.title-card .menu > button::after {
  right: 15px;
  width: 9px;
  height: 9px;
  border-top: 1px solid var(--paper-muted);
  border-right: 1px solid var(--paper-muted);
  background: transparent;
  transform: translateY(-50%) rotate(45deg);
}

.title-card .menu > button.primary {
  border-left-color: var(--paper);
  border-bottom-color: var(--paper);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(7, 9, 10, 0.72), 5px 5px 0 rgba(0, 0, 0, 0.34);
}

.title-card .menu > button:not(:disabled):focus-visible,
.title-card .menu > button:not(:disabled):hover {
  transform: translateX(-5px);
  border-left-color: var(--paper-muted);
  background: rgba(246, 246, 242, 0.14);
  box-shadow: inset 18px 0 0 rgba(246, 246, 242, 0.035), inset 0 1px 0 rgba(246, 246, 242, 0.08), 5px 5px 0 rgba(0, 0, 0, 0.2);
}

.title-card .menu > button.primary:not(:disabled):focus-visible,
.title-card .menu > button.primary:not(:disabled):hover {
  background: #fff;
  color: var(--void);
  border-left-color: var(--void);
}

.title-card .menu > button.primary::before { color: #55595d; }

.title-card .menu > button.primary::after {
  border-color: var(--void);
  background: transparent;
}

#btn-start,
#btn-continue {
  grid-column: 1 / -1;
  min-height: 64px;
  border-left-width: 3px;
  font-size: 16px;
}

#title.open .title-card .menu > button {
  animation: title-menu-arrive 360ms cubic-bezier(0.2, 0.78, 0.2, 1) both;
}

#title.open .title-card .menu > button:nth-child(2) { animation-delay: 35ms; }
#title.open .title-card .menu > button:nth-child(3) { animation-delay: 70ms; }
#title.open .title-card .menu > button:nth-child(4) { animation-delay: 105ms; }
#title.open .title-card .menu > button:nth-child(5) { animation-delay: 140ms; }
#title.open .title-card .menu > button:nth-child(6) { animation-delay: 175ms; }

@keyframes title-menu-arrive {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: translateX(0); }
}

.title-footnote {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  width: min(420px, 88vw);
  margin: 16px 0 0 auto;
  color: var(--graphite);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 8px;
  letter-spacing: 0.16em;
}

.row {
  display: flex;
  gap: 10px;
  width: min(420px, 92vw);
  flex-wrap: wrap;
  justify-content: center;
}

#chapters {
  justify-content: flex-start;
  overflow-y: auto;
  padding-top: max(34px, env(safe-area-inset-top));
}

.chapter-heading {
  width: min(860px, 94vw);
  margin: auto auto 18px;
  padding: 20px 0 0 18px;
  border-left: 2px solid var(--paper-muted);
  text-align: left;
}

.chapter-heading .screen-overline { margin-bottom: 16px; }
.chapter-heading .eyebrow { color: var(--paper-muted); }

.chapter-title {
  margin: 0 0 10px;
  font-size: 38px;
  font-weight: 500;
  letter-spacing: 0.28em;
}

.chapter-heading .sub {
  max-width: none;
  margin: 0;
  text-align: left;
}

.chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: min(860px, 94vw);
}

.chapter-item {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 108px;
  overflow: hidden;
  padding: 14px 16px;
  border-color: rgba(246, 246, 242, 0.28);
  border-left: 2px solid var(--hairline-strong);
  background: #070707;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
  text-align: left;
}

.chapter-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 7, 7, 0.97) 0%, rgba(7, 7, 7, 0.84) 54%, rgba(7, 7, 7, 0.18) 100%);
  pointer-events: none;
}

.chapter-thumb {
  position: absolute;
  inset: 0 0 0 42%;
  width: 58%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.15);
  opacity: 0.78;
}

.chapter-item > span { position: relative; z-index: 1; }

.chapter-number {
  color: #f4f4f1;
  font-size: 19px;
  letter-spacing: 0.08em;
}

.chapter-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.chapter-name {
  overflow: hidden;
  color: var(--paper);
  font-size: 16px;
  letter-spacing: 0.16em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-meta,
.chapter-record,
.chapter-state {
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.chapter-record { color: #b8b8b6; }

.chapter-item.flawless .chapter-number,
.chapter-item.flawless .chapter-state {
  color: #fff;
  text-shadow: 0 0 9px rgba(255, 255, 255, 0.36);
}

.chapter-state {
  align-self: end;
  padding-left: 10px;
  color: #f4f4f1;
}

.chapter-item.current {
  border-left: 4px solid #f4f4f1;
  background: rgba(244, 244, 241, 0.05);
  box-shadow: inset 12px 0 0 rgba(244, 244, 241, 0.035);
}

.chapter-item.cleared .chapter-state { color: var(--paper); }

.chapter-item.locked,
.chapter-item:disabled {
  color: #555557;
  cursor: default;
  opacity: 0.58;
}

.chapter-item.locked::after {
  background: rgba(7, 7, 7, 0.9);
}

.chapter-item.locked .chapter-number,
.chapter-item.locked .chapter-name,
.chapter-item.locked .chapter-state { color: #606064; }

.chapter-back {
  width: min(860px, 94vw);
  margin-top: 22px;
  padding-bottom: 20px;
}

.chapter-back button {
  width: 168px;
  margin-left: auto;
}

#pause-btn {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  top: max(12px, env(safe-area-inset-top));
  z-index: 7;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  background: var(--panel);
  border-color: var(--hairline-strong);
  font-family: system-ui, sans-serif;
  font-size: 16px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.5), 3px 3px 0 rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

#views {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  top: calc(max(12px, env(safe-area-inset-top)) + 50px);
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#views button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-color: var(--hairline);
  background: var(--panel);
  font-family: system-ui, sans-serif;
  font-size: 18px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.44), 3px 3px 0 rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

#views button.primary {
  background: var(--paper);
  color: var(--void);
  border-color: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(7, 9, 10, 0.72), 3px 3px 0 rgba(0, 0, 0, 0.38);
}

#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  z-index: 7;
  pointer-events: none;
}

#crosshair span {
  display: block;
  width: 100%;
  height: 100%;
  border: 1.5px solid rgba(240, 240, 237, 0.88);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(7, 7, 7, 0.45);
}

#crosshair.aim span {
  border-color: #fff;
  background: rgba(240, 240, 237, 0.14);
}

#action-prompt {
  position: absolute;
  left: 50%;
  top: 28px;
  width: max-content;
  max-width: min(260px, calc(100vw - 48px));
  margin: 0;
  padding: 5px 8px;
  transform: translateX(-50%);
  border: 1px solid var(--hairline);
  background: var(--panel);
  color: var(--paper);
  font-size: 12px;
  letter-spacing: 0.12em;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
}

#lamp-pop {
  position: absolute;
  left: 50%;
  top: calc(50% + 28px);
  transform: translateX(-50%);
  z-index: 8;
  min-width: 13em;
  padding: 12px 14px 14px;
  border: 1px solid var(--hairline-strong);
  border-top: 3px solid var(--paper);
  background: var(--panel-strong);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.28);
  text-align: center;
  pointer-events: auto;
}

#lamp-pop-title {
  margin: 0 0 4px;
  letter-spacing: 0.28em;
  font-size: 14px;
}

.lamp-pop-hint {
  margin: 0 0 10px;
  letter-spacing: 0.08em;
  font-size: 12px;
  line-height: 1.6;
  color: var(--dim);
}

.lamp-pop-row {
  display: flex;
  gap: 8px;
}

#lamp-pop button {
  flex: 1;
  min-height: 40px;
  padding: 8px 10px;
  letter-spacing: 0.16em;
  font-size: 13px;
}

#hud {
  position: absolute;
  left: 16px;
  top: max(12px, env(safe-area-inset-top));
  z-index: 6;
  pointer-events: none;
  letter-spacing: 0.18em;
  font-size: 13px;
  line-height: 1.45;
  max-width: min(62vw, 22em);
  text-shadow: 0 1px 0 #0c0e10, 0 0 10px rgba(12, 14, 16, 0.88);
}

.control-state {
  position: absolute;
  right: max(66px, calc(env(safe-area-inset-right) + 58px));
  top: max(12px, env(safe-area-inset-top));
  z-index: 7;
  display: grid;
  grid-template-columns: 24px auto;
  grid-template-rows: auto auto;
  column-gap: 7px;
  min-width: 132px;
  padding: 6px 9px 7px;
  border: 1px solid rgba(240, 240, 237, 0.3);
  border-left: 2px solid var(--paper-muted);
  background: rgba(8, 10, 12, 0.76);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  pointer-events: none;
  text-shadow: 0 1px 0 #0c0e10;
}

#control-state[data-mode="shadow"] {
  border-left-color: #fff;
  background: rgba(238, 238, 234, 0.9);
  color: var(--void);
  text-shadow: none;
}

#control-state-mark {
  grid-row: 1 / span 2;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid currentColor;
  font-family: system-ui, sans-serif;
  font-size: 12px;
}

#control-state-text {
  align-self: end;
  font-size: 11px;
  letter-spacing: 0.12em;
  white-space: nowrap;
}

#control-state-hint {
  align-self: start;
  color: var(--dim);
  font-size: 9px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

#control-state[data-mode="shadow"] #control-state-hint { color: #4e5053; }

.hud-name { color: var(--paper); opacity: 0.9; }

.hud-chapter {
  margin-bottom: 1px;
  color: var(--dim);
  font-family: system-ui, sans-serif;
  font-size: 9px;
}

#objective {
  position: absolute;
  left: 16px;
  top: calc(max(12px, env(safe-area-inset-top)) + 50px);
  z-index: 6;
  width: min(330px, calc(100vw - 134px));
  padding: 9px 11px 9px;
  border: 1px solid rgba(240, 240, 237, 0.16);
  border-left: 3px solid var(--paper);
  background: var(--panel);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  pointer-events: none;
  text-shadow: 0 1px 0 #0c0e10, 0 0 8px rgba(12, 14, 16, 0.74);
}

#objective.checkpoint-flash {
  border-left-color: #fff;
  filter: brightness(1.18);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.18), inset 8px 0 0 rgba(255, 255, 255, 0.055);
}

#exposure-meter {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 7;
  display: grid;
  grid-template-columns: repeat(3, 15px);
  gap: 7px;
  width: 59px;
  height: 20px;
  align-items: center;
  padding: 0 4px;
  transform: translateX(-50%);
  pointer-events: none;
}

#exposure-meter::before,
#exposure-meter::after {
  content: "";
  position: absolute;
  top: 3px;
  width: 4px;
  height: 14px;
  border-top: 1px solid var(--paper-muted);
  border-bottom: 1px solid var(--paper-muted);
  opacity: 0.58;
}

#exposure-meter::before {
  left: -3px;
  border-left: 1px solid var(--paper-muted);
}

#exposure-meter::after {
  right: -3px;
  border-right: 1px solid var(--paper-muted);
}

#exposure-meter span {
  display: block;
  width: 15px;
  height: 5px;
  border: 1px solid rgba(240, 240, 237, 0.48);
  opacity: 0.28;
  transition: opacity 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

#exposure-meter .exposure-void { background: #050607; }
#exposure-meter .exposure-seam { background: #a9a9a6; }
#exposure-meter .exposure-white { background: #fff; }

#exposure-meter[data-state="void"] .exposure-void,
#exposure-meter[data-state="seam"] .exposure-seam,
#exposure-meter[data-state="white"] .exposure-white {
  opacity: 1;
  transform: scaleY(1.8);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.48);
}

#objective-kicker {
  display: none;
}

#objective-text {
  margin: 0;
  color: var(--paper);
  font-size: 12px;
  line-height: 1.5;
}

.objective-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid rgba(240, 240, 237, 0.12);
  color: var(--dim);
  font-size: 9px;
}

#stick {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(86px, calc(env(safe-area-inset-bottom) + 72px));
  z-index: 7;
  touch-action: none;
}

#hands {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 10.8em;
  pointer-events: auto;
}

#hands.hands-empty { display: none; }

.hands-block {
  padding: 10px 10px 12px;
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--paper-muted);
  background: var(--panel-strong);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.24);
}

.hands-title {
  margin: 0 0 8px;
  letter-spacing: 0.22em;
  font-size: 12px;
  text-align: center;
}

.hands-row {
  display: flex;
  gap: 8px;
}

#hands button {
  flex: 1;
  min-height: 44px;
  padding: 8px 8px;
  letter-spacing: 0.14em;
  font-size: 13px;
}

#hands .hands-wide {
  width: 100%;
  margin-top: 8px;
  flex: none;
}

#stick-base {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 1px solid rgba(240, 240, 237, 0.46);
  background: rgba(7, 7, 7, 0.56);
  box-shadow: inset 0 0 0 8px rgba(240, 240, 237, 0.018), 0 0 0 1px rgba(0, 0, 0, 0.34);
  position: relative;
}

#stick-base::after {
  content: "";
  position: absolute;
  inset: 21px;
  border: 1px solid rgba(240, 240, 237, 0.14);
  border-radius: 50%;
  pointer-events: none;
}

#stick-knob {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid var(--paper);
  background: var(--ink);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.32);
  position: absolute;
  left: 32px;
  top: 32px;
  pointer-events: none;
}

#coach {
  display: none !important;
}

#coach p {
  margin: 0;
  letter-spacing: 0.12em;
  line-height: 1.75;
  font-size: 14px;
}

#input-status {
  position: absolute;
  left: 50%;
  top: max(16px, env(safe-area-inset-top));
  z-index: 12;
  min-height: 36px;
  padding: 9px 14px;
  transform: translateX(-50%);
  border: 1px solid var(--hairline-strong);
  border-top: 3px solid var(--paper);
  background: var(--panel-strong);
  color: #f4f4f1;
  font-size: 11px;
  letter-spacing: 0.16em;
  pointer-events: none;
}

.nearby-prompt {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(96px, calc(env(safe-area-inset-bottom) + 82px));
  z-index: 7;
  display: flex;
  width: min(224px, calc(100vw - 32px));
  min-height: 48px;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--hairline);
  border-left: 3px solid #f4f4f1;
  background: var(--panel-strong);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.24);
  pointer-events: none;
}

#shadow-action {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 9;
  width: 56px;
  min-width: 56px;
  height: 56px;
  min-height: 56px;
  padding: 0;
  border-color: rgba(244, 244, 241, 0.72);
  border-radius: 50%;
  background: var(--panel-strong);
  color: #f4f4f1;
  font-family: system-ui, sans-serif;
  font-size: 25px;
  line-height: 1;
  box-shadow: 0 0 0 5px rgba(5, 6, 7, 0.24), 4px 4px 0 rgba(0, 0, 0, 0.3);
}

#shadow-action.active {
  background: #f4f4f1;
  color: #070707;
  box-shadow: 0 0 0 5px rgba(244, 244, 241, 0.12), 0 0 18px rgba(255, 255, 255, 0.24);
}

.shadow-console {
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(88px, calc(env(safe-area-inset-bottom) + 78px));
  z-index: 9;
  display: grid;
  gap: 8px;
  width: min(220px, calc(100vw - 36px));
  padding: 10px;
  border: 1px solid rgba(244, 244, 241, 0.34);
  border-left: 2px solid var(--paper-muted);
  background: rgba(8, 10, 12, 0.84);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  pointer-events: auto;
}

.shadow-console-readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.14em;
}

.shadow-console-readout strong {
  color: var(--paper);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.shadow-console-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.shadow-console-actions button {
  min-height: 38px;
  padding: 7px 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
}

#shadow-console[data-pinned="true"] { border-left-color: #fff; }
#shadow-console[data-pinned="true"] #shadow-pin { background: var(--paper); color: var(--void); }

#shadow-switch {
  position: absolute;
  right: max(84px, calc(env(safe-area-inset-right) + 76px));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 9;
  display: grid;
  width: 56px;
  min-width: 56px;
  height: 56px;
  min-height: 56px;
  place-items: center;
  padding: 0;
  border-color: rgba(244, 244, 241, 0.72);
  border-radius: 50%;
  background: var(--panel-strong);
  color: #f4f4f1;
  font-family: system-ui, sans-serif;
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 0 0 5px rgba(5, 6, 7, 0.24), 4px 4px 0 rgba(0, 0, 0, 0.3);
}

#shadow-switch.active {
  background: #f4f4f1;
  color: #070707;
  box-shadow: 0 0 0 5px rgba(244, 244, 241, 0.12), 0 0 18px rgba(255, 255, 255, 0.24);
}

#game.first-person #shadow-action {
  bottom: max(224px, calc(env(safe-area-inset-bottom) + 208px));
}

#game.first-person #shadow-switch {
  bottom: max(224px, calc(env(safe-area-inset-bottom) + 208px));
}

#game.first-person .shadow-console {
  bottom: max(290px, calc(env(safe-area-inset-bottom) + 274px));
}

#nearby-prompt-key {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border: 1px solid rgba(244, 244, 241, 0.68);
  border-radius: 4px;
  color: #f4f4f1;
  font-family: system-ui, sans-serif;
  font-size: 13px;
  letter-spacing: 0;
}

#nearby-prompt-text {
  min-width: 0;
  color: var(--paper);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.45;
}

.level-intro {
  position: absolute;
  left: 50%;
  top: 36%;
  z-index: 6;
  width: min(560px, calc(100vw - 48px));
  transform: translate(-50%, -50%);
  color: var(--paper);
  text-align: center;
  text-shadow: 0 2px 0 #0c0e10, 0 0 14px rgba(12, 14, 16, 0.9);
  pointer-events: none;
}

.level-intro.reveal { animation: level-intro 2.65s ease both; }

.reference-style .level-intro { display: none; }

.reference-style #hud {
  opacity: 0.72;
}

.reference-style #objective {
  width: min(276px, calc(100vw - 134px));
  padding: 7px 9px;
  border-color: rgba(240, 240, 237, 0.12);
  border-left-width: 1px;
  background: rgba(8, 9, 10, 0.58);
  box-shadow: none;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.reference-style #objective-text {
  font-size: 10px;
  line-height: 1.45;
}

.reference-style .objective-meta { display: none; }

.reference-style .control-state {
  background: rgba(8, 9, 10, 0.58);
  box-shadow: none;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.reference-style #input-status { display: none !important; }

#level-intro-kicker {
  margin: 0 0 9px;
  color: #f4f4f1;
  font-size: 11px;
  letter-spacing: 0.32em;
}

#level-intro-name {
  margin: 0;
  font-size: 34px;
  font-weight: 500;
  letter-spacing: 0.24em;
}

#level-intro-name::after {
  content: "";
  display: block;
  width: 42px;
  height: 2px;
  margin: 13px auto 0;
  background: var(--paper);
  box-shadow: 10px 4px 0 -1px var(--graphite);
}

#level-intro-note {
  margin: 14px 0 0;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.18em;
}

@keyframes level-intro {
  0% { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); }
  14%, 72% { opacity: 1; transform: translate(-50%, -50%); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 8px)); }
}

.guide-title {
  margin: 0 0 14px;
  letter-spacing: 0.22em;
  font-size: 34px;
  font-weight: 500;
}

.guide-body {
  max-width: 48em;
  margin: 0 0 24px;
  letter-spacing: 0.1em;
  line-height: 1.9;
  color: var(--paper);
  text-align: left;
  font-size: 15px;
}

.rules {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 0 0 22px;
  text-align: left;
}

.rule {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 72px;
  padding: 12px 14px 12px 16px;
  border: 1px solid var(--hairline);
  border-left-width: 3px;
  box-shadow: inset 8px 0 0 rgba(246, 246, 242, 0.025);
}

.rule strong {
  letter-spacing: 0.28em;
  font-weight: 500;
}

.rule span {
  color: var(--dim);
  letter-spacing: 0.08em;
  font-size: 13px;
}

.rule.void { background: #070707; border-left-color: #34363a; }
.rule.seam {
  background: var(--paper);
  color: var(--void);
  border-color: var(--paper);
  box-shadow: inset 8px 0 0 rgba(7, 9, 10, 0.08);
}
.rule.seam span { color: #4a4a4d; }
.rule.white {
  background: #fff;
  color: #070707;
  border-color: #fff;
  box-shadow: inset 8px 0 0 rgba(7, 9, 10, 0.08);
}
.rule.white span { color: #5a5a5d; }

.guide-card > .menu {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 8px;
  width: 100%;
  margin: 24px 0 0;
}

.guide-card > .menu button { min-height: 52px; }

.setting {
  width: min(360px, 90vw);
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 10px 0;
  border-bottom: 1px solid rgba(240, 240, 237, 0.13);
  letter-spacing: 0.12em;
}

#settings,
#clear-card {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.settings-card {
  width: min(520px, calc(100vw - 48px));
  padding: 32px 34px 28px;
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--paper-muted);
  background: var(--panel-strong);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(0, 0, 0, 0.42);
}

.settings-card .tag {
  margin: 0 0 16px;
  color: var(--paper);
  font-size: 32px;
  letter-spacing: 0.22em;
  text-align: left;
}

.settings-card .setting { width: 100%; }

.settings-back {
  width: 100%;
  margin: 22px 0 0;
}

.settings-back button { width: 100%; }

.setting > button,
.setting > span button {
  min-height: 40px;
  padding: 8px 14px;
}

.pause-reason {
  width: min(360px, 88vw);
  margin: -12px 0 20px;
  color: #f4f4f1;
  font-size: 12px;
  letter-spacing: 0.12em;
  line-height: 1.7;
  text-align: center;
}

input[type="range"] {
  width: 160px;
  height: 18px;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  accent-color: var(--paper);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--graphite);
}

input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -7px;
  appearance: none;
  -webkit-appearance: none;
  border: 2px solid var(--void);
  border-radius: 0;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--paper);
}

input[type="range"]::-moz-range-track {
  height: 2px;
  background: var(--graphite);
}

input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid var(--void);
  border-radius: 0;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--paper);
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--paper);
}

.line {
  max-width: 28em;
  line-height: 1.9;
  letter-spacing: 0.14em;
  font-size: 24px;
  text-align: center;
}

#clear-card {
  gap: 8px;
}

.clear-stamp {
  min-width: 76px;
  margin: 2px 0 8px;
  padding: 7px 12px;
  transform: rotate(-2deg);
  border: 2px solid #f4f4f1;
  color: #f4f4f1;
  font-size: 18px;
  letter-spacing: 0.24em;
  text-align: center;
}

.clear-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(460px, 90vw);
  border-top: 1px solid rgba(240, 240, 237, 0.28);
  border-bottom: 1px solid rgba(240, 240, 237, 0.28);
}

.clear-stats > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  padding: 10px 8px;
  text-align: center;
}

.clear-stats > div + div { border-left: 1px solid rgba(240, 240, 237, 0.18); }

.clear-stats span {
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.18em;
}

.clear-stats strong {
  overflow: hidden;
  color: var(--paper);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clear-record {
  min-height: 1.5em;
  margin: 3px 0 4px;
  color: #f4f4f1;
  font-size: 11px;
  letter-spacing: 0.14em;
  line-height: 1.5;
  text-align: center;
}

#clear-now {
  margin-bottom: 8px;
}

#clear-next-wrap {
  margin: 8px 0 20px;
}

#clear-go {
  min-width: 12em;
}

.credits {
  display: grid;
  gap: 0;
  line-height: 1.7;
  letter-spacing: 0.12em;
  text-align: left;
  color: var(--dim);
}

.credits-card {
  width: min(620px, calc(100vw - 48px));
  padding: 32px 38px 30px;
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--paper);
  background: var(--panel-strong);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(0, 0, 0, 0.42);
}

.credits-card .mark {
  margin: 0 0 22px;
  font-size: 56px;
  letter-spacing: 0.34em;
  text-align: left;
}

.credits > div {
  padding: 11px 14px;
  border-top: 1px solid rgba(246, 246, 242, 0.16);
}

.credits > div:last-child {
  border-bottom: 1px solid rgba(246, 246, 242, 0.16);
}

#credits-back {
  width: 168px;
  min-height: 52px;
  margin-top: 24px;
}

#pause > .screen-overline {
  width: min(380px, 88vw);
  margin-bottom: 16px;
}

#pause > .tag {
  margin: 0 0 22px;
  font-size: 34px;
  letter-spacing: 0.24em;
}

#pause > .menu {
  width: min(380px, 88vw);
  gap: 8px;
}

.flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
}

.flash.black { box-shadow: inset 0 0 80px 28px #000; background: rgba(0, 0, 0, 0.18); }
.flash.white { box-shadow: inset 0 0 90px 30px #fff; background: rgba(255, 255, 255, 0.2); }

.dialog {
  width: min(360px, 88vw);
  padding: 28px 22px;
  border: 1px solid var(--hairline-strong);
  border-top: 3px solid var(--paper);
  background: var(--panel-strong);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.28);
  text-align: center;
}

.dialog p {
  letter-spacing: 0.12em;
  line-height: 1.7;
}

.hidden { display: none !important; }

@media (hover: hover) and (pointer: fine) {
  button:not(:disabled):hover {
    transform: translate(-1px, -1px);
    border-color: var(--hairline-strong);
    background: rgba(240, 240, 237, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 3px 3px 0 rgba(0, 0, 0, 0.28);
  }

  button.primary:not(:disabled):hover {
    background: #fff;
    color: var(--void);
    box-shadow: inset 0 0 0 1px rgba(7, 9, 10, 0.72), 5px 5px 0 rgba(0, 0, 0, 0.38);
  }

  .menu > button:hover::after { width: 28px; }

  .title-card .menu > button:not(:disabled):hover {
    transform: translateX(-4px);
    border-left-color: var(--paper-muted);
    border-bottom-color: var(--hairline-strong);
    background: rgba(246, 246, 242, 0.11);
    box-shadow: inset 14px 0 0 rgba(246, 246, 242, 0.025), 4px 4px 0 rgba(0, 0, 0, 0.24);
  }

  .title-card .menu > button.primary:not(:disabled):hover {
    background: #fff;
    color: var(--void);
    box-shadow: inset 0 0 0 1px rgba(7, 9, 10, 0.72), 7px 7px 0 rgba(0, 0, 0, 0.38);
  }

  .title-card .menu > button:hover::after {
    width: 9px;
    transform: translate(3px, -50%) rotate(45deg);
  }
}

@media (min-width: 560px) {
  .rules { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 559px) {
  #title {
    align-items: center;
    padding-inline: 12px;
  }
  #title::after {
    right: 12px;
    bottom: max(18px, env(safe-area-inset-bottom));
    width: calc(100% - 24px);
  }
  .title-card {
    width: 100%;
    margin: 0 0 max(22px, env(safe-area-inset-bottom));
    padding: 24px 0 16px;
    text-align: center;
  }
  .title-card::before { top: 13px; right: 28px; }
  .title-card::after { top: 9px; right: 14px; }
  .title-card .tag { margin-bottom: 20px; }
  .title-signal {
    width: min(360px, 100%);
    gap: 8px;
    margin-bottom: 10px;
    font-size: 8px;
  }
  .title-card .menu { width: min(360px, 100%); gap: 8px; margin-inline: auto; }
  .title-card .menu > button {
    min-height: 54px;
    padding-right: 28px;
    padding-left: 42px;
    font-size: 13px;
  }
  #btn-start,
  #btn-continue {
    min-height: 60px;
    font-size: 15px;
  }
  .title-footnote {
    width: min(360px, 100%);
    margin-top: 12px;
    font-size: 7px;
  }
  .mark { font-size: 54px; }
  #guide { padding-inline: 14px; }
  .guide-card {
    width: 100%;
    padding: 24px 22px 22px;
  }
  .guide-card .screen-overline { margin-bottom: 18px; }
  .guide-title { font-size: 27px; }
  .guide-body { font-size: 14px; line-height: 1.75; }
  .guide-card > .menu { grid-template-columns: 1fr; margin-top: 20px; }
  .guide-card > .menu button { min-height: 50px; }
  .line { font-size: 20px; }
  .level-intro { top: 34%; }
  #level-intro-name { font-size: 27px; }
  #chapters { padding-inline: 14px; }
  .chapter-heading { width: 100%; margin-bottom: 16px; padding: 14px 0 0 12px; }
  .chapter-title { font-size: 26px; }
  .chapter-grid { grid-template-columns: 1fr; width: 100%; }
  .chapter-item { min-height: 86px; grid-template-columns: 46px minmax(0, 1fr) auto; padding: 11px 12px; }
  .chapter-name { font-size: 14px; }
  .chapter-thumb { inset-inline-start: 48%; width: 52%; }
  .chapter-state { max-width: 5.5em; text-align: right; white-space: nowrap; }
  .chapter-back { width: 100%; margin-top: 16px; padding-bottom: 12px; }
  .chapter-back button { width: 100%; }
  .settings-card {
    width: 100%;
    padding: 24px 22px 22px;
  }
  .settings-card .tag { margin-bottom: 12px; font-size: 28px; }
  .settings-card .setting { min-height: 46px; padding-block: 8px; }
  .settings-back { margin-top: 18px; }
  .credits-card { width: 100%; padding: 24px 22px 22px; }
  .credits-card .mark { margin-bottom: 18px; font-size: 46px; }
  .credits > div { padding: 9px 10px; font-size: 12px; }
  #credits-back { width: 100%; margin-top: 20px; }
  #pause { padding-inline: 14px; }
  #pause > .screen-overline { width: 100%; }
  #pause > .menu { width: 100%; }
  #hud { left: 12px; top: max(10px, env(safe-area-inset-top)); font-size: 13px; }
  .control-state {
    right: max(64px, calc(env(safe-area-inset-right) + 56px));
    top: max(10px, env(safe-area-inset-top));
    min-width: 124px;
    transform: scale(0.92);
    transform-origin: top right;
  }
  #objective {
    left: 12px;
    top: calc(max(10px, env(safe-area-inset-top)) + 48px);
    width: min(280px, calc(100vw - 128px));
  }
  #objective-text { font-size: 12px; }
  #stick { bottom: max(82px, calc(env(safe-area-inset-bottom) + 66px)); transform: scale(0.84); transform-origin: left bottom; }
  #hands { transform: scale(0.88); transform-origin: right bottom; }
  #shadow-action { right: max(14px, env(safe-area-inset-right)); }
  .shadow-console { right: max(14px, env(safe-area-inset-right)); width: min(204px, calc(100vw - 28px)); }
  #shadow-switch { right: max(78px, calc(env(safe-area-inset-right) + 64px)); }
  .nearby-prompt { right: 10px; bottom: max(92px, calc(env(safe-area-inset-bottom) + 78px)); width: min(184px, calc(100vw - 20px)); }
  #views { top: calc(max(10px, env(safe-area-inset-top)) + 48px); right: max(10px, env(safe-area-inset-right)); }
}

@media (max-width: 559px) and (max-height: 680px) {
  #guide {
    justify-content: flex-start;
    overflow-y: auto;
    padding-top: 14px;
    padding-bottom: 14px;
  }
  #guide .guide-card {
    margin-block: 0;
  }
  #guide .guide-card .screen-overline {
    margin-bottom: 10px;
    padding-bottom: 6px;
  }
  #guide .guide-card .eyebrow { margin-bottom: 4px; }
  #guide .guide-title {
    margin-bottom: 6px;
    font-size: 22px;
  }
  #guide .guide-body {
    margin-bottom: 12px;
    font-size: 12px;
    line-height: 1.55;
  }
  #guide .rules {
    gap: 4px;
    margin-bottom: 12px;
  }
  #guide .rule {
    min-height: 0;
    padding: 7px 9px;
    gap: 1px;
  }
  #guide .rule strong { font-size: 12px; }
  #guide .rule span { font-size: 10px; line-height: 1.3; }
  #guide .guide-card > .menu {
    gap: 6px;
    margin-top: 12px;
  }

  .title-card {
    margin-bottom: max(8px, env(safe-area-inset-bottom));
    padding-top: 12px;
    padding-bottom: 8px;
  }
  .title-card::before,
  .title-card::after { display: none; }
  .title-card .eyebrow { margin-bottom: 5px; }
  .title-card .mark { margin-bottom: 5px; font-size: 44px; }
  .title-card .tag { margin-bottom: 12px; font-size: 13px; }
  .title-signal { margin-bottom: 8px; }
  .title-card .menu { gap: 6px; }
  .title-card .menu > button { min-height: 42px; }
  #btn-start,
  #btn-continue { min-height: 46px; }
  .title-footnote { margin-top: 8px; }

  .settings-card {
    padding: 16px 16px 12px;
  }
  .settings-card .screen-overline {
    margin-bottom: 10px;
    padding-bottom: 6px;
  }
  .settings-card .tag {
    margin-bottom: 8px;
    font-size: 24px;
  }
  .settings-card .setting {
    min-height: 38px;
    padding-block: 4px;
  }
  .settings-card .setting > button,
  .settings-card .setting > span button {
    min-height: 32px;
    padding: 5px 9px;
  }
  .settings-card input[type="range"] { height: 14px; }
  .settings-card input[type="checkbox"] { width: 16px; height: 16px; }
  .settings-back { margin-top: 10px; }
  .settings-back button { min-height: 44px; }
}

@media (max-height: 720px) {
  #settings,
  #clear-card { justify-content: flex-start; }
  .settings-card > .tag,
  #clear-card > .eyebrow { margin-top: 8px; }
  .setting { margin-block: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .overlay.open > *,
  .level-intro.reveal,
  #title.open .title-card .menu > button { animation-duration: 1ms; animation-iteration-count: 1; }
}

#game,
#game * {
  letter-spacing: 0 !important;
}
