/* ماشین‌حساب رزین — web version. Sizes follow the Android app (1dp = 1px, 1sp = 1px). */

@font-face { font-family: 'Vazirmatn FD'; font-weight: 400; font-display: swap; src: url(fonts/vazirmatn-fd-400.woff2) format('woff2'); }
@font-face { font-family: 'Vazirmatn FD'; font-weight: 500; font-display: swap; src: url(fonts/vazirmatn-fd-500.woff2) format('woff2'); }
@font-face { font-family: 'Vazirmatn FD'; font-weight: 700; font-display: swap; src: url(fonts/vazirmatn-fd-700.woff2) format('woff2'); }
@font-face { font-family: 'Vazirmatn FD'; font-weight: 800; font-display: swap; src: url(fonts/vazirmatn-fd-800.woff2) format('woff2'); }

:root {
  /* ManaGift Art brand palette (ui/Theme.kt) */
  --ground: #FAFAFA;
  --surface: #FFFFFF;
  --ink: #323232;
  --ink-soft: #4C4C4C;
  --muted: #66666B;
  --line: #E5E5E5;
  --primary: #643F69;
  --primary-tint: #EFE6F1;
  --primary-dark: #4E2F54;
  --unit-bg: #F7F1F8;
  --hardener-label: #4E2F54;
  --panel: #2E1F31;
  --panel-top: #48294D;
  --panel-muted: #D2C3D4;
  --panel-line: #4A3A4D;
  --panel-accent: #E6CFE9;
  --resin-label: #E9DCEB;
  --resin-on-dark: #8A5A90;
  --logo-bg: #5D2C7F;
  --card-tint: #F7F1F8;
  --card-tint-border: #EADCEC;
  --error: #B42318;
  --heart: #EF365C;
  --font: 'Vazirmatn FD', Tahoma, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--ground);
  color: var(--ink);
  font: 400 14px/1.6 var(--font);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
input { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-align: inherit; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- app shell ---------- */

#app {
  position: fixed; top: 0; left: 0; right: 0; height: 100%;
  max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--ground);
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
@media (min-width: 600px) { #app { box-shadow: 0 0 0 1px var(--line); } }
#screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.screen { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 4px 20px 16px; display: flex; flex-direction: column; gap: 16px;
}
.scroll > * { flex-shrink: 0; } /* cards with overflow:hidden would otherwise be squeezed */
.scroll.g14 { gap: 14px; }
.scroll.g18 { gap: 18px; }
.scroll.center { align-items: center; padding-top: 12px; }

/* ---------- icons (brand PNGs used as masks, tinted with currentColor) ---------- */

.ic {
  display: inline-block; flex: none; width: var(--s, 24px); height: var(--s, 24px);
  background-color: currentColor;
  -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat;
}
.ic.flip { transform: scaleX(-1); }
.i-back { --m: url(img/icons/back.png); }
.i-calculator { --m: url(img/icons/calculator.png); }
.i-close { --m: url(img/icons/close.png); }
.i-hardener-flask { --m: url(img/icons/hardener-flask.png); }
.i-help { --m: url(img/icons/help.png); }
.i-info { --m: url(img/icons/info.png); }
.i-resin-drop { --m: url(img/icons/resin-drop.png); }
.i-settings { --m: url(img/icons/settings.png); }
.i-shape-circle { --m: url(img/icons/shape-circle.png); }
.i-shape-ellipse { --m: url(img/icons/shape-ellipse.png); }
.i-shape-rectangle { --m: url(img/icons/shape-rectangle.png); }
.i-total-weight-jar { --m: url(img/icons/total-weight-jar.png); }
.i-volume-cube { --m: url(img/icons/volume-cube.png); }
.i-waste-percent { --m: url(img/icons/waste-percent.png); }
.i-weight-scale { --m: url(img/icons/weight-scale.png); }
.line-ic { flex: none; display: block; }

.badge { display: grid; place-items: center; flex: none; border-radius: 12px; background: var(--primary-tint); color: var(--primary); }

/* Press feedback in place of the Android ripple */
.tap { position: relative; overflow: hidden; }
.tap::after { content: ''; position: absolute; inset: 0; background: currentColor; opacity: 0; transition: opacity .15s; pointer-events: none; }
.tap:active::after { opacity: .08; transition: none; }

/* ---------- top bar ---------- */

