:root {
  --ink: #12150f;
  --ink-2: #1a1f16;
  --paper: #efe6d2;
  --paper-2: #d9cdb0;
  --lime: #c8f25a;
  --lime-dim: #9fbf3d;
  --moss: #2a3322;
  --fog: #c5ccb8;
  --mute: #8b927c;
  --danger: #e26d5a;
  --guest: #232a1c;
  --mine: #c8f25a;
  --mine-ink: #1a220c;
  --line: rgba(232, 226, 208, 0.08);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-family: "Be Vietnam Pro", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--paper); }
button, textarea, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.chat-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(200, 242, 90, 0.08), transparent 50%),
    linear-gradient(180deg, #161b12, #10140c 40%, #0d100b);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 21, 15, 0.85);
  backdrop-filter: blur(12px);
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: var(--lime);
  color: var(--mine-ink);
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.who { display: flex; align-items: center; }
.who strong { font-size: 16px; }

.thread {
  overflow-y: auto;
  padding: 18px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bubble {
  max-width: min(78%, 42rem);
  padding: 10px 12px;
  border-radius: 16px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 8px 18px rgba(0,0,0,.12);
}
.bubble.guest {
  align-self: flex-start;
  background: var(--guest);
  color: var(--paper);
  border-bottom-left-radius: 6px;
}
.bubble.mine {
  align-self: flex-end;
  background: var(--mine);
  color: var(--mine-ink);
  border-bottom-right-radius: 6px;
}
.bubble time {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  opacity: 0.62;
}
.sil {
  display: block;
  margin-top: 4px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: 11px;
  opacity: 0.55;
  cursor: pointer;
}
.bubble.gone { opacity: 0.38; }
.bubble img, .bubble video {
  display: block;
  max-width: min(72vw, 320px);
  max-height: 320px;
  border-radius: 12px;
  margin-bottom: 8px;
  background: #000;
}
.daychip {
  align-self: center;
  font-size: 11px;
  color: var(--mute);
  background: rgba(255,255,255,.06);
  padding: 4px 10px;
  border-radius: 999px;
  margin: 6px 0;
}
.preview {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 12px 8px;
}
.filechip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--moss);
  color: var(--fog);
  border-radius: 999px;
  padding: 4px 8px 4px 10px;
  font-size: 12px;
}
.filechip button {
  border: 0;
  background: transparent;
  color: var(--paper);
  padding: 0 4px;
}
.icon-btn {
  width: 46px;
  border: 0;
  border-radius: 16px;
  background: var(--moss);
  color: var(--lime);
  font-size: 22px;
  font-weight: 700;
  flex: 0 0 46px;
}
.composer { align-items: flex-end; }


.dock { background: #141910; }
.composer {
  display: flex;
  gap: 8px;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: #141910;
}
.composer textarea {
  flex: 1;
  resize: none;
  min-height: 46px;
  max-height: 140px;
  border: 0;
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--moss);
  color: var(--paper);
  outline: none;
}
.composer button {
  border: 0;
  border-radius: 16px;
  padding: 0 16px;
  background: var(--lime);
  color: var(--mine-ink);
  font-weight: 700;
}

.typing {
  align-self: flex-start;
  color: var(--mute);
  font-size: 13px;
  padding: 0 6px 4px;
}

.panel-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  background: #0f130d;
}
@media (max-width: 900px) {
  .panel-shell { grid-template-columns: 1fr; }
}

.col {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100dvh;
  border-right: 1px solid var(--line);
}

.journal {
  background:
    linear-gradient(180deg, #efe6d2, #e4d8ba);
  color: #2a2418;
  min-height: 100dvh;
  overflow: auto;
  padding: 18px;
}
.journal h2, .journal h3 { font-family: "Fraunces", Georgia, serif; margin: 0 0 8px; }
.journal h2 { font-size: 28px; }
.muted { color: var(--mute); }
.journal .muted { color: #6d624c; }

.seg {
  display: flex;
  gap: 6px;
  background: #1c2218;
  padding: 4px;
  border-radius: 14px;
  margin-left: auto;
  flex-wrap: wrap;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--fog);
  padding: 8px 10px;
  border-radius: 11px;
}
.seg button.on { background: var(--lime); color: var(--mine-ink); font-weight: 700; }

.card {
  background: rgba(255,255,255,.42);
  border-radius: 16px;
  padding: 12px;
  margin: 10px 0;
}
.card b { display: block; margin-bottom: 4px; }
.pill {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #2a3322;
  color: var(--lime);
  margin-bottom: 6px;
}
.journal .pill { background: #3c341f; color: #efe6d2; }

textarea.note, input.field {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: #1c2218;
  color: var(--paper);
}
.journal textarea.note, .journal input.field {
  background: rgba(255,255,255,.55);
  color: #241e14;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ghost, .solid {
  border: 0;
  border-radius: 12px;
  padding: 9px 12px;
  font-weight: 650;
}
.ghost { background: #232a1c; color: var(--paper); }
.solid { background: var(--lime); color: var(--mine-ink); }
.journal .ghost { background: #3c341f; color: #efe6d2; }
.warn { color: var(--danger); font-size: 13px; }
.login {
  position: fixed;
  inset: 0;
  max-width: none;
  margin: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(12, 16, 10, 0.92);
}
.login h1, .login p, .login form { width: min(360px, 92vw); }
.login form { background: var(--ink-2); padding: 24px; border-radius: 22px; box-shadow: var(--shadow); }
.login h1 { font-family: "Fraunces", Georgia, serif; margin-top: 0; }
.login .muted { color: var(--mute); margin-top: 0; }
.fact.off { opacity: 0.45; text-decoration: line-through; }
.linkbox {
  font-size: 12px;
  word-break: break-all;
  background: #1c2218;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--lime);
}
