:root {
  color-scheme: light;
  --bg: #f4f0e8;
  --bg-accent: #f9f8f4;
  --surface: rgba(255, 252, 247, 0.78);
  --surface-strong: #fffdf8;
  --border: rgba(82, 57, 31, 0.12);
  --text: #1d1a17;
  --muted: #6d6257;
  --primary: #1f8f6a;
  --primary-strong: #147355;
  --primary-soft: rgba(31, 143, 106, 0.14);
  --danger: #b2412d;
  --shadow: 0 24px 60px rgba(48, 35, 24, 0.08);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --font-family: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-family);
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.92), transparent 32%),
    linear-gradient(135deg, #f1eadf 0%, #f7f4ee 52%, #eef5f1 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.25) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 90%);
  pointer-events: none;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr) 320px;
  column-gap: 24px;
  row-gap: 25px;
  align-content: start;
  align-items: stretch;
  max-width: 1820px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  grid-column: 1 / -1;
}

.config-panel,
.history-panel,
.hero-card,
.results-section {
  position: relative;
  z-index: 1;
  backdrop-filter: blur(18px);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.config-panel {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 22px;
  padding: 28px;
  border-radius: var(--radius-xl);
}

.history-panel {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 20px;
  padding: 28px;
  border-radius: var(--radius-xl);
}

.main-column {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  gap: 24px;
  min-height: 100%;
  min-width: 0;
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  height: 120px;
  gap: 18px;
  padding: 18px 28px 12px;
  border-radius: var(--radius-xl);
  backdrop-filter: blur(18px);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.topbar-copy {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.topbar-actions,
.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 999px;
}

.topbar-user {
  justify-content: flex-end;
}

.topbar-user-meta {
  display: grid;
  gap: 5px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(85, 67, 45, 0.1);
}

.topbar-user-meta span {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.topbar-user-meta strong {
  font-size: 1rem;
  color: var(--text);
}

.topbar-user-stats {
  display: flex;
  align-items: stretch;
  gap: 18px;
}

.topbar-user-stat {
  display: grid;
  gap: 5px;
  min-width: 96px;
}

.workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 24px;
  min-height: 100%;
}

.hero-card {
  padding: 28px;
  border-radius: var(--radius-xl);
}

.hero-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hero-card-link {
  margin-left: auto;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 18px;
  border-radius: 18px;
  border: 1px solid rgba(31, 143, 106, 0.22);
  background:
    linear-gradient(135deg, rgba(31, 143, 106, 0.16), rgba(37, 160, 110, 0.08)),
    rgba(255, 255, 255, 0.96);
  color: var(--primary-strong);
  box-shadow: 0 14px 30px rgba(31, 143, 106, 0.14);
  overflow: hidden;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.hero-card-link::before {
  content: "";
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Cpath d='M4.5 5.25C4.5 4.83579 4.83579 4.5 5.25 4.5H12.75C13.1642 4.5 13.5 4.83579 13.5 5.25V12.75C13.5 13.1642 13.1642 13.5 12.75 13.5H5.25C4.83579 13.5 4.5 13.1642 4.5 12.75V5.25Z' stroke='%231f8f6a' stroke-width='1.4'/%3E%3Cpath d='M7.125 7.125H10.875' stroke='%231f8f6a' stroke-width='1.4' stroke-linecap='round'/%3E%3Cpath d='M7.125 9H10.875' stroke='%231f8f6a' stroke-width='1.4' stroke-linecap='round'/%3E%3Cpath d='M7.125 10.875H9.375' stroke='%231f8f6a' stroke-width='1.4' stroke-linecap='round'/%3E%3Cpath d='M12 6L14.25 3.75' stroke='%231f8f6a' stroke-width='1.4' stroke-linecap='round'/%3E%3Cpath d='M11.25 3.75H14.25V6.75' stroke='%231f8f6a' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.hero-card-link::after {
  content: "进入";
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(31, 143, 106, 0.86);
}

.hero-card-link:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 143, 106, 0.36);
  box-shadow: 0 18px 34px rgba(31, 143, 106, 0.18);
  background:
    linear-gradient(135deg, rgba(31, 143, 106, 0.2), rgba(37, 160, 110, 0.1)),
    rgba(255, 255, 255, 0.98);
}

.results-section {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 28px;
  border-radius: var(--radius-xl);
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary-strong);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2rem, 4vw, 2.8rem);
}

