:root {
  color-scheme: light;
  --bg: #eaf8ff;
  --bg-soft: #d7f0ff;
  --surface: rgba(250, 254, 255, 0.62);
  --surface-strong: rgba(246, 252, 255, 0.82);
  --line: rgba(65, 136, 174, 0.24);
  --line-strong: rgba(239, 127, 168, 0.46);
  --feature-line: rgba(45, 113, 151, 0.34);
  --feature-bg: rgba(255, 255, 255, 0.52);
  --feature-shadow: 0 14px 34px rgba(58, 137, 178, 0.12);
  --text: #102a43;
  --text-soft: #28465e;
  --muted: #557084;
  --muted-2: #748ca0;
  --primary: #ef7fa8;
  --primary-2: #56b7ee;
  --accent: #5fbf8f;
  --button-bg: linear-gradient(135deg, rgba(239, 127, 168, 0.96), rgba(86, 183, 238, 0.92));
  --button-shadow: 0 12px 28px rgba(86, 183, 238, 0.24);
  --control-bg: rgba(255, 255, 255, 0.68);
  --tabs-bg: rgba(250, 254, 255, 0.66);
  --tabs-glow: rgba(239, 127, 168, 0.18);
  --tool-bg: rgba(255, 255, 255, 0.42);
  --tool-border: rgba(86, 183, 238, 0.24);
  --top-divider: rgba(65, 136, 174, 0.22);
  --active-tab-bg: linear-gradient(135deg, rgba(239, 127, 168, 0.92), rgba(86, 183, 238, 0.9));
  --glass-glow-primary: rgba(239, 127, 168, 0.2);
  --glass-glow-accent: rgba(95, 191, 143, 0.18);
  --glass-wash: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(214, 243, 255, 0.48) 48%, rgba(255, 220, 234, 0.34));
  --feature-glow: rgba(239, 127, 168, 0.14);
  --feature-inset: rgba(255, 255, 255, 0.78);
  --result-card-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(219, 244, 255, 0.62)), rgba(255, 255, 255, 0.68);
  --result-card-shadow: 0 18px 42px rgba(58, 137, 178, 0.18);
  --progress-track: rgba(86, 183, 238, 0.18);
  --linework-color: rgba(45, 113, 151, 0.1);
  --linework-strong: rgba(239, 127, 168, 0.14);
  --linework-grid: rgba(45, 113, 151, 0.07);
  --linework-opacity: 0.78;
  --background-crystal-primary: rgba(239, 127, 168, 0.46);
  --background-crystal-secondary: rgba(86, 183, 238, 0.32);
  --background-crystal-accent: rgba(95, 191, 143, 0.34);
  --background-crystal-border: rgba(255, 255, 255, 0.34);
  --background-crystal-shadow: rgba(7, 18, 32, 0.34);
  --success: #208a62;
  --danger: #fb7185;
  --warning: #d89416;
  --info: #2563eb;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow: 0 22px 70px rgba(58, 137, 178, 0.22);
  --shadow-soft: 0 14px 36px rgba(58, 137, 178, 0.16);
  --focus: 0 0 0 3px rgba(86, 183, 238, 0.28);
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
  background:
    url("../images/japanese-garden-bg.png") center center / cover fixed no-repeat,
    var(--bg);
}

body.custom-bg {
  background-image:
    var(--custom-bg-image),
    radial-gradient(circle at 50% 46%, var(--glass-glow-primary), transparent 42%),
    linear-gradient(135deg, var(--bg-soft), var(--bg));
  background-position: center center, center center, center center;
  background-size: cover, cover, cover;
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-attachment: fixed, fixed, fixed;
  background-color: var(--bg);
}

html.bg-only-page,
html.bg-only-page body {
  height: 100%;
  max-height: 100dvh;
  overflow: hidden !important;
  overscroll-behavior: none;
  scrollbar-width: none !important;
}

html.bg-only-page::-webkit-scrollbar,
html.bg-only-page body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  display: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: none;
}

body.bg-only {
  cursor: zoom-out;
  overflow: hidden !important;
  scrollbar-width: none !important;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: var(--bg);
}

body.bg-only *,
body.bg-only *::before,
body.bg-only *::after {
  scrollbar-width: none !important;
}

body.bg-only *::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

body.bg-only.custom-bg {
  background-size: cover, cover, cover;
  background-position: center center, center center, center center;
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-attachment: fixed, fixed, fixed;
}

body.bg-only::after {
  display: none;
}

body.bg-only .wrap,
body.bg-only .network-status,
body.bg-only .preview-overlay {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

button,
input,
textarea,
select {
  font: inherit;
  min-width: 0;
  max-width: 100%;
}

button,
a,
input,
textarea,
select {
  pointer-events: auto;
}

button {
  border: 0;
  color: #ffffff;
  cursor: pointer;
  border-radius: var(--radius-sm);
  background: var(--button-bg);
  box-shadow: var(--button-shadow);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, opacity 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--control-bg);
  padding: 11px 12px;
}

textarea {
  min-height: 118px;
  resize: vertical;
  line-height: 1.65;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 14px;
  font-weight: 700;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.scan-line {
  display: none;
}

.particles {
  display: none;
}

.weather-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100vw;
  height: 100dvh;
  pointer-events: none;
  opacity: 0;
  transition: opacity 260ms ease;
}

body.weather-active .weather-canvas {
  opacity: 1;
}

