:root {
  --bg-page: #fcf8ff;
  --bg-gradient: linear-gradient(180deg, #f4e8ff 0%, #fbf7ff 48%, #fff8f2 100%);
  --card: rgba(255, 255, 255, 0.9);
  --card-strong: #ffffff;
  --line: rgba(117, 83, 171, 0.1);
  --shadow-lg: 0 28px 80px rgba(106, 73, 151, 0.12);
  --shadow-md: 0 16px 38px rgba(125, 92, 169, 0.1);
  --shadow-sm: 0 10px 24px rgba(128, 95, 172, 0.1);
  --ink-strong: #302043;
  --ink-body: #655478;
  --ink-soft: #9c8bb0;
  --accent: #8c62ca;
  --accent-strong: #6f49b3;
  --accent-soft: #f2e8ff;
  --accent-soft-2: #f8f2ff;
  --success: #2a8a62;
  --danger: #bf4d6b;
  --warm: #fff3df;
  --warm-line: #f6dec1;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg-page);
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink-strong);
  background:
    radial-gradient(circle at top left, rgba(242, 223, 255, 0.9) 0, transparent 28%),
    radial-gradient(circle at top right, rgba(255, 236, 210, 0.65) 0, transparent 24%),
    linear-gradient(180deg, #fcf9ff 0%, #f8f1ff 42%, #fff9f2 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

code {
  font-family: "Consolas", "Courier New", monospace;
}

.hidden,
.directory-entry-panel,
.browse-panel {
  display: none !important;
}

.app-shell {
  width: min(520px, calc(100% - 20px));
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0 34px;
}

.phone-stage {
  display: flex;
  justify-content: center;
  width: 100%;
}

.phone-frame {
  width: min(100%, 430px);
  min-height: 900px;
  position: relative;
  padding: 14px;
  border-radius: 40px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(250, 245, 255, 0.96) 100%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 34px 84px rgba(67, 39, 104, 0.14);
  overflow: hidden;
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.brand-pill {
  flex: 1;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #25b16a;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
}

.topbar-address {
  font-size: 16px;
  font-weight: 700;
}

.header-icon-btn {
  width: 54px;
  height: 54px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  color: var(--ink-body);
  font-size: 24px;
  box-shadow: var(--shadow-sm);
}

.screen {
  display: none;
  position: relative;
  min-height: 800px;
  padding: 10px 8px 94px;
}

.screen.active {
  display: block;
}

.screen-bg {
  position: absolute;
  inset: 0 0 84px;
  border-radius: 34px;
  background: var(--bg-gradient);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -60px 120px rgba(255, 255, 255, 0.2);
}

.hero-card,
.stats-grid,
.glass-card,
.menu-list,
.inner-page {
  position: relative;
  z-index: 1;
}

.hero-card {
  padding: 22px 18px 10px;
}

.mobile-title {
  margin: 0;
  font-size: clamp(30px, 6vw, 40px);
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  margin-top: 14px;
  padding: 10px 16px;
  min-height: 40px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(247, 239, 255, 0.88) 100%);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.96);
}

.stats-grid {
  margin: 0 4px 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.stat-card,
.glass-card,
.menu-item,
.folder-card,
.inline-file-card,
.result-card,
.history-card,
.guide-card div {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-md);
}

.stat-card {
  min-width: 0;
  padding: 16px 13px;
  border-radius: 24px;
  backdrop-filter: blur(10px);
}

.stat-card span {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
  margin-bottom: 8px;
}

.stat-card strong {
  display: block;
  font-size: 17px;
  line-height: 1.25;
  word-break: break-word;
}

.glass-card {
  margin: 0 4px 16px;
  padding: 18px;
  border-radius: 28px;
  backdrop-filter: blur(14px);
}

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

.section-head.compact {
  align-items: center;
}

.section-head h2,
.page-head h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.14;
}

.page-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 4px 4px 16px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink-strong);
  font-size: 28px;
  box-shadow: var(--shadow-sm);
}

