:root {
  --bg: #f3f1ea;
  --card: #fffcf7;
  --ink: #1c2430;
  --muted: #5c6775;
  --line: #d9d3c7;
  --brand: #0e3a5d;
  --brand-2: #0e4d92;
  --accent: #0f6b4c;
  --danger: #8f1d1d;
  --result: #f3faf6;
  --ad: 160px;
  --side-gap: 24px;
  --header-h: 64px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: var(--brand-2);
}

a:hover {
  color: #0b3d74;
}

img,
canvas,
pre,
table {
  max-width: 100%;
}

.site-header {
  background: var(--brand);
  color: #f7f4ee;
  min-height: var(--header-h);
}

.header-inner,
.center-col {
  width: min(1000px, calc(100% - 2 * (var(--ad) + var(--side-gap) + 8px)));
  margin: 0 auto;
}

.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  color: #fff;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.header-nav {
  display: flex;
  gap: 18px;
}

.header-nav a {
  color: #f7f4ee;
  text-decoration: none;
}

.header-nav a:hover {
  text-decoration: underline;
}

.center-col {
  padding: 28px 0 48px;
}

.ad-slot {
  position: fixed;
  top: 80px;
  width: var(--ad);
  z-index: 2;
}

.ad-slot-left {
  left: 12px;
}

.ad-slot-right {
  right: 12px;
}

.ad-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-align: center;
}

.ad-box {
  height: 600px;
  overflow: hidden;
  border: 1px dashed #b7c0cc;
  background: #f7f8fa;
  color: #8b95a3;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  text-align: center;
  font-size: 13px;
  user-select: none;
  box-sizing: border-box;
}

.ad-box.is-blank {
  border-color: transparent;
  background: transparent;
}

.native-ad {
  width: 100%;
  flex: 1 1 auto;
  min-height: 100%;
  height: 100%;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  user-select: text;
  box-sizing: border-box;
}

.native-ad .ad-media {
  flex: 1 1 auto;
  width: 100%;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  position: relative;
  overflow: hidden;
}

.native-ad img,
.native-ad video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.native-ad .ad-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
}

.native-ad .ad-description {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.native-ad .ad-cta {
  width: 100%;
  min-height: 32px;
  border: 1px solid #8b95a3;
  background: #fff;
  color: #33404d;
  cursor: pointer;
}

h1 {
  margin: 0 0 8px;
  font-size: 32px;
  line-height: 1.25;
}

h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.lead,
.crumb,
.hint,
.estimate,
.help-list,
.footer-note {
  color: var(--muted);
}

.lead {
  margin: 0 0 20px;
  font-size: 17px;
}

.crumb {
  margin: 0 0 16px;
  font-size: 14px;
}

.crumb a {
  text-decoration: none;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
}

.span-2 {
  grid-column: 1 / -1;
}

.field label,
.checks legend,
.choice-row legend {
  display: block;
  margin-bottom: 6px;
  font-weight: 650;
}

.choice-row,
.checks {
  border: 0;
  margin: 0;
  padding: 0;
}

.choice-row label,
.checks label {
  font-weight: 450;
  margin: 0 16px 0 0;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  border: 1px solid #c8c1b4;
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
}

textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.55;
}

.mono,
textarea.mono,
pre.mono {
  font-family: Consolas, "Courier New", monospace;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #e2a100;
  outline-offset: 2px;
}

.field-error {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: 14px;
}

.hint {
  margin: 6px 0 0;
  font-size: 13px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.result-head .actions {
  margin-top: 0;
}

.btn {
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #c8c1b4;
  background: #fff;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.btn.primary {
  background: var(--brand-2);
  border-color: var(--brand-2);
  color: #fff;
}

.btn.primary:hover {
  background: #0b3d74;
}

.result {
  background: var(--result);
  border: 1px solid #cfe3d8;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.result-head h2 {
  margin: 0;
}

.result-main {
  margin: 4px 0 12px;
  font-size: 32px;
  line-height: 1.2;
  font-weight: 760;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.stat-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  margin: 0;
}

.stat-list div {
  padding: 8px 0;
  border-bottom: 1px solid #d7e6de;
}

.stat-list dt {
  color: var(--muted);
  font-size: 13px;
}

.stat-list dd {
  margin: 2px 0 0;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.estimate {
  margin: 12px 0 0;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

.sheet {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.sheet th,
.sheet td {
  padding: 8px;
  border-bottom: 1px solid #d7e6de;
  text-align: right;
  white-space: nowrap;
}

.sheet th:first-child,
.sheet td:first-child {
  text-align: left;
}

pre.result-pre {
  margin: 0;
  padding: 12px;
  overflow: auto;
  max-height: 360px;
  white-space: pre-wrap;
  word-break: break-word;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.diff-box {
  max-height: 420px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.diff-line {
  padding: 2px 8px;
  font-family: Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

.diff-add {
  background: #e5f6ea;
}

.diff-del {
  background: #fde8e8;
}

.qr-preview {
  display: block;
  width: 240px;
  height: 240px;
  background: #fff;
  border: 1px solid var(--line);
}

.related-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.related-list a {
  display: inline-block;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
}

.help-list {
  margin: 0;
  padding-left: 18px;
}

.tool-group + .tool-group {
  margin-top: 28px;
}

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tool-card {
  display: block;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
}

.tool-card:hover {
  border-color: var(--brand-2);
}

.tool-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 17px;
}

.tool-card span {
  color: var(--muted);
  font-size: 14px;
}

.site-footer {
  margin-top: 12px;
  padding-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.now-line {
  margin: 0 0 12px;
  font-variant-numeric: tabular-nums;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1439px) and (min-width: 1280px) {
  :root {
    --ad: 120px;
    --side-gap: 16px;
  }
}

@media (max-width: 1279px) {
  .ad-slot {
    display: none;
  }

  .header-inner,
  .center-col {
    width: min(1000px, calc(100% - 32px));
  }
}

@media (max-width: 720px) {
  h1 {
    font-size: 26px;
  }

  .form-grid,
  .tool-grid,
  .stat-list {
    grid-template-columns: 1fr;
  }

  .header-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 10px 0;
  }
}

@media print {
  .ad-slot,
  .site-header,
  .actions,
  .related-list {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .header-inner,
  .center-col {
    width: auto;
  }
}
