* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --pri: #6366f1;
  --pri-h: #4f46e5;
  --bg: #f8fafc;
  --sf: #ffffff;
  --sf-h: #f1f5f9;
  --tx: #1e293b;
  --tx2: #64748b;
  --bd: #e2e8f0;
  --r: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--tx);
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: var(--sf);
  border-bottom: 1px solid var(--bd);
  padding: 14px 24px;
  text-align: center;
}
.header-top {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}
header h1 { font-size: 22px; font-weight: 700; }
header .subtitle { color: var(--tx2); font-size: 13px; margin-top: 2px; }
.user-area {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.user-msg-btn {
  position: relative;
  text-decoration: none;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
}
.msg-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 8px;
  padding: 0 3px;
}
.msg-badge.hidden { display: none; }
.user-beans {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 12px;
}
.user-invite-btn {
  background: linear-gradient(135deg, #ede9fe, #dbeafe);
  border: 1px solid rgba(99,102,241,.2);
  color: var(--pri);
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: .2s;
}
.user-invite-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99,102,241,.18);
}
.user-email {
  color: var(--tx2);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-text {
  background: none;
  border: none;
  color: var(--tx2);
  cursor: pointer;
  font-size: 12px;
}
.btn-text:hover { color: var(--pri); }
.btn-sm { padding: 4px 12px; font-size: 12px; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--pri);
  color: var(--pri);
  border-radius: 6px;
  cursor: pointer;
  transition: .2s;
}
.btn-outline:hover { background: var(--pri); color: #fff; }

/* ── Highlights strip ── */
.highlights-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}
.hl-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  background: linear-gradient(135deg, rgba(99,102,241,.08), rgba(99,102,241,.04));
  border: 1px solid rgba(99,102,241,.18);
  border-radius: 20px;
  font-size: 12px;
  color: var(--pri);
  font-weight: 500;
  white-space: nowrap;
  transition: .2s;
}
.hl-tag:hover {
  background: linear-gradient(135deg, rgba(99,102,241,.16), rgba(99,102,241,.08));
  transform: translateY(-1px);
}

/* ── Layout ── */
main {
  display: flex;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px;
  gap: 16px;
  height: calc(100vh - 110px);
}

/* ── Sidebar ── */
.controls {
  width: 270px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}
.controls section {
  background: var(--sf);
  border-radius: var(--r);
  border: 1px solid var(--bd);
  padding: 14px;
}
.controls h3 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--tx2);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Drop zone ── */
.drop-zone {
  border: 2px dashed var(--bd);
  border-radius: var(--r);
  padding: 28px 12px;
  text-align: center;
  cursor: pointer;
  transition: .2s;
  color: var(--tx2);
  font-size: 13px;
  line-height: 1.7;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--pri);
  background: rgba(99,102,241,.04);
  color: var(--pri);
}

/* ── Preview ── */
.preview-container {
  margin-top: 10px;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--bd);
}
.preview-container img { width: 100%; display: block; }
.restore-btn {
  margin: 6px 6px 0;
  width: calc(100% - 12px);
  font-size: 12px;
  padding: 7px 10px;
}
.restore-status {
  margin: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}
.restore-status-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.restore-status-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.restore-status-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.restore-panel-status {
  margin: 0 20px 16px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
}
.restore-panel-status-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.restore-panel-status-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.restore-panel-status-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.hidden { display: none !important; }

/* ── Form controls ── */
.control-group { margin-bottom: 10px; }
.control-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 3px;
}
.control-group small { font-size: 11px; color: var(--tx2); }
.control-group select, .control-group input[type="range"] { width: 100%; }
select {
  padding: 5px 8px;
  border: 1px solid var(--bd);
  border-radius: 4px;
  font-size: 13px;
  background: var(--sf);
}
input[type="range"] { margin-top: 3px; }
.control-group label input[type="checkbox"] { margin-right: 5px; }

/* ── Buttons ── */
.btn {
  width: 100%;
  padding: 9px 14px;
  border: none;
  border-radius: var(--r);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: .2s;
  margin-bottom: 6px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--pri); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--pri-h); }
.btn-secondary { background: var(--sf); color: var(--tx); border: 1px solid var(--bd); }
.btn-secondary:hover:not(:disabled) { background: var(--sf-h); }

/* ── Gallery button ── */
.btn-gallery {
  width: 100%;
  padding: 8px 14px;
  border: 1px dashed var(--pri);
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(99,102,241,.04);
  color: var(--pri);
  margin-top: 6px;
  transition: .2s;
}
.btn-gallery:hover {
  background: rgba(99,102,241,.10);
  border-style: solid;
}