.ripple-canvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100vw;
  height: 100dvh;
  pointer-events: none;
  opacity: 0.9;
  mix-blend-mode: screen;
  contain: strict;
  transform: translateZ(0);
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(231, 162, 168, 0.7);
  animation: float 16s ease-in-out infinite;
}

.wrap {
  position: relative;
  z-index: 2;
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto 0 clamp(16px, 3.4vw, 72px);
  padding: 28px 0 48px;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.top-tabs {
  position: sticky;
  top: 12px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 92% 18%, var(--tabs-glow), transparent 32%),
    var(--tabs-bg);
  backdrop-filter: blur(18px) saturate(1.18);
}

.top-tabs.scrolled {
  box-shadow: var(--shadow-soft);
}

.top-tab {
  min-width: 110px;
  padding: 10px 16px;
  color: var(--text-soft);
  background: transparent;
  box-shadow: none;
}

.top-tab.active {
  color: #ffffff;
  background: var(--active-tab-bg);
}

.top-tool {
  min-width: auto;
  color: var(--text-soft);
  border-color: var(--tool-border);
  background: var(--tool-bg);
}

.top-tool.subtle {
  color: var(--muted);
  background: rgba(215, 240, 255, 0.44);
}

.top-tool.random-running,
.top-tool[aria-pressed="true"] {
  color: #ffffff;
  border-color: rgba(95, 191, 143, 0.42);
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.28), transparent 34%),
    linear-gradient(135deg, rgba(95, 191, 143, 0.96), rgba(86, 183, 238, 0.92));
  box-shadow: 0 12px 26px rgba(95, 191, 143, 0.2);
}

.top-divider {
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: var(--top-divider);
}

.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
}

.jump-anchor {
  scroll-margin-top: 96px;
}

.jump-anchor.is-jump-highlight {
  animation: jumpHighlight 1200ms ease;
}

.draw-layout {
  display: grid;
  grid-template-columns: minmax(420px, 660px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.draw-layout > .main-card,
.draw-layout > .side-panel {
  grid-column: 1;
}

.card,
.side-panel,
.data-manager-card,
.gallery-control-panel,
.gallery-card {
  position: relative;
  isolation: isolate;
  --linework-radius: var(--radius-lg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 94% 8%, var(--glass-glow-primary) 0 8%, transparent 17%),
    radial-gradient(ellipse at 88% 20%, var(--glass-glow-accent) 0 9%, transparent 18%),
    var(--glass-wash),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(1.24);
}

.card::before,
.side-panel::before,
.data-manager-card::before,
.gallery-control-panel::before,
.gallery-card::before,
.panel::before,
.current-api-display::before,
.custom-size-panel::before,
.gen-control-panel::before,
.gen-progress::before,
.result-area::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  clip-path: inset(0 round var(--linework-radius, var(--radius-lg)));
  opacity: var(--linework-opacity);
  background:
    radial-gradient(ellipse 48px 22px at calc(100% - 88px) 58px, transparent 59%, var(--linework-strong) 60% 62%, transparent 63%),
    radial-gradient(ellipse 22px 48px at calc(100% - 66px) 78px, transparent 59%, var(--linework-strong) 60% 62%, transparent 63%),
    radial-gradient(ellipse 38px 18px at calc(100% - 118px) 96px, transparent 58%, var(--linework-color) 59% 61%, transparent 62%),
    radial-gradient(ellipse 18px 38px at calc(100% - 102px) 118px, transparent 58%, var(--linework-color) 59% 61%, transparent 62%),
    linear-gradient(128deg, transparent 0 61%, var(--linework-color) 61.15% 61.55%, transparent 61.7%),
    repeating-linear-gradient(0deg, transparent 0 27px, var(--linework-grid) 28px, transparent 29px),
    repeating-linear-gradient(90deg, transparent 0 27px, var(--linework-grid) 28px, transparent 29px);
  background-blend-mode: normal;
}

.card > *,
.side-panel > *,
.data-manager-card > *,
.gallery-control-panel > *,
.gallery-card > *,
.panel > *,
.current-api-display > *,
.custom-size-panel > *,
.gen-control-panel > *,
.gen-progress > *,
.result-area > * {
  position: relative;
  z-index: 1;
}

.main-card {
  padding: 26px;
  min-width: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 40px;
  line-height: 1.1;
  font-family: "Noto Serif SC", "Songti SC", STSong, SimSun, serif;
  font-weight: 650;
}

h2 {
  margin-bottom: 16px;
  font-size: 22px;
}

.sub,
.compress-hint {
  color: var(--muted);
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.panel,
.current-api-display,
.custom-size-panel,
.gen-control-panel,
.gen-progress,
.result-area {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--feature-line);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 100% 0%, var(--feature-glow), transparent 28%),
    var(--feature-bg);
  box-shadow:
    inset 0 1px 0 var(--feature-inset),
    var(--feature-shadow);
  backdrop-filter: blur(14px) saturate(1.16);
}

.panel,
.current-api-display,
.custom-size-panel,
.gen-control-panel,
.gen-progress,
.result-area {
  position: relative;
  isolation: isolate;
  --linework-radius: var(--radius-md);
}

.main-card > .panel:first-child {
  margin-top: 0;
}

.panel-title-row,
.network-status-header,
.data-manager-header,
.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  margin: 0;
  font-size: 15px;
}

.icon-btn,
.pwd-toggle,
.toggle-manager-btn,
.cancel-gen-btn,
.preview-close,
.preview-nav {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  box-shadow: none;
}

