:root {
  --paper: #f4f1ea;
  --ink: #242424;
  --muted: rgba(36, 36, 36, 0.66);
  --faint: rgba(36, 36, 36, 0.1);
  --surface: #fffdf8;
  --surface-soft: #ebe6dc;
  --border: #d9d0c2;
  --accent: #6f6f52;
  --accent-strong: #3f5f63;
  --brick: #9a604f;
  --plum: #746175;
  --shadow: 0 18px 42px rgba(44, 38, 30, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto 1fr auto;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.site-header,
main:not(.toolbox-main),
.site-footer {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding-left: clamp(20px, 4vw, 32px);
  padding-right: clamp(20px, 4vw, 32px);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 10px;
  padding-bottom: 10px;
  background: rgba(244, 241, 234, 0.92);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(14px);
}

.site-header.is-scrolled {
  border-color: var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 900;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.site-nav a,
.site-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 0 12px;
  line-height: 1;
  color: inherit;
  cursor: pointer;
}

.site-nav a:hover,
.site-nav button:hover,
.site-nav .is-active {
  border-color: var(--border);
  background: var(--surface);
  color: var(--ink);
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: clamp(24px, 4vw, 44px);
  align-items: start;
  min-height: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 14px;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.16;
  letter-spacing: 0;
}

.hero-text {
  max-width: 690px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.35vw, 17px);
  line-height: 1.58;
}

.page-hero p {
  max-width: none;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.35vw, 17px);
  line-height: 1.58;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 22px;
}

.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

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

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

.hero-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow);
}

.hero-panel span,
.entry-card span,
.capability-grid span,
.about-copy span,
.contact-card span {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.hero-panel strong {
  display: block;
  margin-bottom: 12px;
  font-size: 18px;
  line-height: 1.18;
}

.hero-panel p,
.entry-card p,
.capability-grid p,
.project-copy p,
.about-copy p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.68;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: 0;
  align-items: stretch;
}

.entry-card {
  display: flex;
  min-height: clamp(148px, 18vh, 190px);
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.74);
  padding: 20px;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.entry-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-strong);
  box-shadow: var(--shadow);
}

.entry-featured {
  background: var(--surface);
}

.entry-card h2 {
  margin-bottom: 10px;
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.14;
  letter-spacing: 0;
}

.entry-card p {
  max-width: 92%;
}

.latest-strip {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.62);
  padding: 18px 20px;
  margin-bottom: 0;
}

.home-main {
  display: grid;
  align-content: start;
  gap: clamp(34px, 6vh, 58px);
  padding-top: clamp(44px, 7vh, 72px);
  padding-bottom: clamp(30px, 5vh, 46px);
}

.home-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.home-feature-card {
  display: flex;
  min-height: 174px;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.68);
  padding: 20px;
}

.home-feature-card h2 {
  margin-bottom: 14px;
  font-size: clamp(21px, 2.2vw, 28px);
  line-height: 1.14;
  letter-spacing: 0;
}

.home-feature-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.text-link {
  color: var(--accent-strong);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(63, 95, 99, 0.32);
  transition: text-decoration-color 160ms ease, color 160ms ease;
}

.text-link:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

.home-feature-card .text-link {
  margin-top: auto;
  align-self: flex-start;
}

.home-focus-section {
  border-top: 1px solid var(--border);
  padding-top: clamp(22px, 4vh, 34px);
}

.home-section-heading {
  margin-bottom: 16px;
}

.home-section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(21px, 2.2vw, 28px);
  line-height: 1.14;
  letter-spacing: 0;
}

.home-focus-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.home-focus-grid article {
  min-height: 148px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.68);
  padding: 18px;
}

.home-focus-grid span {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.home-focus-grid h3 {
  margin: 0 0 8px;
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: 0;
}

.home-focus-grid p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.latest-strip h2,
.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(21px, 2.2vw, 28px);
  line-height: 1.14;
  letter-spacing: 0;
}

.latest-link {
  display: grid;
  gap: 6px;
  border-left: 3px solid var(--brick);
  padding-left: 16px;
}

.feature-title {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.latest-link time,
.feature-title time {
  color: var(--accent-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 800;
}

.latest-link span,
.feature-title span {
  font-size: clamp(17px, 1.7vw, 21px);
  font-weight: 900;
  line-height: 1.25;
}

.page-shell {
  width: min(100%, 960px);
}

.page-hero {
  padding: clamp(26px, 4vw, 38px) 0 22px;
}

.about-page {
  width: min(100%, 980px);
  padding-top: clamp(30px, 5vh, 48px);
  padding-bottom: clamp(28px, 5vh, 46px);
}

.about-hero {
  border-bottom: 1px solid var(--border);
  padding-bottom: clamp(22px, 4vh, 34px);
}

.about-hero-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(24px, 5vw, 54px);
  align-items: end;
}

.about-hero h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 3.6vw, 38px);
  line-height: 1.14;
  letter-spacing: 0;
}

