:root {
  color-scheme: dark;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #060814;
  color: #f8fbff;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 4%, rgba(0, 229, 255, 0.24), transparent 26%),
    radial-gradient(circle at 92% 0%, rgba(255, 76, 117, 0.22), transparent 28%),
    linear-gradient(180deg, #070a15 0%, #0b1020 46%, #070812 100%);
  padding-bottom: calc(92px + env(safe-area-inset-bottom));
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 100%),
    linear-gradient(45deg, rgba(0, 229, 255, 0.08) 0 1px, transparent 1px 100%);
  background-size: 42px 42px, 60px 60px;
  mask-image: linear-gradient(#000, transparent 78%);
}

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

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

.h5-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 14px 12px 0;
}

.hero-card,
.account-card,
.brief-card,
.result-card,
.history-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  background: rgba(10, 16, 32, 0.82);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(0, 229, 255, 0.14), transparent 34%, rgba(255, 76, 117, 0.14)),
    rgba(9, 14, 30, 0.9);
}

.hero-card::after {
  position: absolute;
  right: -26px;
  bottom: -2px;
  width: 240px;
  height: 76px;
  content: "";
  background:
    linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.42), transparent),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 14px);
  clip-path: polygon(0 78%, 12% 56%, 22% 64%, 34% 28%, 47% 52%, 58% 14%, 72% 48%, 84% 32%, 100% 58%, 100% 100%, 0 100%);
  opacity: 0.72;
}

.hero-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 66px;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: linear-gradient(135deg, #00e5ff, #7c3aed 48%, #ff4c75);
  color: #fff;
  font-size: 32px;
  font-weight: 950;
  box-shadow: 0 18px 42px rgba(124, 58, 237, 0.34);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(109, 255, 179, 0.28);
  border-radius: 999px;
  background: rgba(109, 255, 179, 0.08);
  color: #8fffc4;
  font-size: 12px;
  font-weight: 900;
}

.status-pill span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6dffb3;
  box-shadow: 0 0 14px rgba(109, 255, 179, 0.85);
}

.eyebrow,
.section-kicker {
  margin: 16px 0 8px;
  color: #00e5ff;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.16em;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  position: relative;
  z-index: 1;
  max-width: 340px;
  font-size: clamp(32px, 10vw, 46px);
  line-height: 1.04;
}

h2 {
  font-size: 21px;
}

.subtitle {
  position: relative;
  z-index: 1;
  margin: 14px 0 0;
  color: #b9c6d9;
  font-size: 15px;
  line-height: 1.72;
}

.hero-metrics {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.hero-metrics span,
.chip {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 850;
  padding: 8px 10px;
}

.quick-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(7, 10, 21, 0.78);
  backdrop-filter: blur(18px);
}

.quick-tabs button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #aebcd0;
  font-size: 14px;
  font-weight: 900;
}

.quick-tabs button:focus,
.quick-tabs button:hover {
  background: rgba(0, 229, 255, 0.14);
  color: #fff;
}

.brief-card,
.account-card,
.result-card,
.history-card {
  padding: 16px;
  margin-top: 12px;
}

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

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(3, 7, 18, 0.5);
}

.auth-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #8ea4bc;
  font-weight: 950;
}

.auth-tabs button.active {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.22), rgba(255, 76, 117, 0.18));
  color: #fff;
}

.primary-small,
.profile-save-btn {
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #00e5ff, #7c3aed 48%, #ff4c75);
  color: #fff;
  font-weight: 950;
  box-shadow: 0 14px 34px rgba(124, 58, 237, 0.26);
}

.auth-hint {
  margin: 0;
  color: #8ea4bc;
  font-size: 12px;
  line-height: 1.65;
}

.user-box > div:first-child {
  display: grid;
  gap: 4px;
}

.user-box strong {
  color: #fff;
  font-size: 16px;
}

.user-box span {
  color: #8ea4bc;
  font-size: 12px;
}

.quota-ring {
  display: grid;
  place-items: center;
  min-height: 118px;
  border: 1px solid rgba(0, 229, 255, 0.24);
  border-radius: 18px;
  background:
    radial-gradient(circle, rgba(0, 229, 255, 0.2), transparent 58%),
    rgba(3, 7, 18, 0.55);
}

.quota-ring b {
  color: #6dffb3;
  font-size: 44px;
  line-height: 1;
}

.quota-ring span {
  color: #dbeafe;
  font-weight: 900;
}

.redeem-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.share-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(0, 229, 255, 0.2);
  border-radius: 16px;
  background: rgba(0, 229, 255, 0.06);
}

.share-box strong {
  display: block;
  margin-bottom: 4px;
}

.share-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.share-row input {
  font-size: 13px;
}

.share-action {
  min-height: 42px;
}

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

.section-head.compact {
  margin-top: 4px;
}

.section-kicker {
  margin: 0 0 7px;
}

.text-btn {
  min-height: 36px;
  border: 1px solid rgba(0, 229, 255, 0.28);
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.08);
  color: #dbeafe;
  font-size: 13px;
  font-weight: 900;
  padding: 7px 12px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 13px;
}

