:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  background: #160d13;
  color: #f4eee9;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

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

body { min-width: 320px; background: #160d13; }

button, input, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(100%, 390px);
  margin: 0 auto;
  height: 100dvh;
  min-height: 640px;
  overflow: hidden;
  isolation: isolate;
  background: #211119;
}

.scene {
  position: absolute;
  z-index: -2;
  inset: 0;
  background-image: var(--room-image);
  background-position: center top;
  background-size: cover;
  background-repeat: no-repeat;
}

.scene::after {
  position: absolute;
  content: "";
  inset: 0;
  background: linear-gradient(180deg, rgba(30, 30, 30, 0) 30%, rgba(30, 30, 30, .6) 100%);
}

.topbar {
  display: flex;
  justify-content: flex-end;
  padding: 40px 14px 0;
}

.menu-button {
  display: grid;
  place-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(218, 177, 105, .82);
  border-radius: 50%;
  color: #e8c47f;
  background: rgba(39, 18, 28, .68);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.menu-button span { display: block; width: 17px; height: 1.5px; background: currentColor; }

.conversation {
  position: relative;
  min-height: 0;
  overflow: hidden;
  margin: 160px 14px 0;
  border: 1px solid rgba(210, 174, 114, 1);
  border-radius: 13px;
  background: rgba(40, 20, 30, .7);
  box-shadow: 0 12px 30px rgba(8, 3, 8, .2);
}

.conversation--overflow::before {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  left: 0;
  height: 28px;
  content: "";
  background: linear-gradient(180deg, rgba(40, 20, 30, .98), rgba(40, 20, 30, 0));
  pointer-events: none;
}

.conversation--overflow::after {
  position: absolute;
  z-index: 2;
  bottom: 0;
  right: 0;
  left: 0;
  height: 28px;
  content: "";
  background: linear-gradient(0deg, rgba(40, 20, 30, .98), rgba(40, 20, 30, 0));
  pointer-events: none;
}

.message-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  margin: 0 auto;
  padding: 14px 14px 120px;
}

.message-stack::-webkit-scrollbar { display: none; }

.message-card {
  width: 100%;
  max-width: 100%;
  padding: 0;
}

.message--shirley {
  align-self: flex-start;
}

.message--you {
  align-self: flex-end;
  width: 100%;
  max-width: 100%;
}

.message-label {
  margin-bottom: 4px;
  color: #d2ae72;
  font-family: "Microsoft Sans Serif", Arial, sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .10em;
  line-height: 1.2;
}

