:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ink: #0f172a;
  --muted: #475569;
  --soft: #64748b;
  --line: #dbe3ef;
  --line-soft: #edf2f7;
  --page: #f7f9fc;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --green: #059669;
  --amber: #d97706;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.08);
  --hero-soft-bg: linear-gradient(135deg, rgba(219, 234, 254, 0.72), rgba(230, 247, 245, 0.52), rgba(236, 248, 255, 0.68));
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #eef5ff 0, var(--page) 520px);
  line-height: 1.6;
  overflow-x: hidden;
}

html.tool-embed,
html.tool-embed body {
  min-height: auto;
  background: #fff;
  overflow: visible;
}

html.tool-embed .topbar,
html.tool-embed .breadcrumb,
html.tool-embed .tool-page-hero,
html.tool-embed .seo-text,
html.tool-embed .more-tools,
html.tool-embed .tool-cta-banner,
html.tool-embed .cta-section,
html.tool-embed .footer {
  display: none !important;
}

html.tool-embed .tool-page-content {
  padding: 0;
}

html.tool-embed .container,
html.tool-embed .container-narrow {
  width: 100%;
  max-width: none;
  margin: 0;
}

html.tool-embed .tool-form-card {
  box-shadow: none;
}

html.tool-embed .tool-form-card {
  padding: 14px;
}

html.tool-embed .tool-form-card + .tool-form-card {
  margin-top: 10px;
}

html.tool-embed .tool-form-card label {
  margin: 8px 0 4px;
  font-size: 0.76rem;
  font-weight: 650;
}

html.tool-embed .tool-form-card input,
html.tool-embed .tool-form-card select,
html.tool-embed .tool-form-card textarea {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 7px;
  font-size: 0.88rem;
}

html.tool-embed .tool-form-card textarea {
  min-height: 84px;
  padding-top: 9px;
}

html.tool-embed .tool-field-row,
html.tool-embed .tool-field-row-3 {
  gap: 9px;
}

html.tool-embed .tool-section-title {
  margin-bottom: 4px;
  font-size: 0.9rem;
  font-weight: 650;
}

html.tool-embed .tool-muted {
  font-size: 0.82rem;
  line-height: 1.35;
}

html.tool-embed .tool-toggle-btn {
  min-height: 34px;
  font-size: 0.84rem;
  font-weight: 650;
}

html.tool-embed .tool-calc-btn {
  min-height: 38px;
  margin-top: 12px;
  font-size: 0.88rem;
  font-weight: 650;
}

html.tool-embed .tool-result {
  margin-top: 12px;
  padding: 12px;
}

html.tool-embed .tool-result h3 {
  margin-bottom: 8px;
  font-size: 0.9rem;
}

html.tool-embed .tool-result-grid {
  gap: 8px;
}

html.tool-embed .tool-result-card {
  min-height: 62px;
  padding: 9px;
}

html.tool-embed .tool-result-card .value {
  font-size: 1rem;
  font-weight: 650;
}

html.tool-embed .tool-result-card .label {
  font-size: 0.68rem;
  font-weight: 600;
}

html.tool-embed .tool-result-detail {
  margin-top: 8px;
  font-size: 0.8rem;
  line-height: 1.35;
}

html.tool-embed .tool-result-tip,
html.tool-embed .tool-result-warning {
  margin-top: 10px;
  padding: 9px 10px;
  font-size: 0.8rem;
  line-height: 1.35;
}

html.tool-embed .measurement-layout {
  grid-template-columns: minmax(0, 1fr) minmax(290px, 0.36fr);
  gap: 12px;
}

html.tool-embed .measurement-aside,
html.tool-embed .measurement-positions {
  gap: 10px;
}

html.tool-embed .measurement-positions {
  margin-top: 10px;
}

html.tool-embed .measurement-position-card {
  padding: 12px;
  background: #fff;
}

html.tool-embed .measurement-position-head {
  margin-bottom: 4px;
}

