:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-dark: #1e40af;
  --border: #e2e8f0;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", "Noto Sans", "Noto Sans CJK SC",
    "Noto Sans CJK TC", "Noto Sans JP", "Noto Sans KR", "PingFang SC",
    "PingFang TC", "Hiragino Sans", "Hiragino Kaku Gothic ProN",
    "Yu Gothic", "Meiryo", "Malgun Gothic", "Apple SD Gothic Neo",
    system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

:lang(zh-Hans),
:lang(zh-Hans) * {
  font-family: "Noto Sans CJK SC", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Heiti SC", system-ui, -apple-system, sans-serif;
}

:lang(zh-Hant),
:lang(zh-Hant) * {
  font-family: "Noto Sans CJK TC", "PingFang TC", "Microsoft JhengHei",
    "Heiti TC", system-ui, -apple-system, sans-serif;
}

:lang(ja),
:lang(ja) * {
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic",
    "Meiryo", system-ui, -apple-system, sans-serif;
}

:lang(ko),
:lang(ko) * {
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic",
    system-ui, -apple-system, sans-serif;
}

:lang(ar),
:lang(ar) * {
  font-family: "Noto Sans Arabic", "Noto Naskh Arabic", "Amiri",
    system-ui, -apple-system, sans-serif;
}

.fa,
.fa-solid,
.fa-regular,
.fa-brands,
[class^="fa-"],
[class*=" fa-"] {
  font-family: "Font Awesome 7 Free" !important;
}

h2 {
  margin: 20px 0 12px;
}

h3 {
  margin: 18px 0 10px;
}

p {
  margin: 8px 0 16px;
}

.hover-zoom-in {
    /* cursor: zoom-in; */
    background: linear-gradient(145deg, #2a2a2a, #383838);
    border: 2px solid #3f51b5;
    transition: all 0.3s ease;
}

.hover-zoom-in:hover {
    transform: scale(1.02);
}

.hover-box-shadow {
  /* transition: box-shadow .3s; */
}

.hover-box-shadow:hover {
  box-shadow: 0 0 11px rgba(33,33,33,.2); 
}

.hover-underline {
  position: relative;
  display: inline-block;
}

.hover-underline::after,
.hover-underline::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, var(--accent), rgba(195, 207, 207, 0.2));
  bottom: 2px;
  left: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease-out;
}

.hover-underline::before {
  top: 2px;
  transform-origin: right;
}

.hover-underline:hover::after,
.hover-underline:hover::before {
  transform: scaleX(1);
}

.hover-flip {
  transition: transform 0.5s ease;
  transform-style: preserve-3d;
}

.hover-flip:hover {
  transform: rotateY(180deg);
}

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

img {
  max-width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 20px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  justify-content: space-between;
  flex-wrap: wrap;
}

.header-menu {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-left: auto;
  min-width: 0;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 4px;
  width: 32px;
  height: 32px;
  font-size: 1.15rem;
  cursor: pointer;
}

.embed-category-menu {
  position: relative;
  margin-left: auto;
}

.embed-category-menu .menu-toggle {
  display: inline-flex;
}

.embed-category-menu .header-menu {
  display: none;
}

.embed-category-menu .header-menu.is-open {
  display: flex;
  position: absolute;
  right: 0;
  top: 40px;
  width: 190px;
  margin-top: 0;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 30;
}

.menu-category-button {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

.menu-category-button:hover,
.menu-category-button.is-active {
  background: var(--soft);
  color: var(--text);
}
.lang-switcher select {
  padding: 4px 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  font-size: 0.65rem;
  font-weight: 400;
  width: 130px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.1rem;
  padding: 2px 0;
}

.hidden {
  display: none;
}

.honeypot-field {
  display: none;
}

.gtm-noscript-frame {
  display: none;
  visibility: hidden;
}

.nav-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
  padding: 2px 0;
}

.nav-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-links ul li {
  list-style: none;
  display: inline-block;
  padding: 0;
  margin: 0;
  a {
    position: relative;
    display: block;
    text-decoration: none;
    transition: .5s;
    z-index: 1;
    &:before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      border-top: 1px solid var(--accent);
      border-bottom: 1px solid var(--accent);
      transform: scaleY(1.3);
      opacity: 0;
      transition: .3s;
    }
    &:after {
      content: '';
      position: absolute;
      top: 1px;
      left: 0;
      width: 100%;
      height: 100%;
      background-color: var(--accent);
      transform: scale(0);
      opacity: 0;
      transition: .3s;
      z-index: -1;
    }
    &:hover {
      color: #fff;
      &:before {
        transform: scaleY(1);
        opacity: 1;
      }
      &:after {
        transform: scaleY(1);
        opacity: 1;
      }
    }
  }
}