.about-hero p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.72;
}

.about-note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: clamp(20px, 4vh, 34px) 0;
}

.about-note-card,
.about-contact-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
  padding: 18px;
}

.about-note-card {
  min-height: 146px;
}

.about-note-card span,
.about-contact-card span {
  display: inline-flex;
  margin-bottom: 12px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.about-note-card h2,
.about-section-head h2 {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.about-note-card p,
.about-section-head p,
.about-contact-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.68;
}

.about-contact {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(24px, 5vw, 54px);
  align-items: start;
  border-top: 1px solid var(--border);
  padding-top: clamp(20px, 4vh, 32px);
}

.about-section-head {
  position: sticky;
  top: 76px;
}

.about-contact-grid {
  display: grid;
  gap: 14px;
}

.about-contact-card {
  display: grid;
  min-height: 112px;
  align-items: center;
}

.about-contact-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: clamp(17px, 1.8vw, 20px);
  line-height: 1.25;
  word-break: break-all;
}

.about-qr-card {
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 18px;
}

.about-qr-card img {
  width: 92px;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.about-page {
  width: min(100%, 880px);
  padding-top: clamp(34px, 6vh, 58px);
  padding-bottom: clamp(30px, 5vh, 48px);
}

.about-block {
  border-bottom: 1px solid var(--border);
  padding: clamp(24px, 4vh, 34px) 0;
}

.about-block:first-child {
  padding-top: 0;
}

.about-block:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.about-hero-simple {
  max-width: 760px;
}

.about-hero-simple h1 {
  margin-bottom: 12px;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.14;
  letter-spacing: 0;
}

.about-hero-simple p,
.about-section-title p,
.about-focus-item p,
.about-contact-row p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.about-section-title {
  max-width: 680px;
  margin-bottom: 18px;
}

.about-section-title h2 {
  margin-bottom: 8px;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.about-focus-list,
.about-contact-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border);
}

.about-focus-item,
.about-contact-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
  padding: 18px;
}

.about-focus-item span,
.about-contact-row span {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.about-focus-item h3 {
  margin: 0 0 6px;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0;
}

.about-contact-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.about-contact-row strong {
  display: block;
  margin: 8px 0 6px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.25;
  word-break: break-all;
}

.about-contact-qr img {
  width: 88px;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.about-contact-line {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(150px, auto) auto;
  gap: 16px;
  align-items: center;
  min-height: 68px;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.about-contact-line span {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.about-contact-line strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
  word-break: break-all;
}

.about-contact-line p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.about-contact-line img {
  width: 64px;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.about-main {
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: space-between;
  gap: clamp(26px, 5vh, 56px);
  padding-top: clamp(30px, 5vh, 52px);
  padding-bottom: clamp(24px, 4vh, 40px);
}

.about-main .page-hero {
  padding: 0;
}

.about-intro {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: clamp(24px, 4vw, 44px);
  align-items: center;
}

.page-hero h1 {
  margin-bottom: 12px;
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.18;
}

.filter-section {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 6px 0 24px;
}

.filter-btn {
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  padding: 0 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.filter-btn:hover,
.filter-btn.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.article-list {
  display: grid;
  gap: 14px;
  padding-bottom: 48px;
}

.article-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.68);
  animation: fadeIn 220ms ease both;
}

.article-item[hidden] {
  display: none;
}

.article-card {
  display: block;
  padding: 20px;
}

.article-card:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 4px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 9px;
  color: var(--accent-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 800;
}

.article-meta span::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  margin: 0 14px 2px 0;
  border-radius: 50%;
  background: var(--brick);
}

.article-item h2 {
  margin-bottom: 8px;
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.22;
  letter-spacing: 0;
}

.article-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.article-item:hover {
  border-color: var(--accent-strong);
  box-shadow: var(--shadow);
}

.article-detail {
  padding-bottom: 56px;
}

.article-back {
  display: inline-flex;
  margin-bottom: 20px;
}

.article-detail-header {
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
  padding-bottom: 24px;
}

.article-detail-header h1 {
  margin-bottom: 14px;
}

.article-detail-header p:last-child {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.72;
}

.article-content {
  max-width: 760px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.86;
}

.article-content h2 {
  margin: 34px 0 12px;
  font-size: clamp(21px, 2.5vw, 26px);
  line-height: 1.24;
}

.article-content h3 {
  margin: 28px 0 10px;
  font-size: 19px;
  line-height: 1.32;
}

.article-content p,
.article-content ul,
.article-content ol,
.article-content blockquote,
.article-content pre {
  margin: 0 0 18px;
}

.article-content ul,
.article-content ol {
  padding-left: 1.35em;
}

.article-content li + li {
  margin-top: 6px;
}

.article-content a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-content blockquote {
  border-left: 3px solid var(--accent-strong);
  background: rgba(255, 253, 248, 0.68);
  padding: 12px 16px;
  color: var(--muted);
}

.article-content code {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  padding: 0.1em 0.35em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.article-content pre {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.article-content pre code {
  border: 0;
  background: transparent;
  padding: 0;
}

.project-detail {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow);
}

.project-shot {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.project-copy h2 {
  margin-bottom: 10px;
  font-size: clamp(22px, 2.5vw, 28px);
  line-height: 1.16;
}

.capability-grid,
.about-layout,
.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.capability-grid {
  padding: 14px 0 48px;
}

.capability-grid article,
.about-copy,
.contact-card {
  display: flex;
  min-height: clamp(132px, 14vh, 164px);
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.64);
  padding: 18px;
}

.about-copy {
  justify-content: space-between;
  background: var(--surface);
}

.capability-grid h3,
.about-copy h2 {
  margin-bottom: 8px;
  font-size: 18px;
  line-height: 1.2;
}

.about-layout {
  grid-template-columns: 1fr;
  gap: 12px;
  padding-bottom: 0;
}

.contact-section {
  border-top: 1px solid var(--border);
  padding: clamp(18px, 3vh, 26px) 0 0;
}

.contact-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: clamp(24px, 4vw, 44px);
  align-items: center;
}

.about-main .contact-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

.section-heading {
  margin-bottom: 0;
}

.contact-card {
  min-height: clamp(132px, 14vh, 164px);
  justify-content: center;
}

.contact-card strong {
  display: block;
  color: var(--ink);
  font-size: clamp(17px, 1.8vw, 20px);
  line-height: 1.25;
  word-break: break-all;
}

.wechat-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.wechat-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.wechat-card img {
  width: 88px;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--border);
  padding-top: 18px;
  padding-bottom: 20px;
  color: var(--muted);
}

.site-footer strong {
  color: var(--ink);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: flex-end;
  font-size: 14px;
  font-weight: 800;
}

.footer-links a:hover {
  color: var(--accent-strong);
}

.legal-page {
  width: min(100%, 880px);
  padding-top: clamp(30px, 4.5vw, 44px);
  padding-bottom: 28px;
}

.legal-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 42px);
}