.import-divider {
  position: relative;
  text-align: center;
  margin: 10px 0 8px;
}
.import-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--bd);
}
.import-divider span {
  position: relative;
  display: inline-block;
  padding: 0 10px;
  background: var(--sf);
  color: var(--tx2);
  font-size: 11px;
}

.xhs-import-box {
  margin-top: 6px;
  padding: 10px;
  border: 1px solid rgba(99,102,241,.16);
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(99,102,241,.04), rgba(99,102,241,.02));
}
.xhs-import-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
}
.xhs-import-head strong {
  font-size: 13px;
  color: var(--tx);
}
.xhs-import-head small {
  font-size: 11px;
  color: var(--tx2);
  line-height: 1.4;
}
.xhs-import-input {
  width: 100%;
  resize: vertical;
  min-height: 78px;
  padding: 10px 12px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  background: #fff;
  color: var(--tx);
  outline: none;
}
.xhs-import-input:focus {
  border-color: var(--pri);
  box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
.xhs-import-btn {
  margin: 8px 0 0;
}
.xhs-status {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}
.xhs-status-info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.xhs-status-success {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.xhs-status-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.xhs-result {
  margin-top: 10px;
}
.xhs-meta {
  margin-bottom: 8px;
}
.xhs-note-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--tx);
  line-height: 1.5;
}
.xhs-note-desc {
  margin-top: 4px;
  font-size: 11px;
  color: var(--tx2);
  line-height: 1.5;
}
.xhs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.xhs-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--bd);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: .18s;
}
.xhs-card:hover,
.xhs-card.is-importing {
  border-color: var(--pri);
  box-shadow: 0 6px 18px rgba(99,102,241,.12);
  transform: translateY(-1px);
}
.xhs-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 8px;
  background: #f8fafc;
}
.xhs-card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(15,23,42,.82);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}
.xhs-card-meta {
  font-size: 11px;
  color: var(--tx2);
  text-align: center;
}

/* ── Gallery modal ── */
.gallery-box {
  background: var(--sf);
  border-radius: 14px;
  padding: 0;
  max-width: 680px;
  width: 94%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  overflow: hidden;
}
.gallery-header {
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--bd);
  position: relative;
}
.gallery-header h2 { font-size: 18px; font-weight: 700; }
.gallery-sub { font-size: 13px; color: var(--tx2); margin-top: 2px; }
.gallery-header .modal-close {
  position: absolute;
  top: 12px; right: 16px;
}
.gallery-tabs {
  display: flex;
  gap: 0;
  padding: 0 16px;
  border-bottom: 1px solid var(--bd);
  overflow-x: auto;
  flex-shrink: 0;
}
.gallery-tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--tx2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: .15s;
}
.gallery-tab:hover { color: var(--tx); }
.gallery-tab.active {
  color: var(--pri);
  border-bottom-color: var(--pri);
  font-weight: 600;
}
.gallery-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 12px;
  align-content: start;
}
.gallery-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid var(--bd);
  cursor: pointer;
  transition: .15s;
  text-align: center;
}
.gallery-item:hover {
  border-color: var(--pri);
  background: rgba(99,102,241,.04);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99,102,241,.10);
}
.gallery-item img {
  width: 56px; height: 56px;
  object-fit: contain;
}
.gallery-item span {
  font-size: 11px;
  color: var(--tx2);
  line-height: 1.3;
}
.gallery-item small {
  font-size: 10px;
  color: var(--tx3, #999);
  background: var(--bg2, #f5f5f5);
  padding: 1px 6px;
  border-radius: 4px;
}
.gallery-mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px 0;
}
.gallery-mode-btn {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--bd);
  background: var(--bg);
  font-size: 13px;
  cursor: pointer;
  transition: .15s;
  color: var(--tx2);
  white-space: nowrap;
}
.gallery-mode-btn:hover {
  border-color: var(--pri);
  color: var(--pri);
}
.gallery-mode-btn.active {
  background: var(--pri);
  color: #fff;
  border-color: var(--pri);
}
.gallery-pattern-item img {
  width: 80px; height: 80px;
  image-rendering: pixelated;
  border-radius: 4px;
  border: 1px solid var(--bd);
}
.gallery-illust-item img {
  width: 80px; height: 80px;
  image-rendering: auto;
  object-fit: contain;
  background: #f5f5f5;
}

