:root {
  font-family: "Noto Sans JP","Yu Gothic",Meiryo,sans-serif;
  color: #242746;
  background: #eef3f8;
  font-size: 15px;
  --navy: #07076a;
  --muted: #636878;
  --line: #e1e5ed;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,input,textarea,select {
  font: inherit;
}

button,a,input,select,textarea {
  outline-offset: 4px;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: .48;
}

[hidden] {
  display: none!important;
}

.backdrop {
  height: 100dvh;
  display: grid;
  place-content: center;
  text-align: center;
  color: #68758d;
  gap: 20px;
}

.backdrop img {
  width: 220px;
  margin: auto;
}

.backdrop p {
  margin: 0;
}

.shell {
  position: fixed;
  inset: 20px 0;
  margin: auto;
  width: min(680px,calc(100% - 40px));
  height: calc(100dvh - 40px);
  background: #fff;
  box-shadow: 0 12px 65px #1d2c5825;
  border: 1px solid #e1e4ea;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  padding: 19px 24px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.brand img {
  width: 175px;
  height: auto;
  display: block;
}

.icon-button {
  border: 0;
  background: transparent;
  width: 40px;
  height: 40px;
  color: var(--navy);
  font-size: 26px;
  border-radius: 50%;
}

.icon-button:hover {
  background: #edf1f8;
}

.category-bar {
  padding: 15px 24px 12px;
}

.category-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.category-line strong {
  color: var(--navy);
  font-size: 14px;
}

.stages {
  display: flex;
  gap: 5px;
  margin-top: 12px;
}

.stages span {
  height: 4px;
  background: #e8ebf1;
  flex: 1;
  border-radius: 4px;
}

.stages .active {
  background: var(--navy);
}

.stage-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  margin-top: 5px;
}

.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 15px 24px 25px;
  scrollbar-gutter: stable;
}

.setup {
  padding: 15px 4px 12px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .06em;
}

h1 {
  font-size: 23px;
  line-height: 1.6;
  color: var(--navy);
  margin: 12px 0;
}

p {
  line-height: 1.85;
}

.muted {
  font-size: 13px;
  color: var(--muted);
}

label.field {
  display: block;
  font-weight: 700;
  margin: 25px 0 10px;
}

select,textarea {
  width: 100%;
  border: 1px solid #b5bdcd;
  background: #fff;
  border-radius: 7px;
  padding: 13px;
  color: #242746;
}

select {
  min-height: 50px;
}

textarea {
  min-height: 90px;
  resize: vertical;
  line-height: 1.7;
}

.primary {
  background: var(--navy);
  color: white;
  border: 1px solid var(--navy);
  border-radius: 5px;
  padding: 14px 22px;
  min-height: 48px;
  font-weight: 700;
}

.secondary {
  background: white;
  color: var(--navy);
  border: 1px solid #c4cada;
  border-radius: 5px;
  padding: 12px 18px;
  min-height: 44px;
}

.setup .primary {
  width: 100%;
  margin: 20px 0 5px;
}

.developer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12px;
  margin-top: 28px;
}

.developer-links a {
  color: #505b78;
  text-underline-offset: 4px;
}

.turn {
  padding: 10px 0 27px;
  border-bottom: 1px solid #edf0f5;
  margin-bottom: 22px;
}

