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

:root {
  --bg: #f0f4fa;
  --surface: #ffffff;
  --text: #0f1a2e;
  --muted: #6d7d93;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --warn-bg: #fffbeb;
  --warn-text: #b45309;
  --radius: 14px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

body::before {
  content: '';
  flex-shrink: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #2563eb, #1d4ed8);
}

.shell {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: calc(10px + var(--safe-top)) 16px calc(8px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

/* 顶栏 */
.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.1);
}

.topbar-text h1 {
  font-size: clamp(18px, 4.5vw, 22px);
  font-weight: 700;
  line-height: 1.2;
}

.topbar-text p {
  margin-top: 1px;
  font-size: 12px;
  color: var(--muted);
}

/* 状态区 — 占据中间弹性空间 */
.status {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.status-icon {
  width: clamp(48px, 12vw, 64px);
  height: clamp(48px, 12vw, 64px);
  margin-bottom: 10px;
  color: var(--primary);
  flex-shrink: 0;
}

.status-icon svg {
  width: 100%;
  height: 100%;
}

.status-arc {
  transform-origin: 24px 24px;
  animation: arc-spin 1.2s linear infinite;
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.status-title {
  font-size: clamp(17px, 4.5vw, 20px);
  font-weight: 700;
  line-height: 1.25;
  flex-shrink: 0;
}

.status-desc {
  margin-top: 5px;
  font-size: clamp(12px, 3.2vw, 13px);
  line-height: 1.5;
  color: var(--muted);
  max-width: 280px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

body.mode-inapp .status { border-color: #fde68a; }
body.mode-inapp .status-badge { background: var(--warn-bg); color: var(--warn-text); }
body.mode-inapp .status-icon { color: #d97706; }

/* 操作区 */
.block {
  flex-shrink: 0;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 12px 14px;
}

.block[hidden] { display: none; }

.block-label {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  text-align: center;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.block-label:empty { display: none; }

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.block-head-title {
  font-size: 13px;
  font-weight: 600;
}

.block-head-tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 500;
}

.btn {
  border: 0;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.btn:active { opacity: 0.82; }
.btn[hidden] { display: none; }

.btn-lg {
  width: 100%;
  padding: 13px;
  font-size: 15px;
}

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

.btn-soft {
  flex: 1;
  padding: 11px 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
}

.btn-ghost {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}

.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.warn-tip {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.warn-tip[hidden] { display: none; }

/* 复制区 */
.copy-block {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #f8fbff 0%, var(--surface) 100%);
}

.copy-block[hidden] { display: none; }

.copy-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.copy-url {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  font-size: 12px;
  line-height: 1.3;
  color: var(--primary);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.copy-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 56px;
  padding: 6px 8px;
  border: 0;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
}

.copy-action svg {
  width: 16px;
  height: 16px;
}

.copy-action.copied { background: #16a34a; }

.copy-hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.footer {
  flex-shrink: 0;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  padding: 2px 0;
}

.empty-tip {
  flex-shrink: 0;
  text-align: center;
  font-size: 13px;
  color: #dc2626;
}

/* 弹层 */
.inapp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: calc(12px + var(--safe-top)) 16px calc(12px + var(--safe-bottom));
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
}

.inapp-overlay.show { display: flex; }

.overlay-arrow {
  position: fixed;
  top: calc(8px + var(--safe-top));
  right: 20px;
  font-size: 34px;
  color: #fff;
  line-height: 1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.overlay-arrow[hidden] { display: none; }

.overlay-sheet {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 18px;
  padding: 22px 18px 14px;
}

.overlay-sheet h2 {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.overlay-sheet p {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}

.overlay-sheet .btn-fill {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
}

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

/* 矮屏适配 */
@media (max-height: 700px) {
  .shell { gap: 8px; padding-top: calc(6px + var(--safe-top)); }
  .status { padding: 8px 12px; }
  .status-icon { width: 44px; height: 44px; margin-bottom: 6px; }
  .block { padding: 10px 12px; }
  .btn-lg { padding: 11px; font-size: 14px; }
  .copy-hint { display: none; }
  .footer { font-size: 10px; }
}

@media (max-height: 580px) {
  .topbar-text p { display: none; }
  .status-desc { -webkit-line-clamp: 1; }
  .block-label { -webkit-line-clamp: 1; margin-bottom: 6px; }
  .warn-tip { -webkit-line-clamp: 1; }
}
