:root {
  --bg: #070808;
  --panel: #181919;
  --panel-2: #202222;
  --panel-3: #2b2e2e;
  --ink: #f2f2f2;
  --muted: #8d9091;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --pink: #ff4fc3;
  --pink-2: #ff86d9;
  --green: #4eeec8;
  --purple: #a783ff;
  --radius: 8px;
  color-scheme: dark;
}

@property --rgb-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui,
    sans-serif;
  background: var(--bg);
}

button,
textarea,
select,
input {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button {
  border: 0;
  color: inherit;
}

button:disabled {
  cursor: wait;
  opacity: 0.78;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.app-shell {
  display: grid;
  grid-template-columns: 64px clamp(360px, 31vw, 620px) minmax(0, 1fr);
  height: 100vh;
}

body.admin-mode .app-shell {
  grid-template-columns: 64px minmax(0, 1fr);
}

body.admin-mode .canvas-area {
  display: none;
}

.icon-rail {
  display: flex;
  z-index: 5;
  align-items: center;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid #101111;
  background: #080909;
}

.logo {
  display: grid;
  position: relative;
  width: 54px;
  height: 58px;
  place-items: center;
  color: transparent;
  font-size: 0;
  font-weight: 900;
  isolation: isolate;
  text-decoration: none;
}

.logo::before,
.logo::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.logo::before {
  width: 48px;
  height: 48px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cdefs%3E%3Cpath id='c' d='M32 32m-25 0a25 25 0 1 1 50 0a25 25 0 1 1-50 0'/%3E%3C/defs%3E%3Ctext fill='%23b88cff' font-family='Arial,sans-serif' font-size='5.2' font-weight='800' letter-spacing='1.05'%3E%3CtextPath href='%23c'%3EIMAGE STUDIO • CREATE • GPT IMAGE • RGB • IMAGE STUDIO • CREATE •%3C/textPath%3E%3C/text%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 0 5px rgba(184, 140, 255, 0.62));
  opacity: 0.95;
  transform-origin: center;
  animation: logoWordsClockwise 16s linear infinite;
}

.logo::after {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  background: linear-gradient(100deg, #ff4fc3, #9a78ff, #5df4ff, #4eeec8, #fff067, #ff4fc3);
  background-clip: text;
  background-size: 420% 100%;
  color: transparent;
  content: "H";
  font-size: 27px;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 0 12px rgba(255, 79, 195, 0.24);
  transform-origin: center;
  -webkit-background-clip: text;
  animation:
    logoHCounterClockwise 9s linear infinite,
    logoRgbFlow 4.2s ease-in-out infinite;
}

.rail-icons,
.rail-bottom {
  display: grid;
  width: 100%;
  justify-items: center;
}

.rail-icons {
  gap: 12px;
  padding-top: 10px;
}

.rail-bottom {
  gap: 10px;
  margin-top: auto;
  padding-bottom: 20px;
}

.rail-divider {
  display: block;
  width: 28px;
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
}

.rail-board-stack {
  display: grid;
  justify-items: center;
  gap: 8px;
  max-height: calc(100vh - 430px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 0;
  scrollbar-width: none;
}

.rail-board-stack::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.board-rail-icon {
  display: grid;
  position: relative;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  color: #dcdcdc;
  background: #151717;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  isolation: isolate;
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.board-rail-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

.board-rail-icon span {
  display: grid;
  position: absolute;
  right: -3px;
  bottom: -4px;
  min-width: 15px;
  height: 15px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: #2b2e2e;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14);
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.board-rail-icon.active {
  color: #fff;
  background: linear-gradient(145deg, rgba(255, 134, 217, 0.9), rgba(167, 131, 255, 0.86));
  box-shadow:
    0 0 0 3px rgba(255, 134, 217, 0.14),
    0 0 22px rgba(255, 134, 217, 0.18);
}

.board-rail-icon.generating::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 13px;
  background: conic-gradient(from 0deg, #ffe5f7, #bceeff, #f6defd, #ffe5f7);
  z-index: -1;
  animation: loadingRing 3.8s linear infinite;
}

.board-rail-icon:hover {
  transform: translateY(-1px);
}

.rail-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: transparent;
  color: #dfdfdf;
  text-decoration: none;
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease,
    color 160ms ease;
}

.rail-icon svg,
.mini-button svg,
.round-button svg,
.generate-button svg,
.top-wallet svg,
.zoom-tools svg,
.setting-row svg,
.help-card svg,
.copy-wide svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.3;
}

.rail-icon.active,
.rail-icon:hover,
.add-board-icon:hover {
  background: linear-gradient(145deg, var(--pink-2), var(--purple));
  color: #fff;
  box-shadow: 0 0 0 3px rgba(255, 134, 217, 0.18);
  transform: translateY(-1px);
}

.account-mini {
  display: grid;
  width: 48px;
  justify-items: center;
  gap: 4px;
  padding: 6px 0;
  border-radius: 14px;
  background: transparent;
  color: #dcdcdc;
}

.account-mini span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--pink), var(--purple));
  box-shadow: 0 0 0 3px rgba(255, 134, 217, 0.16);
  font-size: 13px;
  font-weight: 900;
}

.account-mini small {
  max-width: 48px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-panel {
  display: flex;
  position: relative;
  z-index: 4;
  height: 100vh;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 18px 0 42px rgba(0, 0, 0, 0.2);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--pink-2);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
}

h1,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: #d6d7d7;
  font-size: 24px;
  line-height: 1.18;
}

.header-actions {
  display: none;
  gap: 8px;
}

.mini-button,
.round-button,
.counter button,
.generate-button,
.zoom-tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.mini-button {
  width: 36px;
  height: 36px;
  background: #2a2c2c;
  color: #ededed;
}

.mini-button:hover,
.round-button:hover,
.counter button:hover,
.zoom-tools button:hover {
  background: #3a3d3d;
  transform: translateY(-1px);
}

.compact-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 14px 24px 8px;
}

