:root {
  --paper: #fbf6ec;
  --ink: #2b3149;
  --violet: #6d65b6;
  --rose: #d96983;
  --blue: #5fa8bd;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
  color: var(--ink);
}

#shell {
  position: fixed;
  inset: 0;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#bleed-video {
  position: absolute;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px 28px;
}

.hud-top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.sigil {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--ink);
  transform: rotate(45deg);
  opacity: 0.75;
}
.sigil::after {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  margin: 3.5px;
  background: var(--rose);
  opacity: 0.8;
}

.objective {
  flex: 1;
}
#objective-title {
  font-size: 15px;
  letter-spacing: 0.12em;
  opacity: 0.85;
}
.thread {
  margin-top: 6px;
  height: 1px;
  max-width: 300px;
  background: linear-gradient(90deg, var(--ink), transparent);
  opacity: 0.35;
}

#timer {
  font-size: 13px;
  letter-spacing: 0.2em;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

#region-banner {
  position: absolute;
  top: 18%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 26px;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  opacity: 0;
  transition: opacity 1.4s ease;
}
#region-banner.visible {
  opacity: 0.82;
}

#message {
  position: absolute;
  bottom: 21%;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 17px;
  letter-spacing: 0.14em;
  opacity: 0;
  transition: opacity 0.9s ease;
  text-shadow: 0 0 14px rgba(251, 246, 236, 0.9);
}
#message.visible {
  opacity: 0.92;
}

.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

#pigment-count {
  font-size: 14px;
  letter-spacing: 0.18em;
  opacity: 0.75;
}

#prompt {
  position: absolute;
  left: 50%;
  bottom: 13%;
  transform: translateX(-50%);
  font-size: 17px;
  letter-spacing: 0.2em;
  border: 1px solid rgba(43, 49, 73, 0.4);
  padding: 5px 14px;
  border-radius: 999px;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: rgba(251, 246, 236, 0.55);
}
#prompt.visible {
  opacity: 0.9;
}

#bloom-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 40%,
    rgba(109, 101, 182, 0.16) 78%,
    rgba(217, 105, 131, 0.22) 100%
  );
  transition: opacity 1.2s ease;
}
#bloom-vignette.visible {
  opacity: 1;
}

/* ED白飛び (ブルーム風に中心から白へ) */
#whiteout {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  background: #ffffff; /* 画面全体を均一に白飛び */
}

#end-screen.on-white {
  background: transparent;
}
#end-screen.on-white .panel {
  animation: ed-text-in 2.4s ease both;
}
@keyframes ed-text-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- Screens ---------- */
#start-screen,
#end-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 70% 20%, rgba(217, 105, 131, 0.12), transparent 50%),
    radial-gradient(ellipse at 25% 75%, rgba(95, 168, 189, 0.14), transparent 55%),
    var(--paper);
  z-index: 10;
}
#start-screen[hidden],
#end-screen[hidden] {
  display: none;
}

#end-screen {
  background:
    radial-gradient(ellipse at 50% 30%, rgba(109, 101, 182, 0.16), transparent 60%),
    var(--paper);
}

.panel {
  max-width: 560px;
  text-align: center;
  padding: 40px;
}

.panel h1 {
  font-size: 52px;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  margin-bottom: 10px;
}

.panel .sub {
  font-size: 13px;
  letter-spacing: 0.24em;
  opacity: 0.55;
  margin-bottom: 26px;
}

.panel p {
  font-size: 15px;
  line-height: 2;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.panel button {
  margin: 30px 0 22px;
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  padding: 13px 46px;
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(43, 49, 73, 0.55);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.35s ease;
}
.panel button:hover {
  background: var(--ink);
  color: var(--paper);
}

.panel .controls {
  font-size: 12px;
  letter-spacing: 0.12em;
  opacity: 0.5;
  line-height: 1.9;
}

#start-screen.fade-out,
#end-screen.fade-out {
  opacity: 0;
  transition: opacity 1.6s ease;
  pointer-events: none;
}
