:root {
  color-scheme: light;
  --page: #202020;
  --shell: rgba(248, 251, 255, 0.92);
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --side: rgba(231, 240, 255, 0.78);
  --ink: #151923;
  --muted: #6c7480;
  --soft: #9ca7b6;
  --line: rgba(83, 118, 180, 0.16);
  --blue: #285cff;
  --blue-dark: #173bd6;
  --blue-soft: #edf3ff;
  --violet: #7c3cff;
  --cyan: #00bcd4;
  --hot: #ff3d8a;
  --danger: #cc2d64;
  --success: #0f8f6a;
  --shadow: 0 24px 68px rgba(55, 91, 143, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 82% 7%, rgba(124, 60, 255, 0.2), transparent 28%),
    radial-gradient(circle at 16% 88%, rgba(0, 188, 212, 0.16), transparent 30%),
    linear-gradient(135deg, #f8fbff, #eef3ff 44%, #f7f2ff);
  color: var(--ink);
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
  max-width: 100%;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.96), transparent 28%),
    radial-gradient(circle at 92% 8%, rgba(124, 60, 255, 0.1), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 245, 255, 0.92));
  box-shadow: none;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 0;
  padding: 32px 28px;
  background:
    radial-gradient(circle at 16% 8%, rgba(124, 60, 255, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(224, 237, 255, 0.86)),
    var(--side);
  border-right: 1px solid rgba(47, 109, 246, 0.08);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  padding: 10px 13px;
  border: 1px solid rgba(116, 143, 255, 0.24);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(238, 245, 255, 0.74)),
    rgba(255, 255, 255, 0.68);
  color: #101a35;
  font-size: 1rem;
  font-weight: 860;
  line-height: 1.15;
  box-shadow:
    0 16px 38px rgba(47, 109, 246, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 28px;
  border-radius: 9px;
  background:
    linear-gradient(135deg, var(--blue), var(--violet) 62%, var(--hot));
  color: #fff;
  font-size: 0.75rem;
  box-shadow: 0 10px 24px rgba(124, 60, 255, 0.28);
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 52px;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 0 10px;
  background: transparent;
  color: #1f2530;
  font-weight: 760;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 30px rgba(47, 109, 246, 0.08);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: #fff;
  color: var(--blue);
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(47, 109, 246, 0.08);
}

.nav-item.is-active .nav-icon {
  background: linear-gradient(135deg, var(--blue), var(--violet));
  color: #fff;
  box-shadow: 0 14px 28px rgba(47, 109, 246, 0.22);
}

.side-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.side-profile strong,
.side-profile span {
  display: block;
}

.side-profile strong {
  font-size: 0.92rem;
}

.side-profile span {
  color: var(--muted);
  font-size: 0.76rem;
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  color: #fff;
  font-weight: 850;
}

.stage {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 46px 46px 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.5rem, 2.2vw, 2.1rem);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 1.18rem;
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(47, 109, 246, 0.18);
  border-radius: 999px;
  background: #fff;
  color: #4b5871;
  font-size: 0.82rem;
  font-weight: 760;
  white-space: nowrap;
}

.pill-blue {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.auth-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: stretch;
}

.auth-copy,
.auth-card,
.section-card,
.generator-card,
.hero-panel,
.metric-card {
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(67, 92, 130, 0.1);
  backdrop-filter: blur(16px);
}

.auth-copy {
  min-height: 420px;
  padding: 36px;
  background:
    radial-gradient(circle at 72% 16%, rgba(124, 60, 255, 0.18), transparent 32%),
    radial-gradient(circle at 24% 88%, rgba(0, 188, 212, 0.14), transparent 30%),
    rgba(255, 255, 255, 0.58);
}

.auth-copy h2 {
  max-width: 520px;
  font-size: clamp(1.8rem, 3vw, 3.2rem);
  line-height: 1.05;
}

.auth-copy p {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.7;
}

.auth-card {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 20px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 5px;
  border-radius: 12px;
  background: rgba(237, 244, 255, 0.82);
}

.auth-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 780;
  cursor: pointer;
}

.auth-tabs button.is-active {
  background: #fff;
  color: var(--blue-dark);
  box-shadow: 0 8px 22px rgba(47, 109, 246, 0.1);
}

.auth-form,
.form-grid {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #303846;
  font-size: 0.84rem;
  font-weight: 760;
}

.field-hint {
  color: #64748b;
  font-size: 0.76rem;
  line-height: 1.45;
  font-weight: 720;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(48, 74, 118, 0.15);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  outline: none;
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: rgba(47, 109, 246, 0.52);
  box-shadow: 0 0 0 3px rgba(47, 109, 246, 0.1);
}

.views {
  min-width: 0;
}

.view {
  display: none;
}

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric-card {
  padding: 18px;
}

.metric-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 740;
}

.metric-card strong {
  font-size: 1.8rem;
}

.hero-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 300px;
  padding: 30px;
}

.hero-panel p,
.soft-card p {
  color: var(--muted);
  line-height: 1.7;
}