/* .nav-links ul > li:hover {
  border-bottom: 1px solid #2563eb;
} */

.nav-links ul > li > a {
  color: var(--muted);
  font-size: 0.8rem;
  border-right: 1px solid #c4c5c7;
  padding: 0 6px;
}

.nav-links ul > li:last-child > a {
  border-right: none;
}

.main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 20px 40px;
}

.breadcrumb {
  margin: 0 0 8px;
  font-size: 0.72rem;
  color: var(--muted);
}

.breadcrumb ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.breadcrumb a {
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--muted);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
}

.embed .main {
  padding: 0;
}
.embed .converter-card {
  border-radius: 0;
  padding: 0px 8px;
  -webkit-box-shadow: none;
  -moz-box-shadow: none;
  box-shadow: none;
}

.embed .converter-title {
  font-size: 2.8vw;
}

.converter-card {
  background: var(--card);
  border-radius: 16px;
  padding: 0px 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(148, 163, 184, 0.15);
}

.converter-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin: 20px 0px 4px;
}

.eyebrow {
  margin-top: 0px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--muted);
}

.converter-title {
  margin: 8px 0 4px;
  font-size: 2rem;
}

.converter-subtitle {
  margin: 0;
  padding-bottom: 12px;
  font-size: 0.72rem;
  color: var(--muted);
}

.converter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas:
    "value swap result"
    "from swap2 to";
  gap: 10px;
  align-items: end;
  padding-bottom: 24px;
}

.converter-grid .value-field {
  grid-area: value;
}

.converter-grid .from-field {
  grid-area: from;
}

.converter-grid .swap-field {
  grid-area: swap;
}

.converter-grid .result-field {
  grid-area: result;
}

.converter-grid .to-field {
  grid-area: to;
}

.field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.field label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 4px;
}

.label-copy-button {
  line-height: 1.2;
}

.button-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.button-with-icon i {
  font-size: 0.9em;
}

.contact-form {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.contact-form .form-row {
  display: grid;
  gap: 8px;
}

.contact-form label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.contact-form textarea {
  resize: vertical;
  min-height: 140px;
}

.contact-form .primary-button {
  width: fit-content;
  padding: 12px 18px;
}

.contact-form .cf-turnstile {
  margin-top: 6px;
}

.contact-form .form-status {
  min-height: 1.2em;
  font-size: 0.92rem;
  color: var(--muted);
}

.contact-form .form-status.error {
  color: #b91c1c;
}

.contact-thanks {
  margin-top: 16px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: rgba(37, 99, 235, 0.06);
}

.contact-thanks h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.contact-thanks p {
  margin: 0;
  color: var(--muted);
}

.value-input,
.unit-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
  overflow: hidden;
}

select option:checked {
  background-color: rgba(75, 114, 192, 0.25);
}

.swap-label {
  height: 36px;
  visibility: hidden;
}

.swap-button {
  width: 36px;
  padding: 4px 4px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-size: 1.2rem;
  cursor: pointer;
}

.result {
  font-size: 1.5rem;
  font-weight: 600;
}

.primary-button,
.ghost-button {
  border-radius: 8px;
  padding: 10px 18px;
  border: none;
  cursor: pointer;
  font-weight: 300;
}

.small-button {
  padding: 6px 6px;
  font-size: 0.70rem;
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.equation-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.conversion-equation {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

@media (min-width: 1025px) {
  .converter-grid .unit-select[size] {
    height: auto;
    min-height: 170px;
    max-height: none;
  }
}

.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.ghost-button {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--border);
}

.notice {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--muted);
}

.content-grid {
  margin-top: 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
}

.category-cards {
  padding: 20px 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 20px;
}

.category-card {
  width: 300px;
  flex-grow: 2;
  background: var(--card);
  border-radius: 16px;
  padding: 20px 20px;
  border: 1px solid var(--border);
}

.content-cards {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.content-card {
  background: var(--card);
  border-radius: 16px;
  padding: 0px 20px;
  border: 1px solid var(--border);
}

.category-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-card-header h2 {
  margin: 0;
}

.category-icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.1);
  color: var(--accent-dark);
  flex-shrink: 0;
}

.category-card p {
  margin: 10px 0 14px;
}

.ad-slot {
  background: #fef3c7;
  border-radius: 16px;
  padding: 16px;
  border: 1px dashed #f59e0b;
  color: #92400e;
  font-size: 0.85rem;
}

.ad-slot.sticky {
  position: sticky;
  top: 100px;
}

.ad-inline {
  margin: 24px 0;
}

