/*
 * NIGHT JOURNEY SHELL
 * 전투 로직과 Canvas HUD는 건드리지 않는다. 이 파일은 여정용 HTML 층만 소유한다.
 * 결과 화면은 모달이 아니라, 끝난 전장 위에 이어지는 한 장의 새벽 장면이다.
 */

.page-night {
  --night-paper: #efe1c4;
  --night-paper-dim: #c7b38f;
  --night-ink: #17130f;
  --night-shadow: #06070a;
  --night-line: rgba(239, 225, 196, .22);
  --result-accent: #e9b960;
  --result-accent-hot: #ffd58a;
  --result-horizon: #9c573d;
  --result-deep: #15121a;
  --safe-top: max(18px, env(safe-area-inset-top));
  --safe-right: max(18px, env(safe-area-inset-right));
  --safe-bottom: max(18px, env(safe-area-inset-bottom));
  --safe-left: max(18px, env(safe-area-inset-left));
  position: fixed;
  inset: 0;
  color: var(--night-paper);
  background: #090b10;
  font-family: "Noto Sans KR Variable", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  overscroll-behavior: none;
}

.page-night::before,
.page-night::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.page-night::before {
  background:
    linear-gradient(180deg, rgba(4, 7, 13, .12), transparent 22%, transparent 72%, rgba(2, 3, 6, .3)),
    radial-gradient(ellipse at 50% 47%, transparent 58%, rgba(1, 2, 4, .25) 100%);
}

.page-night::after {
  display: none;
}

.page-night #game {
  isolation: isolate;
  background: #090b10;
}

.page-night #game::before {
  background: none;
}

.page-night #game[data-fit="framed"] canvas {
  border-radius: 0;
  box-shadow:
    0 0 0 1px rgba(211, 184, 133, .4),
    0 0 0 4px #090b10;
}

.page-night #game[data-fit="snug"] canvas {
  border-radius: 0;
  box-shadow: none;
}

.page-night #game canvas {
  filter: saturate(.96) contrast(1.035);
}

/* 모든 밤이 공유하는 일시정지 음량 조절. 설정값은 전투 씬이 저장하고,
   이 DOM은 현재 밤에만 종속되지 않는 한 개의 조작면을 제공한다. */
.page-night #audio-control {
  position: fixed;
  z-index: 310;
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  display: grid;
  grid-template-columns: auto minmax(110px, 180px) 44px;
  align-items: center;
  gap: 9px 12px;
  box-sizing: border-box;
  min-width: min(390px, calc(100vw - 36px));
  padding: 12px 14px;
  color: var(--night-paper);
  border: 1px solid rgba(233, 185, 96, .48);
  border-radius: 5px;
  background: rgba(13, 16, 24, .96);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .48);
  pointer-events: auto;
}

.page-night #audio-control[hidden] { display: none; }

.page-night #audio-control button {
  grid-row: 1 / span 2;
  min-height: 42px;
  padding: 0 14px;
  color: #17130f;
  border: 1px solid var(--result-accent-hot);
  border-radius: 3px;
  background: var(--result-accent);
  font: 800 13px/1 "Noto Sans KR Variable", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  cursor: pointer;
}

.page-night #audio-control[data-muted="true"] button {
  color: var(--night-paper);
  border-color: rgba(239, 225, 196, .36);
  background: #292b31;
}

.page-night #audio-control button:hover,
.page-night #audio-control button:focus-visible,
.page-night #audio-control input:focus-visible {
  outline: 2px solid var(--night-paper);
  outline-offset: 2px;
}

.page-night #audio-control label {
  grid-column: 2;
  color: var(--night-paper-dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
}

.page-night #audio-control input {
  grid-column: 2;
  width: 100%;
  accent-color: var(--result-accent);
  cursor: pointer;
}

.page-night #audio-control output {
  grid-column: 3;
  grid-row: 1 / span 2;
  color: var(--night-paper);
  font: 700 13px/1 ui-monospace, Consolas, monospace;
  text-align: right;
}

@media (max-width: 560px) {
  .page-night #audio-control {
    left: var(--safe-left);
    right: var(--safe-right);
    min-width: 0;
    grid-template-columns: auto minmax(80px, 1fr) 40px;
  }
}