.generator-card {
  min-height: 414px;
  padding: 32px;
}

.prompt-area {
  display: grid;
  gap: 0;
}

#prompt {
  min-height: 44px;
  border-radius: 9px 9px 0 0;
  background: #fff;
}

.image-drop {
  display: grid;
  place-items: center;
  min-height: 180px;
  border: 1px dashed rgba(47, 109, 246, 0.22);
  border-top: 0;
  border-radius: 0 0 9px 9px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  cursor: pointer;
}

.image-drop input {
  display: none;
}

.image-drop span {
  color: #576277;
  font-weight: 800;
}

.image-drop small {
  color: var(--soft);
  font-weight: 700;
}

.image-drop.is-dragging {
  background: var(--blue-soft);
  border-color: rgba(47, 109, 246, 0.55);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.preview-tile {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border-radius: 10px;
  background: #eef3ff;
}

.preview-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-preview {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: rgba(20, 26, 35, 0.72);
  color: #fff;
  cursor: pointer;
}

.tool-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) 136px auto;
  gap: 12px;
  align-items: center;
  margin-top: 40px;
}

.ghost-button,
.primary-button,
.download-button,
.item-actions button,
.user-actions button,
.user-row button {
  min-height: 40px;
  border: 1px solid rgba(47, 109, 246, 0.18);
  border-radius: 999px;
  padding: 0 18px;
  background: #fff;
  color: #263044;
  font-weight: 800;
  cursor: pointer;
}

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--blue), var(--violet) 70%, var(--hot));
  color: #fff;
  box-shadow: 0 14px 30px rgba(124, 60, 255, 0.3);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.ghost-button {
  border-color: rgba(47, 109, 246, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: var(--blue-dark);
}

.danger-button {
  border-color: rgba(204, 45, 100, 0.18);
  background: #fff1f6;
  color: var(--danger);
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.generate-button {
  min-width: 136px;
}

.advanced-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(47, 109, 246, 0.1);
}

.custom-size {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 8px;
}

.range-field span {
  color: var(--blue-dark);
}

.loading-state {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: var(--blue-dark);
  font-weight: 800;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(47, 109, 246, 0.18);
  border-top-color: var(--blue);
  border-radius: 999px;
  animation: spin 900ms linear infinite;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.result-card {
  overflow: hidden;
  border: 1px solid rgba(47, 109, 246, 0.12);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(52, 82, 126, 0.12);
}

.result-card img {
  display: block;
  width: 100%;
  background: #f6f8fc;
}

.result-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.section-card {
  padding: 18px;
  margin-bottom: 14px;
}

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

.history-list,
.channel-list,
.user-table {
  display: grid;
  gap: 10px;
}

.history-item,
.channel-item,
.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(47, 109, 246, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.76);
}

.history-item > *,
.channel-item > *,
.user-row > *,
.detail-list dd,
.result-card footer span,
.item-actions,
.user-actions {
  min-width: 0;
}

.history-item strong,
.history-item span,
.channel-item strong,
.channel-item span,
.channel-item small,
.user-row strong,
.user-row span,
.detail-list dd {
  overflow-wrap: anywhere;
}

.history-item span,
.channel-item span,
.channel-item small,
.user-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.history-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 9px;
}

.history-images a,
.history-images span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid rgba(47, 109, 246, 0.12);
  border-radius: 999px;
  padding: 0 11px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--blue-dark);
  font-size: 0.78rem;
  font-weight: 820;
  text-decoration: none;
}

.history-item b {
  color: var(--blue-dark);
}

.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 14px;
}

.detail-list {
  display: grid;
  gap: 12px;
  margin: 14px 0 0;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(47, 109, 246, 0.1);
}

.detail-list dt {
  color: var(--muted);
  font-weight: 760;
}

.detail-list dd {
  margin: 0;
  font-weight: 850;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(340px, 1.3fr);
  gap: 14px;
}

.admin-wide {
  grid-column: 1 / -1;
}

.cost-editor {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(47, 109, 246, 0.1);
}

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

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.checkbox-row input {
  width: auto;
  min-height: 0;
}

.item-actions,
.user-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.user-row {
  grid-template-columns: minmax(220px, 1fr) 120px 130px auto;
}

.payment-admin-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.payment-admin-form .checkbox-row {
  align-self: end;
}

.callback-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 760;
}

.callback-lines span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.callback-lines code {
  color: var(--blue-dark);
  font-family: inherit;
  font-weight: 850;
}

.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(10px);
}

.modal-panel {
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.24);
  padding: 20px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 1.25rem;
}

.recharge-form {
  display: grid;
  gap: 14px;
}

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

.preset-grid button,
.method-grid label {
  min-height: 42px;
  border: 1px solid rgba(47, 109, 246, 0.14);
  border-radius: 9px;
  background: #fff;
  color: #273245;
  font-weight: 850;
  cursor: pointer;
}

.method-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.method-grid label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.method-grid input {
  width: 18px;
  min-height: 18px;
}

