:root {
  --bg: #eef2f7;
  --card: #fff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #d8dee8;
  --border-focus: #3b82f6;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;
  --radius: 14px;
  --radius-sm: 12px;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  --touch: 52px;
  --font-input: 17px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0));
}

.header {
  margin-bottom: 18px;
}

.title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  color: #0f172a;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 18px;
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field:last-of-type {
  margin-bottom: 0;
}

.label {
  display: block;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 600;
  color: #334155;
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "";
  position: absolute;
  right: 18px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -7px;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: rotate(45deg);
  pointer-events: none;
}

.select {
  width: 100%;
  min-height: var(--touch);
  padding: 14px 44px 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--font-input);
  line-height: 1.35;
  background: #fff;
  color: var(--text);
  appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.select:disabled {
  background-color: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
}

.load-hint {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: #fef2f2;
  border: 1px solid #fecaca;
  text-align: center;
}

.load-hint-text {
  margin: 0;
  font-size: 14px;
  color: #b91c1c;
  line-height: 1.55;
}

.result {
  margin-top: 20px;
  padding: 18px 16px;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
}

.result-scope {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
}

.result-label {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.result-code {
  margin: 10px 0 10px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  word-break: break-all;
  line-height: 1.2;
  cursor: pointer;
}

.result-path {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.55;
}

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  display: block;
  width: 100%;
  min-height: var(--touch);
  margin: 0;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  transition: background-color 0.15s ease, opacity 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  border: none;
  background: var(--primary);
  color: #fff;
}

.btn-primary:active {
  background: var(--primary-hover);
  opacity: 0.95;
}

.btn-secondary {
  border: 1.5px solid var(--primary);
  background: #fff;
  color: var(--primary);
}

.btn-secondary:active {
  background: var(--primary-soft);
}

.btn-muted {
  border: none;
  background: #f1f5f9;
  color: #334155;
  min-height: 46px;
}

.btn-muted:active {
  background: #e2e8f0;
}

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0));
}

.share-modal[hidden] {
  display: none !important;
}

.share-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.share-modal-panel {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 20px 18px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  text-align: center;
}

.share-modal-title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.share-modal-scope {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
}

.share-qr-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--border);
}

.share-qr-wrap img,
.share-qr-wrap canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.share-qr-error {
  margin: 0;
  padding: 16px;
  font-size: 14px;
  color: #b91c1c;
  line-height: 1.5;
}

.share-modal-code {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  color: var(--primary);
  word-break: break-all;
}

.share-modal-tip {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.footer {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

@media (max-width: 380px) {
  .result-code {
    font-size: 30px;
    letter-spacing: 1px;
  }
}
