#assistant-host {
  :root {
    --paper: #f6efe4;
    --ink: #2b2622;
    --primary: #b5532f;
    --muted: #70675e;
    --line: #ded4c6;
    --white: #fffdf8;
    --sage: #e7e9dd;
    --serif: "Noto Serif TC", serif;
    --sans: "Noto Sans TC", sans-serif;
  }
  * {
    box-sizing: border-box;
  }
  html {
    color: var(--ink);
    background: var(--paper);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.65;
    scroll-behavior: smooth;
  }
  body {
    margin: 0;
  }
  button,
  input,
  textarea {
    font: inherit;
  }
  button,
  a,
  input,
  textarea {
    -webkit-tap-highlight-color: transparent;
  }
  button {
    color: inherit;
    cursor: pointer;
    border: 0;
    background: none;
    min-height: 44px;
  }
  button:disabled {
    cursor: default;
    opacity: 0.5;
  }
  a {
    color: var(--primary);
  }
  button:focus-visible,
  a:focus-visible,
  input:focus-visible,
  textarea:focus-visible,
  summary:focus-visible {
    outline: 3px solid #547467;
    outline-offset: 4px;
  }
  h1:focus {
    outline: 0;
  }
  button:active {
    transform: translateY(1px);
  }
  h1,
  h2,
  h3,
  p {
    margin: 0;
  }
  h1,
  h2 {
    font-family: var(--serif);
    font-weight: 500;
  }
  h1 {
    font-size: 32px;
    line-height: 1.5;
    letter-spacing: 0.01em;
  }
  h2 {
    font-size: 24px;
    line-height: 1.5;
  }
  h3 {
    font-size: 17px;
    font-weight: 500;
  }
  p {
    line-height: 1.85;
  }
  .brandbar {
    height: 86px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5vw;
    border-bottom: 1px solid var(--line);
    gap: 20px;
  }
  .brandbar img {
    width: 196px;
    display: block;
  }
  .brandbar > span {
    font-size: 12px;
    white-space: nowrap;
  }
  .badge {
    font-family: var(--sans);
    display: inline-block;
    vertical-align: middle;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.6;
    padding: 2px 6px;
    color: #655d50;
    border: 1px solid #cfc1ae;
    border-radius: 4px;
    letter-spacing: 0.02em;
  }
  .workspace {
    max-width: 1440px;
    margin: auto;
    display: grid;
    grid-template-columns: 55% 45%;
    min-height: calc(100vh - 140px);
  }
  #chat {
    padding: 38px clamp(28px, 4.2vw, 64px) 54px;
    background: #fcf9f3;
    min-width: 0;
  }
  #preview {
    padding: 38px 42px 24px;
    border-left: 1px solid var(--line);
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow: auto;
    min-height: calc(100vh - 86px);
  }
  .chapter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 30px;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
  }
  .soft {
    color: var(--muted);
    font-size: 13px;
  }
  .assistant-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 16px;
  }
  .seal {
    font-family: var(--serif);
    width: 26px;
    height: 26px;
    display: grid;
    place-content: center;
    background: var(--primary);
    color: white;
    border-radius: 5px;
  }
  .bubble {
    padding: 0 0 20px;
  }
  .bubble p {
    color: var(--muted);
    font-size: 15px;
    margin-top: 14px;
    max-width: 38em;
  }
  .assistant {
    scroll-margin-top: 24px;
  }
  .choices {
    display: grid;
    gap: 10px;
    margin-top: 8px;
    grid-template-columns: 1fr 1fr;
  }
  .choice {
    display: flex;
    text-align: left;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    border: 1px solid var(--line);
    background: var(--white);
    border-radius: 12px;
    padding: 16px 18px;
    min-height: 82px;
    transition:
      border-color 0.15s,
      background 0.15s;
  }
  .choice:hover {
    border-color: #b5a08a;
    background: #f6eee3;
  }
  .choice strong {
    font-weight: 500;
    font-size: 16px;
  }
  .choice span {
    font-size: 12px;
    line-height: 1.7;
    color: var(--muted);
  }
  .paths {
    grid-template-columns: 1fr;
  }
  .paths .choice {
    position: relative;
    padding-right: 40px;
    min-height: 72px;
  }
  .paths .choice::after {
    content: "↗";
    position: absolute;
    right: 18px;
    color: #9d8b78;
  }
  .paths .choice:last-child {
    background: transparent;
    border-style: dashed;
  }
  .kids .choice {
    min-height: 62px;
  }
  .history {
    margin-bottom: 28px;
  }
  .history details {
    margin-bottom: 20px;
    font-size: 12px;
    color: var(--muted);
  }
  summary {
    cursor: pointer;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  summary::before {
    content: "＋";
  }
  .history details[open] summary::before {
    content: "−";
  }
  .exchange {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin: 12px 0;
    gap: 5px;
  }
  .asked {
    font-size: 12px;
    color: var(--muted);
    align-self: flex-start;
  }
  .answer {
    min-height: 40px;
    border-radius: 12px 12px 3px 12px;
    background: #eae5d9;
    padding: 8px 14px;
    text-align: left;
    max-width: 92%;
    font-size: 14px;
  }
  .answer:disabled {
    opacity: 1;
  }
  .gentle-actions {
    display: flex;
    justify-content: space-between;
    margin: 18px 0 0;
  }
  .text-button {
    font-size: 14px;
    padding: 8px 10px;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: #c5b8a7;
  }
  .primary {
    background: var(--primary);
    color: white;
    border-radius: 10px;
    padding: 12px 22px;
    font-weight: 500;
    min-height: 48px;
  }
  .primary:hover {
    background: #974428;
  }
  .secondary {
    background: var(--white);
    border: 1px solid #bcae9a;
    border-radius: 10px;
    padding: 9px 16px;
    font-size: 14px;
  }
  .wide {
    width: 100%;
    margin-top: 20px;
  }
  .free-entry {
    padding: 20px;
    border: 1px solid var(--line);
    background: var(--white);
    border-radius: 12px;
  }
  .entry-chooser {
    padding: 20px;
    border: 1px solid var(--line);
    background: var(--white);
    border-radius: 12px;
  }
  .entry-chooser h2 {
    margin: 6px 0 8px;
    font-size: 22px;
    font-weight: 500;
  }
  .entry-chooser p {
    color: var(--muted);
    font-size: 14px;
  }
  .mode-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 14px 0 4px;
  }
  .composer-toggle {
    display: block;
    margin-top: 12px;
    padding: 8px 0;
    min-height: 44px;
    color: var(--muted);
    font-size: 14px;
    text-align: left;
    text-decoration: underline;
    text-underline-offset: 4px;
  }
  .choices .custom-choice {
    grid-column: 1 / -1;
  }
  .paths .custom-choice {
    background: transparent;
    border-style: dashed;
  }
  .free-entry label,
  dialog label {
    display: block;
    font-size: 14px;
    margin-bottom: 10px;
  }
  input,
  textarea {
    display: block;
    width: 100%;
    border: 1px solid #aa9a87;
    border-radius: 8px;
    background: white;
    color: var(--ink);
    padding: 13px;
    font-size: 16px;
    min-height: 52px;
  }
  textarea {
    resize: vertical;
    line-height: 1.8;
  }
  .input-hint {
    color: var(--muted);
    font-size: 12px;
    margin-top: 10px;
  }
  .entry-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
    margin-top: 18px;
  }
  .error {
    color: #8e361f;
    font-size: 14px;
    margin-top: 12px;
  }
  .understanding {
    background: #efe9db;
    border: 1px solid #d2c5b0;
    padding: 24px;
    border-radius: 14px;
  }
  .understanding h2 {
    margin: 14px 0;
    font-size: 23px;
  }
  .understanding h2 strong {
    font-weight: 500;
    color: #7d3e28;
  }
  .understanding p {
    font-size: 13px;
    color: var(--muted);
  }
  .eyebrow {
    font-size: 11px;
    letter-spacing: 0.1em;
    color: var(--muted);
  }
  .preview-head h2 {
    font-size: 24px;
    margin-top: 8px;
  }
  .preview-head {
    border-bottom: 1px solid #d9cebd;
    padding-bottom: 22px;
  }
  .empty-preview {
    position: relative;
    text-align: center;
    padding: 64px 20px 30px;
  }
  .paper-envelope {
    width: 160px;
    height: 105px;
    background: #fffdf7;
    box-shadow: 0 12px 28px #56402712;
    border: 1px solid #d3c5b2;
    border-radius: 3px;
    transform: rotate(-6deg);
    margin: 0 auto 44px;
    display: grid;
    place-content: center;
    font-family: var(--serif);
    color: #a8664b;
    font-size: 22px;
    background-image:
      linear-gradient(32deg, transparent 49.5%, #e6d8c6 50%, transparent 50.5%),
      linear-gradient(-32deg, transparent 49.5%, #e6d8c6 50%, transparent 50.5%);
  }
  .empty-preview h3 {
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1.8;
  }
  .empty-preview p {
    font-size: 13px;
    color: var(--muted);
    margin-top: 14px;
  }
  .track-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 26px 0;
  }
  .track-head h3 {
    font-family: var(--serif);
    font-size: 25px;
  }
  .track-head p {
    font-size: 13px;
    color: var(--muted);
  }
  .track-initial {
    border: 1px solid #c8bba7;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: grid;
    place-content: center;
    font-family: var(--serif);
    color: var(--primary);
    background: #fbf6ed;
  }
  .preview-timeline {
    margin-left: 12px;
    padding-left: 28px;
    border-left: 1px solid #c6b69f;
  }
  .timeline-node {
    position: relative;
    padding: 5px 0 27px;
  }
  .dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    left: -34px;
    top: 14px;
    outline: 5px solid var(--paper);
  }
  .gift-dot {
    border-radius: 2px;
    background: #6f7a5c;
  }
  .timeline-node p {
    font-size: 13px;
    color: var(--muted);
    margin-top: 6px;
  }
  .timeline-node h3 {
    font-size: 16px;
    margin-top: 5px;
  }
  .timeline-node.muted {
    color: #776c5e;
  }
  .muted .dot {
    background: #c6b9a5;
  }
  .node-date,
  .node-state {
    font-size: 11px;
    color: var(--muted);
  }
  .node-state {
    display: block;
    margin-top: 10px;
  }
  .preview-total {
    border-top: 1px solid var(--line);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .preview-total small {
    font-size: 12px;
    color: var(--muted);
  }
  .year-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #d5c6b2;
    border-radius: 10px;
    margin-bottom: 30px;
    background: #fcf8f0;
  }
  .year-nav small {
    font-size: 11px;
    color: var(--muted);
  }
  .icon-button {
    width: 44px;
    font-size: 19px;
  }
  .pending-note {
    font-size: 12px;
    margin-bottom: 18px;
    color: #77674e;
  }
  .plan-summary {
    border-block: 1px solid var(--line);
    padding: 16px 0;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 12px 0 24px;
    align-items: center;
  }
  .plan-summary span {
    font-size: 12px;
    color: var(--muted);
  }
  .section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 28px 0 14px;
  }
  .section-title h2 {
    font-size: 20px;
  }
  .section-title > span {
    font-size: 11px;
    color: var(--muted);
  }
  .plan-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 13px;
    overflow: hidden;
    margin-bottom: 14px;
  }
  .card-copy {
    padding: 22px;
  }
  .card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 13px;
  }
  .card-copy h3 {
    font-family: var(--serif);
    font-size: 22px;
    margin-bottom: 14px;
  }
  .card-copy p {
    font-size: 14px;
    white-space: pre-line;
  }
  .card-actions {
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    margin-top: 18px;
    padding-top: 12px;
  }
  .accepted {
    border-radius: 8px;
    background: #e6e8db;
    color: #414936;
    padding: 8px 12px;
    font-size: 13px;
  }
  .card-actions .text-button {
    font-size: 12px;
  }
  .excluded {
    opacity: 0.65;
  }
  .excluded h3 {
    text-decoration: line-through;
  }
  .gift-visual {
    height: 160px;
    background: #e4d6c5;
    overflow: hidden;
  }
  .gift-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 60%;
  }
  .gift-visual.card img {
    object-position: 80% 80%;
    transform: scale(1.15);
  }
  .gift-visual.audio {
    background: #dedfd5;
    position: relative;
  }
  .gift-visual.audio img {
    opacity: 0.25;
  }
  .gift-visual.audio::after {
    content: "聲音，也是一份心意";
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    color: #404936;
    font-family: var(--serif);
    font-size: 21px;
  }
  .quiet-policy {
    font-size: 12px;
    color: var(--muted);
    margin-top: 22px;
    padding-left: 14px;
    border-left: 2px solid #c7b69e;
  }
  .review-card {
    border: 1px solid var(--line);
    background: var(--white);
    border-radius: 14px;
    padding: 28px;
    margin-top: 18px;
  }
  .review-card h2 {
    margin-top: 8px;
  }
  .review-card p {
    font-size: 13px;
    color: var(--muted);
  }
  .review-numbers {
    display: flex;
    gap: 50px;
    padding: 26px 0;
  }
  .review-numbers div {
    display: flex;
    flex-direction: column;
  }
  .review-numbers strong {
    font-family: var(--serif);
    font-size: 40px;
    font-weight: 400;
  }
  .review-numbers span {
    font-size: 12px;
    color: var(--muted);
  }
  .demo-switch {
    margin-top: 30px;
    color: var(--muted);
    font-size: 12px;
  }
  .demo-switch nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .demo-switch a {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    text-decoration: none;
  }
  .demo-switch p {
    margin-top: 10px;
  }
  .footnote {
    max-width: 1440px;
    padding: 14px 5vw;
    font-size: 11px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    margin: auto;
  }
  .dock {
    display: none;
  }
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  dialog {
    border: 1px solid #cfc0ab;
    border-radius: 18px;
    width: min(620px, calc(100% - 32px));
    max-height: 90dvh;
    padding: 28px;
    background: var(--white);
    color: var(--ink);
  }
  dialog::backdrop {
    background: #2b262277;
  }
  .dialog-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
  }
  .dialog-head h2 {
    font-size: 24px;
  }
  dialog .soft {
    margin-bottom: 24px;
  }
  .mini-chips {
    display: flex;
    gap: 8px;
    margin: 14px 0;
  }
  #rewrite-result {
    margin-top: 20px;
  }
  .sheet {
    background: var(--paper);
    margin: auto auto 0;
    max-width: 600px;
    max-height: 88dvh;
    border-radius: 22px 22px 0 0;
    border-bottom: 0;
    padding: 24px;
    width: 100%;
  }
  .sheet-close {
    display: block;
    margin: 0 0 12px auto;
    text-decoration: underline;
    font-size: 14px;
  }
  .sheet .preview-head {
    padding-bottom: 18px;
  }
  @media (max-width: 899px) {
    html {
      scroll-padding-bottom: calc(176px + env(safe-area-inset-bottom));
    }
    .brandbar {
      height: 68px;
      padding: 0 22px;
    }
    .brandbar img {
      width: 164px;
    }
    .brandbar > span {
      font-size: 10px;
    }
    .workspace {
      display: block;
      min-height: calc(100dvh - 160px);
    }
    #chat {
      padding: 24px 22px 35px;
    }
    #preview {
      display: none;
    }
    h1 {
      font-size: 27px;
    }
    .chapter {
      margin-bottom: 24px;
      font-size: 12px;
      flex-wrap: wrap;
    }
    .chapter .soft {
      font-size: 11px;
    }
    .assistant-label {
      margin-bottom: 14px;
    }
    .bubble p {
      font-size: 14px;
      margin-top: 10px;
    }
    .bubble {
      padding-bottom: 18px;
    }
    .choice {
      padding: 14px;
      min-height: 76px;
    }
    .choice strong {
      font-size: 15px;
    }
    .choice span {
      font-size: 12px;
    }
    .choices {
      gap: 9px;
      grid-template-columns: 1fr;
    }
    .choices.kids {
      grid-template-columns: 1fr 1fr;
    }
    .choices.kids .choice {
      min-height: 58px;
      padding: 12px;
    }
    .choices.kids .choice:last-child {
      min-height: 72px;
    }
    .paths .choice {
      min-height: 76px;
    }
    .history {
      margin-bottom: 22px;
    }
    .history .exchange {
      margin: 9px 0;
    }
    .history details {
      margin-bottom: 8px;
    }
    .asked {
      font-size: 11px;
      max-width: 95%;
    }
    .answer {
      font-size: 13px;
    }
    .understanding {
      padding: 20px;
    }
    .understanding h2 {
      font-size: 22px;
    }
    .understanding .entry-actions {
      justify-content: space-between;
    }
    .understanding .primary {
      padding: 12px 17px;
    }
    .entry-actions {
      flex-wrap: wrap;
    }
    .free-entry {
      padding: 16px;
    }
    .dock {
      position: sticky;
      bottom: 0;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 10px;
      padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
      background: #fffdf8f7;
      backdrop-filter: blur(12px);
      border-top: 1px solid var(--line);
      z-index: 5;
    }
    .dock .primary {
      font-size: 13px;
      padding: 11px 15px;
      min-height: 46px;
    }
    .preview-trigger {
      font-size: 14px;
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 0;
    }
    .dock-dot {
      width: 7px;
      height: 7px;
      background: var(--primary);
      border-radius: 50%;
    }
    .dock-caption {
      font-size: 10px;
      color: var(--muted);
    }
    .footnote {
      padding: 12px 22px 26px;
    }
    .card-copy {
      padding: 18px;
    }
    .card-copy h3 {
      font-size: 20px;
    }
    .card-copy p {
      font-size: 14px;
    }
    .section-title h2 {
      font-size: 19px;
    }
    .gift-visual {
      height: 144px;
    }
    .review-card {
      padding: 22px;
    }
    .review-numbers {
      gap: 40px;
    }
    .empty-preview {
      padding: 35px 15px;
    }
    .sheet .preview-timeline {
      margin-bottom: 12px;
    }
    dialog {
      padding: 22px 18px;
    }
    .dialog-head h2 {
      font-size: 22px;
    }
    .quiet-policy {
      font-size: 12px;
    }
    .plan-summary {
      align-items: flex-start;
    }
    .plan-summary span {
      text-align: right;
    }
    .demo-switch {
      margin-top: 24px;
    }
  }
  @media (prefers-reduced-motion: reduce) {
    html {
      scroll-behavior: auto;
    }
    * {
      transition: none !important;
    }
  }
  .letter-full {
    white-space: pre-line;
    margin-top: 20px;
    font-size: 16px;
    line-height: 1.9;
  }
  .read-letter {
    font-size: 12px;
    padding-left: 0;
    margin-top: 6px;
  }
  @media (max-width: 899px) {
    .paths .choice {
      min-height: 68px;
      padding-top: 11px;
      padding-bottom: 11px;
    }
    .paths {
      gap: 8px;
    }
    .paths .choice span {
      font-size: 11px;
    }
    .paths .choice strong {
      font-size: 15px;
    }
  }
}
#assistant-host .workspace {
  min-height: 0;
  max-width: none;
}
#assistant-host #chat {
  padding: 22px 26px 40px;
  background: #fcf9f3;
}
#assistant-host #preview {
  min-height: 0;
  top: 150px;
  max-height: calc(100dvh - 260px);
  padding: 22px 28px;
}
#assistant-host .assistant {
  scroll-margin-top: 142px;
}
#assistant-host .chapter {
  margin-bottom: 20px;
}
#assistant-host .paths .choice {
  min-height: 72px;
}
#assistant-host h1 {
  font-size: 28px;
}
#assistant-host .history {
  margin-bottom: 20px;
}
#assistant-host .dock {
  z-index: 20;
}
@media (max-width: 899px) {
  #assistant-host #chat {
    padding: 20px 18px calc(176px + env(safe-area-inset-bottom));
    scroll-padding-bottom: calc(176px + env(safe-area-inset-bottom));
  }
  #assistant-host h1 {
    font-size: 24px;
  }
  #assistant-host .dock {
    position: fixed;
    bottom: calc(80px + env(safe-area-inset-bottom));
    left: 0;
    right: 0;
    width: 100%;
    padding: 10px 18px;
    border-bottom: 1px solid var(--line);
  }
  #assistant-host .assistant {
    scroll-margin-top: 132px;
  }
  #assistant-host .choices {
    gap: 8px;
  }
  #assistant-host .choices.binary,
  #assistant-host .choices.multi {
    grid-template-columns: 1fr;
  }
}
#assistant-host .choices.binary,
#assistant-host .choices.multi {
  grid-template-columns: 1fr;
  gap: 12px;
}
#assistant-host .choices.binary .choice {
  min-height: 104px;
  border-radius: 18px;
  padding: 22px 20px;
}
#assistant-host .choices.binary .choice strong {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.45;
}
#assistant-host .choice.picked {
  border-color: var(--primary);
  background: #f6eee3;
}
#assistant-host .multi-label {
  margin: 8px 0 0;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
#assistant-host .own-words {
  margin-top: 18px;
}
#assistant-host .own-words summary {
  color: var(--muted);
  font-size: 14px;
}
#assistant-host .understanding h2 {
  font-size: 28px;
  margin-bottom: 8px;
}
#assistant-host .confirm-multi,
#assistant-host .primary.wide {
  margin-top: 14px;
}
