/* unit-love / mobile first */

:root {
  --game-max-width: 440px;
  --color-surface: #fffaff;
  --color-text: #34283a;
  --color-muted: #8d8193;
  --color-main: #a84f7a;
  --color-main-dark: #813658;
  --color-accent: #7562a0;
  --color-line: rgba(73, 54, 82, 0.14);
  --shadow-soft: 0 20px 60px rgba(60, 44, 69, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
}

html,
button,
.dialogue-box,
.opening-screen {
  /* ピンチ操作は残しつつ、連打をダブルタップ拡大として扱わせない。 */
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  color: var(--color-text);
  background:
    radial-gradient(circle at 15% 18%, rgba(255,255,255,.7), transparent 20%),
    linear-gradient(135deg, #ddd4e7, #f0dce4 48%, #d8d8ec);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
}

button { font: inherit; }

.site-shell {
  min-height: 100vh;
  min-height: 100svh;
}

.game-frame {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: var(--color-surface);
}

.desktop-side { display: none; }

.screen {
  display: none;
  min-height: 100vh;
  min-height: 100svh;
}

.screen--active { display: flex; }

/* =========================================
   Opening title sequence
   ========================================= */

.game-screen--leaving {
  pointer-events: none;
  animation: prologue-fade-out .42s ease-in both;
}

.opening-screen {
  position: absolute;
  z-index: 10;
  inset: 0;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  overflow: hidden;
  color: #172c68;
  background: #dcecff;
  text-align: center;
  cursor: pointer;
  isolation: isolate;
}

.opening-screen--playing {
  animation: opening-timeline 6.6s linear both;
}

.opening-background,
.opening-color-wash {
  position: absolute;
  inset: -3%;
}

.opening-background {
  z-index: -3;
  background-color: #b8ddff;
  background-image: url("../assets/images/backgrounds/op-campus.png");
  background-image: image-set(
    url("../assets/images/backgrounds/op-campus.webp") type("image/webp"),
    url("../assets/images/backgrounds/op-campus.png") type("image/png")
  );
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
}

.opening-screen--playing .opening-background {
  animation: opening-background-reveal 6.6s ease-out both;
}

.opening-color-wash {
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(239,244,255,.08), rgba(254,220,244,.18)),
    radial-gradient(circle at 50% 44%, transparent 18%, rgba(89,68,142,.12) 100%);
  pointer-events: none;
}

.opening-copy {
  position: absolute;
  z-index: 2;
  top: 21%;
  left: 0;
  width: 100%;
  padding: 0 28px;
  pointer-events: none;
}

.opening-copy-line {
  margin: 0;
  color: #183575;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-weight: 700;
  letter-spacing: .09em;
  line-height: 1.9;
  opacity: 0;
  text-shadow:
    0 1px 0 rgba(255,255,255,.95),
    0 0 12px rgba(255,255,255,.95),
    0 3px 18px rgba(103,70,142,.2);
}

.opening-copy-line--first {
  font-size: clamp(21px, 6.4vw, 28px);
}

.opening-copy-line--second {
  margin-top: 13px;
  color: #704982;
  font-size: clamp(15px, 4.6vw, 19px);
}

.opening-screen--playing .opening-copy-line--first {
  animation: opening-copy-first 6.6s ease both;
}

.opening-screen--playing .opening-copy-line--second {
  animation: opening-copy-second 6.6s ease both;
}

.opening-title {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0 14px;
  transform: translateY(-10svh);
  pointer-events: none;
}

.opening-logo-picture {
  display: block;
  width: 100%;
}

.opening-logo {
  display: block;
  width: min(100%, 420px);
  height: auto;
  opacity: 0;
  filter: drop-shadow(0 10px 20px rgba(47,43,112,.2));
}

.opening-screen--playing .opening-logo {
  animation: opening-logo-reveal 6.6s cubic-bezier(.2,.75,.2,1) both;
}

.opening-game-start {
  opacity: 0;
  text-shadow:
    0 1px 0 rgba(255,255,255,.95),
    0 0 10px rgba(255,255,255,.95);
}

.opening-game-start {
  margin: 18px 0 0;
  color: #a93778;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .24em;
}

.opening-screen--playing .opening-game-start {
  animation: opening-start-reveal 6.6s ease both;
}

.opening-skip {
  position: absolute;
  z-index: 6;
  right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 0;
  width: max-content;
  margin: auto;
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 999px;
  color: rgba(29,44,94,.72);
  background: rgba(255,255,255,.42);
  box-shadow: 0 4px 18px rgba(64,48,116,.08);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .2em;
  cursor: pointer;
  backdrop-filter: blur(6px);
  animation: opening-skip-pulse 2.2s ease-in-out infinite;
}

.opening-skip:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.opening-sparkles,
.opening-petals {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.opening-sparkles span {
  position: absolute;
  color: rgba(255,255,255,.92);
  opacity: .3;
  text-shadow: 0 0 9px rgba(255,255,255,.95);
  animation: opening-sparkle 2.8s ease-in-out infinite;
}

.opening-sparkles span:nth-child(1) {
  top: 14%;
  left: 17%;
  font-size: 21px;
}

.opening-sparkles span:nth-child(2) {
  top: 37%;
  right: 12%;
  font-size: 17px;
  animation-delay: .8s;
}

.opening-sparkles span:nth-child(3) {
  right: 24%;
  bottom: 22%;
  font-size: 13px;
  animation-delay: 1.6s;
}

.opening-petals i {
  position: absolute;
  top: -8%;
  left: var(--petal-left);
  width: var(--petal-size);
  height: calc(var(--petal-size) * 1.45);
  border-radius: 80% 12% 75% 22%;
  background: linear-gradient(145deg, #fff6fc, #f5a9cf 74%);
  box-shadow: 0 1px 4px rgba(174,72,130,.16);
  opacity: 0;
  animation: opening-petal-fall var(--petal-duration) linear var(--petal-delay) infinite;
}

.opening-petals i:nth-child(1) {
  --petal-left: 8%;
  --petal-size: 9px;
  --petal-duration: 5.4s;
  --petal-delay: .4s;
}

.opening-petals i:nth-child(2) {
  --petal-left: 29%;
  --petal-size: 12px;
  --petal-duration: 6.2s;
  --petal-delay: 1.7s;
}

.opening-petals i:nth-child(3) {
  --petal-left: 53%;
  --petal-size: 8px;
  --petal-duration: 5.8s;
  --petal-delay: .9s;
}

.opening-petals i:nth-child(4) {
  --petal-left: 72%;
  --petal-size: 11px;
  --petal-duration: 6.5s;
  --petal-delay: 2.5s;
}

.opening-petals i:nth-child(5) {
  --petal-left: 91%;
  --petal-size: 9px;
  --petal-duration: 5.6s;
  --petal-delay: 1.2s;
}

@keyframes prologue-fade-out {
  to { opacity: 0; }
}

@keyframes opening-timeline {
  from, to { opacity: 1; }
}

@keyframes opening-background-reveal {
  0% { opacity: 0; transform: scale(1.015); }
  12% { opacity: 1; }
  100% { opacity: 1; transform: scale(1.075); }
}

@keyframes opening-copy-first {
  0%, 7% { opacity: 0; transform: translateY(8px); }
  15%, 32% { opacity: 1; transform: translateY(0); }
  44%, 100% { opacity: 0; transform: translateY(-5px); }
}

@keyframes opening-copy-second {
  0%, 18% { opacity: 0; transform: translateY(8px); }
  26%, 37% { opacity: 1; transform: translateY(0); }
  46%, 100% { opacity: 0; transform: translateY(-5px); }
}

@keyframes opening-logo-reveal {
  0%, 45% { opacity: 0; transform: scale(.94); }
  58%, 100% { opacity: 1; transform: scale(1); }
}

@keyframes opening-start-reveal {
  0%, 66% { opacity: 0; }
  74%, 100% { opacity: 1; }
}

@keyframes opening-skip-pulse {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}

@keyframes opening-sparkle {
  0%, 100% { opacity: .2; transform: scale(.82) rotate(0); }
  50% { opacity: .9; transform: scale(1.14) rotate(12deg); }
}

@keyframes opening-petal-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -5svh, 0) rotate(0deg);
  }
  12% { opacity: .84; }
  100% {
    opacity: .16;
    transform: translate3d(86px, 114svh, 0) rotate(440deg);
  }
}

