@font-face {
  font-family: "Slide Xia XingKai";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("../assets/fonts/SlideXiaXingKai-Title.woff2") format("woff2");
}

:root {
  --pink: #ff9ec7;
  --pink-deep: #f267a3;
  --pink-soft: #ffd8e8;
  --pink-mist: #fff2f8;
  --purple: #b39ddb;
  --purple-deep: #795aa7;
  --purple-soft: #ddd2f1;
  --gold: linear-gradient(135deg, #fff8cf 0%, #f8d477 38%, #d99a3a 70%, #fff0ad 100%);
  --gold-solid: #e6b653;
  --ink: #553b5f;
  --ink-soft: #806b87;
  --glass-white: rgba(255, 255, 255, 0.76);
  --glass-white-strong: rgba(255, 255, 255, 0.9);
  --stage-radius: clamp(10px, 1.6vw, 24px);
  --shadow-soft: 0 12px 36px rgba(106, 70, 130, 0.2);
  --shadow-pink: 0 10px 28px rgba(242, 103, 163, 0.28);
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

html,
body {
  width: 100%;
  min-width: 320px;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  display: grid;
  place-items: center;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.94) 0 4%, transparent 24%),
    radial-gradient(circle at 86% 78%, rgba(255, 215, 235, 0.78), transparent 28%),
    linear-gradient(135deg, #fff0f7 0%, #e8ddf5 48%, #f8bfd8 100%);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 3px solid rgba(121, 90, 167, 0.7);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.hidden {
  display: none !important;
}

#stage {
  position: relative;
  isolation: isolate;
  width: min(100vw, calc(100vh * 16 / 9));
  max-height: 100vh;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: clamp(2px, 0.35vmin, 4px) solid transparent;
  border-radius: var(--stage-radius);
  background:
    linear-gradient(#f8e8f1, #f8e8f1) padding-box,
    linear-gradient(135deg, #ffd8e8 0%, #d6c4ef 45%, #ff91c0 76%, #f7d989 100%) border-box;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.72),
    0 20px 70px rgba(90, 55, 112, 0.27),
    0 0 60px rgba(255, 158, 199, 0.22);
}

#stage::before {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, rgba(91, 57, 107, 0.06), transparent 20% 78%, rgba(91, 57, 107, 0.08)),
    linear-gradient(0deg, rgba(75, 44, 88, 0.13), transparent 28%);
}

.bg-layer {
  position: absolute;
  z-index: 0;
  inset: 0;
  opacity: 0;
  background-color: #eadcf3;
  background-image:
    radial-gradient(circle at 72% 32%, rgba(255, 255, 255, 0.78), transparent 24%),
    linear-gradient(135deg, #f9d8e6 0%, #cdbce8 52%, #f8bdd7 100%);
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  will-change: opacity;
}

.bg-layer.active {
  opacity: 1;
}

#sprite {
  position: absolute;
  z-index: 8;
  right: 7%;
  bottom: 0;
  width: auto;
  height: 94%;
  max-width: 66%;
  object-fit: contain;
  object-position: right bottom;
  filter: drop-shadow(0 10px 22px rgba(73, 49, 86, 0.2));
  transform-origin: 50% 88%;
  will-change: transform, opacity;
}

#sprite:not([src]),
#sprite[src=""] {
  display: none;
}

#dialog {
  position: absolute;
  z-index: 20;
  right: 4%;
  bottom: 3%;
  left: 4%;
  display: flex;
  min-height: clamp(104px, 18%, 148px);
  padding: clamp(18px, 2.4vmin, 28px) clamp(28px, 4.4vmin, 54px);
  align-items: center;
  border: clamp(1px, 0.2vmin, 2px) solid rgba(255, 133, 185, 0.82);
  border-radius: clamp(14px, 2.2vmin, 26px);
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.9), rgba(255, 245, 251, 0.68)),
    var(--glass-white);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.78),
    0 14px 40px rgba(80, 51, 94, 0.2),
    0 0 28px rgba(255, 158, 199, 0.17);
  -webkit-backdrop-filter: blur(16px) saturate(1.16);
  backdrop-filter: blur(16px) saturate(1.16);
}

#dialog::before {
  position: absolute;
  top: 8px;
  right: 12px;
  bottom: 8px;
  left: 12px;
  pointer-events: none;
  content: "";
  border: 1px solid rgba(230, 182, 83, 0.25);
  border-radius: inherit;
}

#namebox {
  position: absolute;
  top: 0;
  left: clamp(20px, 4.4vmin, 52px);
  min-width: clamp(108px, 16vmin, 180px);
  padding: clamp(8px, 1.2vmin, 13px) clamp(20px, 2.8vmin, 32px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 999px;
  background: linear-gradient(135deg, #ff8ebd, #d88fc7 54%, #a88fd4);
  box-shadow: 0 6px 18px rgba(211, 97, 153, 0.32);
  font-size: clamp(18px, 2.25vmin, 25px);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-align: center;
  transform: translateY(-50%);
}

#namebox:empty {
  display: none;
}

#textbox {
  position: relative;
  z-index: 1;
  width: 100%;
  margin: 0;
  color: #4e3c58;
  font-size: clamp(22px, 2.5vmin, 28px);
  font-weight: 500;
  letter-spacing: 0.035em;
  line-height: 1.6;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.82);
}

.dialog-next {
  position: absolute;
  right: clamp(18px, 3vmin, 34px);
  bottom: clamp(12px, 1.8vmin, 22px);
  width: 0;
  height: 0;
  border-top: clamp(6px, 0.9vmin, 10px) solid var(--pink-deep);
  border-right: clamp(5px, 0.7vmin, 8px) solid transparent;
  border-left: clamp(5px, 0.7vmin, 8px) solid transparent;
  filter: drop-shadow(0 2px 2px rgba(242, 103, 163, 0.24));
}

