:root {
  --bg: #f4f1e8;
  --panel: rgba(255, 255, 255, 0.82);
  --line: rgba(25, 35, 55, 0.1);
  --text: #172033;
  --muted: #647086;
  --accent: #2563eb;
  --accent-2: #d97706;
  --shell: min(1180px, calc(100vw - 32px));
  --radius-xl: 32px;
  --radius-lg: 20px;
  --shadow: 0 28px 70px rgba(41, 47, 65, 0.14);
  --font: "SF Pro Text", "SF Pro Display", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  padding-top: env(safe-area-inset-top, 0);
  color: var(--text);
  background:
    radial-gradient(circle at 12% 4%, rgba(255, 255, 255, 0.96), transparent 34%),
    radial-gradient(circle at 86% 12%, rgba(207, 226, 255, 0.85), transparent 32%),
    linear-gradient(180deg, #fbf8ef 0%, var(--bg) 58%, #eee7d8 100%);
  font-family: var(--font);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Particle Canvas */
#particle-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;
  z-index: -10;
}

a, button, input, textarea, select { font: inherit; }
.shell { width: var(--shell); margin: 0 auto; }

.bg-orb { position: fixed; z-index: -2; filter: blur(110px); opacity: 0.34; pointer-events: none; mix-blend-mode: multiply; }
.orb-a { width: 450px; height: 450px; top: -10%; right: -5%; background: rgba(96, 165, 250, 0.35); }
.orb-b { width: 500px; height: 500px; left: -10%; bottom: 0%; background: rgba(217, 119, 6, 0.18); }
.grid-mask {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(rgba(25,35,55,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(25,35,55,.035) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 100%);
}

.site-header {
  display: flex; align-items: center; justify-content: flex-start; gap: 20px;
  padding: 30px 0 20px; position: sticky; top: 0; backdrop-filter: blur(20px); z-index: 30;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 248, 239, 0.76);
}
.brand-wrap { display: flex; align-items: center; gap: 14px; }
.brand-subtitle {
  margin: 0 0 4px;
  font-size: 13px;
  letter-spacing: .06em;
  color: #2563eb;
  font-weight: 600;
  text-transform: uppercase;
}
.micro-label { margin: 0 0 8px; font-size: 11px; letter-spacing: .15em; color: var(--muted); }
.site-header h1, .hero-panel h2, .section-head h3, .modal-card h3 { margin: 0; }
.site-header h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: #172033;
}

.page-stack { display: grid; gap: 24px; padding: 20px 0 40px; }
.home-stack { display: flex; flex-direction: column; gap: 40px; padding: 40px 0 60px; }
.glass {
  background: var(--panel);
  border: 1px solid rgba(25, 35, 55, 0.1);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(150%);
  border-radius: var(--radius-xl);
}
.glass-subtle {
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(25, 35, 55, 0.09);
  backdrop-filter: blur(24px);
  border-radius: var(--radius-lg);
}

.chat-card, .help-card, .notice-strip { padding: 30px; }
.section-head { margin-bottom: 20px; }

/* Hero Home Section */
.hero-home {
  padding: 68px 40px;
  text-align: left;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(248, 242, 230, 0.88)),
    radial-gradient(circle at 92% 12%, rgba(37, 99, 235, 0.12), transparent 34%);
}
.hero-home::before {
  content: "";
  position: absolute;
  top: 0; left: 20%; width: 60%; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.46), transparent);
}
.hero-home-copy {
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 26px;
}
.hero-home-text--tribute {
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: #172033;
  font-weight: 750;
  margin: 0;
  min-height: 114px;
  text-shadow: none;
}

/* Button Marquee (Google Style) */
@property --angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes marquee {
  0% { --angle: 0deg; }
  100% { --angle: 360deg; }
}

.hero-home-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  margin-top: 10px;
}
.enter-chat-btn {
  position: relative;
  text-decoration: none;
  min-height: 64px;
  padding: 0 44px;
  border-radius: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: #ffffff !important;
  background: #172033;
  background-clip: padding-box;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: 0 14px 36px rgba(23, 32, 51, 0.2);
}
.enter-chat-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 3px;
  margin: -3px;
  background: conic-gradient(from var(--angle), #2563eb, #d97706, #f6d365, #38bdf8, #2563eb);
  animation: marquee 3s linear infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.enter-chat-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 42px rgba(37, 99, 235, 0.24);
  background: #0f172a;
}
.hero-home-note { color: var(--muted); font-size: 14px; line-height: 1.7; margin-top: 8px;}

/* Graph Section */
.graph-board { padding: 40px; }
.graph-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.8fr);
  gap: 30px;
  align-items: stretch;
}
.graph-stage {
  position: relative;
  min-height: 600px;
  border-radius: var(--radius-xl);
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: inset 0 2px 20px rgba(255,255,255,0.02);
  overflow: hidden;
}
.graph-lines {
  position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none;
}
.graph-lines path {
  fill: none;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 2;
  stroke-linecap: round;
  transition: all 0.4s ease;
}
.graph-stage.is-hovered path,
.graph-stage[data-active] path {
  opacity: 0.15;
}

@keyframes flowLine {
  0% { stroke-dashoffset: 40; }
  100% { stroke-dashoffset: 0; }
}

.graph-stage[data-active="policy"] .line-policy,
.graph-stage[data-active="province"] .line-province,
.graph-stage[data-active="score"] .line-score,
.graph-stage[data-active="school"] .line-school,
.graph-stage[data-active="major"] .line-major,
.graph-stage[data-active="style"] .line-style,
.graph-stage[data-active="explain"] .line-core-bottom,
.graph-stage[data-active="route"] path {
  stroke-width: 3.5;
  stroke-dasharray: 6 6;
  animation: flowLine 1.5s linear infinite;
  opacity: 1;
}

