:root {
  color-scheme: dark;
  --bg: #0c0c0d;
  --panel: #111113;
  --control: #252526;
  --control-2: #2b2b2d;
  --line: #36363a;
  --muted: #828287;
  --text: #f7f7f8;
  --blue: #2f7cff;
  --cyan: #54d7c6;
  --danger: #ff6464;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 18px 122px;
  background: var(--bg);
  position: relative;
}

.app-header {
  display: grid;
  grid-template-columns: 48px 54px 1fr auto auto;
  gap: 10px;
  align-items: center;
  min-height: 76px;
}

.icon-button,
.more-button {
  width: 46px;
  height: 46px;
  border: 1px solid #202124;
  border-radius: 50%;
  color: var(--text);
  background: #101011;
  display: grid;
  place-items: center;
  font-size: 32px;
}

.more-button {
  width: 64px;
  border-radius: 999px;
  font-size: 22px;
  letter-spacing: 2px;
}

.brand-dot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #245cff, #69e0be);
  color: #fff;
  font-weight: 800;
}

.title-block h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
}

.title-block p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

#rechargeBtn {
  margin-left: 6px;
  padding: 3px 7px;
  border: 1px solid rgba(47, 124, 255, 0.35);
  border-radius: 9px;
  background: rgba(47, 124, 255, 0.12);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.share-button {
  min-width: 72px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: #2f68d8;
  color: #fff;
  font-weight: 800;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 28px -18px 28px;
  border-bottom: 1px solid #262629;
}

.tabs button {
  height: 60px;
  border: 0;
  background: transparent;
  color: #86868b;
  font-size: 22px;
  font-weight: 800;
  position: relative;
}

.tabs .active {
  color: var(--text);
}

.tabs .active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 42px;
  height: 3px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #fff;
}

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

form {
  display: grid;
  gap: 22px;
}

.field {
  display: grid;
  gap: 10px;
}

.field span {
  font-size: 21px;
  font-weight: 800;
}

.field b {
  color: var(--danger);
}

.history-chip {
  margin-left: 6px;
  padding: 5px 10px;
  border: 1px solid rgba(47, 124, 255, 0.3);
  border-radius: 12px;
  background: rgba(47, 124, 255, 0.12);
  color: var(--blue);
  font-size: 15px;
}

input,
select,
textarea {
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--control);
  color: var(--text);
  outline: none;
}

input::placeholder {
  color: #67676b;
}

select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #9b9ba0 50%), linear-gradient(135deg, #9b9ba0 50%, transparent 50%);
  background-position: calc(100% - 24px) 24px, calc(100% - 15px) 24px;
  background-size: 10px 10px, 10px 10px;
  background-repeat: no-repeat;
  color: #a5a5aa;
}

.upload-card {
  width: min(230px, 52vw);
  aspect-ratio: 1 / 1;
  border: 1.5px dashed #69696d;
  border-radius: 10px;
  background: #111113;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.upload-card input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

.upload-card.has-image {
  background-size: cover;
  background-position: center;
}

.upload-card.has-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.55));
}

.ai-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #245cff, #69e0be);
  box-shadow: 0 0 16px rgba(47, 124, 255, 0.45);
  font-weight: 900;
  z-index: 2;
  pointer-events: none;
}

.camera-icon {
  color: #77777c;
  font-size: 44px;
  line-height: 1;
  pointer-events: none;
}

.upload-card p {
  position: absolute;
  bottom: 32%;
  margin: 0;
  color: #77777c;
  z-index: 2;
  pointer-events: none;
}

.path-import {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 8px;
  width: 100%;
}

.path-import input {
  height: 42px;
  font-size: 13px;
}

.path-import button {
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: rgba(47, 124, 255, 0.16);
  color: var(--blue);
  font-weight: 800;
}

.result-section {
  padding-top: 4px;
}

.result-section h2 {
  margin: 0 0 12px;
  font-size: 21px;
}

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

.result-card {
  overflow: hidden;
  border-radius: 10px;
  background: #1a1a1d;
}

.result-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.result-card div {
  padding: 9px;
  color: #dedee1;
  font-size: 13px;
}

.download {
  display: grid;
  place-items: center;
  height: 46px;
  margin-top: 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #fff;
  text-decoration: none;
  font-weight: 900;
}

.generate-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(480px, 100%);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 14px;
  align-items: center;
  padding: 18px 18px 24px;
  background: #19191b;
  border-radius: 18px 18px 0 0;
  color: #dddde1;
  font-size: 19px;
}

.generate-bar strong {
  color: var(--blue);
  font-size: 30px;
  margin: 0 4px;
}

#generateBtn {
  height: 58px;
  border: 0;
  border-radius: 999px;
  background: #303033;
  color: #8b8b90;
  font-size: 20px;
  font-weight: 900;
}

#generateBtn.ready {
  color: #fff;
  background: linear-gradient(135deg, #2f7cff, #57d5c0);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 36px));
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(28, 28, 31, 0.92);
  color: #d8d8dc;
  font-size: 14px;
  text-align: center;
  pointer-events: none;
}

.progress {
  position: fixed;
  left: 50%;
  bottom: 98px;
  width: min(420px, calc(100% - 36px));
  height: 4px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

#progressBar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transition: width 0.25s ease;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

@media (max-width: 440px) {
  .app-header {
    grid-template-columns: 42px 46px minmax(94px, 1fr) 64px;
    gap: 8px;
  }

  .more-button {
    display: none;
  }

  .title-block h1 {
    font-size: 17px;
    white-space: nowrap;
  }

  .title-block p {
    font-size: 12px;
  }

  .share-button {
    min-width: 64px;
    padding: 0 10px;
  }

  .generate-bar {
    grid-template-columns: 1fr;
  }
}
