/* ============================================================
   香源 · 午夜开工 — game UI
   ============================================================ */

:root {
  --xy-bg: #050607;
  --xy-panel: rgba(8, 9, 10, 0.92);
  --xy-ink: #ddd6c7;
  --xy-dim: #8d887d;
  --xy-faint: #57544d;
  --xy-yellow: #e6b45c;
  --xy-yellow-soft: #b98a3c;
  --xy-red: #b43a2a;
  --xy-red-bright: #e05a3e;
  --xy-green: #7d8a6a;
  --xy-line: rgba(220, 210, 190, 0.16);
  --xy-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --xy-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --xy-mono: "Geist Mono", "Noto Sans Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--xy-bg);
}

body {
  font-family: var(--xy-sans);
  color: var(--xy-ink);
}

.game-main {
  position: fixed;
  inset: 0;
  background: #000;
}

.game-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
  color: var(--xy-ink);
  user-select: none;
  -webkit-user-select: none;
}

.game-root.is-playing {
  cursor: none;
}

.game-root.phone-open {
  cursor: default;
}

.game-root.is-paused {
  cursor: default;
}

.game-root canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  outline: none;
}

.hidden {
  display: none !important;
}

/* ---------- boot ---------- */

.game-boot {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background:
    radial-gradient(circle at 50% 42%, rgba(70, 54, 28, 0.18), transparent 45%),
    #030405;
}

.game-boot-title {
  font-family: var(--xy-serif);
  font-size: clamp(54px, 9vw, 110px);
  letter-spacing: 0.28em;
  color: #d8cfbb;
  text-indent: 0.28em;
  opacity: 0.92;
}

.game-boot-line {
  width: 120px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--xy-yellow-soft), transparent);
}

.game-boot-text {
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--xy-dim);
}

/* ---------- loading ---------- */

.xy-loading {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(64, 46, 22, 0.22), transparent 52%),
    #030405;
}

.xy-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.018) 0,
    rgba(255, 255, 255, 0.018) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.5;
}

.xy-loading-inner {
  width: min(560px, 84vw);
  text-align: center;
  position: relative;
  z-index: 1;
}

.xy-loading-kicker {
  font-family: var(--xy-mono);
  font-size: 10px;
  letter-spacing: 0.5em;
  color: var(--xy-faint);
  margin-bottom: 20px;
}

.xy-loading-title {
  font-family: var(--xy-serif);
  font-size: clamp(58px, 10vw, 124px);
  line-height: 0.95;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: #e2d9c7;
  margin: 0;
  text-shadow: 0 0 40px rgba(230, 180, 92, 0.12);
}

.xy-loading-sub {
  margin-top: 12px;
  font-size: 12px;
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  color: var(--xy-yellow-soft);
}

.xy-progress {
  position: relative;
  height: 2px;
  margin: 56px 0 14px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.xy-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  background: linear-gradient(90deg, #6b4a22, var(--xy-yellow), #f0d39a);
  box-shadow: 0 0 18px rgba(230, 180, 92, 0.5);
  transition: width 0.25s ease;
}

.xy-progress-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  font-family: var(--xy-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--xy-dim);
}

.xy-progress-pct {
  color: var(--xy-yellow-soft);
}

/* ---------- menu ---------- */

.xy-menu {
  position: absolute;
  inset: 0;
  z-index: 40;
  overflow: hidden;
}

.xy-menu-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(2, 3, 4, 0.92) 0%, rgba(2, 3, 4, 0.66) 34%, rgba(2, 3, 4, 0.12) 68%, rgba(2, 3, 4, 0.45) 100%),
    linear-gradient(0deg, rgba(2, 3, 4, 0.9) 0%, transparent 34%, transparent 70%, rgba(2, 3, 4, 0.5) 100%);
  pointer-events: none;
}

.xy-menu::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.014) 0,
    rgba(255, 255, 255, 0.014) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: overlay;
  opacity: 0.6;
}

.xy-menu-content {
  position: absolute;
  left: clamp(28px, 8vw, 130px);
  top: 50%;
  transform: translateY(-52%);
  width: min(520px, 84vw);
  z-index: 2;
}