#choices {
  position: absolute;
  z-index: 28;
  right: 10%;
  bottom: 28%;
  left: 10%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(10px, 1.5vmin, 16px);
  pointer-events: none;
}

#choices:empty {
  display: none;
}

#choices.choice-grid {
  right: 7%;
  left: 7%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#choices > button,
.choice-button {
  min-height: clamp(56px, 7.2vmin, 72px);
  padding: clamp(13px, 1.8vmin, 20px) clamp(28px, 4vmin, 48px);
  color: #704e78;
  border: 2px solid rgba(242, 103, 163, 0.72);
  border-radius: 999px;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.98), rgba(255, 244, 250, 0.92)),
    var(--glass-white-strong);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.9),
    0 8px 22px rgba(91, 61, 105, 0.16);
  font-size: clamp(20px, 2.2vmin, 24px);
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.35;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

#choices > button:hover,
#choices > button:active,
.choice-button:hover,
.choice-button:active {
  color: var(--pink-deep);
  border-color: var(--pink-deep);
  background: linear-gradient(100deg, #fff, #ffe5f1 62%, #eee5fb);
  box-shadow: 0 14px 34px rgba(242, 103, 163, 0.36), 0 0 0 5px rgba(255, 255, 255, 0.4);
  transform: translateY(-3px) scale(1.025);
}

#affection-bar {
  position: absolute;
  z-index: 34;
  top: 3.5%;
  right: 3%;
  display: grid;
  width: clamp(210px, 25vmin, 286px);
  align-items: center;
  min-height: 58px;
  padding: clamp(9px, 1.2vmin, 13px) clamp(14px, 1.8vmin, 20px);
  grid-template-columns: 1fr auto;
  gap: 5px 14px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 7px 24px rgba(87, 54, 103, 0.16), inset 0 0 0 1px rgba(255, 158, 199, 0.24);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.affection-label {
  color: #74547c;
  font-size: clamp(13px, 1.5vmin, 16px);
  font-weight: 700;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.affection-score {
  display: flex;
  align-items: baseline;
  color: #9b789e;
  font-size: clamp(12px, 1.5vmin, 16px);
  font-variant-numeric: tabular-nums;
}

.affection-score strong {
  color: var(--pink-deep);
  font-size: clamp(20px, 2.4vmin, 27px);
  font-weight: 850;
  line-height: 1;
}

.affection-track {
  grid-column: 1 / -1;
  height: clamp(8px, 1.1vmin, 12px);
  padding: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(179, 157, 219, 0.24);
  box-shadow: inset 0 1px 3px rgba(89, 58, 105, 0.18), 0 1px 0 rgba(255, 255, 255, 0.84);
}

.affection-fill {
  display: block;
  width: 20%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b89fe1 0%, #ff83b7 62%, #ffd477 100%);
  box-shadow: 0 0 9px rgba(255, 93, 158, 0.55);
  transition: width 420ms cubic-bezier(0.2, 0.78, 0.25, 1), filter 200ms ease;
}

#affection-bar.affection-loss .affection-fill {
  filter: grayscale(0.9) brightness(0.78);
}

#toast {
  position: absolute;
  z-index: 200;
  top: 3%;
  left: 50%;
  display: flex;
  align-items: center;
  width: min(76%, 460px);
  min-height: 54px;
  padding: clamp(8px, 1.4vmin, 14px) clamp(14px, 2.4vmin, 24px);
  gap: 12px;
  opacity: 0;
  color: #5f426d;
  border: 1px solid rgba(218, 159, 225, 0.82);
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(255, 235, 246, 0.97), rgba(225, 210, 249, 0.97));
  box-shadow: 0 14px 42px rgba(102, 62, 124, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  pointer-events: none;
  transform: translate(-50%, -140%);
}

#toast.show,
#toast.is-visible,
#toast[data-visible="true"] {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast-medal {
  display: grid;
  flex: 0 0 auto;
  width: clamp(32px, 5vmin, 48px);
  aspect-ratio: 1;
  place-items: center;
  color: #fff7d6;
  border-radius: 50%;
  background: linear-gradient(135deg, #ee8fba, #9f7bd8);
  box-shadow: 0 4px 14px rgba(137, 92, 178, 0.38);
  font-size: clamp(17px, 2.6vmin, 25px);
}

.toast-copy {
  display: grid;
  gap: 2px;
  font-size: clamp(11px, 1.55vmin, 15px);
}

.toast-copy strong {
  color: #8a4f9d;
  font-size: clamp(12px, 1.8vmin, 18px);
  letter-spacing: 0.08em;
}

#fx-layer {
  position: absolute;
  z-index: 46;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.fx-particle {
  position: absolute;
  display: none;
}

#title-screen {
  position: absolute;
  z-index: 60;
  inset: 0;
  display: grid;
  overflow: hidden;
  place-items: center;
  background-color: #eadcf4;
  background-image:
    linear-gradient(180deg, rgba(106, 65, 126, 0.02) 0%, rgba(83, 50, 98, 0.06) 58%, rgba(77, 43, 92, 0.3) 100%),
    linear-gradient(90deg, rgba(255, 241, 248, 0.84) 0%, rgba(250, 227, 243, 0.58) 31%, rgba(229, 212, 242, 0.1) 50%, transparent 66%),
    url("../assets/bg/bg-title.webp"),
    linear-gradient(135deg, #ffd4e6 0%, #d6c5ef 50%, #f5aaca 100%);
  background-position: center, center, calc(50% + 5vw) center, center;
  background-repeat: no-repeat;
  background-size: cover;
}

#title-screen::before,
#title-screen::after {
  position: absolute;
  pointer-events: none;
  content: "";
}