.compact-stats article {
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #1d1f1f;
}

.compact-stats span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.compact-stats strong {
  font-size: 20px;
  line-height: 1;
}

.view-stack {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.view-panel {
  display: none;
  height: 100%;
  padding: 20px 24px 14px;
  overflow: auto;
  animation: panelIn 180ms ease both;
}

.view-panel.active {
  display: block;
}

.view-panel[data-panel="library"].active {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.view-panel[data-panel="queue"].active {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.view-panel[data-panel="admin"].active {
  display: flex;
  min-height: 0;
  overflow: hidden;
  padding: 20px 24px;
}

.last-info-card,
.support-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #202222;
}

.last-info-card {
  padding: 14px;
}

.last-info-card {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.last-info-card.empty {
  display: none;
}

.section-row.compact {
  margin-bottom: 10px;
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.section-row strong {
  font-size: 14px;
}

.section-row small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.last-info-card p {
  min-height: 84px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 12px;
  color: #e8e8e8;
  background: #191b1b;
  font-size: 13px;
  line-height: 1.65;
}

.generation-history {
  display: grid;
  gap: 0;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.generation-entry {
  display: grid;
  gap: 8px;
  padding: 12px 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: transparent;
}

.generation-entry:first-child {
  padding-top: 0;
}

.generation-entry:last-child {
  border-bottom: 0;
}

.generation-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.generation-entry-head small {
  color: var(--muted);
  font-size: 12px;
}

.generation-entry p {
  min-height: 0;
  margin: 0;
  padding: 0;
  color: #e8e8e8;
  background: transparent;
  font-size: 13px;
  line-height: 1.6;
}

.generation-entry .reference-mini {
  padding-top: 4px;
  border-top: 0;
}

.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #303333;
  color: #e7e7e7;
  font-size: 12px;
  font-weight: 900;
  line-height: 30px;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.copy-button:hover {
  background: #3a3d3d;
  transform: translateY(-1px);
}

.icon-copy-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  line-height: 0;
}

.icon-copy-button svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.4;
}

.reference-mini {
  display: flex;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.reference-mini.empty {
  display: none;
}

.last-reference-frame {
  display: grid;
  grid-template-columns: repeat(6, 34px);
  gap: 6px;
}

.reference-image {
  width: 100%;
  height: 34px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  background: #191b1b;
  object-fit: cover;
}

.reference-copy-thumb {
  display: grid;
  position: relative;
  width: 34px;
  height: 34px;
  overflow: hidden;
  padding: 0;
  border-radius: 7px;
  background: transparent;
}

.reference-copy-thumb .reference-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.reference-plus {
  display: grid;
  position: absolute;
  inset: 0;
  place-items: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.42);
  opacity: 0;
  transition:
    opacity 160ms ease,
    background 160ms ease;
}

.reference-copy-thumb:hover .reference-plus {
  opacity: 1;
}

.reference-plus svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.6;
}

.panel-list {
  display: grid;
  gap: 10px;
}

.setting-row,
.credit-options button {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #202222;
  color: #ececec;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 12px 14px;
  text-align: left;
  transition:
    transform 160ms ease,
    border 160ms ease,
    background 160ms ease;
}

.setting-row:hover,
.credit-options button:hover {
  border-color: rgba(255, 134, 217, 0.36);
  background: #292c2c;
  transform: translateY(-1px);
}

.wallet-status {
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #d8d8d8;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  line-height: 1.45;
}

.wallet-status.show {
  display: block;
}

.wallet-status.success {
  color: #c7ffe8;
  background: rgba(30, 211, 139, 0.13);
}

.wallet-status.error {
  color: #ffd7dd;
  background: rgba(255, 92, 124, 0.13);
}

.auth-modal {
  display: grid;
  position: fixed;
  inset: 0;
  z-index: 200;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.58);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.auth-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.auth-card {
  display: grid;
  position: relative;
  width: min(420px, 100%);
  gap: 14px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: #202222;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.46);
  transform: translateY(8px) scale(0.98);
  transition: transform 160ms ease;
}

.auth-modal.open .auth-card {
  transform: translateY(0) scale(1);
}

.auth-close {
  display: grid;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: #303333;
  color: #e8e8e8;
}

.auth-close svg {
  width: 17px;
  height: 17px;
}

.auth-title {
  display: grid;
  gap: 5px;
  padding-right: 42px;
}

.auth-title strong {
  color: #fff;
  font-size: 24px;
}

.auth-title small,
.auth-card label span,
.auth-head small {
  color: var(--muted);
  font-size: 12px;
}

.auth-card label {
  display: grid;
  gap: 7px;
}

.auth-card input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  outline: 0;
  color: #fff;
  background: #191b1b;
}

.auth-message {
  padding: 9px 11px;
  border-radius: 12px;
  color: #ffd7dd;
  background: rgba(255, 92, 124, 0.13);
  font-size: 12px;
  line-height: 1.45;
}

.auth-submit,
.auth-switch {
  min-height: 42px;
  font-weight: 900;
}

.auth-submit {
  color: #fff;
  background: var(--pink);
  box-shadow: 0 0 24px rgba(255, 79, 195, 0.24);
}

.auth-submit.logout {
  background: #303333;
  box-shadow: none;
}

.auth-switch {
  color: #e9e9e9;
  background: #303333;
}

.auth-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 42px;
}

.auth-head > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.auth-head strong {
  overflow: hidden;
  color: #fff;
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-avatar {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 79, 195, 0.94), rgba(122, 109, 255, 0.9)),
    #303333;
  font-weight: 950;
}

.auth-balance {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-radius: 14px;
  background: #191b1b;
}

.auth-balance span {
  color: var(--muted);
  font-size: 12px;
}

.auth-balance b {
  color: #fff;
  font-size: 24px;
}

.setting-row.static {
  cursor: default;
}

.setting-row span {
  display: grid;
  gap: 4px;
}

.setting-row b {
  font-size: 14px;
}