.ad-corner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 220px;
  z-index: 20;
}

.affiliate-card {
  background: #ecfeff;
  border-radius: 16px;
  padding: 16px;
  border: 1px solid #67e8f9;
  display: grid;
  gap: 8px;
}

.search-modal {
  display: flex;
  align-items: center;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 50;
  padding: 32px 16px;
  overflow-y: auto;
}

.modal-card {
  width: min(560px, 92vw);
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  max-height: 85vh;
  overflow: hidden;
}

.modal-scroll-area {
  max-height: calc(85vh - 130px);
  overflow-y: auto;
  padding: 0px 4px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  display: grid;
  gap: 12px;
}

.autocomplete {
  display: grid;
  gap: 6px;
}

.autocomplete button {
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.scroll-shadows {
  scrollbar-color: #EEE #FFF;

  background: /* Shadow covers */
  linear-gradient(white 30%, rgba(255, 255, 255, 0)), linear-gradient(rgba(255, 255, 255, 0), white 70%) 0 100%, /* Shadows */
  radial-gradient(50% 0, farthest-side, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0)), radial-gradient(50% 100%, farthest-side, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0)) 0 100%;
  background: /* Shadow covers */
  linear-gradient(white 30%, rgba(255, 255, 255, 0)), linear-gradient(rgba(255, 255, 255, 0), white 70%) 0 100%, /* Shadows */
  radial-gradient(farthest-side at 50% 0, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0)), radial-gradient(farthest-side at 50% 100%, rgba(0, 0, 0, .2), rgba(0, 0, 0, 0)) 0 100%;
  background-repeat: no-repeat;
  background-color: white;
  background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px;
  /* Opera doesn't support this in the shorthand */
  background-attachment: local, local, scroll, scroll;
}

.footer {
  padding: 20px 20px;
  text-align: center;
  color: var(--muted);
}

.footer p {
  margin: 8px 0 0;
  font-size: 0.75rem;
}

.footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer ul > li {
  display: inline-block;
  padding: 0;
  margin: 0;
}

.footer ul > li > a {
  color: var(--muted);
  font-size: 0.8rem;
  border-right: 1px solid #c4c5c7;
  padding: 0 8px;
}

.footer ul > li:last-child > a {
  border-right: none;
}

.footer a {
  color: var(--muted);
  text-decoration: none;
}

.footer-menu a:hover {
  color: var(--accent-dark);
}

*:focus-visible {
  outline: 1px solid rgba(64, 116, 219, 0.5);
  outline-offset: 1px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  box-shadow: 1px 1px 2px 2px rgba(105, 166, 221, 0.5);
}

@media (max-width: 1024px) {
  .hero,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .converter-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    grid-template-areas:
      "value from"
      "swap swap"
      "result to";
  }

  .converter-grid .swap-inline {
    justify-self: center;
    display: inline-block;
    height: 10px;
    margin-top: 15px;
    margin-left: 25px;
  }

  .ad-corner {
    position: static;
    width: 100%;
  }
  
  .swap-field {
    transform: rotate(90deg);
  }
 
  .hover-flip:hover {
   transform: rotateX(180deg);
  }
}

@media (max-width: 768px) {
  .menu-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .header-menu {
    display: none;
    order: 3;
    margin-left: 0;
    margin-top: 10px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  .header-menu.is-open {
    display: flex;
    position: fixed;
    right: 12px;
    top: 72px;
    width: 160px;
    margin-top: 0;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    z-index: 30;
  }

  .header-menu .nav-links {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .header-menu .lang-switcher {
    width: 100%;
  }

  .header-menu .lang-switcher select {
    width: 130px;
  }

  .nav-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .nav-links ul > li {
    display:list-item;
    padding: 5px 0;
    margin: 0;
  }

  .nav-links ul > li > a {
    color: var(--muted);
    font-size: 0.8rem;
    padding: 0 6px;
    border-right: none;
    a {
    position: relative;
    display: block;
    text-decoration: none;
    transition: .5s;
    z-index: 1;
    }
  }
}

@media (min-width: 769px) {
  .header-inner {
    flex-wrap: nowrap;
    align-items: flex-start;
  }

  .header-menu {
    flex: 1;
    align-items: flex-start;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .header-menu .nav-links {
    flex: 1;
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .converter-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "value"
      "from"
      "swap"
      "result"
      "to";
  }

  .converter-title {
    font-size: 1.6rem;
  }
}

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: white;
    color: black;
  }

  .site-header,
  .nav-links,
  .search-modal,
  .ad-slot,
  .affiliate-card,
  .button-row,
  .footer {
    display: none !important;
  }

  .converter-card,
  .content-card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}