.field span,
.select-row span {
  color: #d6e3f5;
  font-size: 14px;
  font-weight: 900;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 14px;
  background: rgba(3, 7, 18, 0.72);
  color: #f8fbff;
  font-size: 16px;
  line-height: 1.55;
  outline: none;
  padding: 13px 14px;
}

textarea {
  min-height: 122px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #6f8095;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #00e5ff;
  box-shadow: 0 0 0 4px rgba(0, 229, 255, 0.12);
}

.chip-group {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 12px;
  scrollbar-width: none;
}

.chip-group::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: 0 0 auto;
  min-height: 38px;
}

.chip.active {
  border-color: rgba(0, 229, 255, 0.78);
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.24), rgba(255, 76, 117, 0.18));
  color: #fff;
}

.select-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.select-row label {
  display: grid;
  gap: 8px;
}

select {
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, #7dd3fc 50%) right 15px center / 7px 7px no-repeat,
    rgba(3, 7, 18, 0.78);
  padding-right: 32px;
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin: 13px 0;
  padding: 0 2px;
  color: #dbeafe;
  font-size: 14px;
  font-weight: 900;
}

.switch-line input {
  width: 20px;
  height: 20px;
  accent-color: #00e5ff;
}

.profile-box {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.profile-box summary {
  cursor: pointer;
  padding: 13px 14px;
  color: #dbeafe;
  font-weight: 950;
}

.profile-grid {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.profile-save-btn {
  width: 100%;
}

.result-list,
.history-list {
  display: grid;
  gap: 12px;
}

.empty-state,
.loading-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  color: #a9b7ca;
  text-align: center;
  line-height: 1.8;
}

.empty-state.error {
  color: #ffb4c3;
  border-color: rgba(255, 76, 117, 0.42);
}

.loading-state {
  gap: 8px;
}

.loading-state strong {
  color: #fff;
}

.loading-state span {
  color: #8ea4bc;
  font-size: 14px;
}

.loader {
  width: 42px;
  aspect-ratio: 1;
  border: 3px solid rgba(0, 229, 255, 0.16);
  border-top-color: #00e5ff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.copy-card {
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(0, 229, 255, 0.09), transparent 36%, rgba(255, 76, 117, 0.08)),
    rgba(8, 13, 26, 0.9);
}

.copy-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 14px 0;
}

.card-index {
  color: #00e5ff;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.14em;
}

.copy-card h3 {
  margin-top: 5px;
  font-size: 18px;
}

.copy-card p {
  margin: 0;
  padding: 12px 14px 6px;
  color: #e8f0fb;
  font-size: 15px;
  line-height: 1.85;
  white-space: pre-wrap;
}

.card-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px 14px 14px;
}

.mini-btn {
  min-height: 38px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #dbeafe;
  font-size: 13px;
  font-weight: 900;
  padding: 7px 10px;
}

.favorite-btn {
  width: auto;
  color: #ffd166;
}

.history-empty {
  padding: 14px;
  border: 1px dashed rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  color: #8ea4bc;
  font-size: 14px;
  line-height: 1.7;
}

.history-item {
  width: 100%;
  min-height: auto;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  background: rgba(3, 7, 18, 0.58);
  color: #f8fbff;
  padding: 13px 12px;
  text-align: left;
}

.history-item strong {
  display: block;
  margin-bottom: 5px;
  font-size: 15px;
}

.history-item span {
  color: #8ea4bc;
  font-size: 12px;
  line-height: 1.45;
}

.prompt-fallback {
  overflow: auto;
  margin: 0;
  padding: 14px;
  border-radius: 16px;
  background: rgba(3, 7, 18, 0.72);
  color: #e8f0fb;
  white-space: pre-wrap;
}

.bottom-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(6, 8, 20, 0.82);
  backdrop-filter: blur(18px);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 20;
  max-width: min(340px, calc(100vw - 28px));
  transform: translateX(-50%);
  padding: 11px 14px;
  border: 1px solid rgba(0, 229, 255, 0.28);
  border-radius: 999px;
  background: rgba(7, 10, 21, 0.92);
  color: #fff;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
  font-size: 14px;
  font-weight: 900;
}

#generateBtn {
  display: block;
  width: min(100%, 456px);
  min-height: 52px;
  margin: 0 auto;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, #00e5ff, #7c3aed 48%, #ff4c75);
  color: #fff;
  box-shadow: 0 18px 40px rgba(124, 58, 237, 0.34), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  font-size: 16px;
  font-weight: 950;
}

#generateBtn:disabled {
  cursor: not-allowed;
  filter: grayscale(0.3);
  opacity: 0.7;
}

@media (min-width: 760px) {
  body {
    padding-bottom: 112px;
  }

  .h5-shell {
    padding-top: 26px;
  }

  .hero-card,
  .brief-card,
  .result-card,
  .history-card {
    border-radius: 22px;
  }
}