.title-screen {
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding:
    max(20px, env(safe-area-inset-top))
    18px
    max(16px, env(safe-area-inset-bottom));
  overflow: hidden;
  text-align: center;
  background: #c8e8ff;
  isolation: isolate;
}

.title-screen::before,
.title-screen::after {
  position: absolute;
  content: "";
  inset: -2%;
  pointer-events: none;
}

.title-screen::before {
  z-index: -3;
  background-image: url("../assets/images/backgrounds/op-campus.png");
  background-image: image-set(
    url("../assets/images/backgrounds/op-campus.webp") type("image/webp"),
    url("../assets/images/backgrounds/op-campus.png") type("image/png")
  );
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  animation: title-background-breathe 14s ease-in-out infinite alternate;
}

.title-screen::after {
  z-index: -2;
  background:
    linear-gradient(180deg, rgba(235,246,255,.05) 0%, rgba(246,228,247,.10) 48%, rgba(49,32,94,.25) 100%),
    radial-gradient(circle at 50% 38%, rgba(255,255,255,.18), transparent 42%);
}

.title-light {
  position: absolute;
  z-index: -1;
  top: -12%;
  left: -24%;
  width: 82%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.62), transparent 67%);
  filter: blur(8px);
  pointer-events: none;
}

.title-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: calc(100svh - 40px);
}

.title-brand {
  width: 100%;
  margin-top: 0;
}

.title-kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto 3px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 999px;
  color: rgba(28,53,112,.74);
  background: rgba(255,255,255,.32);
  box-shadow: 0 5px 18px rgba(55,48,115,.08);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .14em;
  backdrop-filter: blur(7px);
}

.title-kicker span {
  color: #e66da8;
  font-size: 9px;
}

.game-logo {
  margin: 0;
}

.game-logo picture {
  display: block;
}

.game-logo img {
  display: block;
  width: min(100%, 404px);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 12px 22px rgba(41,50,125,.24));
  animation: title-logo-float 5.8s ease-in-out infinite;
}

/* 縦長のスマホ画面では、ロゴの視覚的な重心が左に寄るため少し右へ補正する。 */
@media (max-width: 899px) {
  .game-logo picture {
    transform: translateX(3%);
  }
}

.title-menu {
  display: grid;
  gap: 9px;
  width: min(100%, 336px);
  margin: clamp(18px, 2.8svh, 28px) auto 0;
  padding: 11px;
  border: 1px solid rgba(255,255,255,.57);
  border-radius: 27px;
  background: rgba(248,245,255,.40);
  box-shadow:
    0 20px 42px rgba(48,31,94,.20),
    inset 0 1px 0 rgba(255,255,255,.70);
  backdrop-filter: blur(13px);
}

.main-button, .sub-button {
  width: 100%;
  min-height: 50px;
  border-radius: 999px;
}

.main-button {
  border: 0;
  color: #fff;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-main), #8060a6);
  box-shadow: 0 12px 26px rgba(120,67,108,.22);
  cursor: pointer;
}

.title-start-button {
  position: relative;
  display: grid;
  place-content: center;
  gap: 1px;
  min-height: 60px;
  overflow: hidden;
  background: linear-gradient(125deg, #d84288 0%, #9b4c9e 52%, #566bb4 100%);
  box-shadow:
    0 12px 28px rgba(126,48,112,.30),
    inset 0 1px 0 rgba(255,255,255,.34);
  letter-spacing: .08em;
  transition: transform .2s ease, box-shadow .2s ease;
}

.title-start-button::before {
  position: absolute;
  content: "";
  top: -90%;
  left: -30%;
  width: 28%;
  height: 270%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.38), transparent);
  transform: rotate(24deg);
  animation: title-button-shine 4.6s ease-in-out infinite;
}

.title-start-button:hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 32px rgba(126,48,112,.34),
    inset 0 1px 0 rgba(255,255,255,.34);
}

.title-start-button:active {
  transform: translateY(0) scale(.99);
}

.title-start-button:focus-visible,
.sub-button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.button-label-en {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .22em;
  opacity: .76;
}

.title-start-button strong {
  font-size: 16px;
  letter-spacing: .14em;
}

.button-arrow {
  position: absolute;
  top: 50%;
  right: 21px;
  font-size: 26px;
  font-weight: 300;
  line-height: 1;
  transform: translateY(-54%);
}

.title-sub-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* mainブランチは提出用。章ジャンプはdevelopmentブランチの確認用に残す。 */
#chapter-select-button,
#chapter-jump-dialog {
  display: none !important;
}

#continue-button {
  grid-column: 1 / -1;
}

.title-sound-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 5px 0 9px;
  color: rgba(68, 56, 104, .72);
}

.title-sound-setting-label {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .16em;
}

.title-sound-setting .title-sound-button {
  min-width: 112px;
  min-height: 32px;
  padding: 5px 8px;
  cursor: pointer;
}

.title-sound-state {
  min-width: 20px;
  color: #8f4271;
  font-size: 8px;
  letter-spacing: .08em;
}

.title-sound-button.sound-button--off .title-sound-state {
  color: #958b9a;
}

.ending-album-button {
  grid-column: 1 / -1;
  min-height: 43px;
}

.ending-album-button strong b {
  margin-left: 5px;
  color: #a34b7c;
  font-size: 9px;
}

.sub-button {
  display: grid;
  place-content: center;
  gap: 2px;
  min-height: 52px;
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 17px;
  color: rgba(53,55,103,.62);
  background: rgba(255,255,255,.48);
}

.sub-button span {
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .18em;
}

.sub-button strong {
  font-size: 11px;
  letter-spacing: .05em;
}

.sub-button:not(:disabled) {
  color: #514075;
  border-color: rgba(255,255,255,.9);
  background: linear-gradient(135deg, #fff5fb, #eae6ff);
  box-shadow: 0 5px 14px rgba(70,48,105,.12);
  cursor: pointer;
}

.sub-button:not(:disabled):hover {
  background: #fffaff;
}

.bookmark-info {
  margin: 0;
  color: #51466c;
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
  overflow-wrap: anywhere;
}

.bookmark-status {
  margin: 7px 0 0;
  color: #817389;
  font-size: 9px;
  line-height: 1.5;
  text-align: center;
}

.bookmark-info[data-warning="true"],
.bookmark-status[data-warning="true"] {
  color: #914368;
}

.chapter-jump-dialog {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(35,28,64,.46);
  backdrop-filter: blur(9px);
}

.chapter-jump-dialog[hidden] {
  display: none;
}

.chapter-jump-card {
  width: min(100%, 360px);
  padding: 24px 20px 20px;
  border: 1px solid rgba(255,255,255,.84);
  border-radius: 26px;
  color: #3c3155;
  background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(246,239,255,.97));
  box-shadow: 0 24px 70px rgba(34,24,60,.32);
  text-align: left;
}

.chapter-jump-kicker {
  margin: 0 0 5px;
  color: #a34b7c;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .17em;
}

.chapter-jump-card h2 {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 25px;
}

.chapter-jump-note {
  margin: 9px 0 16px;
  color: #746a80;
  font-size: 11px;
  line-height: 1.7;
}

.chapter-jump-field {
  display: grid;
  gap: 7px;
}

.chapter-jump-field span {
  font-size: 11px;
  font-weight: 700;
}

.chapter-jump-field select {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid rgba(117,82,140,.24);
  border-radius: 13px;
  color: #3c3155;
  background: #fff;
  font: inherit;
  font-size: 12px;
}

.chapter-jump-actions {
  display: grid;
  grid-template-columns: .8fr 1.2fr;
  gap: 9px;
  margin-top: 16px;
}