.legal-card h1 {
  margin-bottom: 8px;
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.14;
}

.legal-card h2 {
  margin: 24px 0 8px;
  font-size: 18px;
  line-height: 1.25;
}

.legal-card p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}

.legal-card a {
  color: var(--accent-strong);
  font-weight: 800;
  border-bottom: 1px solid currentColor;
}

.updated {
  color: rgba(36, 36, 36, 0.48);
}

.qr-modal[hidden] {
  display: none;
}

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
}

.qr-modal.qr-modal-popover {
  inset: auto;
  display: block;
  width: auto;
  padding: 0;
}

.qr-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(36, 36, 36, 0.5);
}

.qr-modal-popover .qr-modal-backdrop,
.qr-modal-popover .qr-modal-close {
  display: none;
}

.qr-modal-card {
  position: relative;
  width: min(100%, 370px);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
  text-align: center;
}

.qr-modal-popover .qr-modal-card {
  width: 220px;
  padding: 16px;
}

.qr-modal-card h2 {
  margin-bottom: 20px;
  font-size: 28px;
}

.qr-modal-popover .eyebrow,
.qr-modal-popover .qr-modal-card h2,
.qr-modal-popover .qr-modal-note {
  display: none;
}

.qr-modal-card img {
  display: block;
  width: min(100%, 250px);
  aspect-ratio: 1;
  margin: 0 auto;
  object-fit: contain;
}

.qr-modal-popover .qr-modal-card img {
  width: 188px;
}

.qr-modal-note {
  margin: 18px 0 0;
  color: var(--muted);
}