.path-caption {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
}

.info-list {
  display: grid;
  gap: 14px;
}

.info-list span,
.license-status span,
.code-list p,
.form-label {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
  margin-bottom: 6px;
}

.info-list strong {
  display: block;
  line-height: 1.6;
  word-break: break-all;
}

.muted-copy,
.meta-line,
.path-line,
.history-card p,
.feedback-log,
.guide-card p,
.license-status p {
  margin: 8px 0 0;
  color: var(--ink-body);
  font-size: 13px;
  line-height: 1.65;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.mini-download-btn,
.download-btn {
  min-height: 46px;
  border-radius: 16px;
  font-weight: 700;
}

.primary-btn,
.download-btn,
.mini-download-btn {
  color: #ffffff;
  background: linear-gradient(180deg, #9f74de 0%, #7b53bd 100%);
  box-shadow: 0 12px 22px rgba(117, 72, 176, 0.2);
}

.secondary-btn,
.ghost-btn {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.secondary-btn {
  width: 100%;
  margin-top: 14px;
}

.ghost-btn {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(123, 88, 178, 0.1);
}

.link-btn,
.text-action {
  padding: 0;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 700;
}

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

.code-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.field-block {
  display: block;
}

.code-prefix-field {
  grid-column: 1 / -1;
}

.search-row input,
.text-field,
.textarea-field {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(141, 99, 206, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink-strong);
  padding: 14px 16px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
}

.search-row input:focus,
.text-field:focus,
.textarea-field:focus {
  border-color: rgba(123, 75, 180, 0.42);
}

.helper-strip {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--ink-soft);
  font-size: 12px;
}

.search-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.search-pager span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.category-chip {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f6edff 0%, #f2e8ff 100%);
  color: var(--accent-strong);
  font-weight: 700;
  border: 1px solid rgba(134, 98, 189, 0.08);
}

.menu-list {
  display: grid;
  gap: 14px;
  margin: 0 4px;
}

.menu-item {
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border-radius: 26px;
  text-align: left;
}

.menu-item strong {
  display: block;
  font-size: 16px;
}

.menu-item small {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12px;
}

.menu-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 18px;
  font-weight: 800;
}

.inner-page {
  min-height: 760px;
  margin-top: 4px;
  padding: 10px 2px 0;
  border-radius: 34px;
  background: var(--bg-gradient);
}

.breadcrumb-row {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  margin-bottom: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.breadcrumb-row::-webkit-scrollbar {
  display: none;
}

.breadcrumb-btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink-body);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--line);
}

.breadcrumb-btn.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

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

.folder-card {
  width: 100%;
  padding: 16px 16px 14px;
  border-radius: 22px;
  text-align: left;
  position: relative;
  z-index: 1;
  touch-action: manipulation;
  background:
    radial-gradient(circle at top right, rgba(255, 241, 222, 0.8) 0, transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(249, 243, 255, 0.96) 100%);
}

.folder-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.folder-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff4e3 0%, #ffeccc 100%);
  border: 1px solid var(--warm-line);
  color: #c5842c;
  font-weight: 800;
}

.folder-arrow {
  color: var(--ink-soft);
  font-size: 24px;
}

