@font-face { font-family: "Colorbook Display"; src: url("assets/display.woff2") format("woff2"); font-display: swap; font-weight: 100 900; }
:root { --paper: #f5f2e9; --card: #fffdf7; --ink: #171715; --muted: #62615b; --line: #ccc9c0; --accent: #c53827; --canvas: #e5e5e3; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); font: 16px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
body { overscroll-behavior: none; }
button, .btn, select { font: inherit; color: inherit; }
button, .btn { display: inline-flex; justify-content: center; align-items: center; gap: 10px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--ink); border-radius: 2px; background: var(--card); cursor: pointer; font-weight: 650; }
button img, .btn img { width: 20px; height: 20px; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .6; cursor: wait; }
button:hover:not(:disabled), summary:hover { background-color: #e8e4d9; }
button.primary { background: var(--accent); border-color: var(--accent); color: white; }
button.primary:hover:not(:disabled) { background: #ab2c1d; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
::selection { background: var(--ink); color: var(--paper); }
[hidden] { display: none !important; }
input { accent-color: var(--ink); }
input[type=range] { min-height: 44px; min-width: 70px; }
.err { position: fixed; z-index: 20; inset: max(16px, env(safe-area-inset-top)) 16px auto; padding: 16px; border: 2px solid var(--ink); background: var(--accent); color: white; }
#home { max-width: 1040px; margin: auto; padding: 24px 32px 36px; }
.masthead { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 30px 32px 38px; background: var(--ink); color: var(--paper); isolation: isolate; }
.masthead::after { content: ""; position: absolute; bottom: -1px; left: 0; right: 0; height: 8px; background: var(--paper); clip-path: polygon(0 100%,0 0,2% 100%,4% 0,6% 100%,8% 0,10% 100%,12% 0,14% 100%,16% 0,18% 100%,20% 0,22% 100%,24% 0,26% 100%,28% 0,30% 100%,32% 0,34% 100%,36% 0,38% 100%,40% 0,42% 100%,44% 0,46% 100%,48% 0,50% 100%,52% 0,54% 100%,56% 0,58% 100%,60% 0,62% 100%,64% 0,66% 100%,68% 0,70% 100%,72% 0,74% 100%,76% 0,78% 100%,80% 0,82% 100%,84% 0,86% 100%,88% 0,90% 100%,92% 0,94% 100%,96% 0,98% 100%,100% 0,100% 100%); }
h1 { margin: 0; font-family: "Colorbook Display", "PingFang SC", sans-serif; font-weight: 900; font-size: clamp(54px, 8vw, 88px); line-height: 1.05; letter-spacing: -.025em; }
h1 span { color: #ef5540; display: inline-block; transform: skew(-9deg); margin-left: 7px; }
.masthead p { margin: 14px 0 0; font-size: 14px; letter-spacing: .1em; }
.head-note { font-size: 13px; line-height: 1.9; border-top: 3px solid var(--accent); padding-top: 10px; flex-shrink: 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 30px 0 14px; }
h2 { font-size: 24px; font-weight: 850; margin: 0; }
#artCount { font-size: 30px; font-weight: 800; line-height: 1.2; border-bottom: 4px solid var(--accent); font-variant-numeric: tabular-nums; }
#gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 18px; }
.card { position: relative; min-width: 0; }
.card-open { width: 100%; display: block; padding: 0; border: 0; background: transparent; text-align: left; font-weight: 400; }
.card-open:hover { background: transparent !important; }
.card-open > img { display: block; width: 100%; height: auto; aspect-ratio: 4/3; object-fit: contain; background: var(--card); border: 2px solid var(--ink); image-rendering: pixelated; }
.card:first-child { grid-column: 1/-1; }
.card:first-child .card-open > img { aspect-ratio: 2/1; max-height: 370px; }
.meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; padding-right: 48px; }
.card-title { font-size: 16px; font-weight: 750; display: block; }
.card-date { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.card-progress { min-width: 82px; font-size: 12px; font-weight: 650; }
.card-progress i { display: block; height: 5px; margin-top: 7px; background: var(--line); }
.card-progress i b { display: block; height: 100%; background: var(--accent); }
.card .del { position: absolute; bottom: 14px; right: 0; width: 44px; padding: 10px; border: none; background: transparent; }
.card .del img { width: 16px; height: 16px; }
.continue { display: none; }
.card:first-child .continue { display: inline-block; background: var(--accent); color: white; padding: 9px 18px; font-weight: 750; font-size: 14px; }
.empty { grid-column: 1/-1; text-align: center; padding: 50px 20px; border: 2px solid var(--ink); background: var(--card); }
.empty-mark { display: flex; justify-content: center; gap: 6px; margin-bottom: 20px; }
.empty-mark span { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--ink); font-weight: 750; }
.empty-mark span:nth-child(2) { background: var(--accent); color: white; transform: translateY(-5px); }
.empty h3 { font-size: 22px; margin: 0 0 8px; }
.empty p { margin: 0; color: var(--muted); font-size: 14px; }
.settings { margin-top: 28px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
summary { cursor: pointer; padding: 16px 0; font-size: 14px; font-weight: 650; }
summary span { float: right; font-weight: 400; color: var(--muted); }
.new { display: flex; flex-wrap: wrap; gap: 14px 28px; padding: 6px 0 20px; }
.new label { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.new select { min-height: 44px; background: var(--card); border: 1px solid var(--ink); padding: 5px 10px; border-radius: 0; }
.new input[type=checkbox] { width: 20px; height: 20px; }
.setting-hint { width: 100%; margin: 0; color: var(--muted); font-size: 12px; }
.import-dock { margin-top: 22px; }
#import { width: 100%; height: 60px; font-size: 24px; font-weight: 800; }
#import img { width: 24px; height: 24px; }
.promise { text-align: center; font-size: 12px; letter-spacing: .1em; margin: 12px 0 0; }
#status { font-size: 14px; margin: 8px 0; text-align: center; }
#status:empty { display: none; }
#play { position: fixed; inset: 0; height: 100%; height: 100dvh; display: flex; flex-direction: column; background: var(--paper); padding-top: env(safe-area-inset-top); user-select: none; }
.play-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px 0; }
#back { border: 0; padding: 8px 0; background: transparent; }
#back span { font-size: 30px; line-height: 20px; }
#saveState { font-size: 12px; color: var(--muted); }
.progress-row { display: flex; align-items: center; gap: 14px; padding: 10px 20px 14px; }
#progressBar { appearance: none; -webkit-appearance: none; flex: 1; min-width: 0; height: 8px; border: 1px solid var(--ink); border-radius: 0; background: transparent; }
#progressBar::-webkit-progress-bar { background: var(--paper); }
#progressBar::-webkit-progress-value { background: var(--ink); }
#progressBar::-moz-progress-bar { background: var(--ink); }
#progress { font-size: 13px; font-weight: 750; font-variant-numeric: tabular-nums; }
#stage { flex: 1; min-height: 0; margin: 0 20px; touch-action: none; background: var(--canvas); border: 1px solid var(--ink); overflow: hidden; }
#stage canvas { width: 100%; height: 100%; display: block; }
#tools { padding: 12px 20px 0; display: flex; gap: 24px; justify-content: space-between; }
.tool-buttons { display: flex; gap: 8px; flex: 1; }
.tool-buttons button, #recolor { flex: 1; white-space: nowrap; }
#tools button.on { color: var(--paper); background: var(--ink); }
#tools button.on img { filter: brightness(0) invert(1); }
#recolor { position: relative; }
#pick { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
#recolor:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
#sizeBox { display: flex; align-items: center; gap: 14px; font-size: 14px; white-space: nowrap; }
#size { width: 140px; flex: 1; }
.palette-heading { display: flex; justify-content: space-between; gap: 10px; padding: 12px 20px 0; font-size: 13px; }
.palette-heading span { font-size: 12px; color: var(--muted); }
#palette { display: flex; gap: 12px; overflow-x: auto; padding: 12px 22px max(20px, env(safe-area-inset-bottom)); scrollbar-width: thin; scrollbar-color: var(--ink) var(--paper); }
#palette button { flex: 0 0 52px; width: 52px; height: 58px; padding: 0; font-size: 18px; position: relative; }
#palette button.on { outline: 2px solid var(--ink); outline-offset: 3px; }
#palette button.on::after { content: ""; position: absolute; bottom: -13px; left: 20px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 6px solid var(--ink); }
#palette button.done::before { content: "✓"; position: absolute; right: 3px; top: 0; font-size: 11px; }
#done { position: fixed; top: 35%; left: 50%; transform: translateX(-50%) rotate(-3deg); background: var(--paper); border: 3px solid var(--ink); padding: 24px 32px; max-width: calc(100% - 32px); text-align: center; box-shadow: 8px 8px 0 var(--accent); }
#done strong { display: block; font-size: 25px; white-space: nowrap; }
#done span { display: block; font-size: 13px; margin-top: 8px; }
@media (min-width: 800px) { #gallery { grid-template-columns: repeat(4, minmax(0,1fr)); } .card:first-child { grid-column: span 2; grid-row: span 2; } .card:first-child .card-open > img { aspect-ratio: 1/1; } .card:not(:first-child) .meta { flex-wrap: wrap; gap: 6px; } .card:first-child .meta { flex-wrap: wrap; } }
@media (max-width: 600px) { #home { padding: 0 18px max(24px, env(safe-area-inset-bottom)); } .masthead { margin: 0 -18px; padding: max(28px, env(safe-area-inset-top)) 22px 30px; } .head-note { display: none; } h1 { font-size: 64px; } .masthead p { font-size: 12px; } .section-head { margin-top: 24px; } h2 { font-size: 22px; } #artCount { font-size: 28px; } .card:first-child .card-open > img { aspect-ratio: 4/3; } .card:not(:first-child) .meta { display: block; } .card:not(:first-child) .card-title { font-size: 14px; } .card:not(:first-child) .card-progress { margin-top: 8px; } .card:first-child .continue { display: none; } .card-date { font-size: 11px; } #tools { flex-direction: column; gap: 8px; padding: 10px 16px 0; } #sizeBox { border: 1px solid var(--line); padding: 0 12px; min-height: 44px; } #size { width: auto; } #stage { margin: 0 16px; } .play-header, .progress-row { padding-left: 16px; padding-right: 16px; } .palette-heading { padding-left: 16px; padding-right: 16px; } .palette-heading span { font-size: 11px; } .tool-buttons button, #recolor { padding: 8px; font-size: 14px; } #palette { padding-left: 20px; } .empty { padding: 38px 16px; } .empty h3 { font-size: 19px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

@media (min-width: 800px) { .card:only-child { grid-column: 1 / -1; } .card:only-child .card-open > img { aspect-ratio: 2 / 1; } }