/* ── Pixel Text Panel ── */
.pixel-text-panel {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pt-input-row {
  display: flex;
  gap: 8px;
}
.pt-input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--bd);
  border-radius: 8px;
  font-size: 16px;
  font-family: 'Zpix', monospace;
  outline: none;
  transition: border-color .15s;
}
.pt-input:focus {
  border-color: var(--pri);
}
.pt-gen-btn {
  white-space: nowrap;
  padding: 10px 20px;
}
.pt-options {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.pt-options label {
  font-size: 13px;
  color: var(--tx2);
  display: flex;
  align-items: center;
  gap: 4px;
}
.pt-options select {
  padding: 4px 8px;
  border: 1px solid var(--bd);
  border-radius: 6px;
  font-size: 13px;
}
.pt-preview-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 80px;
  padding: 16px;
  background: var(--bg2, #f9fafb);
  border-radius: 10px;
  border: 1px dashed var(--bd);
}
.pt-preview img {
  image-rendering: pixelated;
}
.pt-info {
  font-size: 13px;
  color: var(--tx2);
}
.pt-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.pt-preset-label {
  font-size: 12px;
  color: var(--tx3, #999);
}
.pt-preset {
  padding: 4px 12px;
  border: 1px solid var(--bd);
  border-radius: 16px;
  background: var(--bg);
  font-size: 13px;
  cursor: pointer;
  transition: .15s;
  font-family: 'Zpix', monospace;
}
.pt-preset:hover {
  border-color: var(--pri);
  color: var(--pri);
  background: rgba(99,102,241,.04);
}

/* ── Stats ── */
.stats-section .stat-item {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--bd);
}
.stats-section .stat-item:last-child { border-bottom: none; }
.stat-value { font-weight: 600; }

/* ── Pattern area ── */
.pattern-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  overflow-y: auto;
  min-height: 0;
}
.pattern-container {
  position: relative;
  border-radius: var(--r);
}
.pattern-container canvas { display: none; width: 100%; height: 100%; }
.pattern-container.has-pattern {
  flex: 1;
  min-height: 300px;
  background: var(--sf);
  border: 1px solid var(--bd);
  resize: vertical;
  overflow: auto;
}
.pattern-container.has-pattern canvas { display: block; }

/* ── Fullscreen button ── */
.fullscreen-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 6px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  line-height: 1;
}
.pattern-container:hover .fullscreen-btn:not(.hidden),
.fullscreen-btn:focus { opacity: 1; }
/* On touch devices, always show the button */
@media (hover: none) {
  .fullscreen-btn:not(.hidden) { opacity: 1; }
}
.pattern-container:fullscreen .fullscreen-btn,
.pattern-container:-webkit-full-screen .fullscreen-btn { opacity: 1; }
/* iOS / fallback overlay fullscreen */
.pattern-container.fake-fullscreen { position: fixed; inset: 0; z-index: 9999; border-radius: 0; background: #fff; border: none; min-height: unset; resize: none; height: 100vh !important; overflow: hidden; }
.pattern-container.fake-fullscreen .fullscreen-btn { opacity: 1; }

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx2);
  font-size: 15px;
  pointer-events: none;
  padding: 12px 0;
}

/* ── Feature showcase ── */
.feature-showcase {
  max-width: 100%;
  pointer-events: auto;
}
.feature-showcase h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--tx);
  margin-bottom: 12px;
  text-align: center;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.feature-card {
  background: var(--sf);
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  transition: .2s;
}
.feature-card:hover {
  border-color: var(--pri);
  box-shadow: 0 2px 8px rgba(99,102,241,.10);
  transform: translateY(-1px);
}
.fc-icon {
  font-size: 22px;
  margin-bottom: 4px;
}
.feature-card h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--tx);
  margin-bottom: 2px;
}
.feature-card p {
  font-size: 10px;
  line-height: 1.4;
  color: var(--tx2);
}
.showcase-cta {
  text-align: center;
  margin-top: 10px;
  font-size: 13px;
  color: var(--pri);
  font-weight: 600;
}

/* ── Legend ── */
.legend-section {
  background: var(--sf);
  border-radius: var(--r);
  border: 1px solid var(--bd);
  padding: 14px;
}
.legend-section h3 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--tx2);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.legend-content { display: flex; flex-wrap: wrap; gap: 6px; max-height: 260px; overflow-y: auto; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 4px;
  border: 1px solid var(--bd);
  font-size: 12px;
  background: var(--bg);
}
.legend-color {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,.12);
  flex-shrink: 0;
}
.legend-code { font-weight: 600; }
.legend-name { color: var(--tx2); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-count { color: var(--tx2); }
.legend-bags {
  color: var(--pri);
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
}

/* ── Bead tooltip ── */
.bead-tooltip {
  position: fixed;
  background: rgba(30,41,59,.92);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
  z-index: 500;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}
.tip-swatch {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,.4);
  vertical-align: middle;
  margin-right: 4px;
}

