/* Codecdesk — site */
:root {
  --bg: #f0ebe3;
  --bg-2: #e6e0d6;
  --paper: #fffcf7;
  --ink: #1a1f16;
  --muted: #5c6356;
  --line: #d4cdc0;
  --accent: #0f6b5c;
  --accent-ink: #084c41;
  --accent-soft: #d8efe9;
  --warn-bg: #fde8e4;
  --warn: #9b2c1f;
  --ok-bg: #e3f5ea;
  --ok: #1b6b3a;
  --bar: #14201c;
  --bar-ink: #d7e0db;
  --mono: "Cascadia Mono", "Sarasa Mono SC", Consolas, "Courier New", monospace;
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --display: Georgia, "Songti SC", "SimSun", serif;
  --max: 980px;
  --text: 720px;
  --radius: 4px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.65 var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(15, 107, 92, 0.08), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(26, 31, 22, 0.05), transparent 50%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100vh;
}
a { color: var(--accent-ink); }
a:hover { color: var(--accent); }

.wrap { width: min(var(--max), calc(100% - 32px)); margin: 0 auto; }
.wrap--text { width: min(var(--text), calc(100% - 32px)); }

.topbar {
  background: var(--bar);
  color: var(--bar-ink);
  border-bottom: 3px solid var(--accent);
}
.topbar__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 12px 0;
}
.brand {
  color: #fff;
  text-decoration: none;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand small {
  display: block;
  margin-top: 4px;
  font-family: var(--sans);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8fbfb4;
}
.menu { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.menu a {
  color: #9aaaa3;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}
.menu a:hover,
.menu a.is-on { color: #fff; }

.page { padding: 28px 0 56px; }
.page h1 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: clamp(1.85rem, 4vw, 2.45rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.lede {
  margin: 0 0 22px;
  max-width: 40rem;
  color: var(--muted);
  font-size: 1.02rem;
}

.shell {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(26, 31, 22, 0.06);
  position: relative;
  z-index: 1;
  isolation: isolate;
  overflow: hidden;
}
/* 工具工作区不接受广告插入 */
.shell .ad-slot,
.main .ad-slot,
.io .ad-slot {
  display: none !important;
}
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
}

.side {
  background: #f7f3ec;
  border-right: 1px solid var(--line);
  padding: 14px 10px;
}
@media (max-width: 800px) {
  .side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
  }
}
.side__label {
  margin: 12px 8px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.side__label:first-child { margin-top: 0; }
@media (max-width: 800px) {
  .side__label { width: 100%; margin: 0 4px 4px; }
}
.side button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 9px 12px;
  cursor: pointer;
  border-radius: var(--radius);
}
@media (max-width: 800px) {
  .side button {
    width: auto;
    border: 1px solid var(--line);
    background: #fff;
    padding: 7px 11px;
  }
}
.side button:hover { background: rgba(15, 107, 92, 0.08); }
.side button.is-on {
  background: var(--accent);
  color: #fff;
}
@media (max-width: 800px) {
  .side button.is-on { border-color: var(--accent); }
}

.main {
  padding: 18px 18px 20px;
  min-width: 0;
}
.tool-title {
  margin: 0 0 6px;
  font-size: 1.2rem;
  font-weight: 800;
}
.tool-desc {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.94rem;
}
.tool-spec {
  margin: 0 0 14px;
  padding: 8px 10px;
  color: #2f463f;
  font-size: 0.86rem;
  line-height: 1.45;
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
}
.tool-spec code {
  font-family: var(--mono);
  font-size: 0.9em;
}

.io {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 4px;
  padding: 12px;
  background: #fafaf7;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
@media (max-width: 720px) {
  .io { grid-template-columns: 1fr; }
}
.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.field textarea,
.field input[type="text"],
.field select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  font: 0.9rem/1.55 var(--mono);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 2px rgba(26, 31, 22, 0.04);
}
.field textarea:focus,
.field input[type="text"]:focus,
.field select:focus {
  outline: 2px solid rgba(61, 107, 84, 0.35);
  outline-offset: 1px;
  border-color: var(--accent);
}
.field input[type="color"] {
  width: 64px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
}
.field textarea {
  min-height: 220px;
  resize: vertical;
  tab-size: 2;
  white-space: pre-wrap;
  word-break: break-word;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
}
.btn {
  display: inline-block;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--radius);
}
.btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn--ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-ink); }

.msg {
  margin: 12px 0 0;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: var(--radius);
}
.msg.is-ok { background: var(--ok-bg); color: var(--ok); }
.msg.is-err { background: var(--warn-bg); color: var(--warn); }

.note {
  margin-top: 20px;
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.note h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 1.15rem;
}
.note p {
  margin: 0 0 8px;
  color: var(--muted);
}
.note p:last-child { margin-bottom: 0; }

.ad-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1100px;
  margin: 14px auto;
  padding: 0 16px;
  box-sizing: border-box;
  text-align: center;
}
.ad-slot-hint {
  margin: 0 0 8px;
  width: 100%;
  max-width: 728px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}
.ad-slot-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ad-slot-inner > * {
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
}
.ad-slot iframe,
.ad-slot ins,
.ad-slot-inner iframe,
.ad-slot-inner ins {
  max-width: 100%;
}
.ad-slot--header {
  margin-top: 12px;
  margin-bottom: 8px;
}
.ad-slot--mid {
  margin: 18px auto 8px;
}
/* 广告仅出现在工具壳之外，避免遮挡输入输出区 */
.page > .wrap > .shell + .ad-slot,
.shell ~ .ad-slot {
  clear: both;
}

.prose h2 {
  margin: 1.4rem 0 0.45rem;
  font-size: 1.15rem;
}
.prose p, .prose li { color: #333a2e; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0 1.2rem;
  font-size: 0.95rem;
}
.prose th,
.prose td {
  border: 1px solid #d5ddd4;
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
}
.prose th {
  background: var(--accent-soft);
  color: #243028;
  font-weight: 600;
}
.prose code,
.article code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--accent-soft);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}
.prose pre,
.article pre {
  margin: 0.85rem 0 1.1rem;
  padding: 12px 14px;
  overflow-x: auto;
  background: #f4f6f3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: 0.86rem/1.55 var(--mono);
  color: var(--ink);
}
.prose pre code,
.article pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  background: var(--paper);
  border: 1px solid var(--line);
  margin-bottom: 10px;
  padding: 14px 16px;
}
.post-list a {
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
}
.post-list a:hover { color: var(--accent-ink); }
.post-list .meta {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.post-list .excerpt {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.post-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
}
.post-switch__btn {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: var(--radius);
}
.post-switch__btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-ink);
}
.post-switch__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.post-switch__select {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 8px 10px;
  border-radius: var(--radius);
}

.article {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 22px 24px;
}
.article h2 {
  margin: 1.35rem 0 0.45rem;
  font-size: 1.12rem;
}
.article ul {
  margin: 0.4rem 0 0.8rem;
  padding-left: 1.2rem;
  color: #333a2e;
}
.article .meta {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}
.article .cta {
  margin-top: 1.2rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.foot {
  background: var(--bar);
  color: #8f9c96;
  padding: 28px 0;
  font-size: 0.9rem;
}
.foot a {
  color: #d7e0db;
  text-decoration: none;
  margin-right: 12px;
}
.foot__links { margin-bottom: 8px; }
.foot p { margin: 0; }
.foot__legal {
  margin-bottom: 6px !important;
  color: #a8b4ae;
  font-size: 0.86rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .topbar__in { flex-direction: column; align-items: flex-start; }
}