.xy-menu-kicker {
  font-family: var(--xy-mono);
  font-size: 10px;
  letter-spacing: 0.44em;
  color: var(--xy-yellow-soft);
  margin-bottom: 18px;
  opacity: 0.9;
}

.xy-menu-title {
  font-family: var(--xy-serif);
  font-size: clamp(78px, 12vw, 168px);
  line-height: 0.86;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  color: #e7dfcf;
  margin: 0;
  text-shadow:
    0 0 60px rgba(230, 180, 92, 0.18),
    0 10px 40px rgba(0, 0, 0, 0.8);
}

.xy-menu-sub {
  margin-top: 18px;
  font-family: var(--xy-serif);
  font-size: clamp(16px, 2vw, 24px);
  letter-spacing: 0.55em;
  text-indent: 0.55em;
  color: var(--xy-yellow);
}

.xy-menu-tag {
  margin: 26px 0 0;
  max-width: 430px;
  font-size: 13px;
  line-height: 2;
  letter-spacing: 0.08em;
  color: var(--xy-dim);
}

.xy-menu-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 36px;
}

.xy-btn {
  appearance: none;
  border: 1px solid rgba(220, 210, 190, 0.22);
  background: rgba(8, 9, 10, 0.55);
  color: var(--xy-ink);
  font-family: var(--xy-sans);
  font-size: 13px;
  letter-spacing: 0.24em;
  padding: 13px 24px;
  cursor: pointer;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
  backdrop-filter: blur(6px);
}

.xy-btn:hover {
  border-color: rgba(230, 180, 92, 0.65);
  color: #f2e8d5;
  background: rgba(30, 24, 14, 0.65);
  transform: translateY(-1px);
}

.xy-btn:active {
  transform: translateY(0);
}

.xy-btn-primary {
  border-color: rgba(230, 180, 92, 0.7);
  background: linear-gradient(180deg, rgba(120, 82, 34, 0.8), rgba(54, 38, 16, 0.85));
  color: #f7ecd7;
  box-shadow: 0 0 26px rgba(230, 180, 92, 0.12);
}

.xy-btn-primary:hover {
  background: linear-gradient(180deg, rgba(148, 102, 42, 0.9), rgba(70, 48, 20, 0.9));
}

.xy-menu-hint {
  margin-top: 22px;
  font-family: var(--xy-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--xy-faint);
}

.xy-panel {
  position: absolute;
  z-index: 6;
  left: clamp(28px, 8vw, 130px);
  top: 50%;
  transform: translateY(-50%);
  width: min(460px, 84vw);
  padding: 30px 32px;
  background: var(--xy-panel);
  border: 1px solid var(--xy-line);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
}

.xy-panel h2 {
  font-family: var(--xy-serif);
  font-size: 24px;
  letter-spacing: 0.2em;
  margin: 0 0 20px;
  color: #e5ddcc;
}

.xy-panel p,
.xy-panel li {
  font-size: 13px;
  line-height: 1.9;
  color: var(--xy-dim);
}

.xy-panel ul {
  margin: 0;
  padding-left: 18px;
}

.xy-panel .xy-key {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  margin-right: 6px;
  border: 1px solid rgba(220, 210, 190, 0.28);
  font-family: var(--xy-mono);
  font-size: 10px;
  color: var(--xy-yellow);
  text-align: center;
}

.xy-panel .xy-panel-close {
  margin-top: 24px;
}

.xy-panel .xy-panel-note {
  margin-top: 18px;
  font-family: var(--xy-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--xy-faint);
}

/* ---------- HUD ---------- */

.xy-hud {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.xy-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  margin-top: -13px;
  will-change: transform;
  opacity: 0.72;
}

.xy-crosshair::before,
.xy-crosshair::after {
  content: "";
  position: absolute;
  background: rgba(226, 217, 198, 0.72);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
}

.xy-crosshair::before {
  left: 12px;
  top: 5px;
  width: 2px;
  height: 16px;
}

.xy-crosshair::after {
  left: 5px;
  top: 12px;
  width: 16px;
  height: 2px;
}