/* Chrome가 표준 Gamepad 진동을 내주지 않는 USB DualSense용 직접 연결. */
.page-night #dualsense-rumble {
  position: fixed;
  z-index: 36;
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  display: grid;
  justify-items: end;
  gap: 5px;
  max-width: min(300px, calc(100vw - 36px));
  pointer-events: auto;
}

.page-night #dualsense-rumble[hidden] { display: none; }

.page-night #dualsense-rumble button {
  min-height: 38px;
  padding: 0 14px;
  color: #eadfc9;
  border: 1px solid rgba(233, 185, 96, .54);
  border-radius: 4px;
  background: rgba(13, 16, 24, .9);
  box-shadow: 0 5px 20px rgba(0, 0, 0, .38);
  font: 700 12px/1 "Noto Sans KR Variable", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  letter-spacing: .04em;
  cursor: pointer;
}

.page-night #dualsense-rumble button:hover,
.page-night #dualsense-rumble button:focus-visible {
  color: #fff3da;
  border-color: var(--result-accent-hot);
  outline: none;
}

.page-night #dualsense-rumble button:disabled { cursor: wait; opacity: .72; }
.page-night #dualsense-rumble span {
  color: rgba(239, 225, 196, .7);
  font-size: 10px;
  letter-spacing: .025em;
  text-shadow: 0 1px 3px #000;
}
.page-night #dualsense-rumble[data-state="connected"] button {
  color: #dff0d1;
  border-color: rgba(145, 181, 120, .82);
}
.page-night #dualsense-rumble[data-state="error"] button {
  color: #ffd8ca;
  border-color: rgba(214, 116, 86, .82);
}

/* 오류/직접 진입: 개발 도구로 새지 않고 여정 안에서 복귀시킨다. */
.page-night #note {
  position: fixed;
  inset: 0;
  z-index: 80;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 12px;
  padding:
    var(--safe-top)
    max(7vw, var(--safe-right))
    max(9vh, var(--safe-bottom))
    max(7vw, var(--safe-left));
  color: var(--night-paper-dim);
  font-size: clamp(14px, 1.35vw, 18px);
  line-height: 1.85;
  text-align: left;
  background:
    linear-gradient(90deg, rgba(6, 8, 12, .98) 0 42%, rgba(6, 8, 12, .86) 68%, rgba(6, 8, 12, .72)),
    radial-gradient(circle at 80% 18%, rgba(128, 73, 43, .22), transparent 36%),
    #090b10;
}

.page-night #note::before {
  content: "이어지지 않은 밤";
  display: block;
  width: min(520px, 86vw);
  padding-bottom: 16px;
  color: var(--result-accent);
  border-bottom: 1px solid rgba(233, 185, 96, .48);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .26em;
}

.page-night #note strong,
.page-night #note b {
  color: var(--night-paper);
  font-size: clamp(22px, 3vw, 40px);
  line-height: 1.3;
}

.page-night #note span {
  display: block;
  max-width: 560px;
}

.page-night #note a {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: min(280px, 78vw);
  min-height: 48px;
  box-sizing: border-box;
  margin-top: 10px;
  padding: 10px 18px;
  color: #17130f;
  border: 0;
  border-radius: 0;
  background: var(--result-accent);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, .44);
  font-weight: 700;
  text-decoration: none;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

.page-night #note a::after {
  content: "→";
  margin-left: 20px;
}

.page-night #note a:hover {
  color: #17130f;
  border: 0;
  background: var(--result-accent-hot);
}

.page-night #note a:focus-visible {
  outline: 3px solid var(--night-paper);
  outline-offset: 4px;
}

/* 존 타이틀: Canvas의 동일 문자열은 nightboot가 비운다. */
.page-night #ntitle {
  position: fixed;
  z-index: 18;
  top: clamp(72px, 12vh, 132px);
  right: auto;
  bottom: auto;
  left: max(28px, calc((100vw - min(92vw, 1520px)) / 2));
  width: auto;
  max-width: min(620px, 74vw);
  display: grid;
  grid-template-columns: 4px auto;
  grid-template-rows: auto auto auto;
  align-items: center;
  column-gap: 16px;
  row-gap: 2px;
  text-align: left;
  filter: none;
  pointer-events: none;
  animation: night-title-pass 3.55s cubic-bezier(.2, .75, .15, 1) both;
}

.page-night #ntitle::before {
  content: "";
  grid-column: 1;
  grid-row: 1 / 5;
  align-self: stretch;
  background: linear-gradient(180deg, transparent, var(--result-accent) 16% 82%, transparent);
  box-shadow: 0 0 18px rgba(233, 185, 96, .18);
}

