:root {
  --panel: rgba(12, 16, 28, 0.78);
  --line: rgba(232, 180, 196, 0.22);
  --accent: #e8a0b0;
  --accent-cool: #9eb6d8;
  --text: #f4ebe6;
  --muted: #a9b4d0;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: #07090f; color: var(--text);
  font-family: "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow: hidden; user-select: none;
}
#app {
  position: relative; width: 100%; height: 100%;
  max-width: 1280px; margin: 0 auto; background: #000;
  overflow: hidden;
}
#bg, #cg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  transition: opacity .45s ease;
}
#cg.hidden { opacity: 0; pointer-events: none; }
#sprite-wrap {
  position: absolute; left: 0; right: 0; bottom: 18%;
  height: 72%; display: flex; justify-content: center; align-items: flex-end;
  pointer-events: none;
}
#sprite {
  max-height: 100%; max-width: min(420px, 70vw);
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.45));
  transition: opacity .3s ease, transform .3s ease;
}
#sprite.hidden { opacity: 0; transform: translateY(12px); }

#hud {
  position: absolute; top: 10px; right: 12px; z-index: 20;
  display: flex; gap: 8px; align-items: center;
}
#aff {
  font-size: 12px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line);
  padding: 6px 10px; border-radius: 999px; backdrop-filter: blur(8px);
}
#hud button, .title-card button, #choices button {
  cursor: pointer; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); border-radius: 10px; padding: 8px 12px;
  backdrop-filter: blur(8px); font-size: 14px;
  transition: border-color .15s, color .15s, background .15s;
}
#hud button:hover, .title-card button:hover, #choices button:hover {
  border-color: var(--accent); color: #fff;
}
.title-card button.ghost { background: transparent; }

.overlay {
  position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 8, 16, .58);
  backdrop-filter: blur(3px);
}
.overlay.hidden { display: none; }
.title-card {
  width: min(440px, 90vw); padding: 36px 28px 28px;
  background: linear-gradient(165deg, rgba(22, 28, 48, .88), rgba(12, 14, 26, .92));
  border: 1px solid var(--line); border-radius: 20px; text-align: center;
  box-shadow:
    0 24px 70px rgba(0,0,0,.5),
    inset 0 1px 0 rgba(255,255,255,.06);
  backdrop-filter: blur(14px);
}
.title-card h1 {
  margin: 0 0 10px;
  font-weight: 600;
  letter-spacing: .2em;
  text-indent: .2em;
  font-size: clamp(1.8rem, 5vw, 2.35rem);
  background: linear-gradient(180deg, #fff5f2, #e8a0b0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.title-card h2 { margin: 0 0 14px; letter-spacing: .08em; }
.title-card .sub {
  color: var(--accent-cool);
  margin: 0 0 8px;
  letter-spacing: .12em;
  font-size: .95rem;
}
.title-card .hint, .tiny { color: var(--muted); font-size: 12px; }
.title-card button {
  display: block; width: 100%; margin: 10px 0 0; padding: 12px;
  border-radius: 999px;
  letter-spacing: .06em;
}
.title-card #btn-start,
.title-card #btn-name,
.title-card #btn-again {
  background: linear-gradient(135deg, rgba(240,184,196,.92), rgba(217,136,154,.88));
  color: #2a1018;
  border-color: transparent;
  font-weight: 600;
}
.title-card #btn-start:hover,
.title-card #btn-name:hover,
.title-card #btn-again:hover {
  color: #1a0810;
  border-color: transparent;
  filter: brightness(1.05);
}
#name-input {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(0,0,0,.35); color: var(--text); font-size: 16px; text-align: center;
}
#name-input:focus {
  outline: none;
  border-color: var(--accent);
}

#textbox {
  position: absolute; left: 3%; right: 3%; bottom: 3%; z-index: 15;
  min-height: 150px; max-height: 38%;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px 20px 28px;
  backdrop-filter: blur(10px);
  cursor: pointer;
}
#nameplate {
  display: inline-block; margin-bottom: 8px; padding: 4px 12px;
  background: rgba(232,160,176,.16); border: 1px solid var(--line);
  border-radius: 999px; font-size: 13px; color: var(--accent);
}
#nameplate.hidden { display: none; }
#dialogue {
  font-size: clamp(15px, 2.2vw, 18px); line-height: 1.75;
  white-space: pre-wrap; min-height: 3.5em;
}
#click-hint {
  position: absolute; right: 16px; bottom: 10px;
  color: var(--accent); animation: blink 1.2s infinite; font-size: 12px;
}
@keyframes blink { 50% { opacity: .25; } }

#choices {
  position: absolute; left: 50%; bottom: 28%; transform: translateX(-50%);
  z-index: 18; width: min(560px, 92vw); display: flex; flex-direction: column; gap: 10px;
}
#choices.hidden { display: none; }
#choices button {
  text-align: left; padding: 14px 16px; font-size: 15px; line-height: 1.45;
  background: rgba(12,16,28,.88);
}

/* Load bar sakura tint (inline styles in HTML still work; this softens wrap) */
#load-bar-wrap {
  border: 1px solid rgba(232,160,176,.18);
}

@media (max-width: 640px) {
  #sprite { max-width: 88vw; }
  #textbox { min-height: 160px; }
  #aff { display: none; }
}
