:root {
  /* Measured from the user's Discord dark-theme settings DOM, 2026-10-05. */
  --bg: #202024;
  --secondary: #1A1A1E;
  --surface: #242429;
  --surface-soft: #2E2E33;
  --surface-selected: #333338;
  --field: #17171A;
  --brand-ink: #17171A;
  --line: rgba(151, 151, 159, .12);
  --line-strong: rgba(151, 151, 159, .32);
  --text: #FBFBFB;
  --muted: #96979E;
  --sidebar-width: 224px;
  --header-height: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { overflow: hidden; font-family: Inter, "Segoe UI", Arial, "Apple SD Gothic Neo", sans-serif; color: var(--text); background: var(--bg); }
button, input, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
.icon { width: 20px; height: 20px; flex: none; fill: currentColor; }
button .icon { pointer-events: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }

/* All action controls use the Ringcl border, shadow and pressed movement. */
.button {
  --button-edge: var(--field);
  --button-face: rgba(151, 151, 159, .12);
  --button-shadow: var(--field);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 14px; border: 2px solid var(--button-edge);
  border-radius: 6px; background: var(--button-face); box-shadow: 3px 3px 0 var(--button-shadow);
  color: var(--text); font-size: 13px; font-weight: 700; line-height: 1.2;
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}
.button:hover:not(:disabled) { background: rgba(151,151,159,.16); transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--button-shadow); }
.button:active:not(:disabled) { transform: translate(3px,3px); box-shadow: 0 0 0 var(--button-shadow); }
.button.primary, .button[aria-pressed=true], .button.is-current, .button.is-selected { --button-edge: var(--brand); --button-shadow: var(--brand); }
.button.primary { color: var(--brand); }
.button:disabled { --button-edge: var(--field); --button-shadow: var(--field); color: var(--muted); }
.button[aria-disabled=true] { color: var(--muted); pointer-events: none; cursor: default; }
.icon-button { width: 40px; height: 40px; padding: 8px; }

/* Frames use the same real border and offset shadow as Ringcl controls. */
.ringcl-box {
  --box-edge: var(--field);
  border: 2px solid var(--box-edge);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--box-edge);
}
.search-form:focus-within, .prompt-composer:focus-within { --box-edge: var(--brand); }

