@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@300;400;500&family=Manrope:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  color: #e7edf8;
  background: #07101f;
  font-family: "Manrope", "Noto Serif SC", system-ui, sans-serif;
  font-synthesis: none;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  --moon: rgba(235, 241, 250, 0.94);
  --moon-soft: rgba(221, 232, 248, 0.72);
  --line-bright: rgba(235, 245, 255, 0.72);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-width: 320px;
  overflow: hidden;
  background: radial-gradient(circle at 52% 42%, rgba(124, 168, 214, 0.18), transparent 36%), #07101f;
}

.screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  animation: sceneFade 520ms ease both;
}

.asset-fill {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.screen--home .asset-fill {
  filter: saturate(0.9) brightness(0.95);
}

.home-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 53%, transparent 0 18%, rgba(7, 12, 24, 0.12) 42%, rgba(2, 7, 16, 0.28) 100%),
    linear-gradient(180deg, rgba(3, 9, 22, 0.04), rgba(4, 10, 21, 0.22));
  pointer-events: none;
}

.main-menu {
  position: absolute;
  left: 50%;
  top: 65%;
  display: grid;
  width: min(420px, 34vw);
  min-width: 300px;
  gap: clamp(18px, 3.7vh, 34px);
  transform: translateX(-50%);
}

.ornament-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border: 0;
  background: transparent;
  color: var(--moon);
  cursor: pointer;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(21px, 2.35vw, 31px);
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0.16em;
  text-shadow: 0 0 10px rgba(235, 241, 250, 0.54), 0 0 28px rgba(163, 207, 238, 0.28);
  transition: color 180ms ease, filter 180ms ease, transform 180ms ease;
}

.ornament-button::before,
.ornament-button::after {
  display: none;
}

.ornament-button::before {
  left: 5px;
}

.ornament-button::after {
  right: 5px;
}

.ornament-button__line {
  display: none;
}

.ornament-button__text {
  display: block;
  min-width: 168px;
  text-align: center;
}

.ornament-button:hover,
.ornament-button:focus-visible {
  color: #fffaf0;
  filter: drop-shadow(0 0 14px rgba(239, 226, 171, 0.72));
  outline: none;
  transform: translateY(-1px);
}

.ornament-button:active {
  transform: translateY(1px) scale(0.992);
}

.story-bg {
  filter: brightness(0.98) saturate(0.94) contrast(1.02);
  transform: scale(1.012);
}

.story-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 34% 38%, rgba(126, 184, 237, 0.1), transparent 30%),
    linear-gradient(180deg, rgba(4, 14, 29, 0.12), transparent 36%, rgba(3, 7, 14, 0.22)),
    radial-gradient(circle at 50% 55%, transparent 0 42%, rgba(0, 3, 10, 0.22) 100%);
  pointer-events: none;
  transition: background 400ms ease;
}

.story-tone-soft .story-vignette {
  background:
    radial-gradient(circle at 54% 42%, rgba(236, 224, 177, 0.11), transparent 31%),
    linear-gradient(180deg, rgba(4, 14, 29, 0.1), transparent 36%, rgba(3, 7, 14, 0.18)),
    radial-gradient(circle at 50% 55%, transparent 0 42%, rgba(0, 3, 10, 0.18) 100%);
}

.story-tone-lost .story-vignette {
  background:
    radial-gradient(circle at 46% 45%, rgba(180, 205, 228, 0.07), transparent 29%),
    linear-gradient(180deg, rgba(3, 8, 17, 0.18), rgba(6, 13, 25, 0.11) 44%, rgba(1, 4, 10, 0.32)),
    radial-gradient(circle at 50% 52%, transparent 0 34%, rgba(0, 2, 8, 0.32) 100%);
}

.story-character {
  position: absolute;
  right: 2.1%;
  bottom: -1%;
  height: min(78vh, 820px);
  max-width: 39vw;
  object-fit: contain;
  filter: grayscale(0.12) drop-shadow(0 0 24px rgba(203, 225, 245, 0.2)) drop-shadow(-18px 14px 34px rgba(2, 6, 13, 0.42));
  opacity: 0.94;
  user-select: none;
  -webkit-user-drag: none;
}