.qr-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 820px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .home-hero,
  .home-grid,
  .home-feature-grid,
  .home-focus-grid,
  .latest-strip,
  .project-detail,
  .capability-grid,
  .about-hero-grid,
  .about-note-grid,
  .about-contact,
  .about-qr-card,
  .about-intro,
  .contact-shell,
  .about-layout,
  .contact-grid,
  .wechat-card {
    grid-template-columns: 1fr;
  }

  .about-focus-item,
  .about-contact-row {
    grid-template-columns: 1fr;
  }

  .about-contact-line {
    grid-template-columns: 1fr auto;
    gap: 8px 14px;
  }

  .about-contact-line span,
  .about-contact-line strong,
  .about-contact-line p {
    grid-column: 1;
  }

  .about-contact-line img {
    grid-column: 2;
    grid-row: 1 / span 3;
    width: 72px;
  }

  .contact-line {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 6px 0;
  }

  .contact-qr-grid {
    grid-template-columns: repeat(2, minmax(0, 104px));
  }

  .home-hero {
    min-height: auto;
  }

  .home-main,
  .about-main {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 20px;
    padding-top: 24px;
    padding-bottom: 22px;
  }

  .entry-featured {
    min-height: 132px;
  }

  .entry-card,
  .about-note-card,
  .about-contact-card,
  .about-copy,
  .contact-card,
  .capability-grid article {
    min-height: auto;
  }

  .about-section-head {
    position: static;
  }

  .about-qr-card img {
    width: 96px;
  }

  .section-heading {
    margin-bottom: 14px;
  }

  .project-shot {
    width: min(100%, 260px);
  }
}

@media (max-width: 540px) {
  .site-header,
  main:not(.toolbox-main),
  .site-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .site-nav a,
  .site-nav button {
    padding-left: 10px;
    padding-right: 10px;
  }

  .home-hero,
  .page-hero {
    padding-top: 0;
  }

  .action-row,
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }

  .footer-links {
    justify-content: flex-start;
  }
}

.about-page {
  width: min(100%, 760px);
  padding-top: clamp(34px, 6vh, 56px);
  padding-bottom: clamp(30px, 5vh, 46px);
}

.about-block {
  border-bottom: 1px solid var(--border);
  padding: clamp(24px, 4vh, 34px) 0;
}

.about-block:first-child {
  padding-top: 0;
}

.about-block:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.about-hero-simple {
  max-width: none;
}

.about-focus-list,
.about-contact-list {
  display: grid;
  gap: 12px;
  border-top: 0;
}

.about-focus-item,
.about-contact-line {
  display: block;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
  padding: 18px;
}

.about-focus-item span,
.about-contact-line span {
  display: block;
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.about-contact-line strong {
  display: block;
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
  word-break: break-all;
}

.about-contact-line p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.about-contact-line img {
  display: block;
  width: 108px;
  aspect-ratio: 1;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.contact-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
  padding: 18px;
}

.contact-lines {
  display: grid;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.contact-line {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  min-height: 34px;
}

.contact-line span {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.contact-line strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.25;
  word-break: break-all;
}

.contact-qr-grid {
  display: grid;
  grid-template-columns: repeat(2, max-content);
  gap: 18px;
  padding-top: 16px;
}

.contact-qr-grid figure {
  margin: 0;
}

.contact-qr-grid img {
  display: block;
  width: 104px;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.contact-qr-grid figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin: 0 0 32px;
  padding: 0;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.78);
  padding: 22px;
  color: inherit;
  text-decoration: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-strong);
  box-shadow: var(--shadow);
}

.tool-card.is-placeholder {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
}

.tool-card.is-placeholder:hover {
  transform: none;
  box-shadow: none;
}

.tool-card-tag {
  align-self: flex-start;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.tool-card h2,
.tool-card h3 {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
}

.tool-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.tool-card .text-link {
  margin-top: auto;
}

.tool-page {
  padding-bottom: 56px;
}

.tool-back {
  display: inline-flex;
  margin-bottom: 20px;
}

.tool-hero {
  margin-bottom: 28px;
}

.tool-hero h1 {
  margin-bottom: 12px;
  font-size: clamp(26px, 3.4vw, 34px);
  line-height: 1.18;
}

.tool-hero p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.tool-app {
  display: grid;
  gap: 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: clamp(20px, 3vw, 28px);
  margin-bottom: 36px;
  min-width: 0;
  overflow: hidden;
}

.tool-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.tool-tab {
  min-height: 36px;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  padding: 0 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.tool-tab.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.tool-form {
  display: grid;
  gap: 18px;
}

.tool-form[hidden] {
  display: none;
}

.tool-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 14px;
  min-width: 0;
}

.tool-field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 900;
  color: var(--muted);
  min-width: 0;
}

.tool-field > span {
  letter-spacing: 0.04em;
}

.tool-field input[type="text"],
.tool-field input[type="number"],
.tool-field input[type="date"],
.tool-field select,
.tool-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  padding: 10px 12px;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  min-width: 0;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.tool-field textarea {
  min-height: 96px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.tool-field input:focus,
.tool-field select:focus,
.tool-field textarea:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(63, 95, 99, 0.18);
}

.tool-field input[type="range"] {
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--surface-soft);
  border-radius: 999px;
}

.tool-field input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
  border: 2px solid var(--surface);
}

.tool-field input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ink);
  cursor: pointer;
  border: 2px solid var(--surface);
}

.tool-field output {
  color: var(--ink);
  font-weight: 700;
}

