:root {
  color-scheme: dark;
  --bg: #0f1117;
  --panel: #08090d;
  --panel-soft: rgba(30, 34, 45, 0.7);
  --text: #e2e2eb;
  --muted: rgba(255, 255, 255, 0.6);
  --accent: #f2ca50;
  --accent-2: #d4af37;
  --line: rgba(255, 255, 255, 0.12);
  --success: #4ec98d;
  --danger: #ff7b7b;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.native-capacitor-app img,
.native-capacitor-app .task-result-image,
.native-capacitor-app .template-generate-result-image,
.native-capacitor-app .art-cover-img,
.native-capacitor-app .work-detail-item img,
.native-capacitor-app .upload-preview-img,
.native-capacitor-app .template-picked-img {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
  padding-top: calc(14px + var(--safe-top));
  padding-bottom: calc(78px + var(--safe-bottom));
}

.topbar {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(15, 17, 23, 0.92);
  backdrop-filter: blur(6px);
  z-index: 10;
}

.topbar-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-2);
  letter-spacing: 3px;
}

.topbar-btn {
  border: 1px solid var(--line);
  color: var(--accent);
  background: rgba(242, 202, 80, 0.08);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
}

.page-main {
  padding: 16px;
  max-width: 920px;
  margin: 0 auto;
}

.desktop-layout .page-main {
  max-width: none;
}

.gallery-hero {
  padding: 18px 18px 16px;
  border-radius: 20px;
  background:
    radial-gradient(circle at top right, rgba(242, 202, 80, 0.18), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.gallery-hero-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 800;
  color: var(--text);
}

.gallery-hero-desc {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.gallery-generation-banner {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(242, 202, 80, 0.22);
  background: rgba(242, 202, 80, 0.08);
}

.gallery-generation-banner[hidden] {
  display: none;
}

.gallery-generation-banner.is-success {
  border-color: rgba(78, 201, 141, 0.35);
  background: rgba(78, 201, 141, 0.08);
}

.gallery-generation-banner.is-error {
  border-color: rgba(255, 123, 123, 0.35);
  background: rgba(255, 123, 123, 0.08);
}

.gallery-generation-banner-main {
  min-width: 0;
  flex: 1;
}

.gallery-generation-banner-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.gallery-generation-banner-text {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
}

.gallery-generation-banner.is-success .gallery-generation-banner-title {
  color: var(--success);
}

.gallery-generation-banner.is-error .gallery-generation-banner-title {
  color: #ff9e9e;
}

.gallery-generation-banner-btn {
  flex: 0 0 auto;
  min-width: 88px;
}

.chip-row {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel);
}

.chip.active {
  color: #3c2f00;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.card-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.art-card {
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.task-time-card .art-body {
  padding: 16px 14px;
}

.desktop-work-card .art-body {
  padding: 16px 14px;
}

.task-time-label {
  font-size: 12px;
  color: var(--muted);
}

.task-time-value {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.task-time-card {
  overflow: visible;
}

.task-time-card .art-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-time-card .btn-primary,
.task-time-card .btn-secondary-line {
  margin-top: 0;
}

.task-result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.desktop-pack-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.desktop-layout .desktop-pack-grid {
  grid-template-columns: 1fr;
}

.desktop-layout #desktopPackGrid.desktop-pack-grid {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.task-result-item {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.desktop-flat-card {
  margin: 0;
}

.desktop-work-task-card {
  padding: 12px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.desktop-work-task-head {
  margin-bottom: 0;
}

.desktop-work-task-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.desktop-work-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.desktop-work-slot {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

.desktop-work-slot-media {
  position: relative;
  min-height: 180px;
}

.desktop-work-task-actions {
  margin-top: auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0;
}

.desktop-work-task-actions.is-single {
  grid-template-columns: 1fr;
}

.desktop-work-action-btn {
  margin-top: 0;
  min-height: 38px;
  border-radius: 999px;
}

.desktop-work-slot-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  padding: 20px 14px;
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
  color: var(--muted);
  background: #0c1017;
}

.task-result-image {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #0c1017;
  cursor: zoom-in;
}

.desktop-work-cache-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 14px;
  border: 0;
  background: rgba(6, 10, 16, 0.64);
  color: #f5f7fb;
  text-align: center;
  z-index: 2;
}

.desktop-work-cache-overlay.is-loading {
  pointer-events: none;
}

.desktop-work-cache-overlay.is-failed {
  cursor: pointer;
  background: rgba(61, 18, 18, 0.72);
}

.desktop-work-cache-text {
  font-size: 12px;
  line-height: 1.6;
  color: inherit;
}

.desktop-work-cache-spinner {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--accent);
  animation: desktopWorkCacheSpin 0.85s linear infinite;
}

.desktop-work-cache-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: #4ec98d;
  border: 1px solid rgba(78, 201, 141, 0.35);
  background: rgba(8, 22, 15, 0.78);
  pointer-events: none;
}

