:root {
  color-scheme: light;
  --ink: #171a35;
  --body: #4c526b;
  --muted: #565d75;
  --brand: #5335c7;
  --brand-dark: #4026a7;
  --line: #e4e5ee;
  --soft: #f7f7fb;
  --paper: #fff;
  --radius: 18px;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--brand-dark); text-underline-offset: .18em; }
a:hover { color: var(--brand); }
:focus-visible { outline: 3px solid #725ce1; outline-offset: 4px; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.18; }
ul { padding-inline-start: 1.2rem; }
input, select, textarea { min-width: 0; }
.wrap { width: min(1140px, 100% - 64px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 10px; left: 10px; z-index: 10; padding: 12px 16px; background: var(--paper); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner { min-height: 71px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.brand { display: inline-flex; gap: 10px; align-items: center; width: max-content; max-width: 100%; color: var(--ink); font-size: 1.36rem; font-weight: 800; letter-spacing: -.055em; text-decoration: none; }
.brand > span:last-child > span { color: var(--brand); }
.brand-mark { width: 34px; height: 34px; flex: 0 0 auto; display: grid; grid-template-columns: repeat(2, 1fr); place-items: center; padding: 6px; border-radius: 10px; color: white; background: var(--brand); font-size: .78rem; font-weight: 750; letter-spacing: 0; line-height: .85; }
.header-inner nav { display: flex; gap: clamp(.16rem, 2vw, 1.15rem); align-items: center; }
.header-inner nav a { padding: 8px 11px; border-radius: 8px; color: var(--body); font-weight: 650; font-size: .95rem; text-decoration: none; }
.header-inner nav a:hover, .header-inner nav .current { color: var(--brand-dark); background: #f0edff; }

.home-main { padding-top: 32px; padding-bottom: 76px; }
.hero { min-height: 360px; display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; position: relative; overflow: hidden; isolation: isolate; padding: 49px clamp(28px, 5vw, 67px); border: 1px solid #e1dafa; border-radius: 26px; background: radial-gradient(ellipse at 90% 80%, #dce8ff 1%, transparent 56%), linear-gradient(110deg, #f9f7ff 2%, #eee8ff 66%, #ece9ff); }
.hero-copy { z-index: 1; }
.hero h1 { font-size: clamp(2.6rem, 5.4vw, 4.5rem); font-weight: 780; letter-spacing: -.073em; line-height: 1.01; }
.hero h1 .hero-accent, .hero h1 > span:first-child { color: var(--brand); }
.hero p { font-size: 1.05rem; max-width: 470px; color: var(--body); margin-top: 21px; line-height: 1.62; }
.primary, .secondary { min-height: 43px; display: inline-flex; justify-content: center; align-items: center; gap: 6px; border-radius: 9px; padding: 9px 15px; font-weight: 700; font-size: .94rem; text-decoration: none; line-height: 1.35; }
.primary { background: var(--brand); color: white; border: 1px solid var(--brand); }
.primary:hover { background: var(--brand-dark); color: white; }
.secondary { color: var(--ink); border: 1px solid #dcddea; background: white; }
.secondary:hover { border-color: #b7abec; background: #f7f4ff; color: var(--brand-dark); }
.hero-link { min-height: 47px; margin-top: 25px; padding-inline: 20px; box-shadow: 0 5px 11px #6647cb26; }

.hero-art { position: relative; min-height: 265px; width: 100%; max-width: 405px; margin-inline: auto; pointer-events: none; }
.hero-orb { position: absolute; inset: 8px 4px; border-radius: 50%; background-image: radial-gradient(#9283dc80 .9px, transparent .9px); background-size: 14px 14px; mask-image: radial-gradient(ellipse, #000 12%, #0008 46%, transparent 75%); }
.hero-device { position: absolute; top: 5px; left: 50%; width: 174px; height: 239px; padding: 12px; background: linear-gradient(155deg, #fffeff, #f1edff); border: 1px solid #fff; border-radius: 24px; box-shadow: 0 24px 46px #4f37ae39, inset 0 -3px 0 #d9d0fa; transform: translateX(-50%) rotate(-12deg); }
.device-screen { height: 64px; display: flex; flex-direction: column; justify-content: center; align-items: flex-end; padding: 6px 13px; background: linear-gradient(137deg, #5b41ad, #372476); color: #eee4ff; border-radius: 13px; font-variant-numeric: tabular-nums; }
.device-screen > span { font-size: .68rem; letter-spacing: .08em; }
.device-screen strong { display: flex; align-items: center; gap: 4px; color: white; font-size: 1.85rem; line-height: 1.04; }
.device-screen strong span { width: 2px; height: 20px; background: #ae9aee; }
.device-keys { margin-top: 9px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.device-keys span { display: grid; place-items: center; height: 30px; background: #ede7fc; color: #4a347f; border-radius: 7px; font-size: .83rem; font-weight: 750; }
.device-keys span:nth-child(4n) { background: #dcd0fa; }
.device-keys span:nth-child(15) { background: #6141c5; color: white; }
.float-tile { position: absolute; display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid #ffffffb0; border-radius: 15px; box-shadow: 0 9px 19px #5d4a9b1c; font-size: 1.65rem; font-weight: 750; }
.tile-percent { top: 26px; left: 7%; background: #cfc6ff; color: #4f35a4; transform: rotate(-14deg); }
.tile-times { top: 38px; right: 9%; background: #d8eaff; color: #3565a9; transform: rotate(14deg); }
.tile-divide { bottom: 38px; left: 10%; width: 40px; height: 40px; background: #d6f4ea; color: #237b67; transform: rotate(13deg); font-size: 1.35rem; }
.tile-plus { right: 5%; bottom: 47px; background: #eadcff; color: #6b48b7; transform: rotate(-11deg); }

.directory { margin-top: 51px; scroll-margin-top: 24px; }
.directory-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.directory-head h2 { font-size: clamp(2rem, 4vw, 2.6rem); letter-spacing: -.055em; }
.directory-head p { color: var(--body); margin-top: 7px; }
.search-wrap { position: relative; width: min(100%, 300px); flex: 0 0 min(32%, 300px); }
.search-wrap input { width: 100%; height: 45px; border: 1px solid #dcddea; border-radius: 10px; padding: 8px 11px 8px 39px; background: white; color: var(--ink); }
.search-wrap input::placeholder { color: #626781; }
.search-icon { position: absolute; left: 15px; top: 14px; width: 13px; height: 13px; border: 2px solid #666786; border-radius: 50%; pointer-events: none; }
.search-icon::after { content: ''; position: absolute; width: 7px; height: 2px; background: #666786; top: 9px; left: 8px; transform: rotate(45deg); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 29px; }
.filters button { min-height: 38px; border: 1px solid var(--line); border-radius: 100px; background: white; color: var(--body); padding: 6px 13px; font-size: .9rem; font-weight: 650; }
.filters button:hover { border-color: #b6a9e9; }
.filters button[aria-pressed='true'] { color: var(--brand-dark); border-color: #d5c9f9; background: #efeaff; }
.catalog-group { margin-top: 28px; scroll-margin-top: 24px; }
.catalog-group + .catalog-group { margin-top: 38px; }
.group-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.group-icon { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; font-size: 1.35rem; font-weight: 700; color: var(--brand-dark); background: #f1ebff; }
.group-heading h3 { font-size: 1.23rem; letter-spacing: -.025em; }
.group-heading p { color: var(--body); font-size: .92rem; margin-top: 3px; }
.group-count { color: var(--muted); font-size: .83rem; margin-left: auto; white-space: nowrap; }
.card-grid { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.tool-card { display: flex; align-items: flex-start; gap: 12px; min-height: 102px; height: 100%; padding: 15px 13px 14px 15px; background: #fff; border: 1px solid var(--line); border-radius: 13px; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.tool-card:hover { color: var(--ink); border-color: #b9a9ee; box-shadow: 0 5px 16px #3214730e; }
.tool-card h3, .tool-card h4 { margin: 3px 0 5px; font-size: .98rem; letter-spacing: -.018em; }
.tool-card p { font-size: .885rem; color: var(--body); line-height: 1.42; }
.tool-icon { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; font-size: 1.22rem; font-weight: 780; line-height: 1; }
.violet { background: #eee8ff; color: #5135ac; }
.blue { background: #e7ebff; color: #3e55a8; }
.sky { background: #e5f4ff; color: #2f5c86; }
.mint { background: #e4f7ee; color: #236756; }
.peach { background: #fff0e1; color: #8e4b25; }
.rose { background: #fce8f2; color: #963663; }
.card-chevron { margin-left: auto; align-self: center; color: #756798; font-size: 1.25rem; line-height: 1; }
.empty-state { padding: 28px; background: var(--soft); border: 1px solid var(--line); border-radius: var(--radius); }
.empty-state p { margin: 5px 0 13px; color: var(--body); }

.inner-main { padding-top: 27px; padding-bottom: 72px; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .92rem; }
.breadcrumb a { font-weight: 600; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.page-heading { display: flex; align-items: center; gap: 17px; margin: 23px 0 27px; }
.page-heading .tool-icon { width: 63px; height: 63px; border-radius: 16px; font-size: 1.8rem; }
.page-heading h1 { font-size: clamp(2rem, 5vw, 3.15rem); letter-spacing: -.06em; }
.page-heading p { color: var(--body); margin-top: 7px; font-size: 1.04rem; }
.calculator-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(245px, .41fr); gap: 19px; align-items: start; }
.calculator-card, .info-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 30px); box-shadow: 0 7px 24px #24224a06; }
.calculator-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.calculator-header h2 { font-size: 1.38rem; letter-spacing: -.027em; }
.example-button { min-height: 37px; font-size: .875rem; }
.mode-row { display: flex; flex-wrap: wrap; gap: 5px; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.mode-button { min-height: 39px; padding: 5px 10px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--body); font-size: .88rem; font-weight: 650; }
.mode-button:hover { color: var(--brand-dark); }
.mode-button[aria-pressed='true'] { color: var(--brand-dark); background: white; border-color: #dcd6f3; box-shadow: 0 2px 4px #26146a0b; }
.calc-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.full-field, .field:only-child { grid-column: 1 / -1; }
.field label { display: block; font-size: .94rem; font-weight: 700; margin: 0 0 5px; }
.field input, .field textarea, .field select { width: 100%; border-radius: 8px; border: 1px solid #d8d9e7; background-color: #fff; color: var(--ink); padding: 10px 11px; }
.field input, .field select { min-height: 46px; }
.field textarea { display: block; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: #6a7088; }
.field select { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, #626581 50%), linear-gradient(135deg, #626581 50%, transparent 50%); background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field small { display: block; margin-top: 5px; font-size: .85rem; color: var(--body); }
.input-pair { display: flex; gap: 5px; }
.input-pair input { flex: 1 1 55%; }
.field .unit-select { width: auto; max-width: 52%; flex: 0 1 auto; }
.calc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 20px; }
.swap-button { margin-left: auto; }
.form-error { color: #8d2040; font-weight: 650; margin-top: 13px; }
[aria-invalid='true'] { border-color: #ac395b !important; }
.tips-card { background: #faf8ff; border: 1px solid #e5defb; padding: 19px; border-radius: var(--radius); }
.tips-title { display: flex; align-items: center; gap: 8px; }
.tips-title > span { font-size: 1.15rem; }
.tips-title h2 { font-size: 1.05rem; }
.tips-card ul { color: var(--body); font-size: .94rem; margin: 10px 0 0; }
.tips-card li + li { margin-top: 7px; }
.references { margin-top: 16px; padding-top: 13px; border-top: 1px solid #e5defb; }
.references h3 { font-size: .93rem; }
.references ul { list-style: none; padding: 0; }
.references a { overflow-wrap: anywhere; }
.result-card { margin-top: 20px; padding: 16px; border: 1px solid #d8cffa; background: #f5f1ff; border-radius: 12px; }
.result-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.result-top h3 { font-size: 1rem; }
.copy-button { min-height: 34px; padding: 5px 9px; font-size: .82rem; white-space: nowrap; }
.result-value { color: var(--brand-dark); margin-top: 5px; font-weight: 790; font-size: clamp(1.45rem, 4vw, 2rem); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.equation { margin-top: 4px; color: var(--ink); }
.result-notes { margin: 8px 0 0; color: var(--body); overflow-wrap: anywhere; }
.element-table { width: 100%; margin-top: 13px; border-collapse: collapse; font-size: .91rem; overflow-wrap: anywhere; }
.element-table caption { text-align: left; margin: 0 0 5px; font-weight: 700; }
.element-table td, .element-table th { text-align: left; border-top: 1px solid #dfd6f5; padding: 6px 5px; }

.faq-section, .related-section { margin-top: 37px; }
.faq-section { max-width: 800px; }
.faq-section h2, .related-section h2 { margin-bottom: 13px; font-size: 1.5rem; letter-spacing: -.03em; }
.faq-list { border: 1px solid var(--line); border-radius: 13px; }
.faq-list details + details { border-top: 1px solid var(--line); }
.faq-list summary { display: flex; align-items: center; gap: 11px; cursor: pointer; list-style: none; min-height: 52px; padding: 10px 14px; font-weight: 650; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary:hover { color: var(--brand-dark); }
.faq-list summary::after { content: '+'; margin-inline-start: auto; font-size: 1.22rem; font-weight: 600; color: var(--brand); }
.faq-list details[open] summary::after { content: '−'; }
.faq-list details p { padding: 0 20px 15px 43px; color: var(--body); }

.info-card { max-width: 850px; }
.info-card p { color: var(--body); margin-top: 7px; }
.info-card section + section { margin-top: 19px; }
.info-card h2 { font-size: 1.2rem; letter-spacing: -.018em; }
.info-links { margin-bottom: 0; }
.info-links li + li, .sitemap-grid li + li { margin-top: 5px; }
.sitemap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 16px; }
.sitemap-grid section + section { margin-top: 0; }
.sitemap-grid ul { margin-bottom: 0; }

.site-footer { border-top: 1px solid var(--line); background: #fafaff; padding: 35px 0 17px; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr .85fr 1fr; gap: 22px; }
.footer-grid h2 { font-size: .95rem; margin-bottom: 9px; }
.footer-grid p { color: var(--body); font-size: .9rem; max-width: 260px; margin-top: 10px; }
.footer-grid ul { margin: 0; padding: 0; list-style: none; }
.footer-grid li + li { margin-top: 6px; }
.footer-grid li a, .footer-bottom a { color: var(--body); text-decoration: none; font-size: .9rem; }
.footer-grid li a:hover, .footer-bottom a:hover { color: var(--brand-dark); text-decoration: underline; }
.footer-bottom { color: var(--muted); font-size: .85rem; margin-top: 26px; border-top: 1px solid var(--line); padding-top: 13px; display: flex; justify-content: space-between; gap: 10px; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1.2fr .8fr; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-times { right: 3%; }
  .tile-plus { right: 0; }
  .tile-percent, .tile-divide { left: 2%; }
}

@media (max-width: 650px) {
  .wrap { width: calc(100% - 36px); }
  .header-inner { min-height: 60px; gap: 5px; }
  .brand { font-size: 1.18rem; gap: 6px; }
  .brand-mark { width: 29px; height: 29px; padding: 5px; }
  .header-inner nav a { font-size: .84rem; padding: 7px 6px; }
  .home-main { padding-top: 19px; padding-bottom: 48px; }
  .hero { display: block; min-height: 0; padding: 29px 23px 24px; border-radius: 20px; }
  .hero h1 { font-size: clamp(2.4rem, 9vw, 3.4rem); }
  .hero p { margin-top: 13px; font-size: .98rem; }
  .hero-link { margin-top: 17px; }
  .hero-art { display: none; }
  .directory { margin-top: 30px; }
  .directory-head { flex-direction: column; align-items: stretch; gap: 13px; }
  .search-wrap { width: 100%; flex: auto; }
  .filters { margin: 12px 0 19px; gap: 6px; }
  .filters button { padding-inline: 9px; }
  .group-heading { flex-wrap: wrap; gap: 9px; }
  .group-heading p { font-size: .87rem; }
  .group-count { display: none; }
  .card-grid { grid-template-columns: 1fr; gap: 8px; }
  .tool-card { min-height: 76px; padding: 11px; }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .page-heading { align-items: flex-start; gap: 11px; }
  .page-heading .tool-icon { width: 44px; height: 44px; border-radius: 10px; font-size: 1.45rem; }
  .page-heading p { font-size: .96rem; }
  .calculator-layout { grid-template-columns: 1fr; gap: 12px; }
  .calc-fields { gap: 12px; }
}

@media (max-width: 430px) {
  .header-inner { flex-wrap: wrap; padding-block: 8px; }
  .calc-fields { grid-template-columns: 1fr; }
  .calculator-card, .info-card { padding: 15px; }
  .swap-button { margin-left: 0; }
  .field .unit-select { max-width: 45%; }
}

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