h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
}

h3 {
  font-size: 1.4rem;
}

.topbar-copy h2,
.config-panel .panel-header h1,
.hero-card h2,
.history-panel h2 {
  font-size: 1.6rem;
}

@media (max-width: 1180px) {
  .topbar-copy h2 {
    display: none;
  }
}

.hero-copy,
.status-text,
.empty-state span,
.loading-copy span {
  color: var(--muted);
}

.panel-header,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.history-panel .panel-header {
  align-items: center;
}

.panel-header-copy {
  display: grid;
  gap: 6px;
}

.section-heading {
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 20px;
}

.panel-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(29, 26, 23, 0.08);
  flex-shrink: 0;
  align-self: flex-end;
}

.panel-icon-button-icon {
  width: 16px;
  height: 16px;
  display: block;
}

.panel-icon-button.is-loading .panel-icon-button-icon {
  animation: panel-icon-spin 900ms linear infinite;
}

@keyframes panel-icon-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.config-form,
.prompt-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.config-title {
  margin: 4px 0 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  font-size: 0.92rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid rgba(85, 67, 45, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  font: inherit;
  padding: 14px 16px;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.field textarea {
  height: 100px;
  min-height: 100px;
  resize: vertical;
  border: 0;
  outline: none;
  box-shadow: none;
}

.prompt-composer {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(85, 67, 45, 0.16);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.prompt-composer:focus-within {
  border-color: rgba(31, 143, 106, 0.45);
  box-shadow: 0 0 0 4px rgba(31, 143, 106, 0.12);
  transform: translateY(-1px);
}

.prompt-composer textarea {
  min-height: 100px;
  height: 100px;
  padding: 0;
  border: 0 !important;
  outline: none !important;
  border-radius: 0;
  background: transparent;
  box-shadow: none !important;
  resize: vertical;
}

.prompt-composer.has-reference-image textarea {
  min-height: 126px;
  height: 126px;
}

.prompt-composer textarea:focus {
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  transform: none !important;
}

.prompt-composer-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.prompt-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.prompt-reference-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
  flex: 1 1 auto;
}

.reference-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(85, 67, 45, 0.12);
  background: rgba(255, 255, 255, 0.92);
  overflow: hidden;
}

.reference-trigger-stack {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 42px;
  min-width: 42px;
  height: 42px;
  flex-shrink: 0;
  overflow: hidden;
  transition: width 160ms ease;
}

.reference-trigger-stack:hover,
.reference-trigger-stack:focus-within {
  width: 92px;
}

.sketch-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 14px;
  flex-shrink: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-10px) scale(0.92);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.reference-trigger-stack:hover .sketch-trigger,
.reference-trigger-stack:focus-within .sketch-trigger,
.reference-trigger:hover + .sketch-trigger,
.reference-trigger:focus-visible + .sketch-trigger {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0) scale(1);
}

.sketch-trigger-icon {
  width: 22px;
  height: 22px;
  color: rgba(85, 67, 45, 0.88);
  display: block;
}

.reference-trigger-plus {
  font-size: 1.3rem;
  line-height: 1;
  color: var(--muted);
}

.reference-image-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 100%;
  overflow: visible;
  padding-bottom: 0;
}

.reference-image-list:empty {
  display: none;
}

.reference-image-list::-webkit-scrollbar {
  display: none;
}

.reference-image-item {
  position: relative;
  width: 42px;
  min-width: 42px;
  height: 42px;
}

.reference-image-thumb {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid rgba(85, 67, 45, 0.12);
  background: rgba(255, 255, 255, 0.92);
}

.reference-image-item-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  min-width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(29, 26, 23, 0.88);
  color: #ffffff;
  font-size: 0.8rem;
  line-height: 1;
  box-shadow: 0 6px 16px rgba(29, 26, 23, 0.18);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 140ms ease,
    transform 140ms ease;
  transform: scale(0.92);
}

.reference-image-item:hover .reference-image-item-remove,
.reference-image-item:focus-within .reference-image-item-remove {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.reference-inline-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
  align-content: center;
  flex: 1 1 220px;
  align-self: center;
}

.reference-inline-copy strong,
.reference-inline-copy span {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  word-break: break-word;
}