#title-screen::before {
  inset: 0;
  background:
    radial-gradient(circle at 51% 40%, transparent 0 40%, rgba(74, 42, 88, 0.14) 100%),
    linear-gradient(0deg, rgba(83, 48, 97, 0.22), transparent 42%);
}

#title-screen::after {
  right: 0;
  bottom: 0;
  left: 0;
  height: 34%;
  opacity: 0.84;
  background:
    radial-gradient(ellipse at 12% 70%, rgba(255, 195, 222, 0.82) 0 2%, transparent 12%),
    radial-gradient(ellipse at 78% 64%, rgba(206, 187, 235, 0.78) 0 4%, transparent 14%),
    linear-gradient(0deg, rgba(255, 226, 240, 0.7), transparent 78%);
  filter: blur(5px);
}

.title-glow {
  position: absolute;
  top: 16%;
  left: 24%;
  width: 46%;
  aspect-ratio: 2 / 1;
  border-radius: 50%;
  background: rgba(255, 243, 250, 0.72);
  filter: blur(46px);
  transform: translateX(-50%);
}

.title-content {
  position: relative;
  z-index: 5;
  display: flex;
  width: 58%;
  height: 100%;
  margin-right: auto;
  padding: 6% 0 15% 5%;
  align-items: flex-start;
  flex-direction: column;
  justify-content: center;
  text-align: left;
}

.title-subtitle {
  display: flex;
  width: 100%;
  margin: 0 0 clamp(4px, 1vh, 10px);
  padding: 0;
  align-items: flex-start;
  flex-direction: column;
  gap: clamp(3px, 0.7vh, 8px);
}

.title-subtitle span {
  display: block;
  width: max-content;
  max-width: 100%;
  padding: 0.3em 0.78em 0.36em;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 8px 14px 7px 12px;
  background:
    linear-gradient(105deg, rgba(242, 103, 163, 0.96), rgba(148, 107, 190, 0.94)),
    rgba(111, 74, 129, 0.78);
  box-shadow:
    0 8px 20px rgba(77, 43, 92, 0.32),
    inset 0 0 0 1px rgba(255, 214, 234, 0.3);
  font-size: clamp(23px, 4.3vh, 42px);
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1.22;
  text-shadow: 0 2px 6px rgba(73, 43, 86, 0.55);
  white-space: nowrap;
}

.title-subtitle span:nth-child(1) {
  --sticker-rotate: -3.4deg;
  margin-left: 0;
}

.title-subtitle span:nth-child(2) {
  --sticker-rotate: 2.4deg;
  margin-left: 9%;
  background: linear-gradient(105deg, rgba(164, 119, 202, 0.96), rgba(236, 119, 178, 0.95));
}

.title-subtitle span:nth-child(3) {
  --sticker-rotate: -1.6deg;
  margin-left: 3%;
  background: linear-gradient(105deg, rgba(232, 124, 180, 0.96), rgba(124, 94, 173, 0.95));
  font-size: clamp(18px, 3.3vh, 33px);
}

#game-title {
  margin: 0.06em 0 0;
  color: #4c314f;
  background: linear-gradient(180deg, #2c1e33 0%, #63385e 68%, #3a2540 100%);
  background-clip: text;
  -webkit-background-clip: text;
  font-family: "Slide Xia XingKai", "STKaiti", "KaiTi", cursive;
  font-size: clamp(94px, 22.5vh, 230px);
  font-weight: 400;
  letter-spacing: -0.055em;
  line-height: 0.92;
  white-space: nowrap;
  -webkit-text-fill-color: transparent;
  filter:
    drop-shadow(0 0 1px rgba(255, 255, 255, 0.95))
    drop-shadow(0 2px 0 rgba(255, 247, 251, 0.95))
    drop-shadow(0 9px 16px rgba(90, 47, 88, 0.42));
  text-shadow: 0 0 22px rgba(255, 205, 230, 0.35);
  cursor: pointer;
  user-select: none;
}

#game-title:focus-visible {
  outline: 3px solid rgba(255, 246, 199, 0.92);
  outline-offset: 8px;
  border-radius: 12px;
}

#start-button {
  position: absolute;
  z-index: 8;
  bottom: 11.5%;
  left: 50%;
  min-width: clamp(360px, 32vw, 440px);
  min-height: clamp(62px, 8.4vmin, 76px);
  margin: 0;
  padding: clamp(13px, 1.6vmin, 17px) clamp(46px, 6vmin, 68px);
  overflow: hidden;
  color: #fff;
  border: 1px solid rgba(255, 245, 206, 0.9);
  border-radius: 999px;
  background: linear-gradient(110deg, rgba(239, 105, 164, 0.94), rgba(161, 116, 198, 0.94));
  box-shadow:
    0 10px 28px rgba(98, 54, 115, 0.3),
    inset 0 0 0 2px rgba(255, 255, 255, 0.18),
    0 0 22px rgba(255, 158, 199, 0.35);
  cursor: pointer;
  translate: -50% 0;
}

.history-button {
  position: absolute;
  z-index: 7;
  top: 3%;
  left: 3%;
  min-width: clamp(142px, 14vmin, 166px);
  min-height: 48px;
  padding: 10px 22px;
  color: #76517e;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  background: rgba(255, 247, 252, 0.74);
  box-shadow: 0 6px 18px rgba(87, 52, 102, 0.18), inset 0 0 0 1px rgba(242, 103, 163, 0.18);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: clamp(16px, 1.7vmin, 18px);
  font-weight: 750;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.history-button:hover,
.history-button:active {
  color: var(--pink-deep);
  box-shadow: var(--shadow-pink);
  transform: translateY(-2px);
}

#start-button::before {
  position: absolute;
  top: -80%;
  bottom: -80%;
  left: -32%;
  width: 22%;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.75), transparent);
  transform: rotate(18deg);
}

#start-button span,
#start-button small {
  position: relative;
  z-index: 1;
}