/* The drawer is outside layout: visibility never resizes or recenters content. */
.workspace { width: 100%; min-width: 0; display: flex; flex-direction: column; height: 100dvh; }
.topbar { position: relative; z-index: 6; height: var(--header-height); flex: none; padding: 0 24px; display: flex; align-items: center; gap: 16px; background: var(--secondary); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 9px; flex: none; }
.brand img { display: block; width: 124px; height: auto; }
.brand > span { border-left: 1px solid var(--line-strong); padding-left: 9px; font-size: 12px; font-weight: 800; color: var(--brand); }
.edition { font-size: 12px; color: var(--muted); padding-left: 16px; border-left: 1px solid var(--line); }
.language-toggle { margin-left: auto; font-size: 13px; flex: none; }
.language-toggle .icon { width: 16px; height: 16px; }
.sidebar { position: fixed; top: var(--header-height); bottom: 0; left: 0; z-index: 5; width: var(--sidebar-width); display: flex; flex-direction: column; padding: 20px 16px 18px; background: var(--secondary); border-right: 1px solid var(--line); transform: translateX(0); transition: transform 180ms ease; overflow-y: auto; }
.sidebar-collapsed .sidebar { transform: translateX(-100%); }
.sidebar nav, .sidebar-bottom { display: grid; gap: 12px; padding-right: 3px; }
.sidebar .nav-item { display: flex; justify-content: flex-start; gap: 12px; min-height: 44px; font-size: 14px; }
.nav-item.is-current .icon { color: var(--brand); }
.sidebar-bottom { margin-top: auto; padding-top: 32px; }
.saved-count { margin-left: auto; font-size: 11px; color: var(--muted); }
.sidebar-colors { margin-top: 30px; padding-right: 3px; }
.sidebar-colors .field-label { display: flex; align-items: center; gap: 8px; padding-left: 8px; }
.sidebar-colors .icon { width: 16px; height: 16px; }
.color-filters { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.color-filters .button { min-height: 36px; padding: 7px 9px; gap: 6px; font-size: 12px; justify-content: flex-start; }
.color-filters .icon { width: 12px; height: 12px; }
.color-filters a[href*="tag=green"] .icon { color: #94CC7A; }
.color-filters a[href*="tag=orange"] .icon { color: #E6A264; }
.color-filters a[href*="tag=blue"] .icon { color: #7DB9DD; }
.color-filters a[href*="tag=purple"] .icon { color: #B199DC; }
.color-filters a[href*="tag=pink"] .icon { color: #DD94B9; }
.color-filters a[href*="tag=red"] .icon { color: #E88989; }
.color-filters a[href*="tag=yellow"] .icon { color: #E6D57C; }
.sidebar .subtle { font-size: 13px; font-weight: 600; }
.subtle .icon { width: 17px; height: 17px; }
.worker-line { display: flex; align-items: center; gap: 8px; padding: 10px 8px; font-size: 12px; color: var(--muted); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.is-ready { background: var(--brand); }
.sidebar-scrim { display: none; }
.main-content { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; padding: 28px 36px 28px calc(var(--sidebar-width) + 36px); }
.gallery, .detail, .create-page { margin: 0 auto; }
.gallery { max-width: 1440px; }
.detail { max-width: 1320px; }
.create-page { max-width: 1080px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; min-height: 42px; }
h1 { margin: 0; font-size: 30px; line-height: 1.2; letter-spacing: -.03em; font-weight: 750; }
.gallery .page-heading { margin-bottom: 20px; }
.gallery-title { display: flex; align-items: center; gap: 14px; }
.gallery .page-heading { flex-wrap: wrap; }
.gallery-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 0 3px 3px 0; }
.gallery-actions .button:not(.create-link) { min-height: 38px; padding: 8px 12px; font-size: 12px; }
.gallery-actions .icon-button { padding: 8px !important; width: 38px; height: 38px; }
.gallery[data-saved-only=true] > .skin-grid > .skin-card:not(.is-saved) { display: none; }
.gallery h1 { font-size: 32px; }
.count { font-size: 13px; color: var(--muted); white-space: nowrap; background: var(--secondary); border-radius: 5px; padding: 6px 9px; }
.create-link { min-height: 42px; font-size: 14px; }
.gallery-toolbar { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.search-form { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 280px; margin: 0; padding: 5px 7px 5px 14px; background: var(--field); }
.search-form > .icon { color: var(--muted); width: 18px; }
.search-form input { width: 100%; min-width: 0; height: 38px; font-size: 15px; color: var(--text); background: none; border: 0; outline: 0; }
.search-form input:focus-visible { outline: 0; }
.search-form .button { flex: none; min-height: 38px; padding: 8px 16px; }
.tag-filters { display: flex; flex: none; flex-wrap: wrap; gap: 9px; padding: 0 3px 3px 0; }
.button.filter { min-height: 38px; padding: 8px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.skin-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 20px; }
.skin-card { background: var(--surface); overflow: hidden; transition: transform 140ms ease, box-shadow 140ms ease; }
.skin-card:hover { transform: translate(2px,2px); box-shadow: 1px 1px 0 var(--box-edge); }
.skin-card:active { transform: translate(3px,3px); box-shadow: 0 0 0 var(--box-edge); }
.skin-card:hover h2 { color: var(--brand); }
.card-preview { position: relative; display: flex; align-items: center; justify-content: center; height: 208px; background: var(--secondary); overflow: hidden; }
.card-preview::after { content: ""; position: absolute; bottom: 20px; width: 86px; height: 10px; background: var(--field); border-radius: 50%; filter: blur(4px); pointer-events: none; }
.kind-badge { position: absolute; left: 12px; top: 12px; z-index: 1; font-size: 11px; background: var(--surface-soft); color: var(--muted); padding: 5px 8px; border-radius: 4px; }
.skin-preview-image { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; position: relative; z-index: 1; padding: 20px; }
.skin-preview-image.is-3d { padding: 0; image-rendering: auto; }
.card-info { padding: 13px 16px 14px; }
.card-info h2 { font-size: 16px; font-weight: 650; line-height: 1.3; margin: 0 0 7px; }
.card-info > div { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.card-info > div > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-info > div > span:last-child { flex: none; }
.card-models strong { color: var(--text); font-weight: 600; }
.empty-state { min-height: 240px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 18px; color: var(--muted); text-align: center; }
.empty-state > .icon { width: 34px; height: 34px; }
.empty-state h1, .empty-state h2 { font-size: 20px; margin: 0; color: var(--text); }

.back-link { margin-bottom: 24px; font-size: 12px; }
.back-link .icon { width: 16px; }
.detail-navigation { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 24px; padding-right: 3px; }
.tool-group { display: flex; align-items: center; gap: 9px; }
.viewer-tools { margin-top: 16px; padding-right: 3px; }
.tool-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 14px; margin-bottom: 14px; }
.viewer-tools .button { font-size: 12px; padding: 8px 11px; }
.viewer-tools .icon-button { padding: 8px; }
.viewer-notice { margin: 6px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
.detail-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding-right: 3px; }
.detail-actions .kind-label { margin: 0 auto 0 0; }
.share-url { display: block; width: 100%; background: var(--field); color: var(--text); padding: 10px; margin-bottom: 18px; font-size: 12px; }
.related-skins { margin-top: 36px; }
.related-skins > h2 { margin: 0 0 18px; font-size: 18px; }
.related-skins .card-preview { height: 180px; }
.detail-stage[data-background]::before, .generation-stage[data-background]::before { display: none; }
.detail-stage[data-background=light], .generation-stage[data-background=light] { background: #E5E7EC; }
.detail-stage[data-background=checker], .generation-stage[data-background=checker] {
  background-color: var(--secondary);
  background-image: linear-gradient(45deg,var(--surface) 25%,transparent 25%,transparent 75%,var(--surface) 75%),linear-gradient(45deg,var(--surface) 25%,transparent 25%,transparent 75%,var(--surface) 75%);
  background-size: 32px 32px;
  background-position: 0 0,16px 16px;
}
.detail-grid { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(260px,.8fr); gap: 40px; }
.detail-stage { position: relative; height: 480px; overflow: hidden; background: var(--secondary); }
.detail-stage::before, .generation-stage::before { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 30%; opacity: .3; pointer-events: none; background-image: linear-gradient(var(--line) 1px,transparent 1px),linear-gradient(90deg,var(--line) 1px,transparent 1px); background-size: 40px 40px; transform: perspective(150px) rotateX(28deg); transform-origin: bottom; }
.detail-stage canvas, .generation-stage canvas { display: block; position: relative; width: 100%; height: 100%; z-index: 1; touch-action: none; }
.stage-label { position: absolute; top: 16px; left: 16px; font-size: 11px; letter-spacing: .1em; color: var(--muted); }
.viewer-error { position: absolute; top: 45%; left: 0; width: 100%; text-align: center; font-size: 12px; color: var(--muted); padding: 16px; }
.viewer-controls { display: flex; gap: 12px; margin-top: 16px; justify-content: center; flex-wrap: wrap; padding-right: 3px; }
.viewer-controls .button { font-size: 12px; padding: 8px 12px; }
.skin-details { padding-top: 10px; min-width: 0; }
.kind-label { display: inline-block; font-size: 11px; color: var(--muted); background: var(--surface-soft); border-radius: 4px; padding: 6px 9px; margin-bottom: 15px; }
.skin-details h1 { font-size: 34px; overflow-wrap: anywhere; }
.detail-author { color: var(--muted); font-size: 13px; margin: 12px 0 24px; }
.skin-description { font-size: 13px; line-height: 1.6; color: var(--muted); }
.detail-divider { height: 1px; background: var(--line); margin: 24px 0; }
.field-label { font-size: 12px; font-weight: 650; color: var(--muted); margin: 0 0 12px; }
.model-options { display: flex; gap: 12px; margin-bottom: 24px; }
.model-options .button { min-width: 90px; }
.download-button { width: 100%; max-width: 360px; min-height: 45px; }
.format-label { font-size: 11px; color: var(--muted); margin: 12px 0 28px; }
.detail-tags { display: flex; gap: 10px; flex-wrap: wrap; padding-right: 3px; }
.detail-tags .button { min-height: 34px; padding: 6px 10px; font-size: 12px; font-weight: 600; }
.source-heading { margin-top: 24px; }
.source-list { margin: 0; padding-left: 16px; font-size: 12px; color: var(--muted); }
.source-list a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.texture-row { display: flex; align-items: center; gap: 16px; margin-top: 28px; padding: 18px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.texture-row img { background: var(--surface); image-rendering: pixelated; width: 68px; height: 68px; flex: none; }
.texture-row small { display: block; font-size: 11px; margin-top: 7px; color: var(--muted); }

.technical-badge { font-size: 11px; color: var(--muted); padding: 8px 12px; border-radius: 4px; background: var(--secondary); }
.generation-stage { position: relative; height: 330px; overflow: hidden; background: var(--secondary); }
.generation-empty { position: relative; height: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 20px; z-index: 1; color: var(--muted); }
.generation-empty > .icon { width: 50px; height: 50px; }
.generation-empty h2 { font-size: 14px; font-weight: 500; margin: 0; }
.stage-model { font-size: 11px; border-radius: 4px; padding: 5px 9px; background: var(--surface-soft); }
.result-downloads { position: absolute; bottom: 18px; right: 18px; z-index: 2; display: flex; gap: 12px; }
.jobs-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 15px; }
.jobs-heading h2 { font-size: 14px; font-weight: 650; margin: 0; }
.jobs-heading > span { font-size: 11px; color: var(--muted); }
.no-jobs { font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.job-list { display: grid; gap: 10px; }
.job-row { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: 6px; padding: 14px 16px; }
.job-row .job-prompt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.job-time, .job-status { font-size: 11px; color: var(--muted); white-space: nowrap; }
.job-status.is-completed { color: var(--brand); }
.job-status.is-failed { color: var(--danger); }
.job-row .button { font-size: 11px; min-height: 32px; padding: 5px 9px; }
.job-row.is-active { --box-edge: var(--brand); }
.composer-area { flex: none; padding: 16px 36px 22px calc(var(--sidebar-width) + 36px); border-top: 1px solid var(--line); background: var(--bg); }
.prompt-composer { max-width: 1080px; margin: 0 auto; background: var(--secondary); padding: 15px 16px 13px; }
.prompt-composer textarea { display: block; resize: none; outline: none; border: 0; background: none; color: var(--text); width: 100%; height: 50px; max-height: 120px; font-size: 15px; line-height: 1.6; padding: 0 2px; }
.prompt-composer textarea:focus-visible { outline: none; }
.composer-tools { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.output-options { display: flex; gap: 10px; flex: none; }
.output-choice { font-size: 12px; min-height: 36px; padding: 7px 11px; }
.composer-status { font-size: 12px; color: var(--muted); margin-left: auto; }
.generate-button { font-size: 14px; min-width: 124px; min-height: 40px; }
.generate-button .icon { width: 17px; height: 17px; }
.prompt-error { max-width: 1080px; margin: 10px auto 0; color: var(--danger); font-size: 12px; }

@media (min-width: 1700px) {
  .generation-stage { height: 400px; }
  .detail-stage { height: 520px; }
}
@media (max-width: 1300px) {
  .gallery-toolbar { align-items: stretch; flex-direction: column; gap: 14px; }
  .search-form { flex: none; min-width: 0; }
}
@media (max-width: 1200px) {
  .skin-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .detail-grid { gap: 26px; }
  .detail-stage { height: 440px; }
  .skin-details h1 { font-size: 28px; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: 6px 0 36px #0005; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: var(--header-height) 0 0; background: #0008; border: 0; z-index: 4; }
  .sidebar-open .sidebar-scrim { display: block; }
  .main-content { padding: 24px; }
  .composer-area { padding: 14px 24px 18px; }
  .detail-grid { grid-template-columns: minmax(0,1fr) minmax(220px,.8fr); gap: 24px; }
  .detail-stage { height: 390px; }
  .edition { display: none; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 16px; gap: 12px; }
  .brand { gap: 7px; }
  .brand img { width: 104px; }
  .brand > span { font-size: 11px; padding-left: 7px; }
  .language-toggle { font-size: 12px; gap: 6px; padding: 8px 10px; }
  .main-content { padding: 24px 16px; }
  .gallery h1 { font-size: 27px; }
  h1 { font-size: 25px; }
  .gallery-title { gap: 9px; }
  .gallery-actions { gap: 10px; width: 100%; }
  .gallery-actions .create-link { margin-left: auto; }
  .gallery-actions .button:not(.create-link) { padding: 8px 10px; }
  .viewer-tools .tool-group { gap: 8px; }
  .viewer-tools .tool-row { gap: 12px; }
  .viewer-tools .button:not(.icon-button) { padding: 8px 10px; font-size: 11px; }
  .count { font-size: 12px; padding: 5px 7px; }
  .page-heading { gap: 12px; margin-bottom: 20px; }
  .create-link { font-size: 12px; padding: 8px 10px; gap: 6px; }
  .create-link .icon { width: 17px; height: 17px; }
  .gallery-toolbar { margin-bottom: 20px; gap: 14px; }
  .tag-filters { gap: 8px; }
  .button.filter { font-size: 12px; padding: 8px 11px; }
  .skin-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .card-preview { height: 180px; }
  .kind-badge { font-size: 10px; left: 9px; top: 9px; padding: 4px 6px; }
  .card-info { padding: 12px 10px; }
  .card-info h2 { font-size: 14px; }
  .card-info > div { font-size: 11px; flex-wrap: wrap; gap: 4px; }
  .detail-grid { grid-template-columns: 1fr; }
  .skin-details h1 { font-size: 28px; }
  .download-button { max-width: none; }
  .viewer-controls { gap: 10px; }
  .generation-stage { height: 270px; }
  .technical-badge { font-size: 10px; padding: 6px 8px; }
  .jobs-heading > span, .job-time { display: none; }
  .result-downloads { bottom: 12px; right: 12px; gap: 10px; }
  .result-downloads .button { font-size: 11px; }
  .composer-area { padding: 12px 16px 16px; }
  .prompt-composer { padding: 13px; }
  .prompt-composer textarea { font-size: 14px; height: 46px; }
  .composer-tools { flex-wrap: wrap; gap: 12px; }
  .output-choice { font-size: 11px; padding: 7px 10px; }
  .composer-status { font-size: 11px; text-align: right; }
  .generate-button { margin-left: auto; min-width: 100px; padding: 7px 11px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