.setting-row small {
  color: var(--muted);
  font-size: 12px;
}

.support-card {
  display: grid;
  gap: 5px;
  padding: 14px;
}

.support-card strong {
  margin-bottom: 4px;
  font-size: 14px;
}

.support-card p {
  margin-bottom: 0;
  color: #d6d6d6;
  font-size: 13px;
  line-height: 1.5;
}

.library-grid {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow-y: scroll;
  padding: 0 4px 14px 0;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.library-grid::-webkit-scrollbar {
  width: 6px;
}

.library-grid::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.library-card {
  display: flex;
  position: relative;
  align-self: start;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #191b1b;
  transition:
    border 160ms ease,
    transform 160ms ease;
}

.library-card:hover {
  border-color: rgba(255, 134, 217, 0.42);
  transform: translateY(-2px);
}

.library-card.active {
  border-color: rgba(255, 134, 217, 0.58);
  box-shadow: 0 0 0 2px rgba(255, 134, 217, 0.12);
}

.library-card-media {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: var(--work-ratio, 1 / 1);
  min-height: 92px;
  max-height: 190px;
  overflow: hidden;
  place-items: center;
  background: #111313;
}

.library-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.library-expiry-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 5px 7px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: #fff4c7;
  background: rgba(18, 19, 19, 0.76);
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(8px);
}

.library-expiry-badge.expired {
  color: #ffc2ce;
  background: rgba(72, 22, 34, 0.82);
}

.library-card-info {
  display: none;
  gap: 5px;
  padding: 9px 10px 10px;
  background: #1f2121;
}

.library-card-info p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #ebebeb;
  font-size: 12px;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.library-card-info small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.library-empty {
  grid-column: 1 / -1;
  display: grid;
  min-height: 120px;
  place-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  color: var(--muted);
  background: #202222;
  font-size: 13px;
}

.library-detail {
  flex: 0 0 auto;
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #202222;
}

.library-detail[hidden] {
  display: none;
}

#library-download {
  display: none;
}

.library-detail p {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  color: #e8e8e8;
  background: #191b1b;
  font-size: 13px;
  line-height: 1.65;
}

.wallet-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid rgba(255, 134, 217, 0.2);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 79, 195, 0.18), transparent),
    #202222;
}

.wallet-card span,
.wallet-card small {
  color: var(--muted);
  font-size: 12px;
}

.wallet-card strong {
  font-size: 34px;
}

.redeem-form,
.queue-card {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #202222;
}

.admin-view[hidden],
.admin-rail-icon[hidden] {
  display: none;
}

.redeem-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.redeem-row,
.admin-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.admin-create {
  grid-template-columns: minmax(0, 1fr) 66px auto;
}

.redeem-row input,
.admin-create input,
.admin-create select {
  min-height: 38px;
  min-width: 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  color: var(--ink);
  background: #191b1b;
}

.queue-list {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.view-panel[data-panel="queue"] .queue-card {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
}

.view-panel[data-panel="queue"] .queue-list {
  flex: 1 1 auto;
  max-height: none;
}

.queue-empty,
.queue-item {
  border-radius: 10px;
  background: #191b1b;
}

.queue-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.queue-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border-left: 3px solid rgba(255, 255, 255, 0.12);
}

.queue-item.completed {
  border-left-color: var(--green);
}

.queue-item.failed {
  border-left-color: #ff6f91;
}

.queue-item.running {
  border-left-color: var(--pink-2);
}

.queue-item-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.queue-item p {
  margin: 0;
  color: #e8e8e8;
  font-size: 12px;
  line-height: 1.45;
}

.queue-item small {
  color: var(--muted);
  font-size: 11px;
}

.queue-error {
  color: #ffc2ce !important;
}

.queue-refund {
  color: #c7ffe8 !important;
}

.library-retention-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 217, 102, 0.18);
  border-radius: 12px;
  color: #ffe8a8;
  background: rgba(255, 217, 102, 0.08);
  font-size: 12px;
  font-weight: 800;
}

.library-retention-notice svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.admin-shell {
  display: flex;
  min-height: 0;
  width: 100%;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
}

.admin-hero,
.admin-tool-card,
.admin-section,
.admin-search-card,
.admin-user-detail,
.admin-metrics article {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #202222;
}

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.admin-hero div {
  display: grid;
  gap: 5px;
}