.reference-inline-copy strong {
  font-size: 0.94rem;
}

.reference-inline-copy span {
  color: var(--muted);
  font-size: 0.9rem;
}

.reference-remove-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 12px;
  font-size: 0.88rem;
}

.reference-remove-icon {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
}

.select-shell {
  position: relative;
}

.select-shell::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 10px;
  width: 12px;
  height: 12px;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.25 4.5L6 8.25L9.75 4.5' stroke='%236d6257' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 12px;
  pointer-events: none;
}

.field select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 32px;
  background-image: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(31, 143, 106, 0.45);
  box-shadow: 0 0 0 4px rgba(31, 143, 106, 0.12);
  transform: translateY(-1px);
}

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

.button-row,
.submit-row,
.result-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.hidden-file-input {
  display: none;
}

.runtime-summary {
  display: grid;
  gap: 12px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-item-shell {
  position: relative;
  overflow: hidden;
  border-radius: 20px;
}

.history-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(85, 67, 45, 0.1);
  background: rgba(255, 255, 255, 0.78);
  text-align: left;
  box-shadow: 0 14px 26px rgba(48, 35, 24, 0.05);
}

.history-item.active {
  border-color: rgba(31, 143, 106, 0.28);
  box-shadow: 0 16px 30px rgba(31, 143, 106, 0.12);
}

.history-item-delete {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  min-width: 50px;
  height: 100%;
  padding: 0;
  border-radius: 0;
  background: linear-gradient(135deg, var(--primary) 0%, #25a06e 100%);
  color: #ffffff;
  border: 0;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transform: translateX(50px);
  transition:
    opacity 140ms ease,
    transform 140ms ease,
    background 140ms ease;
}

.history-item-delete-icon {
  width: 16px;
  height: 16px;
  display: block;
  filter: brightness(0) invert(1);
}

.history-item-shell:hover .history-item-delete,
.history-item-shell:focus-within .history-item-delete {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.history-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(31, 143, 106, 0.08), rgba(31, 143, 106, 0)),
    #f2eee7;
}

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

.history-item-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.history-item-prompt {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 0.93rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.history-item-meta,
.history-empty span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.history-empty {
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.35);
  text-align: center;
}

.history-empty p {
  margin: 0;
  font-size: 1rem;
}

.summary-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(85, 67, 45, 0.1);
}

.summary-item span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.summary-item strong {
  display: block;
  font-size: 0.96rem;
  line-height: 1.45;
  word-break: break-word;
}

button,
.download-link {
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease,
    opacity 140ms ease;
}

button:hover,
.download-link:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.download-link {
  padding: 13px 18px;
}

.button-leading-icon {
  width: 15px;
  height: 15px;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: 8px;
}

#generateButton .button-leading-icon {
  filter: brightness(0) invert(1);
}

.topbar-link.primary-button .button-leading-icon {
  filter: brightness(0) invert(1);
}

.primary-button {
  background: linear-gradient(135deg, var(--primary) 0%, #25a06e 100%);
  color: white;
  box-shadow: 0 14px 34px rgba(31, 143, 106, 0.26);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  border: 1px solid rgba(29, 26, 23, 0.08);
}

.danger-button {
  background: rgba(178, 65, 45, 0.12);
  color: var(--danger);
  border: 1px solid rgba(178, 65, 45, 0.22);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(29, 26, 23, 0.12);
}

.prompt-field {
  margin-top: 20px;
}

.status-text {
  margin: 0;
  font-size: 0.95rem;
  flex: 1 1 220px;
}

.submit-row {
  align-items: center;
}

.error-banner {
  padding: 15px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 238, 234, 0.92);
  border: 1px solid rgba(178, 65, 45, 0.22);
  color: var(--danger);
  font-weight: 600;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  align-items: start;
}

.result-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 22px;
  background: var(--surface-strong);
  border: 1px solid rgba(85, 67, 45, 0.1);
  box-shadow: 0 20px 36px rgba(48, 35, 24, 0.08);
}

.image-frame {
  display: grid;
  place-items: center;
  flex: 1 1 auto;
  min-width: 0;
  background:
    linear-gradient(135deg, rgba(31, 143, 106, 0.08), rgba(31, 143, 106, 0)),
    #f2eee7;
  padding: 12px;
}

.image-frame img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 72vh;
  object-fit: contain;
  cursor: zoom-in;
}