@keyframes desktopWorkCacheSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.task-result-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
}

.desktop-work-slot-actions .btn-secondary-line.is-cached {
  color: #4ec98d;
  border-color: rgba(78, 201, 141, 0.35);
  background: rgba(78, 201, 141, 0.08);
}

.desktop-work-slot-actions .btn-secondary-line.is-failed {
  color: #ff9e9e;
  border-color: rgba(255, 123, 123, 0.35);
  background: rgba(255, 123, 123, 0.08);
}

.task-empty {
  padding: 24px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.list-empty-state {
  grid-column: 1 / -1;
  padding: 48px 20px 32px;
  text-align: center;
  background: transparent;
}

.list-empty-state-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.list-empty-state-text {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

.art-cover {
  aspect-ratio: 3 / 4;
  background: linear-gradient(160deg, #37405c, #1f2537);
}

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

.art-body {
  padding: 10px;
}

.art-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.art-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.template-coin-cost {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.btn-primary {
  margin-top: 10px;
  width: 100%;
  border: none;
  border-radius: 999px;
  height: 36px;
  color: #0f1117;
  font-weight: 600;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.desktop-layout .card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.task-list-notice {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(242, 202, 80, 0.22);
  border-radius: 14px;
  background: rgba(242, 202, 80, 0.08);
}

.task-list-notice-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.task-list-notice-text {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
}

.desktop-layout .art-cover {
  aspect-ratio: 4 / 3;
}

.auth-panel {
  max-width: 420px;
  margin: 28px auto 0;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.field {
  margin-top: 10px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #171d2a;
  color: var(--text);
  padding: 0 12px;
}

.auth-tabs {
  display: flex;
  gap: 8px;
}

.auth-tab {
  flex: 1;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
}

.auth-tab.active {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.stats-box,
.menu-list {
  margin-top: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.stats-box {
  padding: 14px;
}

.menu-item {
  height: 52px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  color: var(--muted);
}

.profile-menu-btn {
  width: 100%;
  border: none;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.profile-menu-btn:active {
  background: rgba(242, 202, 80, 0.08);
}

.menu-item-arrow {
  color: rgba(255, 255, 255, 0.36);
  font-size: 16px;
}

.menu-item:last-child {
  border-bottom: none;
}

.profile-logout-wrap {
  margin-top: 16px;
}

.profile-logout-btn {
  width: 100%;
  height: 42px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0f1117;
  font-size: 14px;
  font-weight: 700;
}

.profile-logout-btn:active {
  transform: scale(0.99);
}

.settings-card {
  margin-top: 16px;
  padding: 18px 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.settings-intro {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.policy-section {
  margin-top: 18px;
}

.policy-section:first-child {
  margin-top: 0;
}

.policy-section h3 {
  margin: 0;
  font-size: 16px;
  color: var(--accent);
}

.policy-text {
  margin: 10px 0 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.8;
}

.field textarea,
.field select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #171d2a;
  color: var(--text);
  padding: 12px;
  font: inherit;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.settings-submit {
  margin-top: 18px;
}

.settings-tip {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.language-settings-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.language-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #171d2a;
  color: var(--text);
  text-align: left;
}

.language-option.active {
  border-color: rgba(212, 175, 55, 0.5);
  background: rgba(212, 175, 55, 0.08);
}

.language-option-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.language-option-title {
  font-size: 15px;
  font-weight: 700;
}

.language-option-desc {
  font-size: 12px;
  color: var(--muted);
}

.language-option-check {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  position: relative;
  flex: 0 0 auto;
}

.language-option.active .language-option-check {
  border-color: var(--accent);
  background: var(--accent);
}

.language-option.active .language-option-check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #0f1117;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(60px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(18, 22, 31, 0.95);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 20;
}

.bottom-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 56px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.5px;
}

.bottom-icon {
  display: block;
  width: 22px;
  height: 22px;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}

.bottom-link[data-tab="gallery"] .bottom-icon {
  width: 22px;
  height: 18px;
}

.bottom-link[data-tab="create"] .bottom-icon {
  width: 20px;
  height: 24px;
}

.bottom-link[data-tab="studio"] .bottom-icon {
  width: 19px;
  height: 20px;
}

.bottom-label {
  line-height: 1;
}

.bottom-link.active {
  color: var(--accent-2);
}

.hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.app-notice {
  position: fixed;
  left: 50%;
  bottom: calc(90px + var(--safe-bottom));
  transform: translateX(-50%) translateY(16px);
  min-width: 180px;
  max-width: calc(100vw - 32px);
  padding: 12px 14px;
  border-radius: 12px;
  color: #fff;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 80;
}

.app-notice.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.app-notice-success {
  background: rgba(78, 201, 141, 0.95);
}

.app-notice-error {
  background: rgba(255, 123, 123, 0.96);
}

.gallery-pull-hint,
.gallery-load-hint {
  text-align: center;
}

.gallery-status {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-status[hidden] {
  display: none;
}

.gallery-status.is-spinner {
  font-size: 0;
}

.gallery-status.is-spinner::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  animation: app-shell-spinner-rotate 0.75s linear infinite;
}

.gallery-status.is-end {
  color: var(--muted);
}

.gallery-load-sentinel {
  height: 2px;
  width: 100%;
}

@keyframes app-shell-spinner-rotate {
  from {
    transform: rotate(0deg);
  }

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

.modal-overlay[hidden] {
  display: none;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 8, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
}

.modal-card {
  width: min(100%, 460px);
  max-height: min(84vh, 720px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #111621;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
}

.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.modal-head {
  border-bottom: 1px solid var(--line);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.modal-subtitle {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.modal-close-btn,
.btn-secondary-line {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 10px;
  min-height: 38px;
  padding: 0 14px;
}

.modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.template-picked-card {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.template-picked-head {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.template-picked-body {
  display: flex;
  gap: 12px;
  padding: 12px;
}

.template-picked-img {
  width: 92px;
  height: 92px;
  border-radius: 12px;
  object-fit: cover;
  background: #0d121b;
  border: 1px solid var(--line);
}

.template-picked-info {
  min-width: 0;
  flex: 1;
}

.template-picked-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.template-picked-desc {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 148px;
  border: 1px dashed rgba(242, 202, 80, 0.45);
  border-radius: 16px;
  background: rgba(242, 202, 80, 0.05);
  text-align: center;
  cursor: pointer;
}

.upload-dropzone[hidden] {
  display: none;
}

.upload-dropzone-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.upload-dropzone-desc {
  font-size: 12px;
  color: var(--muted);
}

.upload-preview-wrap {
  margin-top: 14px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0c1017;
}

.upload-preview-img {
  width: 100%;
  max-height: 280px;
  display: block;
  object-fit: cover;
}

.upload-preview-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.upload-replace-btn {
  min-width: 108px;
}

.desktop-preview-modal-card {
  width: min(100%, 520px);
}

.desktop-preview-modal-body {
  padding-top: 12px;
}

.desktop-preview-image-wrap {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0c1017;
}

.desktop-preview-image {
  width: 100%;
  max-height: min(70vh, 560px);
  display: block;
  object-fit: contain;
  background: #0c1017;
}

.template-generate-status-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.template-generate-status-card.is-loading {
  border-color: rgba(242, 202, 80, 0.35);
  background: rgba(242, 202, 80, 0.08);
}

.template-generate-status-card.is-success {
  border-color: rgba(78, 201, 141, 0.35);
  background: rgba(78, 201, 141, 0.08);
}

.template-generate-status-card.is-error {
  border-color: rgba(255, 123, 123, 0.35);
  background: rgba(255, 123, 123, 0.08);
}

.template-generate-status-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
}

.template-generate-status-text {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text);
}

.template-generate-result-wrap {
  margin-top: 14px;
}

.template-generate-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.template-generate-view-btn {
  min-width: 92px;
}

.template-generate-result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.template-generate-result-item {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.template-generate-result-image {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #0c1017;
}

.template-generate-result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.template-generate-result-actions .btn-primary,
.template-generate-result-actions .btn-secondary-line {
  margin-top: 0;
}

.modal-actions {
  border-top: 1px solid var(--line);
  flex-shrink: 0;
  background: #111621;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary-line {
  flex: 1;
  margin-top: 0;
}

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

.recharge-balance-card,
.recharge-summary-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  padding: 14px;
}

.recharge-balance-card {
  background: linear-gradient(135deg, rgba(242, 202, 80, 0.12), rgba(212, 175, 55, 0.06));
}
.recharge-balance-label,
.recharge-section-title {
  font-size: 12px;
  color: var(--muted);
}

.recharge-platform-hint {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
}

.recharge-section-title {
  margin: 16px 0 10px;
}

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

.recharge-product-card {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  padding: 14px;
  color: var(--text);
  text-align: left;
}

.recharge-product-card.is-active {
  border-color: rgba(242, 202, 80, 0.6);
  background: rgba(242, 202, 80, 0.1);
  box-shadow: 0 0 0 1px rgba(242, 202, 80, 0.18) inset;
}

.recharge-product-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(242, 202, 80, 0.16);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.recharge-product-title {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 700;
}

.recharge-product-price {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}

.recharge-product-credits {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text);
}

.recharge-product-desc {
  margin-top: 8px;
  min-height: 38px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.recharge-summary-card {
  margin-top: 16px;
}

.recharge-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 13px;
}

.recharge-summary-row:first-child {
  margin-top: 0;
}

.recharge-summary-row strong {
  color: var(--accent);
  font-size: 15px;
}

.upload-entry {
  margin-top: 8px;
}

.upload-entry-card {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}

.upload-entry-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.upload-entry-desc {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.upload-entry .btn-primary {
  margin-top: 10px;
}

.album-title-input {
  margin-top: 10px;
}

.section-title {
  margin: 16px 0 0;
  font-size: 22px;
  color: var(--accent);
}

.desktop-pack-grid {
  margin-top: 16px;
}


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

.art-pack-item {
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(135deg, #303958, #1c2236);
}

.work-detail-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.work-detail-item {
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  overflow: hidden;
}

.work-detail-item img {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.work-detail-item .btn-primary {
  margin: 10px;
  width: calc(100% - 20px);
}

.work-detail-actions {
  padding-bottom: 10px;
}

.work-detail-actions .btn-primary {
  margin: 8px 10px 0;
}

.work-back-btn,
.work-back-placeholder {
  width: 40px;
  height: 40px;
}

.work-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.work-back-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.work-back-btn-theme {
  color: var(--accent-2);
}

.profile-state-block {
  margin-top: 14px;
}

.profile-user-card,
.profile-guest-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.profile-user-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.profile-coin-card {
  margin-left: auto;
  display: inline-flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: max-content;
  min-width: 0;
  max-width: 100%;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid rgba(242, 202, 80, 0.25);
  background: linear-gradient(135deg, rgba(242, 202, 80, 0.12), rgba(212, 175, 55, 0.06));
  text-align: center;
}

.profile-coin-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.profile-coin-value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
  white-space: nowrap;
}

.profile-avatar {
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #0f1117;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.profile-nickname {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-inline-action {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  padding: 0;
  white-space: nowrap;
}

.profile-inline-action:disabled {
  opacity: 0.6;
}

.profile-user-meta .hint {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-auth-actions {
  margin-top: 14px;
}

@media (min-width: 900px) and (hover: hover) and (pointer: fine) {
  .app-shell {
    padding-bottom: 26px;
  }

  .bottom-nav {
    position: static;
    margin: 20px auto 0;
    max-width: 920px;
    border: 1px solid var(--line);
    border-radius: 12px;
    height: 56px;
    padding-bottom: 0;
  }
}

.native-capacitor-app .bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  max-width: none;
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--line);
  height: calc(60px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
}

.native-capacitor-app .app-shell {
  padding-bottom: calc(78px + var(--safe-bottom));
}

@media (max-width: 520px) {
  .recharge-product-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Image Crop Modal ===== */
.crop-modal-card {
  width: min(100%, 480px);
  position: relative;
  z-index: 1;
}

.crop-modal-body {
  padding: 16px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.crop-ratio-title {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 8px;
}

.crop-ratio-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}

.crop-ratio-btn {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.crop-ratio-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #3c2f00;
}

.crop-canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #0c1017;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.crop-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.crop-hint {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.crop-confirm-btn {
  width: auto;
  flex: 1;
  margin-top: 0;
  border-radius: 10px;
  height: 40px;
}

/* ===== Gallery Task Floating Ball ===== */
.gallery-task-float {
  position: fixed;
  z-index: 9999;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3c2f00;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: transform 0.12s ease, opacity 0.25s;
  right: 16px;
  bottom: 100px;
}

.gallery-task-float:active {
  cursor: grabbing;
}

.gallery-task-float[hidden] {
  display: none;
}

.gallery-task-float-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  pointer-events: none;
}

.gallery-task-float-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.65) 100%);
}

.gallery-task-float-label {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  z-index: 2;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  padding: 0 6px;
  pointer-events: none;
  color: var(--accent);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ===== Work Detail Save Choice Sheet ===== */
.save-choice-overlay {
  position: fixed;
  inset: 0;
  z-index: 90000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.save-choice-sheet {
  width: min(100%, 360px);
  background: var(--panel);
  border-radius: 20px;
  padding: 24px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: save-choice-scale-in 0.25s ease;
}

@keyframes save-choice-scale-in {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.save-choice-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.save-choice-btn:active {
  background: rgba(255, 255, 255, 0.08);
}

.save-choice-crop-btn {
  border-color: var(--accent);
  background: rgba(242, 202, 80, 0.08);
  color: var(--accent);
}

.save-choice-crop-btn:active {
  background: rgba(242, 202, 80, 0.14);
}

/* ===== Consent Modal ===== */
.consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(5, 8, 14, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.consent-overlay[hidden] {
  display: none;
}

.consent-card {
  width: min(100%, 420px);
  background: #111621;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  padding: 28px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.consent-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  letter-spacing: 1px;
}

.consent-body {
  font-size: 14px;
  line-height: 1.8;
  color: #ccc;
  text-align: center;
}

.consent-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}

.consent-actions {
  display: flex;
  gap: 12px;
}

.consent-btn {
  flex: 1;
  height: 46px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.consent-btn:active {
  opacity: 0.8;
}

.consent-btn-decline {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  border: 1px solid var(--line);
}

.consent-btn-accept {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0f1117;
}

/* ===== Language Toggle Button ===== */
.lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.lang-toggle-btn:active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.consent-lang-toggle {
  margin: 0 auto;
  display: block;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.consent-lang-toggle:active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.btn-apple-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid #000;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.15s;
}

.btn-apple-signin:active {
  opacity: 0.72;
}

.btn-apple-signin:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-apple-signin .apple-logo {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: currentColor;
  margin-top: -2px;
}

[dir="rtl"] .btn-apple-signin {
  flex-direction: row-reverse;
}

.topbar-btn.btn-apple-signin {
  width: auto;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;
  gap: 6px;
}

.topbar-btn.btn-apple-signin .apple-logo {
  width: 14px;
  height: 14px;
}

.apple-signin-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.apple-signin-modal-overlay[hidden] {
  display: none;
}

.apple-signin-modal-card {
  width: 100%;
  max-width: 340px;
  background: #1c1e25;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px 20px 20px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.apple-signin-modal-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.apple-signin-modal-desc {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.apple-signin-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.apple-signin-modal-cancel {
  width: 100%;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
}

.apple-signin-modal-cancel:active {
  background: rgba(255, 255, 255, 0.06);
}