.page-night #ntitle .title-kicker {
  grid-column: 2;
  color: rgba(233, 185, 96, .88);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .32em;
}

.page-night #ntitle .no {
  grid-column: 2;
  color: rgba(239, 225, 196, .62);
  font-size: clamp(11px, 1.05vw, 14px);
  letter-spacing: .18em;
  text-indent: 0;
  text-shadow: 0 2px 4px #000;
}

.page-night #ntitle .nm {
  grid-column: 2;
  color: var(--night-paper);
  font-size: clamp(30px, 4.3vw, 62px);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.14;
  text-indent: 0;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .65), 0 10px 32px #000;
}

.page-night #ntitle .rule {
  display: none;
}

@keyframes night-title-pass {
  0% { opacity: 0; transform: translateX(-18px); }
  13% { opacity: 1; transform: translateX(0); }
  76% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(12px); }
}

/* ── 결과: 전면 새벽 장면 ───────────────────────────────────── */
.page-night #nightend {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: block;
  overflow: hidden auto;
  color: var(--night-paper);
  background:
    linear-gradient(180deg, rgba(4, 6, 11, .18) 0%, rgba(7, 8, 12, .48) 44%, rgba(7, 8, 11, .94) 100%);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  isolation: isolate;
  animation: result-veil-in .42s steps(6, end) both;
}

.page-night #nightend[data-result="down"] {
  --result-accent: #c98267;
  --result-accent-hot: #e6aa87;
  --result-horizon: #713b38;
  --result-deep: #171116;
}

.page-night #nightend[data-result="rescue"] {
  --result-accent: #e7c66f;
  --result-accent-hot: #ffe29a;
  --result-horizon: #6f765b;
  --result-deep: #101619;
}

.page-night #nightend::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(5, 6, 9, .96) 0%, rgba(5, 6, 9, .72) 46%, rgba(5, 6, 9, .2) 74%, rgba(5, 6, 9, .42) 100%),
    linear-gradient(180deg, transparent 54%, rgba(4, 5, 7, .82) 84%);
}

.page-night #nightend::after {
  display: none;
}

.page-night .dawn,
.page-night .dawn > span {
  position: absolute;
  pointer-events: none;
}

.page-night .dawn {
  z-index: 0;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(4, 8, 17, .34) 0 28%, rgba(53, 40, 48, .52) 61%, var(--result-horizon) 100%);
}

.page-night .dawn-glow {
  right: -10vw;
  bottom: -26vw;
  width: 76vw;
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: .54;
  background: radial-gradient(circle, color-mix(in srgb, var(--result-accent) 70%, white) 0 7%, color-mix(in srgb, var(--result-accent) 44%, transparent) 22%, transparent 66%);
  animation: dawn-breathe 4.6s ease-in-out both;
}

.page-night .dawn-sun {
  right: clamp(70px, 17vw, 290px);
  bottom: clamp(168px, 24vh, 270px);
  width: clamp(54px, 7vw, 104px);
  aspect-ratio: 1;
  border: 3px solid var(--result-accent-hot);
  border-radius: 50%;
  box-shadow:
    0 0 0 8px rgba(7, 8, 12, .42),
    0 0 0 10px color-mix(in srgb, var(--result-accent) 52%, transparent),
    0 0 60px color-mix(in srgb, var(--result-accent) 46%, transparent);
  animation: dawn-rise 1.5s cubic-bezier(.2, .8, .2, 1) both;
}

.page-night #nightend[data-result="down"] .dawn-sun {
  border-style: dashed;
  opacity: .66;
}

.page-night #nightend[data-result="rescue"] .dawn-sun {
  box-shadow:
    0 0 0 8px rgba(7, 8, 12, .34),
    0 0 0 10px color-mix(in srgb, var(--result-accent) 68%, transparent),
    0 0 82px color-mix(in srgb, var(--result-accent) 62%, transparent);
}

.page-night .dawn-ridge {
  right: -4vw;
  bottom: -5vh;
  left: 34vw;
  height: 40vh;
  transform-origin: 50% 100%;
  clip-path: polygon(0 72%, 8% 58%, 16% 64%, 25% 44%, 32% 55%, 42% 32%, 51% 53%, 61% 38%, 70% 57%, 79% 41%, 89% 55%, 100% 35%, 100% 100%, 0 100%);
}

