:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1c1f26;
  --text-muted: #6b7280;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0fe;
  --success: #059669;
  --danger: #dc2626;
  --code-bg: #0f1117;
  --code-text: #e5e7eb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --border: #2a2e38;
    --text: #e8e9ec;
    --text-muted: #9aa0ab;
    --accent: #818cf8;
    --accent-hover: #a5b0fb;
    --accent-soft: #23253a;
    --code-bg: #0b0d12;
    --code-text: #e5e7eb;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "PingFang TC", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand .logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1rem;
}

.main-nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.92rem;
}
.main-nav a { color: var(--text-muted); }
.main-nav a:hover { color: var(--text); text-decoration: none; }

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
}
.page-desc {
  color: var(--text-muted);
  margin: 0 0 1.75rem;
  font-size: 0.98rem;
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.breadcrumb a { color: var(--text-muted); }

/* Article / blog content */
.article-body { max-width: 760px; }
.article-body h2 { font-size: 1.3rem; margin: 2rem 0 0.75rem; }
.article-body h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }
.article-body p { margin: 0 0 1rem; }
.article-body ul, .article-body ol { margin: 0 0 1rem; padding-left: 1.4rem; }
.article-body li { margin-bottom: 0.35rem; }
.article-body a { text-decoration: underline; }
.article-body code {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.88em;
}
.article-body pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 0 0 1.25rem;
}
.article-body pre code { background: none; padding: 0; }
.article-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 0 0 1.25rem;
  padding: 0.25rem 1rem;
  color: var(--text-muted);
}
.article-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 1.75rem;
}

.blog-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.blog-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.blog-list h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.blog-list .article-meta { margin: 0 0 0.4rem; }
.blog-list p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

/* Homepage hero */
.hero {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
}
.hero h1 {
  font-size: 2rem;
  margin: 0 0 0.6rem;
}
.hero p {
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
}

/* Category / tool cards */
.category-block { margin-bottom: 2.25rem; }
.category-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.9rem;
  color: var(--text);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  text-decoration: none;
}
.tool-card .icon { font-size: 1.4rem; }
.tool-card h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}
.tool-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Tool workspace layout */
.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 780px) {
  .workspace { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}
.panel-header .actions { display: flex; gap: 0.4rem; }

textarea, .panel pre, select, input[type="text"], input[type="number"] {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88rem;
}

textarea {
  width: 100%;
  border: none;
  resize: vertical;
  min-height: 320px;
  padding: 0.9rem;
  background: var(--code-bg);
  color: var(--code-text);
  outline: none;
}

.panel pre {
  margin: 0;
  padding: 0.9rem;
  background: var(--code-bg);
  color: var(--code-text);
  min-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  flex: 1;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.dropzone .dropzone-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 7px;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin: 1rem 0;
}
.controls-row label {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
select, input[type="text"], input[type="number"] {
  padding: 0.4rem 0.6rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.status-msg {
  font-size: 0.82rem;
  margin-top: 0.5rem;
  min-height: 1.1em;
}
.status-msg.error { color: var(--danger); }
.status-msg.ok { color: var(--success); }

.info-box {
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 1.75rem;
}
.info-box h4 { margin: 0 0 0.4rem; color: var(--text); font-size: 0.9rem; }

.ad-slot {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
  padding: 0.8rem;
  margin: 1.5rem 0;
}

footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1.75rem 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}
footer a { color: var(--text-muted); }

.converter-simple {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 780px) {
  .converter-simple { grid-template-columns: 1fr; }
}
.swap-btn {
  align-self: center;
  margin-top: 2.2rem;
}

.case-btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
  margin: 1rem 0;
}
.case-btn-grid .btn { text-align: left; padding: 0.55rem 0.75rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem;
  text-align: center;
}
.stat-card .num { font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.stat-card .label { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.15rem; }