.xy-crosshair span {
  position: absolute;
  left: 11px;
  top: 11px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(230, 180, 92, 0.85);
  box-shadow: 0 0 8px rgba(230, 180, 92, 0.5);
}

.xy-tooltip {
  position: absolute;
  left: 50%;
  top: 50%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 7px 8px;
  margin-left: 28px;
  margin-top: -38px;
  background: rgba(4, 5, 6, 0.82);
  border: 1px solid rgba(220, 210, 190, 0.18);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #ddd5c6;
  white-space: nowrap;
  backdrop-filter: blur(4px);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.xy-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.xy-tooltip .key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid rgba(230, 180, 92, 0.55);
  color: var(--xy-yellow);
  font-family: var(--xy-mono);
  font-size: 10px;
}

.xy-tooltip .label {
  color: #e2dacb;
}

.xy-subtitle {
  position: absolute;
  left: 50%;
  bottom: 8.5%;
  transform: translateX(-50%);
  width: min(760px, 82vw);
  text-align: center;
  font-size: 15px;
  line-height: 1.8;
  letter-spacing: 0.1em;
  color: #e6dece;
  text-shadow:
    0 2px 10px rgba(0, 0, 0, 0.95),
    0 0 22px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.xy-subtitle.visible {
  opacity: 1;
}

.xy-hint {
  position: absolute;
  left: 50%;
  bottom: 4.2%;
  transform: translateX(-50%);
  font-family: var(--xy-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: rgba(190, 182, 165, 0.72);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.xy-hint.visible {
  opacity: 1;
}

.xy-notify {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translate(-50%, -12px);
  min-width: 280px;
  max-width: min(440px, 84vw);
  padding: 11px 16px;
  background: rgba(8, 10, 11, 0.9);
  border: 1px solid rgba(220, 210, 190, 0.16);
  border-left: 2px solid var(--xy-yellow-soft);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  backdrop-filter: blur(8px);
}

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

.xy-notify .xy-notify-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--xy-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--xy-faint);
  margin-bottom: 4px;
}

.xy-notify .xy-notify-body {
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0.06em;
  color: #d8d0c1;
}

.xy-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.16) 82%, rgba(0, 0, 0, 0.42) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.14), transparent 16%, transparent 80%, rgba(0, 0, 0, 0.2));
  pointer-events: none;
}

.xy-chase {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse at center, transparent 42%, rgba(90, 8, 4, 0.22) 74%, rgba(60, 4, 2, 0.55) 100%);
  transition: opacity 0.6s ease;
}

.xy-chase.active {
  opacity: 1;
  animation: xy-chase-pulse 1.15s ease-in-out infinite;
}

@keyframes xy-chase-pulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.xy-flash {
  position: absolute;
  inset: 0;
  background: #dfe8ee;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

.xy-flash.red {
  background: #8e130c;
  mix-blend-mode: normal;
}

.xy-debug {
  position: absolute;
  left: 14px;
  bottom: 14px;
  padding: 6px 9px;
  border: 1px solid rgba(230, 180, 92, 0.35);
  background: rgba(0, 0, 0, 0.55);
  font-family: var(--xy-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--xy-yellow-soft);
}

.xy-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.8'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---------- phone ---------- */

.xy-phone {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(1.5px);
}

.xy-phone-frame {
  position: relative;
  width: min(330px, 84vw);
  height: min(650px, 86vh);
  padding: 10px;
  border-radius: 30px;
  background: linear-gradient(145deg, #17181a, #070808 55%, #101112);
  border: 1px solid #2a2b2d;
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.85),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.xy-phone-frame::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 5px;
  width: 62px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: #242526;
}

.xy-phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 22px;
  background:
    radial-gradient(circle at 50% 0%, rgba(80, 90, 80, 0.08), transparent 46%),
    linear-gradient(180deg, #0d1110, #070908);
  border: 1px solid #1d1f1e;
  display: flex;
  flex-direction: column;
}

.xy-phone-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 15px 8px;
  font-family: var(--xy-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #7f8a7e;
  border-bottom: 1px solid rgba(160, 180, 160, 0.08);
}

.xy-phone-status .xy-signal {
  color: #a46a55;
}

.xy-phone-status .xy-signal.full {
  color: #9fb18e;
}

.xy-phone-apps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 18px 16px 10px;
}

