:root {
  color-scheme: light;
  --bg: #f3f6ff;
  --card: #ffffff;
  --text: #16213d;
  --muted: #5c6788;
  --primary: #2659d9;
  --primary-soft: #dee7ff;
  --accent: #16a085;
  --danger: #c0392b;
  --border: #d8e0f2;
  --shadow: 0 12px 24px rgba(28, 54, 119, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: radial-gradient(circle at top, #eef3ff, #f8f9fe 45%, #f3f6ff);
  color: var(--text);
  line-height: 1.7;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: #111;
  color: #fff;
  border-radius: 0.4rem;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 1000;
}

.app-shell {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 1.2rem 1rem 3rem;
}

main {
  margin-top: 0;
}

/* ===== Landing Hero ===== */
.landing-hero {
  position: relative;
  min-height: 85vh;
  min-height: 85dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 1rem;
  margin-bottom: 1rem;
}

.landing-hero-bg {
  position: absolute;
  inset: 0;
  background: url('./images/bg_home_living.jpg') center/cover no-repeat;
  filter: brightness(0.35) saturate(0.8);
  z-index: 0;
}

.landing-hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #fff;
  padding: 2rem 1.5rem;
  max-width: 560px;
}

.landing-tag {
  font-size: 0.85rem;
  opacity: 0.8;
  margin: 0 0 0.5rem;
  letter-spacing: 0.1em;
}

.landing-title {
  font-size: clamp(1.8rem, 6vw, 2.8rem);
  font-weight: 800;
  line-height: 1.3;
  margin: 0 0 0.75rem;
  text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.landing-catch {
  font-size: clamp(1rem, 3vw, 1.25rem);
  margin: 0 0 0.5rem;
  opacity: 0.95;
  text-shadow: 0 1px 6px rgba(0,0,0,0.4);
}

.landing-time {
  font-size: 0.82rem;
  opacity: 0.65;
  margin: 0 0 1.5rem;
}

.landing-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.landing-start-btn {
  background: linear-gradient(135deg, #2659d9, #3b7cf5);
  color: #fff;
  border: none;
  border-radius: 0.8rem;
  padding: 1rem 2.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(38, 89, 217, 0.5);
  transition: all 0.2s ease;
  letter-spacing: 0.05em;
}

.landing-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(38, 89, 217, 0.6);
}

.landing-resume-btn {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 0.7rem;
  padding: 0.65rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
}

.landing-resume-btn:hover {
  background: rgba(255,255,255,0.25);
}

.landing-hint {
  color: rgba(255,255,255,0.6);
  margin-top: 0.5rem;
}

/* ===== How To Play ===== */
.landing-howto {
  margin-bottom: 1rem;
}

.howto-summary {
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 0.3rem 0;
  color: var(--primary);
}

.howto-body {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.screen.hidden {
  display: none !important;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.section-head h2 {
  margin: 0;
}

.bullet-list {
  padding-left: 1.2rem;
  margin-top: 0.5rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.8rem;
}

.button-row.compact {
  justify-content: flex-end;
  margin-top: 0;
}

button {
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  border-radius: 0.7rem;
  padding: 0.65rem 0.95rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s ease;
}

button:hover {
  filter: brightness(1.05);
}

button:focus-visible {
  outline: 3px solid #8fb2ff;
  outline-offset: 1px;
}

button.secondary {
  background: #fff;
  color: var(--primary);
  border-color: #9bb2ea;
}

button.ghost {
  background: #eef3ff;
  color: #23449b;
  border-color: #ccd7f4;
}

button:disabled {
  opacity: 0.58;
  cursor: default;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.fatal {
  margin-top: 0.6rem;
  color: var(--danger);
  font-weight: 700;
}

.fatal.hidden {
  display: none;
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.case-grid {
  display: grid;
  gap: 0.9rem;
}

.case-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.case-card h3 {
  margin: 0.2rem 0 0.4rem;
}

.case-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.case-cast {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  list-style: none;
  margin: 0.55rem 0 0.2rem;
  padding: 0;
}

.case-cast-item {
  display: inline-flex;
  align-items: center;
  gap: 0.33rem;
  background: #f0f4ff;
  border: 1px solid #ccd8f7;
  color: #2b3e75;
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.status-grid {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.8rem;
}

.status-item {
  background: #f8faff;
  border: 1px solid #d7e1f9;
  border-radius: 0.8rem;
  padding: 0.6rem;
}

.status-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
}

.status-label {
  font-size: 0.9rem;
  font-weight: 700;
}

.status-value {
  font-size: 0.86rem;
  color: var(--muted);
}

.status-track {
  margin-top: 0.45rem;
  height: 0.52rem;
  border-radius: 999px;
  background: #d6def1;
  overflow: hidden;
}

.status-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2f6fec, #47b7f5);
}

.status-description {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.mode-badge {
  display: inline-block;
  margin: 0 0 0.7rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #dbf8ed;
  color: #0f7b57;
}

.mode-badge.hidden {
  display: none;
}

.log-list {
  margin: 0.4rem 0 0;
  padding-left: 1.25rem;
}

.log-list li {
  margin: 0.4rem 0;
}

.footer-note {
  margin-top: 1.4rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* ===== VN Game Screen ===== */

#gameScreen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #0a0e1a;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  --vn-textbox-height: clamp(140px, 25vh, 200px);
}

.vn-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #1a1a2e;
  transition: background-image 0.6s ease, filter 0.25s ease;
}

.vn-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.05) 0%,
    transparent 30%,
    transparent 55%,
    rgba(0, 0, 0, 0.35) 100%
  );
}

.vn-bg.is-evening-scene::after {
  background: linear-gradient(
    to bottom,
    rgba(255, 176, 108, 0.22) 0%,
    rgba(255, 136, 72, 0.08) 24%,
    rgba(63, 24, 26, 0.1) 56%,
    rgba(8, 15, 35, 0.44) 100%
  );
}

.vn-bg.is-conference-evening::after {
  background: linear-gradient(
    to bottom,
    rgba(255, 182, 118, 0.26) 0%,
    rgba(255, 139, 84, 0.16) 28%,
    rgba(71, 29, 26, 0.14) 60%,
    rgba(8, 15, 35, 0.48) 100%
  );
}

.vn-bg.is-negative-reaction {
  filter: saturate(0.86) brightness(0.8);
}

.vn-bg.is-positive-reaction {
  filter: saturate(1.08) brightness(1.02);
}

.vn-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 0.6rem 0.8rem;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.15) 80%, transparent);
  pointer-events: none;
}

