:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #66736c;
  --line: rgba(31, 45, 38, .12);
  --card: rgba(255, 255, 255, .94);
  --brand: #b9853c;
  --brand-dark: #2e2418;
  --soft: #f7efe4;
  --ok: #1c7c54;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(140deg, rgba(23, 33, 29, .92), rgba(23, 33, 29, .42)),
    url("../../assets/event-qr-scan-real.jpg") center/cover no-repeat,
    #1f2d26;
}

button, textarea, input {
  font: inherit;
}

.service-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px max(18px, calc((100vw - 1120px) / 2));
  color: #fff8eb;
  background: rgba(18, 25, 22, .88);
  border-bottom: 1px solid rgba(255, 255, 255, .14);
  backdrop-filter: blur(14px);
}

.service-brand,
.service-actions a {
  color: inherit;
  text-decoration: none;
}

.service-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.service-brand span {
  font-size: 18px;
  font-weight: 900;
}

.service-brand small {
  color: rgba(255, 248, 235, .72);
  font-size: 13px;
  font-weight: 800;
}

.service-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.service-actions a,
.service-actions button,
.chat-card-bar button,
.closed-card button,
.closed-card a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  color: inherit;
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.service-actions button,
.chat-card-bar button {
  color: #fff8eb;
}

.chat-shell {
  min-height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(320px, 390px);
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 28px;
}

.service-intro {
  max-width: 420px;
  color: #fff8eb;
}

.service-intro h1 {
  max-width: 8em;
  margin: 0 0 14px;
  font-size: clamp(31px, 4vw, 46px);
  line-height: 1.1;
  letter-spacing: 0;
}

.service-intro p {
  max-width: 25em;
  margin: 0;
  color: rgba(255, 248, 235, .82);
  font-size: 17px;
  line-height: 1.65;
}

.intro-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.intro-tags span {
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: rgba(255,248,235,.88);
  font-size: 13px;
  font-weight: 900;
}

.chat-card {
  width: min(100%, 390px);
  max-height: min(660px, calc(100vh - 104px));
  display: grid;
  grid-template-rows: auto auto auto minmax(150px, 1fr) auto auto;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .24);
  overflow: hidden;
}

.chat-card.is-hidden,
.service-intro.is-hidden {
  display: none;
}

.chat-card-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-card-bar strong {
  font-size: 14px;
  font-weight: 900;
}

.chat-card-bar button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--brand-dark);
  background: var(--soft);
  border-color: var(--line);
}

.chat-hero {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 27px);
  line-height: 1.18;
  letter-spacing: 0;
}

.chat-hero p,
.safe-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.58;
}

.quick-questions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.quick-questions button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
  color: var(--brand-dark);
  font-size: 13px;
  font-weight: 800;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 4px;
  overflow: auto;
}

.message {
  width: fit-content;
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: #fff;
}

.message.user {
  align-self: flex-end;
  color: #fff;
  border-color: transparent;
  background: var(--brand-dark);
}

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

.message strong {
  display: block;
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 13px;
}

.message p {
  margin: 0;
  font-size: 14px;
  line-height: 1.58;
}

.message .sources {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.chat-form {
  display: grid;
  gap: 10px;
}

.chat-form label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea:focus {
  border-color: rgba(185, 133, 60, .72);
  box-shadow: 0 0 0 4px rgba(185, 133, 60, .14);
}

.chat-form button {
  min-height: 46px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #d7a65c, #9d6b2f);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}

.safe-note {
  margin: 0;
  font-size: 12.5px;
}

.closed-card {
  width: min(100%, 360px);
  padding: 22px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 22px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 28px 80px rgba(0,0,0,.24);
}

.closed-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 22px;
}

.closed-card p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.closed-card div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.closed-card button,
.closed-card a {
  color: #fff;
  background: var(--brand-dark);
}

@media (max-width: 780px) {
  .service-topbar {
    position: relative;
    flex-wrap: wrap;
  }

  .chat-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }

  .service-intro {
    max-width: 100%;
  }

  .service-intro h1 {
    max-width: none;
    font-size: 30px;
  }

  .service-intro p {
    max-width: none;
    font-size: 15px;
  }

  .chat-card {
    max-height: none;
    width: 100%;
    border-radius: 20px;
  }

  .quick-questions { grid-template-columns: 1fr; }
}