#start-button span {
  margin-right: 0.8em;
  font-size: clamp(22px, 2.7vmin, 28px);
  font-weight: 850;
  letter-spacing: 0.18em;
}

#start-button small {
  font-size: clamp(16px, 1.8vmin, 19px);
  font-weight: 650;
  letter-spacing: 0.1em;
}

#start-button:hover {
  background: linear-gradient(110deg, #fb7db4, #a67fd2);
  box-shadow: 0 12px 34px rgba(98, 54, 115, 0.36), 0 0 28px rgba(255, 185, 215, 0.54);
}

.copyright {
  position: absolute;
  z-index: 5;
  bottom: 1.8%;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  color: rgba(255, 255, 255, 0.94);
  font-size: clamp(16px, 1.55vmin, 18px);
  font-weight: 650;
  letter-spacing: 0.035em;
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 2px 6px rgba(70, 40, 82, 0.72);
  transform: translateX(-50%);
}

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

.title-petals i {
  position: absolute;
  top: -12%;
  width: clamp(8px, 1.35vmin, 16px);
  height: clamp(11px, 1.85vmin, 22px);
  opacity: 0;
  border-radius: 75% 25% 72% 28%;
  background: linear-gradient(145deg, #fff 4%, #ffd2e5 50%, #ef8fbc 100%);
  box-shadow: 0 0 7px rgba(255, 255, 255, 0.65);
}

/* ===== 标题页拼贴 KV 元素 ===== */
.title-sprite {
  position: absolute;
  z-index: 4;
  right: 1%;
  bottom: 0;
  height: 91%;
  max-width: 36%;
  object-fit: contain;
  object-position: right bottom;
  pointer-events: none;
  filter:
    drop-shadow(0 0 1.5px rgba(255, 255, 255, 0.95))
    drop-shadow(0 0 1.5px rgba(255, 255, 255, 0.9))
    drop-shadow(0 0 16px rgba(255, 138, 192, 0.85))
    drop-shadow(0 14px 30px rgba(90, 45, 100, 0.35));
}

.kv-deco {
  position: absolute;
  z-index: 6;
  inset: 0;
  pointer-events: none;
}

.kv-deco span {
  position: absolute;
  line-height: 1;
}

.kv-cross {
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(18px, 3.4vh, 34px);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 150, 200, 0.85);
}

.kv-cross-1 { top: 13%; left: 17%; }
.kv-cross-2 { top: 5.5%; right: 30%; }
.kv-cross-3 { right: 2.4%; bottom: 8%; }

.kv-heart {
  color: #ff7fb3;
  font-size: clamp(16px, 3.2vh, 32px);
  text-shadow:
    0 0 12px rgba(255, 110, 175, 0.95),
    0 0 26px rgba(255, 160, 210, 0.75);
}

.kv-heart-1 { top: 31%; left: 47%; font-size: clamp(20px, 4.2vh, 42px); }
.kv-heart-2 { top: 64%; left: 55%; }
.kv-heart-3 { top: 44%; right: 19%; font-size: clamp(12px, 2.3vh, 22px); }
.kv-heart-4 { bottom: 17%; left: 28%; font-size: clamp(13px, 2.6vh, 25px); }

.kv-star {
  color: #ffe9a8;
  font-size: clamp(14px, 2.8vh, 28px);
  text-shadow: 0 0 12px rgba(255, 214, 120, 0.95), 0 0 24px rgba(255, 230, 160, 0.6);
}

.kv-star-1 { top: 8.5%; left: 48%; }
.kv-star-2 { top: 55%; left: 2.8%; }
.kv-star-3 { top: 35%; right: 2.6%; }

.kv-sticker {
  position: absolute;
  z-index: 6;
  font-weight: 900;
  line-height: 1.12;
  white-space: nowrap;
  pointer-events: none;
}

.kv-slogan-unlock {
  top: 4.5%;
  left: 21%;
  padding: 0.34em 0.8em 0.4em;
  color: #ef3d8b;
  border: 2px solid rgba(255, 134, 185, 0.9);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 22px rgba(90, 45, 105, 0.3), 0 0 0 4px rgba(255, 255, 255, 0.28);
  font-size: clamp(19px, 3.5vh, 34px);
  font-style: italic;
  letter-spacing: 0.04em;
  --kv-r: -5deg;
  transform: rotate(var(--kv-r));
}

.kv-slogan-ending {
  top: 17%;
  right: 4%;
  color: #fff;
  font-size: clamp(21px, 4vh, 40px);
  font-style: italic;
  letter-spacing: 0.05em;
  text-shadow:
    2px 0 0 #8f5bd1, -2px 0 0 #8f5bd1, 0 2px 0 #8f5bd1, 0 -2px 0 #8f5bd1,
    2px 2px 0 #8f5bd1, -2px 2px 0 #8f5bd1, 2px -2px 0 #8f5bd1, -2px -2px 0 #8f5bd1,
    0 0 18px rgba(255, 120, 190, 0.85),
    0 8px 18px rgba(70, 35, 100, 0.5);
  --kv-r: 7deg;
  transform: rotate(var(--kv-r));
}

.kv-slogan-max {
  bottom: 4%;
  left: 1.2%;
  padding: 0.38em 0.9em 0.44em;
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 9px;
  background: linear-gradient(100deg, #ff5fa2, #b07be0);
  box-shadow: 0 8px 22px rgba(90, 45, 105, 0.34), 0 0 20px rgba(255, 130, 190, 0.4);
  font-size: clamp(15px, 2.9vh, 28px);
  letter-spacing: 0.05em;
  text-shadow: 0 2px 4px rgba(80, 40, 100, 0.5);
  --kv-r: -9deg;
  transform: rotate(var(--kv-r));
}

.kv-shekong {
  right: 5%;
  bottom: 23%;
  color: #ff2f8d;
  font-size: clamp(24px, 5.2vh, 52px);
  font-style: italic;
  letter-spacing: 0.02em;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.92);
  text-shadow:
    0 0 10px rgba(255, 255, 255, 0.9),
    0 0 26px rgba(255, 80, 160, 0.95),
    0 6px 16px rgba(120, 30, 90, 0.45);
  --kv-r: -8deg;
  transform: rotate(var(--kv-r));
}