.api-config-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.api-config-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.5);
}

.api-config-item.active {
  border-color: var(--line-strong);
  background: rgba(255, 224, 236, 0.48);
}

.api-config-name {
  font-weight: 800;
}

.api-config-info,
.api-config-details,
.api-config-actions {
  min-width: 0;
}

.api-config-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.api-config-detail {
  overflow-wrap: anywhere;
}

.api-config-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 6px;
}

.api-config-actions button,
.secondary,
.ghost,
.history-btn,
.data-action-btn,
.network-btn,
.prompt-toggle-btn,
.copy-prompt,
.set-bg-btn,
.variant-btn,
.del-btn {
  padding: 8px 10px;
  border: 1px solid var(--line);
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.48);
  box-shadow: none;
}

.api-config-actions .active-btn {
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.42);
}

.delete-btn,
.danger,
.del-btn {
  color: #b91c4f;
  border-color: rgba(251, 113, 133, 0.32);
}

.warning {
  color: #9a4a12;
  border-color: rgba(216, 148, 22, 0.38);
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.86), rgba(255, 237, 213, 0.64));
}

.full-width {
  width: 100%;
  min-height: 42px;
}

.api-manager-panel {
  margin: 12px 0;
}

.form-row,
.setting-row,
.setting-row3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.form-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-row.single,
.setting-row.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setting-row,
.setting-row3,
.prompt-section {
  padding: 14px;
  border: 1px solid rgba(65, 136, 174, 0.2);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.34);
}

.setting-row > div,
.setting-row3 > div,
.gen-count-section {
  padding: 12px;
  border: 1px solid rgba(65, 136, 174, 0.22);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.42);
}

.prompt-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.prompt-section textarea {
  min-height: 146px;
}

.style-chip-panel,
.recipe-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(65, 136, 174, 0.18);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0.26)),
    repeating-linear-gradient(135deg, rgba(65, 136, 174, 0.055) 0 1px, transparent 1px 14px);
}

.chip-tools,
.recipe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.chip-tools button,
.recipe-actions button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.chip-tools #styleChipToggleBtn {
  color: var(--text);
  border: 1px solid rgba(95, 191, 143, 0.28);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: none;
}

.style-chip-list {
  display: grid;
  gap: 12px;
}

.style-chip-panel.is-collapsed {
  gap: 8px;
}

.style-chip-panel.is-collapsed .style-chip-list {
  max-height: 290px;
  overflow: auto;
  padding-right: 4px;
}

.style-chip-panel.is-collapsed .style-chip-group {
  gap: 6px;
}

.style-chip-panel.is-collapsed .style-chip-group-header {
  align-items: center;
}

.style-chip-panel.is-collapsed .style-chip-group-title span,
.style-chip-panel.is-collapsed .style-chip-desc,
.style-chip-panel.is-collapsed .chip-hint {
  display: none;
}

.style-chip-panel.is-collapsed .style-chip-grid {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 6px;
}

.style-chip-panel.is-collapsed .style-chip {
  min-height: 42px;
  align-content: center;
  padding: 8px 10px;
}

.style-chip-group {
  display: grid;
  gap: 8px;
}

.style-chip-group-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 0;
}

.style-chip-group-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.style-chip-group-title strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.2;
}

.style-chip-group-title span,
.style-chip-count {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.style-chip-count {
  flex: 0 0 auto;
}

.style-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 8px;
}

.style-chip {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid rgba(65, 136, 174, 0.18);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  text-align: left;
  background:
    radial-gradient(circle at 16% 16%, rgba(239, 127, 168, 0.16), transparent 34%),
    rgba(255, 255, 255, 0.48);
  box-shadow: none;
}

.style-chip[aria-pressed="true"] {
  color: var(--text);
  border-color: rgba(52, 211, 153, 0.54);
  background:
    radial-gradient(circle at 82% 20%, rgba(52, 211, 153, 0.18), transparent 38%),
    rgba(255, 255, 255, 0.66);
  box-shadow: 0 10px 24px rgba(5, 150, 105, 0.12);
}

.style-chip-label {
  font-size: 13px;
  font-weight: 900;
}

.style-chip-desc,
.chip-hint,
.recipe-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.chip-hint {
  margin: 0;
}

.recipe-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
}

.recipe-card {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid rgba(65, 136, 174, 0.16);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.44);
}

.recipe-title {
  color: var(--text);
  font-size: 13px;
}

.recipe-text {
  max-height: 64px;
  margin: 0;
  overflow: auto;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.recipe-empty {
  color: var(--muted);
  font-size: 13px;
}

.form-row.single > div {
  grid-column: 1 / -1;
}

.pwd-wrap,
.combo {
  position: relative;
  display: flex;
  gap: 8px;
}

.pwd-wrap input {
  padding-right: 50px;
}

.pwd-wrap .pwd-toggle {
  position: absolute;
  right: 4px;
  top: 4px;
  width: 34px;
  height: 34px;
  font-size: 12px;
}

.combo-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  display: none;
  max-height: 240px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(248, 254, 255, 0.96);
  box-shadow: var(--shadow-soft);
  z-index: 80;
}

.combo-panel.open {
  display: block;
}

.combo-item,
.combo-empty,
.model-item {
  padding: 9px 10px;
  border-radius: 6px;
  color: var(--text-soft);
}

