/* Brand / readability / layout corrections (works with bundled Tailwind). */
html { scroll-padding-top: calc(86px + env(safe-area-inset-top,0px)); }
body > header {padding-top:env(safe-area-inset-top,0px);}
body { font-family: Vazirmatn, Tahoma, system-ui, sans-serif; }
:root { color-scheme: light; --hero-bg:linear-gradient(135deg,#fff 0%,#f8fafc 58%,#fef3c7 100%);--promo-bg:linear-gradient(135deg,#fff,#f1f5f9,#eff6ff);--notice-text:#334155;--focus-ring:#92400e;--social-text:#9d174d;}
body.theme-dark { color-scheme:dark;--hero-bg:linear-gradient(135deg,#13233a,#0d1524 58%,#0a3029);--promo-bg:linear-gradient(135deg,#101c2d,#0c1523,#0c2932);--notice-text:#cbd5e1;}
body.theme-gold {color-scheme:dark;--hero-bg:linear-gradient(135deg,#282014,#17120b 60%,#302108);--promo-bg:linear-gradient(135deg,#201912,#16110d,#28200e);--notice-text:#ffdf92;}
body:is(.theme-dark,.theme-gold) {--focus-ring:#fbbf24;--social-text:#f9a8d4;}
.rt-brand-link {width:44px;height:44px;}
.text-pink-600 {color:var(--social-text);}
.rt-main {display:flex;flex-direction:column;gap:clamp(12px,1.25vw,18px);}
.rt-hero {
  background:radial-gradient(ellipse at top left,color-mix(in srgb,var(--gold-accent) 16%,transparent),transparent 58%),var(--hero-bg);
  box-shadow:inset 0 1px 0 var(--rt-highlight),0 12px 30px -22px #0f172a70;
}
.rt-hero {--rt-highlight:#fff;--rt-depth:#33415532;}
body:is(.theme-dark,.theme-gold) .rt-hero {--rt-highlight:#fff2;--rt-depth:#0009;}
.rt-overview {padding:clamp(14px,2vw,24px);display:grid;gap:12px;border-radius:20px;}
.rt-overview h1 {font-size:clamp(18px,3vw,32px);font-weight:900;line-height:1.55;}
.rt-overview h1 span {display:block;font-size:.62em;color:var(--text-muted);}
.rt-overview-heading,.rt-overview-actions {display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;}
.rt-overview-heading h2 {font-size:clamp(12px,1.4vw,15px);font-weight:800;}
.rt-overview-status {font-size:12px;padding:3px 8px;border-radius:8px;color:var(--text-main);background:var(--surface-card-subtle);}
.rt-overview-rates {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;}
.rt-overview-rate {
  display:grid;gap:4px;min-width:0;padding:9px 10px;border-radius:14px;
  color:var(--text-main);background:linear-gradient(150deg,var(--surface-card),var(--surface-card-subtle));
  box-shadow:inset 0 1px 0 var(--rt-highlight),0 3px 0 var(--rt-depth),0 8px 13px -8px var(--rt-depth);
}
.rt-overview-rate[href="#card-USD"] {--coin-face:linear-gradient(140deg,#d1fae5,#6ee7b7);}
.rt-overview-rate[href="#card-TRY"] {--coin-face:linear-gradient(140deg,#ffe4e6,#fda4af);}
.rt-overview-rate[href="#card-EUR"] {--coin-face:linear-gradient(140deg,#dbeafe,#93c5fd);}
.rt-rate-caption {display:flex;align-items:center;gap:6px;font-size:13px;font-weight:800;}
.rt-coin {
  display:grid;place-items:center;inline-size:25px;aspect-ratio:1;flex:none;border-radius:50%;
  background:radial-gradient(circle at 32% 15%,#fff9,transparent 55%),var(--coin-face);
  border:1px solid #fff9;box-shadow:inset 0 0 0 2px #fff6,0 2px 0 #0f172a5c;
  color:#192b3d;font:800 15px/1 system-ui,sans-serif;
}
.rt-overview-rate small {color:var(--text-muted);font-size:11px;line-height:1.5;}
.rt-overview-rate small[data-status="stale"] {color:var(--social-text);}
.rt-overview-rate strong {font-size:clamp(15px,3.9vw,27px);line-height:1.3;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;}
.rt-overview-rate:hover,.rt-trip-grid button:hover {border-color:var(--gold-accent);}
@media (prefers-reduced-motion:no-preference) {
  .rt-overview-rate {transition:transform .15s,box-shadow .15s,border-color .15s;}
  .rt-overview-rate:active {transform:translateY(2px);box-shadow:inset 0 1px 0 var(--rt-highlight),0 1px 0 var(--rt-depth);}
}
.rt-overview-actions {justify-content:flex-start;}
.rt-overview-actions a,.rt-tool-actions button {
  display:inline-flex;align-items:center;justify-content:center;min-height:44px;
  padding:6px 12px;border-radius:10px;font-size:13px;font-weight:800;
}
.rt-overview-actions .rt-overview-primary {background:#047857;color:#fff;box-shadow:0 2px 0 #065f46;}
.rt-overview-actions .rt-overview-primary:hover {background:#065f46;}
#topRatesAnchor > .grid,.rt-tool-body {padding:0 12px 12px;}
body.kiosk-mode #topRatesAnchor {background:none;border-color:transparent;}
body.kiosk-mode #topRatesAnchor > summary {display:none;}
body.kiosk-mode #topRatesAnchor > .grid {padding:0;}
.rt-converter,.rt-budget,.rt-tools,.rt-contact {
  padding:clamp(12px,2vw,22px);border-radius:20px;
}
:is(.rt-converter,.rt-budget,.rt-tools,.rt-contact) h2 {font-size:clamp(16px,1.6vw,21px);font-weight:900;}
.rt-section-head,.rt-converter-controls,.rt-calculation-actions,.rt-tool-actions,.rt-contact-content {
  display:flex;flex-wrap:wrap;align-items:center;gap:8px;
}
.rt-section-head {justify-content:space-between;margin-bottom:12px;}
.rt-switch {display:inline-flex;padding:3px;border-radius:12px;}
.rt-switch button {min-height:44px;padding-inline:8px;white-space:nowrap;}
.rt-switch button.rt-rate-mode:not([aria-pressed="true"]) {background:transparent;border-color:transparent;}
.rt-converter-currencies {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;}
.rt-converter-currencies button {min-height:44px;padding-inline:3px;font-size:13px;}
.rt-converter-amounts,.rt-route-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,270px),1fr));gap:10px;}
.rt-converter-amounts label {display:block;margin-bottom:4px;font-size:13px;font-weight:700;}
.rt-converter-amounts input {min-height:50px;padding-block:8px;}
.rt-calculation-actions {justify-content:space-between;}
.rt-calculation-actions button {min-height:44px;}
.rt-trip-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,135px),1fr));gap:8px;margin-top:10px;}
.rt-trip-grid button {display:grid;gap:3px;text-align:start;padding:10px;border-radius:12px;}
.rt-trip-grid strong {font-size:14px;}
.rt-trip-grid span,.rt-trip-grid bdi {font-size:12px;color:var(--text-muted);}
.rt-trip-grid bdi {text-align:right;font-weight:700;}
.rt-tools {display:grid;gap:8px;}
.rt-contact-content {justify-content:space-between;gap:12px;}
.mobile-bottom-dock {
  padding:0 max(8px,env(safe-area-inset-right,0px)) calc(8px + var(--safe-bottom)) max(8px,env(safe-area-inset-left,0px));
}
.rt-dock-panel {
  display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:3px;
  max-width:460px;margin-inline:auto;padding:4px;
  border:1px solid var(--dock-border);border-radius:19px;background:var(--dock-bg);
  box-shadow:0 5px 22px #0f172a33,inset 0 1px 0 #fff3;
  backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);
}
.rt-dock-item {
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  min-height:52px;min-width:0;padding:3px 1px;border-radius:13px;color:var(--text-main);
  font-size:clamp(10px,3.4vw,12px);font-weight:800;line-height:1.3;white-space:nowrap;
}
.rt-dock-item i {
  display:grid;place-items:center;width:29px;height:25px;border-radius:9px;
  font-size:17px;color:var(--gold-badge-text);background:var(--gold-badge-bg);
}
a.rt-dock-item:is(:hover,:active) {background:var(--surface-inset);}
.rt-dock-story {
  background:linear-gradient(145deg,#9d174d,#831843);color:#fff;
  box-shadow:0 2px 0 #650d34,inset 0 1px 0 #fff4;
}
.rt-dock-story i {background:#fff2;color:inherit;}
.rt-dock-story:active {background:#70133a;box-shadow:inset 0 1px 2px #0005;}
.rt-display-panel {display:flex;gap:6px;}
.rt-display-toggle {display:none;}
.rt-extra {border-radius:12px;}
.rt-extra > summary {cursor:pointer;min-height:44px;align-content:center;padding:8px 12px;font-size:13px;font-weight:800;}
.rt-extra > summary small {font-size:12px;color:var(--text-muted);}
.rt-extra-form {display:grid;gap:12px;padding:0 12px 12px;}
.rt-form-grid {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr));gap:12px;}
.rt-extra-form :is(label,legend) {font-size:13px;font-weight:700;}
.rt-extra-form :is(input,select) {display:block;width:100%;min-height:44px;padding:6px 8px;border-radius:8px;}
.rt-extra-form fieldset {min-width:0;display:grid;gap:8px;padding:8px;border:1px solid var(--border-card);border-radius:8px;}
.rt-extra-actions {display:flex;flex-wrap:wrap;gap:8px;}
.rt-extra-actions button {min-height:44px;padding:6px 12px;border-radius:8px;font-size:13px;font-weight:800;}
.rt-extra-actions button[type="submit"] {background:#047857;color:#fff;}
.rt-offer-result:not(:empty) {padding:8px;background:var(--surface-card-subtle);border-radius:8px;font-size:13px;line-height:1.8;white-space:pre-line;overflow-wrap:anywhere;}
.rt-promo {background:var(--promo-bg);}
.rt-rate-diagnostics {font-size:13px;font-weight:700;padding:12px 16px;border:1px solid var(--border-card);border-radius:14px;background:var(--surface-card-subtle);color:var(--text-main);line-height:1.9;}
.rt-rate-diagnostics:before {content:'●';color:#d97706;padding-inline-end:.6rem;}
.rt-terms {color:var(--text-muted);font-size:12px;line-height:2;}
.rt-terms a {text-decoration:underline;color:var(--gold-badge-text);}
body:is(.theme-dark,.theme-gold) .rt-terms a {color:var(--gold-accent);}
.rt-helper {font-size:12px;color:var(--text-muted);line-height:1.8;}
.rt-preview-canvas {display:block;max-width:100%;width:auto;height:auto;object-fit:contain;}
.rt-chart-empty {display:flex;align-items:center;justify-content:center;height:100%;font-size:12px;color:var(--text-muted);border:1px dashed var(--border-card);border-radius:10px;}
body.rt-modal-open {overflow:hidden;}
.rt-story-toggle {min-height:40px;font-size:12px;font-weight:700;white-space:normal;line-height:1.5;}
#lastUpdatedText {min-width:0;white-space:nowrap;line-height:1.4;}
#arbitrageVerdictCard{background:var(--surface-card-subtle);border-color:var(--border-card);}
#arbitrageVerdictCard #arbitrageVerdictText {color:var(--text-main);}
#storyCanvas {max-width:100%;}
input,select,textarea {font-size:16px;max-width:100%;}
button,a {touch-action:manipulation;}
:where(button,a,input,select,textarea,summary,[tabindex="0"]):focus-visible,
.rt-input:focus-visible,#tomanAmountInput:focus-visible {outline:3px solid var(--focus-ring);outline-offset:3px;}
#pwaModal [tabindex="0"]:focus-visible {outline-offset:-3px;}
:is(.rt-input,#tomanAmountInput)::placeholder {color:var(--text-muted);opacity:1;}
.rt-rate-mode[aria-pressed="true"]{color:#fff;background:#047857;border-color:#047857;}
:is(#copyBasketBtn,button[onclick^="copy"],button[onclick="downloadStoryImage()"]):disabled {opacity:.55;cursor:not-allowed;transform:none;}
#tomanAmountInput,#basketTotalTomanBox {background:#ecfdf5;border:2px solid #047857;}
#tomanAmountInput {color:#065f46;}
:is(.theme-dark,.theme-gold) :is(#tomanAmountInput,#basketTotalTomanBox){background:var(--surface-card-subtle);border-color:var(--border-card);}
:is(.theme-dark,.theme-gold) #tomanAmountInput {color:var(--text-main);}
.bg-emerald-600.text-white {background-color:#047857;}
.bg-emerald-600.text-white:is(button,a):hover:not(:disabled) {background-color:#065f46;}
.bg-sky-600.text-white {background-color:#0369a1;}
.bg-sky-600.text-white:is(button,a):hover:not(:disabled) {background-color:#075985;}
:is(.rt-social-cta,header button[onclick^="openShareModal("],.rt-story-actions button[onclick="copyStoryImageToClipboard()"]) {background:#9d174d;color:#fff;}
.rt-social-cta:hover {background:#831843;}
.theme-light :is(.rt-inset,.rt-card) .text-slate-500 {color:#475569;}
.rt-quote-warning {padding:8px;border-radius:8px;background:#fef3c7;color:#78350f;font-size:13px;font-weight:700;}
#arbitrageTehranDetails {white-space:pre-line;overflow-wrap:anywhere;}
.rt-field-error {font-size:12px;line-height:1.65;color:#9f1239;background:#fff1f2;border-radius:8px;padding:6px 8px;}
:is(.rt-input,#tomanAmountInput)[aria-invalid="true"]{border-color:#be123c;}
.rt-story-settings > summary,.rt-history > summary {cursor:pointer;padding:8px 12px;min-height:44px;align-content:center;font-size:13px;font-weight:800;}
.rt-history {margin-top:8px;border-radius:10px;}
.rt-history-scroll {max-height:220px;overflow:auto;}
.rt-history table {width:100%;text-align:start;font-size:12px;}
.rt-history :is(th,td) {padding:5px 8px;text-align:start;border-bottom:1px solid var(--border-card);}
.rt-story-actions {padding:8px 12px calc(8px + env(safe-area-inset-bottom,0px));background:var(--modal-card);border-top:1px solid var(--border-card);flex-shrink:0;}
#shareModal label:has(input[type="checkbox"]){min-height:44px;}
#shareModal input[type="checkbox"]{width:24px;height:24px;flex-shrink:0;}
i:has(> .rt-icon-fallback)::before {display:none;}
.rt-icon-fallback {font-family:system-ui,sans-serif;font-style:normal;}
:is(button[onclick^="handlePwaInstallClick("],button[onclick^="openCustomRatesModal("]) {min-height:44px;}
#shareModal,#customRatesModal,#pwaModal {padding-bottom:env(safe-area-inset-bottom,0px);}
#shareModal > div,#customRatesModal > div,#pwaModal > div {max-height:min(94dvh,950px);min-width:0;}
#dataSourceBadge.rt-stale {background:#fef3c7;color:#78350f;border-color:#d97706;}
#card-USD,#card-TRY,#card-EUR {min-width:0;}
#sell-price-USD,#sell-price-EUR,#sell-price-TRY{font-size:clamp(20px,3.2vw,34px);overflow-wrap:anywhere;}
#buy-price-USD,#buy-price-EUR,#buy-price-TRY{font-size:clamp(18px,2.4vw,25px);overflow-wrap:anywhere;}
body.theme-dark :is(.text-slate-900,.text-slate-800,.text-slate-700,.text-slate-600,.text-slate-500),body.theme-gold :is(.text-slate-900,.text-slate-800,.text-slate-700,.text-slate-600,.text-slate-500){color:var(--text-muted);}
body.theme-dark :is(.text-emerald-800,.text-emerald-700,.text-emerald-600),body.theme-gold :is(.text-emerald-800,.text-emerald-700,.text-emerald-600){color:#6ee7b7;}
body.theme-dark :is(.text-rose-800,.text-rose-700,.text-rose-600),body.theme-gold :is(.text-rose-800,.text-rose-700,.text-rose-600){color:#fda4af;}
body:is(.theme-dark,.theme-gold) :is(.text-sky-800,.text-sky-700,.text-sky-600,.text-blue-600,.text-indigo-700){color:#93c5fd;}
body.theme-dark :is(.text-amber-800,.text-amber-700,.text-amber-600),body.theme-gold :is(.text-amber-800,.text-amber-700,.text-amber-600){color:#fcd34d;}
body.theme-dark :is(.bg-white\/70,.bg-white),body.theme-gold :is(.bg-white\/70,.bg-white){background:var(--surface-card-subtle);}
body.theme-dark :is(.border-slate-200,.border-slate-300),body.theme-gold :is(.border-slate-200,.border-slate-300){border-color:var(--border-card);}
body.theme-dark :is(.bg-emerald-50\/80,.bg-emerald-50),body.theme-gold :is(.bg-emerald-50\/80,.bg-emerald-50){background:var(--surface-card-subtle);}
body.theme-dark #card-USD,body.theme-dark #card-TRY,body.theme-dark #card-EUR,
body.theme-gold #card-USD,body.theme-gold #card-TRY,body.theme-gold #card-EUR {border-color:var(--border-card)!important;}
body.theme-dark :is(.bg-amber-50,.bg-slate-50),body.theme-gold :is(.bg-amber-50,.bg-slate-50){background:var(--surface-card-subtle);}
body.theme-dark :is(.text-amber-900,.text-slate-900,.text-emerald-900),body.theme-gold :is(.text-amber-900,.text-slate-900,.text-emerald-900){color:var(--text-main);}
body.theme-dark .rt-hero p,body.theme-gold .rt-hero p{color:var(--text-muted);}
body.theme-dark .rt-hero strong,body.theme-gold .rt-hero strong{color:var(--text-main);}
body[data-rate-status=stale] .animate-ping,body[data-rate-status=expired] .animate-ping {animation:none;opacity:.35;}
@media (max-width:767px){
  .price-fluid-hero{font-size:clamp(24px,6.2vw,32px);}
  .price-fluid-sub{font-size:clamp(19px,5vw,25px);}
  #topRatesAnchor .grid{gap:12px;}
  #topRatesAnchor article {padding:14px;}
  #topRatesAnchor h3 {font-size:16px;}
  .rt-hero {padding:14px;}
  .rt-hero h1 {font-size:18px;line-height:1.85;}
  body > header > div{min-width:0;}
  .rt-terms{padding-bottom:20px;}
  #shareModal .rt-preview-canvas{max-height:330px;}
}
@media (max-width:767px), (pointer:coarse){
  :is(.rt-rate-mode,#presetChipsContainer button,button[onclick^="setArbitrageDollar("],button[onclick^="copySingleCurrencyRate("]){min-width:44px;min-height:44px;}
}
@media (max-width:1023px){
  .rt-header-social {display:none;}
}
@media (max-width:639px){
  html {scroll-padding-bottom:calc(84px + var(--safe-bottom));}
  body.pb-20 {padding-bottom:calc(80px + var(--safe-bottom));}
  header button[onclick^="openShareModal("]{display:none;}
  .rt-display-toggle {display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:0 8px;border-radius:12px;font-size:12px;font-weight:700;}
  .rt-display-panel {display:none;position:absolute;inset-inline-end:8px;top:100%;padding:8px;background:var(--surface-header);border:1px solid var(--border-card);border-radius:12px;box-shadow:0 8px 24px #0003;}
  .rt-display-toggle[aria-expanded="true"] + .rt-display-panel{display:flex;}
  .rt-display-panel #themeNameLabel{display:inline;}
  #shareModal .rt-preview-canvas {max-height:min(42dvh,300px);}
}
@media (max-width:379px){
  header .max-w-7xl {padding-inline:8px;gap:4px;}
  header .max-w-7xl > div:first-child {gap:4px;}
  header .max-w-7xl > div:last-child {gap:3px;}
  #refreshBtn,#digitToggleBtn,#themeToggleBtn {padding:6px;}
  #shareModal .grid-cols-4 {gap:3px;}
  .rt-story-toggle {padding-inline:3px;font-size:11px;}
  .rt-overview-rate{padding-inline:6px;}
  #topRatesAnchor article .space-y-2 {gap:7px;}
}
@media (max-width:319px){
  header .max-w-7xl {padding-inline:5px;gap:3px;}
  #lastUpdatedText {display:none;}
  .rt-overview-rates {grid-template-columns:minmax(0,1fr);gap:6px;}
  .rt-overview-rate {grid-template-columns:1fr minmax(0,1fr);align-items:center;min-height:44px;padding-inline:10px;}
  .rt-overview-rate strong {grid-column:2;grid-row:1 / span 2;text-align:left;}
}
@media (min-width:1440px){body.kiosk-mode main{max-width:100%!important;padding-inline:3vw;}body.kiosk-mode #topRatesAnchor .price-fluid-hero{font-size:clamp(30px,3vw,54px);}}
@media (max-height:520px){#shareModal > div,#customRatesModal > div,#pwaModal > div{max-height:98dvh;}body.kiosk-mode #kioskFloatingBar{font-size:12px;}}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important;scroll-behavior:auto!important;}}
/* Readable compact UI and actual touch targets */
[class~="text-[9px]"],[class~="text-[10px]"] {font-size:12px!important;line-height:1.55;}
[class~="text-[11px]"] {font-size:13px!important;line-height:1.55;}
body.theme-gold {--text-muted:#E8BF72;--text-soft:#DDAF59;}
body.theme-dark {--text-muted:#CBD5E1;--text-soft:#B3C4DA;}
body.theme-dark #dataSourceBadge:not(.rt-stale),body.theme-gold #dataSourceBadge:not(.rt-stale) {color:var(--text-main);}
@media (max-width:460px){
 header .max-w-7xl{height:64px;}
 header #lastUpdatedText{font-size:11px;}
 #countdownTimer{font-size:11px!important;}
}
.rt-card-source{font-size:11px;line-height:1.6;font-weight:700;color:var(--text-muted);overflow-wrap:anywhere;}

/* Final touch target correction: compact but usable on small phones. */
#refreshBtn,#digitToggleBtn,#themeToggleBtn,#kioskToggleBtn,
header button[onclick^="openCustomRatesModal("],header button[onclick^="openShareModal("]{
 min-height:44px;min-width:44px;justify-content:center;
}
#shareModal :is(button,input:not([type="checkbox"]),select),#customRatesModal :is(button,input,select),#pwaModal button{min-height:44px;}
#topRatesAnchor button[title="انتقال به ماشین‌حساب"]{min-height:44px;min-width:44px;}
@media (max-height:420px) and (orientation:landscape){
 .mobile-bottom-dock {display:none;}
 html {scroll-padding-bottom:0;}
 body.pb-20 {padding-bottom:0;}
 header button[aria-controls="shareModal"] {display:flex;}
 header button[aria-controls="shareModal"] > span {display:inline;}
}
