:root {
  --warm: #d99a7c;
  --box: rgba(28, 20, 24, 0.72);
  --box-border: rgba(255, 220, 200, 0.35);
  --text: #fdf3ec;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--text);
  overflow: hidden;
}

/* 場景：滿版暖色背景，圖放進 assets/bg/room.jpg 後自動套用 */
.scene {
  position: relative;
  width: 100vw;
  height: 100vh;
  background:
    linear-gradient(180deg, rgba(40,28,34,0.15), rgba(30,20,26,0.55)),
    url("assets/bg/room.jpg") center/cover no-repeat,
    linear-gradient(160deg, #3a2b33 0%, #5a4048 45%, #caa089 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* 立繪 */
.stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
}

.portrait {
  height: 92vh;
  max-width: 80vw;
  object-fit: contain;
  filter: drop-shadow(0 8px 30px rgba(0,0,0,0.45));
  transition: opacity .35s ease, transform .35s ease;
  animation: fadeUp .5s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.portrait-fallback {
  margin-bottom: 22vh;
  width: 34vh;
  height: 60vh;
  border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%;
  background: linear-gradient(180deg, rgba(255,235,225,0.18), rgba(217,154,124,0.30));
  border: 2px dashed var(--box-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 28px;
  letter-spacing: 4px;
  color: rgba(255,240,232,0.85);
}
.portrait-fallback small { font-size: 12px; letter-spacing: 0; opacity: .7; }

/* 對話框 */
.dialogue {
  position: relative;
  z-index: 2;
  margin: 0 auto;
  width: min(900px, 92vw);
  background: var(--box);
  backdrop-filter: blur(8px);
  border: 1px solid var(--box-border);
  border-radius: 18px 18px 0 0;
  padding: 22px 28px 20px;
  box-shadow: 0 -6px 40px rgba(0,0,0,0.35);
}

.name {
  position: absolute;
  top: -16px;
  left: 26px;
  background: var(--warm);
  color: #2a1c20;
  font-weight: 700;
  padding: 4px 18px;
  border-radius: 12px;
  font-size: 15px;
  letter-spacing: 2px;
}

.text {
  font-size: 19px;
  line-height: 1.9;
  min-height: 2.6em;
  white-space: pre-wrap;
}
.text::after {
  content: "▍";
  opacity: 0;
  animation: blink 1s steps(1) infinite;
}
.text.typing::after { opacity: .8; }
@keyframes blink { 50% { opacity: 0; } }

/* 輸入列 */
.inputbar {
  position: relative;
  z-index: 2;
  margin: 0 auto;
  width: min(900px, 92vw);
  display: flex;
  gap: 10px;
  padding: 14px 0 22px;
}

#input {
  flex: 1;
  font-size: 17px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--box-border);
  background: rgba(20,14,18,0.6);
  color: var(--text);
  outline: none;
}
#input:focus { border-color: var(--warm); }
#input::placeholder { color: rgba(253,243,236,0.45); }

button {
  font-size: 16px;
  padding: 0 22px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: filter .15s ease, opacity .15s;
}
#send {
  background: var(--warm);
  color: #2a1c20;
  font-weight: 700;
}
#send:hover { filter: brightness(1.08); }
#send:disabled { opacity: .5; cursor: default; }
#reset {
  background: rgba(255,255,255,0.1);
  color: rgba(253,243,236,0.7);
}
#reset:hover { filter: brightness(1.2); }
