/* Share the homepage parchment theme; drawing colors remain user-controlled. */
.sprite-page { min-height:100svh; line-height:1.5; }
.sprite-page .eyebrow { display:flex; align-items:center; gap:18px; color:var(--muted); font-size:10px; font-weight:600; letter-spacing:.16em; text-transform:uppercase; }
.sprite-intro .eyebrow>span:first-child::before { content:'◆'; margin-right:12px; font-size:8px; color:#7a8556; }
.sprite-page input[type="checkbox"] { accent-color:var(--acid); }
.sprite-page input::placeholder,.sprite-page textarea::placeholder { color:var(--muted); opacity:1; }
.sprite-page input[type="file"]::file-selector-button { padding:.55rem .7rem; margin-right:.65rem; border:1px solid var(--line); background:var(--paper); color:var(--ink); font:inherit; cursor:pointer; }
.sprite-page summary:focus-visible { outline:2px solid var(--acid); outline-offset:-4px; }

.sprite-main { width:100%; max-width:1700px; margin:0 auto; padding:57px var(--gutter) 72px; }
.sprite-intro { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.55fr); gap: 3rem; align-items: end; margin-bottom: 3.5rem; }
.sprite-intro .eyebrow { grid-column: 1 / -1; margin: 0; }
.sprite-intro h1 { margin: 0; font-size: clamp(4.3rem, 9vw, 9rem); font-family:var(--display); font-weight:400; line-height: .94; letter-spacing: -0.065em; text-transform: none; }
.sprite-intro h1 em { color: var(--acid); font-family: var(--display); font-size: 0.82em; font-weight: 400; letter-spacing: -0.045em; text-transform: none; }
.sprite-intro > p:not(.eyebrow) { max-width: 30rem; margin: 0 0 0.7rem; color: var(--muted); font-family: var(--display); font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.6; }
.sprite-specs { grid-column: 1 / -1; display: flex; gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sprite-specs span { flex: 1; padding: 0.8rem 1rem; color: var(--muted); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.12em; text-align: center; text-transform: uppercase; border-left: 1px solid var(--line); }
.sprite-specs span:first-child { border-left: 0; }

.creator-shell { position: relative; display: grid; grid-template-columns: minmax(21rem, 0.88fr) minmax(26rem, 1.12fr); overflow: hidden; border: 1px solid var(--line); border-radius: 2px; background: #f3e9d0; box-shadow: 0 2rem 6rem #59492f15; }
.creator-status { position: absolute; z-index: 8; inset: 0; display: grid; place-items: center; padding: 2rem; color: var(--acid); background: #f3e9d0f5; font-family: var(--display); font-size: 1.2rem; letter-spacing: 0.05em; text-align: center; }
.creator-shell[data-ready="true"] .creator-status { display: none; }
.creator-shell[data-error="true"] .creator-status { color: var(--rust); }

.creator-controls { max-height: 65rem; overflow-y: auto; border-right: 1px solid var(--line); background: #f3e9d066; scrollbar-color: #8a8d68 transparent; }
.control-section { padding: 1.45rem; border-bottom: 1px solid var(--line); }
.control-heading, .preview-header { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.control-heading span { color: var(--acid); font-family: var(--display); font-size: 0.75rem; }
.control-heading h2, .preview-header h2, .download-panel h2 { margin: 0; color: var(--ink); font-family: var(--display); font-size: 1.3rem; font-weight: 500; }

.class-tabs, .segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.4rem; }
.class-tabs button, .segmented button, .choice-card, .text-button, .play-button, .direction-pad button, .download-sprite { border: 0; font: inherit; cursor: pointer; }
.class-tabs button, .segmented button { min-height: 2.9rem; border: 1px solid var(--line); color: var(--muted); background: #65553805; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.class-tabs button:hover, .class-tabs button[aria-selected="true"], .segmented button:hover, .segmented button[aria-pressed="true"] { border-color: var(--acid); color: #fff5df; background: var(--acid); }

.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem; }
.choice-card { display: grid; grid-template-columns: 3.25rem 1fr; align-items: center; min-width: 0; min-height: 4.5rem; padding: 0.55rem; border: 1px solid var(--line); color: var(--ink); background: #65553805; text-align: left; }
.choice-card:hover, .choice-card[aria-pressed="true"] { border-color: var(--acid); background: #465c380c; }
.choice-card[aria-pressed="true"] { box-shadow: inset 3px 0 0 var(--acid); }
.choice-card canvas { width: 3rem; height: 3rem; image-rendering: pixelated; }
.choice-card strong { display: block; overflow: hidden; font-family: var(--display); font-size: 0.84rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.choice-card small { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.56rem; letter-spacing: 0.08em; text-transform: uppercase; }

.color-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.65rem; }
.color-control { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: 0.55rem; align-items: center; padding: 0.55rem; border: 1px solid var(--line); }
.color-control input[type="color"] { width: 2.6rem; height: 2.6rem; padding: 0; overflow: hidden; border: 0; border-radius: 0; background: transparent; cursor: pointer; }
.color-control label { display: block; overflow: hidden; color: var(--muted); font-size: 0.56rem; font-weight: 800; letter-spacing: 0.09em; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; }
.color-control input[type="text"] { width: 100%; margin-top: 0.25rem; padding: 0; border: 0; color: var(--ink); background: transparent; font: 700 0.72rem/1 monospace; text-transform: uppercase; }
.preset-row { display: flex; flex-wrap: wrap; gap: 0.42rem; margin-top: 0.75rem; }
.preset-row button { width: 1.35rem; height: 1.35rem; padding: 0; border: 1px solid var(--muted); background: var(--swatch); cursor: pointer; }
.preset-row button:hover { transform: translateY(-2px); border-color: var(--acid); }
.control-actions { display: flex; justify-content: space-between; margin-top: 0.75rem; }
.text-button { padding: 0; color: var(--muted); background: transparent; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; text-decoration: underline; text-underline-offset: 0.25rem; text-transform: uppercase; }
.text-button:hover { color: var(--acid); }

.preview-workbench { display: flex; flex-direction: column; min-width: 0; padding: clamp(1.3rem, 3vw, 2.4rem); background: linear-gradient(155deg,#e2d5b650,#eee3c9); }
.preview-header p, .download-panel p { margin: 0 0 0.25rem; color: var(--acid); font-size: 0.58rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.preview-header h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
.preview-fps { padding: 0.35rem 0.55rem; border: 1px solid var(--line); color: var(--muted); font: 700 0.62rem/1 monospace; }
.preview-stage { position: relative; display: grid; place-items: center; isolation: isolate; min-height: 29rem; overflow: hidden; border: 1px solid var(--line); background: #ded4bb; }
.stage-grid { position: absolute; z-index: -3; inset: 0; background: linear-gradient(#65553812 1px, transparent 1px), linear-gradient(90deg, #65553812 1px, transparent 1px); background-size: 2rem 2rem; mask-image: linear-gradient(to bottom, #000 20%, transparent 95%); }
.preview-stage::after { content: ""; position: absolute; z-index: -2; left: 10%; right: 10%; bottom: 15%; height: 25%; border: 1px solid #65553826; border-radius: 50%; background: radial-gradient(ellipse, rgba(126, 160, 118, 0.18), transparent 70%); transform: perspective(12rem) rotateX(58deg); }
.preview-stage canvas { width: min(46vw, 18rem); height: min(46vw, 18rem); image-rendering: pixelated; transform: translateY(-0.6rem); filter: drop-shadow(0 1.2rem 1rem #45382130); }
.stage-shadow { position: absolute; bottom: 21%; width: 8rem; height: 1.5rem; z-index: -1; border-radius: 50%; background: #45382130; filter: blur(0.45rem); }
.stage-direction { position: absolute; right: 1rem; bottom: 1rem; color: var(--muted); font-size: 0.58rem; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }

.preview-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.65rem; align-items: center; margin-top: 0.8rem; }
.segmented { grid-template-columns: repeat(2, minmax(5rem, 1fr)); }
.play-button { min-height: 2.9rem; padding: 0 1rem; border: 1px solid var(--line); color: var(--ink); background: transparent; font-size: 0.65rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.play-button span:first-child { margin-right: 0.4rem; color: var(--acid); }
.direction-pad { display: grid; grid-template-columns: repeat(3, 2.5rem); grid-template-rows: repeat(2, 2.15rem); gap: 0.25rem; }
.direction-pad button { border: 1px solid var(--line); color: var(--muted); background: #65553805; }
.direction-pad button:hover, .direction-pad button.is-active { border-color: var(--acid); color: #fff5df; background: var(--acid); }
.direction-pad [data-direction="up"] { grid-column: 2; }
.direction-pad [data-direction="left"] { grid-column: 1; grid-row: 2; }
.direction-pad [data-direction="down"] { grid-column: 2; grid-row: 2; }
.direction-pad [data-direction="right"] { grid-column: 3; grid-row: 2; }

.selection-ledger { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 1.5rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.selection-ledger div { min-width: 0; padding: 0.9rem; border-left: 1px solid var(--line); }
.selection-ledger div:first-child { border-left: 0; }
.selection-ledger span { display: block; color: var(--muted); font-size: 0.54rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.selection-ledger strong { display: block; overflow: hidden; margin-top: 0.3rem; color: var(--ink); font-family: var(--display); font-size: 0.78rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.download-panel { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-top: auto; padding: 1.4rem 0 0; }
.download-panel h2 { font-size: 1.5rem; }
.download-panel > div > span { color: var(--muted); font-size: 0.6rem; letter-spacing: 0.05em; }
.download-sprite { display: flex; align-items: center; justify-content: space-between; gap: 2rem; min-width: 14rem; min-height: 3.6rem; padding: 0 1rem; color: #fff5df; background: var(--acid); font-size: 0.68rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.download-sprite:hover:not(:disabled) { background:#354a2b; }
.download-sprite:disabled { cursor: wait; opacity: 0.45; }

.sprite-page button:focus-visible, .sprite-page input:focus-visible, .sprite-page a:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }

@media (max-width: 960px) {
  .sprite-intro { grid-template-columns: 1fr; }
  .sprite-intro .eyebrow, .sprite-specs { grid-column: 1; }
  .creator-shell { grid-template-columns: 1fr; }
  .creator-controls { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .preview-stage { min-height: 25rem; }
  .preview-stage canvas { width: 15rem; height: 15rem; }
}

@media (max-width: 680px) {
  .sprite-main { width:100%; padding:35px var(--gutter) 48px; }
  .sprite-intro { gap: 1.5rem; margin-bottom: 2rem; }
  .sprite-intro h1 { font-size: clamp(3.75rem, 20vw, 6rem); }
  .sprite-specs { flex-wrap: wrap; }
  .sprite-specs span { flex: 1 0 50%; border-top: 1px solid var(--line); }
  .creator-shell { border-radius: 2px; }
  .control-section, .preview-workbench { padding: 1rem; }
  .choice-grid, .color-grid { grid-template-columns: 1fr; }
  .preview-stage { min-height: 20rem; }
  .preview-stage canvas { width: 13rem; height: 13rem; }
  .preview-controls { grid-template-columns: 1fr auto; }
  .segmented { grid-column: 1 / -1; }
  .selection-ledger { grid-template-columns: 1fr; }
  .selection-ledger div { border-top: 1px solid var(--line); border-left: 0; }
  .selection-ledger div:first-child { border-top: 0; }
  .download-panel { align-items: stretch; flex-direction: column; }
  .download-sprite { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .preset-row button:hover { transform: none; }
}
/* The drawing canvas is the workshop's primary surface. */
.creator-controls { max-height: none; overflow: visible; min-width: 0; }
.pixel-workshop { padding: clamp(1rem, 2vw, 1.5rem); }
.workshop-hint { color: var(--muted); font-size: .78rem; line-height: 1.6; }
.editor-toolbar, .editor-history { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: .85rem 0; }
.pixel-workshop button, .submission-panel > button { min-height: 2.4rem; padding: .45rem .65rem; border: 1px solid var(--line); background: #eee3c9; color: var(--ink); font-family: inherit; font-size: .72rem; font-weight: 600; line-height: 1.3; cursor: pointer; }
.pixel-workshop button:hover, .pixel-workshop button[aria-pressed="true"] { color: #fff5df; background: var(--acid); border-color: var(--acid); }
.pixel-workshop button:disabled { opacity: .4; cursor: default; }
.pixel-workshop input[type="color"] { width: 2.5rem; height: 2rem; padding: 0; vertical-align: middle; background: transparent; border: 0; }
.editor-history label, .editor-toolbar label { color: var(--muted); font-size: .72rem; }
.drawing-surface { background: repeating-conic-gradient(#e5dcc6 0% 25%, #cfc7b0 0% 50%) 50% / 20px 20px; border: 1px solid var(--line); }
.drawing-surface canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; image-rendering: pixelated; touch-action: none; cursor: crosshair; }
.frame-caption { display: flex; justify-content: space-between; gap: .5rem; margin: .7rem 0 1rem; color: var(--muted); font-size: .7rem; text-transform: capitalize; }
.pose-label, .import-label { display: grid; gap: .5rem; font-size: .76rem; color: var(--ink); }
.pose-label select, .submission-panel input:not([type="checkbox"]), .submission-panel textarea { width: 100%; min-width: 0; padding: .7rem; border: 1px solid var(--line); background: #faf2df; color: var(--ink); font: inherit; }
.frame-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
.frame-strip button { min-width: 0; padding: .3rem; }
.frame-strip canvas { display: block; width: 100%; max-width: 64px; margin: auto; image-rendering: pixelated; }
.import-label input { width: 100%; min-width: 0; font-size: .7rem; }
.template-library { border-top: 1px solid var(--line); }
.template-library summary { padding: 1.2rem; color: var(--acid); cursor: pointer; }
.template-library summary span { display: block; margin-top: .4rem; color: var(--muted); font-size: .75rem; }
.submission-panel { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; line-height: 1.65; }
.submission-panel h2 { color: var(--ink); font-family: var(--display); font-weight: 400; font-size: 1.7rem; margin: .3rem 0; }
.submission-panel form { display: grid; gap: .8rem; }
.submission-panel form label { display: grid; gap: .4rem; }
.submission-panel .rights-check { display: flex; align-items: flex-start; }
.rights-check input { flex: 0 0 auto; margin-top: .35rem; }
[data-editor-status], [data-submit-status], [data-submission-list] { overflow-wrap: anywhere; font-size: .78rem; color: var(--acid); }
.pixel-workshop :focus-visible, .submission-panel :focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }
.preview-stage { min-height: 20rem; }
@media (max-width: 800px) { .creator-shell { grid-template-columns: minmax(0,1fr); } .creator-controls { border-right: 0; } .pixel-workshop { padding: 1rem; } }
