:root {
  color-scheme: light;
  --text: #121417;
  --text-strong: #050505;
  --muted: rgba(18, 20, 23, 0.62);
  --muted-2: rgba(18, 20, 23, 0.44);
  --surface: rgba(255, 255, 255, 0.7);
  --surface-strong: rgba(255, 255, 255, 0.9);
  --surface-soft: rgba(255, 255, 255, 0.42);
  --line: rgba(20, 20, 20, 0.1);
  --line-strong: rgba(20, 20, 20, 0.16);
  --primary: #007aff;
  --primary-2: #5856d6;
  --primary-3: #af52de;
  --ok: #30d158;
  --danger: #ff3b30;
  --shadow: 0 26px 80px rgba(17, 24, 39, 0.16);
  --shadow-soft: 0 14px 38px rgba(17, 24, 39, 0.1);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --blur: blur(26px) saturate(1.45);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --text: rgba(255, 255, 255, 0.9);
  --text-strong: #ffffff;
  --muted: rgba(255, 255, 255, 0.64);
  --muted-2: rgba(255, 255, 255, 0.46);
  --surface: rgba(28, 28, 30, 0.62);
  --surface-strong: rgba(38, 38, 42, 0.82);
  --surface-soft: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 16px 44px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  background:
    radial-gradient(circle at 18% 12%, rgba(0, 122, 255, 0.18), transparent 34%),
    radial-gradient(circle at 84% 10%, rgba(175, 82, 222, 0.2), transparent 30%),
    linear-gradient(135deg, #f5f7fb 0%, #edf2ff 44%, #f8f1ff 100%);
  overflow-x: hidden;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 16% 10%, rgba(10, 132, 255, 0.22), transparent 32%),
    radial-gradient(circle at 82% 12%, rgba(191, 90, 242, 0.22), transparent 28%),
    linear-gradient(135deg, #050507 0%, #111827 55%, #17111f 100%);
}

button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.page-bg {
  position: fixed;
  inset: -32px;
  background: url("./bg.png") center center / contain no-repeat;
  filter: blur(8px) saturate(1.15);
  transform: scale(1);
  z-index: -3;
}

html[data-theme="dark"] .page-bg { opacity: 0.28; }

.page-mask {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.65), rgba(255,255,255,0.18)),
    radial-gradient(circle at 50% 0%, rgba(255,255,255,0.76), transparent 46%);
  pointer-events: none;
}

html[data-theme="dark"] .page-mask {
  background:
    linear-gradient(180deg, rgba(0,0,0,0.34), rgba(0,0,0,0.68)),
    radial-gradient(circle at 50% 0%, rgba(255,255,255,0.1), transparent 46%);
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  width: min(1180px, calc(100% - 32px));
  margin: 14px auto 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: var(--text-strong);
  text-decoration: none;
  font-weight: 860;
  letter-spacing: -0.04em;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  object-fit: cover;
  box-shadow: 0 8px 20px rgba(0, 122, 255, 0.22);
}

.brand-text { font-size: 18px; }
.brand-text span { color: var(--primary); }

.nav-tabs,
.inside-switch {
  display: inline-flex;
  align-items: center;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.12);
}

.nav-tab,
.inside-tab {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 780;
  transition: color .2s ease, background .2s ease, box-shadow .2s ease, transform .2s ease;
}

.nav-tab:hover,
.inside-tab:hover { color: var(--text); }

.nav-tab.active,
.inside-tab.active {
  color: var(--text-strong);
  background: var(--surface-strong);
  box-shadow: 0 10px 28px rgba(0,0,0,0.08);
}

.top-actions {
  display: inline-flex;
  justify-content: flex-end;
  gap: 8px;
}

.chip-btn {
  min-width: 44px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-strong);
  background: var(--surface-soft);
  cursor: pointer;
  font-weight: 820;
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
}

.chip-btn:hover {
  transform: translateY(-1px);
  background: var(--surface-strong);
  border-color: var(--line-strong);
}

.icon-btn { font-size: 17px; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 52px;
}

.hero {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: 18px 0 24px;
}