.chapter-jump-actions button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  color: #695d77;
  background: #eee8f2;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.chapter-jump-actions button:last-child {
  color: #fff;
  background: linear-gradient(135deg, var(--color-main), #7562a0);
  box-shadow: 0 8px 18px rgba(120,67,108,.2);
}

.ending-album-dialog {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(35,28,64,.50);
  backdrop-filter: blur(9px);
}

.ending-album-dialog[hidden] {
  display: none;
}

.ending-album-card {
  width: min(100%, 380px);
  max-height: calc(100svh - 36px);
  padding: 23px 18px 18px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.88);
  border-radius: 26px;
  color: #3c3155;
  background:
    radial-gradient(circle at 100% 0, rgba(255,205,234,.48), transparent 34%),
    linear-gradient(145deg, rgba(255,255,255,.99), rgba(244,239,255,.98));
  box-shadow: 0 24px 70px rgba(34,24,60,.35);
}

.ending-album-kicker {
  margin: 0 0 5px;
  color: #a34b7c;
  font-family: "Times New Roman", serif;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .17em;
}

.ending-album-card h2 {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 24px;
}

.ending-album-note {
  margin: 8px 0 14px;
  color: #746a80;
  font-size: 10px;
  line-height: 1.65;
}

.ending-album-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ending-album-entry {
  min-width: 0;
  padding: 11px 10px;
  border: 1px solid rgba(121,82,143,.16);
  border-radius: 15px;
  color: inherit;
  background: rgba(255,255,255,.78);
  box-shadow: 0 5px 14px rgba(72,48,100,.07);
  font: inherit;
  text-align: left;
}

.ending-album-entry[data-unlocked="false"] {
  color: #97909d;
  background: rgba(235,231,239,.72);
  box-shadow: none;
}

button.ending-album-entry {
  cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

button.ending-album-entry:hover {
  border-color: rgba(173,78,130,.42);
  box-shadow: 0 9px 20px rgba(72,48,100,.13);
  transform: translateY(-2px);
}

button.ending-album-entry:focus-visible {
  outline: 2px solid #ad4e82;
  outline-offset: 2px;
}

.ending-album-entry-number {
  margin: 0 0 5px;
  color: #ad4e82;
  font-family: "Times New Roman", serif;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .13em;
}

.ending-album-entry strong,
.ending-album-entry span {
  display: block;
  overflow-wrap: anywhere;
}

.ending-album-entry strong {
  font-size: 11px;
  line-height: 1.45;
}

.ending-album-entry span {
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.45;
}

.ending-album-close {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--color-main), #7562a0);
  box-shadow: 0 8px 18px rgba(120,67,108,.2);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.ending-album-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

.ending-artwork-dialog {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 14px;
  background: rgba(28,22,48,.78);
  backdrop-filter: blur(12px);
}

.ending-artwork-dialog[hidden] {
  display: none;
}

.ending-artwork-card {
  width: min(100%, 370px);
  max-height: calc(100svh - 28px);
  padding: 10px 10px 14px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 24px;
  color: #fff;
  background: rgba(43,34,66,.96);
  box-shadow: 0 28px 80px rgba(16,10,31,.52);
  text-align: center;
}

.ending-artwork-picture {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 17px;
  background: #eee8f3;
}

.ending-artwork-picture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ending-artwork-kicker {
  margin: 11px 0 3px;
  color: #e7bdd7;
  font-family: "Times New Roman", serif;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .2em;
}

.ending-artwork-card h2 {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 18px;
  line-height: 1.45;
}

.ending-artwork-close {
  width: min(100%, 260px);
  min-height: 43px;
  margin-top: 10px;
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 999px;
  color: #4b3855;
  background: linear-gradient(135deg, #fff, #f4ddea);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.ending-artwork-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.title-footnote {
  margin: 10px 0 0;
  color: rgba(255,255,255,.82);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .22em;
  text-shadow: 0 1px 6px rgba(42,30,86,.58);
}

.title-petals {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.title-petals i {
  position: absolute;
  top: -9%;
  left: var(--title-petal-left);
  width: var(--title-petal-size);
  height: calc(var(--title-petal-size) * 1.45);
  border-radius: 80% 12% 75% 22%;
  background: linear-gradient(145deg, #fff7fc, #f3a5cc 74%);
  box-shadow: 0 1px 5px rgba(169,65,127,.18);
  opacity: 0;
  animation: title-petal-fall var(--title-petal-duration) linear var(--title-petal-delay) infinite;
}

.title-petals i:nth-child(1) {
  --title-petal-left: 7%;
  --title-petal-size: 9px;
  --title-petal-duration: 11s;
  --title-petal-delay: 1s;
}

.title-petals i:nth-child(2) {
  --title-petal-left: 35%;
  --title-petal-size: 12px;
  --title-petal-duration: 13s;
  --title-petal-delay: 4s;
}

.title-petals i:nth-child(3) {
  --title-petal-left: 68%;
  --title-petal-size: 8px;
  --title-petal-duration: 10s;
  --title-petal-delay: 2.4s;
}

.title-petals i:nth-child(4) {
  --title-petal-left: 91%;
  --title-petal-size: 10px;
  --title-petal-duration: 12s;
  --title-petal-delay: 6s;
}

@keyframes title-background-breathe {
  from { transform: scale(1.01); }
  to { transform: scale(1.045); }
}

@keyframes title-logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes title-button-shine {
  0%, 66% { left: -32%; opacity: 0; }
  72% { opacity: 1; }
  88%, 100% { left: 110%; opacity: 0; }
}

@keyframes title-petal-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -4svh, 0) rotate(0deg);
  }
  10%, 82% { opacity: .72; }
  100% {
    opacity: 0;
    transform: translate3d(72px, 116svh, 0) rotate(420deg);
  }
}

.game-screen {
  flex-direction: column;
  background: #ebe6ef;
}

.title-return-dialog {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(35,28,64,.48);
  backdrop-filter: blur(9px);
}

.title-return-dialog[hidden] {
  display: none;
}

.title-return-card {
  width: min(100%, 360px);
  padding: 25px 21px 20px;
  border: 1px solid rgba(255,255,255,.86);
  border-radius: 26px;
  color: #3c3155;
  background:
    radial-gradient(circle at 100% 0, rgba(255,205,234,.46), transparent 38%),
    linear-gradient(145deg, rgba(255,255,255,.99), rgba(246,239,255,.98));
  box-shadow: 0 24px 70px rgba(34,24,60,.34);
  text-align: left;
}

.title-return-kicker {
  margin: 0 0 5px;
  color: #a34b7c;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .17em;
}

.title-return-card h2 {
  margin: 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 24px;
}

.title-return-message {
  margin: 14px 0 0;
  padding: 13px 14px;
  border: 1px solid rgba(168,79,122,.15);
  border-radius: 15px;
  color: #6f5f78;
  background: rgba(255,255,255,.72);
  font-size: 11px;
  line-height: 1.75;
}

.title-return-message[data-warning="true"] {
  color: #8b4058;
  background: rgba(255,237,242,.82);
}

.title-return-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 17px;
}

.title-return-actions button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  color: #695d77;
  background: #eee8f2;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.title-return-actions button:last-child {
  color: #fff;
  background: linear-gradient(135deg, var(--color-main), #7562a0);
  box-shadow: 0 8px 18px rgba(120,67,108,.2);
}

.game-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-line);
  background: rgba(255,250,255,.94);
}

.quarter-badge {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 34px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  background: var(--color-main);
}