.kv-panel {
  position: absolute;
  z-index: 6;
  display: grid;
  padding: clamp(8px, 1.5vh, 14px) clamp(10px, 1.9vh, 18px);
  gap: clamp(2px, 0.5vh, 5px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 12px;
  background: linear-gradient(150deg, rgba(58, 32, 72, 0.78), rgba(43, 22, 56, 0.82));
  box-shadow:
    0 8px 24px rgba(60, 30, 80, 0.4),
    inset 0 0 0 1px rgba(255, 158, 199, 0.28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: clamp(12px, 2vh, 17px);
  font-weight: 650;
  letter-spacing: 0.04em;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
}

.kv-panel-title {
  color: #ffd0e5;
  font-size: 0.86em;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.kv-status {
  bottom: 12%;
  left: 1.6%;
  --kv-r: -3.5deg;
  transform: rotate(var(--kv-r));
}

.kv-status em {
  color: #ff9ec7;
  font-style: normal;
  font-weight: 900;
}

.kv-affection {
  top: 3.2%;
  right: 2.2%;
  width: clamp(210px, 24vw, 300px);
  align-items: center;
  grid-template-columns: 1fr auto;
  --kv-r: 2deg;
  transform: rotate(var(--kv-r));
}

.kv-aff-head {
  font-size: 1.02em;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.kv-aff-head b {
  color: #ff6faa;
  text-shadow: 0 0 8px rgba(255, 120, 180, 0.9);
}

.kv-aff-num {
  color: #ffd9ea;
  font-size: 0.88em;
  font-variant-numeric: tabular-nums;
}

.kv-aff-track {
  height: clamp(8px, 1.3vh, 12px);
  padding: 2px;
  grid-column: 1 / -1;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 3px rgba(30, 10, 40, 0.5);
}

.kv-aff-track i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b89fe1, #ff83b7 55%, #ffd477);
  box-shadow: 0 0 10px rgba(255, 105, 165, 0.9);
}

.kv-affection::after {
  grid-column: 1 / -1;
  content: "♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥";
  color: #ff7fb3;
  font-size: 0.82em;
  letter-spacing: 0.22em;
  text-shadow: 0 0 8px rgba(255, 120, 180, 0.85);
}

.kv-bubble {
  position: absolute;
  z-index: 6;
  top: 22%;
  right: 25%;
  padding: 0.5em 1.05em 0.56em;
  color: #d4488f;
  border: 2px solid #ffb7d4;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 20px rgba(90, 45, 105, 0.28);
  font-size: clamp(13px, 2.4vh, 22px);
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  --kv-r: -4deg;
  transform: rotate(var(--kv-r));
}

.kv-bubble::after {
  position: absolute;
  right: 12%;
  bottom: -8px;
  width: 14px;
  height: 14px;
  content: "";
  border-right: 2px solid #ffb7d4;
  border-bottom: 2px solid #ffb7d4;
  background: rgba(255, 255, 255, 0.96);
  transform: rotate(38deg) skewX(18deg);
}

.kv-tag {
  position: absolute;
  z-index: 6;
  right: 24%;
  bottom: 39%;
  padding: 0.32em 0.6em 0.38em;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(50, 26, 64, 0.74);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: clamp(13px, 2.3vh, 20px);
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
  pointer-events: none;
  --kv-r: 3deg;
  transform: rotate(var(--kv-r));
}

.history-modal {
  position: absolute;
  z-index: 120;
  inset: 0;
  display: grid;
  padding: 5%;
  place-items: center;
  background: rgba(73, 43, 86, 0.42);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.history-panel {
  position: relative;
  width: min(78%, 760px);
  max-height: 88%;
  padding: clamp(18px, 3.2vmin, 36px);
  overflow: auto;
  border: 1px solid rgba(230, 182, 83, 0.62);
  border-radius: clamp(16px, 2.5vmin, 28px);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 238, 248, 0.92));
  box-shadow: 0 22px 64px rgba(71, 40, 85, 0.34), inset 0 0 0 3px rgba(255, 255, 255, 0.5);
  text-align: center;
}

.history-close-button {
  position: absolute;
  top: 10px;
  right: 12px;
  display: grid;
  width: clamp(32px, 4.5vmin, 44px);
  aspect-ratio: 1;
  padding: 0;
  place-items: center;
  color: #8b668f;
  border: 1px solid rgba(179, 157, 219, 0.52);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  font-size: clamp(19px, 3vmin, 30px);
  line-height: 1;
  cursor: pointer;
}

.history-eyebrow {
  margin: 0 0 3px;
  color: #b27c35;
  font-size: clamp(8px, 1.2vmin, 13px);
  font-weight: 750;
  letter-spacing: 0.24em;
}

#history-modal-title {
  margin: 0;
  color: #7c5584;
  font-size: clamp(24px, 4.3vmin, 46px);
  text-shadow: 0 2px 0 #fff;
}

.history-best {
  margin: clamp(5px, 1vmin, 10px) 0 clamp(9px, 1.8vmin, 18px);
  color: var(--pink-deep);
  font-size: clamp(10px, 1.5vmin, 15px);
  font-weight: 700;
}

.history-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(179, 157, 219, 0.3);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.54);
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  color: #765b7b;
  font-size: clamp(8px, 1.18vmin, 12px);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  text-align: center;
}

.history-table th,
.history-table td {
  padding: clamp(4px, 0.7vmin, 8px) clamp(5px, 1vmin, 10px);
  border-bottom: 1px solid rgba(179, 157, 219, 0.2);
  white-space: nowrap;
}

