:root {
  color-scheme: light;
  --ink: #1f211e;
  --secondary: #65645c;
  --page: #f5f3ef;
  --paper: #fffefb;
  --line: #ded9d0;
  --dark: #20221e;
  --radius: 16px;
  --serif: 'Songti SC', 'Noto Serif SC', 'STSong', Georgia, serif;
  --sans: Inter, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); font-size: 16px; background: var(--page); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, textarea:focus-visible, .upload label:focus-within { outline: 2px solid #a36c2b; outline-offset: 3px; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 600; }
p { line-height: 1.65; }
small { font-size: .82rem; }
.photo { height: 100%; width: 100%; display: block; object-fit: cover; }
.photo.tailored { object-position: 75% 23%; }
.photo.casual { object-position: center 25%; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-family: Georgia, serif; font-size: 1.35rem; letter-spacing: .10em; line-height: 1; font-weight: 600; }
.brand small { display: block; margin-top: 5px; font-family: var(--sans); font-weight: 600; font-size: .59rem; letter-spacing: .25em; }
.brand-mark { width: 22px; height: 22px; display: block; border: 1px solid #dabc92; transform: rotate(45deg); position: relative; margin-inline: 4px; }
.brand-mark::before, .brand-mark::after { content: ''; position: absolute; inset: 4px; border: 1px solid #dabc92; }
.brand-mark::after { inset: 9px; background: #dabc92; }
.btn { min-height: 44px; padding: 10px 17px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 8px; font-weight: 600; font-size: .9rem; line-height: 1.3; white-space: nowrap; background: transparent; color: inherit; transition: background-color .18s, border-color .18s; }
.btn.small { min-height: 36px; padding: 7px 12px; }
.btn.full { width: 100%; }
.btn.dark { background: var(--dark); color: #fffaf1; }
.btn.dark:hover { background: #3b3f36; }
.btn.outline { border-color: #d5cec2; background: #fffdf74a; }
.btn.outline:hover, .btn.quiet:hover { background: #a998801c; }
.sidebar .quiet { border-color: #f0e4ce29; color: #e6dfd0; }
.sidebar .quiet:hover { background: #ffffff12; }
.actions, .button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.eyebrow { color: #755737; font-size: .76rem; font-weight: 700; letter-spacing: .15em; margin-bottom: 12px; line-height: 1.4; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 25px; }
.page-heading h1 { font-family: var(--serif); font-size: clamp(2.25rem, 4.9vw, 4.1rem); line-height: 1.08; }
.page-heading p:last-child { margin-top: 10px; color: var(--secondary); }
.page-heading .eyebrow { margin-top: 0; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel h2 { font-size: 1.22rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.section-heading p { color: var(--secondary); font-size: .86rem; margin-top: 4px; }
.stage-canvas { position: absolute; inset: 0; touch-action: none; cursor: grab; }
.stage-canvas:active { cursor: grabbing; }
.stage-canvas canvas { display: block; width: 100%; height: 100%; }
.stage-fallback, .fallback-note { display: none; }
.loading-note { display: none; }
.rin-canvas[data-state="loading"] .loading-note { display: grid; position: absolute; inset: 0; place-items: center; color: #efe3cf; pointer-events: none; }
.rin-canvas[data-state="fallback"] canvas { display: none; }
.rin-canvas[data-state="fallback"] .stage-fallback { object-fit: contain; }
[data-state="fallback"] .stage-fallback { display: block; opacity: .8; }
[data-state="fallback"] .fallback-note, .asset-preview-label { display: block; position: absolute; bottom: 14px; left: 14px; font-size: .8rem; background: #25231fb5; padding: 5px 8px; border-radius: 5px; color: #fff2dc; }
.asset-3d [data-state="fallback"] .fallback-note { bottom: 50px; }
.pill { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 6px 11px; border: 1px solid #dcd6cc; border-radius: 8px; background: var(--paper); color: var(--ink); font-size: .88rem; white-space: nowrap; }
.pill:hover { border-color: #a78760; }
.pill[aria-pressed="true"] { border-color: #9d784e; color: #5b4127; background: #f2e5d1; }
.bubble { width: fit-content; max-width: 90%; margin-bottom: 10px; padding: 10px 13px; border-radius: 12px; line-height: 1.55; font-size: .93rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble.character { background: #f1ede5; border-bottom-left-radius: 3px; }
.bubble.user { background: #33372f; color: #fcf5e7; border-bottom-right-radius: 3px; margin-left: auto; }
.typing { color: #686256; }
.effect { font-size: .79rem; color: #765438; margin: -5px 0 10px 1px; }
.message-form { display: flex; gap: 8px; align-items: stretch; }
.message-form input { flex: 1; min-width: 0; }
.fine { color: var(--secondary); font-size: .83rem; }
input:not([type="checkbox"], [type="file"]), textarea { min-height: 42px; border: 1px solid #d8d1c5; border-radius: 8px; padding: 9px 11px; color: var(--ink); background: #fffefa; }
input[readonly] { background: #efede7; }
textarea { resize: vertical; }
.text-link { display: inline-block; color: #73512e; background: none; border: 0; padding: 0; margin: 0 0 11px; text-decoration: underline; text-underline-offset: 3px; font-size: .86rem; }
.candidate.selected { border-color: #956b3d; box-shadow: 0 0 0 1px #956b3d; }
.form-panel, .agent-preview { padding: clamp(16px, 2.4vw, 28px); align-self: start; }
fieldset { border: 0; margin: 0 0 16px; padding: 0; min-width: 0; }
legend { font-weight: 600; font-size: .95rem; margin-bottom: 8px; }
.chip { display: inline-block; background: #eeebe2; color: #585447; border-radius: 30px; padding: 5px 9px; font-size: .79rem; white-space: nowrap; line-height: 1.3; }
.chip.good { background: #e6ecdf; color: #3b5433; }
.chip.warm { background: #f1e3d1; color: #79512b; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin: 15px 0; }
.fields label { display: grid; align-content: start; gap: 6px; min-width: 0; font-weight: 600; font-size: .88rem; }
.fields .wide { grid-column: 1 / -1; }
.fields label input, .fields label textarea { font-weight: 400; width: 100%; }
.form-subtitle { margin-top: 23px; }
.version small { display: block; color: var(--secondary); margin-top: 4px; }
.console-shell { display: grid; grid-template-columns: 214px minmax(0, 1fr); min-height: 100svh; }
.sidebar { position: sticky; top: 0; height: 100svh; background: #22241f; color: #f6f0e2; display: flex; flex-direction: column; padding: 23px 17px; }
.sidebar .brand { margin-left: 5px; margin-bottom: 44px; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; min-height: 43px; padding: 8px 11px; border-radius: 8px; color: #dfd9cc; font-size: .93rem; }
.sidebar nav a span { width: 18px; text-align: center; color: #ddc197; font-size: 1.12rem; }
.sidebar nav a:hover, .sidebar nav a[aria-current] { background: #3b3f33; color: #fff8e9; }
.side-preview { margin-top: auto; }
.console-bar { min-height: 65px; padding: 12px clamp(18px, 3.5vw, 48px); display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); background: #fffdf7; color: var(--secondary); font-size: .9rem; }
.console-content { padding: 30px clamp(18px, 3.5vw, 48px) 44px; max-width: 1460px; margin: 0 auto; }
.console-content .page-heading h1 { font-family: var(--sans); font-size: clamp(1.8rem, 3.5vw, 2.7rem); letter-spacing: -.035em; }
.pipeline, .agent-grid, .release-grid { display: grid; grid-template-columns: minmax(180px, .38fr) minmax(0, 1fr); gap: 18px; }
.agent-grid { grid-template-columns: minmax(0, 1.25fr) minmax(270px, .85fr); }
.release-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pipeline-steps, .asset-panel { padding: 20px; }
.pipeline-steps { align-self: start; }
.pipeline-steps ol { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 16px; }
.pipeline-steps li { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--secondary); }
.pipeline-steps li > span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none; border: 1px solid #ddd7cb; background: #f5f3ec; font: 600 .78rem var(--sans); }
.pipeline-steps li.active { color: #6e4d2d; }
.pipeline-steps li.active > span { background: #e9d2ad; border-color: #d5b28b; }
.pipeline-steps li.done > span { background: #e9eddf; color: #3b5433; }
.pipeline-steps small { display: block; margin-top: 3px; }
.upload, .source-image, .asset-3d, .candidate-grid { margin-top: 16px; border-radius: 12px; overflow: hidden; }
.upload { min-height: 328px; display: grid; justify-items: center; align-content: center; gap: 11px; padding: 20px; text-align: center; border: 1px dashed #c4b7a4; background: #f7f4ed; }
.upload p { color: var(--secondary); }
.upload .actions { justify-content: center; }
.upload-icon { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid #ddcdb5; background: #f0e5d4; border-radius: 11px; font-size: 1.38rem; color: #755737; }
.upload label { cursor: pointer; position: relative; overflow: hidden; }
.upload label input { position: absolute; width: 100%; height: 100%; inset: 0; opacity: 0; cursor: pointer; }
.source-image { height: 328px; position: relative; background: #eeeadf; }
.source-image img { object-fit: contain; }
.source-image span { position: absolute; bottom: 12px; left: 12px; max-width: 90%; overflow-wrap: anywhere; background: #fffef1; padding: 5px 8px; border-radius: 5px; font-size: .86rem; }
.asset-3d { height: 345px; position: relative; background: radial-gradient(ellipse, #756c5b, #252620); }
.asset-preview-actions { margin-top: 10px; }
.candidate-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; padding: 2px; }
.candidate { border: 1px solid var(--line); background: #f9f6f0; color: var(--ink); border-radius: 10px; padding: 0; overflow: hidden; }
.candidate .photo { height: 234px; }
.candidate span { display: block; padding: 8px; }
.panel-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 16px; }
.panel-actions > :last-child { margin-left: auto; }
.checks { display: flex; flex-wrap: wrap; gap: 12px; }
.checks label { display: flex; align-items: center; gap: 5px; font-size: .91rem; }
input[type="checkbox"] { accent-color: #715536; height: 16px; width: 16px; }
.test-log { height: 307px; margin: 15px 0; overflow-y: auto; background: #f7f4ec; border-radius: 9px; padding: 12px; }
.checklist { list-style: none; padding: 0; margin: 15px 0; }
.checklist li { display: flex; gap: 10px; align-items: start; padding: 11px 0; border-bottom: 1px solid var(--line); }
.checklist li span { color: #446239; }
.checklist small { display: block; color: var(--secondary); margin-top: 4px; }
.version { min-height: 63px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.order-stack { display: grid; gap: 15px; }
.order-stack .message-form, .order-stack p, .order-stack .text-link { margin-top: 14px; }
.scroll-table { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; margin-top: 12px; white-space: nowrap; font-size: .9rem; }
td, th { padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { font-weight: 600; color: var(--secondary); }
#toast { position: fixed; left: 50%; bottom: 18px; z-index: 5; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; max-width: 90vw; background: #22241f; color: #fbf5e8; padding: 9px 15px; border-radius: 8px; box-shadow: 0 4px 20px #0003; transition: transform .15s, opacity .15s; }
#toast.visible { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 1000px) {
  .console-shell { grid-template-columns: 170px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .console-content { padding-inline: 20px; }
}
@media (max-width: 780px) {
  .agent-grid { grid-template-columns: minmax(0, 1fr); }
  .console-shell { display: block; }
  .sidebar { position: static; height: auto; display: grid; grid-template-columns: 1fr auto; gap: 15px; padding: 14px 16px 10px; }
  .sidebar .brand { margin: 0; }
  .sidebar nav { grid-column: 1 / -1; grid-row: 2; display: flex; overflow-x: auto; }
  .sidebar nav a { white-space: nowrap; min-height: 40px; }
  .side-preview { margin: 0; min-height: 38px; }
  .console-bar { min-height: 49px; }
}
@media (max-width: 540px) {
  .pipeline, .release-grid { grid-template-columns: minmax(0, 1fr); }
  .fields { grid-template-columns: minmax(0, 1fr); }
  .pipeline-steps ol { display: flex; gap: 12px; overflow-x: auto; }
  .pipeline-steps li { flex-direction: column; white-space: nowrap; text-align: center; }
  .pipeline-steps small { display: none; }
  .candidate .photo { height: 180px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}