.combo-item:hover,
.model-item:hover,
.combo-item.active,
.model-item.selected {
  background: rgba(239, 127, 168, 0.16);
  color: var(--text);
}

.model-list-display {
  margin: 12px 0;
}

.model-list-content {
  max-height: 220px;
  overflow: auto;
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.46);
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.current-api-display {
  display: flex;
  align-items: center;
  gap: 8px;
}

.current-api-display strong {
  color: var(--success);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.network-status-title,
.network-status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
}

.network-status {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 86;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 36px);
  padding: 9px 12px;
  border: 1px solid var(--background-crystal-border);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.9);
  background:
    radial-gradient(circle at 20% 12%, rgba(255, 255, 255, 0.32), transparent 34%),
    linear-gradient(135deg, rgba(18, 42, 64, 0.46), var(--background-crystal-secondary)),
    rgba(7, 18, 32, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 14px 34px var(--background-crystal-shadow),
    0 0 22px var(--glass-glow-primary);
  backdrop-filter: blur(16px) saturate(1.12);
  transition: opacity 180ms ease, visibility 180ms ease, transform 180ms ease;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 14px rgba(156, 207, 154, 0.62);
}

.status-dot.offline {
  background: var(--danger);
}

.status-dot.checking {
  background: var(--warning);
  animation: pulse 1s ease-in-out infinite;
}

.network-ping {
  min-width: 52px;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  background: rgba(255, 255, 255, 0.1);
}

.network-status-details,
.storage-info,
.progress-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.network-detail-item,
.storage-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.42);
}

.storage-info {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.storage-item {
  min-height: 76px;
  padding: 16px 18px;
  border-color: rgba(65, 136, 174, 0.24);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(239, 249, 255, 0.5)),
    rgba(255, 255, 255, 0.48);
}

.storage-value {
  display: block;
  color: var(--text);
  font-size: 26px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

#storageQuota.storage-value {
  font-size: 15px;
  line-height: 1.45;
}

.detail-label,
.storage-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.network-actions,
.data-actions,
.examples-buttons,
.gen-count-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.data-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.data-action-btn {
  min-height: 48px;
  padding: 10px 14px;
  font-size: 17px;
  font-weight: 700;
}

.data-action-btn:disabled {
  color: rgba(40, 70, 94, 0.46);
  border-color: rgba(65, 136, 174, 0.16);
  background: rgba(255, 255, 255, 0.38);
  opacity: 1;
}

.diag-result {
  display: none;
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.58);
  color: var(--text-soft);
  line-height: 1.6;
}

.diag-result.show {
  display: block;
}

.thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.thumb-add,
.thumb-item {
  width: 88px;
  height: 88px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.58);
}

.thumb-add {
  font-size: 34px;
  color: #b2265b;
}

.thumb-item {
  position: relative;
  overflow: hidden;
}

.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  background: rgba(16, 42, 67, 0.72);
}

.history-btn {
  width: 100%;
  min-height: 44px;
  margin-top: 2px;
  justify-content: center;
}

.history-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  color: #213a52;
  border-color: rgba(65, 136, 174, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(230, 246, 255, 0.62));
}

.history-badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  margin-left: 6px;
  border-radius: 999px;
  background: rgba(86, 183, 238, 0.18);
}

.prompt-history-panel {
  display: none;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.54);
}

.prompt-history-panel.open {
  display: block;
}

.prompt-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
}

.prompt-history-item:hover {
  background: rgba(239, 127, 168, 0.1);
}

.prompt-history-text {
  color: var(--text-soft);
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-history-empty,
.gallery-empty {
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.gen-control-panel {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(260px, 330px);
  gap: 28px;
  align-items: center;
}

.gen-count-label {
  display: block;
  color: var(--text-soft);
  font-weight: 800;
  margin-bottom: 8px;
}

.gen-count-section {
  min-width: 0;
}

.gen-count-options {
  gap: 12px;
}

.gen-count-btn {
  width: 62px;
  height: 50px;
  color: #203a52;
  border: 1px solid rgba(65, 136, 174, 0.28);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: none;
  font-size: 18px;
  font-weight: 900;
  opacity: 1;
}

.gen-count-btn.active {
  color: #ffffff;
  background: linear-gradient(135deg, rgba(239, 127, 168, 0.92), rgba(95, 191, 143, 0.82));
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 12px 26px rgba(239, 127, 168, 0.22);
}

.gen-count-btn:disabled {
  color: rgba(16, 42, 67, 0.42);
  border-color: rgba(65, 136, 174, 0.18);
  background: rgba(255, 255, 255, 0.54);
  opacity: 1;
}

.gen-btn-new {
  position: relative;
  min-height: 72px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 42px rgba(86, 183, 238, 0.24);
  font-size: 18px;
  font-weight: 900;
}

.gen-btn-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 250, 243, 0.32), transparent);
  transform: translateX(-120%);
}

.gen-btn-new:hover .gen-btn-shine {
  animation: shimmer 900ms ease;
}

.progress-bar-container {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--progress-track);
  margin: 12px 0;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), var(--accent), var(--primary));
  transition: width 220ms ease;
}

.result-area {
  display: none;
}

.result-area.active {
  display: block;
}

.result-grid,
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  align-items: start;
}

.gallery-grid.masonry-layout {
  display: block;
  column-count: 3;
  column-gap: 18px;
}

.gallery-grid.masonry-layout .gallery-item {
  display: inline-grid;
  width: 100%;
  margin: 0 0 18px;
  break-inside: avoid;
}