.history-table th {
  color: #8a668e;
  background: rgba(255, 224, 239, 0.58);
  font-weight: 750;
}

.history-table tr:last-child td {
  border-bottom: 0;
}

#ending-screen {
  position: absolute;
  z-index: 90;
  inset: 0;
  display: grid;
  padding: 2%;
  overflow: auto;
  align-items: center;
  grid-template-columns: 100%;
  justify-content: center;
  place-items: center;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.9), transparent 27%),
    linear-gradient(135deg, rgba(255, 220, 234, 0.94), rgba(218, 204, 240, 0.96));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.ending-card {
  width: min(90%, 960px);
  max-height: 96%;
  padding: clamp(14px, 2vmin, 24px) clamp(24px, 3.6vmin, 44px);
  overflow: auto;
  border: 1px solid rgba(227, 167, 73, 0.68);
  border-radius: clamp(18px, 3vmin, 32px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 244, 250, 0.72)),
    var(--glass-white);
  box-shadow: 0 20px 60px rgba(87, 53, 103, 0.23), inset 0 0 0 4px rgba(255, 255, 255, 0.34);
  text-align: center;
}

.ending-eyebrow {
  margin: 0 0 4px;
  color: #b27c35;
  font-size: clamp(14px, 1.8vmin, 18px);
  font-weight: 750;
  letter-spacing: 0.26em;
}

#ending-title {
  margin: 0;
  color: #7c5584;
  font-size: clamp(48px, 6.3vmin, 68px);
  line-height: 1.25;
  text-shadow: 0 3px 0 #fff, 0 8px 18px rgba(157, 104, 171, 0.2);
}

.ending-divider {
  display: flex;
  margin: clamp(8px, 1.7vmin, 18px) 0;
  align-items: center;
  gap: 12px;
  color: var(--pink-deep);
}

.ending-divider::before,
.ending-divider::after {
  height: 1px;
  content: "";
  flex: 1;
  background: linear-gradient(90deg, transparent, rgba(230, 182, 83, 0.8), transparent);
}

.ending-stats {
  display: grid;
  margin: 0;
  grid-template-columns: repeat(2, 1fr);
}

.ending-stats div {
  padding: clamp(8px, 1.5vmin, 16px);
}

.ending-stats > p {
  margin: 0;
  padding: clamp(8px, 1.5vmin, 16px);
  color: var(--pink-deep);
  font-size: clamp(15px, 2.5vmin, 26px);
  font-weight: 800;
}

.ending-stats div + div {
  border-left: 1px solid rgba(179, 157, 219, 0.4);
}

.ending-stats > p + p {
  border-left: 1px solid rgba(179, 157, 219, 0.4);
}

.ending-stats dt,
.ending-achievements h3 {
  color: var(--ink-soft);
  font-size: clamp(18px, 2.2vmin, 22px);
  font-weight: 650;
  letter-spacing: 0.08em;
}

.ending-stats dd {
  margin: 4px 0 0;
  color: var(--pink-deep);
  font-size: clamp(26px, 3.6vmin, 38px);
  font-weight: 850;
}

.ending-achievements {
  margin-top: clamp(8px, 1.4vmin, 15px);
  padding: clamp(10px, 1.8vmin, 18px);
  border-radius: 14px;
  background: rgba(255, 236, 245, 0.56);
}

.ending-achievements h3 {
  margin: 0 0 6px;
}

.ending-history {
  margin-top: clamp(7px, 1.2vmin, 13px);
}

.ending-history h3 {
  margin: 0 0 5px;
  color: var(--ink-soft);
  font-size: clamp(18px, 2.2vmin, 22px);
  font-weight: 650;
  letter-spacing: 0.08em;
}

#ending-screen .ending-card > h3 {
  margin: clamp(8px, 1.4vmin, 15px) 0 6px;
  color: var(--ink-soft);
  font-size: clamp(18px, 2.2vmin, 22px);
  letter-spacing: 0.08em;
}

#ending-achievements {
  display: flex;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  list-style: none;
}

#ending-achievements li {
  padding: 5px 12px;
  color: #8f648e;
  border: 1px solid rgba(230, 182, 83, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  font-size: clamp(16px, 1.8vmin, 18px);
}

#ending-screen .history-table {
  font-size: clamp(16px, 1.8vmin, 18px);
}

#ending-screen .history-table th,
#ending-screen .history-table td {
  padding: 5px clamp(6px, 1vmin, 11px);
}

.ending-actions {
  display: flex;
  margin-top: clamp(10px, 1.6vmin, 18px);
  justify-content: center;
  gap: 12px;
}

.ending-actions button {
  min-width: 130px;
  min-height: 44px;
  padding: 9px 24px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 999px;
  background: linear-gradient(115deg, #f17eaf, #9f83cb);
  box-shadow: 0 7px 18px rgba(113, 74, 131, 0.2);
  font-size: clamp(16px, 1.8vmin, 18px);
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.ending-actions button:last-child {
  color: #8a638d;
  border-color: rgba(242, 103, 163, 0.56);
  background: rgba(255, 255, 255, 0.74);
}

.ending-actions button:hover,
.ending-actions button:active {
  box-shadow: var(--shadow-pink);
  transform: translateY(-2px) scale(1.03);
}

#ending-screen[data-ending="blocked"] {
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.82), transparent 27%),
    linear-gradient(135deg, rgba(218, 215, 228, 0.96), rgba(185, 176, 205, 0.98));
}

#ending-screen[data-ending="blocked"] .ending-card {
  border-color: rgba(105, 92, 130, 0.58);
  background: linear-gradient(135deg, rgba(250, 249, 252, 0.94), rgba(224, 219, 233, 0.86));
  box-shadow: 0 20px 60px rgba(59, 51, 76, 0.28), inset 0 0 0 4px rgba(255, 255, 255, 0.3);
}