.eyebrow,
.card-kicker {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  box-shadow: 0 12px 30px rgba(0, 122, 255, 0.08);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.hero-title {
  display: block;
  width: 100%;
  max-width: 1120px;
  min-height: 1.12em;
  margin: 12px auto 10px;
  color: var(--text-strong);
  font-size: clamp(30px, 4.1vw, 54px);
  font-weight: 950;
  line-height: 1.08;
  letter-spacing: -0.065em;
  text-align: center;
  white-space: nowrap;
}

#typewriterText {
  background: linear-gradient(115deg, var(--text-strong) 0%, var(--primary) 42%, var(--primary-2) 72%, var(--text-strong) 100%);
  background-size: 180% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: titleShine 6s ease-in-out infinite;
}

.type-cursor {
  display: inline-block;
  width: 0.075em;
  height: 0.86em;
  margin-left: 0.07em;
  border-radius: 999px;
  background: var(--text-strong);
  transform: translateY(0.1em);
  animation: cursorBlink .86s steps(1) infinite;
}

.subtitle {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(18px, 1.8vw, 23px);
  line-height: 1.48;
  font-weight: 620;
  letter-spacing: -0.025em;
  text-align: center;
  white-space: nowrap;
}

.hero-chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
}

.hero-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-soft);
  font-size: 13px;
  font-weight: 760;
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

@keyframes cursorBlink {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0; }
}

@keyframes titleShine {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(350px, 420px);
  align-items: stretch;
  gap: 22px;
}

.glass-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  overflow: hidden;
}

.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.44), transparent 34%);
  pointer-events: none;
}

html[data-theme="dark"] .glass-card::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.1), transparent 42%);
}

.input-card,
.output-card {
  padding: 24px;
}

.card-topline,
.output-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.card-topline h2,
#accountName {
  margin: 4px 0 0;
  color: var(--text-strong);
  font-size: 23px;
  line-height: 1.18;
  font-weight: 900;
  letter-spacing: -0.045em;
}

.tab-panel {
  position: relative;
  z-index: 1;
  display: none;
  margin-top: 18px;
}

.tab-panel.active {
  display: block;
  animation: softIn .24s ease both;
}

@keyframes softIn {
  from { opacity: 0; transform: translateY(6px) scale(.994); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

form { position: relative; z-index: 1; }

label {
  display: block;
  margin: 12px 0 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 840;
}

textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text-strong);
  background: rgba(255,255,255,0.5);
  outline: none;
  transition: border .18s ease, box-shadow .18s ease, background .18s ease, transform .18s ease;
}

html[data-theme="dark"] textarea,
html[data-theme="dark"] input,
html[data-theme="dark"] select {
  background: rgba(255,255,255,0.08);
}

textarea {
  min-height: 112px;
  padding: 15px 16px;
  resize: vertical;
  line-height: 1.66;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

input, select { height: 48px; padding: 0 14px; }

textarea::placeholder, input::placeholder { color: var(--muted-2); }

textarea:focus, input:focus, select:focus {
  border-color: rgba(0,122,255,.55);
  box-shadow: 0 0 0 5px rgba(0,122,255,.12);
  background: var(--surface-strong);
}

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

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.primary-btn, .secondary-btn {
  position: relative;
  border: 0;
  border-radius: 999px;
  min-height: 46px;
  padding: 0 19px;
  cursor: pointer;
  font-weight: 900;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease, background .18s ease;
}

.primary-btn {
  color: white;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 16px 30px rgba(0, 122, 255, 0.25);
}

.secondary-btn {
  color: var(--text-strong);
  background: rgba(120, 120, 128, 0.14);
  border: 1px solid var(--line);
}

.primary-btn:hover, .secondary-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.1);
}

.primary-btn:active, .secondary-btn:active { transform: translateY(0); }

.primary-btn:disabled, .secondary-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.drop-zone {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 224px;
  margin: 0;
  padding: 28px;
  text-align: center;
  border: 1.5px dashed rgba(0, 122, 255, 0.35);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 122, 255, 0.14), transparent 42%),
    rgba(255,255,255,0.34);
  cursor: pointer;
  transition: transform .18s ease, border .18s ease, background .18s ease;
}