.gallery-grid.masonry-layout .flip-card-front,
.gallery-grid.masonry-layout .normal-image,
.gallery-grid.masonry-layout .gallery-item img {
  aspect-ratio: auto;
  height: auto;
}

.result-card,
.gallery-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--result-card-bg);
  box-shadow: var(--result-card-shadow);
}

.gallery-item {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  content-visibility: auto;
  contain-intrinsic-size: 420px 560px;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.gallery-item:hover {
  transform: translateY(-2px);
  border-color: rgba(239, 127, 168, 0.34);
  box-shadow:
    0 22px 54px rgba(58, 137, 178, 0.24),
    0 0 0 3px rgba(239, 127, 168, 0.08);
}

.result-card img,
.gallery-item img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  cursor: zoom-in;
}

.broken-image-notice {
  display: grid;
  place-items: center;
  gap: 8px;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  color: var(--text-soft);
  text-align: center;
  background: rgba(255, 255, 255, 0.58);
}

.broken-image-notice span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.result-card .label,
.result-info,
.gallery-item .info {
  padding: 12px;
}

.result-info {
  display: grid;
  gap: 10px;
}

.gallery-item .info {
  display: grid;
  gap: 12px;
  padding: 14px;
  align-content: start;
}

.actions,
.meta,
.prompt-row,
.ref-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.status-bar {
  display: none;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.58);
  white-space: pre-wrap;
}

.status-bar.show {
  display: block;
}

.status-bar.done {
  border-color: rgba(52, 211, 153, 0.4);
  color: #047857;
}

.status-bar.err {
  border-color: rgba(251, 113, 133, 0.4);
  color: #be123c;
}

.status-bar.info {
  border-color: rgba(96, 165, 250, 0.4);
  color: #1d4ed8;
}

.side-panel {
  position: sticky;
  top: 92px;
  padding: 18px;
  max-height: calc(100vh - 120px);
  overflow: auto;
}

.side-panel-header {
  font-size: 18px;
}

.loading-mini {
  display: none;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  color: var(--muted);
}

.loading-mini.active {
  display: grid;
}

.spinner-sm {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 226, 198, 0.22);
  border-top-color: var(--primary-2);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}

.stats-row {
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.event-log,
.text-stream {
  display: none;
  max-height: 360px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.54);
}

.event-log.active,
.text-stream.active {
  display: block;
}

.event-line {
  padding: 7px 0;
  border-bottom: 1px solid rgba(65, 136, 174, 0.12);
  color: var(--text-soft);
  font-size: 13px;
}

.event-tag,
.data-tag,
.text-tag,
.done-tag {
  display: inline-block;
  min-width: 52px;
  margin-right: 8px;
  color: #b2265b;
  font-weight: 800;
}

.done-tag {
  color: var(--success);
}

.data-manager-card {
  padding: 18px;
  margin-bottom: 18px;
}

.data-manager-title {
  color: var(--text);
  font-size: 20px;
}

.toggle-manager-btn {
  color: var(--text-soft);
  font-size: 18px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.62);
}

.data-manager-content.collapsed {
  display: none;
}

.gallery-container {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.gallery-control-panel,
.gallery-card {
  padding: 18px;
}

.gallery-card {
  background:
    radial-gradient(circle at 100% 0%, rgba(239, 127, 168, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(219, 244, 255, 0.52)),
    var(--surface);
}

.gallery-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-top: 0;
  margin-bottom: 18px;
}

.gallery-card h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
}

.gallery-control-panel {
  position: sticky;
  top: 92px;
}

.panel-section {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(65, 136, 174, 0.22);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.38);
}

.panel-section + .panel-section {
  margin-top: 12px;
}

.radio-group,
.checkbox-group {
  display: grid;
  gap: 8px;
  color: var(--text-soft);
}

.gallery-count {
  color: #176b9a;
  font-size: 14px;
}

.thumb-wrap {
  position: relative;
  perspective: 900px;
  overflow: hidden;
  background:
    radial-gradient(circle at 28% 20%, rgba(239, 127, 168, 0.18), transparent 34%),
    rgba(255, 255, 255, 0.56);
}

.flip-card-inner {
  position: relative;
  transform-style: preserve-3d;
  transition: transform 420ms ease;
}

.gallery-item.card-mode .thumb-wrap:hover .flip-card-inner {
  transform: none;
}

.flip-card-front,
.flip-card-back,
.normal-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-bottom: 1px solid var(--line);
}

.flip-card-front,
.flip-card-back {
  backface-visibility: hidden;
}

.flip-card-front {
  position: relative;
  display: block;
  background:
    linear-gradient(135deg, rgba(239, 127, 168, 0.13), rgba(86, 183, 238, 0.12)),
    repeating-linear-gradient(45deg, rgba(65, 136, 174, 0.07) 0 1px, transparent 1px 12px);
}

.card-back-symbol {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(16, 107, 154, 0.62);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  backdrop-filter: blur(10px);
}

.flip-card-back {
  position: absolute;
  inset: 0;
  transform: rotateY(180deg);
}

.mode-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  background: rgba(255, 255, 255, 0.68);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.gallery-summary {
  display: grid;
  gap: 10px;
}

.gallery-style-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.prompt-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.gallery-style-pill,
.prompt-tag {
  padding: 5px 9px;
  border: 1px solid rgba(65, 136, 174, 0.18);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.42);
}