.result-actions {
  display: flex;
  justify-content: space-between;
  padding: 14px;
}

.result-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.result-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.copy-link,
.reuse-as-input-link,
.download-link,
.close-image-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 13px 18px;
  border: 1px solid transparent;
  background: var(--primary-soft);
  color: var(--primary-strong);
  text-decoration: none;
  line-height: 1;
}

.copy-link {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(29, 26, 23, 0.08);
  color: var(--text);
}

.reuse-as-input-link {
  background: rgba(31, 143, 106, 0.12);
  border: 1px solid rgba(31, 143, 106, 0.2);
  color: var(--primary-strong);
}

.close-image-link {
  background: #fff4f1;
  border: 1px solid #e6b7ae;
  color: var(--danger);
}

.result-error {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 20px;
  background: rgba(255, 238, 234, 0.78);
  border: 1px solid rgba(178, 65, 45, 0.18);
}

.result-error strong {
  color: var(--danger);
  font-size: 1rem;
}

.result-error pre {
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(178, 65, 45, 0.12);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-state,
.loading-state {
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.35);
  text-align: center;
  padding: 24px;
}

.empty-state {
  min-height: 120px;
}

.empty-state p,
.loading-copy strong {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.loading-state {
  min-height: 280px;
  gap: 18px;
}

.loading-card {
  width: min(360px, 100%);
  aspect-ratio: 1 / 1;
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(31, 143, 106, 0.18), rgba(255, 255, 255, 0.8));
}

.shimmer {
  position: relative;
  overflow: hidden;
}

.shimmer::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.65) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

.hidden {
  display: none !important;
}

.auth-page {
  min-height: 100vh;
  padding: 28px;
  overflow-y: auto;
}

.doc-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 1160px;
  min-height: calc(100vh - 56px);
  margin: 0 auto;
}

.doc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.doc-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.doc-back-button {
  min-height: 42px;
  padding: 10px 18px;
}

.doc-panel {
  backdrop-filter: blur(18px);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 32px;
  padding: 32px;
}

.doc-status {
  color: var(--muted);
  font-size: 0.98rem;
}

.prompt-center-empty {
  padding: 24px 0 6px;
  color: var(--muted);
}

.prompt-center-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  padding-top: 22px;
}

.admin-topbar-actions .hero-card-link {
  margin-left: 0;
}

.prompt-create-markdown-textarea {
  min-height: 360px;
}

.prompt-detail-panel {
  display: grid;
  gap: 22px;
}

.prompt-detail-images {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.prompt-detail-image-card {
  flex: 0 0 min(100%, 420px);
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(82, 57, 31, 0.12);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 36px rgba(48, 35, 24, 0.09);
}

.prompt-detail-image-card img {
  display: block;
  width: 100%;
  height: auto;
}

.prompt-detail-image-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
  background:
    linear-gradient(160deg, rgba(31, 143, 106, 0.1), rgba(255, 255, 255, 0.92)),
    rgba(255, 255, 255, 0.88);
}

.prompt-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.prompt-card-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.prompt-card-edit,
.prompt-card-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(29, 26, 23, 0.74);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
  transition:
    background 160ms ease;
}

.prompt-card-admin:hover .prompt-card-actions,
.prompt-card-admin:focus-within .prompt-card-actions {
  opacity: 1;
  transform: translateY(0);
}

.prompt-card-edit:hover {
  background: rgba(31, 143, 106, 0.92);
}

.prompt-card-delete:hover {
  background: rgba(178, 65, 45, 0.92);
}

.prompt-card-media {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: 24px;
  background:
    linear-gradient(160deg, rgba(31, 143, 106, 0.15), rgba(255, 255, 255, 0.92)),
    rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(82, 57, 31, 0.12);
  box-shadow: 0 18px 36px rgba(48, 35, 24, 0.09);
}

.prompt-card-image,
.prompt-card-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.prompt-card-image {
  object-fit: cover;
}

.prompt-card-placeholder {
  display: grid;
  place-items: center;
  padding: 24px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(29, 26, 23, 0.34);
}

.prompt-card-title {
  display: block;
  min-height: 2.6em;
  padding: 0 4px;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  opacity: 1;
  transform: translateY(0);
}