.admin-hero span,
.admin-section-head small,
.admin-table small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.admin-hero strong {
  color: #fff;
  font-size: 26px;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-metrics article {
  display: grid;
  gap: 7px;
  padding: 14px;
}

.admin-metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-metrics strong {
  color: #fff;
  font-size: 24px;
}

.admin-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-search-card {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(260px, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px;
}

.admin-search-card div {
  display: grid;
  gap: 4px;
}

.admin-search-card small {
  color: var(--muted);
  font-size: 12px;
}

.admin-search-card input,
.admin-detail-adjust input {
  min-height: 40px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  color: var(--ink);
  background: #191b1b;
}

.admin-user-detail {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.admin-user-detail[hidden] {
  display: none;
}

.admin-detail-main,
.admin-detail-adjust,
.admin-detail-records article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.admin-detail-main div {
  display: grid;
  gap: 4px;
}

.admin-detail-main span,
.admin-detail-grid span,
.admin-detail-records small,
.admin-detail-empty {
  color: var(--muted);
  font-size: 12px;
}

.admin-detail-main strong {
  color: #fff;
  font-size: 20px;
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.admin-detail-grid article {
  display: grid;
  gap: 5px;
  padding: 12px;
  border-radius: 12px;
  background: #191b1b;
}

.admin-detail-grid strong {
  overflow: hidden;
  color: #fff;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-detail-adjust {
  justify-content: flex-start;
}

.admin-detail-adjust input {
  width: 180px;
}

.admin-detail-records {
  display: grid;
  gap: 8px;
}

.admin-detail-records article {
  padding: 10px 12px;
  border-radius: 12px;
  background: #191b1b;
}

.admin-tool-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.admin-output {
  display: grid;
  grid-template-columns: 1fr;
  flex: 1 1 auto;
  min-height: 0;
  gap: 16px;
  overflow: auto;
  padding-bottom: 4px;
}

.admin-output.detail-open {
  overflow: hidden;
}

.admin-section {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
}

.admin-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.admin-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border-radius: 12px;
  background: #191b1b;
}

.admin-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  color: #e8e8e8;
  font-size: 12px;
}

.admin-table th,
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  background: #222525;
  font-size: 11px;
  font-weight: 900;
}

.admin-table b,
.admin-table small {
  display: block;
}

.admin-section-ops {
  min-width: 0;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.admin-section-ops .admin-table-wrap {
  max-height: 190px;
}

.admin-detail-section.admin-section-ops .admin-table-wrap {
  max-height: 260px;
}

.admin-section-nav .admin-table-wrap,
.admin-detail-section .admin-table-wrap {
  max-height: 420px;
}

.admin-nav-row {
  cursor: pointer;
}

.admin-nav-row:hover {
  background: rgba(255, 134, 217, 0.08);
}

.admin-back-button {
  justify-self: start;
}

.ops-grid article {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  background: #191b1b;
}

.ops-grid span,
.ops-grid small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-grid strong {
  color: #fff;
  font-size: 20px;
}

.admin-section-records .admin-table td:nth-child(4) {
  max-width: 220px;
  color: #d8d8d8;
}

.admin-ops-subtitle {
  margin-top: 2px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.admin-log-wrap {
  max-height: 260px !important;
}

.admin-key-toggle {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.ops-log-table td:nth-child(5) {
  max-width: 360px;
  color: #d8d8d8;
}

.admin-user-row {
  cursor: pointer;
}

.admin-user-row:hover,
.admin-user-row.active {
  background: rgba(255, 134, 217, 0.08);
}

.admin-user-row.active td:first-child {
  box-shadow: inset 3px 0 0 var(--pink-2);
}

.admin-loading {
  padding: 14px;
  border-radius: 14px;
  color: #d8d8d8;
  background: #202222;
}

.admin-loading.error {
  color: #ffd7dd;
}

.admin-loading.success {
  color: #c7ffe8;
}

.credit-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.credit-options button {
  min-height: 42px;
  font-weight: 900;
}

.help-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #202222;
}

.help-card p {
  margin-bottom: 0;
  color: #d0d0d0;
  line-height: 1.7;
}

.composer {
  position: relative;
  flex: 0 0 auto;
  margin: 0 18px 18px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: #222424;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
}

.control-panel:not([data-view="home"]) .composer {
  display: none;
}

.composer {
  z-index: 12;
}

.composer::after {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: 4;
  border: 1px dashed rgba(255, 194, 234, 0);
  border-radius: 14px;
  background: rgba(255, 134, 217, 0);
  pointer-events: none;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

body.reference-dragging .composer::after {
  border-color: rgba(255, 194, 234, 0.58);
  background: rgba(255, 134, 217, 0.06);
}

body.reference-dragging .composer {
  border-color: rgba(255, 194, 234, 0.42);
}

.composer-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.composer-title div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.composer-title span {
  color: #ffc2ea;
  font-weight: 900;
}

.composer-title b,
.composer-title small {
  color: var(--muted);
}

.text-button {
  min-height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: transparent;
  color: #c7c7c7;
  font-size: 12px;
  font-weight: 800;
}

.text-button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.textarea-shell {
  position: relative;
}

textarea {
  width: 100%;
  height: 78px;
  min-height: 78px;
  max-height: 220px;
  resize: none;
  padding: 12px 30px 12px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  outline: 0;
  color: var(--ink);
  background: #1a1c1c;
  font-size: 14px;
  line-height: 1.55;
}

.textarea-resize {
  position: absolute;
  top: 8px;
  right: 9px;
  z-index: 2;
  width: 14px;
  height: 18px;
  border-radius: 4px;
  background: transparent;
  cursor: ns-resize;
}

.textarea-resize::before,
.textarea-resize::after {
  content: "";
  position: absolute;
  right: 1px;
  width: 12px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  transform: rotate(48deg);
  transform-origin: right center;
}

.textarea-resize::before {
  top: 3px;
}

.textarea-resize::after {
  top: 8px;
  width: 9px;
  opacity: 0.55;
}

.textarea-resize:hover,
body.resizing-prompt .textarea-resize {
  background: transparent;
}

.textarea-resize:hover::before,
.textarea-resize:hover::after,
body.resizing-prompt .textarea-resize::before,
body.resizing-prompt .textarea-resize::after {
  background: rgba(255, 194, 234, 0.95);
}

body.resizing-prompt {
  cursor: ns-resize;
  user-select: none;
}

textarea:focus,
select:focus,
input:focus {
  border-color: rgba(255, 134, 217, 0.48);
  box-shadow: 0 0 0 3px rgba(255, 134, 217, 0.12);
}

.textarea-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.generation-status {
  display: none;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #d8d8d8;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  line-height: 1.45;
}

.generation-status.show {
  display: block;
}

.generation-status.error {
  color: #ffd7dd;
  background: rgba(255, 92, 124, 0.13);
}

.generation-status.success {
  color: #c7ffe8;
  background: rgba(30, 211, 139, 0.13);
}

.reference-tray {
  display: none;
  grid-template-columns: repeat(6, 38px);
  gap: 7px;
  margin-top: 10px;
}

.reference-tray.has-items {
  display: grid;
}

.reference-chip {
  position: relative;
  width: 38px;
  height: 38px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9px;
  background: #171818;
}

.reference-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-chip button {
  display: grid;
  position: absolute;
  right: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 12px;
  line-height: 1;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.round-button {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  background: #303333;
  color: #e7e7e7;
}

.counter {
  display: grid;
  grid-template-columns: 30px 36px 30px;
  align-items: center;
  overflow: hidden;
  margin-left: auto;
  border-radius: 999px;
  background: #303333;
}

.counter button {
  height: 36px;
  background: transparent;
}

.counter button svg {
  width: 14px;
  height: 14px;
}

.counter input {
  width: 36px;
  height: 36px;
  border: 0;
  outline: 0;
  color: #fff;
  background: transparent;
  text-align: center;
  font-weight: 900;
}

.generate-button {
  min-width: 58px;
  height: 40px;
  gap: 6px;
  padding: 0 12px;
  color: #fff;
  background: var(--pink);
  box-shadow: 0 0 24px rgba(255, 79, 195, 0.34);
  font-weight: 900;
}

.generate-button:hover {
  background: #ff66cd;
  box-shadow: 0 0 34px rgba(255, 79, 195, 0.46);
  transform: translateY(-2px);
}

.generate-button svg {
  width: 17px;
  height: 17px;
}

.ratio-popover {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 76px;
  z-index: 80;
  width: auto;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: #2a2d2d;
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.46);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.98);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.ratio-popover.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.popover-section + .popover-section {
  margin-top: 18px;
}

.popover-section strong {
  display: block;
  margin-bottom: 10px;
  color: #d2d2d2;
  font-size: 14px;
}

.ratio-options {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  border-radius: 12px;
  background: #3b3e3e;
}

.ratio-option {
  display: grid;
  min-height: 64px;
  place-items: center;
  gap: 5px;
  background: transparent;
  color: #9a9d9d;
  font-weight: 900;
}

.ratio-option.active,
.ratio-option:hover {
  background: #575a5a;
  color: #fff;
}

.ratio-shape {
  display: block;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.ratio-shape.square {
  width: 18px;
  height: 18px;
}

.ratio-shape.r23 {
  width: 13px;
  height: 21px;
}

.ratio-shape.r32 {
  width: 24px;
  height: 15px;
}

.ratio-shape.r916 {
  width: 10px;
  height: 24px;
}

.ratio-shape.r169 {
  width: 25px;
  height: 14px;
}

.ratio-shape.r34 {
  width: 14px;
  height: 21px;
}

.ratio-shape.r43 {
  width: 22px;
  height: 16px;
}

.quality-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border-radius: 999px;
  background: #3b3e3e;
}

.quality-option {
  min-height: 38px;
  background: transparent;
  color: #adadad;
  font-weight: 900;
}

.quality-option.active,
.quality-option:hover {
  background: #5c5f5f;
  color: #fff;
}

.canvas-area {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.045) 1px, transparent 1.8px),
    #030404;
  background-size: 22px 22px;
}

.top-wallet {
  display: flex;
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  background: #2d3030;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.top-wallet strong {
  font-size: 18px;
}

.top-wallet span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.back-to-grid {
  display: none;
  position: absolute;
  left: 22px;
  top: 20px;
  z-index: 3;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  color: #fff;
  background: rgba(37, 40, 40, 0.9);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  font-size: 13px;
  font-weight: 900;
}

.back-to-grid.show {
  display: inline-flex;
}

.back-to-grid svg,
.download-current svg {
  width: 16px;
  height: 16px;
}

.download-current {
  display: none;
  position: absolute;
  left: 112px;
  top: 20px;
  z-index: 3;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  color: #fff;
  background: rgba(37, 40, 40, 0.9);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  font-size: 13px;
  font-weight: 900;
}

.download-current.show {
  display: inline-flex;
}

.board-stage {
  position: absolute;
  left: 50%;
  top: 45%;
  cursor: grab;
  transform: translate(
      calc(-50% + var(--pan-x, 0px)),
      calc(-50% + var(--pan-y, 0px))
    )
    scale(var(--board-zoom, 1));
  transform-origin: center;
  transition: transform 180ms ease;
  user-select: none;
  touch-action: none;
}

.board-stage.dragging {
  cursor: grabbing;
  transition: none;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns, 1), var(--board-w, 360px));
  place-items: center;
  gap: 18px;
  transition:
    gap 260ms ease,
    transform 260ms ease;
}