.gallery-style-pill {
  color: var(--text-soft);
  border-color: rgba(239, 127, 168, 0.2);
  background: rgba(255, 255, 255, 0.5);
}

.gallery-time {
  color: rgba(16, 42, 67, 0.72);
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.4;
}

.gallery-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.gallery-actions button {
  width: 100%;
  min-width: 0;
}

.gallery-prompt-panel[hidden] {
  display: none !important;
}

.gallery-prompt-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(65, 136, 174, 0.18);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.48);
}

.gallery-prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.prompt-text {
  max-height: 132px;
  margin: 0;
  overflow: auto;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.prompt-toggle-btn,
.copy-prompt,
.set-bg-btn,
.variant-btn,
.del-btn {
  min-height: 36px;
}

.prompt-toggle-btn {
  justify-content: center;
  width: 100%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.52);
}

.copy-prompt {
  white-space: nowrap;
}

.del-btn {
  color: #b91c4f;
  border-color: rgba(251, 113, 133, 0.34);
  background: rgba(251, 113, 133, 0.1);
}

.set-bg-btn {
  color: #176b9a;
  border-color: rgba(86, 183, 238, 0.28);
  background: rgba(219, 244, 255, 0.34);
}

.variant-btn {
  color: #7c3aed;
  border-color: rgba(167, 139, 250, 0.28);
  background: rgba(237, 233, 254, 0.34);
}

.ref-thumb {
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.ref-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.86);
  z-index: 200;
}

.preview-overlay.open {
  display: flex;
}

.preview-overlay img {
  max-width: min(92vw, 1200px);
  max-height: 84vh;
  object-fit: contain;
  cursor: grab;
  user-select: none;
  transition: transform 80ms linear;
}

.preview-overlay img.dragging {
  cursor: grabbing;
}

.preview-close {
  position: fixed;
  top: 18px;
  right: 18px;
  font-size: 28px;
}

.preview-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 72px;
  font-size: 48px;
}

.preview-nav.disabled {
  opacity: 0.25;
  pointer-events: none;
}

.preview-nav-prev {
  left: 18px;
}

.preview-nav-next {
  right: 18px;
}

.preview-counter,
.preview-hint {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(16, 42, 67, 0.78);
  color: #ffffff;
}

.preview-counter {
  top: 18px;
}

.preview-hint {
  bottom: 22px;
}

.background-overlay {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: min(560px, calc(100vw - 32px));
  padding: 28px 18px 0;
  transform: translate(-50%, 12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease, transform 180ms ease;
}

.background-overlay::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -12px;
  width: min(660px, calc(100vw - 16px));
  height: 118px;
  transform: translateX(-50%);
}

body.bg-only .background-overlay {
  visibility: visible;
  pointer-events: auto;
}

body.bg-only .background-overlay:hover,
body.bg-only .background-overlay:focus-within,
body.bg-only .background-overlay.is-countdown-visible,
body.bg-only.background-countdown-visible .background-overlay {
  opacity: 1;
  transform: translate(-50%, 0);
}

.background-clock,
.background-nav-btn,
.background-delete-btn,
.background-fullscreen-btn {
  position: relative;
  z-index: 1;
  border: 1px solid var(--background-crystal-border);
  color: rgba(255, 255, 255, 0.94);
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.36), transparent 30%),
    linear-gradient(135deg, rgba(16, 42, 67, 0.42), var(--background-crystal-secondary)),
    rgba(7, 18, 32, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -10px 24px rgba(255, 255, 255, 0.05),
    0 16px 40px var(--background-crystal-shadow);
  backdrop-filter: blur(18px) saturate(1.16);
}

.background-clock {
  display: grid;
  min-width: 210px;
  gap: 3px;
  justify-items: center;
  padding: 10px 20px;
  border-radius: 999px;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.34);
}

.background-clock strong {
  font-size: 22px;
  line-height: 1;
  letter-spacing: 0;
}

.background-clock span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.76);
}

.background-countdown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  margin-top: 2px;
  padding: 2px 9px 3px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.88) !important;
  font-size: 12px !important;
  font-weight: 800;
  line-height: 1.15;
  background:
    radial-gradient(circle at 24% 18%, rgba(255, 255, 255, 0.24), transparent 42%),
    linear-gradient(135deg, var(--background-crystal-secondary), var(--background-crystal-primary));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    0 7px 18px rgba(0, 0, 0, 0.16);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.28);
}

.background-nav-btn,
.background-delete-btn,
.background-fullscreen-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 800;
  overflow: hidden;
}

.background-nav-btn {
  font-size: 30px;
  line-height: 1;
}

.background-delete-btn,
.background-fullscreen-btn {
  min-width: 90px;
  padding-inline: 18px;
  color: #fff7f8;
  font-size: 19px;
  font-weight: 900;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18),
    0 7px 22px rgba(0, 0, 0, 0.32);
  background:
    radial-gradient(circle at 26% 14%, rgba(255, 255, 255, 0.58), transparent 24%),
    radial-gradient(circle at 82% 78%, var(--background-crystal-accent), transparent 42%),
    linear-gradient(135deg, var(--background-crystal-primary), var(--background-crystal-secondary)),
    rgba(7, 18, 32, 0.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    inset 0 -14px 28px rgba(255, 255, 255, 0.08),
    0 16px 42px var(--background-crystal-shadow),
    0 0 30px var(--glass-glow-primary);
}