.prompt-card:hover .prompt-card-media,
.prompt-card:focus-visible .prompt-card-media {
  border-color: rgba(31, 143, 106, 0.28);
  box-shadow: 0 22px 42px rgba(31, 143, 106, 0.12);
}

.markdown-content {
  display: grid;
  gap: 18px;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
  line-height: 1.18;
}

.markdown-content h1 {
  font-size: clamp(2rem, 3.6vw, 2.7rem);
}

.markdown-content h2 {
  margin-top: 10px;
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
}

.markdown-content h3 {
  margin-top: 6px;
  font-size: 1.28rem;
}

.markdown-content p,
.markdown-content li,
.markdown-content blockquote {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text);
}

.markdown-content p,
.markdown-content ul,
.markdown-content ol,
.markdown-content blockquote,
.markdown-content pre {
  margin: 0;
}

.markdown-content ul,
.markdown-content ol {
  padding-left: 24px;
  display: grid;
  gap: 8px;
}

.markdown-content a {
  color: var(--primary-strong);
  text-decoration: none;
}

.markdown-content a:hover {
  text-decoration: underline;
}

.markdown-content img {
  display: block;
  max-width: min(100%, 420px);
  width: auto;
  height: auto;
  margin-top: 8px;
  border-radius: 24px;
  border: 1px solid rgba(85, 67, 45, 0.1);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 22px 42px rgba(48, 35, 24, 0.12);
}

.markdown-content code {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(85, 67, 45, 0.1);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

.markdown-content pre {
  overflow: auto;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(29, 26, 23, 0.92);
  color: #f8f6f1;
}

.markdown-content pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

.markdown-content blockquote {
  padding: 14px 18px;
  border-left: 4px solid rgba(31, 143, 106, 0.44);
  border-radius: 0 18px 18px 0;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
}

.markdown-content hr {
  width: 100%;
  height: 1px;
  border: 0;
  background: rgba(85, 67, 45, 0.12);
}

.auth-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 480px) minmax(0, 460px);
  gap: 28px;
  align-items: stretch;
  max-width: 1120px;
  margin: 0 auto;
}

.auth-side,
.auth-card-page {
  backdrop-filter: blur(18px);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.auth-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 34px;
  border-radius: 32px;
}

.auth-side-copy {
  display: grid;
  gap: 18px;
}

.auth-side-visual {
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 220px;
  padding: 18px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top, rgba(31, 143, 106, 0.16), transparent 58%),
    rgba(255, 255, 255, 0.46);
  border: 1px solid rgba(85, 67, 45, 0.08);
}

.auth-side-visual img {
  display: block;
  width: min(100%, 240px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 28px rgba(48, 35, 24, 0.12));
}

.auth-side-copy p,
.auth-feature-list li,
.auth-card-copy p,
.auth-page-footer {
  color: var(--muted);
}

.auth-feature-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.auth-card-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 34px;
  border-radius: 32px;
}

.auth-card-copy {
  display: grid;
  gap: 10px;
}

.auth-page-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-page-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.captcha-field {
  display: grid;
  gap: 12px;
}

.captcha-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.captcha-refresh-button {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.86rem;
}

.captcha-preview {
  min-height: 48px;
  padding: 10px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(29, 26, 23, 0.12);
  background: rgba(255, 251, 247, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
}

.captcha-preview svg {
  display: block;
  width: 132px;
  max-width: 100%;
  height: auto;
}

.captcha-preview-fallback {
  font-size: 0.92rem;
  color: var(--danger);
}

.auth-page-footer {
  margin: 0;
  font-size: 0.94rem;
}

.admin-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 25px;
  max-width: 1480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px;
}

