* {
  box-sizing: border-box;
}

:root {
  --text: #fff8ef;
  --sub: #ffe7c7;
  --brown: #5a341f;
  --coffee: #8b5a3c;
  --milk: #fff2dc;
  --gold: #ffd66b;
  --orange: #ff9b59;
  --pink: #ff8fb3;
  --line: rgba(255, 255, 255, 0.25);
  --box: rgba(64, 35, 26, 0.82);
  --shadow: 0 24px 70px rgba(44, 20, 10, 0.38);
}

html {
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    "Hiragino Maru Gothic ProN",
    "Yu Gothic",
    system-ui,
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 214, 107, 0.55), transparent 26%),
    radial-gradient(circle at 80% 20%, rgba(255, 143, 179, 0.42), transparent 28%),
    linear-gradient(160deg, #2b1748 0%, #61412b 48%, #1d1430 100%);
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.8) 0 2px, transparent 3px),
    radial-gradient(circle, rgba(255, 214, 107, 0.7) 0 1px, transparent 2px);
  background-size: 120px 120px, 80px 80px;
  opacity: 0.32;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
}

.screen {
  display: none;
  min-height: 100vh;
  width: min(1040px, calc(100% - 24px));
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.screen.active {
  display: block;
}

.title-screen {
  text-align: center;
  align-content: center;
  padding: 40px 0;
}

.label {
  margin: 0;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}

h1 {
  margin: 16px 0 0;
  font-size: clamp(3.1rem, 11vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: -0.08em;
  text-shadow:
    0 0 24px rgba(255, 214, 107, 0.48),
    0 0 58px rgba(255, 143, 179, 0.34);
}

.catch {
  margin: 22px 0 0;
  color: var(--sub);
  font-size: clamp(1.1rem, 3vw, 1.7rem);
  font-weight: 900;
}

.credit-box {
  width: min(520px, 100%);
  margin: 28px auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.credit-box p {
  margin: 6px 0;
  color: var(--sub);
  font-weight: 800;
}

.main-btn,
.next-btn,
.sub-btn,
.choice-btn {
  border: 0;
  border-radius: 999px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.main-btn,
.next-btn {
  min-height: 50px;
  padding: 0 28px;
  background: linear-gradient(135deg, var(--orange), var(--pink));
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.main-btn:hover,
.next-btn:hover,
.sub-btn:hover,
.choice-btn:hover {
  transform: translateY(-2px);
}

.back-link {
  display: block;
  width: fit-content;
  margin: 18px auto 0;
  color: rgba(255, 248, 239, 0.72);
  font-weight: 800;
}

.novel-screen.active {
  display: grid;
  align-content: end;
  padding: 24px 0;
}

.stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(20, 12, 35, 0.1), rgba(20, 12, 35, 0.74)),
    radial-gradient(circle at 50% 34%, rgba(255, 224, 160, 0.24), transparent 35%);
}

.stage::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 175px;
  width: min(900px, 92vw);
  height: 160px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(255, 236, 202, 0.16);
  filter: blur(12px);
}

.character {
  position: fixed;
  z-index: 1;
  max-width: 28vw;
  max-height: 52vh;
  object-fit: contain;
  filter: drop-shadow(0 24px 28px rgba(0, 0, 0, 0.34));
  transition:
    transform 0.2s ease,
    opacity 0.2s ease,
    filter 0.2s ease;
}

.mocchi {
  left: 50%;
  top: 11%;
  transform: translateX(-50%);
}

.coffee {
  left: 11%;
  bottom: 210px;
}

.tapioca {
  right: 10%;
  bottom: 210px;
}

.character.speaking {
  transform: translateY(-12px) scale(1.05);
  filter:
    drop-shadow(0 24px 28px rgba(0, 0, 0, 0.34))
    drop-shadow(0 0 18px rgba(255, 214, 107, 0.55));
}

.mocchi.speaking {
  transform: translateX(-50%) translateY(-12px) scale(1.05);
}

.character.dim {
  opacity: 0.62;
}

.message-box {
  position: relative;
  z-index: 3;
  width: min(920px, 100%);
  margin: auto auto 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--box);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.name-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.speaker-name {
  color: var(--gold);
  font-size: 1.08rem;
  font-weight: 900;
}

.gag-point {
  color: var(--sub);
  font-size: 0.9rem;
  font-weight: 900;
}

.message-text {
  min-height: 104px;
  margin: 0;
  color: var(--text);
  font-size: 1.06rem;
  line-height: 1.9;
  font-weight: 800;
  white-space: pre-line;
}

.choices {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.choice-btn {
  width: 100%;
  min-height: 48px;
  padding: 12px 18px;
  color: var(--text);
  text-align: left;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.12);
}

.choice-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.sub-btn {
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.12);
}

.next-btn {
  min-width: 120px;
}

@media (max-width: 760px) {
  html,
  body {
    min-height: 100dvh;
    overflow: hidden;
  }

  .novel-screen.active {
    min-height: 100dvh;
    padding: 12px 0 max(12px, env(safe-area-inset-bottom));
    align-content: end;
  }

  .character {
    max-width: 38vw;
    max-height: 36vh;
  }

  .mocchi {
    top: 8%;
  }

  .coffee {
    left: 2%;
    bottom: 230px;
  }

  .tapioca {
    right: 2%;
    bottom: 230px;
  }

  .message-box {
    max-height: 42dvh;
    overflow-y: auto;
    padding: 16px;
    border-radius: 20px;
  }

  .message-text {
    min-height: 96px;
    font-size: 0.95rem;
    line-height: 1.75;
  }

  .actions {
    flex-direction: row;
    gap: 10px;
  }

  .sub-btn,
  .next-btn {
    width: auto;
    flex: 1;
    min-height: 42px;
    padding: 0 14px;
  }
}