.background-fullscreen-btn {
  color: rgba(255, 255, 255, 0.96);
  background:
    radial-gradient(circle at 24% 14%, rgba(255, 255, 255, 0.62), transparent 24%),
    radial-gradient(circle at 82% 78%, var(--background-crystal-accent), transparent 44%),
    linear-gradient(135deg, var(--background-crystal-secondary), rgba(255, 255, 255, 0.16)),
    rgba(7, 18, 32, 0.32);
}

.background-fullscreen-btn.is-active {
  min-width: 104px;
  border-color: rgba(255, 255, 255, 0.6);
  background:
    radial-gradient(circle at 24% 14%, rgba(255, 255, 255, 0.72), transparent 24%),
    radial-gradient(circle at 80% 78%, var(--background-crystal-primary), transparent 44%),
    linear-gradient(135deg, var(--background-crystal-accent), var(--background-crystal-secondary)),
    rgba(7, 18, 32, 0.34);
}

.background-delete-btn::before,
.background-fullscreen-btn::before {
  content: "";
  position: absolute;
  inset: 1px 8px auto;
  height: 42%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent);
  pointer-events: none;
}

.background-delete-btn::after,
.background-fullscreen-btn::after {
  content: "";
  position: absolute;
  top: -55%;
  bottom: -55%;
  left: -70%;
  width: 46%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  opacity: 0;
  pointer-events: none;
}

.background-delete-btn:hover::after,
.background-delete-btn.is-confirming::after,
.background-fullscreen-btn:hover::after,
.background-fullscreen-btn.is-active::after {
  left: 122%;
  opacity: 1;
  transition: left 680ms ease, opacity 220ms ease;
}

.background-delete-btn.is-confirming {
  min-width: 126px;
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.58);
  background:
    radial-gradient(circle at 24% 14%, rgba(255, 255, 255, 0.68), transparent 24%),
    radial-gradient(circle at 80% 78%, var(--background-crystal-accent), transparent 44%),
    linear-gradient(135deg, var(--background-crystal-secondary), var(--background-crystal-primary)),
    rgba(7, 18, 32, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    inset 0 -14px 30px rgba(255, 255, 255, 0.1),
    0 18px 48px var(--background-crystal-shadow),
    0 0 38px var(--glass-glow-primary);
}

.background-nav-btn:hover,
.background-delete-btn:hover,
.background-fullscreen-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.5);
}

.background-nav-btn:disabled,
.background-delete-btn:disabled,
.background-fullscreen-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.bottom-tools {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  transition: opacity 180ms ease, visibility 180ms ease;
}

body.bg-only .bottom-tools {
  min-width: min(390px, calc(100vw - 28px));
  min-height: 96px;
  align-items: flex-end;
  pointer-events: auto;
}

body.bg-only .bottom-tools::before {
  content: "";
  position: absolute;
  right: -12px;
  bottom: -12px;
  width: min(430px, calc(100vw - 12px));
  height: 124px;
}

.bottom-tools > * {
  position: relative;
  z-index: 1;
}

.season-weather-panel {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--background-crystal-border);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.9);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.42), transparent 30%),
    linear-gradient(135deg, var(--background-crystal-secondary), var(--background-crystal-primary)),
    rgba(7, 18, 32, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    inset 0 -10px 24px rgba(255, 255, 255, 0.06),
    0 18px 44px var(--background-crystal-shadow),
    0 0 28px var(--glass-glow-primary);
  backdrop-filter: blur(18px) saturate(1.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease, transform 180ms ease;
}

body.bg-only .bottom-tools:hover .season-weather-panel,
body.bg-only .bottom-tools:focus-within .season-weather-panel,
body.bg-only.background-countdown-visible .season-weather-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.season-weather-label {
  padding: 0 8px 0 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.34);
  white-space: nowrap;
}

.season-weather-btn {
  position: relative;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, 0.38), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 10px 22px rgba(0, 0, 0, 0.12);
  text-shadow: 0 1px 9px rgba(0, 0, 0, 0.32);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.season-weather-btn::before {
  content: "";
  position: absolute;
  inset: 1px 7px auto;
  height: 40%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.44), transparent);
  pointer-events: none;
}

.season-weather-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.48);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 14px 28px rgba(0, 0, 0, 0.18),
    0 0 24px var(--glass-glow-primary);
}

.season-weather-btn.is-active {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.58);
  background:
    radial-gradient(circle at 26% 14%, rgba(255, 255, 255, 0.62), transparent 26%),
    radial-gradient(circle at 80% 78%, var(--background-crystal-accent), transparent 45%),
    linear-gradient(135deg, var(--background-crystal-primary), var(--background-crystal-secondary));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    inset 0 -12px 24px rgba(255, 255, 255, 0.08),
    0 14px 34px var(--background-crystal-shadow),
    0 0 30px var(--glass-glow-primary);
}

.page-toc-wrap {
  position: relative;
  flex: 0 0 auto;
}

.page-toc-panel {
  position: absolute;
  right: 0;
  bottom: 56px;
  z-index: 4;
  width: min(286px, calc(100vw - 28px));
  max-height: min(560px, calc(100vh - 120px));
  padding: 10px;
  border: 1px solid var(--background-crystal-border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.52), transparent 28%),
    radial-gradient(circle at 90% 96%, var(--background-crystal-accent), transparent 38%),
    linear-gradient(135deg, rgba(18, 42, 64, 0.52), var(--background-crystal-secondary)),
    rgba(7, 18, 32, 0.46);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.44),
    inset 0 -16px 34px rgba(255, 255, 255, 0.06),
    0 18px 48px var(--background-crystal-shadow),
    0 0 34px var(--glass-glow-primary);
  backdrop-filter: blur(20px) saturate(1.18);
  overflow: auto;
}