.tool-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}

.tool-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--ink);
}

.tool-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px 16px;
}

.tool-preview {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--border);
  padding-top: 22px;
}

.tool-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  padding: 24px;
}

.qr-canvas {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: 220px;
}

.qr-canvas svg {
  display: block;
}

.tool-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tool-hint.is-error {
  color: var(--brick);
}

.tool-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 22px;
}

.tool-result-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  padding: 16px;
}

.tool-result-card-wide {
  grid-column: span 2;
}

.tool-result-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.tool-result-card strong {
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 900;
  line-height: 1.2;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.password-display {
  display: grid;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  padding: 18px 20px;
}

.password-output {
  display: block;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: clamp(18px, 2.4vw, 22px);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.password-output.is-empty {
  color: var(--brick);
  font-weight: 800;
  font-size: 15px;
  font-family: inherit;
  letter-spacing: 0;
}

.password-strength {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
}

.password-strength-bar {
  position: relative;
  flex: 1;
  height: 6px;
  background: var(--surface-soft);
  border-radius: 999px;
  overflow: hidden;
}

.password-strength-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 200ms ease, background 200ms ease;
}

.unit-result-panel {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  padding: 18px 20px;
  min-width: 0;
}

.unit-result-panel span {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.unit-result-panel strong {
  display: block;
  color: var(--ink);
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 900;
  line-height: 1.1;
  word-break: break-all;
}

.unit-result-panel em {
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
  font-weight: 800;
}

.unit-result-list-wrap {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding-top: 22px;
}

.unit-result-list-wrap h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.unit-result-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 10px;
}

.unit-result-item {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  padding: 10px 14px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.unit-result-item:hover,
.unit-result-item.is-active {
  border-color: var(--accent-strong);
  background: var(--surface);
}

.unit-result-item span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.unit-result-item strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-result-item small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.unit-result-item em {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.mortgage-workbench {
  display: grid;
  gap: 16px;
}

.mortgage-input-panel,
.mortgage-result-panel,
.mortgage-part-panel {
  display: grid;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  padding: clamp(16px, 2.4vw, 22px);
  min-width: 0;
}

.mortgage-input-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--surface);
}

.mortgage-option-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.mortgage-input-panel > .tool-field {
  grid-column: 1 / -1;
  max-width: 360px;
}

.mortgage-result-panel {
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.35fr);
  align-items: stretch;
  background: var(--paper);
  color: var(--ink);
}

.mortgage-main-result {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
  border: 1px solid rgba(63, 95, 99, 0.18);
  border-radius: 10px;
  background: var(--surface);
  padding: 18px 20px;
}

.mortgage-main-result > span {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.mortgage-main-result > strong {
  display: block;
  color: var(--ink);
  font-size: clamp(34px, 4.8vw, 56px);
  font-weight: 900;
  line-height: 1.1;
  word-break: break-all;
}

.mortgage-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mortgage-result-grid div {
  display: grid;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.mortgage-result-grid span,
.mortgage-part-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mortgage-result-grid span {
  color: var(--muted);
}

.mortgage-result-grid strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.mortgage-result-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 0;
}

.mortgage-result-actions .primary-btn {
  width: 100%;
}

.mortgage-result-actions .tool-hint {
  color: var(--muted);
}

.mortgage-loan-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  padding: 16px;
  align-content: start;
}

.mortgage-input-panel:has(#mortgage-commercial-panel:not([hidden])):has(#mortgage-fund-panel:not([hidden])) .mortgage-loan-panel {
  grid-column: auto;
}

.mortgage-loan-panel[hidden] {
  display: none;
}

.mortgage-loan-panel h2,
.mortgage-part-panel h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.mortgage-rate-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 10px;
}

.mortgage-rate-row button {
  min-height: 34px;
  border: 1px solid rgba(63, 95, 99, 0.24);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.mortgage-rate-row button:hover {
  border-color: var(--accent-strong);
}

.mortgage-part-panel {
  background: var(--surface);
}

.mortgage-part-panel[hidden] {
  display: none;
}

.mortgage-part-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 10px;
}

.mortgage-part-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  padding: 12px 14px;
}

.mortgage-part-row span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.mortgage-part-row span:last-child {
  text-align: right;
}

.mortgage-part-row strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.mortgage-extra-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.mortgage-extra-panel .tool-result-card {
  border-color: var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.mortgage-extra-panel .tool-result-card span {
  color: var(--muted);
}

.mortgage-extra-panel .tool-result-card strong {
  color: var(--ink);
  font-size: 18px;
}

.kinship-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 18px 20px;
  align-items: start;
}

.kinship-input-panel,
.kinship-result-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  padding: 18px 20px;
  min-width: 0;
}