.board-stage.no-board-transition,
.board-stage.no-board-transition .board-grid,
.board-stage.no-board-transition .canvas-board {
  transition: none !important;
}

.canvas-board {
  display: grid;
  position: relative;
  width: var(--board-w, 360px);
  height: var(--board-h, 360px);
  overflow: hidden;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  background: #2a2d2d;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  cursor: inherit;
  transition:
    width 680ms cubic-bezier(0.16, 1, 0.3, 1),
    height 680ms cubic-bezier(0.16, 1, 0.3, 1),
    transform 220ms ease,
    box-shadow 220ms ease,
    opacity 180ms ease;
}

.canvas-board.loading-board {
  border: 0;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 218, 236, 0.12), transparent 36%),
    radial-gradient(circle at 82% 76%, rgba(190, 236, 255, 0.12), transparent 40%),
    #151718;
  box-shadow:
    0 26px 72px rgba(0, 0, 0, 0.48),
    0 0 42px rgba(184, 220, 255, 0.1);
}

.canvas-board.loading-board::before,
.canvas-board.loading-board::after {
  content: "";
  position: absolute;
  border-radius: inherit;
}

.canvas-board.loading-board::before {
  inset: 0;
  z-index: 4;
  padding: 3px;
  background: conic-gradient(
    from var(--rgb-angle, 0deg),
    rgba(255, 244, 249, 0.04) 0deg,
    rgba(255, 236, 247, 0.48) 42deg,
    rgba(216, 244, 255, 0.42) 108deg,
    rgba(255, 244, 249, 0.06) 168deg,
    rgba(210, 244, 255, 0.46) 234deg,
    rgba(255, 238, 249, 0.44) 306deg,
    rgba(255, 244, 249, 0.04) 360deg
  );
  box-shadow:
    0 0 22px rgba(255, 230, 246, 0.14),
    0 0 38px rgba(188, 232, 255, 0.12);
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  pointer-events: none;
  animation: rgbFrameSweep 13s linear infinite;
}