.folder-card strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.folder-card small {
  display: block;
  margin-top: 8px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.subsection-head {
  margin: 18px 0 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.subsection-head strong {
  font-size: 15px;
}

.subsection-head span {
  color: var(--ink-soft);
  font-size: 12px;
}

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

.inline-file-card,
.result-card {
  display: flex;
  gap: 12px;
  padding: 15px;
  border-radius: 24px;
}

.inline-file-main,
.result-main {
  min-width: 0;
  flex: 1;
}

.inline-file-card strong,
.result-main h4,
.history-card strong {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
  word-break: break-word;
}

.mini-download-btn {
  min-width: 72px;
  padding: 0 16px;
  align-self: center;
  border-radius: 14px;
}

.file-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(180deg, #f3ebff 0%, #ebddff 100%);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.path-line {
  word-break: break-all;
  color: var(--ink-soft);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.tag-row span,
.demo-codes span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.download-btn {
  width: 100%;
}

.empty-state {
  padding: 24px 18px;
  border-radius: 24px;
  text-align: center;
  color: var(--ink-body);
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(141, 99, 206, 0.16);
}

.license-panel,
.feedback-card {
  padding: 18px;
}

.license-status {
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, #f7f0ff 0%, #ffffff 100%);
}

.license-status strong {
  display: block;
  font-size: 28px;
}

.code-list {
  margin: 18px 0;
}

.demo-codes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.feedback-log {
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: var(--accent-soft-2);
}

.history-card {
  padding: 16px 18px;
  border-radius: 24px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.history-card span {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}

.guide-card div {
  padding: 18px;
  border-radius: 22px;
}

.guide-card strong {
  display: block;
  margin-bottom: 8px;
}

.bottom-nav {
  position: absolute;
  inset: auto 14px 14px;
  min-height: 68px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 34px rgba(93, 54, 143, 0.12);
  backdrop-filter: blur(18px);
}

.nav-item {
  border-radius: 16px;
  background: transparent;
  color: var(--ink-body);
  font-weight: 700;
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(16px);
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(46, 26, 72, 0.92);
  color: #ffffff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  z-index: 50;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast[data-type="success"] {
  background: rgba(36, 127, 88, 0.95);
}

.toast[data-type="error"] {
  background: rgba(164, 51, 86, 0.96);
}

.primary-btn:disabled,
.secondary-btn:disabled,
.ghost-btn:disabled,
.mini-download-btn:disabled {
  opacity: 0.66;
  cursor: wait;
}

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

.summary-card {
  padding: 16px 12px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 239, 255, 0.98) 100%);
  border: 1px solid rgba(117, 83, 171, 0.08);
  text-align: center;
}

.summary-card span {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
  margin-bottom: 8px;
}

.summary-card strong {
  display: block;
  font-size: 20px;
}

.code-list-stack {
  display: grid;
  gap: 12px;
}

.code-card {
  padding: 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(249, 244, 255, 0.96) 100%);
  border: 1px solid rgba(117, 83, 171, 0.08);
  box-shadow: var(--shadow-sm);
}

.code-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.code-value {
  font-size: 18px;
  line-height: 1.35;
  word-break: break-all;
}

.code-badge {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
}

.code-badge.unused {
  background: #eaf8f0;
  color: var(--success);
}

.code-badge.used {
  background: #fdebf0;
  color: var(--danger);
}

.code-action-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.code-copy-btn {
  min-width: 84px;
}

@media (max-width: 640px) {
  body {
    background: linear-gradient(180deg, #f9f3ff 0%, #fffaf4 100%);
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .phone-stage {
    width: 100%;
  }

  .phone-frame {
    width: 100%;
    min-height: 100vh;
    padding: 12px 12px calc(18px + env(safe-area-inset-bottom));
    border-radius: 0;
    box-shadow: none;
    border: 0;
    background: transparent;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 12;
    padding-top: env(safe-area-inset-top);
    background: linear-gradient(180deg, rgba(249, 243, 255, 0.98) 0%, rgba(249, 243, 255, 0.72) 100%);
    backdrop-filter: blur(10px);
  }

  .screen {
    min-height: auto;
    padding: 4px 0 100px;
  }

  .screen-bg {
    inset: 0 0 86px;
    border-radius: 30px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stat-card {
    padding: 14px 10px;
  }

  .stat-card strong {
    font-size: 15px;
  }

  .search-row {
    grid-template-columns: 1fr;
  }

  .code-form-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

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

  .section-head {
    align-items: center;
  }

  .inline-file-card,
  .result-card,
  .history-card {
    flex-direction: column;
  }

  .mini-download-btn {
    width: 100%;
  }
}