html.tool-embed .measurement-position-head strong {
  font-size: 0.88rem;
  font-weight: 650;
}

html.tool-embed .measurement-position-tools,
html.tool-embed .measurement-actions,
html.tool-embed .measurement-output-actions {
  gap: 7px;
}

html.tool-embed .measurement-position-tools button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 0.72rem;
  font-weight: 650;
}

html.tool-embed .measurement-position-result {
  margin-top: 9px;
  padding: 9px 10px;
  font-size: 0.78rem;
  line-height: 1.35;
  background: #f8fafc;
}

html.tool-embed .measurement-secondary-btn {
  margin-top: 0;
  width: 178px;
  min-height: 34px;
  font-size: 0.8rem;
  font-weight: 600;
}

html.tool-embed .measurement-output-actions {
  justify-content: flex-start;
  margin-top: 12px;
}

html.tool-embed .measurement-add-btn {
  flex: 0 0 178px;
  width: 178px;
  min-height: 34px;
  margin-top: 0;
  padding: 0 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: none;
}

html.tool-embed .measurement-add-btn:hover {
  background: #eff6ff;
  color: var(--ink);
}

html.tool-embed .measurement-summary-card {
  position: sticky;
  top: 8px;
}

html.tool-embed .measurement-summary-result {
  margin-top: 8px;
  border-color: var(--line-soft);
  background: #f8fafc;
}

html.tool-embed .tool-result-card.highlight {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--ink);
}

html.tool-embed .tool-result-card.highlight .label {
  color: var(--soft);
}

html.tool-embed .measurement-output-actions .btn {
  width: 136px;
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.8rem;
  font-weight: 600;
}

html.tool-embed .measurement-title-field {
  flex: 1 1 260px;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin: 0;
}

html.tool-embed .measurement-title-field span {
  color: var(--soft);
  font-size: 0.9rem;
}

html.tool-embed .measurement-title-field input {
  min-height: 30px;
  border-color: transparent;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 650;
}

html.tool-embed .measurement-title-field input:focus {
  border-color: #bfdbfe;
  background: #fff;
  padding: 0 8px;
}

html.tool-embed .measurement-type-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.28fr) minmax(150px, 0.72fr);
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

html.tool-embed .measurement-type-row label {
  margin: 0;
}

html.tool-embed .measurement-input-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 8px;
}

html.tool-embed .measurement-input-grid.secondary,
html.tool-embed .measurement-input-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html.tool-embed .measurement-position-formula {
  margin-top: 3px;
  color: var(--soft);
}

html.tool-embed .tool-detail-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

html.tool-embed .tool-info-aside,
html.tool-embed .measurement-aside .tool-form-card:not(.measurement-summary-card) {
  display: none;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
p { color: var(--muted); }

.container,
.container-narrow {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}
.container-narrow { width: min(820px, calc(100% - 40px)); }

.accent { color: var(--brand); }
.serif { font-family: Georgia, "Times New Roman", serif; font-style: italic; }
.section { padding: 64px 0; }

.mobile-menu-btn { display: none; }

.theme-toggle,
.mobile-menu-btn { display: none; }
.tool-calc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font: inherit;
  font-weight: 750;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.18);
}
.tool-calc-btn:hover { background: var(--brand-dark); color: white; }