/* ── Usage info ── */
.usage-info {
  text-align: center;
  font-size: 12px;
  color: var(--tx2);
  padding: 6px 0 2px;
}
.usage-info b { color: var(--pri); font-size: 14px; }
.usage-info.usage-low b { color: #ef4444; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  overflow-y: auto;
  z-index: 1000;
}
.modal-box {
  background: var(--sf);
  border-radius: 14px;
  padding: 28px 32px;
  max-width: 420px;
  width: 90%;
  max-height: calc(100vh - 40px);
  overflow: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-close {
  position: absolute;
  top: 10px; right: 14px;
  background: none; border: none;
  font-size: 22px; cursor: pointer;
  color: var(--tx2);
}
.modal-box h2 { font-size: 20px; margin-bottom: 10px; }
.modal-box p { font-size: 14px; color: var(--tx2); line-height: 1.6; }
.modal-box ul {
  list-style: none;
  padding: 0;
  margin: 10px 0;
}
.modal-box ul li {
  font-size: 14px;
  padding: 4px 0;
}
.pricing {
  display: flex;
  gap: 12px;
  margin-top: 14px;
}
.price-card {
  flex: 1;
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  position: relative;
}
.price-card.featured {
  border-color: var(--pri);
  background: rgba(99,102,241,0.04);
}
.price-badge {
  position: absolute;
  top: -10px; right: 12px;
  background: var(--pri);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
}
.price-label { font-size: 13px; color: var(--tx2); margin-bottom: 4px; }
.price-amount { font-size: 22px; font-weight: 700; color: var(--tx); }
.price-amount span { font-size: 13px; font-weight: 400; color: var(--tx2); }
.modal-hint { font-size: 11px; color: #aaa; text-align: center; margin-top: 8px; }
.price-desc { font-size: 11px; color: var(--tx2); margin-top: 4px; }

.pixel-restore-box {
  background: var(--sf);
  border-radius: 16px;
  width: min(1100px, 96vw);
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.24);
}
.pixel-restore-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--bd);
  position: relative;
}
.pixel-restore-header h2 {
  font-size: 20px;
  margin-bottom: 6px;
}
.pixel-restore-header p {
  font-size: 13px;
  color: var(--tx2);
  line-height: 1.6;
}
.pixel-restore-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--bd);
  background: linear-gradient(180deg, rgba(99,102,241,.04), rgba(99,102,241,.01));
}
.restore-mode-group {
  display: inline-flex;
  gap: 8px;
}
.restore-mode-btn {
  border: 1px solid var(--bd);
  background: var(--bg);
  color: var(--tx2);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.restore-mode-btn:hover {
  border-color: var(--pri);
  color: var(--pri);
}
.restore-mode-btn.active {
  background: var(--pri);
  color: #fff;
  border-color: var(--pri);
}
.restore-scale-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--tx2);
}
.restore-scale-group select {
  min-width: 76px;
}
.restore-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--tx2);
}
.pixel-restore-grid {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.pixel-restore-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--bd);
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
}
.pixel-restore-pane h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--tx2);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.pixel-restore-stage {
  flex: 1;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  border: 1px dashed var(--bd);
  border-radius: 12px;
  background:
    linear-gradient(45deg, rgba(148,163,184,.08) 25%, transparent 25%, transparent 75%, rgba(148,163,184,.08) 75%, rgba(148,163,184,.08)),
    linear-gradient(45deg, rgba(148,163,184,.08) 25%, transparent 25%, transparent 75%, rgba(148,163,184,.08) 75%, rgba(148,163,184,.08));
  background-position: 0 0, 10px 10px;
  background-size: 20px 20px;
}
.pixel-restore-stage img,
.pixel-restore-stage canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 10px 32px rgba(15,23,42,.12);
  image-rendering: pixelated;
}
.pixel-restore-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 20px 20px;
}
.pixel-restore-actions .btn {
  width: auto;
  min-width: 180px;
  margin-bottom: 0;
}