.kinship-input-panel {
  grid-column: 1;
  grid-row: 1;
  background: var(--surface);
  min-height: 184px;
  align-content: start;
}

.kinship-input-panel input {
  min-height: 48px;
  font-size: 16px;
  font-weight: 800;
}

.kinship-input-panel .action-row {
  margin-top: 4px;
}

.kinship-result-panel > span {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 900;
}

.kinship-result-panel > strong {
  display: block;
  color: var(--ink);
  font-size: clamp(28px, 3.4vw, 42px);
  font-weight: 900;
  line-height: 1.15;
  word-break: break-word;
}

.kinship-result-panel > p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.kinship-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

.kinship-chain span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  padding: 0 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.kinship-keypad {
  grid-column: 1 / -1;
  grid-row: 2;
  display: grid;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 16px;
}

.tool-app-kinship .kinship-result-panel {
  grid-column: 2;
  grid-row: 1;
}

.tool-app-kinship .tool-sticky-result {
  position: static;
}

.kinship-keypad-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kinship-keypad-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.3;
}

.kinship-more-toggle {
  min-height: 34px;
  padding-left: 12px;
  padding-right: 12px;
}

.kinship-keypad-section {
  display: grid;
  gap: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  min-width: 0;
}

.kinship-keypad-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
}

.kinship-keypad-grid button {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.kinship-keypad-grid button:hover {
  border-color: var(--accent-strong);
  background: var(--surface);
}

.color-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 20px;
  align-items: start;
}

.color-mode-tabs {
  margin-bottom: 0;
}

.color-main-panels {
  min-width: 0;
}

.color-mode-panel {
  display: none;
}

.color-mode-panel.is-active {
  display: grid;
  gap: 16px;
}

.color-preview-panel,
.color-control-panel {
  display: grid;
  gap: 16px;
}

.color-side-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
  position: sticky;
  top: 82px;
}

.color-preview {
  min-height: 118px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #7e5a3d;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.color-output-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.color-output-grid button {
  display: grid;
  gap: 4px;
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  padding: 10px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.color-output-grid button:hover {
  border-color: var(--accent-strong);
  background: var(--surface);
}

.color-output-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.color-output-grid strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.35;
}

.color-canvas-frame {
  position: relative;
  display: grid;
  min-height: 360px;
  align-items: start;
  justify-items: stretch;
}

.color-image-canvas {
  display: none;
  width: auto;
  max-width: 100%;
  max-height: min(64vh, 560px);
  height: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    linear-gradient(45deg, rgba(36, 36, 36, 0.06) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(36, 36, 36, 0.06) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(36, 36, 36, 0.06) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(36, 36, 36, 0.06) 75%);
  background-color: var(--surface);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  cursor: crosshair;
}

.color-image-canvas.has-image {
  display: block;
}

.color-canvas-empty {
  display: grid;
  gap: 12px;
  width: 100%;
  min-height: 360px;
  place-items: center;
  align-content: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(63, 95, 99, 0.08), transparent 42%),
    var(--paper);
  padding: 28px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.color-canvas-empty strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.color-canvas-empty span {
  max-width: 360px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.color-empty-upload {
  margin-top: 4px;
  cursor: pointer;
}

.color-canvas-empty[hidden] {
  display: none;
}

.color-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.color-compact-row {
  grid-template-columns: 74px minmax(0, 1fr);
}

.color-rgb-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.color-control-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper);
  padding: 14px;
}

.color-control-panel h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
}

.color-control-panel .tool-row {
  gap: 10px;
}

.color-control-panel .tool-field {
  gap: 5px;
}

.color-control-panel input[type="color"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 4px;
}

.color-primary-actions {
  margin-top: 0;
  gap: 10px;
}

.color-primary-actions .primary-btn {
  width: 100%;
}

.color-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.color-section-head h2 {
  margin: 0;
  font-size: 17px;
}

.color-favorite-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr));
  gap: 10px;
}

.color-favorite-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 2px 10px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  padding: 10px;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.color-favorite-item span {
  grid-row: 1 / 3;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.color-favorite-item strong {
  font-size: 14px;
}

.color-favorite-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-app-unit {
  grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1.08fr);
  align-items: start;
}

.tool-app-unit > .tool-tabs {
  grid-column: 1 / -1;
}

.tool-app-unit > .unit-result-panel {
  grid-column: 1;
}

.tool-app-unit > .tool-form,
.tool-app-unit > .unit-result-list-wrap {
  grid-column: 2;
}

.tool-sticky-result {
  position: sticky;
  top: 82px;
}

.tool-app-color {
  gap: 26px;
}

