/* ============================================
   短链接生成器 - 黑白简约风格
   ============================================ */

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

:root {
  --bg: #ffffff;
  --bg-card: #fafafa;
  --text: #0a0a0a;
  --text-secondary: #6b6b6b;
  --text-muted: #9e9e9e;
  --border: #e5e5e5;
  --border-focus: #0a0a0a;
  --accent: #0a0a0a;
  --accent-hover: #2a2a2a;
  --error: #d32f2f;
  --error-bg: #fef2f2;
  --success-bg: #f0fdf4;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 背景网格纹理 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: -1;
}

.container {
  width: 100%;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
}

/* ===== 头部 ===== */
.header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
}

.logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ===== 主卡片 ===== */
.main-card {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: box-shadow var(--transition);
}

.main-card:hover {
  box-shadow: var(--shadow-lg);
}

/* ===== 输入框 ===== */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.url-input {
  width: 100%;
  padding: 14px 18px;
  font-size: 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: all var(--transition);
  font-family: inherit;
}

.url-input::placeholder {
  color: var(--text-muted);
}

.url-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.custom-row {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
  transition: all var(--transition);
}

.custom-row:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.custom-prefix {
  padding: 14px 0 14px 18px;
  font-size: 14px;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
}

.custom-input {
  flex: 1;
  padding: 14px 18px 14px 4px;
  font-size: 14px;
  border: none;
  background: transparent;
  color: var(--text);
  outline: none;
  font-family: inherit;
}

.custom-input::placeholder {
  color: var(--text-muted);
}

/* ===== 按钮 ===== */
.shorten-btn {
  width: 100%;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.3px;
}

.shorten-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.shorten-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.shorten-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-loader svg {
  animation: spin 0.8s linear infinite;
}

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

/* ===== 错误提示 ===== */
.error-msg {
  padding: 12px 16px;
  background: var(--error-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 14px;
  animation: fadeIn 0.3s ease;
}

/* ===== 结果卡片 ===== */
.result-card {
  padding: 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: fadeIn 0.4s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.result-url-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-url {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
  transition: opacity var(--transition);
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  padding: 8px 0;
}

.result-url:hover {
  opacity: 0.7;
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
}

.copy-btn:hover {
  background: #f0f0f0;
  border-color: #ccc;
}

.copy-btn.copied {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

.result-original {
  font-size: 13px;
  color: var(--text-muted);
  word-break: break-all;
  line-height: 1.5;
}

.result-original span {
  color: var(--text-secondary);
}

/* ===== 页脚 ===== */
.footer {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* ===== 动画 ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  .main-card {
    padding: 24px 20px;
  }

  .url-input {
    font-size: 14px;
    padding: 12px 14px;
  }

  .result-url-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .copy-btn {
    width: 100%;
    justify-content: center;
  }
}