.story-tools {
  position: absolute;
  top: clamp(24px, 4vh, 42px);
  right: clamp(24px, 4.7vw, 76px);
  z-index: 4;
  display: flex;
  gap: 11px;
}

.mini-button {
  min-width: 58px;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(229, 241, 255, 0.3);
  border-radius: 3px;
  background: rgba(8, 21, 40, 0.28);
  color: rgba(235, 244, 255, 0.82);
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 0.12em;
  text-shadow: 0 0 12px rgba(183, 213, 241, 0.38);
  backdrop-filter: blur(14px);
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.mini-button:hover,
.mini-button:focus-visible,
.mini-button--active {
  border-color: rgba(248, 236, 185, 0.68);
  background: rgba(21, 41, 65, 0.46);
  color: #fffaf1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 0 18px rgba(228, 217, 168, 0.22);
  outline: none;
}

.mini-button:active {
  transform: translateY(1px);
}

.dialogue-hit-area {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  height: 31%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  pointer-events: auto;
}

.dialogue-copy {
  position: absolute;
  left: 6.4vw;
  right: 10.2vw;
  bottom: 4.4vh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  pointer-events: none;
}

.speaker-plate {
  position: static;
  min-width: 160px;
  padding: 10px 30px 11px;
  border: 1px solid rgba(237, 246, 255, 0.35);
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(240, 247, 255, 0.11), rgba(125, 167, 209, 0.08)), rgba(9, 22, 42, 0.24);
  color: #fbfdff;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(18px, 1.8vw, 24px);
  letter-spacing: 0.12em;
  text-align: center;
  text-shadow: 0 0 15px rgba(226, 240, 255, 0.62);
  backdrop-filter: blur(12px);
}

.dialogue-text {
  position: static;
  margin: 16px 0 0;
  max-width: 72vw;
  color: rgba(248, 251, 255, 0.95);
  font-family: "Noto Serif SC", serif;
  font-size: clamp(20px, 2vw, 30px);
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: 0.07em;
  white-space: pre-wrap;
  word-break: break-word;
  text-shadow: 0 1px 4px rgba(0, 3, 12, 0.8), 0 0 14px rgba(204, 226, 246, 0.24);
}

.next-cue {
  position: absolute;
  right: 3.5vw;
  bottom: 2.2vh;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: rgba(236, 246, 255, 0.55);
  font-size: 42px;
  opacity: 0.5;
}

.next-cue--ready {
  color: #fffaf0;
  opacity: 1;
  animation: cuePulse 1.3s ease-in-out infinite;
}

.screen--chat .chat-bg {
  filter: brightness(0.42) blur(5px) saturate(0.84);
  transform: scale(1.03);
}

.screen--loading {
  background: #07101f;
}

.loading-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.24) blur(12px) saturate(0.72);
  transform: scale(1.08);
}

.loading-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 47%, rgba(115, 145, 184, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(4, 12, 25, 0.5), rgba(4, 8, 16, 0.74));
}

.loading-top-right {
  position: absolute;
  top: clamp(40px, 8vh, 82px);
  right: clamp(54px, 9vw, 160px);
  display: flex;
  align-items: center;
  gap: 24px;
  opacity: 0.58;
}

.loading-top-right span {
  width: 1px;
  height: 38px;
  background: linear-gradient(180deg, transparent, rgba(183, 199, 232, 0.58), transparent);
}

.loading-top-right span:last-child {
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, rgba(183, 199, 232, 0.5), transparent);
}

.loading-top-right i {
  position: relative;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(220, 232, 252, 0.9);
  box-shadow: 0 0 14px rgba(183, 199, 232, 0.8);
}

.loading-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 44px;
}

.loading-core {
  position: relative;
  display: grid;
  width: 128px;
  height: 128px;
  place-items: center;
}