.breadcrumb {
  padding: 24px 0 4px;
  color: var(--soft);
  font-size: 0.92rem;
  font-weight: 650;
}
.breadcrumb a { color: var(--soft); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { margin: 0 9px; color: #94a3b8; }
.breadcrumb .current { color: var(--ink); }

.tool-page-hero {
  padding: 70px 0 28px;
  text-align: center;
  background: var(--hero-soft-bg);
}
.tool-page-hero .container {
  display: grid;
  justify-items: center;
}
.tool-icon {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  margin-bottom: 18px;
  border: 1px solid rgba(219, 227, 239, 0.95);
  border-radius: 12px;
  background: white;
  box-shadow: var(--shadow);
  font-size: 2rem;
}
.tool-page-hero h1 {
  max-width: 780px;
  font-size: clamp(2rem, 3.2vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: 0;
}
.tool-page-hero p {
  max-width: 680px;
  margin-top: 18px;
  font-size: 1.04rem;
}

.tool-page-content { padding: 34px 0 70px; }

.tool-form-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
  padding: 28px;
}

.tool-form-card + .tool-form-card { margin-top: 18px; }
.tool-form-card label {
  display: block;
  margin: 14px 0 6px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}
.tool-form-card label:first-child { margin-top: 0; }

.tool-form-card input,
.tool-form-card select,
.tool-form-card textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
}
.tool-form-card textarea {
  min-height: 120px;
  padding-top: 12px;
}
.tool-form-card input:focus,
.tool-form-card select:focus,
.tool-form-card textarea:focus {
  outline: 3px solid rgba(37, 99, 235, 0.14);
  border-color: #9bb9f4;
}

.tool-field-row,
.tool-field-row-3 {
  display: grid;
  gap: 14px;
}
.tool-field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tool-field-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.tool-section-title {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 850;
}
.tool-muted { color: var(--muted); font-size: 0.95rem; }

.tool-toggle-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.tool-toggle-btn {
  min-height: 44px;
  border: 0;
  border-right: 1px solid var(--line);
  background: white;
  color: var(--muted);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.tool-toggle-btn:last-child { border-right: 0; }
.tool-toggle-btn.active {
  background: var(--brand);
  color: white;
}

.tool-calc-btn {
  width: 100%;
  min-height: 48px;
  margin-top: 20px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.tool-result {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}
.tool-result h3 {
  margin-bottom: 14px;
  color: var(--brand);
  font-size: 1rem;
}
.tool-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.tool-result-card {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  text-align: center;
}
.tool-result-card.highlight {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}
.tool-result-card .value {
  color: inherit;
  font-size: 1.35rem;
  font-weight: 850;
}
.tool-result-card .label {
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 750;
}
.tool-result-card.highlight .label { color: rgba(255, 255, 255, 0.82); }
.tool-result-detail { margin-top: 14px; color: var(--muted); font-size: 0.94rem; }
.tool-result-detail strong { color: var(--ink); }

.tool-result-tip,
.tool-result-warning {
  margin-top: 16px;
  padding: 13px 14px;
  border-radius: 8px;
  font-size: 0.92rem;
}
.tool-result-tip {
  border: 1px solid #bbf7d0;
  background: #ecfdf5;
  color: var(--muted);
}
.tool-result-tip strong { color: var(--green); }
.tool-result-warning {
  border: 1px solid #fed7aa;
  background: #fff7ed;
  color: var(--amber);
}

.tool-cta-banner {
  margin-top: 28px;
  padding: 28px;
  border-radius: 8px;
  background: #0f172a;
  color: white;
  text-align: center;
}
.tool-cta-banner h4 { font-size: 1.15rem; }
.tool-cta-banner p {
  margin: 8px auto 18px;
  max-width: 520px;
  color: #cbd5e1;
}
.tool-cta-banner a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  background: white;
  color: var(--brand);
  font-weight: 800;
}

.seo-text {
  padding: 64px 0;
  border-top: 1px solid var(--line-soft);
  background: white;
}
.seo-text-inner {
  width: min(760px, 100%);
  margin: 0 auto;
}
.seo-text-block + .seo-text-block { margin-top: 26px; }
.seo-text-block h2 {
  margin-bottom: 8px;
  font-size: 1.2rem;
}
.seo-text-block p { color: var(--muted); }

.more-tools {
  padding: 58px 0;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-soft);
}
.more-tools h3 {
  margin-bottom: 22px;
  text-align: center;
  font-size: 1.2rem;
}
.more-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.more-tools-card {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding: 22px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.05);
}
.more-tools-card:hover {
  border-color: #9bb9f4;
  color: var(--ink);
}
.more-tools-card .icon { font-size: 1.7rem; }
.more-tools-card .name { font-weight: 800; text-align: center; }