#ending-screen[data-ending="blocked"] #ending-title,
#ending-screen[data-ending="blocked"] .ending-stats dd {
  color: #655b78;
}

#ending-screen[data-ending="blocked"] .ending-eyebrow,
#ending-screen[data-ending="blocked"] .ending-divider,
#ending-screen[data-ending="blocked"] .ending-achievements h3,
#ending-screen[data-ending="blocked"] .ending-history h3 {
  color: #777084;
}

#ending-screen[data-ending="blocked"] .ending-achievements {
  background: rgba(211, 205, 222, 0.48);
}

#preloader {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.82), transparent 32%),
    linear-gradient(135deg, #ffe5f0, #dcd0ef 58%, #f6bbd5);
  transition: visibility 500ms ease, opacity 500ms ease;
}

#preloader.is-hidden,
#preloader.loaded,
#preloader.is-done {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.preloader-card {
  width: min(72vw, 420px);
  padding: 32px;
  color: #805b84;
  border: 1px solid rgba(255, 255, 255, 0.84);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow-soft);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  text-align: center;
}

.loading-heart {
  display: inline-block;
  color: var(--pink-deep);
  font-size: 36px;
  filter: drop-shadow(0 4px 8px rgba(242, 103, 163, 0.35));
}

.preloader-card p {
  margin: 10px 0 18px;
  font-size: 14px;
  letter-spacing: 0.08em;
}

.loading-track {
  height: 9px;
  padding: 2px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(179, 157, 219, 0.25);
  box-shadow: inset 0 1px 3px rgba(89, 58, 105, 0.16);
}

.loading-track .bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--purple), var(--pink), #ffd77f);
  box-shadow: 0 0 10px rgba(255, 111, 171, 0.5);
  transition: width 240ms ease;
}

#rotate-hint {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: none;
  padding: 32px;
  place-content: center;
  justify-items: center;
  color: #76517e;
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.96), transparent 26%),
    linear-gradient(145deg, #ffe9f2, #dacdef 62%, #f7bfd8);
  text-align: center;
}

#rotate-hint strong {
  margin-top: 28px;
  font-size: clamp(21px, 6vw, 34px);
  letter-spacing: 0.12em;
}

#rotate-hint small {
  margin-top: 8px;
  color: #987ba0;
  font-size: 13px;
}

.phone-rotate {
  position: relative;
  width: 62px;
  height: 104px;
  border: 4px solid var(--purple-deep);
  border-radius: 13px;
  box-shadow: 0 8px 20px rgba(104, 69, 122, 0.2), inset 0 0 0 2px rgba(255, 255, 255, 0.65);
}

.phone-rotate span {
  position: absolute;
  bottom: 5px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--purple-deep);
  transform: translateX(-50%);
}

.phone-rotate::before {
  position: absolute;
  top: 50%;
  left: -42px;
  width: 28px;
  height: 28px;
  content: "";
  border-top: 4px solid var(--pink-deep);
  border-left: 4px solid var(--pink-deep);
  border-radius: 50% 0 0;
  transform: rotate(-45deg);
}

.phone-rotate::after {
  position: absolute;
  top: calc(50% - 19px);
  left: -47px;
  width: 0;
  height: 0;
  content: "";
  border-top: 7px solid transparent;
  border-right: 10px solid var(--pink-deep);
  border-bottom: 7px solid transparent;
  transform: rotate(-12deg);
}

@media (orientation: portrait) {
  #rotate-hint {
    display: grid;
  }
}

@media (max-height: 430px) and (orientation: landscape) {
  #dialog {
    min-height: 27%;
    padding: 14px 28px;
  }

  #textbox {
    font-size: 18px;
    line-height: 1.5;
  }

  #namebox {
    min-width: 92px;
    padding: 6px 18px;
    font-size: 15px;
  }

  #choices {
    bottom: 32%;
    gap: 8px;
  }

  #choices > button,
  .choice-button {
    min-height: 48px;
    padding: 9px 20px;
    font-size: 18px;
  }

  .title-content {
    padding-bottom: 6%;
  }

  .title-subtitle {
    max-width: 88%;
  }

  .kv-status,
  .kv-tag,
  .kv-bubble,
  .kv-cross-1,
  .kv-heart-2 {
    display: none;
  }

  .kv-slogan-max {
    bottom: 3%;
    left: 1%;
  }

  .ending-card {
    width: min(78%, 700px);
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .ending-divider,
  .ending-achievements {
    margin-top: 6px;
    margin-bottom: 6px;
  }
}