/* ── Auth Modal ── */
.auth-modal-box { max-width: 380px; }
.auth-tabs {
  display: flex;
  gap: 0;
  margin: 16px 0 12px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  overflow: hidden;
}
.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--tx2);
  transition: .2s;
}
.auth-tab.active {
  background: var(--pri);
  color: #fff;
}
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form .form-group { width: 100%; }
.auth-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--tx2);
  margin-bottom: 4px;
}
.auth-form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bd);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: .2s;
  box-sizing: border-box;
}
.auth-form input:focus { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }
.auth-form input.input-error { border-color: #ef4444; }
.auth-form input.input-error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.12); }
.auth-form input.input-ok { border-color: #22c55e; }
.field-error {
  display: block;
  font-size: 12px;
  color: #ef4444;
  min-height: 16px;
  margin-top: 2px;
  transition: .2s;
}
.code-group {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.code-group .code-input-wrap { flex: 1; min-width: 0; }
.code-group input { flex: 1; min-width: 0; }
.send-code-btn {
  padding: 10px 14px;
  background: transparent;
  border: 1px solid var(--pri);
  color: var(--pri);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: .2s;
  margin-bottom: 1px;
}
.send-code-btn:hover { background: var(--pri); color: #fff; }
.send-code-btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-full { width: 100%; padding: 10px; position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; }
.auth-tip {
  color: var(--tx2);
  font-size: 13px;
  margin-top: 4px;
}
.label-optional {
  font-size: 11px;
  color: var(--tx2);
  font-weight: 500;
}
.invite-field-tip {
  font-size: 12px;
  color: var(--tx2);
  line-height: 1.5;
}
.invite-field-tip.is-valid { color: #15803d; }
.invite-field-tip.is-error { color: #ef4444; }
/* Password toggle */
.pw-input-wrap {
  position: relative;
  width: 100%;
}
.pw-input-wrap input { padding-right: 40px; }
.pw-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px;
  opacity: .5;
  transition: .2s;
}
.pw-toggle:hover { opacity: 1; }
/* Spinner */
.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.btn-spinner.hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
/* Forgot password */
.forgot-link {
  text-align: center;
  margin-top: 4px;
}
.forgot-link a {
  font-size: 12px;
  color: var(--tx2);
  text-decoration: none;
}
.forgot-link a:hover { color: var(--pri); }
/* Toast */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: #22c55e;
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  z-index: 2000;
  opacity: 0;
  transition: opacity .3s, transform .3s;
  pointer-events: none;
}
.toast.toast-error { background: #ef4444; }
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive ── */
@media (max-width: 800px) {
  main { flex-direction: column; height: auto; }
  .controls { width: 100%; }
  .pattern-container.has-pattern { flex: none; height: 50vh; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .xhs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pixel-restore-box { width: 100%; max-height: calc(100vh - 16px); }
  .pixel-restore-toolbar { align-items: stretch; }
  .restore-meta { width: 100%; margin-left: 0; }
  .pixel-restore-grid { grid-template-columns: 1fr; padding: 14px; }
  .pixel-restore-stage { min-height: 220px; }
  .pixel-restore-actions { padding: 0 14px 14px; }
  .pixel-restore-actions .btn { width: 100%; }
  .empty-state-mobile {
    display: block;
    padding: 0 0 12px;
  }
  .empty-state-mobile .feature-showcase {
    width: 100%;
  }
  .feature-highlights-mobile {
    margin-top: 12px;
  }
}

/* ── Crop overlay ── */
.preview-container { position: relative; }
.preview-img-wrap {
  position: relative;
  overflow: hidden;
  border-radius: var(--r);
}
.preview-img-wrap img { display: block; width: 100%; }
.crop-overlay {
  position: absolute;
  inset: 0;
  background: transparent;
  cursor: crosshair;
  z-index: 10;
}
.crop-box {
  position: absolute;
  border: 2px dashed #fff;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.5);
  background: transparent;
  min-width: 10px;
  min-height: 10px;
  pointer-events: none;
}
.crop-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  position: relative;
  z-index: 20;
}
.crop-btn { margin-top: 4px; position: relative; z-index: 20; }

/* ── Comparison overlay ── */
.compare-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.compare-overlay img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.55;
}
.compare-slider-wrap {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  background: rgba(30,41,59,.8);
  padding: 4px 12px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}
.compare-slider-wrap label { color: #fff; font-size: 12px; }
.compare-slider-wrap input { width: 100px; }

/* ── History ── */
.history-section {
  background: var(--sf);
  border-radius: var(--r);
  border: 1px solid var(--bd);
  padding: 14px;
}
.history-section h3 {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--tx2);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.history-content { display: flex; flex-direction: column; gap: 6px; }
.history-empty { font-size: 12px; color: var(--tx2); text-align: center; }
.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 6px;
  border: 1px solid var(--bd);
  cursor: pointer;
  transition: .15s;
  font-size: 12px;
}
.history-item:hover { background: var(--sf-h); border-color: var(--pri); }
.history-thumb {
  width: 40px; height: 40px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--bd);
}
.history-meta { flex: 1; min-width: 0; }
.history-meta .h-size { font-weight: 600; }
.history-meta .h-date { color: var(--tx2); font-size: 11px; }
.history-del {
  background: none;
  border: none;
  color: var(--tx2);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
}
.history-del:hover { color: #ef4444; }

/* ── Bead picker popup ── */
.bead-picker {
  position: fixed;
  z-index: 600;
  background: var(--sf);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.22);
  width: 260px;
  max-height: 360px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.bp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--bd);
  font-size: 13px;
  font-weight: 600;
}
.bp-close {
  background: none; border: none; font-size: 18px;
  cursor: pointer; color: var(--tx2); line-height: 1;
}
.bp-search {
  margin: 6px 10px;
  padding: 5px 8px;
  border: 1px solid var(--bd);
  border-radius: 5px;
  font-size: 12px;
  outline: none;
}
.bp-search:focus { border-color: var(--pri); }
.bp-colors {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 4px;
  align-content: start;
}
.bp-swatch {
  width: 36px; height: 36px;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  position: relative;
  transition: .15s;
}
.bp-swatch:hover {
  border-color: var(--pri);
  transform: scale(1.15);
  z-index: 1;
}
.bp-swatch.bp-active {
  border-color: var(--pri);
  box-shadow: 0 0 0 2px rgba(99,102,241,.35);
}
.bp-swatch::after {
  content: attr(data-code);
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 8px;
  white-space: nowrap;
  color: var(--tx2);
  opacity: 0;
  pointer-events: none;
  transition: .15s;
}
.bp-swatch:hover::after { opacity: 1; }

/* edit-mode canvas cursor */
.canvas-edit-mode { cursor: crosshair !important; }
.edit-mode-hint {
  position: absolute;
  top: 8px; left: 50%;
  transform: translateX(-50%);
  background: rgba(99,102,241,.9);
  color: #fff;
  font-size: 12px;
  padding: 4px 14px;
  border-radius: 20px;
  pointer-events: none;
  z-index: 4;
}

/* ── Recharge Modal ── */
.recharge-modal-box { max-width: 520px; }
.recharge-balance { font-size: 16px; color: #666; margin-bottom: 16px; }
.recharge-balance b { color: #6366f1; font-size: 20px; }
.recharge-section { margin-bottom: 18px; }
.recharge-section h3 { font-size: 15px; margin-bottom: 10px; color: #333; display: flex; align-items: center; gap: 8px; }
.recharge-desc { font-size: 13px; color: #888; margin: -4px 0 10px; }
.member-badge { font-size: 11px; background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; padding: 2px 8px; border-radius: 10px; }
.recharge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.recharge-card { border: 2px solid #e5e7eb; border-radius: 12px; padding: 14px 8px; text-align: center; cursor: pointer; transition: all .2s; position: relative; }
.recharge-card:hover { border-color: #6366f1; background: #f5f3ff; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(99,102,241,0.15); }
.recharge-card.featured { border-color: #f59e0b; }
.recharge-card.featured::before { content: '推荐'; position: absolute; top: -10px; right: -6px; background: linear-gradient(135deg, #f59e0b, #ef4444); color: #fff; font-size: 10px; padding: 2px 8px; border-radius: 8px; }
.recharge-card .rc-beans { font-size: 22px; font-weight: 700; color: #6366f1; }
.recharge-card .rc-price { font-size: 18px; font-weight: 600; color: #ef4444; margin-top: 4px; }
.recharge-card .rc-price small { font-size: 12px; color: #999; }
.recharge-card .rc-unit { font-size: 11px; color: #999; margin-top: 2px; }
.recharge-card .rc-name { font-size: 13px; color: #666; margin-top: 4px; }
.recharge-card .rc-benefit { font-size: 11px; color: #6366f1; margin-top: 6px; background: #f5f3ff; padding: 3px 6px; border-radius: 6px; }
.recharge-card .rc-save { position: absolute; top: -8px; left: -6px; background: #ef4444; color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 8px; font-weight: 600; }

/* Recharge tip */
.recharge-tip { display: flex; align-items: center; gap: 6px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 8px 12px; margin-bottom: 14px; font-size: 13px; color: #92400e; }
.recharge-tip b { color: #d97706; }

/* Member benefits */
.member-benefits { background: linear-gradient(135deg, #fdf4ff, #f5f3ff); border: 1px solid #e9d5ff; border-radius: 12px; padding: 14px 16px; margin-top: 8px; }
.member-benefits h4 { font-size: 14px; color: #7c3aed; margin: 0 0 10px; }
.benefits-list { list-style: none; padding: 0; margin: 0; }
.benefits-list li { font-size: 13px; color: #555; padding: 4px 0; display: flex; align-items: center; gap: 8px; }
.benefit-icon { font-size: 15px; flex-shrink: 0; }

/* Pay benefits summary (step 2) */
.pay-benefits-summary { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 10px 14px; margin: 8px 0 12px; }
.pbs-title { font-size: 13px; font-weight: 600; color: #166534; margin-bottom: 6px; }
.pbs-item { font-size: 13px; color: #15803d; padding: 2px 0; }
.pbs-item b { color: #166534; }

.paying-status { text-align: center; padding: 20px 0; }
.paying-status p { margin: 8px 0; color: #666; }
.pay-hint { font-size: 13px; color: #999 !important; }
.pay-spinner { width: 40px; height: 40px; border: 4px solid #e5e7eb; border-top-color: #6366f1; border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 12px; }
.paying-status .btn { margin: 8px 6px 0; }

/* Payment QR flow */
.pay-order-info { font-size: 15px; color: #333; margin: 8px 0; }
.pay-order-no { font-size: 13px; color: #888; margin-bottom: 12px; }
.pay-order-no code, .pay-qr-note code { background: #f3f4f6; padding: 2px 8px; border-radius: 4px; font-size: 13px; font-weight: 600; color: #6366f1; user-select: all; }
.pay-method-label { font-size: 15px; font-weight: 600; color: #1677ff; margin-bottom: 12px; text-align: center; }
.pay-qr-wrap { text-align: center; padding: 16px 0; }
.pay-qr-img { width: 220px; height: 220px; border: 2px solid #e5e7eb; border-radius: 12px; object-fit: contain; background: #fafafa; }
.pay-qr-hint { font-size: 18px; font-weight: 600; color: #333; margin: 10px 0 4px; }
.pay-qr-note { font-size: 13px; color: #ef4444; margin: 8px 0; }
.pay-actions { display: flex; gap: 10px; margin-top: 12px; }
.pay-actions .btn { flex: 1; padding: 10px; font-size: 15px; }
.pay-done-info { text-align: center; padding: 20px 0; }
.pay-done-info h2 { margin-bottom: 12px; }
.pay-done-info p { margin: 8px 0; color: #555; }
.pay-done-hint { font-size: 13px; color: #999 !important; margin-top: 12px !important; }
.pay-done-info .btn { margin-top: 16px; }

.invite-loading {
  margin-top: 16px;
  padding: 14px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--tx2);
  text-align: center;
}

.invite-modal-box {
  max-width: 520px;
  width: min(92vw, 520px);
  max-height: min(86vh, 760px);
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.invite-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.invite-modal-copy {
  min-width: 0;
}
.invite-modal-copy h2 {
  margin: 0;
  line-height: 1.2;
}
.invite-modal-copy p {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.6;
}
.invite-modal-close {
  position: static;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--bd);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(15,23,42,.08);
  color: var(--tx2);
}
#inviteBody {
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}
.invite-summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  margin-top: 12px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
}
.invite-code-label {
  font-size: 12px;
  color: var(--tx2);
  margin-bottom: 6px;
}
.invite-code-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--pri);
}
.invite-share-field {
  margin-top: 14px;
}
.invite-share-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--tx2);
  margin-bottom: 6px;
}
.invite-share-field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--bd);
  border-radius: 10px;
  font-size: 13px;
  color: var(--tx);
  background: #f8fafc;
}
.invite-share-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.invite-share-actions .btn {
  flex: 1;
}
.invite-share-preview {
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #e9d5ff;
  background: linear-gradient(135deg, #faf5ff, #eff6ff);
}
.invite-share-preview-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--tx2);
  margin-bottom: 8px;
}
.invite-share-preview-text {
  font-size: 13px;
  line-height: 1.7;
  color: var(--tx);
  white-space: pre-wrap;
}
.invite-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.invite-stat-card {
  padding: 12px 8px;
  border: 1px solid var(--bd);
  border-radius: 12px;
  background: #fff;
  text-align: center;
}
.invite-stat-card b {
  display: block;
  font-size: 22px;
  color: var(--pri);
}
.invite-stat-card span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--tx2);
}
.invite-rules-card {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fbff;
}
.invite-rules-card h3 {
  font-size: 14px;
  margin-bottom: 8px;
}
.invite-rules-list {
  margin: 0;
  padding-left: 18px;
  color: var(--tx2);
}
.invite-rules-list li {
  font-size: 13px;
  line-height: 1.6;
  margin: 4px 0;
}
.invite-recent {
  margin-top: 18px;
}
.invite-recent h3 {
  font-size: 14px;
  margin-bottom: 10px;
}
.invite-recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.invite-recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--bd);
  border-radius: 12px;
  background: #fff;
}
.invite-recent-main {
  min-width: 0;
}
.invite-recent-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--tx);
}
.invite-recent-time {
  margin-top: 4px;
  font-size: 12px;
  color: var(--tx2);
}
.invite-status-badge {
  flex-shrink: 0;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.invite-status-badge.is-rewarded {
  background: #dcfce7;
  color: #15803d;
}
.invite-status-badge.is-pending {
  background: #fef3c7;
  color: #b45309;
}
.invite-status-badge.is-blocked {
  background: #e2e8f0;
  color: #475569;
}
.invite-empty {
  padding: 16px;
  border: 1px dashed var(--bd);
  border-radius: 12px;
  text-align: center;
  color: var(--tx2);
  font-size: 13px;
}

.nobeans-note {
  margin-top: 6px;
  font-size: 12px !important;
  color: #64748b !important;
}

.nobeans-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.nobeans-actions .btn {
  min-width: 150px;
  padding: 10px 20px;
  font-size: 15px;
}

/* User recharge button */
.user-recharge-btn { background: none; border: 1px solid #6366f1; color: #6366f1; padding: 3px 10px; border-radius: 14px; font-size: 12px; cursor: pointer; transition: all .2s; }
.user-recharge-btn:hover { background: #6366f1; color: #fff; }

@media (max-width: 600px) {
  .xhs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recharge-grid { grid-template-columns: repeat(2, 1fr); }
  .recharge-modal-box { max-width: 95vw; padding: 16px; }
  .invite-modal-box {
    width: 100%;
    max-height: calc(100vh - 24px);
    padding: 16px;
  }
  .invite-modal-copy h2 { font-size: 18px; }
  .invite-modal-copy p { font-size: 13px; }
  .invite-summary-card {
    flex-direction: column;
    align-items: stretch;
    margin-top: 10px;
    padding: 14px;
  }
  .invite-share-actions {
    flex-direction: column;
  }
  .invite-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .invite-recent-item {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ── SEO Footer ── */
.seo-footer {
  background: #1e293b;
  color: #cbd5e1;
  padding: 40px 20px 20px;
  margin-top: 40px;
  font-size: 14px;
  line-height: 1.8;
}
.seo-footer-inner {
  max-width: 900px;
  margin: 0 auto;
}
.seo-footer h2 {
  color: #f1f5f9;
  font-size: 18px;
  margin-bottom: 10px;
}
.seo-footer h3 {
  color: #e2e8f0;
  font-size: 15px;
  margin: 20px 0 8px;
}
.seo-footer p { margin-bottom: 8px; }
.seo-footer ul, .seo-footer ol {
  padding-left: 20px;
  margin-bottom: 8px;
}
.seo-footer li { margin-bottom: 4px; }
.seo-footer a { color: #818cf8; text-decoration: none; }
.seo-footer a:hover { text-decoration: underline; }
.seo-footer details {
  margin-bottom: 6px;
  cursor: pointer;
}
.seo-footer summary {
  font-weight: 600;
  color: #e2e8f0;
}
.seo-footer details p {
  padding-left: 12px;
  color: #94a3b8;
}
.seo-copy {
  text-align: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #334155;
  color: #64748b;
  font-size: 12px;
}

/* ═══════ Character Gallery ═══════ */
.character-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  max-width: 100%;
  margin: 0 auto 16px;
  padding: 0 8px;
}
.character-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  border-radius: 12px;
  padding: 10px 6px 8px;
  background: #f8f9fa;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}
.character-thumb:hover {
  border-color: #6366f1;
  background: #eef2ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99,102,241,0.15);
}
.character-thumb img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 8px;
}
.character-thumb span {
  margin-top: 5px;
  font-size: 0.72rem;
  color: #555;
  text-align: center;
  white-space: nowrap;
}

/* ═══════ Scroll Hint ═══════ */
.scroll-hint {
  text-align: center;
  color: #aaa;
  font-size: 0.8rem;
  padding: 8px 0 4px;
  animation: scrollBounce 2s ease-in-out infinite;
}
.scroll-arrow {
  display: inline-block;
  animation: scrollBounce 2s ease-in-out infinite;
  font-size: 1rem;
}
@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(6px); opacity: 1; }
}

/* Back bar after character gallery generation */
.char-back-bar {
  width: 100%;
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  padding: 10px 16px;
  text-align: center;
  border-radius: 10px 10px 0 0;
}
.char-back-bar .char-back-btn {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,0.4);
  border-radius: 20px;
  padding: 7px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.char-back-bar .char-back-btn:hover { background: rgba(255,255,255,0.32); }

@media (max-width: 600px) {
  .character-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 0 4px;
  }
  .character-thumb { padding: 6px 2px 5px; }
  .character-thumb img { width: 48px; height: 48px; }
  .character-thumb span { font-size: 0.6rem; }
}