.admin-topbar,
.admin-panel,
.admin-stat-card,
.admin-table-wrap {
  position: relative;
  z-index: 1;
  backdrop-filter: blur(18px);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.admin-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 28px;
  border-radius: var(--radius-xl);
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-topbar-info-card {
  min-width: 132px;
}

.admin-page .topbar-copy h1 {
  font-size: 1.6rem;
}

.admin-page .section-heading h2 {
  font-size: 1.6rem;
}

.admin-page .admin-bulk-selection span {
  font-size: 1.44rem;
  line-height: 1.5;
}

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

.admin-stat-card {
  display: grid;
  gap: 8px;
  padding: 22px 24px;
  border-radius: 24px;
}

.admin-stat-card span {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.admin-stat-card strong {
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 500;
}

.admin-setting-card {
  align-content: start;
}

.admin-setting-stack {
  display: grid;
  gap: 16px;
}

.admin-dual-setting-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 6px;
}

.admin-setting-group {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.admin-setting-group-title {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: normal;
  text-transform: none;
}

.admin-runtime-card {
  grid-column: 1 / -1;
}

.admin-runtime-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 6px;
}

.admin-runtime-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.admin-runtime-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-runtime-toolbar-copy {
  display: grid;
  gap: 6px;
}

.admin-runtime-save-row {
  justify-content: flex-start;
}

.admin-runtime-summary .summary-item strong {
  font-size: 1rem;
  line-height: 1.45;
  font-weight: 500;
}

.admin-setting-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}

.admin-setting-input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(85, 67, 45, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font: inherit;
  padding: 12px 14px;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.admin-setting-input:focus {
  outline: none;
  border-color: rgba(31, 143, 106, 0.45);
  box-shadow: 0 0 0 4px rgba(31, 143, 106, 0.12);
  transform: translateY(-1px);
}

.admin-setting-controls .secondary-button {
  min-height: 44px;
  white-space: nowrap;
}

.admin-setting-hint {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}

.admin-panel {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px;
  border-radius: var(--radius-xl);
}

.admin-users-filter {
  width: min(360px, 100%);
}

.admin-users-summary {
  display: flex;
  align-items: center;
  min-height: 48px;
  color: var(--muted);
  font-weight: 700;
}

.admin-bulk-sidebar {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  min-width: min(360px, 100%);
}

.points-log-topbar {
  justify-content: flex-start;
  gap: 18px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.points-log-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(85, 67, 45, 0.1);
}

.points-log-filter {
  width: min(360px, 100%);
}

.points-log-summary {
  display: flex;
  align-items: center;
  min-height: 48px;
  color: var(--muted);
  font-weight: 700;
}

.points-log-table {
  min-width: 860px;
}

.points-log-delta {
  font-weight: 800;
}

.points-log-positive {
  color: var(--primary);
}

.points-log-negative {
  color: var(--danger);
}

.points-log-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-user-create-row {
  display: flex;
  justify-content: flex-end;
}

.admin-bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(85, 67, 45, 0.1);
}

.admin-bulk-selection,
.admin-row-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.admin-bulk-selection input,
.admin-row-checkbox input,
.admin-select-column input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.admin-bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 1;
  flex-wrap: wrap;
}

.admin-users-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-bulk-amount-input {
  width: 180px;
}

.admin-table-wrap {
  overflow-x: auto;
  border-radius: 24px;
}

.admin-users-table,
.admin-runtime-table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
}

.admin-users-table th,
.admin-users-table td,
.admin-runtime-table th,
.admin-runtime-table td {
  padding: 16px 18px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(85, 67, 45, 0.1);
}

.admin-users-table thead th,
.admin-runtime-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(255, 253, 248, 0.96);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-runtime-table thead th {
  text-transform: none;
}

.admin-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  box-shadow: none;
}

.admin-sort-button:hover {
  transform: none;
  color: var(--text);
}

.admin-sort-button.active {
  color: var(--primary-strong);
}

.admin-sort-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  color: rgba(109, 98, 87, 0.75);
}

.admin-sort-button.active .admin-sort-indicator {
  color: currentColor;
}

.admin-sort-button[data-sort-direction="asc"] .admin-sort-indicator::before {
  content: "↑";
}

.admin-sort-button[data-sort-direction="desc"] .admin-sort-indicator::before {
  content: "↓";
}

.admin-sort-button[data-sort-direction=""] .admin-sort-indicator::before,
.admin-sort-button:not([data-sort-direction]) .admin-sort-indicator::before {
  content: "↕";
}

.admin-users-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-users-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.44);
}

.admin-user-row-selected,
.admin-user-row-selected:nth-child(even) {
  background: rgba(31, 143, 106, 0.12);
}

.admin-user-row:hover {
  background: rgba(31, 143, 106, 0.05);
}

.admin-select-column {
  width: 64px;
  min-width: 64px;
  text-align: center !important;
}

.admin-cell-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.admin-static-cell {
  display: grid;
  gap: 8px;
  min-width: 140px;
}

