/* Refining Profit Calculator — dark UI. Original implementation. */
:root {
  --bg: #161719;
  --card: #1d1e21;
  --card-head: #212326;
  --card-alt: #1a1b1e;
  --field: #202226;
  --border: rgba(255, 255, 255, .09);
  --border-strong: #3a3f45;
  --text: #fdfdfd;
  --muted: rgba(255, 255, 255, .55);
  --blue: #0d6efd;
  --blue-dark: #0b5ed7;
  --green: #4cc12f;
  --red: #d9534f;
  --red-btn: #c13a47;
  --radius: 6px;
  --font: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.5 var(--font); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
h1, h2 { margin: 0; line-height: 1.2; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid #6ea8fe; outline-offset: 2px; }
.small { font-size: .8rem; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: 1440px; margin-inline: auto; padding-inline: 1.5rem; }
.skip-link { position: absolute; inset-inline-start: 1rem; top: -4rem; background: var(--blue); color: #fff; padding: .5rem 1rem; border-radius: 6px; z-index: 300; }
.skip-link:focus { top: .75rem; }

/* Top bar */
.topbar { background: #1b1c1f; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; min-height: 56px; gap: 1rem; }
.topbar__brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.1rem; letter-spacing: -.02em; text-decoration: none; padding: .4rem 0; }
.badge { font-size: .75rem; font-weight: 600; padding: .25rem .7rem; border-radius: 999px; }
.badge--sample { background: rgba(255, 193, 7, .14); color: #ffd25a; border: 1px solid rgba(255, 193, 7, .35); cursor: help; }

main.wrap { padding-block: 2rem 3rem; display: flex; flex-direction: column; gap: 1.5rem; }

/* Intro */
.intro h1 { display: flex; align-items: center; gap: .75rem; font-size: 2rem; font-weight: 700; text-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.intro__icon { border-radius: 50%; flex: none; }
.intro__text { margin-top: 1rem; max-width: 40rem; }
.alert { display: flex; align-items: center; gap: 1rem; margin-top: 1.25rem; padding: 1rem 1.1rem; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg); }
.alert[hidden] { display: none; }
.alert__icon { flex: none; }
.alert p { flex: 1; }
.alert__close { flex: none; border: 0; background: none; color: var(--muted); padding: 4px; border-radius: 4px; display: grid; }
.alert__close:hover { color: var(--text); }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.tab { flex: 0 0 auto; min-width: 200px; display: flex; align-items: center; justify-content: center; gap: .5rem; padding: .85rem 1.25rem; background: none; border: 1px solid transparent; border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; color: var(--muted); font-weight: 600; transition: background .2s, color .2s; }
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.tab.is-active { color: var(--text); background: var(--card); border-color: var(--border); box-shadow: inset 0 -2px 0 var(--blue); }
.tab img { border-radius: 5px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.card__head { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: .9rem 1.25rem; background: var(--card-head); border: 0; border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; text-align: start; }
.card.is-collapsed > .card__head { border-bottom-color: transparent; border-radius: var(--radius); }
.card__head--toggle:hover { background: #26282c; }
.card__head h2 { font-size: 1.15rem; font-weight: 600; }
.card__body { padding: 1.25rem; }
.card__body[hidden] { display: none; }
.card__title-sm { font-size: .95rem; font-weight: 600; margin-bottom: .9rem; }
.chev { transition: transform .25s; flex: none; color: var(--muted); }
.is-collapsed .chev { transform: rotate(180deg); }

.row-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.card--info { background: transparent; border-style: dashed; }
.info-list { margin: 0; padding-inline-start: 1.1rem; display: grid; gap: .4rem; color: var(--muted); font-size: .9rem; }

/* Mastery */
.mastery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.5rem; margin-top: .9rem; }

/* Fields and controls */
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field__label { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .9rem; }
.field__label--icon img { border-radius: 4px; }
.field.is-disabled .field__label { opacity: .5; }
.control, .mini { width: 100%; background: var(--field); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: .4rem .75rem; min-height: 40px; transition: border-color .15s, box-shadow .15s; }
.control:hover:not(:disabled):not([readonly]), .mini:hover { border-color: #5a6169; }
.control:focus, .mini:focus { outline: none; border-color: #6ea8fe; box-shadow: 0 0 0 3px rgba(13, 110, 253, .25); }
.control:disabled { opacity: .5; cursor: not-allowed; }
.control[readonly] { cursor: default; opacity: .9; }
select.control { appearance: none; padding-inline-end: 2.25rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23adb5bd' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' d='m2 5 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; background-size: 14px; }
select.control option { background: #1d1e21; }
.mini { min-height: 34px; padding: .25rem .6rem; text-align: center; font-size: .9rem; }
.info-btn { display: inline-grid; place-items: center; background: none; border: 0; padding: 0; color: var(--muted); border-radius: 50%; }
.info-btn:hover { color: var(--text); }

.select-dot { position: relative; }
.select-dot .dot { position: absolute; inset-inline-start: .85rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.select-dot .control { padding-inline-start: 2rem; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.city { display: inline-flex; align-items: center; gap: .35rem; }

/* Switches */
.switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; min-height: 28px; width: fit-content; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__track { position: relative; width: 36px; height: 20px; border-radius: 999px; background: #2b2e33; border: 1px solid #4a4f56; transition: background .2s, border-color .2s; flex: none; }
.switch__track::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 14px; height: 14px; border-radius: 50%; background: #8d939b; transition: transform .2s, background .2s; }
.switch input:checked + .switch__track { background: var(--blue); border-color: var(--blue); }
.switch input:checked + .switch__track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .switch__track { outline: 2px solid #6ea8fe; outline-offset: 2px; }
.switch:hover .switch__track { border-color: #7a8088; }
.switch__text { color: rgba(255, 255, 255, .8); font-size: .95rem; }

/* Settings grid (12 columns) */
.settings { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem 1.5rem; }
.s2 { grid-column: span 2; }
.s3 { grid-column: span 3; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { min-width: 42px; height: 34px; padding: 0 .6rem; border-radius: var(--radius); background: transparent; border: 2px solid #4c5158; font-weight: 600; font-size: .85rem; transition: background .15s, border-color .15s, color .15s, transform .1s; }
.chip:hover { border-color: #8d939b; }
.chip:active { transform: scale(.94); }
.chip[aria-pressed="true"] { background: #2e3237; border-color: #2e3237; color: var(--muted); }
.chip[aria-pressed="true"]:hover { border-color: #5a6169; }

.city-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem 1.5rem; }
.sep { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .5rem .9rem; border-radius: var(--radius); border: 1px solid transparent; font-weight: 600; font-size: .9rem; transition: filter .15s, transform .1s, opacity .2s; }
.btn:hover:not(:disabled) { filter: brightness(1.12); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn--primary { background: #0f5bd8; border-color: #0f5bd8; }
.btn--secondary { background: #2e3237; border-color: #2e3237; }
.btn--danger { background: var(--red-btn); border-color: var(--red-btn); }
.btn kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 4px; background: rgba(255, 255, 255, .22); font: 600 .72rem var(--font); }
.btn.is-loading::after { content: ""; width: 12px; height: 12px; border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-status { margin-inline-start: .5rem; }

/* Material prices */
/* Material Prices: separate groups (products, raw, refined, hearts), each with its own header and card grid */
.mat-hint { margin-bottom: 1.25rem; }
.mat-groups { display: flex; flex-direction: column; gap: 2rem; }
.mat-group__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .5rem 1.5rem; padding-bottom: .65rem; margin-bottom: .9rem; border-bottom: 1px solid var(--border); }
.mat-group__head h3 { font-size: 1.02rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: .6rem; }
.mat-group__head h3::before { content: ""; width: 4px; height: 1.05em; border-radius: 3px; background: var(--group, var(--blue)); }
.mat-group__sub { margin: .1rem 0 0; }
.mat-group__meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; color: var(--muted); }
.mat-group__city { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .65rem; border: 1px solid var(--border); border-radius: 999px; background: rgba(255, 255, 255, .03); }
.mat-group--products { --group: #4cc12f; }
.mat-group--raw { --group: #d9a441; }
.mat-group--refined { --group: #4aa3e8; }
.mat-group--hearts { --group: #e0556b; }
.mat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem 1rem; }
.mat { display: flex; align-items: flex-start; gap: .8rem; padding: .7rem .8rem; background: var(--card-alt); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; transition: border-color .15s, background .15s; }
.mat:hover { border-color: var(--border-strong); background: #1f2023; }
.mat__icon { border-radius: 8px; flex: none; margin-top: 2px; }
.mat__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .45rem; }
.mat__name { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; font-weight: 600; font-size: .88rem; line-height: 1.25; }
.mat__tier { font-size: .7rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; color: var(--tier-color, #b4915c); border: 1px solid var(--tier-color, #b4915c); background: rgba(255, 255, 255, .03); }
.mat__line { display: flex; align-items: flex-start; gap: .75rem; }
.mat__price { flex: 0 0 92px; }
.mat__price .age { margin-top: 3px; text-align: start; line-height: 1.2; }
.mat__info { display: flex; flex-direction: column; gap: .15rem; font-size: .85rem; line-height: 1.3; min-width: 0; padding-top: .3rem; }
.mat__info strong { font-weight: 600; }

/* Results table */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table-wrap:focus-visible { outline-offset: 0; }
table.results { width: 100%; min-width: 0; border-collapse: collapse; font-size: .95rem; }
.results th { background: #212529; text-align: start; font-weight: 700; padding: .5rem; vertical-align: bottom; white-space: nowrap; line-height: 1.3; }
.results td { padding: .5rem; vertical-align: middle; background: rgba(255, 255, 255, .02); border-top: 1px solid rgba(255, 255, 255, .03); }
.results tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .045); }
.results tbody tr:hover td { background: rgba(255, 255, 255, .075); }
.results .sticky { position: sticky; inset-inline-start: 0; z-index: 2; background-clip: padding-box; }
.results th.sticky { background: #212529; }
.results td.sticky { background: #1e1f22; }
.results tbody tr:nth-child(even) td.sticky { background: #232427; }
.results tbody tr:hover td.sticky { background: #2a2c30; }
.item { display: flex; flex-direction: column; align-items: center; gap: .15rem; min-width: 52px; }
.item__icon { border-radius: 8px; cursor: help; }
.item__label { display: none; font-size: .7rem; color: var(--muted); font-weight: 600; }
.labels-on .item__label { display: block; }
.c-price, .c-qty { width: 130px; }
.c-price .age { text-align: start; line-height: 1.2; margin-top: 2px; }
.c-vol { font-size: .85rem; line-height: 1.4; }
.qty { display: flex; align-items: center; gap: .5rem; }
.qty .mini { width: 84px; text-align: start; }
.qty__icon { border-radius: 6px; }
.seg { display: inline-flex; background: #2a2d31; border: 1px solid var(--border); border-radius: var(--radius); padding: 2px; margin-bottom: .45rem; }
.seg[hidden] { display: none; }
.seg__btn { border: 0; background: none; color: var(--muted); padding: .1rem .6rem; border-radius: 4px; font-weight: 600; font-size: .8rem; }
.seg__btn:hover:not(:disabled) { color: var(--text); }
.seg__btn.is-active { background: #3a3e44; color: var(--text); }
.seg__btn:disabled { opacity: .4; cursor: not-allowed; }
.ings { display: flex; flex-wrap: wrap; gap: .4rem; }
.ing { display: inline-flex; align-items: center; gap: .4rem; padding: 3px 8px 3px 4px; background: #2a2d31; border: 1px solid var(--border); border-radius: var(--radius); font-size: .85rem; }
.ing img { border-radius: 5px; }
.ing--missing { border-color: rgba(217, 83, 79, .5); }
.stack-badge { align-self: center; font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: rgba(13, 110, 253, .2); color: #8bb9fe; }
.tip-dotted { border-bottom: 1px dashed currentColor; cursor: help; white-space: nowrap; padding-bottom: 1px; }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
.results tr.is-missing .item__icon { opacity: .6; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
.empty[hidden] { display: none; }

.foot { border-top: 1px solid var(--border); padding-block: 1.5rem; margin-top: 1rem; }

/* Tooltip */
.tooltip { position: fixed; z-index: 400; max-width: 280px; padding: .45rem .7rem; background: #0e0f11; color: #fff; border: 1px solid #3a3f45; border-radius: 6px; font-size: .78rem; line-height: 1.35; pointer-events: none; box-shadow: 0 6px 20px rgba(0, 0, 0, .5); animation: tipIn .12s ease; }
.tooltip[hidden] { display: none; }
@keyframes tipIn { from { opacity: 0; transform: translateY(3px); } }

/* Entrance animation for the cards */
.card, .tabs, .intro { animation: fadeUp .5s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }

/* Responsive */
@media (max-width: 1199px) {
  .s2 { grid-column: span 4; }
  .s3 { grid-column: span 6; }
  .hide-sm { display: none; }
  .mat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .city-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .row-split { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .wrap { padding-inline: 1rem; }
  main.wrap { padding-top: 1.25rem; gap: 1.1rem; }
  .intro h1 { font-size: 1.6rem; flex-wrap: wrap; }
  .tab { min-width: 130px; padding-inline: .8rem; }
  .s2 { grid-column: span 6; }
  .s3 { grid-column: span 12; }
  .mastery-grid { grid-template-columns: 1fr; }
  .mat-grid, .city-grid { grid-template-columns: 1fr; }
  .card__body { padding: 1rem; }
  .btn-row .btn { flex: 1 1 100%; justify-content: center; }
  .btn-status { margin-inline-start: 0; }
}
@media (max-width: 359px) {
  .s2 { grid-column: span 12; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Market source (live Data Project prices) */
.market-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem 1.5rem; margin-top: 1.25rem; align-items: start; }
.market-row__basis p { margin-top: .35rem; }
.market-status { margin-top: .9rem; color: var(--muted); }
.market-status--ok { color: #8fd37c; }
.market-status--stale, .market-status--ratelimited, .market-status--sample { color: #ffd25a; }
.market-status--error { color: #ff8b86; }
.market-status--loading::before { content: ""; display: inline-block; width: 11px; height: 11px; margin-inline-end: .5rem; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; vertical-align: -1px; animation: spin .7s linear infinite; }
.badge--live { background: rgba(76, 193, 47, .14); color: #8fd37c; border: 1px solid rgba(76, 193, 47, .4); cursor: help; }
.age--stale { color: #ffd25a; }
.age--old { color: #ff8b86; }
.btn.is-current { box-shadow: 0 0 0 2px rgba(110, 168, 254, .55); }
@media (max-width: 767px) { .market-row { grid-template-columns: 1fr; } }

.ing--crafted { border-color: rgba(13, 110, 253, .6); background: rgba(13, 110, 253, .12); }
.ing--transmuted { border-color: rgba(184, 104, 234, .6); background: rgba(184, 104, 234, .12); }

/* Header: navigation and server selector (like the reference page's top bar) */
.topbar__nav { display: flex; gap: 1.6rem; margin-inline-end: auto; margin-inline-start: 1.5rem; }
.topbar__nav a { color: var(--muted); font-weight: 500; font-size: .92rem; text-decoration: none; padding: .35rem 0; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.topbar__nav a:hover { color: var(--text); }
.topbar__nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--blue); }
.topbar__tools { display: flex; align-items: center; gap: .75rem; }
.control--sm { min-height: 34px; padding-block: .15rem; width: auto; min-width: 150px; font-size: .9rem; }
.badge.badge--live::before, .badge.badge--sample::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: .45rem; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.badge--live::before { animation: pulse 2s infinite; box-shadow: 0 0 0 0 currentColor; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } }
.badge { white-space: nowrap; }
@media (max-width: 1060px) {
  .topbar__inner { flex-wrap: wrap; padding-block: .4rem; }
  .topbar__nav { flex-wrap: wrap; gap: .3rem 1.2rem; margin-inline-start: 1rem; }
}
@media (max-width: 767px) {
  /* the page links stay reachable on phones: a wrapping row under the brand instead of being hidden */
  .topbar__nav { order: 3; width: 100%; margin-inline-start: 0; }
  .topbar__inner { flex-wrap: wrap; padding-block: .5rem; }
  .topbar__tools { margin-inline-start: auto; }
  .control--sm { min-width: 0; max-width: 150px; }
}
/* Phones: one column like the reference page */
@media (max-width: 575px) {
  .s2 { grid-column: span 12; }
  .settings { gap: .85rem; }
  .chip { min-width: 40px; height: 32px; }
}
@media (max-width: 767px) {
  .topbar__tools { width: 100%; margin-inline-start: 0; justify-content: space-between; }
  .topbar__tools .control--sm { flex: 1; max-width: none; }
}

/* Results table: compact on mid-size screens, one card per recipe on small ones, so no column is ever hidden */
@media (max-width: 1280px) {
  .results th, .results td { padding: .45rem .4rem; }
  .results { font-size: .88rem; }
  .qty__icon { display: none; }
  .qty .mini { width: 64px; }
  .ing { padding: 2px 6px 2px 3px; }
}
@media (max-width: 1060px) {
  .table-wrap { overflow-x: visible; }
  table.results, .results tbody { display: block; }
  .results thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .results tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem 1rem; padding: .9rem; margin-bottom: .8rem; background: rgba(255, 255, 255, .03); border: 1px solid var(--border); border-radius: var(--radius); }
  .results td, .results tbody tr:nth-child(even) td, .results tbody tr:hover td { display: block; background: none; border: 0; padding: 0; width: auto; }
  .results td::before { content: attr(data-label); display: block; margin-bottom: .2rem; color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
  .results .sticky { position: static; }
  .results td[data-label="Name"] { grid-column: 1 / -1; display: flex; align-items: center; gap: .75rem; }
  .results td[data-label="Name"]::before { margin: 0; }
  .results td[data-label="Recipe"] { grid-column: 1 / -1; }
  .results td[data-label="Volume (last 24 hours)"] { grid-column: 1 / -1; }
  .qty__icon { display: block; }
  .c-vol { white-space: normal; }
}
@media (max-width: 420px) { .results tbody tr { grid-template-columns: minmax(0, 1fr); } }
.market-status--cleared { color: #ffd25a; }
.mini::placeholder { color: rgba(255, 255, 255, .45); }

.topbar__logo { display: block; flex: none; border-radius: 10px; object-fit: cover; }

/* Right-to-left (Persian): things CSS cannot mirror by itself */
html[dir="rtl"] select.control { background-position: left .75rem center; }
html[dir="rtl"] .switch input:checked + .switch__track::after { transform: translateX(-16px); }
html[dir="rtl"] .alert__close { margin-inline-start: 0; }
html[dir="rtl"] .kbd, html[dir="rtl"] kbd { direction: ltr; }
html[dir="rtl"] .qty .mini, html[dir="rtl"] .mini { text-align: center; }
html[dir="rtl"] .ing b, html[dir="rtl"] .item__label { direction: ltr; unicode-bidi: isolate; }
html[dir="rtl"] .field__label--icon bdi { unicode-bidi: isolate; }
html[dir="rtl"] .city bdi, html[dir="rtl"] .mat-group__city bdi { unicode-bidi: isolate; direction: ltr; }
html[dir="rtl"] select.control { text-overflow: ellipsis; }
html[dir="rtl"] .tooltip { direction: rtl; text-align: start; }
html[dir="rtl"] .tooltip:lang(en) { direction: ltr; }
html[dir="rtl"] .topbar__brand span { direction: ltr; }
.mat__city { display: inline-flex; align-items: center; gap: .35rem; margin-top: -.2rem; }
.mat__city[hidden] { display: none; }
/* site version beside the logo */
.ver { display: inline-block; padding: .18rem .5rem; border-radius: 6px; background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .85); font-size: .75rem; font-weight: 600; letter-spacing: 0; line-height: 1.3; }
/* account button in the header + "N online" in the footer */
.authlink { display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .75rem; border-radius: 999px; border: 1px solid rgba(127, 127, 127, .4); color: inherit; font-size: .875rem; font-weight: 600; text-decoration: none; white-space: nowrap; line-height: 1.2; }
.authlink:hover { background: rgba(127, 127, 127, .15); }
.authlink--user { padding: .2rem .7rem .2rem .25rem; }
.authlink__av { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #0d6efd; color: #fff; font-size: .8rem; font-weight: 700; object-fit: cover; flex: none; }
.authlink__name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
.online { display: inline-flex; align-items: center; gap: .45rem; font-size: .8125rem; }
.online[hidden] { display: none; }
.online__dot { width: 8px; height: 8px; border-radius: 50%; background: #3fb950; box-shadow: 0 0 0 3px rgba(63, 185, 80, .22); }
.foot__online, .footer__online { margin: .35rem 0 0; }
.authlink__ic { flex: none; }
@media (max-width: 520px) { .authlink__name, .authlink__txt { display: none; } .authlink { padding: .35rem; } .authlink--user { padding: .2rem; } }
/* ---------- Item Price Details side panel ---------- */
.pin { display: flex; align-items: center; gap: .5rem; }
.pvbtn { flex: none; width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(255, 255, 255, .12); border-radius: 6px; background: #343a40; color: #d7dbe0; cursor: pointer; }
.pvbtn:hover { background: #444b52; color: #fff; }
.pvbtn:focus-visible { outline: 2px solid #6ea8fe; outline-offset: 2px; }
html.pv-open { overflow: hidden; }
.pv { position: fixed; inset: 0; z-index: 1000; }
.pv[hidden] { display: none; }
.pv__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); }
.pv__panel { position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: min(485px, 100vw); display: flex; flex-direction: column; background: #161719; border-inline-start: 1px solid rgba(255, 255, 255, .15); box-shadow: -12px 0 32px rgba(0, 0, 0, .45); animation: pv-in .18s ease-out; }
@keyframes pv-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pv__panel { animation: none; } }
.pv__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.1rem .6rem; }
.pv__head h2 { margin: 0; font-size: 1.35rem; font-weight: 700; }
.pv__x { width: 34px; height: 34px; border: 0; background: none; color: #fff; font-size: 1.7rem; line-height: 1; cursor: pointer; border-radius: 6px; }
.pv__x:hover { background: rgba(255, 255, 255, .1); }
.pv__body { flex: 1; overflow-y: auto; padding: .4rem 1.1rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.pv__item { display: flex; flex-direction: column; gap: .5rem; padding: .85rem; background: #202226; border: 1px solid rgba(255, 255, 255, .15); border-inline-start: 6px solid #d9d9d9; border-radius: 6px; }
.pv__ch { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.pv__cn { flex: 1; min-width: 0; }
.pv__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; min-width: 0; }
.pv__name--big { flex: 1; font-size: 1.1rem; }
.pv__ic { flex: none; width: 34px; height: 28px; display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .15); border-radius: 6px; background: #2b2f34; color: #cfd4da; cursor: pointer; padding: 0; }
.pv__ic:hover { background: #3a4047; color: #fff; }
.pv__fetch { display: flex; align-items: center; justify-content: center; gap: .4rem; width: 100%; padding: .4rem .8rem; border: 0; border-radius: 4px; font: inherit; font-weight: 700; font-size: .95rem; color: #fff; cursor: pointer; }
.pv__fetch:disabled { opacity: .6; cursor: wait; }
.pv__fetch--latest { background: #0d6efd; }
.pv__fetch--latest:hover:not(:disabled) { background: #0b5ed7; }
.pv__fetch--avg { background: #3b4046; }
.pv__fetch--avg:hover:not(:disabled) { background: #4a5057; }
.pv__fetch kbd { padding: 0 .4rem; border-radius: 4px; background: #e9ecef; color: #212529; font: 700 .8rem/1.4 inherit; }
.pv__refreshed { text-align: center; color: #6c757d; font-size: .9rem; padding-top: .2rem; }
.pv__sort { display: flex; flex-direction: column; gap: .4rem; }
.pv__sort label { font-weight: 700; font-size: 1.05rem; }
.pv .control { width: 100%; }
.pv__city { display: flex; flex-direction: column; gap: .7rem; }
.pv__city h3 { display: flex; align-items: center; gap: .5rem; margin: .2rem 0 0; font-size: 1.35rem; font-weight: 700; }
.pv__dot { display: inline-block; flex: none; width: 15px; height: 15px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); }
.pv__card { display: flex; flex-direction: column; gap: .8rem; padding: .85rem; background: #202226; border: 1px solid rgba(255, 255, 255, .15); border-radius: 6px; min-width: 0; }
.pv__q { color: #6c757d; font-size: .95rem; }
.pv__bl { font-size: 1rem; }
.pv__num { color: #51df3e; font-weight: 700; }
.pv__age { color: #6c757d; font-size: .95rem; }
.pv__use { width: 100%; padding: .5rem .8rem; border: 0; border-radius: 4px; background: #198754; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.pv__use:hover { background: #157347; }
.pv__use:focus-visible, .pv__fetch:focus-visible, .pv__ic:focus-visible, .pv__x:focus-visible { outline: 2px solid #6ea8fe; outline-offset: 2px; }
.pv__msg { margin: 0; padding: .6rem 0; }
.pv__msg--err { color: #f08a8a; }
@media (max-width: 560px) { .pv__panel { width: 100vw; border-inline-start: 0; } }

/* tooltips of the calculator: light box, like the reference */
.tooltip { z-index: 1100; background: #fff; color: #111; border: 0; font-size: .9rem; line-height: 1.4; text-align: center; white-space: pre-line; padding: .5rem .8rem; border-radius: 6px; max-width: 320px; }
html[dir="rtl"] .tooltip { text-align: center; }.tooltip--dark { background: #0e0f11; color: #fff; border: 1px solid #3a3f45; font-size: .9rem; }

/* ---------- about + FAQ text at the end of each page (also read by search engines) ---------- */
.seo-about { max-width: 920px; margin: 3rem auto 0; padding: 2rem 0 1rem; border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent); }
.seo-about h2 { margin: 0 0 .8rem; font-size: 1.35rem; font-weight: 700; }
.seo-about h3 { margin: 1.7rem 0 .6rem; font-size: 1.1rem; font-weight: 700; }
.seo-about p { margin: 0 0 .9rem; line-height: 1.85; opacity: .88; }
.seo-faq { margin: .5rem 0; border: 1px solid color-mix(in srgb, currentColor 18%, transparent); border-radius: 8px; background: color-mix(in srgb, currentColor 4%, transparent); }
.seo-faq summary { padding: .75rem 1rem; font-weight: 600; cursor: pointer; }
.seo-faq summary:focus-visible { outline: 2px solid #6ea8fe; outline-offset: 2px; }
.seo-faq p { margin: 0; padding: 0 1rem 1rem; }