.xy-phone-app {
  appearance: none;
  border: 1px solid rgba(170, 185, 165, 0.14);
  background: rgba(28, 34, 29, 0.72);
  color: #b9c2b2;
  font-family: var(--xy-sans);
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 15px 6px 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.xy-phone-app:hover {
  background: rgba(48, 58, 46, 0.85);
  border-color: rgba(190, 205, 175, 0.3);
  color: #e0e6d8;
}

.xy-phone-app.active {
  border-color: rgba(210, 180, 110, 0.5);
  color: #e8d4a2;
  background: rgba(62, 52, 30, 0.65);
}

.xy-phone-app:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.xy-phone-content {
  flex: 1;
  overflow-y: auto;
  padding: 6px 18px 18px;
  color: #b7bfae;
  font-size: 12px;
  line-height: 1.8;
  scrollbar-width: thin;
  scrollbar-color: rgba(160, 180, 150, 0.25) transparent;
}

.xy-phone-content::-webkit-scrollbar {
  width: 4px;
}

.xy-phone-content::-webkit-scrollbar-thumb {
  background: rgba(160, 180, 150, 0.25);
}

.xy-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
}

.xy-clock-time {
  font-family: var(--xy-mono);
  font-size: 46px;
  letter-spacing: 0.04em;
  color: #d8dfc9;
  text-shadow: 0 0 24px rgba(180, 200, 160, 0.12);
}

.xy-clock-time.red {
  color: #e05a3e;
  text-shadow: 0 0 24px rgba(224, 90, 62, 0.35);
  animation: xy-clock-red 1s steps(2) infinite;
}

@keyframes xy-clock-red {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.72;
  }
}

.xy-clock-date {
  margin-top: 4px;
  font-family: var(--xy-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: #6f786a;
}

.xy-clock-note {
  margin-top: 26px;
  width: 100%;
  padding: 12px 14px;
  border-left: 1px solid rgba(180, 200, 165, 0.18);
  background: rgba(30, 36, 30, 0.45);
  font-size: 11px;
  line-height: 1.8;
  color: #8f9987;
}

.xy-notes {
  padding-top: 4px;
}

.xy-notes-title {
  margin: 10px 0 12px;
  font-family: var(--xy-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: #687264;
}

.xy-note {
  position: relative;
  padding: 10px 12px 10px 16px;
  margin-bottom: 8px;
  background: rgba(28, 34, 28, 0.55);
  border-left: 1px solid rgba(180, 200, 160, 0.14);
  color: #aab3a1;
  font-size: 11px;
  line-height: 1.7;
  animation: xy-note-in 0.3s ease both;
}

.xy-note::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 15px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #8d9a7e;
}

@keyframes xy-note-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.xy-call {
  padding-top: 10px;
}

.xy-call-status {
  margin: 16px 0;
  padding: 18px 14px;
  border: 1px dashed rgba(170, 185, 160, 0.18);
  text-align: center;
  font-family: var(--xy-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #8b9583;
}

.xy-call-status.ok {
  border-color: rgba(160, 190, 140, 0.3);
  color: #b9c9a8;
}

.xy-call-button {
  width: 100%;
  appearance: none;
  border: 1px solid rgba(190, 90, 70, 0.55);
  background: linear-gradient(180deg, rgba(90, 28, 20, 0.85), rgba(48, 16, 12, 0.9));
  color: #efd8cf;
  font-family: var(--xy-sans);
  font-size: 14px;
  letter-spacing: 0.18em;
  padding: 16px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.xy-call-button:hover:not(:disabled) {
  filter: brightness(1.18);
  transform: translateY(-1px);
}

.xy-call-button:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.xy-call-buttoncalling {
  animation: xy-call-pulse 1.2s ease-in-out infinite;
}

@keyframes xy-call-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.35);
  }
}