.chapter-name {
  overflow: hidden;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-button {
  border: 0;
  color: var(--color-accent);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.scene {
  position: relative;
  display: flex;
  flex: 1;
  align-items: flex-end;
  min-height: calc(100svh - 58px);
  padding: 18px 14px 20px;
  overflow: hidden;
  background-color: #e4dde8;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.background-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  background:
    linear-gradient(rgba(255,255,255,.2), rgba(255,255,255,.02)),
    repeating-linear-gradient(
      135deg,
      #e9e1eb 0 16px,
      #e5dce8 16px 32px
    );
}

.background-placeholder[hidden] {
  display: none;
}

.background-placeholder p {
  margin: 0;
  color: rgba(96,71,104,.42);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .18em;
}

.background-placeholder span {
  color: rgba(96,71,104,.38);
  font-size: 11px;
}

.foreground-image {
  position: absolute;
  z-index: 1;

  left: 50%;
  bottom: 145px;

  width: 100%;
  max-width: none;
  max-height: none;

  transform: translateX(-50%);
  pointer-events: none;
}

.foreground-image[hidden] {
  display: none;
}

/* 縦長のスマホ前景だけ高さに収める。プロローグの既存前景には適用しない。 */
.scene[data-foreground-layout="phone"] .foreground-image {
  bottom: 135px;
  height: 78%;
  object-fit: contain;
  object-position: center bottom;
}

/* Q1-03の手元画像は、広い画面では画面いっぱいの横幅を優先する。 */
.scene[data-foreground-layout="width-full"] .foreground-image {
  bottom: 135px;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center bottom;
}

.scene-caption {
  position: absolute;
  z-index: 2;
  top: 22px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 36px);
  margin: 0;
  padding: 10px 18px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 999px;
  color: #39446b;
  background: rgba(255,250,255,.93);
  box-shadow: 0 6px 24px rgba(69,48,92,.12);
  font-size: 12px;
  letter-spacing: .06em;
  line-height: 1.6;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
  animation: scene-caption-in .6s ease both;
}

.scene-caption[hidden] {
  display: none;
}

@keyframes scene-caption-in {
  from { opacity: 0; transform: translate(-50%, 5px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* 章の間に時間が空くときは、見逃しにくい専用の一画面を挟む。 */
.game-screen--time-passage .game-header {
  display: none;
}

.game-screen--time-passage .scene {
  min-height: 100svh;
  padding: 0;
}

.scene[data-scene-layout="time-passage"] {
  align-items: stretch;
}

.scene[data-scene-layout="time-passage"]::before {
  position: absolute;
  z-index: 2;
  inset: 0;
  content: "";
  background:
    radial-gradient(circle at 50% 42%, rgba(255,240,249,.14), transparent 48%),
    rgba(34,24,48,.62);
  backdrop-filter: blur(3px);
  animation: time-passage-shade-in .7s ease both;
}

@keyframes time-passage-shade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.scene-notification {
  position: absolute;
  z-index: 1;
  top: 24px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  border: 1px solid rgba(255,255,255,.92);
  border-radius: 20px;
  color: #29375f;
  background: linear-gradient(125deg, rgba(255,248,253,.97), rgba(233,247,250,.96));
  box-shadow: 0 12px 32px rgba(54,55,98,.16);
  pointer-events: none;
}

.scene-notification[hidden] {
  display: none;
}

.scene-notification-icon {
  display: grid;
  flex: 0 0 42px;
  place-items: center;
  height: 42px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, #8466b0, #409dba);
  font-size: 27px;
  font-weight: 700;
}

.scene-notification-content {
  min-width: 0;
  overflow-wrap: anywhere;
}

.scene-notification-title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
}

.scene-notification-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
}

.deadline-schedule {
  position: absolute;
  z-index: 1;
  top: clamp(58px, 10svh, 96px);
  left: 26px;
  right: 26px;
  padding: 20px 18px 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 24px;
  color: #263456;
  background:
    linear-gradient(135deg, rgba(255,255,255,.97), rgba(242,247,255,.96));
  box-shadow: 0 18px 50px rgba(42,52,92,.2);
  pointer-events: none;
  animation: deadline-schedule-in .55s ease both;
}

.deadline-schedule[hidden] {
  display: none;
}

.deadline-schedule::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  content: "";
  background: linear-gradient(#1698dd, #5d69b4);
}

.deadline-schedule-period {
  margin: 0 0 5px;
  color: #5672a1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
}

.deadline-schedule-title {
  margin: 0 0 14px;
  font-size: 17px;
  line-height: 1.45;
}

.deadline-schedule-list {
  display: grid;
  gap: 8px;
}

.deadline-schedule-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 10px 12px;
  border: 1px solid rgba(68,112,163,.14);
  border-radius: 14px;
  background: rgba(255,255,255,.82);
}

.deadline-schedule-label {
  align-self: end;
  color: #53617d;
  font-size: 10px;
  font-weight: 700;
}

.deadline-schedule-date {
  grid-row: span 2;
  align-self: center;
  color: #db3d55;
  font-size: 18px;
  letter-spacing: .03em;
}

.deadline-schedule-detail {
  color: #263456;
  font-size: 12px;
  font-weight: 700;
}

@keyframes deadline-schedule-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ZEN Portalの実画面を、会話を読みながら確認できる大きさに縮約した登録フォーム。 */
.my-step-form {
  position: absolute;
  z-index: 1;
  top: clamp(24px, 6svh, 52px);
  left: 20px;
  right: 20px;
  overflow: hidden;
  border: 1px solid rgba(16,75,103,.24);
  border-radius: 17px;
  color: #17232a;
  background: rgba(247,249,249,.97);
  box-shadow: 0 18px 48px rgba(19,51,69,.28);
  pointer-events: none;
  animation: deadline-schedule-in .55s ease both;
}

.my-step-form[hidden] {
  display: none;
}

/* 攻略カードと専用の進行ボタンを、会話枠を使わず画面中央へまとめる。 */
.strategy-guide-stage {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 24px 20px;
  pointer-events: none;
}

.strategy-guide-stage[hidden] {
  display: none;
}

/* 章末の要点を、ゲームの世界観を保ったまま持ち帰れる攻略カード。 */
.strategy-guide {
  position: relative;
  width: 100%;
  padding: 22px 20px 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.92);
  border-radius: 24px;
  color: #353458;
  background:
    radial-gradient(circle at 100% 0, rgba(255,213,237,.76), transparent 42%),
    linear-gradient(145deg, rgba(255,255,255,.98), rgba(239,240,255,.97));
  box-shadow: 0 20px 52px rgba(49,39,88,.24);
  pointer-events: none;
  animation: deadline-schedule-in .55s ease both;
}

.strategy-guide[hidden] {
  display: none;
}

.strategy-guide::before {
  position: absolute;
  top: 17px;
  right: 18px;
  color: rgba(190,70,137,.55);
  content: "✦";
  font-size: 22px;
}

.strategy-guide-kicker {
  margin: 0 0 5px;
  color: #a5487c;
  font-family: "Times New Roman", serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .18em;
}

.strategy-guide-title {
  margin: 0 30px 13px 0;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 20px;
  line-height: 1.45;
}

.strategy-guide-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.strategy-guide-list li {
  position: relative;
  padding: 8px 10px 8px 31px;
  border: 1px solid rgba(111,91,157,.13);
  border-radius: 12px;
  background: rgba(255,255,255,.76);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.55;
}

.strategy-guide-list li::before {
  position: absolute;
  top: 8px;
  left: 10px;
  color: #c14683;
  content: "✓";
  font-size: 13px;
}

.strategy-guide-action {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px dashed rgba(106,82,143,.25);
}

.strategy-guide-action span {
  padding: 3px 7px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #c54b87, #8262ae);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.strategy-guide-action p {
  margin: 0;
  color: #514c6b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.55;
}

.strategy-guide-next {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-self: center;
  width: min(76%, 310px);
  min-height: 58px;
  padding: 8px 20px 8px 26px;
  border: 3px solid rgba(255,255,255,.72);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #d94f99, #8e55ad);
  box-shadow:
    0 13px 28px rgba(94,45,110,.28),
    0 0 0 1px rgba(173,79,151,.22);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .04em;
  cursor: pointer;
  pointer-events: auto;
  animation: deadline-schedule-in .55s .08s ease both;
}

.strategy-guide-next b {
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
}

.strategy-guide-next:hover {
  filter: brightness(1.06);
}

.strategy-guide-next:focus-visible {
  outline: 3px solid rgba(255,255,255,.96);
  outline-offset: 3px;
}

.strategy-guide-navigation {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(90%, 360px);
  justify-self: center;
  pointer-events: none;
}

.strategy-guide-navigation button {
  pointer-events: auto;
}