@media (max-width: 760px) {
  .tool-app-unit,
  .mortgage-workbench,
  .kinship-workbench,
  .color-workbench {
    grid-template-columns: 1fr;
  }

  .color-side-panel {
    order: 0;
    position: static;
  }

  .tool-app-unit > * {
    grid-column: 1 / -1 !important;
  }

  .tool-sticky-result {
    position: static;
  }

  .mortgage-input-panel,
  .mortgage-result-panel,
  .mortgage-part-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .mortgage-input-panel,
  .mortgage-result-panel {
    grid-template-columns: 1fr;
  }

  .mortgage-result-actions {
    grid-template-columns: 1fr;
  }

  .mortgage-input-panel > .tool-field {
    max-width: none;
  }

  .kinship-keypad {
    grid-template-columns: 1fr;
  }

  .kinship-input-panel,
  .tool-app-kinship .kinship-result-panel,
  .kinship-keypad {
    grid-column: 1;
    grid-row: auto;
  }

  .kinship-input-panel {
    min-height: 0;
  }

  .color-preview {
    min-height: 150px;
  }

  .color-output-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .mortgage-part-row {
    grid-template-columns: 1fr;
  }

  .mortgage-part-row span:last-child {
    text-align: left;
  }

  .mortgage-option-row,
  .mortgage-input-panel,
  .mortgage-result-panel,
  .mortgage-extra-panel {
    grid-template-columns: 1fr;
  }

  .tool-app {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    margin-left: -18px;
    margin-right: -18px;
    padding: 18px;
  }

  .tool-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .color-mode-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .tool-tab {
    width: 100%;
    padding-left: 8px;
    padding-right: 8px;
  }

  .action-row {
    width: 100%;
    align-items: stretch;
  }

  .action-row .primary-btn,
  .action-row .secondary-btn {
    width: 100%;
  }

  .unit-result-item,
  .color-workbench {
    grid-template-columns: 1fr;
  }

  .color-compact-row,
  .color-rgb-row,
  .color-output-grid {
    grid-template-columns: 1fr;
  }

  .unit-result-item em {
    text-align: left;
  }

  .mortgage-result-grid {
    grid-template-columns: 1fr;
  }

  .kinship-keypad-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kinship-keypad {
    padding: 14px;
  }

  .color-section-head {
    display: grid;
    align-items: stretch;
  }

  .color-canvas-frame,
  .color-canvas-empty {
    min-height: 260px;
  }
}

.tool-doc {
  margin-bottom: 36px;
  color: var(--ink);
}

.tool-doc h2 {
  margin: 28px 0 10px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}

.tool-doc h2:first-child {
  margin-top: 0;
}

.tool-doc p,
.tool-doc ul,
.tool-doc ol {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.78;
}

.tool-doc ul,
.tool-doc ol {
  padding-left: 1.4em;
}

.tool-doc li + li {
  margin-top: 4px;
}

.tool-doc code {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface);
  padding: 0.1em 0.35em;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.92em;
}

.tool-related h2 {
  margin: 0 0 14px;
  font-size: clamp(20px, 2.2vw, 24px);
}

.tools-explainer {
  padding-top: 8px;
}

.home-tools-section {
  border-top: 1px solid var(--border);
  padding-top: clamp(22px, 4vh, 34px);
}

.home-section-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.home-section-heading-row > div {
  display: grid;
}

@media (max-width: 640px) {
  .tool-result-card-wide {
    grid-column: span 1;
  }
}

/* ===== Toolbox App Layout (mirrors 01tools-web) ===== */
.toolbox-body {
  display: block;
  grid-template-rows: none;
  margin: 0;
  background: var(--paper);
}

.toolbox-layout {
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  min-height: 100vh;
}

/* -- Sidebar -- */
.toolbox-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
}

.toolbox-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 120px;
  padding: 0 34px;
  border-bottom: 1px solid var(--surface-soft);
}

.toolbox-brand img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.toolbox-brand strong {
  color: var(--ink);
  font-size: 23px;
  line-height: 1;
}

.toolbox-nav {
  padding: 10px 12px 24px;
}

.toolbox-nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 43px;
  padding: 0 28px;
  margin-bottom: 1px;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.toolbox-nav-item:hover {
  color: var(--ink);
}

.toolbox-nav-item.active {
  background: rgba(154, 96, 79, 0.06);
  color: var(--ink);
  font-weight: 700;
}

.toolbox-nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: var(--brick);
}

.toolbox-nav-icon {
  display: grid;
  place-items: center;
}

.toolbox-nav-icon img {
  width: 18px;
  height: 18px;
}

.toolbox-nav-item[href] {
  text-decoration: none;
  color: var(--muted);
}

.toolbox-nav-item[href].active,
.toolbox-nav-item[href]:hover {
  color: var(--ink);
}

.toolbox-nav-divider {
  height: 1px;
  margin: 6px 12px;
  background: var(--border);
}