.page-night .ridge-far {
  opacity: .7;
  background: color-mix(in srgb, var(--result-deep) 74%, var(--result-horizon));
  animation: ridge-rise .72s steps(7, end) both;
}

.page-night .ridge-near {
  right: -9vw;
  bottom: -12vh;
  left: 28vw;
  height: 38vh;
  opacity: .96;
  background: var(--result-deep);
  clip-path: polygon(0 63%, 10% 51%, 18% 59%, 27% 42%, 38% 62%, 48% 48%, 59% 64%, 67% 47%, 76% 57%, 87% 39%, 100% 58%, 100% 100%, 0 100%);
  animation: ridge-rise .62s steps(6, end) .08s both;
}

.page-night .dawn-grain {
  display: none;
}

.page-night .result-shell {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(150px, 18vw, 240px);
  grid-template-rows: minmax(190px, 1fr) auto auto;
  column-gap: clamp(28px, 5vw, 88px);
  width: min(1520px, 100%);
  min-height: 100dvh;
  box-sizing: border-box;
  margin: 0 auto;
  padding:
    max(7vh, var(--safe-top))
    max(5vw, var(--safe-right))
    max(4vh, var(--safe-bottom))
    max(5vw, var(--safe-left));
}

.page-night .result-copy {
  align-self: end;
  max-width: 900px;
  padding-bottom: clamp(24px, 4vh, 54px);
  animation: result-copy-in .62s cubic-bezier(.16, .76, .24, 1) .12s both;
}

.page-night .result-chapter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 clamp(18px, 3vh, 32px);
  color: var(--night-paper-dim);
  font-size: clamp(11px, 1vw, 14px);
  font-weight: 700;
  letter-spacing: .2em;
}

.page-night .result-chapter i {
  width: 26px;
  height: 1px;
  background: var(--result-accent);
  box-shadow: 0 0 10px color-mix(in srgb, var(--result-accent) 44%, transparent);
}

.page-night .result-kind {
  margin: 0 0 8px;
  color: var(--result-accent);
  font-size: clamp(12px, 1.05vw, 15px);
  font-weight: 700;
  letter-spacing: .28em;
}

.page-night #nightend h1 {
  max-width: 980px;
  margin: 0;
  padding: 0;
  color: #fff0d3;
  border: 0;
  font-size: clamp(42px, 6.1vw, 88px);
  font-weight: 700;
  letter-spacing: -.045em;
  line-height: 1.06;
  text-wrap: balance;
  text-shadow: 0 4px 0 rgba(0, 0, 0, .58), 0 14px 46px rgba(0, 0, 0, .72);
}

.page-night .result-summary {
  max-width: 700px;
  margin: 17px 0 0;
  color: rgba(239, 225, 196, .74);
  font-size: clamp(14px, 1.3vw, 19px);
  line-height: 1.7;
}

.page-night .result-boss-record {
  max-width: 920px;
  margin: 11px 0 0;
  padding-left: 12px;
  border-left: 2px solid var(--result-accent);
  color: rgba(255, 231, 184, .88);
  font-size: clamp(11px, 1vw, 14px);
  line-height: 1.55;
  letter-spacing: .025em;
}

.page-night .result-mark {
  align-self: end;
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-bottom: clamp(28px, 5vh, 66px);
  color: var(--result-accent);
  animation: result-mark-in .8s steps(8, end) .16s both;
}

.page-night .mark-orbit {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(118px, 13vw, 190px);
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--result-accent) 64%, transparent);
  border-radius: 50%;
  box-shadow: inset 0 0 0 9px rgba(4, 5, 8, .36);
}

.page-night .mark-orbit::before,
.page-night .mark-orbit::after {
  content: "";
  position: absolute;
  background: var(--result-accent);
}

.page-night .mark-orbit::before {
  top: -12px;
  bottom: -12px;
  left: 50%;
  width: 1px;
  opacity: .52;
}

.page-night .mark-orbit::after {
  top: 50%;
  right: -12px;
  left: -12px;
  height: 1px;
  opacity: .52;
}

.page-night .mark-core {
  position: relative;
  z-index: 1;
  width: 48%;
  aspect-ratio: 1;
  border: 5px solid var(--result-accent-hot);
  border-radius: 50%;
  background: rgba(7, 8, 11, .72);
  box-shadow: 0 0 24px color-mix(in srgb, var(--result-accent) 34%, transparent);
}