.canvas-board.loading-board::after {
  inset: 6px;
  z-index: 0;
  border-radius: 10px;
  background: rgba(7, 8, 8, 0.08);
  pointer-events: none;
}

.canvas-board:hover {
  transform: translateY(-3px);
  box-shadow:
    0 30px 82px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 134, 217, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.canvas-board span {
  z-index: 1;
  color: rgba(255, 255, 255, 0.2);
  font-size: 18px;
  font-weight: 900;
}

.board-stage.generating .canvas-board {
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.42),
    0 0 42px rgba(215, 232, 255, 0.14);
}

.board-stage.single .canvas-board:not(.selected) {
  display: none;
}

.board-stage.single .canvas-board.selected {
  width: var(--board-w);
  height: var(--board-h);
}

.generated-art {
  position: absolute;
  inset: 0;
  opacity: 0.96;
}

.generated-image {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}

.board-stage.single .generated-image {
  object-fit: contain;
}

.empty-generated-board {
  display: grid;
  position: absolute;
  inset: 0;
  place-items: center;
  background: #2a2d2d;
}

.empty-generated-board span {
  color: rgba(255, 255, 255, 0.22);
  font-size: 18px;
  font-weight: 900;
}

.empty-generated-board:empty::after {
  content: "空白画板";
  color: rgba(255, 255, 255, 0.22);
  font-size: 18px;
  font-weight: 900;
}

.loading-preview {
  position: absolute;
  inset: 8px;
  z-index: 1;
  overflow: hidden;
  border-radius: 10px;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 190, 226, 0.32), transparent 38%),
    radial-gradient(circle at 72% 32%, rgba(174, 208, 255, 0.3), transparent 42%),
    radial-gradient(circle at 84% 78%, rgba(255, 202, 178, 0.24), transparent 38%),
    linear-gradient(145deg, #1f1b25, #11151b 52%, #221b20);
  background-size: 260% 260%;
  filter: saturate(0.82) contrast(1.01);
  animation: loadingBackdropFlow 15s ease-in-out infinite;
}

.loading-preview::before,
.loading-preview::after {
  content: "";
  position: absolute;
  inset: -28%;
  z-index: 1;
  background:
    radial-gradient(circle at 20% 34%, rgba(255, 182, 224, 0.28), transparent 28%),
    radial-gradient(circle at 72% 28%, rgba(160, 198, 255, 0.3), transparent 31%),
    radial-gradient(circle at 78% 76%, rgba(255, 196, 168, 0.24), transparent 30%),
    radial-gradient(circle at 38% 82%, rgba(176, 240, 255, 0.2), transparent 28%);
  background-size: 190% 190%;
  filter: blur(36px);
  mix-blend-mode: screen;
  opacity: 0.64;
  pointer-events: none;
  transform: translate3d(-4%, -3%, 0) scale(1.08);
  animation: loadingBlurFlow 16s ease-in-out infinite;
}

.loading-preview::after {
  opacity: 0.36;
  filter: blur(56px);
  transform: translate3d(4%, 5%, 0) scale(1.18);
  animation-duration: 19s;
  animation-direction: reverse;
}

.loading-preview img {
  position: relative;
  z-index: 0;
  width: 128%;
  height: 128%;
  margin: -14%;
  object-fit: cover;
  filter: blur(34px) saturate(1.05) brightness(0.9);
  opacity: 0.76;
  transform: translate3d(-6%, -4%, 0) scale(1.1);
  animation: loadingPreviewDrift 10.5s ease-in-out infinite;
}

.loading-preview.is-empty {
  animation: loadingBackdropFlow 15s ease-in-out infinite;
}

.loading-flow {
  position: absolute;
  inset: 8px;
  z-index: 3;
  border-radius: 10px;
  background:
    linear-gradient(110deg, rgba(132, 162, 224, 0.18), rgba(186, 156, 224, 0.18), rgba(255, 180, 218, 0.2), rgba(178, 234, 255, 0.18)),
    radial-gradient(circle at 18% 28%, rgba(136, 174, 255, 0.16), transparent 48%),
    radial-gradient(circle at 84% 54%, rgba(255, 164, 208, 0.16), transparent 48%);
  background-size: 320% 320%;
  mix-blend-mode: screen;
  opacity: 0.7;
  filter: blur(18px) saturate(0.9);
  animation: loadingFlow 16s ease-in-out infinite;
}

.rgb-frame {
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 0 22px rgba(255, 255, 255, 0.04),
    0 0 46px rgba(180, 226, 255, 0.14);
}

.generated-art::before,
.generated-art::after {
  content: "";
  position: absolute;
  border-radius: 999px;
}

.generated-art::before {
  right: 13%;
  top: 12%;
  width: 24%;
  aspect-ratio: 1;
  background: rgba(255, 222, 119, 0.84);
  box-shadow: 0 0 42px rgba(255, 222, 119, 0.24);
}