.graph-stage[data-active="policy"] .line-policy { stroke: url(#grad-1); filter: drop-shadow(0 0 6px rgba(234,67,53,0.6)); }
.graph-stage[data-active="province"] .line-province { stroke: url(#grad-2); filter: drop-shadow(0 0 6px rgba(52,168,83,0.6)); }
.graph-stage[data-active="score"] .line-score { stroke: url(#grad-3); filter: drop-shadow(0 0 6px rgba(251,188,5,0.6)); }
.graph-stage[data-active="school"] .line-school { stroke: url(#grad-4); filter: drop-shadow(0 0 6px rgba(66,133,244,0.6)); }
.graph-stage[data-active="major"] .line-major { stroke: url(#grad-5); filter: drop-shadow(0 0 6px rgba(66,133,244,0.6)); }
.graph-stage[data-active="style"] .line-style { stroke: url(#grad-6); filter: drop-shadow(0 0 6px rgba(156,39,176,0.6)); }
.graph-stage[data-active="explain"] .line-core-bottom { stroke: url(#grad-7); filter: drop-shadow(0 0 6px rgba(233,30,99,0.6)); }
.graph-stage[data-active="route"] path { stroke: #4285f4; filter: drop-shadow(0 0 6px rgba(66,133,244,0.6)); }

.graph-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
  padding: 16px 20px;
  text-align: left;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.02) 100%);
  box-shadow: 
    0 10px 40px 0 rgba(0, 0, 0, 0.4),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.15),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  color: #eeeeee;
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  animation: nodeFloat 6s ease-in-out infinite;
  overflow: hidden;
}
.graph-node::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  transform: translateX(-100%);
  transition: 0.6s;
  pointer-events: none;
}
.graph-node:hover::before,
.graph-node.is-active::before {
  transform: translateX(100%);
}
.graph-node:nth-child(odd) { animation-duration: 7s; }
.graph-node:hover,
.graph-node.is-active {
  transform: translateY(-8px) scale(1.05);
  border: 1px solid rgba(66, 133, 244, 0.6);
  background: linear-gradient(135deg, rgba(66, 133, 244, 0.15) 0%, rgba(66, 133, 244, 0.03) 100%);
  box-shadow: 
    0 20px 40px -10px rgba(66,133,244,0.4), 
    0 0 30px rgba(66,133,244,0.2),
    inset 0 1px 0 0 rgba(255, 255, 255, 0.3),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
.graph-node-title { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; }
.graph-node-meta { font-size: 12px; color: var(--muted); }
.graph-detail {
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.graph-detail-label { margin: 0 0 16px; font-size: 12px; letter-spacing: .2em; color: var(--muted); text-transform: uppercase; }
.graph-detail h4 { margin: 0 0 16px; font-size: 28px; font-weight: 600; letter-spacing: -0.03em; color: #ffffff; text-shadow: 0 2px 10px rgba(0,0,0,0.5);}
.graph-detail p { margin: 0; color: #d4d4d8; line-height: 1.7; font-size: 16px; }
.graph-detail-list { margin: 24px 0 0; padding-left: 20px; color: #d4d4d8; line-height: 1.8; font-size: 15px; }
.graph-detail-list li::marker { color: #4285f4; }

/* Chat Workspace */
.notice-strip { padding: 18px 24px; color: var(--muted); font-size: 14px; text-align: center; background: rgba(0,0,0,0.2); }
.workspace-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.8fr);
  gap: 24px;
}
.chat-main { display: flex; flex-direction: column; min-height: 680px; }
.chat-main .section-head h3, .help-card h3 { font-size: 20px; font-weight: 600; color: #ffffff; }

.chat-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}
.message-stream {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  border-radius: var(--radius-lg);
  overflow-y: auto;
  max-height: 60vh;
}
.message-stream:empty::before {
  content: "剑桥爸爸志愿咨询器已就绪。在此输入您的问题进行咨询。";
  display: block;
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 15px;
}
.message {
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  max-width: 90%;
}
.message.user {
  align-self: flex-end;
  background: rgba(66, 133, 244, 0.15);
  border-color: rgba(66, 133, 244, 0.3);
  border-bottom-right-radius: 4px;
}
.message.assistant {
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.message.progress-message {
  min-width: min(520px, 100%);
}
.message-role { font-size: 12px; font-weight: 500; color: #60a5fa; margin-bottom: 6px; display: block; }
.message-body p { margin: 0; line-height: 1.7; font-size: 16px; color: #eeeeee; }
.message-body p + p { margin-top: 12px; }
.message-body h1,
.message-body h2,
.message-body h3,
.message-body h4 {
  margin: 0 0 14px;
  line-height: 1.35;
  color: #ffffff;
}
.message-body h1 { font-size: 28px; }
.message-body h2 { font-size: 24px; }
.message-body h3 { font-size: 20px; }
.message-body h4 { font-size: 18px; }
.message-body strong { color: #ffffff; font-weight: 700; }
.message-body em { color: #f6d59b; }
.message-body code {
  display: inline;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffe0a8;
  font-size: 0.92em;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.message-body hr {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.12);
}
.message-body ul {
  margin: 0;
  padding-left: 20px;
}
.message-body ul li {
  margin: 8px 0;
  line-height: 1.7;
  color: #eeeeee;
}
.message-body blockquote {
  margin: 0;
  padding: 14px 16px;
  border-left: 3px solid rgba(245, 166, 35, 0.9);
  background: rgba(245, 166, 35, 0.10);
  border-radius: 10px;
}
.message-body blockquote p {
  color: #fff4df;
}
.message-body .md-table-wrap {
  overflow-x: auto;
  margin: 14px 0;
}
.message-body .md-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  overflow: hidden;
}
.message-body .md-table th,
.message-body .md-table td {
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.08);
  text-align: left;
  vertical-align: top;
  line-height: 1.6;
  color: #eeeeee;
}
.message-body .md-table th {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
  font-weight: 700;
}

.progress-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
  padding: 2px 0;
}
.progress-card::before {
  content: "";
  position: absolute;
  inset: -40% -10%;
  background: radial-gradient(circle at 20% 40%, rgba(255,255,255,0.12), transparent 36%),
              radial-gradient(circle at 80% 65%, rgba(96,165,250,0.12), transparent 32%);
  opacity: 0.9;
  pointer-events: none;
  filter: blur(18px);
}
.progress-card::after {
  content: "";
  position: absolute;
  inset: auto -30% -8px -30%;
  height: 26px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  transform: translateX(-40%);
  animation: progressSweep 2.6s ease-in-out infinite;
  pointer-events: none;
}
.progress-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #f5f5f5;
  position: relative;
  z-index: 1;
}
.progress-card-text {
  font-size: 14px;
  color: #d4d4d8;
  position: relative;
  z-index: 1;
  transition: color 0.35s ease, transform 0.35s ease, opacity 0.35s ease;
}
.inline-progress {
  height: 8px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.inline-progress .progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(96,165,250,0.85), rgba(52,199,89,0.85));
  transition: width 0.45s ease;
  box-shadow: 0 0 18px rgba(96,165,250,0.35);
}

.chat-form { margin-top: auto; }
.composer-shell {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(20, 20, 22, 0.8);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 28px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
  padding: 8px 12px;
}
textarea {
  flex: 1;
  min-height: 24px;
  max-height: 120px;
  background: transparent;
  border: none;
  padding: 12px 14px;
  font-size: 16px;
  color: #eeeeee;
  resize: none;
  outline: none;
  font-family: var(--font);
}

.send-btn {
  position: relative;
  min-width: 44px; width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  background: #303035;
  background-clip: padding-box;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #fff;
  transition: transform 0.2s, background 0.2s;
}
.send-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 3px;
  margin: -3px;
  background: conic-gradient(from var(--angle), #4285f4, #ea4335, #fbbc05, #34a853, #4285f4);
  animation: marquee 3s linear infinite;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.send-btn:hover { transform: scale(1.05); background: #404045; }
.send-icon { font-size: 18px; font-weight: bold; transform: translateY(-1px); }

/* Help Panel Details */
.help-card {
  display: flex; flex-direction: column; gap: 20px;
}
.help-copy { display: flex; flex-direction: column; gap: 14px; }
.help-copy p {
  margin: 0; padding: 18px; border-radius: 16px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
  color: #a1a1aa; font-size: 15px; line-height: 1.7;
}
.help-copy strong {
  color: #f5f5f5;
  font-weight: 600;
}

.queue-panel { padding: 16px; border-radius: 18px; background: rgba(255,255,255,.05); border: 1px solid rgba(66,133,244,.3); margin-bottom: 14px; }
.hidden { display: none !important; }

@keyframes progressSweep {
  0% { transform: translateX(-45%); opacity: 0; }
  20% { opacity: 1; }
  100% { transform: translateX(45%); opacity: 0; }
}
.queue-top { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 14px; font-weight: 500; color: #fff; }
.progress-track { width: 100%; height: 8px; border-radius: 999px; background: rgba(255,255,255,.1); overflow: hidden; }
.progress-fill { width: 0%; height: 100%; background: linear-gradient(90deg, #4285f4, #34a853); transition: width .3s ease; }

.modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 90; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(14px); }
.modal-card { position: relative; background: var(--panel); border: 1px solid rgba(255,255,255,0.1); width: min(400px, calc(100vw - 32px)); padding: 32px; text-align: center; border-radius: calc(var(--radius-xl) - 4px); }

/* Animations */
.reveal, .reveal-delay-1 { opacity: 0; transform: translateY(16px); animation: fadeUp .6s cubic-bezier(0.2,0.8,0.2,1) forwards; }
.reveal-delay-1 { animation-delay: 0.1s; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }
@keyframes nodeFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* Mobile Adaptations */
@media (max-width: 900px) {
  .workspace-shell, .graph-layout { grid-template-columns: 1fr; }
  .chat-main, .help-card, .graph-stage { min-height: auto; }
  .graph-stage { height: 600px; }
  .message-stream { max-height: 50vh; }
}
@media (max-width: 640px) {
  .shell { width: 100%; padding: 0 10px; }
  .hero-home { padding: 40px 20px; }
  .hero-home-text--tribute { font-size: 26px; min-height: 72px; }
  .enter-chat-btn { font-size: 18px; padding: 0 32px; min-height: 54px; }
  .chat-card, .help-card { padding: 20px; }
  .message { max-width: 100%; }
}

@media (max-width: 768px) {
  :root {
    --shell: 100%;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --shadow: 0 18px 46px rgba(0,0,0,0.45);
  }

  html,
  body {
    min-height: 100dvh;
    overscroll-behavior-y: none;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .bg-orb {
    filter: blur(90px);
    opacity: 0.26;
  }

  .orb-a {
    width: 260px;
    height: 260px;
    top: -80px;
    right: -120px;
  }

  .orb-b {
    width: 300px;
    height: 300px;
    left: -160px;
    bottom: 15%;
  }

  .grid-mask {
    background-size: 24px 24px;
    opacity: 0.8;
  }

  .shell {
    width: 100%;
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .site-header {
    padding: calc(12px + env(safe-area-inset-top, 0px)) 14px 12px;
    margin: 0;
    width: 100%;
    border-bottom-color: rgba(25,35,55,0.08);
    background: rgba(251, 248, 239, 0.86);
  }

  .brand-subtitle {
    font-size: 11px;
    letter-spacing: .08em;
  }

  .site-header h1 {
    font-size: 20px;
    letter-spacing: -0.03em;
  }

  .home-stack,
  .page-stack {
    gap: 16px;
    padding-top: 14px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }

  .glass {
    border-color: rgba(255,255,255,0.09);
    backdrop-filter: blur(28px) saturate(160%);
  }

  .hero-home {
    min-height: calc(100dvh - 132px);
    padding: 34px 20px 28px;
    justify-content: flex-start;
    border-radius: 28px;
  }

  .hero-home-copy {
    width: 100%;
    gap: 22px;
  }

  .hero-home-text--tribute {
    font-size: clamp(28px, 8vw, 36px);
    line-height: 1.24;
    min-height: 92px;
    text-wrap: balance;
  }

  .hero-home-actions {
    width: 100%;
    gap: 12px;
  }

  .enter-chat-btn {
    width: min(100%, 280px);
    min-height: 54px;
    padding: 0 24px;
    font-size: 17px;
    border-radius: 999px;
    touch-action: manipulation;
  }

  .hero-home-note {
    max-width: 310px;
    font-size: 13px;
    line-height: 1.6;
  }

  .graph-board {
    padding: 18px;
  }

  .graph-head {
    margin-bottom: 14px;
  }

  .graph-layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .graph-stage {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    height: auto;
    min-height: 0;
    padding: 12px;
    overflow: visible;
    background: #f8fafc;
    border-color: rgba(37, 99, 235, 0.14);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
  }

  .graph-lines {
    display: none;
  }

  .graph-node {
    position: relative !important;
    inset: auto !important;
    left: auto !important;
    top: auto !important;
    min-width: 0;
    width: 100%;
    min-height: 64px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.42);
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    color: #0f172a;
    animation: none;
    touch-action: manipulation;
  }

  .graph-node:hover,
  .graph-node.is-active {
    transform: none;
    border-color: rgba(37, 99, 235, 0.82);
    background: #eff6ff;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.14);
    color: #0f172a;
  }

  .graph-node-title {
    font-size: 15px;
    color: #0f172a;
  }

  .graph-node-meta {
    font-size: 12px;
    line-height: 1.4;
    color: #475569;
  }

  .graph-detail {
    padding: 18px;
    background: #ffffff;
    border-color: rgba(148, 163, 184, 0.34);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  }

  .graph-detail-label {
    color: #64748b;
  }

  .graph-detail h4 {
    font-size: 22px;
    color: #0f172a;
    text-shadow: none;
  }

  .graph-detail p,
  .graph-detail-list {
    font-size: 14px;
    line-height: 1.7;
    color: #334155;
  }

  .graph-detail-list li::marker {
    color: #2563eb;
  }

  .notice-strip {
    padding: 12px 14px;
    font-size: 12px;
    line-height: 1.6;
    text-align: left;
    border-radius: 18px;
  }

  .workspace-shell {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .chat-card,
  .help-card {
    padding: 14px;
    border-radius: 22px;
  }

  .chat-main {
    min-height: calc(100dvh - 164px);
  }

  .chat-main .section-head {
    margin-bottom: 12px;
  }

  .chat-main .section-head h3,
  .help-card h3 {
    font-size: 17px;
  }

  .chat-stack {
    gap: 12px;
  }

  .message-stream {
    min-height: 360px;
    height: calc(100dvh - 324px);
    max-height: none;
    padding: 12px;
    gap: 12px;
    -webkit-overflow-scrolling: touch;
  }

  .message-stream:empty::before {
    padding: 42px 18px;
    font-size: 14px;
    line-height: 1.7;
  }

  .message {
    max-width: 96%;
    padding: 14px 16px;
    border-radius: 18px;
  }

  .message-body p {
    font-size: 15px;
    line-height: 1.75;
  }

  .message.assistant,
  .message.user {
    width: 100%;
    max-width: 100%;
  }

  .message-body h1 {
    font-size: 24px;
  }

  .message-body h2 {
    font-size: 20px;
  }

  .message-body h3 {
    font-size: 18px;
  }

  .message-body h4 {
    font-size: 16px;
  }

  .message-body blockquote {
    padding: 12px 14px;
  }

  .message-body .md-table {
    min-width: 420px;
    table-layout: auto;
  }

  .message-body .md-table th,
  .message-body .md-table td {
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.6;
  }

  .chat-form {
    position: sticky;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 20;
  }

  .composer-shell {
    align-items: flex-end;
    gap: 8px;
    padding: 8px;
    border-radius: 22px;
    background: rgba(20, 20, 22, 0.94);
  }

  textarea {
    min-height: 46px;
    max-height: 132px;
    padding: 12px 10px;
    font-size: 16px;
    line-height: 1.55;
  }

  .send-btn {
    min-width: 46px;
    width: 46px;
    height: 46px;
  }

  .help-card {
    order: 2;
  }

  .help-copy {
    gap: 10px;
  }

  .help-copy p {
    padding: 14px;
    font-size: 13px;
    line-height: 1.65;
  }

  .modal-card {
    width: calc(100vw - 28px);
    padding: 24px 18px;
  }
}

@media (max-width: 380px) {
  .shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .hero-home-text--tribute {
    font-size: 24px;
  }

  .message-stream {
    height: calc(100dvh - 338px);
    min-height: 320px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Safe Fallbacks for other generic buttons */
.primary-btn:not(.enter-chat-btn):not(.send-btn) { padding: 12px 24px; background: #4285f4; color: white; border-radius: 8px; border: none; cursor: pointer; text-decoration: none; font-weight: 500; }
.primary-btn:not(.enter-chat-btn):not(.send-btn):hover { background: #3367d6; }
.ghost-btn { padding: 12px 24px; background: rgba(255,255,255,0.1); color: #fafafa; border-radius: 8px; border: 1px solid rgba(255,255,255,0.2); cursor: pointer; text-decoration: none; font-weight: 500; }
.ghost-btn:hover { background: rgba(255,255,255,0.2); }

/* Cambridge orange theme: align web-view with the project logo background. */
:root {
  --bg: #f39a2e;
  --panel: rgba(255, 249, 237, 0.92);
  --line: rgba(112, 58, 10, 0.16);
  --text: #241305;
  --muted: #744b24;
  --accent: #ea922e;
  --accent-2: #7a3d09;
  --shadow: 0 26px 64px rgba(119, 58, 8, 0.2);
}

body {
  background:
    radial-gradient(circle at 20% 6%, rgba(255, 238, 188, 0.98), transparent 30%),
    radial-gradient(circle at 86% 10%, rgba(255, 204, 95, 0.78), transparent 28%),
    radial-gradient(circle at 50% 108%, rgba(255, 240, 196, 0.82), transparent 34%),
    linear-gradient(180deg, #ef8d23 0%, #f5a13a 48%, #ffc060 100%);
}

.orb-a {
  background: rgba(255, 219, 126, 0.58);
}

.orb-b {
  background: rgba(170, 78, 7, 0.2);
}

.grid-mask {
  background-image:
    linear-gradient(rgba(112, 58, 10, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(112, 58, 10, 0.055) 1px, transparent 1px);
}

.site-header {
  background: rgba(232, 125, 18, 0.78);
  border-bottom-color: rgba(255, 246, 221, 0.32);
}

.brand-subtitle {
  color: #fff0cf;
}

.site-header h1 {
  color: #ffffff;
  text-shadow: 0 2px 14px rgba(95, 43, 4, 0.2);
}

.p6-page-slogan {
  margin: 8px 0 0;
  color: #fff6e5;
  font-size: 15px;
  line-height: 1.6;
}

.glass {
  background: var(--panel);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
}

.glass-subtle {
  background: rgba(255, 250, 240, 0.76);
  border-color: rgba(126, 65, 8, 0.14);
}

.hero-home {
  background:
    radial-gradient(circle at 82% 15%, rgba(255, 205, 97, 0.58), transparent 34%),
    linear-gradient(145deg, rgba(255, 251, 241, 0.97), rgba(255, 232, 185, 0.91));
}

.hero-home::before {
  background: linear-gradient(90deg, transparent, rgba(234, 146, 46, 0.86), transparent);
}

.hero-home-text--tribute,
.graph-detail h4,
.chat-main .section-head h3,
.help-card h3,
.graph-node-title {
  color: #241305;
  text-shadow: none;
}

.enter-chat-btn {
  background: linear-gradient(135deg, #2f1908, #783907);
  box-shadow: 0 14px 36px rgba(104, 52, 8, 0.28);
}

.enter-chat-btn::before,
.send-btn::before {
  background: conic-gradient(from var(--angle), #fff0b8, #ea922e, #7a3d09, #ffd884, #fff0b8);
}

.enter-chat-btn:hover {
  background: linear-gradient(135deg, #1f1107, #7a3d09);
  box-shadow: 0 16px 42px rgba(122, 61, 9, 0.3);
}

.graph-stage {
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 220, 142, 0.5), transparent 30%),
    linear-gradient(160deg, rgba(255, 247, 229, 0.84), rgba(244, 146, 37, 0.3));
  border-color: rgba(255, 255, 255, 0.52);
  box-shadow: inset 0 2px 20px rgba(255, 255, 255, 0.18);
}

.graph-lines path {
  stroke: rgba(122, 61, 9, 0.16);
}

.graph-node {
  color: #241305;
  border-color: rgba(125, 64, 9, 0.18);
  background: linear-gradient(135deg, rgba(255, 255, 246, 0.84), rgba(255, 236, 199, 0.7));
  box-shadow:
    0 10px 34px rgba(124, 63, 10, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.graph-node:hover,
.graph-node.is-active {
  color: #241305;
  border-color: rgba(234, 146, 46, 0.82);
  background: linear-gradient(135deg, rgba(255, 248, 232, 0.98), rgba(255, 218, 146, 0.78));
  box-shadow:
    0 20px 40px -10px rgba(154, 77, 8, 0.32),
    0 0 30px rgba(255, 202, 98, 0.28);
}

.graph-node-meta,
.graph-detail-label,
.hero-home-note {
  color: #744b24;
}

.graph-detail p,
.graph-detail-list,
.help-copy p,
.notice-strip {
  color: #4d2a0a;
}

.graph-detail-list li::marker {
  color: #ea922e;
}

.notice-strip {
  background: rgba(255, 248, 232, 0.86);
}

.message-stream {
  background: rgba(255, 250, 240, 0.64);
}

.message {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(124, 63, 10, 0.12);
  box-shadow: 0 4px 14px rgba(124, 63, 10, 0.12);
}

.message.user {
  background: rgba(255, 228, 177, 0.9);
  border-color: rgba(234, 146, 46, 0.42);
}

.message-role {
  color: #b35d09;
}

.message-body p {
  color: #241305;
}

.message,
.message-body,
.message-body > * {
  min-width: 0;
}

.message {
  overflow: hidden;
}

.message.assistant {
  max-width: min(100%, 880px);
}

.message-body {
  width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.message-body p,
.message-body li,
.message-body strong,
.message-body em {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message-body h1,
.message-body h2,
.message-body h3,
.message-body h4,
.message-body strong {
  color: #241305;
}

.message-body em {
  color: #8a4608;
}

.message-body code {
  background: rgba(234, 146, 46, 0.12);
  color: #8a4608;
}

.message-body hr {
  border-top-color: rgba(124, 63, 10, 0.18);
}

.message-body ul li {
  color: #241305;
}

.message-body blockquote {
  background: rgba(255, 244, 223, 0.92);
  border-left-color: rgba(234, 146, 46, 0.95);
}

.message-body blockquote p {
  color: #5d330b;
}

.message-body .md-table-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

.message-body .md-table {
  width: 640px;
  min-width: 640px;
  max-width: none;
  table-layout: auto;
  background: rgba(255, 250, 240, 0.92);
}

.message-body .md-table th,
.message-body .md-table td {
  color: #241305;
  border-color: rgba(124, 63, 10, 0.14);
  word-break: break-word;
  overflow-wrap: anywhere;
  min-width: 120px;
}

@media (max-width: 768px) {
  html,
  body,
  .shell,
  .page-stack,
  .workspace-shell,
  .chat-card,
  .chat-main,
  .chat-stack,
  .message-stream,
  .message,
  .message-body,
  .chat-form,
  .composer-shell {
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    box-sizing: border-box;
  }

  .shell,
  .page-stack,
  .workspace-shell,
  .chat-card,
  .chat-main,
  .chat-stack,
  .message-stream,
  .message,
  .message-body {
    overflow-x: hidden;
  }

  .message-stream {
    overflow-x: hidden;
  }

  .message-body .md-table-wrap {
    display: block;
    width: 100%;
    max-width: calc(100vw - 64px);
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .message-body .md-table {
    width: max-content;
    min-width: 560px;
  }
}

.message-body .md-table th {
  color: #5d330b;
  background: rgba(255, 236, 204, 0.95);
}

.composer-shell {
  background: rgba(255, 248, 232, 0.95);
  border-color: rgba(124, 63, 10, 0.16);
  box-shadow: 0 8px 30px rgba(124, 63, 10, 0.18);
}

textarea {
  color: #241305;
}

textarea::placeholder {
  color: rgba(116, 75, 36, 0.72);
}

.send-btn {
  background: #7a3d09;
}

.send-btn:hover {
  background: #5e2e06;
}

.help-copy p,
.queue-panel {
  background: rgba(255, 255, 255, 0.6);
  border-color: rgba(124, 63, 10, 0.1);
}

.help-copy strong {
  color: #241305;
}

.primary-btn:not(.enter-chat-btn):not(.send-btn) {
  background: #ea922e;
}

.primary-btn:not(.enter-chat-btn):not(.send-btn):hover {
  background: #d47e18;
}

.progress-card {
  color: #241305;
  background:
    radial-gradient(circle at 88% 10%, rgba(255, 211, 126, 0.42), transparent 34%),
    linear-gradient(135deg, rgba(255, 248, 232, 0.96), rgba(255, 229, 182, 0.86));
  border: 1px solid rgba(234, 146, 46, 0.26);
  border-radius: 18px;
  padding: 14px 16px;
}

.progress-card::before,
.progress-card::after {
  opacity: 0.22;
}

.progress-card-title {
  color: #8a4608;
  font-weight: 700;
}

.progress-card-text {
  color: #3a210b;
  font-weight: 500;
}

.inline-progress {
  background: rgba(122, 61, 9, 0.14);
}

.inline-progress .progress-fill {
  background: linear-gradient(90deg, #ea922e, #1f9f64);
  box-shadow: 0 0 16px rgba(234, 146, 46, 0.35);
}

.ghost-btn {
  color: #5d330b;
  background: rgba(255, 248, 232, 0.7);
  border-color: rgba(124, 63, 10, 0.18);
}

.ghost-btn:hover {
  background: rgba(255, 228, 177, 0.82);
}

@media (max-width: 768px) {
  .site-header {
    background: rgba(232, 125, 18, 0.88);
    border-bottom-color: rgba(255, 246, 221, 0.34);
  }

  .graph-stage {
    background:
      radial-gradient(circle at 20% 0%, rgba(255, 219, 126, 0.42), transparent 38%),
      rgba(255, 248, 232, 0.78);
    border-color: rgba(255, 255, 255, 0.48);
  }

  .graph-node,
  .graph-detail {
    background: rgba(255, 252, 244, 0.88);
    border-color: rgba(124, 63, 10, 0.14);
    box-shadow: 0 8px 24px rgba(124, 63, 10, 0.12);
  }

  .graph-node:hover,
  .graph-node.is-active {
    background: rgba(255, 230, 184, 0.9);
    border-color: rgba(234, 146, 46, 0.72);
  }

  .graph-node-title,
  .graph-detail h4 {
    color: #241305;
  }

  .graph-node-meta,
  .graph-detail p,
  .graph-detail-list {
    color: #5d360f;
  }

  .composer-shell {
    background: rgba(255, 248, 232, 0.98);
  }
}

/* P6 page */
.p6-page {
  gap: 20px;
  padding-bottom: 56px;
}

.entry-card {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 10px 26px rgba(116, 66, 9, 0.12);
}

.entry-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.entry-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f59f24;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
}

.entry-user {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.entry-user strong,
.entry-user span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-user strong {
  color: #3c2209;
  font-size: 14px;
  font-weight: 900;
}

.entry-user span {
  color: #8a5a2d;
  font-size: 12px;
  font-weight: 700;
}

.entry-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 243, 220, 0.96);
  color: #9a5a08;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.entry-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.entry-switch-btn {
  min-width: 0;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(247, 241, 234, 0.92);
  color: #5d330b;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  cursor: default;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(124, 63, 10, 0.06);
}

.entry-switch-btn.is-active {
  background: #2f77b8;
  color: #fff;
  box-shadow: 0 10px 22px rgba(47, 119, 184, 0.24);
}

.p6-hero,
.p6-report-card,
.p6-detail-card,
.p6-form-card,
.p6-school-card {
  padding: 28px 30px;
}

.p6-hero h2,
.p6-report-card h3,
.p6-detail-card h3,
.p6-form-card h3,
.p6-school-card h3,
#module4-section h3 {
  color: #241305;
  margin: 0;
}

.p6-hero h2 {
  font-size: 34px;
  line-height: 1.2;
}

.p6-hero-copy {
  margin: 12px 0 0;
  color: #5d330b;
  line-height: 1.8;
  font-size: 16px;
}

.p6-child-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.p6-summary-item {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(124, 63, 10, 0.12);
}

.p6-summary-item span {
  display: block;
  font-size: 12px;
  color: #8a5a2d;
  margin-bottom: 8px;
}

.p6-summary-item strong {
  display: block;
  color: #241305;
  font-size: 18px;
  line-height: 1.5;
}

.p6-report-status {
  margin-bottom: 22px;
  padding: 16px 18px;
  border-radius: 18px;
  line-height: 1.75;
  border: 1px solid rgba(124, 63, 10, 0.14);
  background: rgba(255, 255, 255, 0.62);
  color: #5d330b;
}

.p6-report-status.tone-loading {
  background: rgba(255, 244, 223, 0.9);
}

.p6-report-status.tone-success {
  background: rgba(241, 255, 243, 0.92);
  border-color: rgba(36, 132, 79, 0.22);
  color: #1f6f44;
}

.p6-report-status.tone-warning {
  background: rgba(255, 245, 230, 0.92);
  border-color: rgba(194, 107, 25, 0.24);
  color: #8a4608;
}

.p6-match-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.p6-match-column {
  padding: 22px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(124, 63, 10, 0.1);
}

.p6-match-column h4 {
  margin: 0 0 10px;
  color: #241305;
  font-size: 20px;
}

.p6-match-column p {
  margin: 0 0 16px;
  color: #744b24;
  line-height: 1.7;
  font-size: 14px;
}

.p6-major-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.p6-major-btn {
  width: 100%;
  border: 1px solid rgba(124, 63, 10, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  padding: 14px 14px 14px 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.p6-major-btn:hover,
.p6-major-btn.is-selected {
  transform: translateY(-2px);
  border-color: rgba(234, 146, 46, 0.5);
  box-shadow: 0 14px 28px rgba(124, 63, 10, 0.14);
}

.p6-major-btn.is-selected {
  background: rgba(255, 250, 240, 0.96);
}

.p6-major-index {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(234, 146, 46, 0.14);
  color: #8a4608;
  font-weight: 700;
  font-size: 14px;
}

.p6-major-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.p6-major-copy strong {
  color: #241305;
  font-size: 16px;
  line-height: 1.45;
}

.p6-major-copy em,
.p6-major-copy small {
  color: #744b24;
  font-style: normal;
  line-height: 1.6;
}

.p6-major-copy small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.p6-major-code {
  display: inline-flex;
  width: fit-content;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(234, 146, 46, 0.14);
  color: #8a4608;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.p6-major-status {
  display: inline-flex;
  margin-left: auto;
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(234, 146, 46, 0.14);
  color: #8a4608;
  font-size: 12px;
  font-weight: 700;
}

.p6-major-btn.is-loading .p6-major-status {
  background: rgba(31, 111, 68, 0.12);
  color: #1f6f44;
}

.p6-empty-item {
  color: #8a5a2d;
  padding: 12px 0;
  line-height: 1.7;
}

.p6-thinking-item {
  list-style: none;
}

.p6-thinking-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border-bottom-left-radius: 5px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(124, 63, 10, 0.1);
  box-shadow: 0 8px 18px rgba(124, 63, 10, 0.08);
  color: #5d330b;
  line-height: 1.55;
  font-size: 14px;
}

.p6-thinking-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.p6-thinking-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
}

.p6-thinking-dots i {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #c78336;
  opacity: 0.35;
  animation: p6ThinkingDot 1.05s infinite ease-in-out;
}

.p6-thinking-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.p6-thinking-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes p6ThinkingDot {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.32;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.p6-basis-note,
.p6-chat-intro {
  margin: 18px 0 0;
  color: #744b24;
  line-height: 1.8;
}

.p6-report-actions {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

.p6-next-btn {
  min-height: 48px;
  padding-inline: 28px !important;
}

.p6-next-btn:disabled {
  background: rgba(138, 90, 45, 0.22) !important;
  color: rgba(93, 51, 11, 0.62) !important;
  cursor: not-allowed;
  box-shadow: none;
}

body.modal-open {
  overflow: hidden;
}

.p6-detail-modal-card {
  width: min(760px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  padding: 24px 24px 26px;
  text-align: left;
}

.p6-detail-modal-card .section-head {
  padding-right: 42px;
}

.p6-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(124, 63, 10, 0.14);
  border-radius: 999px;
  background: rgba(255, 248, 232, 0.9);
  color: #5d330b;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.p6-modal-close:hover {
  background: rgba(255, 229, 182, 0.95);
}

.p6-module-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(360px, 0.94fr);
  gap: 20px;
}

.p6-empty,
.p6-loading,
.p6-warning {
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(124, 63, 10, 0.12);
  color: #5d330b;
  line-height: 1.75;
}

.p6-warning {
  background: rgba(255, 244, 223, 0.92);
  color: #8a4608;
}

.p6-rich h4 {
  margin: 0 0 16px;
  color: #241305;
  font-size: 28px;
}

.p6-detail-code {
  display: block;
  margin-top: 6px;
  color: #8a4608;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.p6-rich h1,
.p6-rich h2,
.p6-rich h3,
.p6-rich h4,
.p6-rich p,
.p6-rich li,
.p6-rich strong,
.p6-rich em,
.p6-rich blockquote {
  color: #241305;
}

.p6-rich em {
  color: #8a4608;
  font-style: normal;
}

.p6-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.p6-field {
  display: grid;
  gap: 8px;
}

.p6-field span {
  color: #5d330b;
  font-weight: 600;
}

.p6-field em {
  color: #b35d09;
  font-style: normal;
}

.p6-field input,
.p6-field select,
.p6-field textarea {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(124, 63, 10, 0.16);
  background: rgba(255, 255, 255, 0.9);
  color: #241305;
  padding: 14px 16px;
  outline: none;
}

.p6-field textarea {
  resize: vertical;
  min-height: 96px;
}

.p6-field-wide {
  grid-column: 1 / -1;
}

.p6-submit-btn {
  grid-column: 1 / -1;
  min-height: 56px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #7a3d09, #ea922e);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.p6-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.p6-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 248, 232, 0.96);
  border: 1px solid rgba(124, 63, 10, 0.14);
  color: #5d330b;
  font-size: 14px;
}

.p6-school-overview {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.p6-school-overview p {
  margin: 0;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(124, 63, 10, 0.12);
  color: #5d330b;
  line-height: 1.75;
}

.p6-school-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.p6-school-column,
.p6-school-note {
  padding: 22px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(124, 63, 10, 0.12);
}

.p6-school-note {
  margin-top: 18px;
}

.p6-school-column h4,
.p6-school-note h4 {
  margin: 0 0 10px;
  color: #241305;
  font-size: 20px;
}

.p6-school-column p {
  margin: 0 0 14px;
  color: #744b24;
  line-height: 1.7;
  font-size: 14px;
}

.p6-school-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.p6-school-list li {
  color: #241305;
  line-height: 1.7;
}

.p6-admission-list {
  padding-left: 0;
  list-style: none;
}

.p6-admission-item {
  display: grid;
  gap: 5px;
  padding: 12px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(124, 63, 10, 0.1);
}

.p6-admission-item strong {
  color: #241305;
  font-size: 15px;
}

.p6-admission-item span {
  color: #5d330b;
  font-weight: 700;
}

.p6-admission-item em,
.p6-admission-item small {
  color: #744b24;
  font-style: normal;
  line-height: 1.55;
}

#module4-section {
  padding: 24px 22px 22px;
}

#module4-section .chat-stack {
  gap: 14px;
  margin-top: 14px;
}

#module4-section .message-stream {
  min-height: 340px;
  max-height: none;
  padding: 0 0 16px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

#module4-section .message {
  width: 100%;
  max-width: 100%;
  padding: 16px 18px;
  border-radius: 16px;
}

#module4-section .message.user {
  width: auto;
  max-width: min(92%, 680px);
  margin-left: auto;
}

#module4-section .message.assistant,
#module4-section .message.progress-message {
  width: 100%;
  max-width: 100%;
}

#module4-section .message.streaming-message .message-body::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1.15em;
  margin-left: 3px;
  border-radius: 2px;
  background: rgba(109, 59, 8, 0.72);
  vertical-align: -0.18em;
  animation: streamCaretBlink 0.9s steps(2, start) infinite;
}

#module4-section .composer-shell {
  border-radius: 18px;
  padding: 8px 10px;
}

@keyframes streamCaretBlink {
  50% { opacity: 0; }
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.chat-suggestion-btn {
  max-width: 100%;
  border: 1px solid rgba(157, 92, 21, 0.18);
  border-radius: 999px;
  background: rgba(255, 247, 232, 0.82);
  color: #6d3b08;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: 0 6px 18px rgba(125, 73, 8, 0.08);
}

.chat-suggestion-btn:active {
  transform: translateY(1px);
  background: rgba(255, 239, 207, 0.95);
}

@media (max-width: 900px) {
  .p6-child-summary,
  .p6-match-grid,
  .p6-school-grid,
  .p6-module-grid,
  .p6-form {
    grid-template-columns: 1fr;
  }

  .p6-hero,
  .p6-report-card,
  .p6-detail-card,
  .p6-form-card,
  .p6-school-card,
  #module4-section {
    padding: 22px 20px;
  }

  #module4-section {
    padding: 18px 14px 16px;
  }

  #module4-section .message-stream {
    min-height: 300px;
  }

  #module4-section .message {
    padding: 14px 14px;
  }
}

@media (max-width: 768px) {
  .p6-page {
    gap: 16px;
  }

  .p6-hero h2 {
    font-size: 28px;
  }

  .p6-page-slogan {
    font-size: 14px;
  }

  .p6-summary-item strong {
    font-size: 16px;
  }

  .p6-match-column h4 {
    font-size: 18px;
  }

  .p6-school-column h4,
  .p6-school-note h4 {
    font-size: 18px;
  }

  .p6-rich h4 {
    font-size: 24px;
  }

  #module4-section .message-stream {
    height: auto;
    min-height: 280px;
    padding-bottom: 16px;
  }

  #module4-section .section-head {
    margin-bottom: 10px;
  }

  #module4-section .chat-stack {
    gap: 12px;
    margin-top: 12px;
  }

  #module4-section .composer-shell {
    padding: 8px;
  }

  #module4-section .chat-form {
    position: static;
    z-index: auto;
  }

  .chat-suggestions {
    gap: 6px;
    margin-bottom: 8px;
  }

  .chat-suggestion-btn {
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
  }
}

@media (min-width: 901px) {
  .site-header {
    position: static;
    padding: 24px 0 10px;
    background: transparent;
    border-bottom: 0;
    backdrop-filter: none;
  }

  .brand-wrap {
    display: inline-flex;
    padding: 18px 26px 20px;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(239, 141, 35, 0.96), rgba(245, 161, 58, 0.94));
    box-shadow: 0 18px 42px rgba(122, 61, 9, 0.18);
  }

  .brand-subtitle {
    color: #fff1d6;
  }

  .site-header h1 {
    font-size: 30px;
  }

  .workspace-shell {
    grid-template-columns: minmax(0, 1.52fr) minmax(300px, 0.72fr);
    gap: 24px;
    align-items: start;
  }

  .chat-main {
    min-height: auto;
  }

  .help-card {
    position: sticky;
    top: 20px;
    align-self: start;
  }

  .message-stream {
    min-height: clamp(460px, 62vh, 880px);
    max-height: none;
    overflow-y: visible;
  }

  .message,
  .message.assistant,
  .message.user,
  .message.progress-message {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .message-body {
    width: 100%;
  }
}