.loading-core::before {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(183, 199, 232, 0.2);
  border-radius: 50%;
  content: "";
}

.loading-ring {
  position: absolute;
  border-radius: 50%;
}

.loading-ring--outer {
  inset: 10px;
  border-top: 2px solid rgba(183, 199, 232, 0.84);
  border-left: 1px solid rgba(183, 199, 232, 0.8);
  border-right: 1px solid transparent;
  border-bottom: 1px solid transparent;
  animation: loadingSpin 4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  box-shadow: 0 0 15px rgba(183, 199, 232, 0.32);
}

.loading-ring--inner {
  inset: 22px;
  border-right: 1px solid rgba(183, 199, 232, 0.45);
  border-bottom: 1px solid rgba(183, 199, 232, 0.45);
  border-left: 1px solid transparent;
  border-top: 1px solid transparent;
  animation: loadingSpin 6s linear infinite reverse;
}

.loading-orbit {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(222, 234, 252, 0.92);
  animation: loadingOrbit 6s linear infinite;
  box-shadow: 0 0 10px rgba(183, 199, 232, 0.8);
}

.loading-center {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  animation: loadingPulse 3s ease-in-out infinite;
}

.loading-text {
  margin: 0;
  color: rgba(214, 226, 248, 0.92);
  font-family: "JetBrains Mono", "Noto Serif SC", monospace;
  font-size: clamp(17px, 1.45vw, 22px);
  letter-spacing: 0.18em;
  animation: loadingBreathe 4s ease-in-out infinite;
}

.chat-atmosphere {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 76% 42%, rgba(192, 213, 237, 0.22), transparent 20%),
    radial-gradient(circle at 31% 34%, rgba(96, 140, 190, 0.18), transparent 35%),
    linear-gradient(90deg, rgba(5, 15, 31, 0.76) 0 48%, rgba(4, 10, 21, 0.24) 66%, rgba(2, 6, 13, 0.58));
  pointer-events: none;
}

.chat-character {
  position: absolute;
  right: 4%;
  bottom: -8%;
  height: min(95vh, 960px);
  max-width: 48vw;
  object-fit: contain;
  opacity: 0.86;
  filter: grayscale(0.18) drop-shadow(0 0 36px rgba(205, 225, 244, 0.22)) drop-shadow(-25px 18px 48px rgba(0, 4, 12, 0.68));
  user-select: none;
  -webkit-user-drag: none;
}

.corner-link,
.icon-text-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: rgba(238, 246, 255, 0.88);
  cursor: pointer;
  font-size: 15px;
  letter-spacing: 0.19em;
  text-shadow: 0 0 12px rgba(212, 231, 249, 0.32);
  transition: color 180ms ease, filter 180ms ease, transform 180ms ease;
}

.corner-link:hover,
.corner-link:focus-visible,
.icon-text-button:hover,
.icon-text-button:focus-visible {
  color: #fffaf1;
  filter: drop-shadow(0 0 12px rgba(236, 225, 172, 0.54));
  outline: none;
}

.corner-link:active,
.icon-text-button:active {
  transform: translateY(1px);
}

.corner-link--left {
  position: absolute;
  top: clamp(30px, 7vh, 78px);
  left: clamp(24px, 5vw, 82px);
  z-index: 5;
}

.chat-actions {
  position: absolute;
  top: clamp(30px, 7vh, 78px);
  right: clamp(24px, 5vw, 82px);
  z-index: 5;
  display: flex;
  gap: 32px;
}

.chat-panel {
  position: absolute;
  left: clamp(28px, 5vw, 82px);
  top: clamp(108px, 17vh, 170px);
  z-index: 3;
  display: grid;
  width: min(45vw, 610px);
  min-width: 480px;
  height: min(70vh, 660px);
  grid-template-rows: auto 1fr auto;
}

