* { box-sizing: border-box; }
:root { color-scheme: light; --paper: #f5eee7; --ink: #443d48; --muted: #857580; --line: #e0d4d7; --rose: #9a5969; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; line-height: 1.65; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { min-height: 44px; border: 1px solid #d4c2c8; border-radius: 11px; color: var(--ink); background: #fffaf4; padding: 9px 12px; font-weight: 650; cursor: pointer; touch-action: manipulation; }
button:hover:not(:disabled) { background: #f4e8e6; border-color: #b38693; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #c48c43; outline-offset: 3px; }
[hidden] { display: none !important; }
.page { max-width: 1120px; margin: auto; padding: 22px 30px 0; }
.site-header { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.back-home { display: inline-flex; align-items: center; min-height: 44px; color: #79616d; font-size: 13px; text-underline-offset: 4px; }
.studio-mark { color: #92747e; white-space: nowrap; font-size: 11px; letter-spacing: .5px; }
.studio-mark span { color: #b47c7b; font-size: 21px; vertical-align: middle; }
.hero { padding: 34px 0 25px; }
.eyebrow { margin: 0 0 7px; color: #a07b85; font-weight: 750; letter-spacing: 2px; font-size: 10px; }
h1 { margin: 0 0 13px; font-size: clamp(33px, 5vw, 50px); line-height: 1.25; letter-spacing: 1px; }
h1 > span { color: #c18f6b; }
.lead { margin: 0; color: #8a7480; line-height: 1.9; font-size: 15px; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 17px; }
.hero-tags span { background: #ecdfe0; padding: 4px 9px; border-radius: 5px; color: #936e79; font-size: 11px; }
.notice { margin: 0 0 12px; padding: 12px 15px; border: 1px solid #dbc090; border-radius: 11px; color: #795e32; background: #fff6df; font-size: 12px; }
.notice p { margin: 3px 0; }
.atelier-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .86fr); gap: 22px; align-items: start; }
.panel { min-width: 0; padding: 23px; border: 1px solid var(--line); border-radius: 20px; background: #fffaf5; box-shadow: 0 5px 0 #e9dfe0; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 18px; }
h2 { margin: 0; font-size: 20px; line-height: 1.4; }
h3 { margin: 0; font-size: 12px; }
.thread-mark { font-size: 40px; line-height: 1; color: #c9a9ad; transform: rotate(-20deg); }
.canvas-meta { display: flex; justify-content: space-between; gap: 6px; margin: 0 2px 11px; color: #987d87; font-size: 11px; }
.canvas-meta b { font-size: 17px; font-weight: 750; color: var(--rose); }
.board { display: grid; grid-template-columns: repeat(8, minmax(32px, 1fr)); gap: 2px; width: 100%; padding: 5px; border: 1px solid #cdbac0; border-radius: 10px; background: #e1d6d1; }
.cell { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; min-width: 32px; min-height: 32px; aspect-ratio: 1; padding: 0; border-radius: 2px; border: 1px solid #d9cec3; background: var(--pixel-color); }
.cell:hover:not(:disabled) { background: var(--pixel-color); border-color: #8c6778; }
.cell[data-active="true"] { box-shadow: inset 0 0 0 2px #b1848d; }
.cell:focus-visible { z-index: 1; outline-offset: -3px; }
.empty-dot { width: 3px; height: 3px; border-radius: 50%; background: #c4bbae; pointer-events: none; }
.cell[data-color="7"] { border-color: #baaf9e; }
.tool-caption { margin: 10px 2px 13px; min-height: 20px; color: #946a7a; font-size: 11px; }
.tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.tools button { padding: 9px 3px; font-size: 12px; background: #f9eeec; }
.tools button span { margin-right: 3px; }
.tools button[aria-pressed="true"] { background: #ecd9dc; color: #874e60; border-color: #ad7b8d; box-shadow: inset 0 0 0 1px #ad7b8d; }
.tool-help { margin: 9px 2px 16px; color: #a68c95; font-size: 10px; }
.palette-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: #8d6d79; }
.palette-heading > span { color: #aa9197; font-size: 9px; }
.palette { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.color-choice { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; padding: 7px 3px; font-size: 11px; }
.color-choice[aria-pressed="true"] { border-color: #ae7c8e; box-shadow: inset 0 0 0 1px #ae7c8e; background: #f4e7e8; }
.color-chip { position: relative; display: block; width: 21px; height: 21px; flex-shrink: 0; border: 1px solid #c3b6ac; border-radius: 5px; background: var(--pixel-color); }
.color-chip.empty-chip::after { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: #b4aa9c; left: 8px; top: 8px; content: ""; }
.history-actions { display: grid; grid-template-columns: 1fr 1fr 1.45fr; gap: 7px; margin-top: 14px; }
.history-actions button { min-width: 0; padding: 9px 3px; font-size: 11px; }
.history-actions span { margin-left: 2px; color: #a87c8c; font-family: ui-monospace, monospace; }
.live-status { min-height: 44px; margin: 13px 2px 0; color: #8c6475; font-size: 12px; }
.save-note { margin: 10px 2px 0; color: #a49094; font-size: 10px; }
.side-stack { display: grid; gap: 21px; }
.preview-tag { font-family: ui-monospace, monospace; color: #b2999c; font-size: 12px; }
.patch-wrap { position: relative; padding: 17px 25px 30px; max-width: 310px; margin: 3px auto 0; }
.patch-frame { position: relative; z-index: 1; padding: 12px; border: 2px dashed #c2a6a9; border-radius: 28px; background: #f4e8df; box-shadow: 0 4px 0 #d9c6bf; }
.preview-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); width: 100%; aspect-ratio: 1; border: 1px solid #ded2c6; overflow: hidden; border-radius: 10px; }
.preview-cell { display: block; aspect-ratio: 1; min-width: 0; background: var(--pixel-color); }
.preview-cell[data-color="0"] { background-image: radial-gradient(#c8beae 1px, transparent 1px); background-size: 8px 8px; }
.patch-shadow { position: absolute; height: 15px; width: 65%; left: 17.5%; bottom: 8px; background: #e4d6ce; border-radius: 50%; filter: blur(5px); }
.preview-note { text-align: center; margin: 3px 0 15px; color: #aa9199; font-size: 10px; }
.creation-actions { display: grid; gap: 8px; }
.creation-actions button { width: 100%; font-size: 12px; }
.primary { background: var(--rose); border-color: var(--rose); color: #fff9f1; }
.primary:hover:not(:disabled) { background: #85495d; border-color: #85495d; }
.small-note { color: #a28c93; font-size: 10px; line-height: 1.9; }
.templates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 13px; }
.template-button { display: flex; align-items: center; flex-direction: column; justify-content: center; gap: 9px; min-width: 0; padding: 10px 4px; font-size: 11px; border-color: #e1d1d4; }
.template-preview { width: min(100%, 56px); display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); aspect-ratio: 1; border: 1px solid #dfd5ca; }
.template-cell, .mini-cell { display: block; aspect-ratio: 1; min-width: 0; background: var(--pixel-color); }
.template-cell[data-color="0"], .mini-cell[data-color="0"] { background-image: radial-gradient(#c4baaa .7px, transparent .7px); background-size: 5px 5px; }
.collection-panel { margin-top: 25px; }
.count { white-space: nowrap; font-size: 11px; color: #a18490; }
.collection-note { color: #a48a94; font-size: 10px; margin: -3px 0 17px; }
.collection { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.empty-collection { grid-column: 1 / -1; color: #b59aa3; font-size: 12px; text-align: center; padding: 25px 0 31px; margin: 0; }
.collection-item { min-width: 0; border: 1px solid #e5d6d8; padding: 12px; border-radius: 13px; background: #fcf4ee; }
.open-patch { display: flex; width: 100%; flex-direction: column; align-items: center; gap: 9px; min-width: 0; padding: 10px 5px; font-size: 12px; border-color: #dfcbd1; }
.mini-grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); width: min(100%, 88px); aspect-ratio: 1; border: 1px solid #ded3c6; }
.collection-date { margin: 8px 0; font-size: 9px; line-height: 1.7; color: #ab9098; text-align: center; }
.delete-patch { width: 100%; min-width: 0; padding: 8px 4px; border-color: #e1d2d5; color: #a27c89; font-size: 11px; font-weight: 550; }
.share-panel { padding: 15px 18px; margin-top: 25px; border-radius: 12px; color: #a07f8b; background: #ecdfe0; font-size: 11px; }
.share-panel p { margin: 0; }
.share-panel label { display: block; margin-top: 12px; margin-bottom: 5px; }
#share-fallback { display: block; width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid #ccb2bd; border-radius: 8px; color: #875d71; background: #fffaf7; font-size: 12px; }
footer { text-align: center; padding: 28px 0; color: #b49ca3; font-size: 10px; letter-spacing: 1px; }
footer span { padding-inline: 4px; }
dialog { width: min(440px, calc(100% - 32px)); border: 1px solid #d4bdc5; border-radius: 20px; padding: 26px; color: var(--ink); background: #fffaf5; box-shadow: 0 20px 70px #49373e38; }
dialog::backdrop { background: #4c3d4866; backdrop-filter: blur(3px); }
dialog h2 { font-size: 22px; }
dialog > p:not(.eyebrow) { margin: 14px 0 22px; color: #977581; font-size: 13px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }
.dialog-actions button { min-width: 0; padding: 10px 4px; font-size: 12px; }
@media (max-width: 900px) {
  .page { padding-inline: 22px; }
  .atelier-layout { gap: 16px; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); }
  .panel { padding: 17px; }
  .workbench { padding: 12px; }
  .color-choice { font-size: 10px; gap: 4px; }
  .color-chip { width: 18px; height: 18px; }
  .color-chip.empty-chip::after { top: 7px; left: 7px; }
  .patch-wrap { padding-inline: 10px; }
  .patch-frame { padding: 9px; border-radius: 21px; }
  .collection { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  h2 { font-size: 18px; }
}
@media (max-width: 700px) {
  .page { padding: 14px 16px 0; }
  .atelier-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .site-header { gap: 7px; }
  .back-home { font-size: 12px; }
  .studio-mark { letter-spacing: 0; font-size: 10px; }
  .hero { padding: 27px 0 23px; }
  .lead { font-size: 14px; }
  .workbench { padding: 12px; }
  .workbench .section-heading { padding: 4px 3px 0; }
  .board { gap: 2px; padding: 5px; }
  .palette { gap: 6px; }
  .color-choice { font-size: 11px; gap: 5px; }
  .color-chip { width: 18px; height: 18px; }
  .preview-panel, .inspiration, .collection-panel { padding: 20px 18px; }
  .patch-wrap { max-width: 290px; padding: 8px 22px 27px; }
  .patch-frame { padding: 12px; border-radius: 26px; }
  .collection { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .collection-item { padding: 9px; }
  .collection-note { font-size: 10px; }
  .canvas-meta { font-size: 10px; }
  dialog { padding: 22px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
  button:active:not(:disabled) { transform: none; }
}
