/* ============================================================
   GitHub 加速链接生成工具 —— GitHub 风格浅色主题
   设计语言借鉴 shadcn/ui（new-york-v4）组件规范转译，
   配色与 gh-proxy.com 桌面版一致，零外部依赖。
   ============================================================ */
@import url('https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css');

:root {
  /* shadcn 风格设计令牌（GitHub 浅色主题取值） */
  --background: #F6F8FA;
  --foreground: #1F2328;
  --card: #FFFFFF;
  --card-foreground: #1F2328;
  --primary: #1F6FEB;
  --primary-hover: #0969DA;
  --primary-foreground: #FFFFFF;
  --muted: #F6F8FA;
  --muted-foreground: #59636E;
  --accent: #DDF4FF;
  --accent-foreground: #0969DA;
  --border: #D1D9E0;
  --input: #D1D9E0;
  --ring: #1F6FEB;
  --danger: #CF222E;
  --success: #1A7F37;
  --radius: 0.625rem;            /* 10px */
  --radius-sm: 0.5rem;           /* 8px  */
  --shadow-sm: 0 1px 2px rgba(31, 35, 40, 0.04), 0 1px 3px rgba(31, 35, 40, 0.06);
  --shadow-md: 0 2px 4px rgba(31, 35, 40, 0.05), 0 8px 24px rgba(31, 35, 40, 0.08);
  --shadow-lg: 0 4px 8px rgba(31, 35, 40, 0.06), 0 16px 40px rgba(31, 35, 40, 0.10);
  --ring-width: 3px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  font-family: 'PingFang SC', 'Microsoft YaHei UI', -apple-system, 'Segoe UI', sans-serif;
  background:
    radial-gradient(1200px 400px at 20% -10%, rgba(31, 111, 235, 0.06), transparent 60%),
    var(--background);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ===== 页面主体：标题区 + 两张卡片 ===== */
.page {
  flex: 1;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 36px 24px 44px;
}

/* ===== 顶部标题区 ===== */
.hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
}

.hero-icon {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: calc(var(--radius) + 4px);
  background: linear-gradient(135deg, #1F6FEB 0%, #0969DA 60%, #0550AE 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(31, 111, 235, 0.30);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease;
}

.hero:hover .hero-icon {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 24px rgba(31, 111, 235, 0.38);
}

.hero h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #1F2328 30%, #0969DA 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero .subtitle {
  font-size: 13px;
  color: var(--muted-foreground);
  margin-top: 3px;
}

/* ===== 卡片通用（shadcn Card 规范） ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 22px;
  margin-bottom: 16px;
  transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: #C3CBD4;
  transform: translateY(-2px);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.card-head h2 {
  font-size: 15px;
  font-weight: 600;
}

/* ===== 徽章（shadcn Badge subtle 变体） ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  color: var(--primary);
  background: rgba(31, 111, 235, 0.10);
  border: 1px solid rgba(31, 111, 235, 0.22);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* ===== 输入卡片 ===== */
.input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

#urlInput {
  flex: 1;
  min-width: 200px;
  height: 40px;
  padding: 0 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--foreground);
  background: #fff;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  outline: none;
  box-shadow: 0 1px 2px rgba(31, 35, 40, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#urlInput::placeholder {
  color: #8C959F;
}

#urlInput:focus-visible {
  border-color: var(--ring);
  box-shadow: 0 0 0 var(--ring-width) rgba(31, 111, 235, 0.18);
}

#modeSelect {
  height: 40px;
  min-width: 150px;
  padding: 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--foreground);
  background: #fff;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(31, 35, 40, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#modeSelect:focus-visible {
  border-color: var(--ring);
  box-shadow: 0 0 0 var(--ring-width) rgba(31, 111, 235, 0.18);
}

/* ===== 按钮（shadcn Button 规范） ===== */
#convertBtn {
  height: 40px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  color: var(--primary-foreground);
  background: linear-gradient(135deg, #1F6FEB 0%, #0969DA 100%);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 2px 6px rgba(31, 111, 235, 0.30);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

#convertBtn:hover {
  background: linear-gradient(135deg, #0969DA 0%, #0550AE 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 4px 12px rgba(31, 111, 235, 0.38);
}

#convertBtn:active {
  transform: scale(0.96) translateY(1px);
}

#convertBtn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 var(--ring-width) rgba(31, 111, 235, 0.35), 0 2px 8px rgba(31, 111, 235, 0.30);
}

/* 输入区底部提示 */
.input-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted-foreground);
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
  font-size: 11px;
  text-align: center;
  color: var(--foreground);
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  line-height: 1.5;
}

/* ===== 结果卡片 ===== */
.result-card {
  display: flex;
  flex-direction: column;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted-foreground);
  background: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

thead th:first-child {
  width: 220px;
  min-width: 180px;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid #EAEEF2;
  vertical-align: middle;
  word-break: break-all;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  cursor: pointer;
  transition: background 0.12s ease;
}

tbody tr:hover {
  background: var(--muted);
}

td.node-action {
  width: 80px;
  text-align: center;
  white-space: nowrap;
}

.node-name {
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
}

.node-link {
  font-family: 'SF Mono', 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  color: var(--primary);
}

.result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  min-height: 32px;
}

.tip {
  font-size: 12.5px;
  color: var(--muted-foreground);
}

/* ===== 行内复制按钮（shadcn Button outline 变体） ===== */
.row-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: 26px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--foreground);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.row-copy-btn:hover {
  background: var(--muted);
  border-color: #B6BEC8;
}

.row-copy-btn:active {
  transform: scale(0.95);
}

.row-copy-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 var(--ring-width) rgba(31, 111, 235, 0.18);
}

.row-copy-btn.copied {
  color: var(--success);
  border-color: rgba(26, 127, 55, 0.35);
  background: rgba(26, 127, 55, 0.06);
}

.hidden {
  display: none !important;
}

/* ===== 状态栏 ===== */
.statusbar {
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  padding: 11px 24px;
  font-size: 13px;
  color: var(--muted-foreground);
  background: rgba(246, 248, 250, 0.92);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
  text-align: center;
  transition: color 0.2s ease;
}

.statusbar.error {
  color: var(--danger);
  font-weight: 500;
}

.statusbar.success {
  color: var(--success);
  font-weight: 500;
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .page {
    padding: 22px 14px 30px;
  }

  .hero h1 {
    font-size: 20px;
  }

  .input-row {
    flex-wrap: wrap;
  }

  #urlInput {
    min-width: 100%;
  }

  #modeSelect {
    flex: 1;
    min-width: 0;
  }

  thead th:first-child {
    width: 130px;
    min-width: 110px;
  }
}