.strategy-guide-navigation .strategy-guide-next {
  width: 100%;
}

.strategy-guide-back {
  display: grid;
  place-items: center;
  width: 58px;
  min-height: 58px;
  padding: 4px;
  border: 3px solid rgba(255,255,255,.72);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #a94f91, #7462a5);
  box-shadow: 0 13px 28px rgba(94,45,110,.22);
  cursor: pointer;
  animation: deadline-schedule-in .55s ease both;
}

.strategy-guide-back b {
  font-size: 25px;
  font-weight: 400;
  line-height: .75;
}

.strategy-guide-back span {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .04em;
  line-height: 1;
}

.strategy-guide-back:disabled {
  opacity: .35;
  cursor: default;
}

.my-step-portal-bar {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 30px;
  color: #fff;
  background: #075f86;
  font-size: 13px;
  font-weight: 500;
}

.my-step-menu-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  font-size: 14px;
  line-height: 1;
  transform: translateY(-52%);
}

.my-step-screen-title {
  display: grid;
  place-items: center;
  min-height: 34px;
  margin: 0;
  border-top: 1px solid rgba(255,255,255,.18);
  color: #fff;
  background: #075f86;
  font-size: 14px;
}

.my-step-category {
  position: relative;
  margin: 9px 10px 4px;
  padding: 8px 32px 8px 12px;
  border: 1px solid rgba(27,41,47,.30);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 5px rgba(22,44,55,.10);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.my-step-category::after {
  position: absolute;
  top: 50%;
  right: 10px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #fff;
  background: #d4d8da;
  content: "⌄";
  font-size: 13px;
  transform: translateY(-50%);
}

.my-step-subject {
  margin: 0;
  padding: 1px 10px 5px;
  border-bottom: 1px solid rgba(25,44,52,.25);
  font-size: 10px;
  text-align: center;
}

.my-step-tabs {
  display: flex;
  justify-content: center;
  padding: 6px 0 5px;
  font-size: 10px;
  font-weight: 700;
}

.my-step-tabs span,
.my-step-tabs strong {
  display: grid;
  place-items: center;
  min-width: 64px;
  min-height: 25px;
  border: 1px solid #7b858a;
  background: #e6e7e8;
}

.my-step-tabs span:first-child {
  min-width: 45px;
  border-color: #222;
  border-radius: 5px 0 0 5px;
  color: #fff;
  background: #222;
}

.my-step-tabs strong {
  border-color: #0874aa;
  color: #ed7517;
  background: #fff;
}

.my-step-tabs span:last-child {
  border-radius: 0 5px 5px 0;
}

.my-step-fields {
  display: grid;
  gap: 4px;
  padding: 0 10px 7px;
}

.my-step-field-heading {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
}

.my-step-field-label {
  font-size: 9px;
}

.my-step-required {
  padding: 1px 4px;
  border-radius: 3px;
  color: #fff;
  background: #d40000;
  font-size: 7px;
}

.my-step-field-value {
  display: block;
  min-height: 24px;
  padding: 5px 8px;
  border: 1px solid rgba(37,52,58,.30);
  border-top: 3px solid #222;
  border-radius: 5px;
  color: #185f83;
  background: #fff;
  font-size: 10px;
  font-weight: 700;
}

.my-step-actions {
  display: flex;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px 7px;
  background: #075f86;
  font-size: 9px;
  font-weight: 700;
}

.my-step-actions span,
.my-step-actions strong,
.my-step-actions b {
  min-width: 68px;
  padding: 6px 8px;
  border-radius: 5px;
  color: #1f2426;
  background: #fff;
  text-align: center;
}

.my-step-actions b {
  color: #fff;
  background: #daa600;
}

.character-image {
  position: absolute;
  z-index: 1;

  left: 50%;
  bottom: 135px;

  /* 素材の切れ目が画面内に浮かないよう、左右をシーンの端まで広げる。 */
  width: 100%;
  height: 72%;

  transform: translateX(-50%);
  /* 縦横比は保ち、頭側を残して余った下側を会話枠の後ろで切り取る。 */
  object-fit: cover;
  object-position: center top;

  pointer-events: none;
}

.character-image[hidden] {
  display: none;
}

/* 離れた全身姿用。通常の立ち絵を画面の左右端に合わせる設定は変えない。 */
.character-image[data-layout="full-body"] {
  /* 足元を会話枠の後ろに隠し、宙に浮いて見える隙間をなくす。 */
  bottom: 160px;
  height: min(54%, calc(100% - 260px));
  object-fit: contain;
  object-position: center bottom;
}

/* Q1-03のSlackくんは、広い画面では画面いっぱいの横幅を優先する。 */
.character-image[data-layout="width-full"] {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center bottom;
}

@media (max-width: 899px) {
  /* スマホではQ1-04と同じ収まりに戻し、顔やスマホが大きく切れないようにする。 */
  .scene[data-foreground-layout="width-full"] .foreground-image {
    height: 78%;
    object-fit: contain;
  }

  .scene[data-foreground-layout="phone"] .foreground-image {
    width: 92%;
    height: 76%;
  }

  .character-image[data-layout="width-full"] {
    height: 72%;
    object-fit: cover;
    object-position: center top;
  }

  /* マイステップの全項目が会話欄の後ろへ隠れないように少し縮める。 */
  .my-step-form {
    top: 12px;
    left: 28px;
    right: 28px;
    transform: scale(.88);
    transform-origin: top center;
  }
}

.dialogue-box {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 174px;
  padding: 28px 20px 14px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 22px;
  background: rgba(255,252,255,.94);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.speaker-name {
  position: absolute;
  top: -17px;
  left: 18px;
  min-width: 104px;
  padding: 8px 16px;
  border-radius: 999px;
  color: #fff;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-main), #8165a4);
}

.speaker-name[hidden] {
  display: none;
}

.dialogue-text {
  min-height: 78px;
  margin: 0;
  font-size: 15px;
  line-height: 1.9;
  white-space: pre-wrap;
}

.dialogue-text--emphasis {
  color: #253d45;
  font-weight: 700;
}

.choice-area {
  display: grid;
  gap: 9px;
  margin: 12px 0 4px;
}

.choice-area[hidden] { display: none; }

.choice-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 9px 13px 9px 10px;
  border: 1px solid rgba(126,87,129,.20);
  border-radius: 16px;
  color: var(--color-text);
  text-align: left;
  background: rgba(255,255,255,.88);
  box-shadow: 0 7px 18px rgba(66,44,82,.07);
  cursor: pointer;
  transition:
    border-color .18s ease,
    box-shadow .18s ease,
    transform .18s ease;
}

.choice-button:nth-child(2) .choice-label {
  background: linear-gradient(135deg, #8d6bb0, #667bc1);
}

.choice-button:nth-child(3) .choice-label {
  background: linear-gradient(135deg, #6c79ad, #6d9bc0);
}

.choice-label {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #d84988, #a44e93);
  box-shadow: 0 4px 12px rgba(118,61,111,.22);
  font-family: "Times New Roman", serif;
  font-size: 16px;
  font-weight: 700;
}

.choice-text {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.choice-button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.dialogue-box--choice {
  padding-top: 23px;
  background: rgba(255,252,255,.97);
}

.dialogue-box--choice .dialogue-text {
  min-height: 0;
  color: #45305b;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .06em;
  text-align: center;
}

.dialogue-box--clear {
  overflow: hidden;
  border-color: rgba(255,255,255,.9);
  background:
    radial-gradient(circle at 50% 20%, rgba(255,255,255,.96), transparent 52%),
    linear-gradient(135deg, rgba(255,239,249,.97), rgba(235,235,255,.97));
  box-shadow:
    0 20px 54px rgba(68,47,99,.24),
    inset 0 0 0 1px rgba(214,133,185,.18);
}

.dialogue-box--clear::before,
.dialogue-box--clear::after {
  position: absolute;
  top: 25px;
  color: rgba(204,72,139,.66);
  content: "✦";
  font-size: 16px;
}

.dialogue-box--clear::before { left: 28px; }
.dialogue-box--clear::after { right: 28px; }

.dialogue-box--clear .dialogue-text {
  display: grid;
  place-items: center;
  min-height: 82px;
  color: #253d7a;
  font-family: "Times New Roman", "Yu Mincho", serif;
  font-size: clamp(23px, 7vw, 30px);
  font-weight: 700;
  letter-spacing: .12em;
  text-align: center;
  text-shadow: 0 2px 0 #fff, 0 6px 18px rgba(102,66,139,.16);
}

.dialogue-box--time-passage {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  margin: 0;
  padding:
    max(28px, env(safe-area-inset-top))
    24px
    max(18px, env(safe-area-inset-bottom));
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(90deg, transparent, rgba(255,255,255,.62), transparent) center 16% / 72% 1px no-repeat,
    linear-gradient(90deg, transparent, rgba(255,255,255,.48), transparent) center calc(100% - 82px) / 72% 1px no-repeat,
    linear-gradient(145deg, rgba(77,54,94,.88), rgba(42,52,88,.91));
  box-shadow: none;
  backdrop-filter: blur(8px);
  animation: time-passage-card-in .7s cubic-bezier(.2,.8,.2,1) both;
}

.dialogue-text--time-passage {
  display: grid;
  flex: 1;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 0;
  color: #fff;
  text-align: center;
}

.time-passage-label {
  color: #ead0e3;
  font-family: "Times New Roman", serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .28em;
}

.time-passage-title {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(27px, 8vw, 35px);
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.45;
  text-shadow: 0 5px 22px rgba(0,0,0,.28);
}

.time-passage-detail {
  color: rgba(255,255,255,.78);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
}

.dialogue-box--time-passage .dialogue-footer {
  grid-template-columns: 38px minmax(0, 1fr);
  margin-top: 0;
  border-top: 0;
}

.dialogue-box--time-passage .tap-guide {
  color: rgba(255,255,255,.64);
}

.dialogue-box--time-passage .dialogue-nav-button {
  color: #594267;
  background: rgba(255,255,255,.9);
}

.dialogue-box--time-passage .bookmark-status {
  color: rgba(255,255,255,.6);
}

@keyframes time-passage-card-in {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (hover: hover) {
  .choice-button:hover {
    border-color: rgba(180,74,132,.48);
    box-shadow: 0 10px 22px rgba(102,51,99,.13);
    transform: translateY(-1px);
  }
}

.dialogue-footer {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--color-line);
}

.tap-guide {
  color: #aa9eae;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .15em;
  text-align: center;
}

.dialogue-nav-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--color-main);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.dialogue-nav-button:disabled {
  opacity: .28;
  cursor: default;
}

.dialogue-nav-button[hidden] {
  display: none;
}

@media (min-width: 900px) {
  body { overflow: hidden; }

  .site-shell {
    position: relative;
    display: grid;
    grid-template-columns: minmax(220px, 1fr) var(--game-max-width) minmax(220px, 1fr);
    align-items: stretch;
    overflow: hidden;
    background: #dcecff;
    isolation: isolate;
  }

  .site-shell::before,
  .site-shell::after {
    position: absolute;
    content: "";
    inset: -5%;
    pointer-events: none;
  }

  .site-shell::before {
    z-index: -2;
    background-image: url("../assets/images/backgrounds/op-campus.png");
    background-image: image-set(
      url("../assets/images/backgrounds/op-campus.webp") type("image/webp"),
      url("../assets/images/backgrounds/op-campus.png") type("image/png")
    );
    background-position: center 48%;
    background-size: cover;
    background-repeat: no-repeat;
    filter: blur(16px) saturate(.88);
    transform: scale(1.05);
  }

  .site-shell::after {
    z-index: -1;
    background:
      linear-gradient(90deg, rgba(239,244,255,.68), rgba(243,229,247,.46) 50%, rgba(224,236,255,.68)),
      linear-gradient(180deg, rgba(255,255,255,.15), rgba(59,42,104,.16));
  }

  .game-frame {
    z-index: 2;
    width: var(--game-max-width);
    max-width: var(--game-max-width);
    border-inline: 1px solid rgba(255,255,255,.68);
    box-shadow:
      -22px 0 64px rgba(42,38,91,.18),
      22px 0 64px rgba(42,38,91,.18);
  }

  .desktop-side {
    position: relative;
    z-index: 1;
    display: flex;
    min-width: 0;
    overflow: hidden;
    padding: clamp(26px, 4vw, 68px);
    color: #263871;
  }

  .desktop-side--left {
    align-items: center;
    justify-content: flex-end;
    border-right: 1px solid rgba(255,255,255,.32);
    text-align: left;
  }

  .desktop-side--right {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    border-left: 1px solid rgba(255,255,255,.32);
  }

  .side-copy {
    width: min(100%, 360px);
  }

  .side-kicker, .side-note {
    color: rgba(34,50,103,.62);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .19em;
  }

  .side-lead {
    margin: 17px 0 22px;
    color: rgba(33,49,102,.82);
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: clamp(34px, 4vw, 64px);
    font-weight: 600;
    letter-spacing: .04em;
    line-height: 1.28;
    text-shadow: 0 2px 16px rgba(255,255,255,.75);
  }

  .side-lead strong {
    color: #a93d79;
    font-weight: 700;
  }

  .side-text {
    margin: 0;
    color: rgba(44,47,91,.68);
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: clamp(11px, 1.1vw, 14px);
    line-height: 2;
    text-shadow: 0 1px 9px rgba(255,255,255,.86);
  }

  .side-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 24px;
  }

  .side-tags span {
    padding: 6px 9px;
    border: 1px solid rgba(255,255,255,.56);
    border-radius: 999px;
    color: rgba(117,55,105,.70);
    background: rgba(255,255,255,.34);
    box-shadow: 0 4px 14px rgba(64,50,110,.08);
    font-size: 9px;
    font-weight: 700;
    backdrop-filter: blur(7px);
  }

  .side-year-card {
    width: min(100%, 324px);
    padding: clamp(20px, 2.5vw, 31px);
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 28px;
    background: rgba(247,245,255,.35);
    box-shadow:
      0 22px 54px rgba(52,38,99,.14),
      inset 0 1px 0 rgba(255,255,255,.72);
    backdrop-filter: blur(12px);
  }

  .quarter-list {
    display: grid;
    gap: 9px;
    margin: 21px 0 25px;
  }

  .quarter-item {
    display: grid;
    grid-template-columns: 24px 48px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 54px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 16px;
  }

  .quarter-item--current {
    border-color: rgba(255,255,255,.66);
    background: linear-gradient(125deg, rgba(227,90,153,.18), rgba(103,103,184,.16));
    box-shadow: 0 8px 20px rgba(82,50,118,.10);
  }

  .quarter-item span {
    color: rgba(62,67,119,.38);
    font-size: 9px;
    font-weight: 800;
  }

  .quarter-item b {
    color: rgba(39,53,109,.77);
    font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
    font-size: 25px;
    line-height: 1;
  }

  .quarter-item--current b {
    color: #a53676;
  }

  .quarter-item small {
    overflow: hidden;
    color: rgba(51,52,97,.61);
    font-size: 9px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .side-note {
    margin: 0;
    line-height: 1.8;
  }

  .side-vertical-copy {
    position: absolute;
    bottom: 34px;
    left: 24px;
    margin: 0;
    color: rgba(39,49,99,.32);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .24em;
    writing-mode: vertical-rl;
  }

  .side-vertical-copy--right {
    right: 24px;
    left: auto;
  }
}

@media (max-width: 360px) {
  .title-screen { padding-inline: 13px; }
  .title-menu { padding: 9px; }
  .title-sub-menu { gap: 6px; }
  .sub-button strong { font-size: 10px; }
  .dialogue-box { padding-inline: 16px; }
  .choice-button {
    grid-template-columns: 31px minmax(0, 1fr);
    gap: 8px;
    padding-right: 10px;
  }
  .choice-label {
    width: 31px;
    height: 31px;
  }
  .choice-text { font-size: 11px; }
  .ending-album-list { grid-template-columns: 1fr; }
}

/* =========================================
   Header actions / sound controls
   ========================================= */

.game-header {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sound-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 82px;
  padding: 5px 7px;
  border: 1px solid rgba(190,83,139,.2);
  border-radius: 999px;
  color: #744565;
  background: linear-gradient(135deg, rgba(255,246,252,.94), rgba(240,235,255,.92));
  box-shadow: 0 4px 12px rgba(116,64,106,.08);
}

.sound-button-label {
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
}

.sound-switch {
  position: relative;
  flex: 0 0 31px;
  width: 31px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, #df5c96, #8268b0);
  box-shadow:
    inset 0 1px 2px rgba(89,45,91,.2),
    0 2px 7px rgba(153,67,125,.18);
  transition: background-color .2s ease;
}

.sound-switch::after {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  content: "♪";
  display: grid;
  place-items: center;
  color: #b44979;
  background: #fff9fd;
  box-shadow: 0 1px 5px rgba(28,48,42,.28);
  font-size: 8px;
  font-weight: 800;
  line-height: 1;
  transition: transform .2s ease;
}

.sound-button--off .sound-switch {
  background: #c9becd;
}

.sound-button--off .sound-switch::after {
  transform: translateX(-13px);
}

.sound-button:focus-visible {
  outline: 2px solid var(--color-main);
  outline-offset: 2px;
}

.header-button:disabled {
  opacity: .28;
  cursor: default;
}

@media (max-width: 390px) {
  .header-actions {
    gap: 4px;
  }

  .header-button {
    padding-inline: 3px;
    font-size: 9px;
  }

  .sound-button {
    gap: 4px;
    min-width: 73px;
    padding-inline: 5px;
  }

  .sound-button-label {
    font-size: 8px;
  }
}

/* =========================================
   Quarter result
   ========================================= */

.result-screen {
  position: relative;
  align-items: center;
  justify-content: center;
  padding: 18px 14px;
  overflow-y: auto;
  background-color: #cbe7ff;
  background-image: url("../assets/images/backgrounds/op-campus.png");
  background-image: image-set(
    url("../assets/images/backgrounds/op-campus.webp") type("image/webp"),
    url("../assets/images/backgrounds/op-campus.png") type("image/png")
  );
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  isolation: isolate;
}

.result-screen::before,
.result-screen::after {
  position: absolute;
  content: "";
  inset: 0;
  pointer-events: none;
}

.result-screen::before {
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(236,246,255,.33), rgba(240,218,242,.42)),
    radial-gradient(circle at 50% 34%, transparent 24%, rgba(44,38,94,.22) 100%);
  backdrop-filter: blur(2px);
}

.result-screen::after {
  z-index: 0;
  background:
    radial-gradient(circle at 12% 16%, rgba(255,255,255,.88) 0 2px, transparent 3px),
    radial-gradient(circle at 87% 31%, rgba(255,255,255,.76) 0 1px, transparent 2px),
    radial-gradient(circle at 17% 78%, rgba(255,224,244,.88) 0 2px, transparent 3px),
    radial-gradient(circle at 91% 86%, rgba(255,255,255,.78) 0 2px, transparent 3px);
}

.result-card {
  --grade-start: #db4b91;
  --grade-end: #6c67b2;
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 23px 19px 13px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.82);
  border-radius: 30px;
  background: rgba(253,250,255,.84);
  box-shadow:
    0 24px 60px rgba(39,31,87,.26),
    inset 0 1px 0 rgba(255,255,255,.86);
  backdrop-filter: blur(16px);
}

.result-card::before {
  position: absolute;
  content: "";
  top: 0;
  right: 0;
  left: 0;
  height: 7px;
  background: linear-gradient(90deg, #e24c91, #a957a7 52%, #566cb6);
}

.result-screen.screen--active .result-card {
  animation: result-card-in .45s cubic-bezier(.2,.8,.2,1) both;
}

.result-card[data-grade="S"] {
  --grade-start: #f0a53e;
  --grade-end: #e75b8d;
}

.result-card[data-grade="A"] {
  --grade-start: #e2488d;
  --grade-end: #a652a4;
}

.result-card[data-grade="B"] {
  --grade-start: #9c63b4;
  --grade-end: #6570b8;
}

.result-card[data-grade="C"] {
  --grade-start: #6876ae;
  --grade-end: #7f6e9d;
}

.result-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.result-heading {
  min-width: 0;
}

.result-kicker {
  margin: 0 0 4px;
  color: rgba(51,55,112,.58);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .15em;
}

.result-title {
  margin: 0;
  color: #283d7c;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 27px;
  letter-spacing: .04em;
  line-height: 1.2;
}

.result-title span {
  color: #bd3e7b;
  font-size: 34px;
}

.result-term {
  margin: 5px 0 0;
  color: rgba(74,62,113,.42);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .22em;
}

.result-grade-box {
  position: relative;
  display: grid;
  align-items: center;
  flex: 0 0 92px;
  width: 92px;
  height: 92px;
  padding: 11px;
  border: 1px solid rgba(255,255,255,.80);
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, var(--grade-start), var(--grade-end));
  box-shadow:
    0 10px 24px rgba(94,48,112,.26),
    inset 0 1px 0 rgba(255,255,255,.35);
  text-align: center;
}

.result-grade-box::before {
  position: absolute;
  content: "";
  inset: 6px;
  border: 1px solid rgba(255,255,255,.40);
  border-radius: inherit;
}

.result-grade-box span {
  align-self: end;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .2em;
  opacity: .78;
}

.result-grade-box strong {
  position: relative;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 36px;
  line-height: 1;
  text-shadow: 0 2px 9px rgba(49,28,81,.20);
}

.result-grade-box small {
  align-self: start;
  font-size: 7px;
  font-weight: 700;
  opacity: .82;
}

.result-section-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
  color: rgba(52,56,112,.55);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .2em;
}

