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

.hidden { display: none !important; }

:root {
  --panel: rgba(28, 24, 38, 0.88);
  --panel-border: rgba(255, 214, 150, 0.25);
  --cream: #fff3dc;
  --amber: #ffb454;
}

html, body { height: 100%; overflow: hidden; }
body {
  font-family: "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
  background: #1a1626;
  color: var(--cream);
}

#app, #scene { position: absolute; inset: 0; width: 100%; height: 100%; }

/* ---------- overlays ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(30,25,45,0.92), rgba(12,10,20,0.97));
  transition: opacity 0.6s;
}
.overlay.hidden { display: none; }

.intro-card {
  max-width: 480px; padding: 36px 40px; text-align: center;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.intro-card h1 { font-size: 26px; margin-bottom: 14px; letter-spacing: 0.5px; }
.intro-day { color: var(--amber); font-weight: 600; margin-bottom: 10px; }
.intro-text { line-height: 1.55; font-size: 15px; opacity: 0.92; margin-bottom: 22px; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-size: 14px; color: var(--cream);
  background: rgba(255,255,255,0.08); border: 1px solid var(--panel-border);
  padding: 9px 16px; border-radius: 12px; cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: rgba(255,255,255,0.16); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #ff9c3f, #ee7d1f); border-color: #ffb96e; color: #2a1602; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.small { padding: 5px 11px; font-size: 12px; border-radius: 9px; }
.btn.give { background: linear-gradient(180deg, #7ecb6f, #52a344); border-color: #a9e29d; color: #0d2607; font-weight: 700; }

/* ---------- HUD ---------- */
#hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; padding: 14px 16px;
  pointer-events: none;
}
#hud.hidden { display: none; }
#hud .btn { pointer-events: auto; }
.hud-left, .hud-right { display: flex; gap: 8px; align-items: flex-start; }
.chip {
  background: var(--panel); border: 1px solid var(--panel-border);
  padding: 8px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
}
.chip.item { border-color: #a9e29d; color: #cdf3c2; }
.chip.hidden { display: none; }

/* ---------- interaction prompt ---------- */
#prompt {
  position: absolute; left: 50%; bottom: 26%; transform: translateX(-50%);
  z-index: 15; background: var(--panel); border: 1px solid var(--panel-border);
  padding: 8px 16px; border-radius: 12px; font-size: 14px;
}
#prompt.hidden { display: none; }

/* ---------- dialogue ---------- */
#dialogue {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  width: min(680px, 94vw); z-index: 30;
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 18px; padding: 14px 18px 14px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.45);
}
#dialogue.hidden { display: none; }
.dlg-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
#dlg-name { font-size: 17px; font-weight: 800; color: var(--amber); }
.dlg-mood { font-size: 12px; opacity: 0.75; font-style: italic; flex: 1; }
.dlg-text {
  min-height: 58px; max-height: 130px; overflow-y: auto;
  font-size: 15px; line-height: 1.5; margin-bottom: 10px; white-space: pre-wrap;
}
.dlg-text .action { color: #a8d8ff; font-style: italic; }
.dlg-input-row { display: flex; gap: 8px; }
#dlg-input {
  flex: 1; font: inherit; font-size: 14px; color: var(--cream);
  background: rgba(255,255,255,0.07); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 9px 13px; outline: none;
}
#dlg-input:focus { border-color: var(--amber); }

