
:root {
  color-scheme: light;
  --ink: #142c38;
  --muted: #687981;
  --line: #dce6e8;
  --paper: #f2f6f6;
  --white: #fff;
  --accent: #d3f36b;
  --accent-dark: #86a83c;
  --sea: #1d7270;
  --danger: #b44148;
  --shadow: 0 16px 42px rgba(20, 44, 56, .075);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 92% 3%, rgba(201, 233, 221, .72) 0, transparent 31rem),
    radial-gradient(ellipse at 0 40%, rgba(255, 230, 207, .35) 0, transparent 27rem),
    var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", "Noto Sans", Tahoma, Arial, sans-serif;
  line-height: 1.55;
}
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid #1d9390;
  outline-offset: 3px;
}
button:disabled { opacity: .48; cursor: not-allowed; }
[hidden] { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 72px;
  padding: 12px clamp(18px, 5vw, 76px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(112deg, #102a36 0%, #173c47 58%, #1b514f 100%);
  color: #fff;
  box-shadow: 0 8px 26px rgba(14, 39, 49, .15);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid #e8ffa455; border-radius: 13px; background: linear-gradient(145deg, #e0ff88, #bce957); color: var(--ink); box-shadow: 0 4px 14px #c9f56630; font-size: 1.15rem; font-weight: 700; transition: transform .2s, box-shadow .2s; }
.brand:hover .brand-mark { transform: rotate(-5deg) scale(1.05); box-shadow: 0 6px 19px #c9f56655; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.02rem; letter-spacing: .3px; }
.brand small { color: #a9b8b5; font-size: .73rem; }
.top-actions { display: flex; align-items: center; gap: 15px; }
.offline-label { display: inline-flex; align-items: center; gap: 8px; color: #c5d0cd; font-size: .78rem; }
.offline-label i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px #d3f36b20, 0 0 12px #d3f36b80; }
.text-button, .install-button { border: 0; border-radius: 8px; padding: 8px 12px; color: #fff; background: transparent; font-size: .82rem; font-weight: 600; }
.text-button:hover { background: #ffffff18; }
.install-button { border: 1px solid #ffffff20; background: #ffffff12; transition: background .18s, color .18s, transform .18s, box-shadow .18s; }
.install-button:hover { transform: translateY(-1px); background: var(--accent); color: var(--ink); box-shadow: 0 6px 18px #c9f56625; }

main { max-width: 1030px; margin: auto; padding: 0 22px 34px; }
.intro { min-height: 238px; margin-top: 26px; padding: 37px clamp(22px, 5vw, 46px); position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 28px; border: 1px solid #ffffff26; border-radius: 23px; background: linear-gradient(116deg, #142f3b 0%, #1b4650 62%, #1d6460 100%); color: #fff; box-shadow: 0 20px 46px rgba(16, 48, 57, .17); }
.intro::after { content: ""; width: 310px; height: 310px; position: absolute; z-index: -1; inset-inline-end: 14%; top: -190px; border: 1px solid #ffffff16; border-radius: 50%; box-shadow: 0 0 0 32px #ffffff08, 0 0 0 66px #ffffff06; pointer-events: none; }
.eyebrow { margin: 0 0 12px; display: flex; align-items: center; gap: 9px; color: #c7d9d4; font-size: .79rem; font-weight: 700; }
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px #d3f36b; }
h1, h2, p { margin-top: 0; }
.intro h1 { margin: 0; font-size: clamp(2.15rem, 5vw, 3.35rem); line-height: 1.2; letter-spacing: -.8px; }
.intro-text { max-width: 520px; margin: 12px 0 0; color: #d1dfdc; font-size: .94rem; }
.intro-compare-link { min-height: 39px; margin-top: 16px; padding: 8px 13px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid #e8ffa455; border-radius: 10px; background: linear-gradient(110deg, #d7f477, #c2ed5c); color: #19333a; box-shadow: 0 5px 14px #9bbf3c24; font-size: .76rem; font-weight: 700; text-decoration: none; transition: transform .18s, box-shadow .18s, background .18s; }
.intro-compare-link::before { content: "↗"; font-size: 1rem; line-height: 1; }
.intro-compare-link:hover { transform: translateY(-2px); background: linear-gradient(110deg, #e2fb91, #c9f167); box-shadow: 0 8px 20px #9bbf3c35; }
.intro-compare-link:active { transform: translateY(0); }
.unit-setting { display: block; width: min(245px, 33%); flex: 0 0 auto; position: relative; z-index: 1; padding: 13px; border: 1px solid #ffffff22; border-radius: 15px; background: #ffffff0d; backdrop-filter: blur(10px); }
.unit-setting span { display: block; margin-bottom: 5px; color: #d1dfdc; font-size: .71rem; font-weight: 600; }
.unit-setting select { width: 100%; height: 43px; padding: 0 11px; border: 1px solid #ffffff40; border-radius: 9px; background: #f9fcfa; color: var(--ink); font-size: .79rem; transition: box-shadow .18s, border-color .18s; }
.unit-setting select:hover { border-color: var(--accent); box-shadow: 0 0 0 3px #d3f36b20; }

.categories-section, .catalog-section, .calculator-section, .results-section { margin-top: 24px; scroll-margin-top: 16px; }
.section-heading { margin-bottom: 13px; display: flex; align-items: center; gap: 12px; }
.section-heading > div { min-width: 0; }
.section-heading h2 { margin: 0; font-size: 1.06rem; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: .75rem; }
.step-number { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #cfe1dd; border-radius: 10px; background: linear-gradient(145deg, #fff, #e7f2ef); color: #267c77; box-shadow: 0 3px 9px #193b4310; font-size: .68rem; font-weight: 700; }
.category-list { overflow: hidden; border: 1px solid #d9e5e5; border-radius: 18px; background: var(--white); box-shadow: var(--shadow); }
.category-row { width: 100%; min-height: 78px; padding: 11px 16px; position: relative; display: grid; grid-template-columns: 39px minmax(0, 1fr) auto 15px; align-items: center; gap: 13px; border: 0; border-bottom: 1px solid #e9eeee; border-inline-start: 4px solid transparent; background: #fff; color: var(--ink); text-align: start; transition: background .2s, border-color .2s, transform .2s, box-shadow .2s; }
.category-row:last-child { border-bottom: 0; }
.category-row:hover, .category-row.is-selected { z-index: 1; background: linear-gradient(100deg, #f1f8f6, #fbfdf8); box-shadow: inset 0 0 0 1px #d7e9df; }
.category-row:hover { transform: translateY(-1px); }
.category-row:active, .select-profile:active, .custom-option:active, .save-result:active { transform: scale(.995); }
.category-row.is-selected { border-inline-start-color: var(--sea); }
.category-icon { width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid #e4ede8; border-radius: 12px; background: linear-gradient(145deg, #edf8f4, #e0f0eb); color: #236d69; font-size: 1rem; font-weight: 700; transition: transform .2s, background .2s, color .2s; }
.category-row:hover .category-icon { transform: scale(1.07) rotate(-3deg); background: #d8eee4; color: #15574f; }
.category-row:nth-child(2) .category-icon { background: linear-gradient(145deg, #eef2ff, #e4e9fa); color: #5967a0; }
.category-row:nth-child(3) .category-icon { background: linear-gradient(145deg, #fff3e8, #f9e9d8); color: #a56434; }
.category-row:nth-child(4) .category-icon { background: linear-gradient(145deg, #f2efff, #e9e3fa); color: #7564a7; }
.category-row:nth-child(5) .category-icon { background: linear-gradient(145deg, #fff0ef, #f9e2df); color: #ab5d58; }
.category-row:nth-child(6) .category-icon { background: linear-gradient(145deg, #eef6e5, #e3efd7); color: #607d3e; }
.category-copy strong, .category-copy small { display: block; }
.category-copy strong { font-size: .83rem; }
.category-copy small { margin-top: 2px; color: var(--muted); font-size: .69rem; }
.category-count { color: #8a9690; font-size: .66rem; white-space: nowrap; }
.category-arrow { color: #8da49e; font-size: 1.3rem; transition: color .18s, transform .18s; }
.category-row:hover .category-arrow { transform: translateX(3px); color: var(--sea); }

.catalog-section { margin-top: 19px; padding: 21px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); animation: rise-in .24s ease both; }
.catalog-heading { margin-bottom: 12px; }
.catalog-tools { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.search-box { min-height: 42px; width: min(100%, 430px); padding: 0 11px; display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 10px; background: #fbfdfc; color: #6f8d88; transition: border-color .18s, box-shadow .18s, background .18s; }
.search-box:focus-within { border-color: #63aaa1; background: #fff; box-shadow: 0 0 0 4px #54a89a1c; }
.search-box > span { font-size: 1.35rem; line-height: 1; }
.search-box input { width: 100%; min-width: 0; height: 40px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .79rem; }
.catalog-count { color: var(--muted); font-size: .68rem; white-space: nowrap; }
.profile-list { max-height: 390px; overflow: auto; border-top: 1px solid #e9eeee; scrollbar-color: #9ebdb5 transparent; scrollbar-width: thin; }
.profile-row { min-height: 61px; padding: 9px 9px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #edf1ef; border-radius: 8px; transition: background .16s, padding .16s; }
.profile-row:hover { padding-inline: 13px; background: #f5faf8; }
.profile-row { animation: rise-in .2s ease both; }
.profile-details { min-width: 0; }
.profile-details strong, .profile-details small { display: block; }
.profile-details strong { font-size: .81rem; }
.profile-details small { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; }
.select-profile { min-width: 82px; height: 35px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #cfe3dc; border-radius: 9px; background: linear-gradient(145deg, #fff, #f3f9f6); color: #205b57; font-size: .71rem; font-weight: 600; transition: background .16s, border-color .16s, transform .12s, box-shadow .16s; }
.select-profile:hover { transform: translateY(-1px); border-color: #8fc1b2; background: #eaf6f0; box-shadow: 0 4px 12px #1f665012; }
.select-profile span { font-size: 1.05rem; }
.no-results { padding: 15px 6px; color: var(--muted); font-size: .78rem; text-align: center; }
.custom-options { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.custom-option { min-height: 57px; padding: 9px 11px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 11px; background: linear-gradient(145deg, #fff, #f3f8f5); color: var(--ink); text-align: start; }
.custom-option:hover { transform: translateY(-2px); border-color: #9dc9bb; background: #edf7f2; box-shadow: 0 8px 18px #214c4110; }
.custom-option > span { font-size: .76rem; font-weight: 600; }
.custom-option strong { color: #65756a; font-size: .65rem; font-weight: 500; white-space: nowrap; }
.custom-option b { color: #267b6f; font-size: .95rem; }

.calculator-section { margin-top: 19px; }
.calculator-card { padding: 21px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); animation: rise-in .24s ease both; }
.selected-section { padding-bottom: 13px; display: flex; align-items: center; gap: 11px; border-bottom: 1px solid #edf0ed; }
.section-symbol { width: 39px; height: 39px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #2e5960; border-radius: 12px; background: linear-gradient(145deg, #1d4650, #132e3a); color: var(--accent); box-shadow: 0 5px 13px #122e3824; font-size: 1.05rem; }
.selected-section strong, .selected-section small { display: block; }
.selected-section strong { font-size: .91rem; }
.selected-section small { margin-top: 2px; color: var(--muted); font-size: .68rem; }
.dimension-fields { margin-top: 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.input-field { min-width: 0; }
.input-field span { display: block; margin-bottom: 5px; color: var(--muted); font-size: .67rem; }
.input-field input { width: 100%; height: 40px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; background: #f8fbfa; color: var(--ink); font-size: .8rem; transition: border-color .18s, box-shadow .18s, background .18s; }
.input-field input:hover { border-color: #a9c5be; }
.input-field input:focus { border-color: #60a79d; background: #fff; box-shadow: 0 0 0 4px #54a89a1c; }
.calculation-feedback { margin-top: 10px; color: var(--danger); font-size: .72rem; }
.weight-result { margin-top: 14px; display: grid; grid-template-columns: 1fr 1.3fr; gap: 9px; }
.weight-result > div { min-height: 77px; padding: 11px 13px; display: flex; flex-direction: column; justify-content: space-between; gap: 5px; border: 1px solid #dcece5; border-radius: 11px; background: linear-gradient(145deg, #f4faf6, #eaf5ef); }
.weight-result > div:last-child { border-color: #204b52; background: linear-gradient(130deg, #173943, #1f5a5a); box-shadow: 0 7px 18px #17394322; }
.weight-result span { color: #627772; font-size: .69rem; }
.weight-result > div:last-child span { color: #c4d9d5; }
.weight-result strong { font-size: 1.05rem; direction: ltr; text-align: start; unicode-bidi: isolate; }
.weight-result > div:last-child strong { color: var(--accent); font-size: 1.2rem; }
.save-result { width: 100%; min-height: 45px; margin-top: 11px; border: 0; border-radius: 10px; background: linear-gradient(100deg, #d7f477, #c2ed5c); color: #19333a; box-shadow: 0 5px 14px #9bbf3c24; font-size: .8rem; font-weight: 700; }
.save-result:hover:not(:disabled) { transform: translateY(-1px); background: linear-gradient(100deg, #e2fb91, #c9f167); box-shadow: 0 8px 20px #9bbf3c35; }

.results-section { margin-top: 20px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); animation: rise-in .24s ease both; }
.results-heading { margin-bottom: 11px; }
.clear-button { margin-inline-start: auto; color: var(--muted); font-size: .7rem; }
.results-list { border-top: 1px solid #edf0ed; }
.result-row { min-height: 58px; padding: 9px 2px; display: grid; grid-template-columns: minmax(0, 1fr) auto 30px; align-items: center; gap: 12px; border-bottom: 1px solid #edf0ed; }
.result-row > div { min-width: 0; }
.result-row > div strong, .result-row > div small { display: block; }
.result-row > div strong { font-size: .76rem; }
.result-row > div small { margin-top: 2px; color: var(--muted); font-size: .66rem; }
.result-value { font-size: .78rem; white-space: nowrap; direction: ltr; }
.remove-result { width: 30px; height: 30px; border: 1px solid transparent; border-radius: 9px; background: #fbefed; color: #a26761; font-size: 1rem; transition: background .16s, color .16s, transform .16s; }
.remove-result:hover { transform: rotate(5deg); background: #f8dfda; color: var(--danger); }
.grand-weight { margin-top: 12px; padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; border: 1px solid #d8e9df; border-radius: 11px; background: linear-gradient(110deg, #eff8f2, #f7fae9); }
.grand-weight span { color: #58716a; font-size: .74rem; }
.grand-weight strong { color: var(--ink); font-size: 1rem; direction: ltr; }

.trust-strip { margin-top: 23px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-around; flex-wrap: wrap; gap: 13px; border: 1px solid #dce8e4; border-radius: 15px; background: linear-gradient(110deg, #edf5f2, #f5f7ed); box-shadow: 0 7px 19px #183a3510; }
.trust-strip > div { display: flex; align-items: center; gap: 8px; }
.trust-mark { color: #286e68; font-size: .72rem; font-weight: 700; }
.trust-strip > div > span:last-child { color: #758078; font-size: .67rem; }
.disclaimer { margin: 13px 2px 0; color: #78837c; font-size: .67rem; }
.footer { min-height: 56px; padding: 15px clamp(16px, 5vw, 76px); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; background: linear-gradient(112deg, #102a36, #173c47 62%, #1b514f); color: #c3d2d0; font-size: .68rem; }
.footer a { color: #d9f48d; text-decoration: none; transition: color .16s; }
.footer a:hover { text-decoration: underline; }
.toast { position: fixed; z-index: 20; inset-inline-start: 50%; bottom: max(20px, env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 9px; background: var(--ink); color: #fff; box-shadow: var(--shadow); font-size: .78rem; opacity: 0; pointer-events: none; transform: translate(-50%, 10px); transition: opacity .2s, transform .2s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
[dir="ltr"] .top-actions { direction: ltr; }
[dir="rtl"] .category-arrow, [dir="rtl"] .select-profile span { transform: scaleX(-1); }
@keyframes rise-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 640px) {
  main { padding-inline: 15px; }
  .topbar { min-height: 64px; padding-inline: 14px; }
  .offline-label { display: none; }
  .top-actions { gap: 5px; }
  .intro { min-height: 0; padding-block: 34px 23px; display: block; }
  .intro h1 { font-size: clamp(2rem, 9vw, 2.7rem); }
  .unit-setting { width: 100%; margin-top: 18px; }
  .unit-setting select { height: 42px; }
  .category-row { min-height: 70px; padding: 9px 11px; grid-template-columns: 35px minmax(0, 1fr) 13px; gap: 10px; }
  .category-icon { width: 35px; height: 35px; }
  .category-count { display: none; }
  .category-copy strong { font-size: .77rem; }
  .category-copy small { font-size: .64rem; }
  .catalog-section, .calculator-card, .results-section { padding: 14px; }
  .catalog-tools { align-items: start; flex-direction: column; }
  .search-box { width: 100%; }
  .catalog-count { align-self: flex-end; }
  .profile-list { max-height: 330px; }
  .profile-row { gap: 7px; }
  .profile-details small { max-width: 220px; }
  .select-profile { min-width: 73px; padding-inline: 7px; }
  .dimension-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .weight-result { grid-template-columns: 1fr; }
  .weight-result > div { min-height: 68px; }
  .trust-strip { align-items: flex-start; flex-direction: column; padding-inline: 13px; }
  .footer { justify-content: flex-start; }
}
@media (max-width: 360px) {
  .brand { gap: 8px; }
  .brand-mark { width: 35px; height: 35px; }
  .brand strong { font-size: .93rem; }
  .install-button { padding-inline: 8px; font-size: .72rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* i18n flash guard and legal page */
html.i18n-pending body { visibility: hidden; }
.legal { max-width: 760px; margin: 0 auto; padding: 28px clamp(16px, 5vw, 32px) 60px; line-height: 1.7; }
.legal h1 { font-size: 1.6rem; margin: 0 0 6px; }
.legal h2 { font-size: 1.02rem; margin: 22px 0 4px; }
.legal p { margin: 0 0 8px; color: var(--muted); font-size: .86rem; }
.legal hr { margin: 36px 0; border: 0; border-top: 1px solid var(--line); }
.legal a { color: #205b57; }
.footer-link { color: #d9f48d; }