.cta-section {
  background: #0f172a;
  color: white;
}
.cta-inner {
  width: min(760px, 100%);
  margin: 0 auto;
  text-align: center;
}
.cta-inner h2 { font-size: clamp(1.7rem, 3vw, 2.5rem); }
.cta-inner p {
  margin-top: 14px;
  color: #cbd5e1;
}
.cta-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
}

.footer {
  padding: 34px 0;
  background: #0f172a;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  color: #cbd5e1;
  font-size: 0.9rem;
}
.footer a { color: #cbd5e1 !important; }
.footer a:hover { color: white !important; }
.footer-links {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.measurement-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
.tool-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
.measurement-aside,
.measurement-positions {
  display: grid;
  gap: 16px;
}
.tool-info-aside {
  display: grid;
  gap: 16px;
}
.measurement-positions { margin-top: 18px; }
.measurement-position-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}
.measurement-position-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.measurement-position-head strong { overflow-wrap: anywhere; }
.measurement-title-field {
  flex: 1 1 280px;
  display: flex !important;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0 !important;
}
.measurement-title-field span {
  color: var(--soft);
}
.measurement-title-field input {
  min-height: 36px;
  border-color: transparent;
  background: transparent;
  padding: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 750;
}
.measurement-title-field input:focus {
  border-color: #bfdbfe;
  background: #fff;
  padding: 0 10px;
}
.measurement-type-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.28fr) minmax(180px, 0.72fr);
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.measurement-type-row label {
  margin: 0;
}
.measurement-input-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.measurement-input-grid.secondary,
.measurement-input-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.measurement-position-tools,
.measurement-actions,
.measurement-output-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.measurement-position-tools button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}
.measurement-position-result {
  margin-top: 14px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 0.9rem;
}
.measurement-position-result strong { color: var(--ink); }
.measurement-position-formula {
  margin-top: 4px;
  color: var(--soft);
}
.measurement-summary-result {
  margin-top: 10px;
}
.measurement-add-btn { flex: 1 1 220px; }
.measurement-secondary-btn { margin-top: 20px; }
.measurement-output-actions {
  justify-content: center;
  margin-top: 20px;
}
.tool-copy-status {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}
.tool-faq-item {
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}
.tool-faq-item summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
}

@media (max-width: 920px) {
  .measurement-layout,
  .tool-detail-layout,
  .tool-field-row,
  .tool-field-row-3,
  .tool-result-grid,
  .more-tools-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .container-narrow { width: min(100% - 28px, 1160px); }
  .tool-page-hero {
    padding: 42px 0 18px;
    text-align: left;
  }
  .tool-page-hero .container { justify-items: start; }
  .tool-page-hero h1 { font-size: clamp(1.7rem, 6vw, 2rem); }
  .tool-form-card { padding: 20px; }
  .measurement-position-head,
  .measurement-actions,
  .measurement-output-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .measurement-position-tools button,
  .measurement-secondary-btn { width: 100%; }
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media print {
  .nav,
  .breadcrumb,
  .tool-cta-banner,
  .more-tools,
  .cta-section,
  .footer,
  .measurement-actions,
  .measurement-output-actions,
  .tool-copy-status {
    display: none !important;
  }
  body { background: white; }
  .container { width: 100%; }
  .tool-form-card,
  .measurement-position-card,
  .tool-result {
    border-color: #dbe3ef;
    box-shadow: none;
  }
  .measurement-layout {
    grid-template-columns: 1fr;
  }
  .measurement-aside {
    display: block !important;
    margin-top: 18px;
  }
  .measurement-aside .tool-form-card:not(.measurement-summary-card) {
    display: none !important;
  }
  .measurement-summary-card,
  .measurement-summary-result {
    display: block !important;
  }
}
