:root {
  --paper: #ffffff;
  --ink: #171717;
  --muted: #66645f;
  --rule: #d7d7d2;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  --sans: "Helvetica Neue", Helvetica, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --page-inset: clamp(24px, 7.6vw, 16mm);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  background: #e8e8e6;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

.toolbox-page {
  width: min(calc(100% - clamp(16px, 4vw, 32px)), 210mm);
  min-height: 297mm;
  margin: 24px auto;
  background: var(--paper);
  box-shadow: 0 3px 24px rgb(0 0 0 / 12%);
  transition: opacity 140ms ease, transform 140ms ease;
}

.toolbox-page.is-leaving { opacity: 0; transform: translateY(-4px); }

.toolbox-header {
  padding: clamp(28px, 6.7vw, 14mm) var(--page-inset) 0;
}

.page-rule {
  height: 0;
  margin: 0 0 clamp(16px, 3vw, 6mm);
  border: 0;
  border-top: 1px solid var(--rule);
}

h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(24px, 3.8vw, 31px);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.page-intro {
  margin: 7mm 0 0;
  font-family: var(--serif);
  font-size: clamp(11.5px, 1.65vw, 13px);
  line-height: 1.85;
}

.login-section {
  padding: clamp(32px, 7vw, 16mm) var(--page-inset) 12mm;
}

label { display: block; color: var(--muted); font-size: 11px; }

.password-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 10px;
}

.password-row input {
  width: min(240px, 100%);
  min-width: 0;
  padding: 5px 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  transition: border-color 160ms ease;
}

.password-row input:focus { border-bottom-color: var(--ink); }
.password-row input[aria-invalid="true"] { border-bottom-color: var(--ink); }

.text-action {
  flex-shrink: 0;
  padding: 4px 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-family: var(--sans);
  font-size: clamp(9px, 1.15vw, 10px);
  font-weight: 600;
  line-height: 1.65;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

.text-action:disabled { cursor: wait; color: var(--muted); }
.form-message { min-height: 1.65em; margin: 10px 0 0; color: var(--muted); font-size: 11px; }

.intro-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; }
.toolbox-content { padding: 8mm var(--page-inset) 12mm; }
.toolbox-section + .toolbox-section { margin-top: 7mm; }

h2 {
  margin: 0;
  padding: 3mm 0 1mm;
  border-bottom: 1px solid var(--rule);
  font-family: var(--serif);
  font-size: clamp(15px, 2vw, 17px);
  font-weight: 600;
  line-height: 1.5;
}

.section-content { margin: 0; padding: 5mm 0 0; }
.tool-list { display: grid; gap: 4mm; }

.tool-item summary {
  display: flex;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  font-family: var(--serif);
  font-size: 13px;
}

.tool-item summary::-webkit-details-marker { display: none; }
.tool-item summary > span:nth-child(2) {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: text-decoration-color 160ms ease;
}

.tool-item summary:hover > span:nth-child(2),
.tool-item summary:focus-visible > span:nth-child(2),
.tool-item[open] summary > span:nth-child(2) { text-decoration-color: currentColor; }
.tool-item[open] summary > span:nth-child(2) { font-weight: 600; }
.item-number, .item-status { color: var(--muted); font-family: var(--sans); font-size: 10px; font-weight: 400; }
.item-description { margin: 3mm 0 0; color: var(--muted); font-size: 11px; line-height: 1.8; }
.placeholder-list { display: grid; gap: 4mm; list-style: none; }
.placeholder-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 16px; font-family: var(--serif); }
.no-script-message { margin: 24px; }

@media (max-width: 700px) {
  .toolbox-page { min-height: calc(100svh - 24px); margin: 12px auto; }
  .toolbox-section + .toolbox-section { margin-top: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