/* -- Main -- */
.toolbox-main {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding-left: 0;
  padding-right: 0;
  background: var(--surface);
}

/* -- Topbar -- */
.toolbox-topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  height: 60px;
  padding: 0 28px;
  border-bottom: 1px solid var(--surface-soft);
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(14px);
}

.toolbox-menu-btn {
  display: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.toolbox-menu-btn:hover {
  border-color: var(--border);
  background: var(--surface-soft);
}

.toolbox-menu-icon {
  position: relative;
  display: block;
  width: 18px;
  height: 14px;
  background: linear-gradient(var(--ink), var(--ink)) 0 6px / 18px 2px no-repeat;
}

.toolbox-menu-icon::before,
.toolbox-menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--ink);
}

.toolbox-menu-icon::before { top: 0; }
.toolbox-menu-icon::after { bottom: 0; }

.toolbox-topbar-back {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  font-style: italic;
}

.toolbox-topbar-back:hover {
  color: var(--ink);
}

.toolbox-search {
  justify-self: end;
  display: grid;
  grid-template-columns: auto minmax(120px, 220px);
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--surface-soft);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
}

.toolbox-search-icon {
  width: 14px;
  height: 14px;
  opacity: 0.5;
}

.toolbox-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.toolbox-meta-pill {
  min-height: 30px;
  padding: 0 14px;
  border: 1px solid var(--surface-soft);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  line-height: 30px;
  white-space: nowrap;
}

/* -- Content -- */
.toolbox-content {
  max-width: 1268px;
  margin: 0 auto;
  padding: 30px 38px 54px;
}

.toolbox-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}

.toolbox-section-title::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50% 50% 50% 4px;
  background: var(--brick);
  transform: rotate(-18deg);
}

/* -- Tool grid & cards -- */
.toolbox-tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 30px;
}

.toolbox-tool-card {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 32px;
  gap: 14px;
  align-items: center;
  min-height: 86px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(44, 38, 30, 0.055);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.toolbox-tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--surface-soft);
  box-shadow: var(--shadow);
}

.toolbox-tool-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--surface-soft);
  border-radius: 8px;
  background: var(--paper);
}

.toolbox-tool-icon img {
  width: 25px;
  height: 25px;
}

.toolbox-tool-copy {
  min-width: 0;
}

.toolbox-tool-card strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
}

.toolbox-tool-card .toolbox-tool-copy span {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.35;
}

.toolbox-favorite-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--paper);
  color: var(--border);
  font-size: 15px;
  cursor: pointer;
  transition: color 150ms, background 150ms;
}

.toolbox-favorite-btn:hover,
.toolbox-favorite-btn.active {
  color: var(--brick);
  background: rgba(154, 96, 79, 0.08);
}

.toolbox-empty {
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.toolbox-empty[hidden] {
  display: none;
}

/* -- Toolbox tool detail page -- */
.toolbox-detail-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.toolbox-back-link {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.toolbox-back-link:hover {
  color: var(--ink);
}

.toolbox-detail-fav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 150ms ease;
}

.toolbox-detail-fav:hover {
  border-color: var(--brick);
  color: var(--brick);
}

.toolbox-detail-fav.is-fav {
  border-color: var(--brick);
  color: var(--brick);
  background: var(--surface-soft);
}

.toolbox-tool-detail .tool-hero {
  margin-bottom: 28px;
}

.toolbox-tool-detail .tool-hero h1 {
  margin-bottom: 12px;
  font-size: clamp(22px, 2.8vw, 28px);
  line-height: 1.2;
}

.toolbox-tool-detail .tool-hero p {
  margin-bottom: 0;
  color: var(--muted);
}

.toolbox-tool-detail .tool-related .tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

/* -- Mobile -- */
@media (max-width: 820px) {
  .toolbox-layout {
    display: block;
  }

  .toolbox-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 238px;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 200ms ease;
    box-shadow: none;
  }

  .toolbox-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(44, 38, 30, 0.12);
  }

  .toolbox-menu-btn {
    display: grid;
  }

  .toolbox-topbar {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    padding: 0 20px;
  }

  .toolbox-topbar .toolbox-search {
    display: none;
  }

  .toolbox-content {
    padding: 24px 22px 46px;
  }

  .toolbox-detail-bar {
    gap: 12px;
  }

  .toolbox-tool-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

@media (max-width: 520px) {
  .toolbox-topbar {
    height: 54px;
    padding: 0 14px;
  }

  .toolbox-topbar-back {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .toolbox-content {
    padding: 20px 18px 40px;
  }

  .toolbox-detail-bar {
    align-items: stretch;
  }

  .toolbox-detail-fav {
    justify-content: center;
    min-width: 86px;
  }

  .toolbox-tool-grid {
    grid-template-columns: 1fr;
  }
}
