:root {
  --bg: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f6f9fe;
  --text: #12203a;
  --muted: #5d7089;
  --line: #e2e9f4;
  --line-strong: #d3deed;
  --brand: #2563eb;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(920px 520px at 8% -10%, rgba(37, 99, 235, 0.11), transparent 62%),
    radial-gradient(720px 460px at 102% 0%, rgba(14, 159, 110, 0.07), transparent 58%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 26%, transparent 76%);
  mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 26%, transparent 76%);
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 30px 18px calc(38px + env(safe-area-inset-bottom));
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.mark {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font: 700 14px/1 var(--mono);
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(155deg, #4b8bff, #1d4ed8);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 10px 22px -10px rgba(37, 99, 235, 0.65);
}

.brand-text h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #0d1a30;
}

.brand-text p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.appid {
  font: 600 11px/1 var(--mono);
  color: #56708f;
  padding: 7px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 1px 2px rgba(17, 45, 95, 0.05);
  white-space: nowrap;
}

.panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow:
    0 22px 48px -38px rgba(17, 45, 95, 0.5),
    0 1px 2px rgba(17, 45, 95, 0.04);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #5a6f90;
}

.hint {
  font-size: 12px;
  color: #64788f;
}

.fields {
  display: grid;
  gap: 12px;
  margin-top: 13px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #5d7294;
}

input {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  color: #12203a;
  font: 13px/1 var(--mono);
  letter-spacing: 0.02em;
  background: #f8fafd;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input::placeholder {
  color: #8295ae;
}

input:hover {
  border-color: #c2d0e3;
}

input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.warn {
  font-size: 12px;
  color: #b26a05;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: 600 13.5px/1 inherit;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: filter 0.15s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  box-shadow:
    0 10px 20px -12px rgba(37, 99, 235, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn-ghost {
  color: #53688a;
  background: #fff;
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  background: #f3f7fd;
}

.results {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.card {
  position: relative;
  overflow: hidden;
  padding: 15px 15px 15px 17px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 12px 30px -26px rgba(17, 45, 95, 0.55);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--accent);
}

.card[data-ready="true"] {
  border-color: var(--line-hot);
  box-shadow: 0 16px 34px -26px var(--glow);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 9px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 9px;
}

.no {
  padding: 5px 7px;
  color: var(--accent);
  font: 700 11px/1 var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.card-title h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #14233e;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chips code {
  padding: 5px 7px;
  color: #566b8c;
  font: 600 10.5px/1 var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.url {
  margin-top: 11px;
  padding: 11px 12px;
  max-height: 132px;
  overflow: auto;
  color: #243a5e;
  font: 12.5px/1.55 var(--mono);
  word-break: break-all;
  overflow-wrap: anywhere;
  user-select: all;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.url .placeholder {
  color: #8295ae;
}

.card-actions {
  display: flex;
  gap: 9px;
  margin-top: 11px;
}

.btn-copy {
  flex: 1;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 18px -14px var(--glow);
}

.card[data-ready="true"] .btn-copy:hover {
  filter: brightness(0.95);
}

.btn-open {
  flex: none;
  color: #53688a;
  background: #fff;
  border-color: var(--line-strong);
}

.btn-open:hover {
  background: #f3f7fd;
}

.btn-open[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.footer {
  margin-top: 18px;
  color: #5d7089;
  font-size: 12px;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 50;
  padding: 10px 16px;
  color: #fff;
  font-size: 13px;
  background: #12203a;
  border-radius: 999px;
  box-shadow: 0 16px 34px -16px rgba(17, 45, 95, 0.55);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

@media (min-width: 640px) {
  .fields {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 380px) {
  .appid {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
