:root {
  --gold: #d4b45a;
  --gold2: #f3e0a8;
  --wine: #6b1d1d;
  --ink: #f4ead6;
  --muted: #c4b59a;
  --glass: rgba(28, 12, 8, .62);
  --line: rgba(212, 180, 90, .32);
  --danger: #e08a8a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Cormorant Garamond", Georgia, serif;
  color: var(--ink);
  background: #120805;
  overflow: hidden;
  min-height: 100dvh;
}
.sea, .sea-phone {
  position: fixed; inset: 0;
  background: url("/img/sea.jpg") center / cover no-repeat;
  transform: scale(1.08);
  animation: ken 48s ease-in-out infinite alternate;
  z-index: 0;
}
.sea-phone {
  display: none;
  background-image: url("/img/sea-phone.jpg");
}
@media (max-aspect-ratio: 3/4) {
  .sea { display: none; }
  .sea-phone { display: block; }
}
@keyframes ken {
  from { transform: scale(1.06) translate3d(0,0,0); }
  to { transform: scale(1.14) translate3d(-1%, 1%, 0); }
}
.flash, .flash-b {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  mix-blend-mode: screen;
}
.flash {
  background: radial-gradient(ellipse at 70% 18%, rgba(212,180,90,.22), transparent 48%);
  animation: glow 8s ease-in-out infinite;
}
.flash-b {
  background: radial-gradient(ellipse at 20% 80%, rgba(107,29,29,.28), transparent 42%);
  animation: glow 11s ease-in-out 2s infinite;
}
@keyframes glow {
  0%, 100% { opacity: .35; }
  50% { opacity: .7; }
}
.rain { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
.vignette {
  position: fixed; inset: 0; z-index: 3; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(12,4,2,.45), transparent 22%, transparent 72%, rgba(12,4,2,.35)),
    radial-gradient(ellipse at center, transparent 42%, rgba(0,0,0,.35) 100%);
}
.screen {
  position: relative; z-index: 4;
  height: 100dvh;
  display: flex; flex-direction: column;
  padding: calc(18px + env(safe-area-inset-top)) 18px calc(16px + env(safe-area-inset-bottom));
  max-width: 720px; margin: 0 auto;
}
.hidden { display: none !important; }
.word {
  font-family: Cinzel, Georgia, serif;
  font-weight: 700; letter-spacing: .22em;
  font-size: 20px;
  color: var(--gold2);
  text-shadow: 0 2px 18px rgba(212,180,90,.35);
}
.word.small { font-size: 13px; letter-spacing: .28em; }
.hint { font-size: 13px; color: var(--muted); text-align: center; }
.ghost {
  background: transparent; border: 0; color: var(--gold2); font: inherit; cursor: pointer;
}
.top {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.top-mid { flex: 1; min-width: 0; }
.now-engine { font-size: 12px; color: var(--gold); letter-spacing: .12em; text-transform: uppercase; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--glass); color: var(--gold2); font-size: 18px;
  backdrop-filter: blur(12px);
}
.engines {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 4px 2px 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.engines::-webkit-scrollbar { display: none; }
.eng {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  background: rgba(28,12,8,.55);
  color: var(--gold2);
  font-size: 13px; font-weight: 600;
  letter-spacing: .08em;
  white-space: nowrap;
  backdrop-filter: blur(10px);
}
.eng.on {
  background: linear-gradient(90deg, rgba(107,29,29,.7), rgba(212,180,90,.28));
  box-shadow: 0 0 18px rgba(212,180,90,.28);
  color: #fff;
  border-color: var(--gold);
}
.thread {
  flex: 1; overflow-y: auto; padding: 6px 2px 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.bubble {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 16px 16px 16px 4px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.bubble.me {
  align-self: flex-end;
  border-radius: 16px 16px 4px 16px;
  background: linear-gradient(180deg, rgba(107,29,29,.55), rgba(28,12,8,.7));
}
.bubble .meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; letter-spacing: .08em; }
.welcome {
  text-align: center; color: var(--gold2);
  padding: 28px 10px; text-shadow: 0 2px 18px rgba(0,0,0,.6);
}
.welcome h2 {
  font-family: Cinzel, Georgia, serif; letter-spacing: .28em; font-size: 22px; margin: 0 0 8px;
  color: var(--gold);
}
.typing { opacity: .85; font-style: italic; }
.composer {
  display: flex; gap: 8px; align-items: flex-end;
  flex-shrink: 0;
  background: rgba(40,16,10,.92);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 12px 10px 12px 16px;
  backdrop-filter: blur(18px);
  box-shadow: 0 0 28px rgba(212,180,90,.35);
}
.composer textarea {
  flex: 1; resize: none; min-height: 44px; max-height: 120px;
  background: transparent; border: 0; color: var(--ink);
  font: inherit; font-size: 18px; outline: none;
}
.send {
  width: 46px; height: 46px; border-radius: 12px; border: 0;
  background: radial-gradient(circle at 30% 30%, #f3e0a8, var(--gold) 42%, #6b1d1d);
  color: #1a0a08; font-size: 18px; font-weight: 800;
  box-shadow: 0 0 18px rgba(212,180,90,.45);
  font-family: Cinzel, Georgia, serif;
}
.drawer {
  position: fixed; z-index: 8; top: 0; bottom: 0; left: 0;
  width: min(360px, 88vw);
  background: rgba(18,6,4,.9);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(22px);
  padding: calc(18px + env(safe-area-inset-top)) 16px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.chat-list { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.chat-row {
  background: rgba(255,255,255,.05);
  border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; color: var(--ink); text-align: left;
  font: inherit; width: 100%;
}
.shade {
  position: fixed; inset: 0; z-index: 7; background: rgba(0,0,0,.5);
}
code { font-family: ui-monospace, Consolas, monospace; font-size: .92em; color: var(--gold); }