.admin-cell-label {
  display: none;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.admin-runtime-table .admin-cell-label {
  text-transform: none;
}

.admin-user-amount {
  width: 100%;
  border: 1px solid rgba(85, 67, 45, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font: inherit;
  padding: 12px 14px;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.admin-user-amount:focus {
  outline: none;
  border-color: rgba(31, 143, 106, 0.45);
  box-shadow: 0 0 0 4px rgba(31, 143, 106, 0.12);
  transform: translateY(-1px);
}

.admin-user-username {
  font-size: 0.98rem;
  line-height: 1.4;
  color: var(--text);
}

.admin-user-online {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
}

.admin-user-online.online {
  background: rgba(31, 143, 106, 0.14);
  color: var(--primary-strong);
}

.admin-user-online.offline {
  background: rgba(109, 98, 87, 0.12);
  color: var(--muted);
}

.admin-user-ip {
  display: block;
  min-width: 120px;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
  word-break: break-word;
}

.admin-history-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 0.86rem;
  font-weight: 700;
}

.admin-user-created-at,
.admin-user-id {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
  word-break: break-word;
}

.admin-runtime-config-row.is-selected {
  background: rgba(31, 143, 106, 0.06);
}

.admin-runtime-config-base-url {
  word-break: break-all;
}

.admin-row-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  min-width: 180px;
}

.admin-row-actions .primary-button,
.admin-row-actions .secondary-button,
.admin-row-actions .danger-button {
  flex: 0 0 85px;
  width: 85px;
  min-height: 38px;
  padding: 9px 14px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.toast-stack {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-message {
  min-width: 220px;
  max-width: min(360px, calc(100vw - 44px));
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(85, 67, 45, 0.12);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 36px rgba(48, 35, 24, 0.14);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.45;
  transform: translateY(-10px);
  opacity: 0;
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.toast-message.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  background: rgba(255, 253, 248, 0.94);
  color: var(--primary-strong);
}

.toast-error {
  background: rgba(255, 241, 238, 0.96);
  color: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(29, 26, 23, 0.26);
  backdrop-filter: blur(10px);
}

.modal-card {
  width: min(100%, 520px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
  border-radius: 28px;
  backdrop-filter: blur(18px);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: 0 28px 60px rgba(48, 35, 24, 0.16);
}

.image-preview-backdrop {
  padding: 32px;
  background: rgba(29, 26, 23, 0.68);
}

.image-preview-card {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  max-height: 100%;
}

.image-preview-media {
  width: fit-content;
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  transition: transform 120ms ease;
}

.image-preview-card img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 88px);
  border-radius: 24px;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.22);
  background: rgba(255, 255, 255, 0.92);
}

.image-preview-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  background: rgba(255, 252, 247, 0.96);
  border: 1px solid rgba(29, 26, 23, 0.16);
  border-radius: 999px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 3;
  color: var(--text);
}

.image-preview-close:hover {
  background: #ffffff;
  border-color: rgba(29, 26, 23, 0.22);
}

.image-preview-close:focus-visible {
  outline: 3px solid rgba(44, 168, 118, 0.28);
  outline-offset: 2px;
}

.image-preview-close .modal-close-icon {
  filter: none;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.modal-close-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sketch-modal-card {
  width: min(100%, 840px);
}

.sketch-toolbar {
  display: flex;
  align-items: end;
  gap: 14px;
  flex-wrap: wrap;
}

.sketch-field {
  flex: 1 1 180px;
}

.sketch-color-input {
  width: 100%;
  min-height: 44px;
  padding: 6px;
  cursor: pointer;
}

.sketch-size-value {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

.sketch-canvas-shell {
  border-radius: 24px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 236, 227, 0.92));
  padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.sketch-canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(251, 248, 243, 0.98));
  touch-action: none;
  cursor: crosshair;
}

