:root {
  --ink: #2b2a26;
  --paper: #f7f1e3;
  --paper-2: #efe5cc;
  --jade: #2f6b5a;
  --jade-2: #3f8a74;
  --cinnabar: #a8452f;
  --bubble-bot: #ffffff;
  --bubble-user: #2f6b5a;
  --radius: 18px;
  font-size: 18px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "PingFang HK", "Noto Sans HK", "Microsoft JhengHei", sans-serif;
  color: var(--ink);
  background: var(--paper) radial-gradient(circle at 20% 10%, #fffaf0 0, transparent 60%);
  display: flex; flex-direction: column; height: 100dvh;
}
/* 蓮花輕水印（約 10% 透明度，唔阻文字） */
body::before {
  content: ""; position: fixed; right: -40px; bottom: 30px; width: 520px; height: 210px;
  background: url("assets/brand/lotus-sprig.svg") no-repeat center / contain;
  opacity: .12; pointer-events: none; z-index: 0;
}
body > * { position: relative; z-index: 1; }
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 20px; background: #fffdf6; border-bottom: 2px solid var(--paper-2);
}
.school-logo { height: 44px; width: auto; }
.course-tag {
  font-size: .85rem; color: var(--jade); font-weight: 600;
  border: 1.5px solid var(--jade-2); border-radius: 999px; padding: 4px 12px; background: #fff;
}
.site-footer { text-align: center; font-size: .7rem; color: #8a806e; padding: 4px 0 8px; }
.buddies { display: flex; justify-content: center; align-items: flex-end; gap: 8px; margin-top: 14px; opacity: .9; }
.buddies img { height: 110px; width: auto; }
.fixed-tag { display: block; margin-top: 6px; font-size: .7rem; color: #9a8f7a; }
.layout {
  display: grid;
  grid-template-columns: minmax(260px, 38%) 1fr;
  flex: 1; min-height: 0; width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}
.hero {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
  border-right: 2px solid var(--paper-2);
}
.hero-img { width: 100%; max-width: 380px; height: auto; filter: drop-shadow(0 8px 16px rgba(0,0,0,.12)); }
.hero h1 { margin: 12px 0 4px; font-size: 1.6rem; color: var(--jade); letter-spacing: .05em; }
.hero-sub { margin: 0 0 12px; color: #6b6253; font-size: .9rem; }
.privacy {
  font-size: .8rem; line-height: 1.5; background: #fff8e6; border: 1px solid #e8d9ad;
  border-radius: 12px; padding: 8px 12px; max-width: 380px;
}
.chat { display: flex; flex-direction: column; min-height: 0; padding: 16px; }
.messages { flex: 1; overflow-y: auto; padding: 8px 4px 16px; scroll-behavior: smooth; }
.msg { display: flex; gap: 10px; margin: 12px 0; align-items: flex-end; }
.msg.user { justify-content: flex-end; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: var(--paper-2); border: 2px solid var(--jade-2); object-fit: cover;
}
.bubble {
  max-width: 78%; padding: 12px 16px; border-radius: var(--radius);
  line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}
.bot .bubble { background: var(--bubble-bot); border-bottom-left-radius: 4px; box-shadow: 0 2px 6px rgba(0,0,0,.06); }
.user .bubble { background: var(--bubble-user); color: #fff; border-bottom-right-radius: 4px; }
.bubble.typing::after { content: "……"; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.suggestions button {
  font: inherit; font-size: .85rem; padding: 8px 12px; border-radius: 999px;
  border: 1.5px solid var(--jade-2); background: #fff; color: var(--jade); cursor: pointer;
}
.suggestions button:hover { background: var(--jade); color: #fff; }
.composer { display: flex; gap: 8px; padding-top: 8px; }
.composer textarea {
  flex: 1; font: inherit; resize: none; padding: 12px 14px; border-radius: 14px;
  border: 2px solid var(--paper-2); background: #fff; max-height: 140px;
}
.composer textarea:focus { outline: none; border-color: var(--jade-2); }
.composer button {
  font: inherit; padding: 0 22px; border: 0; border-radius: 14px;
  background: var(--cinnabar); color: #fff; cursor: pointer;
}
.composer button:disabled { opacity: .5; cursor: wait; }
.disclaimer { margin: 6px 0 0; font-size: .72rem; color: #8a806e; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* iPad 直向 / 手機 */
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .hero { flex-direction: row; gap: 12px; padding: 10px 14px; border-right: 0; border-bottom: 2px solid var(--paper-2); text-align: left; }
  .hero-img { width: 96px; }
  .hero h1 { font-size: 1.2rem; margin: 0; }
  .hero-sub { font-size: .75rem; margin: 2px 0 6px; }
  .privacy { font-size: .7rem; padding: 6px 8px; }
  .buddies { display: none; }
  .site-header { padding: 6px 12px; }
  .school-logo { height: 32px; }
  .course-tag { font-size: .72rem; padding: 3px 10px; }
  body::before { width: 300px; height: 120px; }
}