.result-section-heading i {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(91,70,126,.20), transparent);
}

.result-metrics {
  display: grid;
  gap: 9px;
}

.result-metric {
  padding: 10px 13px 11px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 15px;
  background: rgba(255,255,255,.48);
  box-shadow: 0 5px 16px rgba(63,50,106,.07);
}

.result-metric-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.result-metric-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-metric-name > span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: #fff;
  background: #d34b8b;
  font-size: 7px;
  font-weight: 800;
}

.result-metric:nth-child(2) .result-metric-name > span {
  background: #9b62ad;
}

.result-metric:nth-child(3) .result-metric-name > span {
  background: #5e70ad;
}

.result-metric-name strong {
  color: #303c70;
  font-size: 12px;
  font-weight: 700;
}

.result-metric-heading b {
  color: #bc3e79;
  font-size: 10px;
}

.result-metric-heading b span {
  font-size: 15px;
}

.result-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(75,64,112,.10);
}

.result-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e44b91, #c757a1);
  transition: width .45s ease;
}

.result-metric:nth-child(2) .result-bar span {
  background: linear-gradient(90deg, #b35fae, #8a66b5);
}

.result-metric:nth-child(3) .result-bar span {
  background: linear-gradient(90deg, #7472bb, #526eac);
}

.result-summary {
  display: grid;
  gap: 9px;
  margin: 13px 0;
}

.result-comment-card {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(116,93,146,.12);
  border-radius: 14px;
  background: rgba(245,239,249,.66);
}

.result-comment-card > span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #d64b8c;
  background: rgba(255,255,255,.75);
  font-size: 10px;
  box-shadow: 0 4px 12px rgba(93,54,116,.09);
}

.result-comment-card p {
  margin: 0;
  color: rgba(49,47,83,.80);
  font-size: 10px;
  line-height: 1.65;
}

.result-close-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 290px;
  min-height: 50px;
  margin: 0 auto;
  background: linear-gradient(125deg, #d84288, #8659aa 58%, #5a6db1);
  box-shadow: 0 10px 24px rgba(110,51,115,.24);
  letter-spacing: .10em;
}

.result-close-button b {
  position: absolute;
  top: 50%;
  right: 19px;
  font-size: 24px;
  font-weight: 300;
  transform: translateY(-54%);
}

.result-sheet-number {
  margin: 8px 0 0;
  color: rgba(66,57,107,.32);
  font-size: 6px;
  font-weight: 800;
  letter-spacing: .24em;
  text-align: center;
}

/* =========================================
   Story ending
   ========================================= */

.ending-screen {
  --ending-accent: #c78a45;
  --ending-secondary: #ca648b;
  position: relative;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at 15% 8%, rgba(255,255,255,.92), transparent 25%),
    linear-gradient(165deg, #fff8ee 0%, #fce5eb 52%, #e8dbf0 100%);
  isolation: isolate;
}

.ending-screen[data-ending="self-management"] {
  --ending-accent: #cf7899;
  --ending-secondary: #6c9fcf;
}

.ending-screen[data-ending="information-use"] {
  --ending-accent: #7669b9;
  --ending-secondary: #59aebe;
}

.ending-screen[data-ending="university-life"] {
  --ending-accent: #3d9689;
  --ending-secondary: #d783a4;
}

.ending-screen[data-ending="tight"] {
  --ending-accent: #317fc4;
  --ending-secondary: #e29a48;
}

.ending-visual {
  position: relative;
  z-index: 0;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 100%;
  height: min(66svh, 660px);
  min-height: 420px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 24%, rgba(255,255,255,.95), transparent 42%),
    linear-gradient(160deg, #f7d7d5, #f5e8cb 55%, #d8cce8);
}

.ending-picture {
  display: block;
  width: 100%;
  height: 100%;
}

.ending-picture img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
}