.sketch-modal-actions {
  justify-content: flex-end;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-inline-link {
  color: var(--primary-strong);
  font-weight: 700;
  text-decoration: none;
}

.auth-inline-link:hover {
  text-decoration: underline;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .auth-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .admin-summary-grid {
    grid-template-columns: 1fr;
  }

  .admin-topbar {
    flex-direction: column;
  }

  .admin-users-table {
    min-width: 1080px;
  }

  .admin-runtime-table {
    min-width: 960px;
  }
}

@media (max-width: 640px) {
  .auth-page {
    min-height: 100vh;
    padding: 16px;
  }

  .config-panel,
  .history-panel,
  .topbar,
  .hero-card,
  .results-section,
  .auth-side,
  .auth-card-page,
  .admin-topbar,
  .admin-panel,
  .admin-stat-card,
  .admin-table-wrap {
    padding: 20px;
    border-radius: 22px;
  }

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

  .auth-layout {
    gap: 16px;
  }

  .topbar {
    height: auto;
    min-height: 120px;
    justify-content: flex-start;
  }

  .admin-topbar-info-card {
    width: 100%;
    min-width: 0;
  }

  .topbar-actions,
  .topbar-user {
    width: 100%;
  }

  .auth-side-visual {
    min-height: 180px;
  }

  .auth-card-page {
    min-height: 0;
    height: auto;
    overflow: visible;
  }

  .auth-page-form,
  .auth-page-actions {
    min-height: 0;
  }

  .admin-dual-setting-row {
    grid-template-columns: 1fr;
  }

  .admin-runtime-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .submit-row,
  .button-row,
  .prompt-composer-footer,
  .hero-card-header,
  .admin-users-pagination,
  .points-log-toolbar,
  .points-log-pagination,
  .topbar,
  .admin-topbar,
  .admin-topbar-actions,
  .admin-bulk-toolbar,
  .admin-bulk-actions,
  .modal-header,
  .modal-actions,
  .result-actions,
  .result-buttons {
    align-items: stretch;
    flex-direction: column;
  }

  .prompt-reference-row {
    align-items: center;
  }

  .prompt-action-row {
    width: 100%;
    justify-content: flex-end;
  }

  .admin-bulk-sidebar,
  .admin-users-filter,
  .points-log-filter {
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button,
  .copy-link,
  .reuse-as-input-link,
  .download-link,
  .close-image-link,
  .hero-card-link,
  .topbar-link {
    width: 100%;
    text-align: center;
  }

  .result-card {
    flex-direction: column;
  }

  .modal-card {
    padding: 20px;
    border-radius: 22px;
  }

  .sketch-toolbar {
    align-items: stretch;
  }

  .sketch-field,
  .sketch-size-value {
    width: 100%;
  }

  .sketch-canvas-shell {
    padding: 12px;
  }

  .image-preview-backdrop {
    padding: 16px;
  }

  .image-preview-card img {
    max-height: calc(100vh - 64px);
    border-radius: 18px;
  }

  .admin-users-table,
  .admin-runtime-table {
    min-width: 0;
  }

  .admin-users-table,
  .admin-users-table thead,
  .admin-users-table tbody,
  .admin-users-table th,
  .admin-users-table td,
  .admin-users-table tr,
  .admin-runtime-table,
  .admin-runtime-table thead,
  .admin-runtime-table tbody,
  .admin-runtime-table th,
  .admin-runtime-table td,
  .admin-runtime-table tr {
    display: block;
  }

  .admin-users-table thead,
  .admin-runtime-table thead {
    display: none;
  }

  .admin-users-table tbody,
  .admin-runtime-table tbody {
    display: grid;
    gap: 14px;
  }

  .admin-users-table tbody tr,
  .admin-runtime-table tbody tr {
    border: 1px solid rgba(85, 67, 45, 0.1);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.68);
    overflow: hidden;
  }

  .admin-users-table td,
  .admin-runtime-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(85, 67, 45, 0.08);
  }

  .admin-select-column {
    width: auto;
    min-width: 0;
    text-align: left !important;
  }

  .admin-users-table tbody tr td:last-child,
  .admin-runtime-table tbody tr td:last-child {
    border-bottom: 0;
  }

  .admin-cell-label {
    display: inline-block;
  }

  .admin-history-badge {
    min-height: 32px;
  }

  .admin-row-actions {
    min-width: 0;
    gap: 8px;
  }

  .admin-bulk-amount-input {
    width: 100%;
  }

  .admin-row-actions .primary-button,
  .admin-row-actions .secondary-button,
  .admin-row-actions .danger-button {
    flex: 1 0 0;
    width: auto;
    min-height: 34px;
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .toast-stack {
    top: 16px;
    right: 16px;
    left: 16px;
  }

  .toast-message {
    min-width: 0;
    max-width: none;
  }
}