.page-night .mark-core::before,
.page-night .mark-core::after {
  content: "";
  position: absolute;
  right: -17px;
  left: -17px;
  height: 3px;
  background: var(--result-accent);
}

.page-night .mark-core::before { top: 34%; }
.page-night .mark-core::after { bottom: 28%; }

.page-night #nightend[data-result="down"] .mark-core {
  border-style: dashed;
  border-width: 4px;
  transform: rotate(-12deg);
}

.page-night #nightend[data-result="down"] .mark-core::after {
  right: -8px;
  bottom: -8px;
  left: 44%;
  width: 3px;
  height: calc(100% + 16px);
  transform: rotate(31deg);
}

.page-night #nightend[data-result="rescue"] .mark-core::before {
  top: 23%;
  right: auto;
  left: 19%;
  width: 36%;
  height: 36%;
  border: 3px solid var(--result-accent-hot);
  border-radius: 50%;
  background: transparent;
}

.page-night #nightend[data-result="rescue"] .mark-core::after {
  right: 16%;
  bottom: 17%;
  left: auto;
  width: 30%;
  height: 30%;
  border: 3px solid var(--result-accent-hot);
  border-radius: 50%;
  background: transparent;
}

.page-night .mark-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .32em;
  text-indent: .32em;
}

.page-night .result-metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-top: 2px solid var(--result-accent);
  border-bottom: 1px solid var(--night-line);
  background: rgba(5, 6, 9, .68);
  animation: result-metrics-in .55s steps(7, end) .28s both;
}

.page-night .metric {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  min-width: 0;
  padding: clamp(15px, 2.2vw, 28px) clamp(15px, 2.6vw, 38px);
}

.page-night .metric + .metric {
  border-left: 1px solid var(--night-line);
}

.page-night .metric dt {
  grid-column: 1;
  align-self: end;
  margin: 0;
  color: rgba(239, 225, 196, .72);
  font-size: clamp(12px, 1vw, 15px);
  font-weight: 700;
  letter-spacing: .08em;
}

.page-night .metric-no {
  margin-right: 8px;
  color: var(--result-accent);
  font-size: 10px;
  letter-spacing: .12em;
}

.page-night .metric dd {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: center;
  margin: 0 0 0 18px;
  color: #fff0d3;
  font-family: inherit;
  font-size: clamp(34px, 4.2vw, 62px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.045em;
  line-height: 1;
  text-shadow: 0 3px 0 #000;
}

.page-night .metric-unit {
  grid-column: 1;
  color: rgba(199, 179, 143, .56);
  font-size: clamp(10px, .8vw, 12px);
  letter-spacing: .03em;
}

.page-night .metric-cheese dd::before {
  content: "◆";
  margin-right: 8px;
  color: var(--result-accent);
  font-size: .35em;
  vertical-align: .42em;
}

.page-night .result-foot {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-top: clamp(18px, 2.6vh, 30px);
  animation: result-copy-in .46s ease .4s both;
}

.page-night .result-foot p {
  margin: 0;
  color: rgba(199, 179, 143, .64);
  font-size: clamp(11px, .9vw, 13px);
  letter-spacing: .06em;
}

.page-night #nightend button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 34px;
  min-width: clamp(210px, 18vw, 280px);
  min-height: 56px;
  padding: 13px 20px 13px 24px;
  color: #17130f;
  border: 0;
  border-radius: 0;
  background: var(--result-accent);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, .5);
  font: 700 clamp(14px, 1.1vw, 17px)/1.2 "Noto Sans KR Variable", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px));
  transition: transform 100ms steps(2, end), background-color 100ms linear, box-shadow 100ms steps(2, end);
}

.page-night #nightend button i {
  position: relative;
  width: 27px;
  height: 1px;
  background: currentColor;
}

.page-night #nightend button i::after {
  content: "";
  position: absolute;
  top: -4px;
  right: 0;
  width: 8px;
  height: 8px;
  border-top: 1px solid currentColor;
  border-right: 1px solid currentColor;
  transform: rotate(45deg);
}

.page-night #nightend button:hover {
  color: #17130f;
  background: var(--result-accent-hot);
  filter: none;
}

.page-night #nightend button:active {
  transform: translate(4px, 4px);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, .56);
}