.page-toc-panel[hidden] {
  display: none;
}

.page-toc-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 10px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.34);
}

.page-toc-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.38), transparent);
}

.page-toc-list {
  display: grid;
  gap: 6px;
}

.page-toc-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 7px 10px 7px 7px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.9);
  background:
    radial-gradient(circle at 20% 12%, rgba(255, 255, 255, 0.2), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 8px 20px rgba(0, 0, 0, 0.12);
  text-align: left;
}

.page-toc-item:hover,
.page-toc-item:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.42);
  background:
    radial-gradient(circle at 20% 12%, rgba(255, 255, 255, 0.3), transparent 34%),
    linear-gradient(135deg, var(--background-crystal-primary), var(--background-crystal-secondary));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 12px 28px var(--background-crystal-shadow),
    0 0 22px var(--glass-glow-primary);
}

.page-toc-index {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 12px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.12);
}

.page-toc-text {
  overflow: hidden;
  color: inherit;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.28);
}

.page-toc-btn {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--background-crystal-border);
  color: rgba(255, 255, 255, 0.92);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  background:
    radial-gradient(circle at 28% 14%, rgba(255, 255, 255, 0.5), transparent 28%),
    linear-gradient(135deg, var(--background-crystal-primary), var(--background-crystal-secondary)),
    rgba(7, 18, 32, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.48),
    0 16px 36px var(--background-crystal-shadow),
    0 0 24px var(--glass-glow-primary);
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(18px) saturate(1.14);
}

.page-toc-btn:hover,
.page-toc-btn[aria-expanded="true"] {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.54);
  color: #ffffff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 18px 42px var(--background-crystal-shadow),
    0 0 30px var(--glass-glow-primary);
}

body.bg-only .page-toc-wrap {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes scan {
  from { transform: translateY(-4vh); }
  to { transform: translateY(104vh); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); opacity: 0.25; }
  50% { transform: translateY(-32px); opacity: 0.72; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@keyframes shimmer {
  to { transform: translateX(120%); }
}

@keyframes jumpHighlight {
  0% {
    outline: 1px solid rgba(255, 255, 255, 0);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
  22% {
    outline: 1px solid var(--background-crystal-border);
    box-shadow:
      0 0 0 4px rgba(255, 255, 255, 0.16),
      0 0 34px var(--glass-glow-primary);
  }
  100% {
    outline: 1px solid rgba(255, 255, 255, 0);
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1100px) {
  .draw-layout,
  .gallery-container {
    grid-template-columns: 1fr;
  }

  .gallery-grid.masonry-layout {
    column-count: 2;
  }

  .side-panel,
  .gallery-control-panel {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .wrap {
    width: 100%;
    margin: 0;
    padding: 14px 8px 88px;
    overflow: hidden;
  }

  .main-card,
  .side-panel,
  .data-manager-card,
  .gallery-control-panel,
  .gallery-card {
    padding: 14px;
    border-radius: 12px;
    overflow: hidden;
  }

  h1 {
    font-size: 30px;
  }

  .form-row,
  .form-row.single,
  .setting-row,
  .setting-row.two,
  .network-status-details,
  .storage-info,
  .progress-stats,
  .gen-control-panel {
    grid-template-columns: 1fr;
  }

  .panel,
  .current-api-display,
  .custom-size-panel,
  .gen-control-panel,
  .gen-progress,
  .result-area {
    padding: 16px;
  }

  .prompt-section,
  .setting-row,
  .setting-row3 {
    padding: 12px;
  }

  .gen-control-panel {
    gap: 16px;
  }

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

  .gen-count-btn {
    width: 100%;
    height: 46px;
  }

  .gen-btn-new {
    min-height: 62px;
  }

  .data-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .data-action-btn {
    width: 100%;
    font-size: 16px;
  }

  .top-tabs {
    width: 100%;
  }

  .top-tab {
    flex: 1;
    min-width: 0;
  }

  .api-config-item {
    grid-template-columns: 1fr;
  }

  .api-config-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .api-config-actions button {
    width: 100%;
    padding-inline: 6px;
  }

  .api-config-details {
    display: grid;
    grid-template-columns: 1fr;
  }

  .bottom-tools {
    right: 10px;
    left: auto;
    justify-content: flex-end;
    gap: 8px;
  }

  .background-overlay {
    bottom: 12px;
    min-width: calc(100vw - 20px);
    gap: 8px;
    padding-inline: 10px;
  }

  .background-clock {
    min-width: 150px;
    padding: 9px 12px;
  }

  .background-clock strong {
    font-size: 19px;
  }

  .background-clock span {
    font-size: 11px;
  }

  .background-nav-btn,
  .background-delete-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 10px;
  }

  .background-delete-btn {
    min-width: 72px;
    font-size: 16px;
  }

  .background-delete-btn.is-confirming {
    min-width: 108px;
  }

  .season-weather-panel {
    min-width: 0;
    max-width: calc(100vw - 72px);
    gap: 5px;
    padding: 6px;
  }

  .season-weather-label {
    display: none;
  }

  .season-weather-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  .page-toc-btn {
    flex: 0 0 44px;
  }

}
