* {
  box-sizing: border-box;
}

:root {
  --blue: #1769ff;
  --purple: #7c4dff;
  --text: #182033;
  --sub: #6f788b;
  --line: rgba(65, 84, 130, .12);
  --bg: #f7f9fe;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Hiragino Sans",
    "Noto Sans JP",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 0%, rgba(44, 125, 255, .10), transparent 28%),
    radial-gradient(circle at 85% 8%, rgba(123, 77, 255, .10), transparent 30%),
    var(--bg);
}


/* ==============================
   HEADER
============================== */

header {
  height: 68px;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255,255,255,.84);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  background: linear-gradient(135deg, #0877ff, #515be9, #8847e9);
  box-shadow: 0 5px 16px rgba(65,75,220,.22);
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
}

.council-name {
  margin-top: 2px;
  font-size: 11px;
  color: #788194;
}

.header-right {
  font-size: 12px;
  color: #788194;
}


/* ==============================
   START SCREEN
============================== */

.start-screen {
  width: min(900px, calc(100% - 34px));
  margin: 0 auto;
  padding: 76px 0 70px;
}

.hero {
  text-align: center;
  margin-bottom: 36px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 50px);
  letter-spacing: -.045em;
  line-height: 1.2;
  background: linear-gradient(90deg, #1769ff, #515ae9, #8750e8);
  -webkit-background-clip: text;
  color: transparent;
}

.hero p {
  margin: 15px 0 0;
  color: var(--sub);
  font-size: 15px;
  line-height: 1.8;
}


/* ==============================
   INPUT
============================== */

.question-box {
  padding: 20px;
  border-radius: 23px;
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  box-shadow:
    0 18px 55px rgba(48,65,120,.09),
    0 2px 6px rgba(48,65,120,.04);
}

.question-box textarea {
  width: 100%;
  height: 100px;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.7;
}

.question-box textarea::placeholder {
  color: #a0a8b6;
}

.question-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.source-label {
  color: #818a9c;
  font-size: 11px;
}

.primary-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  color: white;
  font-weight: 650;
  background: linear-gradient(100deg, #1769ff, #5858e8, #824be8);
  box-shadow: 0 8px 20px rgba(65,74,220,.22);
}


/* ==============================
   ACTION CARDS
============================== */

.section-label {
  margin: 30px 0 12px 4px;
  font-size: 12px;
  color: #7b8495;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
}

.action-card {
  padding: 17px;
  min-height: 94px;
  text-align: left;
  cursor: pointer;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.78);
  transition: .18s ease;
}

.action-card:hover {
  transform: translateY(-2px);
  background: white;
  box-shadow: 0 10px 26px rgba(45,65,115,.08);
}

.action-icon {
  margin-bottom: 9px;
  font-size: 18px;
}

.action-name {
  font-size: 13px;
  font-weight: 650;
}

.action-description {
  margin-top: 4px;
  color: #818a9b;
  font-size: 11px;
  line-height: 1.5;
}


/* ==============================
   CHAT SCREEN
============================== */

.chat-screen {
  display: none;
}

.chat-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 68px);
}


/* SIDEBAR */

.sidebar {
  padding: 20px 14px;
  border-right: 1px solid var(--line);
  background: rgba(250,251,255,.78);
}

.new-chat {
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  border: 1px solid var(--line);
  background: white;
}

.sidebar-title {
  margin: 25px 8px 10px;
  color: #949cac;
  font-size: 10px;
}

.history-item {
  padding: 10px 9px;
  margin-bottom: 3px;
  border-radius: 9px;
  color: #596275;
  font-size: 12px;
  cursor: pointer;
}

.history-item:hover {
  background: rgba(55,88,180,.06);
}


/* CHAT MAIN */

.chat-main {
  position: relative;
  min-width: 0;
}

.conversation {
  width: min(820px, calc(100% - 40px));
  margin: 0 auto;
  padding: 42px 0 170px;
}

.user-message {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 32px;
}

.user-bubble {
  max-width: 70%;
  padding: 13px 17px;
  border-radius: 18px 18px 5px 18px;
  background: #edf2ff;
  font-size: 14px;
  line-height: 1.7;
}


/* AI ANSWER */

.ai-message {
  margin-bottom: 32px;
}

.ai-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}

.ai-icon {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: white;
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(135deg, #1769ff, #7b4ee8);
}

.ai-name {
  font-size: 13px;
  font-weight: 650;
}

.answer {
  font-size: 14px;
  line-height: 1.9;
}

.answer h2 {
  margin: 27px 0 10px;
  font-size: 18px;
}

.answer h3 {
  margin: 22px 0 8px;
  font-size: 15px;
}

.answer strong {
  font-weight: 700;
}


/* ==============================
   SOURCES
============================== */

.sources {
  margin-top: 26px;
  padding: 18px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.72);
}

.sources-title {
  margin-bottom: 11px;
  font-size: 12px;
  font-weight: 650;
}

.source-item {
  padding: 9px 0;
  border-top: 1px solid rgba(60,80,120,.08);
  font-size: 12px;
}

.source-item:first-of-type {
  border-top: 0;
}

.source-type {
  display: inline-block;
  margin-right: 7px;
  padding: 3px 7px;
  border-radius: 6px;
  color: #4f5d77;
  background: #eef2fb;
  font-size: 9px;
}


/* ==============================
   DEEPER ACTIONS
============================== */

.deep-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 22px;
}

.deep-button {
  padding: 9px 13px;
  border-radius: 999px;
  cursor: pointer;
  color: #536079;
  font-size: 11px;
  border: 1px solid var(--line);
  background: white;
}

.deep-button:hover {
  border-color: rgba(60,80,220,.28);
  color: #4354c5;
}


/* ==============================
   MERMAID / VISUAL AREA
============================== */

.visual-panel {
  display: none;
  margin-top: 24px;
  padding: 20px;
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: white;
}

.visual-title {
  margin-bottom: 15px;
  font-size: 13px;
  font-weight: 650;
}


/* ==============================
   CHAT INPUT BOTTOM
============================== */

.chat-input-area {
  position: fixed;
  left: 240px;
  right: 0;
  bottom: 0;
  padding: 18px 25px 22px;
  background:
    linear-gradient(
      to top,
      rgba(247,249,254,1) 55%,
      rgba(247,249,254,0)
    );
}

.chat-input {
  width: min(820px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 12px 12px 17px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: white;
  box-shadow: 0 10px 35px rgba(45,65,110,.10);
}

.chat-input textarea {
  flex: 1;
  min-height: 42px;
  max-height: 130px;
  resize: none;
  outline: none;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 14px;
  line-height: 1.6;
}

.send-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 0;
  border-radius: 50%;
  color: white;
  font-size: 17px;
  background: linear-gradient(135deg, #1769ff, #7b4ee8);
}


/* ==============================
   NOTICE
============================== */

.notice {
  margin-top: 34px;
  text-align: center;
  color: #9ba3b1;
  font-size: 10px;
}


/* ==============================
   RESPONSIVE
============================== */

@media (max-width: 760px) {

  header {
    padding: 0 16px;
  }

  .header-right {
    display: none;
  }

  .start-screen {
    padding-top: 48px;
  }

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

  .chat-layout {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .conversation {
    width: calc(100% - 28px);
    padding-top: 28px;
  }

  .chat-input-area {
    left: 0;
    padding: 14px;
  }

  .user-bubble {
    max-width: 88%;
  }
}