.question-line {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.q-label {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  min-width: 38px;
  height: 29px;
  background: var(--navy);
  color: white;
  font-size: 14px;
  font-weight: 700;
  border-radius: 4px;
}

.question-title {
  font-size: 16px;
  line-height: 1.8;
  margin: 0;
  color: var(--navy);
  font-weight: 700;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.description,.preface {
  font-size: 14px;
  color: #525a6c;
  white-space: pre-wrap;
}

.preface {
  margin: 0 0 15px;
}

.answer {
  display: table;
  margin: 20px 0 0 auto;
  background: var(--navy);
  color: white;
  border-radius: 8px 8px 0 8px;
  padding: 10px 15px;
  max-width: 90%;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
}

.choices {
  border: 0;
  padding: 0;
  margin: 22px 0 18px;
  min-width: 0;
}

.choices legend {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.option {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 12px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  line-height: 1.6;
  cursor: pointer;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.option:hover {
  background: #f5f7fc;
}

.option:has(input:checked) {
  background: #f0f3fc;
  border-color: #7779b0;
  color: var(--navy);
}

.option input {
  margin: 4px 0 0;
  width: 18px;
  height: 18px;
  accent-color: var(--navy);
  flex-shrink: 0;
}

.free-label {
  display: block;
  font-size: 13px;
  margin: 15px 0 8px;
  line-height: 1.7;
  color: #535a6c;
}

.answer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.answer-actions .primary {
  min-width: 160px;
}

.loader {
  margin: 18px 0;
  color: #606879;
  font-size: 13px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #d4d8e8;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error {
  border: 1px solid #e5b4ad;
  border-radius: 7px;
  padding: 16px;
  background: #fff8f6;
  color: #7b2d25;
  line-height: 1.8;
  white-space: pre-wrap;
  margin: 12px 0;
}

.notice {
  padding: 12px;
  background: #f5f7fb;
  font-size: 13px;
  line-height: 1.8;
  color: #515c76;
}

.footer {
  border-top: 1px solid var(--line);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.text-button {
  border: 0;
  background: none;
  color: #535d77;
  font-size: 12px;
  text-decoration: underline;
  padding: 8px;
}

.latest {
  position: absolute;
  bottom: 56px;
  right: 24px;
  border: 1px solid #c4cada;
  background: white;
  color: var(--navy);
  padding: 10px 16px;
  border-radius: 30px;
  box-shadow: 0 3px 15px #0001;
}

.raw-output,pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.7;
  background: #f5f7fa;
  padding: 12px;
  border-radius: 5px;
  max-height: 350px;
  overflow: auto;
}

.raw-output {
  max-height: none;
}

.debug {
  margin-top: 24px;
}

.debug summary {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.completion {
  text-align: center;
  padding: 26px 0;
}

.completion h2 {
  color: var(--navy);
  font-size: 21px;
}

.complete-icon {
  margin: auto;
  border-radius: 50%;
  background: #edf4f0;
  color: #1c7559;
  font-size: 27px;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
}

.result-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 15px;
}

.dialog {
  border: 0;
  border-radius: 12px;
  padding: 24px;
  max-width: 420px;
  width: calc(100% - 32px);
  color: #242746;
  box-shadow: 0 15px 70px #0003;
}

.dialog::backdrop {
  background: #1a234655;
}

.dialog h2 {
  font-size: 19px;
  color: var(--navy);
}

.dialog .result-actions {
  justify-content: flex-end;
}

.closed {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  background: #eef3f8;
  gap: 18px;
}

.closed img {
  width: 210px;
  margin: auto;
}

.closed p {
  margin: 0;
}

.closed .primary {
  margin-top: 8px;
}

.completion p {
  font-size: 14px;
}

.body-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.9;
  font-size: 15px;
}

.debug-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.debug-controls button {
  font-size: 12px;
}

.form-error {
  color: #a33427;
  font-size: 13px;
  line-height: 1.6;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

@media(max-width:600px) {
  .shell {
    inset: 0;
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .brand {
    padding: 12px 16px 10px;
  }
  .brand img {
    width: 155px;
  }
  .category-bar {
    padding: 12px 16px 10px;
  }
  .scroll {
    padding: 12px 16px 22px;
    scrollbar-gutter: auto;
  }
  .footer {
    padding: 8px 16px;
  }
  .question-title {
    font-size: 15px;
  }
  .question-line {
    gap: 10px;
  }
  .option {
    padding: 12px 6px;
  }
  .answer-actions .primary {
    width: 100%;
  }
  textarea {
    font-size: 16px;
  }
  .category-line {
    align-items: flex-start;
  }
  .category-line strong {
    font-size: 13px;
  }
  h1 {
    font-size: 21px;
  }
  .latest {
    right: 16px;
  }
  .backdrop {
    display: none;
  }
  .turn {
    padding-bottom: 22px;
  }
  .setup {
    padding-top: 6px;
  }
}

@media(prefers-reduced-motion:reduce) {
  .spinner {
    animation: none;
  }
}

#question .turn {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}

.chat-open {
  overflow: hidden;
}

.chat-open>.site-header {
  visibility: hidden;
}

.chat-open:before {
  content: '';
  position: fixed;
  inset: 0;
  background: #f0f5f2e8;
  z-index: 1;
}

.shell {
  width: min(650px,calc(100% - 40px));
  inset: 24px 0 0;
  height: calc(100dvh - 24px);
  border: 1px solid #dce1df;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 1px 5px #0002;
  color: #233032;
}

.shell .brand {
  background: #eef7f3;
  padding: 10px 14px;
  min-height: 56px;
}

.shell .brand img {
  width: 145px;
}

.shell .category-bar {
  padding: 10px 12px 9px;
  background: white;
}

.shell .category-line {
  font-size: 11px;
}

.shell .category-line strong {
  font-size: 12px;
  font-weight: 400;
}

.shell .category-bar progress {
  appearance: none;
  height: 12px;
  margin: 7px 0 0;
  background: #e4e4e4;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  accent-color: #f9dd38;
}

.shell progress::-webkit-progress-bar {
  background: #e4e4e4;
}

.shell progress::-webkit-progress-value {
  background: linear-gradient(90deg,#f3e83b,#ffdc43);
  border-radius: 12px;
}

.shell progress::-moz-progress-bar {
  background: #f9dd38;
}

.shell .scroll {
  padding: 12px 12px 30px;
  scrollbar-width: thin;
}

.shell .turn {
  padding: 4px 0 0;
  margin: 0;
  border: 0;
}

.shell .question-line {
  gap: 10px;
  align-items: flex-start;
}

.shell .q-label {
  min-width: 46px;
  height: 28px;
  border-radius: 3px;
  background: #10045e;
  font-weight: bold;
  font-size: 16px;
}

.shell .question-title {
  font-size: 14px;
  line-height: 1.9;
  color: #10045e;
}

.shell .description {
  font-size: 12px;
  line-height: 1.7;
  margin: 8px 0 10px;
  color: #6d7774;
}

.shell .choices {
  margin: 12px 0 6px;
  padding: 0;
  border: 0;
}

.shell .choices legend {
  font-size: 11px;
  color: #74807a;
  margin-bottom: 4px;
}

.shell .option {
  padding: 6px 8px;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 2px;
  gap: 7px;
  line-height: 1.5;
  font-size: 14px;
  align-items: flex-start;
  background: transparent;
}

.shell .option:has(input:checked) {
  border-color: #0cb6a8;
  background: #f3fcfa;
}

.shell .option input {
  margin-top: 2px;
  width: 17px;
  height: 17px;
  accent-color: #0db6a6;
  flex: none;
}

.shell .answer {
  background: #13055b;
  color: white;
  width: fit-content;
  max-width: 90%;
  margin: 16px 14px 22px auto;
  padding: 4px 10px;
  border-radius: 2px;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.shell .history-item {
  border: 0;
  padding: 0;
  margin: 0 0 24px;
}

.shell .history-item .edit-answer {
  font-size: 10px;
  color: #818a86;
  display: block;
  margin-left: auto;
  margin-top: -18px;
  margin-bottom: 10px;
}

.shell textarea {
  border: 1px solid #e0e4e2;
  border-radius: 1px;
  min-height: 66px;
  max-width: 100%;
  padding: 10px;
  line-height: 1.6;
  font-size: 13px;
  resize: vertical;
}

.shell .free-label {
  font-size: 11px;
  color: #64706a;
  margin: 10px 0 6px;
  display: block;
}

.shell .answer-actions {
  margin: 10px 0 18px;
  display: flex;
  justify-content: center;
}

.shell .answer-actions .primary {
  background: #0cb7a5;
  border: 0;
  border-radius: 24px;
  min-height: 38px;
  padding: 9px 24px;
  font-size: 12px;
  width: auto;
}

.shell .chat-note {
  font-size: 12px;
  line-height: 1.8;
  padding: 0 0 14px;
  color: #4d625a;
  white-space: pre-wrap;
}

.shell .chat-note:before {
  content: '✧';
  color: #0cb7a5;
  margin-right: 7px;
}

.shell .footer {
  display: none;
}

.shell .mock-controls {
  font-size: 10px;
  padding: 4px 10px;
  background: #fff9e8;
  line-height: 1.5;
}

.shell .mock-controls span {
  font-size: 10px;
}

.shell .mock-controls button {
  font-size: 10px;
  padding: 3px 7px;
}

.shell .mock-wait {
  text-align: left;
  padding: 10px 0;
}

.shell .mock-wait h2 {
  font-size: 12px;
  font-weight: 400;
  color: #79817e;
}

.shell .mock-wait p {
  display: none;
}

.shell .mock-spinner,.chat-orb {
  display: block;
  position: relative;
  width: 34px;
  height: 22px;
  border: 0;
  border-radius: 0;
  margin: 14px 0;
  animation: none;
  background: transparent;
}

.shell .mock-spinner:before,.shell .mock-spinner:after,.chat-orb:before,.chat-orb:after {
  content: '';
  position: absolute;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #0fcbb8;
  left: 0;
  top: 0;
  opacity: .85;
  animation: orb-pulse 1.1s ease-in-out infinite alternate;
}

.shell .mock-spinner:after,.chat-orb:after {
  left: 16px;
  background: #02b99f;
  animation-delay: .4s;
}

.chat-orb {
  margin-top: 18px;
}

.shell .completion {
  padding: 30px 12px;
}

.shell .category-intro {
  display: none;
}

@keyframes orb-pulse {
  to {
    opacity: .4;
    transform: scale(.86);
  }
}

@media(prefers-reduced-motion:reduce) {
  .shell .mock-spinner:before,.shell .mock-spinner:after,.chat-orb:before,.chat-orb:after {
    animation: none;
  }
}

@media(min-width:641px) {
  .shell .brand {
    height: 0;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .shell .brand img {
    display: none;
  }
  .shell .brand .icon-button {
    position: absolute;
    right: 10px;
    top: 2px;
    width: 25px;
    height: 25px;
    font-size: 18px;
    z-index: 3;
  }
  .shell .category-line {
    padding-right: 25px;
  }
}

@media(max-width:640px) {
  .shell {
    inset: 0;
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }
  .shell .scroll {
    padding: 12px 12px 24px;
  }
  .shell .question-title {
    font-size: 13px;
  }
  .shell .q-label {
    font-size: 14px;
    min-width: 43px;
    height: 27px;
  }
  .shell .option {
    font-size: 14px;
    padding: 6px;
    min-height: 34px;
  }
  .shell textarea {
    font-size: 16px;
  }
  .shell .answer {
    font-size: 12px;
  }
  .shell .category-line strong {
    font-size: 11px;
  }
}

.shell {
  overflow: clip;
}

.shell .brand,.shell .category-bar {
  flex-shrink: 0;
}

.shell .option-description {
  display: block;
  font-size: 10px;
  line-height: 1.6;
  font-weight: 400;
  color: #52617b;
  margin-top: 2px;
}

.shell .chat-orb,.shell .mock-spinner {
  width: 44px;
  height: 30px;
  isolation: isolate;
}

.shell .chat-orb:before,.shell .mock-spinner:before,.shell .chat-orb:after,.shell .mock-spinner:after {
  width: 25px;
  height: 25px;
  opacity: .9;
  background: radial-gradient(circle at 30% 25%,#69e5e2,#14bbb9 65%,#16aaa8);
  animation: chat-orb-left 1.4s ease-in-out infinite;
  filter: blur(.4px);
}

.shell .chat-orb:after,.shell .mock-spinner:after {
  left: 16px;
  background: radial-gradient(circle at 70% 25%,#9bdcda,#51b5b2 70%);
  animation: chat-orb-right 1.4s ease-in-out infinite;
  mix-blend-mode: multiply;
}

@keyframes chat-orb-left {
  0%,100% {
    transform: translateX(0) scale(.94);
  }
  50% {
    transform: translateX(7px) scale(1.07);
  }
}

@keyframes chat-orb-right {
  0%,100% {
    transform: translateX(0) scale(1.03);
  }
  50% {
    transform: translateX(-7px) scale(.9);
  }
}

@media(prefers-reduced-motion:reduce) {
  .shell .chat-orb:before,.shell .chat-orb:after,.shell .mock-spinner:before,.shell .mock-spinner:after {
    animation: none;
  }
}

.stages,.stage-labels {
  display: none;
}

.category-bar:after {
  content: "";
  display: block;
  height: 12px;
  border-radius: 12px;
  background: linear-gradient(90deg,#f8df3d 0 18%,#e4e4e4 18%);
  margin-top: 8px;
}

.loader .spinner {
  background: #0fc8b3;
  border: 0;
  width: 22px;
  height: 22px;
  box-shadow: 13px 0 #02b99f;
  animation: none;
}

.loader {
  font-size: 11px;
}

.shell #free-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.shell #free {
  margin-top: 8px;
}

.shell .footer {
  display: flex;
  font-size: 10px;
  padding: 5px 12px;
}

.shell #mode-label {
  display: none;
}

.shell .preface {
  font-size: 12px;
  line-height: 1.8;
}

.shell .turn {
  margin: 0 0 12px;
}

.stage-instructions {
  font-size: 12px;
  line-height: 1.7;
  padding: 12px;
  background: #f2f5fa;
  border: 1px solid #dce4f0;
  border-radius: 6px;
  margin-bottom: 16px;
}

.stage-instructions strong {
  font-size: 14px;
  color: #07076a;
}

.stage-instructions details {
  margin: 8px 0;
}

.stage-instructions summary {
  cursor: pointer;
}

.stage-instructions p {
  margin: 8px 0;
}

.run-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.run-controls .secondary {
  font-size: 11px;
  padding: 7px 10px;
  min-height: 36px;
}

.storage-note {
  font-size: 11px;
  color: #52637a;
}

.single-choice {
  width: 100%;
  text-align: left;
  font: inherit;
  background: #fff;
  border: 1px solid #dce3ed;
  margin: 6px 0;
  min-height: 44px;
  color: #10105c;
}

.single-choice[aria-pressed=true] {
  background: #edf4ff;
  border-color: #07076a;
}

.shell .stage-instructions a {
  color: #17478a;
}

.shell .category-bar:after {
  display: none!important;
}

.shell #free-label {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  display: block;
}

.shell .loader .spinner {
  animation: qa-pulse 1s ease-in-out infinite alternate!important;
  box-shadow: 13px 0 #02b99f;
}

.shell .loader {
  gap: 24px;
}

@keyframes qa-pulse {
  from {
    opacity: .4;
    transform: translateX(0);
  }
  to {
    opacity: 1;
    transform: translateX(5px);
  }
}

@media(prefers-reduced-motion:reduce) {
  .shell .loader .spinner {
    animation: none!important;
  }
}

body[data-mode="chat"] .shell #question .turn {
  margin: 0;
  padding: 4px 0 0;
  border: 0;
}

body[data-mode="chat"] .shell #choices .option {
  margin: 0;
}

body[data-mode="chat"] .shell .free-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

body[data-mode="chat"] .shell #free {
  margin-top: 0;
}

body[data-mode="chat"] .shell .loader .spinner {
  display: none;
}

body[data-mode="chat"] .shell .loader .chat-orb {
  margin: 0;
  flex-shrink: 0;
}

.stage-instructions {
  display: none;
}

#api-routing {
  padding: 8px 0 16px;
}

#api-routing h1 {
  font-size: 14px;
  margin: 0;
}

.option small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.6;
  color: #53627e;
}

.routing-intro,.routing-help {
  font-size: 12px;
  line-height: 1.8;
  color: #54627b;
}

.routing-history-question {
  font-size: 12px;
  font-weight: bold;
}

.routing-handoff {
  margin: 16px 0;
  padding: 12px;
  background: #f0f5fb;
  border-left: 3px solid #080b91;
  font-size: 12px;
  line-height: 1.8;
}

.routing-handoff p {
  margin: 4px 0;
}

.routing-handoff small {
  font-size: 11px;
  color: #52607a;
}

#api-routing-history .turn {
  padding: 8px 0;
  border-bottom: 1px solid #dbe3ee;
}

#api-routing-history button {
  font-size: 11px;
}

.stage-instructions {
  display: block;
  font-size: 11px;
}

.stage-instructions>strong,.stage-instructions>details,.stage-instructions>a {
  display: none;
}