html[data-theme="dark"] .drop-zone {
  background:
    radial-gradient(circle at 50% 0%, rgba(10, 132, 255, 0.18), transparent 42%),
    rgba(255,255,255,0.06);
}

.drop-zone.dragover {
  transform: translateY(-2px) scale(1.006);
  border-color: var(--primary);
  background: rgba(0, 122, 255, 0.1);
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 12px;
  color: white;
  border-radius: 22px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 18px 34px rgba(0, 122, 255, 0.25);
  font-size: 32px;
  line-height: 1;
}

.drop-zone strong {
  color: var(--text-strong);
  font-size: 18px;
}

.drop-zone small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.qr-result {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(120, 120, 128, 0.12);
  color: var(--muted);
  line-height: 1.65;
  word-break: break-all;
}

.output-card {
  display: flex;
  flex-direction: column;
}

.time-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-strong);
  background: var(--surface-strong);
  font-weight: 950;
  box-shadow: 0 14px 28px rgba(0,0,0,.08);
}

.code-box {
  position: relative;
  z-index: 1;
  margin: 20px 0 15px;
  padding: 30px 16px 32px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 30px;
  background:
    radial-gradient(circle at 30% 0%, rgba(255,255,255,0.22), transparent 38%),
    linear-gradient(135deg, #0a84ff, #5856d6 54%, #af52de);
  color: white;
  text-align: center;
  font-size: clamp(44px, 6.6vw, 74px);
  font-weight: 950;
  line-height: 1;
  letter-spacing: .075em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 14px 34px rgba(0,0,0,.25);
  box-shadow: 0 24px 56px rgba(0, 122, 255, .22);
}

.progress {
  position: relative;
  z-index: 1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(120, 120, 128, 0.16);
}

.progress span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  transition: width .35s linear;
}

.mini-meta {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 13px;
}

.mini-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(120, 120, 128, 0.12);
  font-size: 12px;
  font-weight: 780;
}

.output-actions { margin-top: 18px; }
.output-actions .primary-btn,
.output-actions .copy-only { flex: 1 1 100%; width: 100%; }

.status {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: var(--radius-md);
  color: var(--muted);
  background: rgba(120, 120, 128, 0.12);
  line-height: 1.62;
}

.status[hidden] { display: none; }

.status.ok {
  color: #0b7a32;
  background: rgba(48, 209, 88, 0.14);
}

html[data-theme="dark"] .status.ok { color: #68e486; }

.status.error {
  color: #b42318;
  background: rgba(255, 59, 48, 0.12);
}

html[data-theme="dark"] .status.error { color: #ff8a83; }

.security-note {
  width: min(920px, 100%);
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr auto;
    border-radius: 28px;
  }

  .brand { grid-column: 1; }
  .top-actions { grid-column: 2; grid-row: 1; }
  .nav-tabs {
    grid-column: 1 / -1;
    justify-self: stretch;
  }
  .nav-tab { flex: 1; }

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

  .subtitle {
    white-space: normal;
    max-width: 760px;
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 22px, 1180px);
    padding-top: 20px;
  }

  .topbar {
    width: min(100% - 22px, 1180px);
    top: 10px;
    margin-top: 10px;
  }

  .brand-text { font-size: 16px; }
  .brand-logo { width: 34px; height: 34px; border-radius: 12px; }
  .chip-btn { min-width: 40px; height: 38px; }

  .hero {
    padding: 12px 0 18px;
  }

  .hero-title {
    font-size: clamp(16px, 5.2vw, 30px);
    letter-spacing: -0.055em;
  }

  .subtitle {
    font-size: 16px;
    line-height: 1.58;
  }

  .hero-chips { margin-top: 12px; }

  .input-card,
  .output-card {
    padding: 18px;
    border-radius: 26px;
  }

  .card-topline,
  .output-head {
    flex-direction: column;
    gap: 14px;
  }

  .inside-switch { width: 100%; }
  .inside-tab { flex: 1; padding-inline: 12px; }

  .settings-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  textarea { min-height: 122px; }

  .code-box {
    font-size: clamp(40px, 13vw, 64px);
    border-radius: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}