.topbar {
  display: flex; align-items: center; gap: 12px; flex: none;
  padding: calc(14px + env(safe-area-inset-top)) 20px 10px;
}
.topbar.has-back { padding-inline-start: 8px; }
.back-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--ink); flex: none; }
.logo {
  flex: none; width: var(--s, 44px); height: var(--s, 44px); border-radius: calc(var(--s, 44px) * .27);
  background: var(--logo-bg) url(img/logo.svg) center / 100% no-repeat;
}
.topbar-text { flex: 1; min-width: 0; }
.topbar h1 { font-size: 20px; font-weight: 800; line-height: 1.35; }
.topbar.has-sub h1 { font-size: 22px; }
.topbar p { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ---------- text ---------- */

.label { font-size: 13px; font-weight: 500; color: var(--ink-soft); line-height: 1.5; }
.err { font-size: 12px; color: var(--error); line-height: 1.6; }
.help { font-size: 12px; color: var(--muted); line-height: 19px; }
.col { display: flex; flex-direction: column; }
.col.g6 { gap: 6px; }
.col.g8 { gap: 8px; }
.col.g10 { gap: 10px; }
.row { display: flex; align-items: center; }
.row.g8 { gap: 8px; }
.row.g10 { gap: 10px; }
.row.g12 { gap: 12px; }
.row.top { align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.t15b { font-size: 15px; font-weight: 700; line-height: 1.5; }
.t12m { font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ---------- cards ---------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card.tint, .tint-card { background: var(--card-tint); border: 1px solid var(--card-tint-border); }
.tint-card { border-radius: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; color: var(--primary); }
.card-head b { font-size: 15px; font-weight: 700; color: var(--ink); }

/* ---------- number field ---------- */

.nbox {
  display: flex; align-items: center; height: var(--h, 52px); min-width: 0;
  background: var(--bg, var(--surface)); border: 1.5px solid var(--line); border-radius: 14px; overflow: hidden;
  cursor: text;
}
.nbox.bad { border-color: var(--error); }
.nbox:focus-within { border-color: var(--primary); }
.nbox.bad:focus-within { border-color: var(--error); }
.nbox input {
  flex: 1; min-width: 0; height: 100%; padding: 0 14px; border: 0; background: transparent;
  font: 700 var(--fs, 18px) var(--font); color: var(--ink); text-align: left; direction: ltr;
  caret-color: var(--primary); -webkit-appearance: none; appearance: none; border-radius: 0;
}
.nbox input[readonly] { cursor: default; }
.nbox .lead { padding-inline-start: 12px; font-size: 13px; color: var(--muted); flex: none; }
.nbox .unit { align-self: stretch; display: grid; place-items: center; padding: 0 14px; background: var(--unit-bg); color: var(--primary); font-size: 13px; font-weight: 700; flex: none; direction: ltr; }
.clear-btn { width: 36px; height: 36px; margin-inline-start: 6px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex: none; }

.ratio { display: flex; align-items: center; gap: 8px; }
.ratio .nbox { flex: 1; }
.ratio .colon { font-size: 22px; font-weight: 800; color: var(--muted); line-height: 1; }

.waste { display: flex; align-items: center; gap: 8px; }
.waste .nbox { width: 104px; flex: none; --h: 48px; }
.chip {
  flex: 1; height: 46px; border-radius: 12px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 700; color: var(--ink-soft);
}
.chip.on { background: var(--primary-tint); border: 1.5px solid var(--primary); color: var(--primary); }

/* ---------- selectable tiles ---------- */

.segment {
  display: flex; gap: 5px; padding: 5px; border-radius: 18px;
  background: var(--card-tint); border: 1px solid var(--card-tint-border);
}
.segment button {
  flex: 1; height: 64px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); font-size: 13px; font-weight: 500; border: 1.5px solid transparent;
}
.segment button[aria-selected="true"] { background: var(--primary-tint); border-color: var(--primary); color: var(--primary); font-weight: 700; }

.tile {
  height: var(--h, 56px); border-radius: 14px; padding: 0 12px; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 15px; font-weight: 700;
}
.tile[aria-checked="true"] { background: var(--primary-tint); border: 1.5px solid var(--primary); color: var(--primary); }
.tiles { display: flex; gap: 10px; }
.tiles > * { flex: 1; min-width: 0; }

/* ---------- list rows ---------- */

.rowcard {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; color: var(--primary);
}
.listrow { display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; color: var(--primary); }
.rowcard .grow b, .listrow .grow b { display: block; font-size: 15px; font-weight: 700; color: var(--ink); line-height: 1.5; }
.rowcard .grow span, .listrow .grow span { display: block; font-size: 12px; color: var(--muted); line-height: 1.5; }
.chev { color: var(--muted); transition: transform .2s; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.divider { height: 1px; background: var(--line); margin: 0 16px; }

.shortcut { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px; background: var(--card-tint); border: 1px solid var(--card-tint-border); color: var(--primary); width: 100%; }
.shortcut .grow b { display: block; font-size: 15px; font-weight: 700; color: var(--ink); }
.shortcut .grow span { display: block; font-size: 12px; color: var(--muted); }

.primary-btn {
  width: 100%; height: 54px; flex: none; border-radius: 16px; background: var(--primary-dark); color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 15px; font-weight: 700;
}

/* ---------- result panel ---------- */

.result {
  flex: none; color: #fff; padding: 14px 16px; border-radius: 24px 24px 0 0;
  background: linear-gradient(var(--panel-top), var(--panel));
}
.result-full { display: flex; flex-direction: column; gap: 12px; }
.result-head { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; }
.result-head .badge { width: 34px; height: 34px; background: rgba(255,255,255,.12); color: #fff; }
.cards3 { display: flex; gap: 8px; }
.rcard { flex: 1; min-width: 0; border-radius: 16px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rcard .rl { font-size: 12px; white-space: nowrap; line-height: 1.5; }
.rcard .ru { font-size: 11px; line-height: 1.5; }
.rcard.total { background: rgba(255,255,255,.10); color: #fff; }
.rcard.total .rl, .rcard.total .ru { color: var(--panel-muted); }
.rcard.resin { background: var(--resin-on-dark); color: #fff; }
.rcard.resin .rl, .rcard.resin .ru { color: var(--resin-label); }
.rcard.hardener { background: var(--surface); color: var(--ink); }
.rcard.hardener .ic { color: var(--primary); }
.rcard.hardener .rl, .rcard.hardener .ru { color: var(--hardener-label); }
.fit { display: block; width: 100%; white-space: nowrap; overflow: hidden; text-align: center; font-weight: 800; line-height: 1.35; }
.details { display: flex; align-items: center; }
.dcell { display: flex; align-items: center; gap: 6px; padding: 0 6px; min-width: 0; color: var(--panel-muted); }
.dcell .grow span { display: block; font-size: 10px; white-space: nowrap; overflow: hidden; line-height: 1.5; }
.dcell .fit { text-align: start; font-weight: 700; color: #fff; }
.vsep { width: 1px; height: 30px; background: var(--panel-line); flex: none; }
.result-compact { display: none; gap: 8px; }
.cval { flex: 1; min-width: 0; text-align: center; }
.cval span { display: block; font-size: 11px; color: var(--panel-muted); }
body.kb .result { padding-top: 10px; padding-bottom: 10px; }
body.kb .result-full { display: none; }
body.kb .result-compact { display: flex; }

/* ---------- bottom navigation ---------- */

#nav {
  flex: none; display: flex; gap: 8px; background: var(--surface);
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -1px 0 rgba(0,0,0,.04), 0 -4px 12px rgba(0,0,0,.06); position: relative; z-index: 1;
}
#nav button {
  flex: 1; border-radius: 16px; padding: 8px 0; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); font-size: 12px; line-height: 1.5;
}
#nav button[aria-selected="true"] { background: var(--primary-tint); color: var(--primary); font-weight: 700; }
body.kb #nav { display: none; }

/* ---------- weight screen ---------- */

.intro { display: flex; align-items: center; padding: 16px; border-radius: 20px; background: var(--card-tint); border: 1px solid var(--card-tint-border); }
.intro h2 { font-size: 16px; font-weight: 800; color: var(--primary); line-height: 1.5; }
.intro p { font-size: 13px; color: var(--muted); line-height: 21px; }
.intro img { width: 118px; height: 118px; flex: none; }
.answer { display: flex; align-items: center; padding: 16px; border-radius: 16px; background: var(--card-tint); border: 1px solid var(--card-tint-border); }
.answer .grow { display: flex; flex-direction: column; align-items: center; }
.answer h3 { font-size: 15px; font-weight: 700; color: var(--primary); }
.answer .val { display: flex; align-items: flex-end; justify-content: center; max-width: 100%; }
.answer .val .fit { width: auto; max-width: 100%; color: var(--ink); }
.answer .val small { font-size: 14px; color: var(--muted); padding-bottom: 8px; white-space: pre; }

/* ---------- guide ---------- */

.hero { position: relative; height: 176px; border-radius: 20px; overflow: hidden; flex: none; }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: left center; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to right, transparent 0%, rgba(255,255,255,0) 38%, rgba(255,255,255,.85) 62%, rgba(255,255,255,.95) 100%); }
.hero .txt { position: absolute; z-index: 1; inset-block: 0; right: 0; width: 62%; padding: 18px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.hero h2 { font-size: 19px; font-weight: 800; color: var(--primary); line-height: 28px; }
.hero p { font-size: 12px; color: var(--ink-soft); line-height: 20px; }
.banner { display: block; width: 100%; border-radius: 20px; overflow: hidden; flex: none; }
.banner img { display: block; width: 100%; height: 100%; object-fit: cover; }

.acc { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.acc.open { border-color: var(--card-tint-border); }
.acc-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.tip { display: flex; gap: 10px; font-size: 13px; line-height: 23px; color: var(--ink-soft); }
.tip::before { content: ''; flex: none; width: 6px; height: 6px; margin-top: 9px; border-radius: 50%; background: var(--primary); }
.faq-q { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 0; border-radius: 10px; font-size: 14px; font-weight: 700; line-height: 22px; }
.faq-q .grow { color: var(--ink); }
.faq.open .faq-q .grow { color: var(--primary); }
.faq-a { padding-bottom: 10px; font-size: 13px; line-height: 23px; color: var(--ink-soft); }
.hr { height: 1px; background: var(--line); }

.paras { display: flex; flex-direction: column; gap: 8px; }
.paras p { font-size: 14px; line-height: 25px; color: var(--ink-soft); }
.about .paras p { line-height: 26px; }

.step { display: flex; gap: 12px; }
.step .num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--primary-tint); color: var(--primary); font-size: 15px; font-weight: 800; }
.step .grow { display: flex; flex-direction: column; gap: 8px; }
.step .grow > div:first-child b { display: block; font-size: 15px; font-weight: 700; line-height: 1.5; }
.step .grow > div:first-child span { display: block; font-size: 12px; color: var(--muted); line-height: 20px; }
.schip {
  height: 40px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 12px; font-weight: 700; min-width: 0;
}
.schip.icon { height: 58px; }
.schip.on { background: var(--primary-tint); border: 1.5px solid var(--primary); color: var(--primary); }
.minires { display: flex; gap: 6px; padding: 8px; border-radius: 16px; background: linear-gradient(var(--panel-top), var(--panel)); }
.minires > div { flex: 1; border-radius: 12px; padding: 8px 0; display: flex; flex-direction: column; align-items: center; }
.minires span { font-size: 11px; opacity: .8; }
.minires b { font-size: 18px; font-weight: 800; line-height: 1.4; }
.minires small { font-size: 10px; opacity: .8; }
.slab { height: 130px; border-radius: 14px; background: var(--card-tint); display: grid; place-items: center; }
.example .res { display: flex; gap: 8px; padding: 8px; border-radius: 14px; background: linear-gradient(var(--panel-top), var(--panel)); }
.example .res > div { flex: 1; border-radius: 10px; padding: 8px 0; display: flex; flex-direction: column; align-items: center; }
.example .res span { font-size: 12px; opacity: .8; }
.example .res b { font-size: 17px; font-weight: 800; line-height: 1.5; }
.kv { display: flex; justify-content: space-between; font-size: 13px; }
.kv span { color: var(--muted); }
.kv b { font-weight: 700; }
.note { font-size: 13px; line-height: 22px; color: var(--ink-soft); }

/* ---------- about ---------- */

.app-icon { width: 88px; height: 88px; display: block; border-radius: 27%; }
.about-name { text-align: center; }
.about-name h2 { font-size: 24px; font-weight: 800; line-height: 1.4; }
.about-name p { font-size: 13px; color: var(--muted); }
.about .card, .about .tint-card { width: 100%; }
.sign { align-self: flex-end; text-align: left; padding-top: 4px; }
.sign b { display: block; font-size: 15px; font-weight: 800; color: var(--primary); }
.sign span { font-size: 12px; color: var(--muted); }
.made { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); }
.made b { color: var(--primary); }
.site { padding: 12px 22px; border-radius: 14px; background: var(--card-tint); border: 1px solid var(--card-tint-border); font-size: 14px; font-weight: 700; color: var(--primary); direction: ltr; }

/* ---------- dialogs, sheets, toast ---------- */

.scrim { position: fixed; inset: 0; z-index: 10; background: rgba(0,0,0,.32); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .15s; }
.scrim.sheet-scrim { align-items: flex-end; padding: 0; }
.dialog { width: 100%; max-width: 360px; background: var(--surface); border-radius: 28px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog h2 { font-size: 20px; font-weight: 700; }
.dialog p { font-size: 14px; color: var(--ink-soft); line-height: 1.7; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog .actions button { padding: 10px 14px; border-radius: 20px; font-size: 14px; }
.sheet {
  width: 100%; max-width: 560px; background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; animation: rise .2s ease-out;
}
.sheet h2 { font-size: 18px; font-weight: 800; color: var(--primary); }
.sheet p { font-size: 14px; color: var(--ink-soft); line-height: 1.7; }
.sheet ol { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.sheet li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; line-height: 1.7; }
.sheet li .num { width: 28px; height: 28px; font-size: 13px; }
.share-ic { display: inline-block; vertical-align: -4px; color: #0A84FF; }
.toast {
  position: absolute; z-index: 5; left: 16px; right: 16px; bottom: calc(84px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 16px; padding-inline-start: 16px;
  border-radius: 16px; background: var(--primary-dark); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,.2); animation: rise .2s ease-out;
}
.toast b { flex: 1; font-size: 14px; }
.toast button { padding: 8px 14px; border-radius: 12px; background: #fff; color: var(--primary); font-size: 14px; font-weight: 700; }
body.kb .toast { display: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