.message--you .message-label { color: #c8a9d2; }

.message-card p {
  margin: 0;
  color: #ffffff;
  font-family: "IBM Plex Sans", Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.28;
}

.message-action { color: #c3bec4; }
.message-dialogue { color: #e59829; }

.message--with-card {
  width: 100%;
  max-width: 100%;
}

.card-inline {
  display: inline;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid rgba(240, 200, 119, .95);
  color: #f0c97d;
  background: rgba(117, 73, 38, .16);
  font: inherit;
  text-decoration: none;
  text-underline-offset: 3px;
  cursor: pointer;
}

.card-inline:active,
.card-inline:focus-visible { color: #ffe3a6; background: rgba(163, 110, 55, .28); }

.message--loading { min-width: 134px; }

.typing-dots { display: flex; gap: 6px; padding-top: 3px; }

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e6bc73;
  animation: breathe 1.1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: .16s; }
.typing-dots span:nth-child(3) { animation-delay: .32s; }

@keyframes breathe { 0%, 60%, 100% { opacity: .32; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }

.notice {
  align-self: center;
  max-width: 92%;
  padding: 8px 12px;
  border: 1px solid rgba(211, 169, 94, .62);
  border-radius: 12px;
  color: #f0dcc1;
  background: rgba(35, 16, 25, .84);
  font-size: 13px;
  text-align: center;
}

.composer-wrap {
  position: relative;
  z-index: 2;
  padding: 14px 14px max(48px, calc(env(safe-area-inset-bottom) + 12px));
  background: linear-gradient(180deg, rgba(19, 8, 14, 0), rgba(19, 8, 14, .88) 34%);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 0;
}

.composer input {
  min-width: 0;
  flex: 1;
  height: 42px;
  border: 0;
  outline: 0;
  color: #f5eee7;
  background: transparent;
  font-size: 16px;
  font-family: "IBM Plex Sans", Arial, sans-serif;
}

.composer textarea {
  min-width: 0;
  flex: 1;
  min-height: 44px;
  max-height: 132px;
  padding: 9px 13px;
  border: 1px solid rgba(204, 170, 114, .4);
  border-radius: 13px;
  outline: 0;
  resize: none;
  overflow-y: hidden;
  color: #f5eee7;
  background: rgba(30, 30, 30, .8);
  font-size: 16px;
  font-family: "IBM Plex Sans", Arial, sans-serif;
  line-height: 1.35;
  transition: border-color 140ms ease;
}

.composer textarea:focus { border-color: rgba(204, 170, 114, 1); }

.composer input::placeholder,
.composer textarea::placeholder { color: rgba(247, 237, 228, .72); }
.composer input:disabled,
.composer textarea:disabled { color: rgba(247, 237, 228, .46); }

.send-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(204, 170, 114, .4);
  border-radius: 50%;
  color: #f4ce8b;
  background: rgba(30, 30, 30, .8);
  cursor: pointer;
  line-height: 1;
  transition: border-color 140ms ease, opacity 140ms ease;
}

.send-button:not(.is-disabled) { border-color: rgba(204, 170, 114, 1); }

.send-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.send-button svg path:first-child { fill: currentColor; stroke: currentColor; }

.send-button.is-disabled { opacity: .42; cursor: default; }

.card-modal {
  position: fixed;
  z-index: 10;
  inset: 0;
  overflow-y: auto;
  padding: max(52px, calc(env(safe-area-inset-top) + 24px)) 18px max(24px, env(safe-area-inset-bottom));
  background: rgba(25, 10, 20, .86);
  backdrop-filter: blur(8px);
}

.modal-close {
  position: fixed;
  z-index: 11;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(222, 182, 108, .92);
  border-radius: 50%;
  color: #f1cb87;
  background: rgba(47, 23, 33, .82);
  cursor: pointer;
  font-size: 29px;
  font-weight: 200;
  line-height: 1;
}

.card-modal__inner { display: grid; gap: 18px; width: min(100%, 460px); margin: 0 auto; }

.card-modal__image-frame {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 13px;
  box-shadow: 0 16px 42px rgba(7, 2, 7, .54);
}

.card-modal__image {
  display: block;
  width: auto;
  height: min(57vh, 520px);
  max-width: 100%;
  margin: 0 auto;
  border-radius: 13px;
}

.card-modal__copy {
  padding: 22px 18px 24px;
  border: 1px solid rgba(211, 169, 94, .92);
  border-radius: 17px;
  background: rgba(47, 20, 31, .91);
  box-shadow: 0 12px 28px rgba(9, 3, 8, .3);
}

.card-modal__copy h1 {
  margin: 0;
  color: #e4bb76;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(18px, 5vw, 25px);
  font-weight: 500;
  letter-spacing: .12em;
  line-height: 1.25;
  text-align: center;
}

.card-modal__copy p { margin: 0 0 14px; color: #f5eee8; font-size: 16px; line-height: 1.48; }
.card-modal__copy p:last-child { margin-bottom: 0; }

.ornament { display: flex; align-items: center; gap: 10px; margin: 14px 0 18px; color: #e0b873; }
.ornament span { height: 1px; flex: 1; background: linear-gradient(90deg, transparent, rgba(218, 174, 96, .82)); }
.ornament span:last-child { background: linear-gradient(90deg, rgba(218, 174, 96, .82), transparent); }
.ornament b { font-size: 21px; font-weight: 400; }

@media (min-width: 700px) {
  .app-shell { box-shadow: 0 0 80px rgba(0, 0, 0, .35); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