.recharge-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  border: 1px solid rgba(47, 109, 246, 0.1);
  border-radius: 12px;
  background: var(--blue-soft);
  padding: 0 14px;
  color: var(--blue-dark);
  font-weight: 850;
}

.recharge-summary strong {
  font-size: 1.3rem;
}

.pay-area {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.pay-area .primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.pay-area img {
  width: min(220px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
  border: 1px solid rgba(47, 109, 246, 0.12);
  border-radius: 12px;
  background: #fff;
  padding: 10px;
}

.pay-area span {
  color: var(--muted);
  font-weight: 800;
}

.message,
.empty-note {
  margin-top: 12px;
  border: 1px solid rgba(47, 109, 246, 0.12);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-weight: 760;
}

.message.is-error {
  border-color: rgba(204, 45, 100, 0.2);
  background: #fff1f6;
  color: var(--danger);
}

.message.is-success {
  border-color: rgba(15, 143, 106, 0.2);
  background: #ecfbf6;
  color: var(--success);
}

[hidden] {
  display: none !important;
}

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

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .tool-row,
  .advanced-grid,
  .admin-grid,
  .cost-grid,
  .payment-admin-form,
  .account-grid,
  .auth-layout {
    grid-template-columns: 1fr;
  }

  .user-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .shell {
    display: block;
    width: 100%;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    overflow: visible;
    border-radius: 0;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    gap: 10px;
    padding: max(10px, env(safe-area-inset-top)) 12px 12px;
    border-right: 0;
    border-bottom: 1px solid rgba(47, 109, 246, 0.08);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(235, 244, 255, 0.9)),
      var(--side);
    backdrop-filter: blur(18px);
  }

  .logo {
    width: 100%;
    min-height: 42px;
    justify-content: center;
    padding: 8px 11px;
    border-radius: 12px;
    font-size: 0.95rem;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    margin: 0 -12px;
    padding: 0 12px 2px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 44px;
    gap: 8px;
    padding: 0 12px;
    border-radius: 999px;
    scroll-snap-align: start;
    white-space: nowrap;
  }

  .nav-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    font-size: 0.78rem;
  }

  .side-profile {
    display: none;
  }

  .stage {
    display: block;
    min-height: auto;
    overflow: visible;
    padding: 14px 12px 28px;
  }

  .topbar,
  .hero-panel,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 14px;
  }

  h1 {
    font-size: 1.45rem;
  }

  h2 {
    font-size: 1.12rem;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }

  .pill {
    min-height: 32px;
    max-width: 100%;
    white-space: normal;
  }

  .auth-layout {
    gap: 12px;
  }

  .auth-copy {
    min-height: auto;
    padding: 20px;
    border-radius: 12px;
  }

  .auth-copy h2 {
    font-size: 1.55rem;
    line-height: 1.14;
  }

  .auth-card,
  .section-card,
  .generator-card,
  .hero-panel,
  .metric-card {
    border-radius: 12px;
  }

  .auth-card,
  .section-card {
    padding: 16px;
  }

  input,
  select,
  .ghost-button,
  .primary-button,
  .download-button,
  .item-actions button,
  .user-actions button,
  .user-row button {
    min-height: 44px;
  }

  .primary-button,
  .ghost-button {
    padding: 0 16px;
  }

  .metric-grid,
  .gallery,
  .user-row {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: auto;
    padding: 20px;
  }

  .hero-panel .primary-button,
  .auth-form .primary-button,
  .section-head .ghost-button,
  .generate-button {
    width: 100%;
  }

  .generator-card {
    min-height: 0;
    padding: 16px;
  }

  #prompt {
    min-height: 48px;
  }

  .image-drop {
    min-height: 132px;
    padding: 18px 12px;
    text-align: center;
  }

  .preview-grid {
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  }

  .remove-preview {
    width: 28px;
    height: 28px;
  }

  .tool-row {
    grid-template-columns: 1fr;
    margin-top: 16px;
  }

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

  .custom-size {
    align-items: center;
  }

  .result-card footer,
  .history-item,
  .channel-item,
  .user-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .result-card footer {
    display: grid;
  }

  .download-button,
  .item-actions button,
  .user-actions button,
  .user-row button {
    width: 100%;
  }

  .item-actions,
  .user-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .detail-list div {
    display: grid;
    gap: 3px;
  }

  .checkbox-row {
    min-height: 44px;
  }

  .checkbox-row input {
    min-width: 20px;
    width: 20px;
    height: 20px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal-panel {
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    border-radius: 12px;
    padding: 16px;
  }

  .preset-grid,
  .method-grid {
    grid-template-columns: 1fr 1fr;
  }

  .callback-lines {
    display: grid;
  }
}

@media (max-width: 420px) {
  .stage {
    padding-inline: 10px;
  }

  .logo span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .auth-copy {
    padding: 18px;
  }

  .auth-copy h2 {
    font-size: 1.38rem;
  }

  .item-actions,
  .user-actions {
    grid-template-columns: 1fr;
  }

  .top-actions .ghost-button {
    width: 100%;
  }

  .preset-grid,
  .method-grid {
    grid-template-columns: 1fr;
  }
}