@media (max-width: 680px) and (orientation: landscape) {
  #choices {
    right: 4%;
    left: 4%;
  }

  #choices.choice-grid {
    right: 3%;
    left: 3%;
  }

  #affection-bar {
    top: 2%;
    right: 2%;
    width: clamp(172px, 32vw, 210px);
    min-height: 48px;
    padding: 7px 12px;
  }

  .ending-actions button {
    min-width: 118px;
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (orientation: portrait) {
  #rotate-hint {
    display: none;
  }

  #stage {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    aspect-ratio: auto;
    border-width: 0;
    border-radius: 0;
  }

  #title-screen {
    background-position: center;
  }

  #sprite {
    top: 3%;
    right: -6%;
    bottom: auto;
    height: 52%;
    max-width: 100%;
    object-position: right top;
  }

  #dialog {
    right: 12px;
    bottom: 12px;
    left: 12px;
    min-height: 176px;
    max-height: 30%;
    padding: 30px 20px 18px;
    overflow-y: auto;
    align-items: flex-start;
    border-radius: 18px;
    scrollbar-width: none;
  }

  #dialog::-webkit-scrollbar,
  #choices::-webkit-scrollbar,
  .ending-card::-webkit-scrollbar {
    display: none;
  }

  #namebox {
    left: 20px;
    min-width: 112px;
    padding: 7px 18px;
    font-size: 17px;
  }

  #textbox {
    font-size: clamp(18px, 5vw, 21px);
    line-height: 1.55;
  }

  #choices,
  #choices.choice-grid {
    right: 12px;
    bottom: calc(30% + 24px);
    left: 12px;
    max-height: 55%;
    overflow-y: auto;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    scrollbar-width: none;
  }

  #choices > button,
  .choice-button {
    min-height: 48px;
    padding: 10px 18px;
    font-size: clamp(16px, 4.5vw, 19px);
  }

  #affection-bar {
    top: 12px;
    right: auto;
    left: 12px;
    width: 184px;
    min-height: 54px;
    padding: 8px 12px;
  }

  .affection-label,
  .affection-score {
    font-size: 14px;
  }

  .affection-score strong {
    font-size: 23px;
  }

  #title-screen::after {
    height: 52%;
    opacity: 1;
    background: linear-gradient(0deg, rgba(245, 211, 230, 0.96) 0%, rgba(236, 214, 239, 0.82) 48%, transparent 100%);
    filter: none;
  }

  .title-content {
    width: 100%;
    padding: 8% 5% 43%;
    justify-content: flex-end;
  }

  .title-subtitle {
    margin-bottom: 8px;
    gap: 5px;
  }

  .title-subtitle span {
    max-width: 100%;
    font-size: clamp(18px, 5vw, 23px);
  }

  .title-subtitle span:nth-child(3) {
    font-size: clamp(14px, 4vw, 19px);
  }

  #game-title {
    font-size: clamp(92px, 26vw, 118px);
    letter-spacing: -0.035em;
  }

  .title-sprite {
    top: 7%;
    right: -5%;
    bottom: auto;
    height: 47%;
    max-width: 92%;
    object-position: right top;
  }

  .kv-status,
  .kv-tag,
  .kv-slogan-unlock,
  .kv-cross-1,
  .kv-heart-2,
  .kv-star-2 {
    display: none;
  }

  .kv-affection {
    top: 27%;
    right: auto;
    left: 10px;
    width: 168px;
    padding: 7px 10px;
    font-size: 12px;
    --kv-r: -2deg;
  }

  .kv-slogan-ending {
    top: 24%;
    right: 8px;
    font-size: 17px;
  }

  .kv-slogan-max {
    top: 47%;
    right: auto;
    bottom: auto;
    left: 10px;
    font-size: 13px;
    --kv-r: -7deg;
  }

  .kv-shekong {
    top: 37%;
    right: 6%;
    bottom: auto;
    font-size: 24px;
  }

  .kv-bubble {
    top: 13%;
    right: auto;
    left: 4%;
    font-size: 12px;
  }

  .kv-cross-2 { top: 8%; right: 48%; }
  .kv-cross-3 { right: 4%; bottom: 5%; }
  .kv-heart-1 { top: 21%; left: 7%; font-size: 26px; }
  .kv-heart-3 { top: 36%; right: auto; left: 40%; font-size: 16px; }
  .kv-heart-4 { bottom: 22%; left: auto; right: 8%; font-size: 18px; }
  .kv-star-1 { top: 22%; left: 42%; font-size: 16px; }
  .kv-star-3 { top: 57%; right: 4%; font-size: 15px; }

  #start-button {
    bottom: 10.5%;
    min-width: min(82vw, 340px);
    min-height: 60px;
    padding: 12px 28px;
  }

  #start-button span {
    font-size: 22px;
  }

  #start-button small {
    font-size: 16px;
  }

  .history-button {
    top: 16px;
    left: 16px;
    min-width: 142px;
    min-height: 46px;
    padding: 9px 18px;
    font-size: 16px;
  }

  .copyright {
    bottom: calc(18px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
    max-width: 370px;
    font-size: 15px;
  }

  #ending-screen {
    padding: 8px;
  }

  .ending-card {
    width: 100%;
    max-height: calc(100dvh - 16px);
    padding: 14px 12px;
    border-radius: 18px;
    scrollbar-width: none;
  }

  .ending-eyebrow {
    font-size: 14px;
  }

  #ending-title {
    font-size: clamp(42px, 12vw, 52px);
  }

  .ending-divider {
    margin: 6px 0;
  }

  .ending-stats div {
    padding: 6px;
  }

  .ending-stats dt,
  .ending-achievements h3,
  .ending-history h3,
  #ending-screen .ending-card > h3 {
    font-size: 16px;
  }

  .ending-stats dd {
    font-size: 24px;
  }

  .ending-achievements {
    margin-top: 5px;
    padding: 8px;
  }

  #ending-achievements li {
    padding: 4px 8px;
    font-size: 16px;
  }

  .ending-history {
    margin-top: 5px;
  }

  #ending-screen .history-table {
    table-layout: fixed;
    font-size: 16px;
  }

  #ending-screen .history-table th,
  #ending-screen .history-table td {
    padding: 4px 2px;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  #ending-screen .history-table th:nth-child(1),
  #ending-screen .history-table td:nth-child(1) {
    width: 32%;
  }

  #ending-screen .history-table th:nth-child(2),
  #ending-screen .history-table td:nth-child(2) {
    width: 32%;
  }

  .ending-actions {
    margin-top: 8px;
    gap: 8px;
  }

  .ending-actions button {
    min-width: 0;
    min-height: 44px;
    padding: 8px 16px;
    flex: 1;
    font-size: 16px;
  }
}

@media (max-height: 700px) and (orientation: portrait) {
  .ending-card {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #ending-title {
    font-size: 40px;
  }

  .ending-eyebrow,
  .ending-divider {
    margin-top: 2px;
    margin-bottom: 2px;
  }
}