/* ---------- scrapbook ---------- */
.book {
  width: min(620px, 94vw); max-height: 84vh; overflow-y: auto;
  background: #f7ecd7; color: #3d2c1c; border-radius: 18px; padding: 26px 30px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.6);
}
.book-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.book-head .btn { color: #3d2c1c; border-color: #c9b490; background: rgba(0,0,0,0.05); }
.book h3 { margin: 14px 0 10px; font-size: 15px; color: #7c5b33; }
.book-friends { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.friend-card {
  background: #fffaf0; border: 1px solid #e2d3b4; border-radius: 12px; padding: 12px;
}
.friend-card b { display: block; margin-bottom: 4px; }
.friend-card .hearts { font-size: 13px; letter-spacing: 1px; }
.friend-card .opinion { font-size: 12px; line-height: 1.4; margin-top: 6px; opacity: 0.85; }
.friend-card .mood { font-size: 11px; font-style: italic; opacity: 0.7; margin-top: 4px; }
.book-entries { display: flex; flex-direction: column; gap: 10px; }
.entry {
  background: #fffaf0; border: 1px solid #e2d3b4; border-radius: 12px; padding: 12px 14px;
}
.entry b { font-size: 14px; }
.entry .cap { font-size: 13px; line-height: 1.45; margin-top: 4px; }
.entry .meta { font-size: 11px; opacity: 0.6; margin-top: 6px; }
.entry.empty { text-align: center; opacity: 0.7; font-style: italic; }

/* ---------- customizer ---------- */
.cust-card {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 20px; padding: 24px 28px; text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5); max-height: 92vh; overflow-y: auto;
}
.cust-card h1 { font-size: 22px; margin-bottom: 14px; }
.cust-body { display: flex; gap: 22px; align-items: stretch; margin-bottom: 16px; }
#preview {
  width: 300px; height: 364px; border-radius: 16px;
  background: radial-gradient(ellipse at 50% 30%, #3d3660, #211d33);
  border: 1px solid var(--panel-border);
}
.cust-opts { display: flex; flex-direction: column; gap: 7px; min-width: 300px; text-align: left; }
.cust-name-row { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 700; margin-bottom: 3px; }
#cust-name {
  flex: 1; font: inherit; font-size: 14px; color: var(--cream);
  background: rgba(255,255,255,0.07); border: 1px solid var(--panel-border);
  border-radius: 10px; padding: 7px 11px; outline: none;
}
#cust-name:focus { border-color: var(--amber); }
.cust-presets { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.cust-presets .lbl { width: 74px; font-size: 12px; opacity: 0.75; font-weight: 700; }
.cust-row { display: flex; align-items: center; gap: 6px; }
.cust-row .lbl { width: 74px; font-size: 12px; opacity: 0.75; font-weight: 700; }
.cust-row .val { flex: 1; text-align: center; font-size: 13px; font-weight: 600; }
.cust-row button {
  width: 30px; height: 30px; border-radius: 9px; font-size: 13px;
  background: rgba(255,255,255,0.08); border: 1px solid var(--panel-border);
  color: var(--cream); cursor: pointer;
}
.cust-row button:hover { background: rgba(255,255,255,0.18); }
.cust-colors { display: flex; gap: 6px; margin-top: 4px; padding-left: 74px; flex-wrap: wrap; }
.cust-colors .swatch {
  width: 22px; height: 22px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent;
}
.cust-colors .swatch.sel { border-color: var(--cream); }

/* ---------- quests & paywall ---------- */
.entry.quest-open { border-left: 4px solid #e8a13f; }
.entry.quest-done { opacity: 0.65; border-left: 4px solid #7ecb6f; }
.entry .qgiver { font-size: 11px; opacity: 0.6; margin-top: 5px; }
.pw-dev { font-size: 12px; opacity: 0.8; margin-top: 10px; line-height: 2; }

/* ---------- toasts ---------- */
#toasts {
  position: absolute; top: 66px; left: 50%; transform: translateX(-50%);
  z-index: 35; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 14px; padding: 10px 18px; font-size: 14px;
  animation: toast-in 0.35s ease, toast-out 0.5s ease 4.5s forwards;
  max-width: 80vw; text-align: center;
}
.toast.memory { border-color: var(--amber); color: #ffe9c4; box-shadow: 0 0 24px rgba(255,180,84,0.25); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }

.typing::after { content: "…"; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.2; } }