.vn-header > * {
  pointer-events: auto;
}

.vn-scene-banner {
  background: linear-gradient(135deg, rgba(20, 49, 132, 0.92), rgba(42, 94, 224, 0.88));
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.55rem 1.2rem;
  border-radius: 0.6rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(130, 180, 255, 0.3);
  letter-spacing: 0.03em;
  max-width: 70%;
  line-height: 1.4;
}

.vn-header-btns {
  display: flex;
  gap: 0.4rem;
}

.vn-ctrl-btn {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  border-radius: 0.35rem;
  backdrop-filter: blur(4px);
}

.vn-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.vn-portrait {
  position: absolute;
  bottom: calc(var(--vn-textbox-height) + 24px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.vn-portrait img {
  max-height: clamp(30vh, 45vh, 55vh);
  max-width: 80vw;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.4));
  transition: opacity 0.3s ease;
}

.vn-textbox {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  min-height: var(--vn-textbox-height);
  background: linear-gradient(
    to bottom,
    rgba(8, 15, 35, 0.78),
    rgba(8, 15, 35, 0.94)
  );
  backdrop-filter: blur(10px);
  padding: 0 1.2rem calc(1.4rem + env(safe-area-inset-bottom, 0px));
  padding-left: calc(1.2rem + env(safe-area-inset-left, 0px));
  padding-right: calc(1.2rem + env(safe-area-inset-right, 0px));
  cursor: pointer;
  user-select: none;
  border-top: 2px solid rgba(80, 130, 255, 0.25);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.vn-textbox.is-negative-reaction {
  background: linear-gradient(180deg, rgba(65, 18, 24, 0.96) 0%, rgba(18, 24, 46, 0.98) 100%);
  border-top-color: rgba(192, 57, 43, 0.84);
  box-shadow: 0 -18px 40px rgba(192, 57, 43, 0.28);
}

.vn-textbox.is-positive-reaction {
  border-top-color: rgba(22, 160, 133, 0.72);
  box-shadow: 0 -16px 34px rgba(22, 160, 133, 0.14);
}

.vn-speaker {
  display: inline-block;
  background: linear-gradient(135deg, #2659d9, #3b7cf5);
  color: #fff;
  padding: 0.22rem 0.9rem;
  border-radius: 0 0 0.5rem 0.5rem;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 8px rgba(38, 89, 217, 0.3);
}

.vn-speaker:empty,
.vn-speaker.hide {
  visibility: hidden;
  margin-bottom: 0.5rem;
}

.vn-message {
  color: #eef2ff;
  font-size: clamp(0.92rem, 2.5vw, 1.12rem);
  line-height: 1.9;
  margin: 0;
  min-height: 3rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  white-space: pre-wrap;
}

.vn-next-btn {
  position: absolute;
  bottom: calc(0.8rem + env(safe-area-inset-bottom, 0px));
  right: calc(1rem + env(safe-area-inset-right, 0px));
  background: linear-gradient(135deg, #2659d9, #3b7cf5);
  color: #fff;
  border: 1px solid rgba(130, 180, 255, 0.5);
  border-radius: 0.55rem;
  padding: 0.5rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(38, 89, 217, 0.4);
  animation: vnPulse 2s ease-in-out infinite;
  transition: all 0.15s ease;
  z-index: 5;
  letter-spacing: 0.05em;
  min-width: 44px;
  min-height: 44px;
}

.vn-next-btn:hover {
  background: linear-gradient(135deg, #3b7cf5, #5a9aff);
  box-shadow: 0 4px 18px rgba(38, 89, 217, 0.55);
  transform: translateY(-1px);
}

.vn-next-btn.hide {
  display: none;
}

@keyframes vnPulse {
  0%, 100% {
    box-shadow: 0 3px 12px rgba(38, 89, 217, 0.4);
  }
  50% {
    box-shadow: 0 3px 20px rgba(59, 124, 245, 0.65);
  }
}

.vn-choices {
  position: absolute;
  bottom: calc(var(--vn-textbox-height) + 12px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 92%);
  z-index: 20;
  display: grid;
  gap: 0.5rem;
  max-height: min(38vh, 360px);
  overflow-y: auto;
  padding-right: 0.15rem;
}

.vn-choices.hidden {
  display: none;
}

.vn-choice-btn {
  width: 100%;
  text-align: left;
  background: rgba(12, 20, 48, 0.88);
  backdrop-filter: blur(6px);
  color: #dce4ff;
  border: 1px solid rgba(80, 130, 255, 0.35);
  border-radius: 0.65rem;
  padding: 0.75rem 1.2rem;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.5;
  min-height: 48px;
}

.vn-choice-btn:hover {
  background: rgba(38, 89, 217, 0.65);
  border-color: rgba(130, 180, 255, 0.55);
  transform: translateX(3px);
  color: #fff;
}

.vn-choice-btn:disabled {
  opacity: 0.4;
  cursor: default;
  transform: none;
}

.vn-quiz-badge {
  position: absolute;
  top: 3.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  background: rgba(15, 123, 87, 0.85);
  color: #fff;
  padding: 0.3rem 1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.vn-quiz-badge.hidden {
  display: none;
}

.vn-feedback {
  position: absolute;
  bottom: 190px;
  left: 50%;
  transform: translateX(-50%);
  width: min(500px, 90%);
  z-index: 25;
  background: rgba(12, 20, 48, 0.92);
  backdrop-filter: blur(8px);
  color: #dce4ff;
  border: 1px solid rgba(80, 130, 255, 0.3);
  border-radius: 0.8rem;
  padding: 1rem 1.2rem;
  text-align: center;
}

.vn-feedback.hidden {
  display: none;
}

.vn-feedback h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: #a8c0ff;
}

.vn-feedback p {
  margin: 0.3rem 0;
  font-size: 0.88rem;
  line-height: 1.6;
}

.vn-feedback button {
  margin-top: 0.8rem;
  background: linear-gradient(135deg, #2659d9, #3b7cf5);
  border: none;
  color: #fff;
  padding: 0.55rem 1.5rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
}

@media (min-width: 760px) {
  #gameScreen {
    --vn-textbox-height: 180px;
  }

  .app-shell {
    padding: 1.5rem 1.4rem 3.5rem;
  }

  .card,
  .case-card {
    padding: 1.2rem;
  }

  .case-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .vn-scene-banner {
    font-size: 1.3rem;
    padding: 0.6rem 1.5rem;
  }

  .vn-textbox {
    padding: 0 2rem calc(1.6rem + env(safe-area-inset-bottom, 0px));
    min-height: 180px;
  }

  .vn-message {
    font-size: 1.12rem;
  }

  .vn-portrait img {
    max-height: 55vh;
  }

  .vn-next-btn {
    font-size: 1rem;
    padding: 0.55rem 1.8rem;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    right: calc(1.5rem + env(safe-area-inset-right, 0px));
  }

  .landing-hero {
    min-height: 70vh;
    border-radius: 1.2rem;
  }

  .landing-title {
    font-size: 2.8rem;
  }

  .result-hero {
    min-height: 50vh;
  }
}

@media (max-width: 720px) {
  #gameScreen {
    --vn-textbox-height: clamp(185px, 31vh, 250px);
  }

  .vn-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    padding:
      calc(0.55rem + env(safe-area-inset-top, 0px))
      0.65rem
      0;
  }

  .vn-scene-banner {
    max-width: 100%;
    font-size: 0.98rem;
    padding: 0.5rem 0.85rem;
    line-height: 1.35;
  }

  .vn-header-btns {
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .vn-ctrl-btn {
    min-height: 38px;
    padding: 0.38rem 0.7rem;
    font-size: 0.74rem;
  }

  .vn-portrait {
    bottom: calc(var(--vn-textbox-height) + 12px);
    width: 100%;
    padding: 0 0.5rem;
  }

  .vn-portrait img {
    max-height: clamp(56vh, 72vh, 82vh);
    max-width: min(140vw, 680px);
  }

  .vn-textbox {
    padding: 0.35rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    padding-left: calc(1rem + env(safe-area-inset-left, 0px));
    padding-right: calc(1rem + env(safe-area-inset-right, 0px));
  }

  .vn-textbox.has-inline-choices {
    min-height: auto;
    max-height: none;
    overflow: visible;
  }

  .vn-textbox.has-inline-choices .vn-message {
    min-height: 0;
    padding-bottom: 0.45rem;
  }

  .vn-message {
    font-size: 0.98rem;
    line-height: 1.8;
    min-height: 4rem;
    padding-bottom: 4.3rem;
  }

  .vn-next-btn {
    right: calc(0.85rem + env(safe-area-inset-right, 0px));
    bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
    min-width: 112px;
    padding: 0.65rem 1rem;
    font-size: 0.95rem;
    border-radius: 0.72rem;
  }

  .vn-choices {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    transform: none;
    gap: 0.65rem;
    max-height: min(48vh, 360px);
    padding: 0.75rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(
      to top,
      rgba(8, 15, 35, 0.96),
      rgba(8, 15, 35, 0.88)
    );
    border-top: 1px solid rgba(80, 130, 255, 0.24);
    box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.24);
  }

  .vn-textbox .vn-choices {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    width: 100%;
    transform: none;
    max-height: none;
    overflow: visible;
    padding: 0.75rem 0 0;
    background: none;
    border-top: none;
    box-shadow: none;
  }

  .vn-choice-btn {
    padding: 0.72rem 0.9rem;
    border-radius: 0.8rem;
    font-size: 0.92rem;
    line-height: 1.45;
    min-height: 44px;
  }

  .vn-epilogue-skip-btn {
    top: -2.8rem;
    right: 0;
  }
}

/* ===== Fade Overlay ===== */
.vn-fade-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.vn-fade-overlay.active {
  opacity: 1;
}

/* ===== Tutorial Overlay ===== */
.tutorial-overlay {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.tutorial-overlay.hidden {
  display: none;
}

.tutorial-step {
  text-align: center;
  color: #fff;
  padding: 2rem;
  max-width: 400px;
}

.tutorial-step.hidden {
  display: none;
}

.tutorial-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.tutorial-text {
  font-size: 1.15rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.tutorial-next {
  background: linear-gradient(135deg, #2659d9, #3b7cf5);
  color: #fff;
  border: none;
  border-radius: 0.7rem;
  padding: 0.7rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-right: 0.5rem;
}

.tutorial-skip {
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.7rem;
  padding: 0.7rem 1.2rem;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ===== Result Screen ===== */
.result-hero {
  position: relative;
  min-height: 60vh;
  min-height: 60dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 1rem;
  margin-bottom: 1rem;
}

.result-hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a237e 0%, #0d47a1 40%, #01579b 100%);
  background-size: cover;
  background-position: center;
  z-index: 0;
  transition: opacity 0.6s ease;
}

.result-hero-bg.with-image {
  background-color: #000;
}

.result-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.55) 60%, rgba(0, 0, 0, 0.8) 100%);
  z-index: 0;
  pointer-events: none;
}

.result-hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #fff;
  padding: 2rem 1.5rem;
  max-width: 620px;
}

.result-tag {
  font-size: 0.85rem;
  opacity: 0.85;
  margin: 0 0 0.5rem;
  letter-spacing: 0.08em;
}

.result-title {
  font-size: clamp(1.5rem, 5vw, 2.4rem);
  font-weight: 800;
  line-height: 1.3;
  margin: 0 0 0.75rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

.result-tagline {
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  font-weight: 600;
  line-height: 1.6;
  margin: 0 0 1.1rem;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  letter-spacing: 0.02em;
}

.result-desc {
  font-size: 1rem;
  line-height: 1.75;
  margin: 0 0 1.2rem;
  opacity: 0.92;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.result-aftertaste {
  margin: -0.35rem auto 1.2rem;
  max-width: 36rem;
  font-size: 0.94rem;
  line-height: 1.7;
  padding: 0.7rem 0.9rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.result-aftertaste.is-caution {
  background: rgba(122, 27, 27, 0.26);
  border-color: rgba(255, 189, 189, 0.24);
}

.result-meta {
  font-size: 0.82rem;
  opacity: 0.7;
  margin: 0 0 1.2rem;
}

.result-share-btn {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 0.7rem;
  padding: 0.7rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: all 0.2s ease;
  min-height: 44px;
}

.result-share-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Next Action card */
.result-next-action {
  border-left: 4px solid var(--accent);
  background: linear-gradient(135deg, #f0fbf6 0%, #ffffff 100%);
}

.result-next-action h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.result-next-action p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--text);
}

/* Replay row */
.result-replay-row {
  justify-content: center;
}

.result-replay-btn {
  background: linear-gradient(135deg, #ff7e3d 0%, #ff5e6c 100%);
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.85rem 1.6rem;
  min-height: 48px;
  box-shadow: 0 6px 18px rgba(255, 94, 108, 0.32);
}

.result-replay-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(255, 94, 108, 0.4);
}

/* Score & log details */
.result-details {
  background: var(--card);
}

.result-details[open] summary {
  margin-bottom: 0.8rem;
}

.ending-badge.current {
  background: linear-gradient(135deg, #ff7e3d 0%, #ff5e6c 100%);
  color: #fff;
  box-shadow: 0 4px 10px rgba(255, 94, 108, 0.35);
}

/* Learnings */
.learnings-list {
  padding-left: 1.2rem;
  line-height: 1.8;
}

.learnings-list li {
  margin-bottom: 0.4rem;
}

/* Endings Gallery */
.endings-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.ending-badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.ending-badge.reached {
  background: #dbeafe;
  color: #1e40af;
}

.ending-badge.locked {
  background: #f3f4f6;
  color: #9ca3af;
}

/* Footer Credits */
.footer-credits {
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

.footer-credits a {
  color: var(--primary);
  text-decoration: none;
}

/* ===== Ending Title Card Overlay ===== */
.ending-title-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.6s ease;
  cursor: pointer;
  padding: 1rem;
}

.ending-title-overlay.active {
  opacity: 1;
}

.ending-title-overlay.hidden {
  display: none;
}

.ending-title-stage {
  position: relative;
  width: 100%;
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ending-title-image {
  width: 100%;
  max-width: 1080px;
  max-height: 70vh;
  max-height: 70dvh;
  height: auto;
  object-fit: contain;
  border-radius: 0.75rem;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.7);
  opacity: 0;
  transform: scale(0.985);
  animation: endingImageIn 1.4s ease-out 0.2s forwards;
}

.ending-title-text-block {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 1.2rem 1.6rem 1.6rem;
  pointer-events: none;
  text-align: center;
  background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.55) 100%);
  border-radius: 0.75rem;
  opacity: 0;
  animation: endingTextIn 1.4s ease-out 1.5s forwards;
}

.ending-title-label {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Times New Roman", serif;
  font-size: clamp(0.85rem, 1.8vw, 1rem);
  letter-spacing: 0.4em;
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 0.3rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

.ending-title-heading {
  font-size: clamp(1.4rem, 3.2vw, 2rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  margin: 0 0 0.6rem;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.85);
}

.ending-tagline {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif;
  font-size: clamp(0.95rem, 2.2vw, 1.2rem);
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: 0.03em;
  color: #fff;
  margin: 0;
  text-shadow: 0 4px 14px rgba(0, 0, 0, 0.85);
  max-width: 80%;
}

.ending-title-advance {
  margin-top: 1.2rem;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 0.7rem;
  padding: 0.7rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  backdrop-filter: blur(6px);
  opacity: 0;
  animation: endingTextIn 1.2s ease-out 2.6s forwards;
  transition: background 0.2s, transform 0.2s;
  letter-spacing: 0.05em;
}

.ending-title-advance:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

@keyframes endingImageIn {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* Epilogue skip button (inside vn-textbox, top-right) */
.vn-epilogue-skip-btn {
  position: absolute;
  top: -2.4rem;
  right: 0.4rem;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 0.5rem;
  padding: 0.35rem 0.8rem;
  font-size: 0.78rem;
  cursor: pointer;
  z-index: 5;
  min-height: 36px;
  letter-spacing: 0.04em;
}

.vn-epilogue-skip-btn:hover {
  background: rgba(0, 0, 0, 0.75);
}

/* Reduced motion: skip animations */
@media (prefers-reduced-motion: reduce) {
  .ending-title-overlay,
  .ending-title-image,
  .ending-title-text-block,
  .ending-title-advance,
  .result-hero-bg,
  .result-share-btn {
    transition: none !important;
    animation: none !important;
  }
  .ending-title-image,
  .ending-title-text-block,
  .ending-title-advance {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* ===== Small Screen Adjustments ===== */
@media (max-width: 390px) {
  #gameScreen {
    --vn-textbox-height: clamp(168px, 29vh, 220px);
  }

  .vn-header {
    gap: 0.35rem;
    padding:
      calc(0.45rem + env(safe-area-inset-top, 0px))
      0.5rem
      0;
  }

  .vn-scene-banner {
    font-size: 0.9rem;
    padding: 0.42rem 0.72rem;
  }

  .vn-ctrl-btn {
    min-height: 34px;
    padding: 0.28rem 0.52rem;
    font-size: 0.68rem;
  }

  .vn-message {
    font-size: 0.92rem;
    line-height: 1.75;
  }

  .vn-speaker {
    font-size: 0.78rem;
  }

  .vn-next-btn {
    font-size: 0.85rem;
    padding: 0.45rem 0.9rem;
    min-width: 98px;
  }

  .vn-portrait {
    bottom: calc(var(--vn-textbox-height) + 8px);
  }

  .vn-portrait img {
    max-height: clamp(54vh, 70vh, 78vh);
    max-width: 140vw;
  }

  .vn-textbox {
    padding-left: calc(0.8rem + env(safe-area-inset-left, 0px));
    padding-right: calc(0.8rem + env(safe-area-inset-right, 0px));
  }

  .vn-textbox.has-inline-choices {
    max-height: none;
  }

  .vn-textbox.has-inline-choices .vn-message {
    font-size: 0.88rem;
    line-height: 1.58;
    padding-bottom: 0.5rem;
  }

  .vn-textbox .vn-choices {
    padding-top: 0.55rem;
    gap: 0.45rem;
  }

  .vn-choice-btn {
    padding: 0.58rem 0.72rem;
    font-size: 0.84rem;
    line-height: 1.35;
    min-height: 40px;
  }

  .landing-title {
    font-size: 1.6rem;
  }

  .landing-catch {
    font-size: 0.95rem;
  }

  .ending-title-heading {
    font-size: 1.25rem;
  }

  .ending-tagline {
    font-size: 0.92rem;
    max-width: 92%;
  }

  .vn-epilogue-skip-btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    top: -2.2rem;
  }
}