.ending-visual[data-has-artwork="false"] .ending-picture img {
  object-fit: cover;
  object-position: center;
  filter: saturate(.82) brightness(1.05);
}

.ending-light {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,246,228,.03) 48%, rgba(71,39,70,.18) 100%),
    radial-gradient(circle at 50% 3%, rgba(255,244,204,.40), transparent 38%);
}

.ending-petals {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ending-petals i {
  position: absolute;
  top: -7%;
  width: 9px;
  height: 6px;
  border-radius: 80% 20% 70% 30%;
  background: rgba(255,217,225,.92);
  box-shadow: 0 1px 5px rgba(117,61,83,.18);
  animation: ending-petal-fall 7s linear infinite;
}

.ending-petals i:nth-child(1) { left: 12%; animation-delay: -2s; }
.ending-petals i:nth-child(2) { left: 37%; animation-delay: -5s; animation-duration: 8.5s; }
.ending-petals i:nth-child(3) { left: 68%; animation-delay: -1s; animation-duration: 6.5s; }
.ending-petals i:nth-child(4) { left: 88%; animation-delay: -4s; animation-duration: 9s; }

/* 青空を走るカツカツENDでは、画像内の動きだけを生かす。 */
.ending-screen[data-ending="tight"] .ending-petals {
  display: none;
}

.ending-panel {
  position: relative;
  z-index: 2;
  width: calc(100% - 24px);
  margin: -52px 12px 14px;
  padding: 22px 18px 14px;
  border: 1px solid rgba(255,255,255,.88);
  border-radius: 28px;
  color: #3a3043;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--ending-accent) 20%, transparent), transparent 34%),
    rgba(255,252,253,.94);
  box-shadow:
    0 22px 54px rgba(63,42,74,.24),
    inset 0 1px 0 rgba(255,255,255,.92);
  text-align: center;
  backdrop-filter: blur(16px);
}

.ending-screen.screen--active .ending-panel {
  animation: ending-panel-in .65s cubic-bezier(.18,.78,.22,1) both;
}

.ending-kicker {
  margin: 0;
  color: var(--ending-accent);
  font-family: "Times New Roman", serif;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .22em;
}

.ending-unlocked {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 7px 0 9px;
  padding: 4px 10px;
  border: 1px solid color-mix(in srgb, var(--ending-accent) 34%, transparent);
  border-radius: 999px;
  color: #7b5c54;
  background: rgba(255,248,230,.74);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: .13em;
}

.ending-unlocked span {
  color: var(--ending-accent);
}

.ending-panel h2 {
  margin: 0;
  color: #57344c;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(23px, 6.4vw, 29px);
  letter-spacing: .05em;
  line-height: 1.38;
  text-wrap: balance;
}

.ending-panel h2:focus { outline: none; }

.ending-message {
  margin: 7px 0 13px;
  color: #887986;
  font-size: 9px;
  letter-spacing: .08em;
}

.ending-scores {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-bottom: 13px;
}

.ending-scores > div {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 9px 5px 8px;
  border: 1px solid rgba(113,84,116,.12);
  border-radius: 13px;
  background: rgba(250,245,250,.72);
}

.ending-scores span {
  overflow-wrap: anywhere;
  color: #756775;
  font-size: 8px;
  font-weight: 700;
}

.ending-scores span b {
  margin-right: 2px;
  color: var(--ending-accent);
  font-family: "Times New Roman", serif;
}

.ending-scores strong {
  color: #4e4252;
  font-family: "Times New Roman", serif;
  font-size: 12px;
  letter-spacing: .04em;
}

.ending-title-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 250px;
  min-height: 46px;
  margin: 0 auto;
  border: 1px solid rgba(255,255,255,.42);
  background: linear-gradient(135deg, var(--color-main), #875f9e);
  box-shadow:
    0 8px 18px rgba(114,62,104,.18),
    inset 0 1px 0 rgba(255,255,255,.24);
  font-size: 13px;
  letter-spacing: .08em;
}

.ending-title-button b {
  position: absolute;
  top: 50%;
  right: 19px;
  font-size: 24px;
  font-weight: 300;
  transform: translateY(-54%);
}

.ending-save-note {
  margin: 8px 0 0;
  color: rgba(91,76,94,.54);
  font-size: 7px;
  letter-spacing: .05em;
}

@keyframes ending-panel-in {
  from { opacity: 0; transform: translateY(18px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ending-petal-fall {
  from { transform: translate3d(0, -8px, 0) rotate(0deg); }
  to { transform: translate3d(34px, 72svh, 0) rotate(280deg); }
}

@keyframes result-card-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-height: 700px) {
  .title-screen {
    padding-block: 12px;
  }

  .title-content {
    min-height: calc(100svh - 24px);
  }

  .title-brand {
    margin-top: 0;
  }

  .game-logo img {
    width: min(82%, 320px);
  }

  .title-menu {
    gap: 7px;
    padding: 8px;
  }

  .title-start-button {
    min-height: 54px;
  }

  .sub-button {
    min-height: 46px;
  }

  .ending-album-button {
    min-height: 39px;
  }

  .ending-artwork-card {
    width: min(100%, 320px);
  }

  .ending-artwork-picture {
    width: min(100%, 280px);
    margin-inline: auto;
  }

  .opening-copy { top: 15%; }
  .opening-logo { width: min(88%, 360px); }
  .opening-game-start { margin-top: 10px; }

  .result-screen {
    align-items: flex-start;
    padding-block: 10px;
  }

  .ending-visual {
    height: min(64svh, 470px);
    min-height: 370px;
  }

  .ending-panel {
    margin-top: -42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene-caption {
    animation: none;
  }

  .scene[data-scene-layout="time-passage"]::before,
  .dialogue-box--time-passage,
  .deadline-schedule,
  .my-step-form,
  .strategy-guide,
  .strategy-guide-next {
    animation: none;
  }

  .game-screen--leaving {
    animation-duration: .15s;
  }

  .opening-background,
  .opening-copy-line,
  .opening-logo,
  .opening-sparkles span {
    transform: none !important;
  }

  .opening-petals,
  .opening-sparkles {
    display: none;
  }

  .opening-skip {
    animation: none;
  }

  .title-screen::before,
  .game-logo img,
  .title-start-button::before {
    animation: none;
  }

  .title-petals {
    display: none;
  }

  .result-screen.screen--active .result-card {
    animation: none;
  }

  .ending-screen.screen--active .ending-panel,
  .ending-petals i {
    animation: none;
  }

  .result-bar span {
    transition: none;
  }

  .choice-button {
    transition: none;
    transform: none;
  }
}