.chat-title-block h1 {
  margin: 0;
  color: #f7fbff;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(38px, 5vw, 68px);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-shadow: 0 0 16px rgba(231, 240, 255, 0.52), 0 0 40px rgba(108, 166, 220, 0.28);
}

.chat-title-block p {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  margin: 18px 0 30px;
  color: rgba(207, 221, 243, 0.78);
  font-family: "JetBrains Mono", monospace;
  font-size: 14px;
  letter-spacing: 0.18em;
}

.chat-log {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 20px;
  overflow: auto;
  padding: 8px 10px 28px 0;
  scrollbar-color: rgba(219, 234, 255, 0.28) transparent;
}

.chat-row {
  display: flex;
}

.chat-row--player {
  justify-content: flex-end;
}

.chat-row--tulpa {
  justify-content: flex-start;
}

.chat-bubble {
  position: relative;
  max-width: min(520px, 88%);
  margin: 0;
  padding: 19px 24px;
  border: 1px solid rgba(226, 239, 255, 0.24);
  border-radius: 6px;
  color: rgba(247, 251, 255, 0.94);
  font-family: "Noto Serif SC", serif;
  font-size: clamp(17px, 1.8vw, 22px);
  font-weight: 300;
  line-height: 1.65;
  letter-spacing: 0.05em;
  text-shadow: 0 0 10px rgba(205, 225, 244, 0.22);
  backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 0 20px rgba(110, 156, 205, 0.1);
}

.chat-row--player .chat-bubble {
  background: linear-gradient(135deg, rgba(12, 34, 67, 0.66), rgba(19, 42, 72, 0.34)), rgba(4, 12, 25, 0.24);
}

.chat-row--tulpa .chat-bubble {
  background: linear-gradient(135deg, rgba(238, 246, 255, 0.16), rgba(165, 194, 225, 0.09)), rgba(9, 20, 37, 0.2);
}

.chat-row--tulpa .chat-bubble::before {
  position: absolute;
  top: 7px;
  left: 7px;
  width: 7px;
  height: 7px;
  border-left: 1px solid rgba(236, 246, 255, 0.58);
  border-top: 1px solid rgba(236, 246, 255, 0.58);
  content: "";
}

.chat-bubble--thinking {
  color: rgba(218, 230, 247, 0.72);
}

.chat-input-shell {
  display: grid;
  grid-template-columns: 1fr 48px;
  align-items: center;
  gap: 12px;
  min-height: 86px;
  padding: 14px 16px 14px 30px;
  border: 1px solid rgba(232, 243, 255, 0.2);
  border-radius: 7px;
  background: linear-gradient(135deg, rgba(241, 247, 255, 0.06), rgba(89, 123, 168, 0.08)), rgba(8, 18, 34, 0.54);
  backdrop-filter: blur(22px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.11), 0 0 32px rgba(99, 142, 190, 0.12);
}

.chat-input-shell input {
  min-width: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: rgba(247, 251, 255, 0.96);
  font-family: "Noto Serif SC", serif;
  font-size: clamp(17px, 1.6vw, 20px);
  letter-spacing: 0.05em;
  outline: none;
}

.chat-input-shell input::placeholder {
  color: rgba(217, 228, 244, 0.58);
}

.chat-input-shell:focus-within {
  border-color: rgba(180, 225, 246, 0.48);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13), 0 0 32px rgba(139, 202, 236, 0.18);
}

.send-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(230, 244, 255, 0.34);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(237, 247, 255, 0.12), rgba(96, 139, 184, 0.12)), transparent;
  color: #e8f7ff;
  cursor: pointer;
  font-size: 22px;
  transition: color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.send-button:hover,
.send-button:focus-visible {
  border-color: rgba(246, 231, 173, 0.76);
  color: #fff7db;
  box-shadow: 0 0 20px rgba(236, 223, 166, 0.24);
  outline: none;
}

.send-button:active {
  transform: scale(0.96);
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 42%, rgba(116, 164, 211, 0.1), transparent 35%), rgba(1, 5, 13, 0.46);
  backdrop-filter: blur(7px);
  animation: sceneFade 220ms ease both;
}

