/* 公共样式 - 在线工具集 */
:root {
  --bg: #f5f5f5;
  --surface: #fff;
  --text: #1a1a1a;
  --text-muted: #666;
  --border: #e0e0e0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* 头部 */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}

.logo:hover {
  color: var(--accent);
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 1rem;
}

.nav a:hover {
  color: var(--accent);
}

/* 主内容 */
.site-main {
  flex: 1;
  padding: 2rem 0;
}

.site-main h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
}

.lead {
  margin: 0 0 2rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* 分类与工具列表 */
.tool-category {
  margin-bottom: 2rem;
}

.tool-category h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 600;
}

.tool-list {
  list-style: none;
  padding: 0;
  margin: 0;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.tool-list li {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.tool-list li:last-child {
  border-bottom: none;
}

.tool-list a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.tool-list a:hover {
  text-decoration: underline;
}

.tool-list .placeholder {
  color: var(--text-muted);
}

/* 工具页通用 */
.tool-page h1 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
}

.tool-page .back {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.tool-page .back:hover {
  color: var(--accent);
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.tool-card h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
  width: 100%;
  max-width: 400px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
}

.form-group input[type="file"] {
  padding: 0.35rem 0;
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

.w-full {
  max-width: 100% !important;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 120px;
}

/* 按钮 */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  background: var(--accent);
  color: #fff;
}

.btn:hover {
  background: var(--accent-hover);
}

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

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg);
}

/* 预览与结果区 */
.preview-box {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-box img {
  max-width: 100%;
  max-height: 320px;
  display: block;
}

.preview-box canvas {
  max-width: 100%;
  display: block;
}

/* 预览区 - 固定高度 + 滚动条，图片保持原始尺寸 */
.preview-box--scroll {
  height: 320px;
  overflow: auto;
}

.preview-box--scroll img {
  max-width: none;
  max-height: none;
}

.preview-placeholder {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* 页脚 */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  margin-top: auto;
}

.site-footer p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