.generated-art::after {
  left: 30%;
  bottom: 12%;
  width: 38%;
  height: 56%;
  border-radius: 50% 50% 12px 12px;
  background: linear-gradient(160deg, #eefaf6, #60cfc2 52%, #304c72);
}

.thumb-empty {
  background: #2a2d2d;
}

.recent-strip {
  position: absolute;
  right: 20px;
  bottom: 82px;
  width: 272px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(32, 34, 34, 0.82);
  backdrop-filter: blur(12px);
}

.recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.recent-head strong {
  font-size: 13px;
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.recent-thumb {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: #191b1b;
}

.recent-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.recent-thumb .library-card-media {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  aspect-ratio: 1 / 1;
}

.recent-thumb .library-card-info {
  display: none;
}

.recent-thumb span {
  display: none;
}

.thumb-a {
  background:
    linear-gradient(135deg, rgba(255, 79, 195, 0.86), transparent 48%),
    linear-gradient(30deg, #263d66, #75c8c2);
}

.thumb-b {
  background:
    linear-gradient(150deg, rgba(245, 184, 75, 0.9), transparent 48%),
    linear-gradient(30deg, #f7f0d6, #5bb9ad);
}

.thumb-c {
  background:
    linear-gradient(160deg, rgba(167, 131, 255, 0.92), transparent 50%),
    linear-gradient(30deg, #f6e3e0, #1fa394);
}

.thumb-d {
  background:
    linear-gradient(135deg, #19263c 0 40%, transparent 40%),
    linear-gradient(35deg, #e86d5b, #75c8c2);
}

.thumb-e {
  background:
    linear-gradient(135deg, rgba(78, 238, 200, 0.75), transparent 52%),
    linear-gradient(40deg, #433d7e, #ece1bd);
}

.thumb-f {
  background:
    linear-gradient(135deg, rgba(255, 134, 217, 0.72), transparent 46%),
    linear-gradient(30deg, #212f3f, #c7b18a);
}

.zoom-tools {
  display: flex;
  position: absolute;
  right: 20px;
  bottom: 20px;
  align-items: center;
  gap: 4px;
  padding: 7px;
  border-radius: 999px;
  background: #252828;
}

.zoom-tools button {
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  background: transparent;
  color: #e6e6e6;
  font-size: 13px;
  font-weight: 900;
}

.zoom-tools strong {
  min-width: 54px;
  color: #bababa;
  font-size: 14px;
  text-align: center;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes canvasPulse {
  from {
    box-shadow:
      0 24px 70px rgba(0, 0, 0, 0.42),
      inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  }
  to {
    box-shadow:
      0 24px 70px rgba(0, 0, 0, 0.42),
      0 0 46px rgba(255, 79, 195, 0.2),
      inset 0 0 0 1px rgba(255, 134, 217, 0.2);
  }
}

@keyframes loadingRing {
  to {
    transform: rotate(360deg);
  }
}

@keyframes loadingPreviewDrift {
  0% {
    transform: translate3d(-7%, -5%, 0) scale(1.1);
    filter: blur(30px) saturate(0.94) brightness(0.9);
  }
  50% {
    transform: translate3d(7%, 4%, 0) scale(1.16);
    filter: blur(36px) saturate(1.06) brightness(0.98);
  }
  100% {
    transform: translate3d(-7%, -5%, 0) scale(1.1);
    filter: blur(30px) saturate(0.94) brightness(0.9);
  }
}

@keyframes loadingFlow {
  0% {
    background-position: 0% 50%;
    transform: scale(1.08) translate3d(-2.5%, -1.5%, 0);
  }
  25% {
    background-position: 48% 24%;
    transform: scale(1.1) translate3d(1.8%, -2.4%, 0);
  }
  50% {
    background-position: 100% 74%;
    transform: scale(1.12) translate3d(2.8%, 1.8%, 0);
  }
  75% {
    background-position: 38% 100%;
    transform: scale(1.1) translate3d(-2.2%, 2.8%, 0);
  }
  100% {
    background-position: 0% 50%;
    transform: scale(1.08) translate3d(-2.5%, -1.5%, 0);
  }
}

@keyframes loadingBlurFlow {
  0% {
    background-position: 0% 20%;
    transform: translate3d(-3%, -2.5%, 0) rotate(0deg) scale(1.08);
  }
  35% {
    background-position: 82% 42%;
    transform: translate3d(4%, -1.4%, 0) rotate(2deg) scale(1.14);
  }
  70% {
    background-position: 36% 92%;
    transform: translate3d(1.2%, 4%, 0) rotate(-2deg) scale(1.17);
  }
  100% {
    background-position: 0% 20%;
    transform: translate3d(-3%, -2.5%, 0) rotate(0deg) scale(1.08);
  }
}

@keyframes loadingBackdropFlow {
  0% {
    background-position: 0% 20%;
  }
  25% {
    background-position: 74% 28%;
  }
  50% {
    background-position: 100% 80%;
  }
  75% {
    background-position: 24% 96%;
  }
  100% {
    background-position: 0% 20%;
  }
}

@keyframes rgbFrameSweep {
  to {
    --rgb-angle: 360deg;
  }
}

@keyframes logoWordsClockwise {
  to {
    transform: rotate(360deg);
  }
}

@keyframes logoHCounterClockwise {
  to {
    transform: rotate(-360deg);
  }
}

@keyframes logoRgbFlow {
  0%,
  100% {
    background-position: 0% 50%;
    filter: drop-shadow(0 0 6px rgba(255, 79, 195, 0.38));
  }
  33% {
    background-position: 55% 50%;
    filter: drop-shadow(0 0 7px rgba(93, 244, 255, 0.34));
  }
  66% {
    background-position: 100% 50%;
    filter: drop-shadow(0 0 7px rgba(167, 131, 255, 0.36));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 58px clamp(330px, 36vw, 470px) minmax(0, 1fr);
  }

  .recent-strip {
    display: none;
  }
}

@media (max-width: 860px) {
  html,
  body {
    min-height: 100%;
    overflow: auto;
  }

  body {
    padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    background: #030404;
  }

  .app-shell {
    display: flex;
    min-height: 100vh;
    height: auto;
    flex-direction: column;
  }

  .icon-rail {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    display: grid;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    grid-template-columns: 1fr;
    align-items: center;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 0;
    background: rgba(8, 9, 9, 0.94);
    box-shadow: 0 -16px 34px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(14px);
  }

  .logo,
  .rail-divider,
  .rail-board-stack {
    display: none;
  }

  .rail-bottom {
    position: fixed;
    top: calc(10px + env(safe-area-inset-top, 0px));
    left: 10px;
    z-index: 121;
    display: block;
    width: auto;
    padding: 0;
  }

  .rail-bottom .rail-icon {
    display: none;
  }

  .account-mini {
    width: auto;
    min-height: 36px;
    grid-template-columns: 28px auto;
    align-items: center;
    gap: 7px;
    padding: 4px 10px 4px 5px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    background: rgba(37, 40, 40, 0.86);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(12px);
  }

  .account-mini span {
    width: 28px;
    height: 28px;
  }

  .account-mini small {
    max-width: 84px;
    color: #e8e8e8;
    font-size: 11px;
  }

  .rail-icons {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
  }

  .rail-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 14px;
    background: #151717;
  }

  .rail-icon.active {
    background: linear-gradient(145deg, rgba(255, 79, 195, 0.92), rgba(167, 131, 255, 0.86));
  }

  .control-panel,
  .canvas-area {
    min-height: auto;
  }

  .control-panel {
    order: 2;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-top: 1px solid var(--line);
    box-shadow: none;
  }

  .canvas-area {
    order: 1;
    height: min(62vh, 520px);
    min-height: 330px;
    overflow: hidden;
  }

  body.admin-mode .app-shell {
    display: flex;
  }

  body.admin-mode .canvas-area {
    display: none;
  }

  body.admin-mode .control-panel {
    min-height: calc(100vh - 70px - env(safe-area-inset-bottom, 0px));
  }

  .panel-header {
    min-height: 64px;
    padding: 15px 16px 10px;
  }

  h1 {
    font-size: 22px;
  }

  .compact-stats {
    gap: 8px;
    padding: 10px 16px 8px;
  }

  .compact-stats article {
    min-height: 50px;
  }

  .view-stack {
    overflow: visible;
  }

  .view-panel,
  .view-panel[data-panel="admin"].active {
    height: auto;
    padding: 14px 16px;
    overflow: visible;
  }

  .view-panel[data-panel="library"].active,
  .view-panel[data-panel="queue"].active,
  .view-panel[data-panel="admin"].active {
    overflow: visible;
  }

  .control-panel:not([data-view="home"]) {
    min-height: calc(100vh - 70px - env(safe-area-inset-bottom, 0px));
  }

  .control-panel:not([data-view="home"]) .compact-stats {
    display: none;
  }

  .composer {
    margin: 0 12px 14px;
    padding: 12px;
    border-radius: 16px;
  }

  textarea {
    height: 96px;
    min-height: 96px;
    max-height: 180px;
    font-size: 15px;
  }

  .composer-toolbar {
    gap: 7px;
  }

  .round-button {
    width: 38px;
    height: 38px;
  }

  .counter {
    grid-template-columns: 30px 34px 30px;
  }

  .generate-button {
    min-width: 56px;
    height: 40px;
    padding: 0 10px;
  }

  .ratio-popover {
    left: 12px;
    right: 12px;
    bottom: 68px;
    max-height: min(62vh, 420px);
    overflow-y: auto;
    padding: 14px;
  }

  .ratio-options {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ratio-option {
    min-height: 56px;
  }

  .top-wallet {
    top: 10px;
    right: 10px;
    height: 36px;
    padding: 0 10px;
  }

  .back-to-grid,
  .download-current {
    top: 10px;
    min-height: 34px;
    padding: 0 10px;
  }

  .back-to-grid {
    left: 10px;
  }

  .download-current {
    left: 88px;
  }

  .board-stage {
    top: 54%;
  }

  .zoom-tools {
    left: 50%;
    right: auto;
    bottom: 12px;
    transform: translateX(-50%);
  }

  .zoom-tools button {
    min-height: 32px;
    padding: 0 10px;
  }

  .zoom-tools strong {
    min-width: 48px;
    font-size: 12px;
  }

  .recent-strip {
    display: none;
  }

  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    padding: 0;
  }

  .library-card-media {
    min-height: 120px;
    max-height: 220px;
  }

  .library-card-info {
    display: grid;
  }

  .library-detail .section-row {
    align-items: flex-start;
  }

  #library-download {
    display: inline-flex;
  }

  .queue-list {
    max-height: none;
    overflow: visible;
  }

  .redeem-row,
  .admin-create {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    gap: 12px;
  }

  .admin-hero,
  .admin-search-card,
  .admin-detail-main,
  .admin-detail-adjust {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .admin-hero {
    padding: 14px;
  }

  .admin-hero strong {
    font-size: 22px;
  }

  .admin-metrics,
  .admin-tools,
  .admin-detail-grid,
  .ops-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-detail-adjust input {
    width: 100%;
  }

  .admin-output,
  .admin-output.detail-open {
    overflow: visible;
  }

  .admin-section {
    padding: 12px;
  }

  .admin-section-head {
    align-items: flex-start;
  }

  .admin-table-wrap,
  .admin-section-ops .admin-table-wrap,
  .admin-detail-section.admin-section-ops .admin-table-wrap,
  .admin-section-nav .admin-table-wrap,
  .admin-detail-section .admin-table-wrap,
  .admin-log-wrap {
    max-height: none !important;
    overflow-x: auto;
    overflow-y: visible;
  }

  .admin-table {
    min-width: 620px;
  }

  .admin-section-users .admin-table,
  .admin-section-codes .admin-table {
    min-width: 560px;
  }
}

@media (max-width: 520px) {
  .canvas-area {
    height: 54vh;
    min-height: 300px;
  }

  .rail-icons {
    justify-content: center;
    gap: 2px;
  }

  .rail-icon {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border-radius: 12px;
  }

  .rail-icon svg {
    width: 18px;
    height: 18px;
  }

  .panel-header {
    padding-inline: 14px;
  }

  .compact-stats,
  .view-panel,
  .view-panel[data-panel="admin"].active {
    padding-inline: 14px;
  }

  .library-grid {
    grid-template-columns: 1fr;
  }

  .library-card-media {
    max-height: none;
  }

  .composer-title {
    align-items: flex-start;
  }

  .composer-title div {
    flex-wrap: wrap;
  }

  .textarea-meta {
    flex-direction: column;
    gap: 4px;
  }

  .ratio-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-metrics,
  .admin-detail-grid,
  .ops-grid {
    grid-template-columns: 1fr;
  }

  .admin-table {
    min-width: 680px;
  }
}