.page-night #nightend button:focus-visible {
  outline: 3px solid #fff0d3;
  outline-offset: 5px;
}

.page-night #nightend[data-leaving="true"] button {
  pointer-events: none;
  opacity: .7;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@keyframes result-veil-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes result-copy-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes result-mark-in {
  from { opacity: 0; transform: scale(.82); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes result-metrics-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dawn-rise {
  from { opacity: 0; transform: translateY(84px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dawn-breathe {
  from { opacity: .18; transform: scale(.88); }
  to { opacity: .54; transform: scale(1); }
}

@keyframes ridge-rise {
  from { transform: translateY(40px); }
  to { transform: translateY(0); }
}

/* 세로 화면에서는 전장을 축소하지 않는다. 가로 전환 전까지 전용 안내가 전장을 덮는다. */
.rotate-hint {
  display: none;
}

/* 오류와 결과는 언제나 회전/입력 안내보다 먼저 읽힌다. */
.page-night #note:not([hidden]) ~ .rotate-hint,
.page-night #nightend:not([hidden]) ~ .rotate-hint {
  display: none !important;
}

/* 이 빌드의 능동 입력은 키보드다. 터치 전용 기기를 축소된 전장 안에 들여보내지 않는다. */
@media (orientation: portrait) and (max-width: 900px),
       (hover: none) and (pointer: coarse) and (max-width: 900px) {
  .rotate-hint {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 30px;
    box-sizing: border-box;
    padding: max(34px, env(safe-area-inset-top)) 30px max(34px, env(safe-area-inset-bottom));
    color: var(--night-paper);
    text-align: center;
    background:
      linear-gradient(180deg, rgba(13, 16, 23, .97), rgba(7, 8, 12, .99)),
      #090b10;
  }

  .rotate-hint::before {
    content: "";
    position: absolute;
    inset: 18px;
    border: 1px solid rgba(233, 185, 96, .22);
    pointer-events: none;
  }

  .rotate-device {
    position: relative;
    width: 104px;
    height: 58px;
    border: 3px solid var(--result-accent);
    box-shadow: 7px 7px 0 rgba(0, 0, 0, .44);
    animation: rotate-device-in 1.7s steps(5, end) infinite;
  }

  .rotate-device::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -27px;
    width: 15px;
    height: 15px;
    border-top: 2px solid var(--result-accent);
    border-left: 2px solid var(--result-accent);
    transform: translateY(-50%) rotate(-45deg);
  }

  .rotate-device::after {
    content: "";
    position: absolute;
    top: 50%;
    left: -24px;
    width: 28px;
    height: 28px;
    border: 2px solid transparent;
    border-top-color: var(--result-accent);
    border-radius: 50%;
    transform: translateY(-50%) rotate(-40deg);
  }

  .rotate-device span {
    position: absolute;
    top: 50%;
    right: 6px;
    width: 4px;
    height: 4px;
    border: 1px solid var(--result-accent);
    border-radius: 50%;
    transform: translateY(-50%);
  }

  .rotate-kicker {
    margin: 0 0 9px;
    color: var(--result-accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .26em;
  }

  .rotate-hint h2 {
    margin: 0;
    font-size: clamp(23px, 7vw, 34px);
    line-height: 1.35;
  }

  .rotate-hint p:last-child {
    max-width: 330px;
    margin: 12px auto 0;
    color: rgba(199, 179, 143, .72);
    font-size: 13px;
    line-height: 1.7;
  }

  @keyframes rotate-device-in {
    0%, 30% { transform: rotate(0); }
    60%, 100% { transform: rotate(-4deg); }
  }
}

@media (max-width: 760px) and (orientation: landscape) {
  .page-night .result-shell {
    grid-template-columns: minmax(0, 1fr) 108px;
    grid-template-rows: minmax(100px, 1fr) auto auto;
    column-gap: 24px;
    padding: 18px 28px 16px;
  }

  .page-night .result-copy,
  .page-night .result-mark {
    padding-bottom: 14px;
  }

  .page-night .result-chapter {
    margin-bottom: 8px;
  }

  .page-night #nightend h1 {
    font-size: clamp(31px, 7vw, 48px);
  }

  .page-night .result-summary {
    margin-top: 7px;
    font-size: 12px;
  }

  .page-night .mark-orbit {
    width: 82px;
  }

  .page-night .result-metrics {
    min-height: 76px;
  }

  .page-night .metric {
    padding: 10px 14px;
  }

  .page-night .metric dd {
    font-size: 30px;
  }

  .page-night .metric-unit,
  .page-night .mark-label {
    display: none;
  }

  .page-night .result-foot {
    padding-top: 11px;
  }

  .page-night #nightend button {
    min-width: 190px;
    min-height: 45px;
  }
}

@media (max-height: 620px) and (orientation: landscape) {
  .page-night .result-shell {
    grid-template-rows: minmax(130px, 1fr) auto auto;
    padding-top: 22px;
    padding-bottom: 16px;
  }

  .page-night .result-copy,
  .page-night .result-mark {
    padding-bottom: 16px;
  }

  .page-night .result-chapter {
    margin-bottom: 9px;
  }

  .page-night #nightend h1 {
    font-size: clamp(34px, 5.4vw, 60px);
  }

  .page-night .result-summary {
    margin-top: 8px;
    font-size: 13px;
  }

  .page-night .mark-orbit {
    width: 98px;
  }

  .page-night .metric {
    padding-top: 11px;
    padding-bottom: 11px;
  }

  .page-night .metric dd {
    font-size: clamp(30px, 4vw, 44px);
  }

  .page-night .result-foot {
    padding-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-night #ntitle,
  .page-night #nightend,
  .page-night .result-copy,
  .page-night .result-mark,
  .page-night .result-metrics,
  .page-night .result-foot,
  .page-night .dawn-glow,
  .page-night .dawn-sun,
  .page-night .dawn-ridge,
  .rotate-device {
    animation: none !important;
  }
}

@media (forced-colors: active) {
  .page-night #nightend,
  .page-night #note,
  .rotate-hint {
    forced-color-adjust: auto;
    background: Canvas;
    color: CanvasText;
  }

  .page-night #nightend button,
  .page-night #note a {
    border: 2px solid ButtonText;
  }
}
/* 개발자 밤 점프 — H로만 호출하며 기본 플레이 화면에는 흔적을 남기지 않는다. */
.page-night #night-jump {
  position: fixed;
  z-index: 1200;
  inset: 22px 22px auto auto;
  width: min(560px, calc(100vw - 44px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 18px;
  color: #eadfc9;
  background: rgba(12, 9, 7, .97);
  border: 2px solid #8d633f;
  box-shadow: 0 18px 60px #000b;
  font-family: "Noto Sans KR Variable", "Noto Sans KR", "Malgun Gothic", system-ui, sans-serif;
}
.page-night #night-jump header { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:16px; }
.page-night #night-jump header div { display:grid; gap:3px; }
.page-night #night-jump header nav { display:flex; gap:8px; }
.page-night #night-jump small { color:#9f8465; font-size:11px; font-weight:800; letter-spacing:.15em; }
.page-night #night-jump strong { font-size:24px; }
.page-night #night-jump button { font:inherit; color:inherit; cursor:pointer; }
.page-night #night-jump-close,
.page-night #night-jump-end { min-height:40px; padding:0 14px; border:1px solid #765238; background:#24180f; }
.page-night #night-jump-end { color:#e5bd68; border-color:#a47743; }
.page-night #night-jump-grid { display:grid; grid-template-columns:repeat(5, minmax(0, 1fr)); gap:8px; }
.page-night #night-jump-grid button { min-height:58px; display:grid; align-content:center; gap:2px; text-align:left; padding:8px 10px; border:1px solid #62462f; background:#21170f; }
.page-night #night-jump-grid button:hover,
.page-night #night-jump-grid button:focus-visible { border-color:#e5bd68; background:#3a2818; outline:none; }
.page-night #night-jump-grid button.current { border:2px solid #91b578; background:#213322; }
.page-night #night-jump-grid span { color:#e5bd68; font-size:16px; font-weight:850; }
.page-night #night-jump-grid b { overflow:hidden; color:#cdbb9d; font-size:11px; font-weight:600; text-overflow:ellipsis; white-space:nowrap; }
@media (max-width:760px) {
  .page-night #night-jump { inset:8px; width:auto; max-height:calc(100vh - 16px); padding:12px; }
  .page-night #night-jump-grid { grid-template-columns:repeat(5, minmax(0, 1fr)); gap:5px; }
  .page-night #night-jump-grid button { min-height:48px; padding:5px; }
  .page-night #night-jump-grid b { display:none; }
}
