:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #666b73;
  --paper: #f7f3ef;
  --panel: #fffdf9;
  --line: #ddd5cc;
  --rose: #b34f61;
  --teal: #31776b;
  --gold: #b8842f;
  --blue: #345f8f;
  --shadow: 0 18px 45px rgba(47, 36, 25, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  background:
    linear-gradient(125deg, rgba(179, 79, 97, 0.16), transparent 34%),
    linear-gradient(230deg, rgba(49, 119, 107, 0.16), transparent 40%),
    radial-gradient(circle at 18% 20%, rgba(184, 132, 47, 0.15), transparent 26%),
    repeating-linear-gradient(90deg, rgba(32, 33, 36, 0.025) 0, rgba(32, 33, 36, 0.025) 1px, transparent 1px, transparent 18px),
    var(--paper);
}

button,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 28px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  max-width: 1240px;
  min-height: calc(100vh - 56px);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(76, 63, 50, 0.18);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.9);
}

.brand-block {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: white;
  font-size: 24px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--rose), var(--teal));
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.15;
}

.brand-block p,
.support-box p,
.message-meta,
.eyebrow {
  color: var(--muted);
}

.context-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #3b3d42;
  font-size: 14px;
  font-weight: 700;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

select {
  min-height: 42px;
  padding: 0 12px;
}

.support-box {
  margin-top: auto;
  padding: 16px;
  border-left: 4px solid var(--gold);
  background: #fff8e8;
}

.support-box h2 {
  margin-bottom: 8px;
  font-size: 16px;
}

.support-box p {
  font-size: 13px;
  line-height: 1.7;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 620px;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 24px 26px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.chat-header h2 {
  font-size: 26px;
}

.voice-status {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--teal);
  background: white;
  font-size: 13px;
  font-weight: 800;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.install-button {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  color: white;
  background: var(--blue);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.install-button[hidden] {
  display: none;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 26px;
  overflow: auto;
}

.message {
  max-width: 820px;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: white;
}

.message.user {
  align-self: flex-end;
  border-color: rgba(49, 119, 107, 0.38);
  background: #effaf6;
}

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

.message-meta {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 800;
}

.message-body {
  white-space: pre-wrap;
  line-height: 1.75;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.pill-card {
  padding: 12px;
  border-radius: 8px;
  color: #283033;
  background: #f7f5f0;
  font-size: 14px;
  line-height: 1.55;
}

.pill-card strong {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
}

.composer {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 96px;
  gap: 12px;
  align-items: end;
  padding: 18px 26px 24px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 249, 0.94);
}

textarea {
  min-height: 78px;
  max-height: 180px;
  resize: vertical;
  padding: 12px;
  line-height: 1.55;
}

.icon-button,
.send-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.icon-button {
  background: #efe7dc;
}

.icon-button.listening {
  color: white;
  background: var(--rose);
}

.send-button {
  color: white;
  background: var(--teal);
}

@media (max-width: 860px) {
  .app-shell {
    padding: 0;
  }

  .workspace {
    min-height: 100vh;
    grid-template-columns: 1fr;
    border: 0;
    border-radius: 0;
  }

  .settings-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .chat-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .composer {
    grid-template-columns: 46px 1fr;
  }

  .send-button {
    grid-column: 1 / -1;
  }
}