.moon-modal,
.side-panel {
  position: relative;
  border: 1px solid rgba(236, 246, 255, 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(236, 246, 255, 0.12), rgba(88, 125, 170, 0.1)), rgba(7, 18, 35, 0.66);
  color: rgba(242, 248, 255, 0.95);
  backdrop-filter: blur(30px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 0 42px rgba(90, 139, 190, 0.2);
}

.moon-modal::before,
.side-panel::before {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(236, 246, 255, 0.12);
  border-radius: 5px;
  content: "";
  pointer-events: none;
}

.exit-modal {
  width: min(520px, calc(100vw - 40px));
  padding: 58px 54px 46px;
  text-align: center;
}

.modal-star {
  color: rgba(243, 229, 177, 0.88);
  font-size: 30px;
  filter: drop-shadow(0 0 16px rgba(237, 224, 174, 0.38));
}

.moon-modal h2,
.side-panel h2 {
  margin: 13px 0 0;
  font-family: "Noto Serif SC", serif;
  font-size: 30px;
  font-weight: 300;
  letter-spacing: 0.14em;
  text-shadow: 0 0 18px rgba(225, 240, 255, 0.36);
}

.moon-modal p {
  margin: 20px 0 32px;
  color: rgba(219, 231, 247, 0.72);
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 18px;
}

.glass-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 26px;
  border: 1px solid rgba(233, 244, 255, 0.28);
  border-radius: 4px;
  background: rgba(9, 24, 45, 0.28);
  color: rgba(241, 248, 255, 0.88);
  cursor: pointer;
  letter-spacing: 0.12em;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.glass-button:hover,
.glass-button:focus-visible {
  border-color: rgba(247, 232, 176, 0.72);
  background: rgba(28, 47, 72, 0.38);
  color: #fff8e6;
  box-shadow: 0 0 20px rgba(238, 225, 170, 0.18);
  outline: none;
}

.glass-button:active {
  transform: translateY(1px);
}

.glass-button--primary {
  color: rgba(252, 246, 225, 0.95);
}

.glass-button--wide {
  width: 100%;
  margin-top: 22px;
}

.side-panel {
  width: min(520px, calc(100vw - 36px));
  max-height: min(82vh, 780px);
  padding: 34px 34px 32px;
}

.settings-panel {
  width: min(610px, calc(100vw - 36px));
}

.history-panel {
  width: min(690px, calc(100vw - 36px));
}

.close-button {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(231, 242, 255, 0.2);
  border-radius: 50%;
  background: rgba(6, 16, 31, 0.24);
  color: rgba(238, 246, 255, 0.76);
  cursor: pointer;
  font-size: 24px;
}

.close-button:hover,
.close-button:focus-visible {
  color: #fff8e6;
  border-color: rgba(244, 230, 176, 0.58);
  outline: none;
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.panel-heading h2 {
  margin: 0;
}

.setting-row {
  display: grid;
  grid-template-columns: 150px 1fr 42px;
  align-items: center;
  gap: 16px;
  margin: 18px 0;
  color: rgba(235, 244, 255, 0.85);
  font-size: 15px;
  letter-spacing: 0.08em;
}

.setting-row span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.setting-row strong {
  color: rgba(244, 248, 255, 0.86);
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  font-weight: 500;
  text-align: right;
}

.setting-row input {
  width: 100%;
  accent-color: #dceeff;
}

.prompt-box {
  margin-top: 26px;
  padding: 20px;
  border: 1px solid rgba(230, 242, 255, 0.18);
  border-radius: 6px;
  background: rgba(4, 12, 24, 0.28);
}

.prompt-box h3 {
  margin: 0 0 13px;
  color: rgba(251, 253, 255, 0.94);
  font-family: "Noto Serif SC", serif;
  font-size: 19px;
  font-weight: 300;
  letter-spacing: 0.12em;
}

.prompt-box pre {
  max-height: 240px;
  margin: 0;
  overflow: auto;
  color: rgba(225, 235, 250, 0.78);
  font-family: "Noto Serif SC", serif;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.history-list {
  max-height: min(58vh, 520px);
  overflow: auto;
  padding-right: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: 108px 1fr;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(229, 242, 255, 0.12);
}

.history-item strong {
  color: rgba(250, 253, 255, 0.94);
  font-family: "Noto Serif SC", serif;
  font-weight: 400;
  letter-spacing: 0.09em;
}

.history-item p {
  margin: 0;
  color: rgba(224, 234, 249, 0.78);
  font-family: "Noto Serif SC", serif;
  line-height: 1.8;
  letter-spacing: 0.04em;
}

@keyframes sceneFade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes cuePulse {
  0%,
  100% {
    transform: translateX(0);
    filter: drop-shadow(0 0 5px rgba(245, 235, 184, 0.45));
  }

  50% {
    transform: translateX(5px);
    filter: drop-shadow(0 0 14px rgba(245, 235, 184, 0.85));
  }
}

@keyframes loadingSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loadingOrbit {
  from {
    transform: rotate(0deg) translateX(40px) rotate(0deg);
  }

  to {
    transform: rotate(360deg) translateX(40px) rotate(-360deg);
  }
}

@keyframes loadingPulse {
  0%,
  100% {
    box-shadow: 0 0 10px rgba(183, 199, 232, 0.3);
    opacity: 0.7;
  }

  50% {
    box-shadow: 0 0 25px rgba(183, 199, 232, 0.9);
    opacity: 1;
  }
}

@keyframes loadingBreathe {
  0%,
  100% {
    opacity: 0.62;
    text-shadow: 0 0 8px rgba(183, 199, 232, 0.2);
  }

  50% {
    opacity: 1;
    text-shadow: 0 0 16px rgba(183, 199, 232, 0.8), 0 0 4px rgba(183, 199, 232, 0.5);
  }
}

@media (max-aspect-ratio: 4 / 3) {
  body {
    overflow: auto;
    background: #07101f;
  }

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

  .main-menu {
    top: 61%;
    width: min(82vw, 390px);
  }

  .story-character {
    right: -10%;
    bottom: -2%;
    height: 57vh;
    max-width: 58vw;
    opacity: 0.8;
  }

  .story-tools {
    right: 16px;
    left: 16px;
    justify-content: flex-end;
    gap: 6px;
  }

  .mini-button {
    min-width: 48px;
    padding: 0 9px;
    font-size: 12px;
  }

  .dialogue-hit-area {
    left: 0;
    right: 0;
    bottom: 0;
    height: 31%;
  }

  .dialogue-copy {
    left: 54px;
    right: 72px;
    bottom: 26px;
  }

  .dialogue-text {
    font-size: 18px;
    line-height: 1.58;
  }

  .chat-character {
    right: -18%;
    bottom: -4%;
    height: 66vh;
    opacity: 0.42;
  }

  .chat-panel {
    left: 18px;
    right: 18px;
    top: 112px;
    width: auto;
    min-width: 0;
    height: calc(100svh - 210px);
  }

  .chat-actions {
    top: 28px;
    right: 18px;
    gap: 14px;
  }

  .corner-link--left {
    top: 28px;
    left: 18px;
  }

  .icon-text-button,
  .corner-link {
    font-size: 12px;
    letter-spacing: 0.08em;
  }
}

@media (max-width: 680px) {
  .ornament-button__text {
    min-width: 130px;
  }

  .speaker-plate {
    min-width: 132px;
  }

  .dialogue-text {
    font-size: 18px;
    line-height: 1.65;
  }

  .next-cue {
    right: 24px;
    bottom: 30px;
  }

  .setting-row {
    grid-template-columns: 1fr 42px;
  }

  .setting-row span {
    grid-column: 1 / -1;
  }

  .history-item {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .modal-actions {
    flex-direction: column;
  }
}