.xy-phone-dead {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #4f574b;
  font-family: var(--xy-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.xy-phone-dead .xy-dead-bolt {
  width: 28px;
  height: 48px;
  border: 1px solid #3a4036;
  position: relative;
}

.xy-phone-dead .xy-dead-bolt::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 8px;
  width: 8px;
  height: 30px;
  background: #3a4036;
  clip-path: polygon(60% 0, 0 55%, 45% 55%, 30% 100%, 100% 40%, 50% 40%);
}

.xy-phone-nav {
  width: 100%;
  padding: 8px 14px 12px;
  text-align: center;
  font-family: var(--xy-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  color: #4e574b;
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.xy-phone-nav:hover {
  color: #9aa88f;
}

/* ---------- paper ---------- */

.xy-paper {
  position: absolute;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
}

.xy-paper-sheet {
  position: relative;
  width: min(560px, 88vw);
  max-height: 80vh;
  overflow-y: auto;
  padding: 42px 46px 34px;
  background:
    linear-gradient(135deg, rgba(120, 100, 62, 0.14), transparent 36%),
    radial-gradient(circle at 80% 12%, rgba(90, 60, 25, 0.18), transparent 34%),
    #b8ae96;
  color: #2b271f;
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.8),
    inset 0 0 80px rgba(70, 50, 20, 0.25);
  transform: rotate(-0.7deg);
  font-family: var(--xy-serif);
}

.xy-paper-sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23p)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

.xy-paper-title {
  position: relative;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.12em;
  border-bottom: 1px solid rgba(40, 34, 24, 0.25);
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.xy-paper-body {
  position: relative;
  font-size: 15px;
  line-height: 2;
  white-space: pre-wrap;
  letter-spacing: 0.03em;
}

.xy-paper-body em {
  font-style: normal;
  color: #6d2b1c;
  font-weight: 700;
}

.xy-paper-foot {
  position: relative;
  margin-top: 26px;
  padding-top: 12px;
  border-top: 1px dashed rgba(40, 34, 24, 0.25);
  font-family: var(--xy-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  color: rgba(43, 39, 31, 0.55);
  text-align: right;
}

/* ---------- pause ---------- */

.xy-pause {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
}

.xy-pause-card {
  width: min(380px, 86vw);
  padding: 34px 36px;
  background: var(--xy-panel);
  border: 1px solid var(--xy-line);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.8);
  text-align: center;
}

.xy-pause-card h2 {
  font-family: var(--xy-serif);
  font-size: 28px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  margin: 0 0 10px;
  color: #e4dccd;
}

.xy-pause-card p {
  margin: 0 0 24px;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--xy-dim);
}

.xy-pause-card .xy-btn {
  width: 100%;
  margin-top: 8px;
}

/* ---------- ending ---------- */

.xy-ending {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 1.4s ease;
}

.xy-ending.visible {
  opacity: 1;
}

.xy-ending-letterbox {
  position: absolute;
  left: 0;
  right: 0;
  height: 9vh;
  background: #000;
  z-index: 1;
}

.xy-ending-letterbox.top {
  top: 0;
}

.xy-ending-letterbox.bottom {
  bottom: 0;
}

.xy-ending-content {
  position: relative;
  z-index: 2;
  width: min(680px, 86vw);
  text-align: center;
  padding: 0 20px;
}

.xy-ending-kicker {
  font-family: var(--xy-mono);
  font-size: 9px;
  letter-spacing: 0.5em;
  color: var(--xy-yellow-soft);
  margin-bottom: 18px;
}

.xy-ending-title {
  font-family: var(--xy-serif);
  font-size: clamp(30px, 5vw, 54px);
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  margin: 0 0 26px;
  color: #e8dfcd;
  text-shadow: 0 0 50px rgba(230, 180, 92, 0.16);
}

.xy-ending-text {
  font-size: 14px;
  line-height: 2.1;
  letter-spacing: 0.08em;
  color: #c9c1b1;
  white-space: pre-wrap;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}

.xy-ending-text .xy-ending-line {
  display: block;
  opacity: 0;
  transform: translateY(8px);
  animation: xy-ending-line 1.2s ease forwards;
}

@keyframes xy-ending-line {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.xy-ending-restart {
  margin-top: 38px;
  opacity: 0;
  animation: xy-ending-line 1s ease 2.4s forwards;
}

/* ---------- intro / chapter ---------- */

.xy-intro {
  position: absolute;
  inset: 0;
  z-index: 65;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  gap: 40px;
}

.xy-intro-sms {
  width: min(390px, 84vw);
  padding: 16px 18px;
  background: #0b0d0c;
  border: 1px solid rgba(160, 180, 150, 0.14);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.8);
  transform: translateY(10px);
  opacity: 0;
  animation: xy-intro-sms 0.8s ease 0.5s forwards;
}

@keyframes xy-intro-sms {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.xy-intro-sender {
  font-family: var(--xy-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  color: #6f7a6b;
  margin-bottom: 10px;
}

.xy-intro-text {
  font-size: 14px;
  line-height: 1.9;
  letter-spacing: 0.04em;
  color: #c7d0bc;
}

.xy-intro-time {
  margin-top: 10px;
  text-align: right;
  font-family: var(--xy-mono);
  font-size: 9px;
  color: #4e574b;
}

.xy-intro-skip {
  font-family: var(--xy-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: #4e4a42;
  opacity: 0;
  animation: xy-intro-skip 1s ease 1.8s forwards;
}

@keyframes xy-intro-skip {
  to {
    opacity: 1;
  }
}

.xy-chapter {
  position: absolute;
  inset: 0;
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0.28), transparent 60%);
  opacity: 0;
  transition: opacity 1s ease;
}

.xy-chapter.visible {
  opacity: 1;
}

.xy-chapter-num {
  font-family: var(--xy-mono);
  font-size: 10px;
  letter-spacing: 0.5em;
  color: var(--xy-yellow-soft);
  margin-bottom: 16px;
}

.xy-chapter h2 {
  font-family: var(--xy-serif);
  font-size: clamp(28px, 4.6vw, 52px);
  font-weight: 400;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  margin: 0;
  color: #e2d9c7;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.9);
}

/* ---------- cutscene ---------- */

.xy-cutscene {
  position: absolute;
  inset: 0;
  z-index: 62;
  pointer-events: none;
  background: transparent;
}

.xy-cutscene .xy-cutscene-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 10vh;
  background: #000;
}

.xy-cutscene .xy-cutscene-bar.top {
  top: 0;
}

.xy-cutscene .xy-cutscene-bar.bottom {
  bottom: 0;
}

.xy-cutscene .xy-cutscene-caption {
  position: absolute;
  left: 50%;
  bottom: 13vh;
  transform: translateX(-50%);
  width: min(700px, 84vw);
  text-align: center;
  font-family: var(--xy-serif);
  font-size: 16px;
  line-height: 1.9;
  letter-spacing: 0.12em;
  color: #d9d1c0;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.95);
  opacity: 0;
  transition: opacity 0.8s ease;
}

.xy-cutscene .xy-cutscene-caption.visible {
  opacity: 1;
}

.xy-fade {
  position: absolute;
  inset: 0;
  z-index: 66;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.xy-fade.visible {
  opacity: 1;
}

.xy-fade.solid {
  opacity: 1;
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .xy-menu-content {
    left: 24px;
    right: 24px;
    width: auto;
    top: 46%;
  }

  .xy-menu-title {
    font-size: clamp(66px, 20vw, 120px);
  }

  .xy-menu-tag {
    font-size: 12px;
    line-height: 1.9;
  }

  .xy-menu-buttons {
    gap: 8px;
  }

  .xy-btn {
    padding: 12px 16px;
    font-size: 12px;
    letter-spacing: 0.16em;
  }

  .xy-panel {
    left: 20px;
    right: 20px;
    width: auto;
    padding: 24px 22px;
  }

  .xy-phone-frame {
    width: min(300px, 90vw);
    height: min(600px, 82vh);
  }

  .xy-clock-time {
    font-size: 38px;
  }

  .xy-paper-sheet {
    padding: 30px 24px 26px;
  }

  .xy-paper-body {
    font-size: 14px;
  }

  .xy-tooltip {
    margin-left: 22px;
    margin-top: -34px;
    font-size: 11px;
  }
}
