/* ---------------------------------------------------------------
   Self-hosted fonts — Vazirmatn (SIL Open Font License 1.1)
   Subset to Persian + Latin, licence text in fonts/OFL.txt.
   Served from this host: no CDN call, works offline, cacheable.
   --------------------------------------------------------------- */
@font-face {
    font-family: Vazirmatn;
    src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: Vazirmatn;
    src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: Vazirmatn;
    src: url("../fonts/Vazirmatn-ExtraBold.woff2") format("woff2");
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: Vazirmatn;
    src: url("../fonts/Vazirmatn-Black.woff2") format("woff2");
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --accent: #9fe870;
    --accent-strong: #163300;
    --accent-soft: rgba(159, 232, 112, .18);
    --accent-ink: #163300;
    --accent-rgb: 159, 232, 112;
    --accent-tint-rgb: 199, 255, 173;
    --glow-two: #d7ffc5;
    --glow-two-dark: #234218;
    --glass-border: rgba(255, 255, 255, .72);
    --card-border: rgba(255, 255, 255, .72);
    --up: #2e9b56;
    --change-chip: #328150;
    --hover-veil: rgba(255, 255, 255, .55);
    --nav-veil: rgba(255, 255, 255, .45);
    --check: #4b9c55;
    --badge: #c0453f;
    --page: #f5fff1;
    --surface: rgba(255, 255, 255, .66);
    --surface-strong: rgba(255, 255, 255, .86);
    --border: rgba(22, 51, 0, .09);
    --text: #163300;
    --muted: #687563;
    --danger: #df625e;
    --shadow: 0 22px 60px rgba(38, 83, 22, .10);
    --radius: 24px;
    --scroll-track: transparent;
    --scroll-thumb: rgba(22, 51, 0, .18);
    --scroll-thumb-hover: rgba(22, 51, 0, .32);
}

* {
    box-sizing: border-box;
}

/* ---------------------------------------------------------------
   Scrollbars — themed, palette aware, never hidden where you need
   them. Firefox uses scrollbar-*, Chromium/Safari the ::-webkit
   rules; the transparent border + background-clip makes the thumb
   a slim pill instead of a full-width block.
   --------------------------------------------------------------- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--scroll-track);
}

::-webkit-scrollbar-thumb {
    background-color: var(--scroll-thumb);
    border: 3px solid transparent;
    border-radius: 999px;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--scroll-thumb-hover);
}

::-webkit-scrollbar-corner {
    background: transparent;
}

html {
    scroll-behavior: smooth;
    color-scheme: light;
}

body {
    margin: 0;
    min-height: 100vh;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: contain;
    touch-action: manipulation;
    background:
        radial-gradient(circle at 10% 5%, rgba(var(--accent-rgb), .25), transparent 28%),
        radial-gradient(circle at 90% 15%, rgba(var(--accent-tint-rgb), .25), transparent 28%),
        var(--page);
    color: var(--text);
    font-family: Vazirmatn, IRANSans, Tahoma, sans-serif;
    overflow-x: hidden;
    transition: background .35s ease, color .35s ease;
}

button,
input {
    font: inherit;
}

input,
.card-price strong,
.chart-price-row strong,
.history-value strong {
    -webkit-user-select: text;
    user-select: text;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    border: 0;
    cursor: pointer;
}

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

svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.page-glow {
    position: fixed;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    opacity: .35;
    z-index: -1;
}

.glow-one {
    top: 12%;
    right: -100px;
    background: var(--accent);
}

.glow-two {
    bottom: 5%;
    left: -120px;
    background: var(--glow-two);
}

.app-shell {
    width: min(1400px, calc(100% - 32px));
    margin: auto;
    padding: 20px 0 calc(120px + env(safe-area-inset-bottom));
}

.glass {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
    backdrop-filter: blur(28px) saturate(145%);
    -webkit-backdrop-filter: blur(28px) saturate(145%);
}

.topbar {
    position: sticky;
    top: calc(16px + env(safe-area-inset-top));
    z-index: 50;
    height: 72px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: var(--accent-strong);
    font-size: 21px;
    font-weight: 900;
    box-shadow: 0 10px 28px rgba(var(--accent-rgb), .3);
}

.brand-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.brand-text strong {
    font-size: 17px;
    letter-spacing: -.4px;
}

.icon-btn,
.close-btn {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(255,255,255,.55);
    color: var(--text);
    transition: .25s ease;
}

.icon-btn svg,
.close-btn svg {
    width: 20px;
    height: 20px;
}

.icon-btn:hover,
.close-btn:hover {
    background: var(--accent-soft);
    transform: translateY(-2px);
}

.toolbar {
    margin-top: 30px;
}

.search-box {
    height: 58px;
    border-radius: 19px;
    display: flex;
    align-items: center;
    padding: 0 17px;
    gap: 12px;
}

.search-box svg {
    width: 20px;
    opacity: .55;
}

.search-box input {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    min-width: 0;
}

.search-box input::placeholder {
    color: var(--muted);
}

.search-box kbd {
    min-width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: rgba(0,0,0,.05);
    color: var(--muted);
    font-size: 12px;
}

.category-row {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 15px 2px 4px;
}

.category-row::-webkit-scrollbar {
    display: none;
}

.category {
    flex: 0 0 auto;
    padding: 9px 16px;
    border-radius: 13px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    transition: .25s ease;
}

.category:hover {
    background: var(--hover-veil);
}

.category.active {
    background: var(--accent);
    color: var(--accent-strong);
    box-shadow: 0 8px 22px rgba(var(--accent-rgb), .22);
}

.market-section {
    margin-top: 28px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-heading h1 {
    margin: 0;
    font-size: 28px;
    letter-spacing: -1px;
}

.market-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}

.market-status i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 5px var(--accent-soft);
}

.market-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.market-card {
    position: relative;
    min-height: 188px;
    padding: 17px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--card-border);
    box-shadow: 0 15px 45px rgba(36,72,21,.07);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    cursor: pointer;
    overflow: hidden;
    transition: transform .25s ease, box-shadow .25s ease, border .25s ease;
}

.market-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 22px 50px rgba(36,72,21,.12);
    border-color: rgba(var(--accent-rgb), .5);
}

.market-card:active {
    transform: scale(.985);
}

.card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.asset-icon {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-size: 14px;
    font-weight: 900;
}

.asset-icon svg {
    width: 21px;
    height: 21px;
}

.favorite-btn {
    position: relative;
    z-index: 5;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: transparent;
    color: #98a08f;
}

.favorite-btn svg {
    width: 19px;
    height: 19px;
    transition: transform .25s cubic-bezier(.2,.8,.2,1), fill .25s ease, color .25s ease;
}

.favorite-btn.active {
    color: #e17b73;
}

.favorite-btn.active svg {
    fill: currentColor;
    transform: scale(1.22);
}

.favorite-btn.pop::after {
    content: "";
    position: absolute;
    inset: 5px;
    border: 2px solid #e17b73;
    border-radius: 50%;
    animation: heartBurst .45s ease forwards;
}

@keyframes heartBurst {
    0% {
        opacity: .8;
        transform: scale(.5);
    }
    100% {
        opacity: 0;
        transform: scale(1.7);
    }
}

.card-name {
    margin-top: 15px;
}

.card-name strong {
    display: block;
    font-size: 14px;
}

.card-name span {
    display: block;
    margin-top: 2px;
    font-size: 10px;
    color: var(--muted);
    direction: ltr;
    text-align: right;
}

.card-price {
    margin-top: 11px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 7px;
}

.card-price strong {
    font-size: 19px;
    letter-spacing: -.7px;
    direction: ltr;
}

.card-change {
    font-size: 10px;
    font-weight: 800;
    direction: ltr;
}

.card-change.up {
    color: var(--up);
}

.card-change.down {
    color: var(--danger);
}

.sparkline {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 10px;
    height: 38px;
    opacity: .45;
}

.sparkline path,
.sparkline polyline {
    stroke: var(--accent-ink);
    stroke-width: 2;
    fill: none;
}

.card-size-compact .market-card {
    min-height: 160px;
}

.card-size-compact .sparkline {
    display: none;
}

.card-size-compact .card-name {
    margin-top: 9px;
}

.card-size-large .market-card {
    min-height: 225px;
}

.card-size-large .asset-icon {
    width: 46px;
    height: 46px;
}

.card-size-large .asset-icon svg {
    width: 24px;
    height: 24px;
}

.card-size-large .card-price strong {
    font-size: 23px;
}

.show-more {
    width: 100%;
    margin-top: 16px;
    min-height: 56px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text);
    font-weight: 800;
    transition: .25s ease;
}

.show-more:hover {
    background: var(--surface-strong);
    transform: translateY(-2px);
}

.show-more svg {
    width: 17px;
    transition: transform .25s ease;
}

.show-more.open svg {
    transform: rotate(180deg);
}

.bottom-nav {
    position: fixed;
    z-index: 100;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(590px, calc(100% - 24px));
    min-height: 70px;
    padding: 7px;
    border-radius: 24px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.nav-item {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 18px;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    transition: .25s ease;
}

.nav-icon {
    position: relative;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
}

.nav-icon svg {
    width: 19px;
    height: 19px;
}

.nav-item.active {
    background: transparent;
    color: var(--accent-strong);
}

.nav-item:hover:not(.active) {
    background: var(--nav-veil);
}

.modal-layer {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    visibility: hidden;
    opacity: 0;
    transition: opacity .3s ease, visibility .3s ease;
}

.modal-layer.show {
    visibility: visible;
    opacity: 1;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 18, 4, .28);
    backdrop-filter: blur(8px);
}

.chart-panel,
.more-panel,
.settings-panel {
    position: relative;
    z-index: 2;
    width: min(760px, 100%);
    border-radius: 30px;
    background: var(--surface-strong);
    padding: 23px;
    transform: translateY(20px) scale(.97);
    transition: transform .35s cubic-bezier(.2,.8,.2,1);
}

.modal-layer.show .chart-panel,
.modal-layer.show .more-panel,
.modal-layer.show .settings-panel {
    transform: translateY(0) scale(1);
}

.modal-head,
.sheet-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.modal-head h2,
.sheet-title h2 {
    margin: 0;
    font-size: 24px;
}

#chartSubtitle {
    display: block;
    color: var(--muted);
    font-size: 11px;
    margin-top: 2px;
}

.chart-price-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 24px 0 18px;
}

.chart-price-row strong {
    font-size: 29px;
    direction: ltr;
}

.chart-price-row span {
    padding: 6px 9px;
    border-radius: 9px;
    background: var(--accent-soft);
    color: var(--change-chip);
    font-size: 11px;
    font-weight: 900;
}

.chart-price-row span.down {
    background: rgba(223, 98, 94, .14);
    color: var(--danger);
}

.range-row {
    display: flex;
    gap: 7px;
    margin-bottom: 15px;
}

.range-btn {
    padding: 8px 13px;
    border-radius: 11px;
    background: rgba(0,0,0,.035);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.range-btn.active {
    background: var(--accent);
    color: var(--accent-strong);
}

.chart-box {
    height: 310px;
    border-radius: 22px;
    overflow: hidden;
    background: rgba(255,255,255,.38);
}

.chart-box svg {
    width: 100%;
    height: 100%;
}

.chart-grid-line {
    stroke: currentColor;
    opacity: .07;
    stroke-width: 1;
}

.chart-area {
    fill: url(#chartGradient);
}

.chart-line {
    fill: none;
    stroke: var(--accent-ink);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.more-panel {
    width: min(530px, 100%);
    align-self: flex-end;
    margin-bottom: 8px;
}

.sheet-handle {
    width: 42px;
    height: 4px;
    border-radius: 20px;
    background: rgba(0,0,0,.12);
    margin: 0 auto 22px;
}

.more-list {
    display: grid;
    gap: 9px;
    margin-top: 20px;
}

.more-item {
    width: 100%;
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 13px;
    text-align: right;
    padding: 10px 12px;
    border-radius: 18px;
    background: rgba(255,255,255,.52);
    color: var(--text);
    transition: .2s ease;
}

.more-item:hover {
    background: var(--accent-soft);
    transform: translateX(-3px);
}

.more-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.more-icon svg {
    width: 19px;
}

.more-item > span:nth-child(2) {
    flex: 1;
}

.more-item strong,
.more-item small {
    display: block;
}

.more-item strong {
    font-size: 13px;
}

.more-item small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 10px;
}

.more-item b {
    font-size: 22px;
    color: var(--muted);
    font-weight: 400;
}

.small-layer {
    z-index: 400;
}

.settings-panel {
    width: min(580px, 100%);
}

.settings-content {
    margin-top: 24px;
}

.hidden {
    display: none !important;
}

.setting-block {
    padding: 17px 0;
    border-bottom: 1px solid var(--border);
}

.setting-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 13px;
}

.setting-label strong {
    font-size: 13px;
}

.setting-label span {
    color: var(--muted);
    font-size: 11px;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent-ink);
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.option-btn {
    min-height: 44px;
    border-radius: 13px;
    background: rgba(0,0,0,.035);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}

.option-btn.active {
    background: var(--accent);
    color: var(--accent-strong);
}

.palette-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.palette-btn {
    padding: 9px 5px;
    border-radius: 14px;
    background: rgba(0,0,0,.035);
    color: var(--muted);
    font-size: 10px;
}

.palette-btn i {
    display: block;
    width: 28px;
    height: 28px;
    margin: 0 auto 6px;
    border-radius: 10px;
    background: var(--palette);
}

.palette-btn[data-palette="green"] {
    --palette: #9fe870;
}

.palette-btn[data-palette="blue"] {
    --palette: #8bd8ff;
}

.palette-btn[data-palette="purple"] {
    --palette: #c7a5ff;
}

.palette-btn[data-palette="orange"] {
    --palette: #ffbd78;
}

.palette-btn.active {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.language-option,
.theme-option,
.contact-item {
    width: 100%;
    min-height: 65px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 13px;
    margin-bottom: 8px;
    border-radius: 17px;
    background: rgba(255,255,255,.52);
    color: var(--text);
    text-align: right;
}

.language-option > span:first-child,
.theme-option > span:first-child,
.contact-item > span:first-child {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--accent-soft);
}

.language-option .option-text,
.theme-option .option-text,
.contact-item .option-text,
.language-option div,
.theme-option div,
.contact-item div {
    flex: 1;
    min-width: 0;
}

.language-option strong,
.language-option small,
.theme-option strong,
.theme-option small,
.contact-item strong,
.contact-item small {
    display: block;
}

.language-option small,
.theme-option small,
.contact-item small {
    color: var(--muted);
    font-size: 10px;
    margin-top: 3px;
}

.language-option i.check {
    color: var(--check);
    font-style: normal;
    opacity: 0;
}

.language-option.active i.check {
    opacity: 1;
}

.theme-option.active {
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1.5px var(--accent);
}

.about-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.about-brand > div strong,
.about-brand > div small {
    display: block;
}

.about-brand small {
    color: var(--muted);
    margin-top: 2px;
    font-size: 10px;
}

.contact-list {
    display: grid;
    gap: 7px;
}

.contact-item {
    margin: 0;
    transition: .2s ease;
}

.contact-item:hover {
    background: var(--accent-soft);
}

body.dark {
    --page: #0c1109;
    --surface: rgba(24, 34, 21, .72);
    --surface-strong: rgba(27, 38, 23, .94);
    --border: rgba(255,255,255,.08);
    --text: #eff8ea;
    --muted: #a7b1a1;
    --shadow: 0 22px 60px rgba(0,0,0,.28);
    --accent-ink: var(--accent);
    --glass-border: rgba(255,255,255,.09);
    --card-border: rgba(255,255,255,.08);
    --up: #5fd08a;
    --change-chip: var(--accent);
    --hover-veil: rgba(255,255,255,.06);
    --nav-veil: rgba(255,255,255,.06);
    --check: var(--accent);
    --scroll-track: transparent;
    --scroll-thumb: rgba(var(--accent-rgb), .34);
    --scroll-thumb-hover: rgba(var(--accent-rgb), .58);
    color-scheme: dark;
}

body.dark {
    background:
        radial-gradient(circle at 10% 5%, rgba(var(--accent-rgb), .14), transparent 28%),
        radial-gradient(circle at 90% 15%, rgba(var(--accent-tint-rgb), .07), transparent 28%),
        var(--page);
}

body.dark .page-glow {
    opacity: .2;
}

body.dark .market-card {
    box-shadow: 0 15px 45px rgba(0,0,0,.28);
}

body.dark .market-card:hover {
    box-shadow: 0 22px 50px rgba(0,0,0,.38);
    border-color: rgba(var(--accent-rgb), .38);
}

body.dark .favorite-btn {
    color: #7d8a76;
}

body.dark .modal-backdrop {
    background: rgba(0, 0, 0, .55);
}

body.dark .sheet-handle {
    background: rgba(255,255,255,.16);
}

/* `:not(.active)` matters — `body.dark .range-btn` (0,2,1) outranks
   `.range-btn.active` (0,2,0) and would wipe the accent chip, leaving
   near-black text on a near-black background */
body.dark .search-box kbd,
body.dark .range-btn:not(.active),
body.dark .option-btn:not(.active),
body.dark .palette-btn:not(.active) {
    background: rgba(255,255,255,.06);
}

body.dark .more-item,
body.dark .language-option,
body.dark .theme-option,
body.dark .contact-item,
body.dark .chart-box {
    background: rgba(255,255,255,.045);
}

body.dark .icon-btn,
body.dark .close-btn {
    background: rgba(255,255,255,.06);
}

body.dark .glow-two {
    background: var(--glow-two-dark);
}

@media (max-width: 1180px) {
    .market-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .app-shell {
        width: min(100% - 20px, 680px);
        padding-top: 10px;
    }

    .topbar {
        top: 8px;
        height: 64px;
    }

    .toolbar {
        margin-top: 22px;
    }

    .market-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .market-card {
        min-height: 178px;
        padding: 13px;
        border-radius: 20px;
    }

    .asset-icon {
        width: 35px;
        height: 35px;
        border-radius: 11px;
        font-size: 12px;
    }

    .asset-icon svg {
        width: 18px;
        height: 18px;
    }

    .favorite-btn {
        width: 30px;
        height: 30px;
    }

    .card-name {
        margin-top: 11px;
    }

    .card-name strong {
        font-size: 12px;
    }

    .card-name span {
        font-size: 9px;
    }

    .card-price {
        margin-top: 8px;
        align-items: flex-end;
        flex-direction: column;
        gap: 3px;
    }

    .card-price strong {
        font-size: 16px;
    }

    .card-change {
        font-size: 9px;
    }

    .sparkline {
        height: 28px;
        bottom: 8px;
    }

    .section-heading h1 {
        font-size: 24px;
    }

    .market-status {
        font-size: 9px;
    }

    .chart-panel,
    .settings-panel {
        padding: 18px;
        border-radius: 25px;
    }

    .chart-box {
        height: 245px;
    }

    .chart-price-row strong {
        font-size: 24px;
    }

    .more-panel {
        border-radius: 25px;
        padding: 18px;
    }
}

@media (max-width: 430px) {
    .app-shell {
        width: calc(100% - 14px);
    }

    .brand-mark {
        width: 38px;
        height: 38px;
    }

    .brand-text strong {
        font-size: 15px;
    }

    .market-card {
        min-height: 170px;
    }

    .market-grid {
        gap: 8px;
    }

    .bottom-nav {
        bottom: 10px;
        width: calc(100% - 16px);
    }

    .nav-item {
        font-size: 9px;
    }

    .palette-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
/* ============================================================
   Additions
   ------------------------------------------------------------
   · icon sizing for the new line-icon set
   · empty state (history / no search result)
   · LTR layout for the English language
   ============================================================ */

.flag-badge svg,
.theme-option > span:first-child svg,
.contact-item > span:first-child svg {
    width: 20px;
    height: 20px;
    color: var(--accent-ink);
}

.flag-badge svg {
    width: 22px;
    height: 22px;
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 46px 22px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--card-border);
    box-shadow: 0 15px 45px rgba(36, 72, 21, .07);
    color: var(--muted);
    text-align: center;
}

.empty-state svg {
    width: 34px;
    height: 34px;
    margin-bottom: 4px;
    opacity: .45;
}

.empty-state strong {
    color: var(--text);
    font-size: 15px;
}

.empty-state span {
    max-width: 34ch;
    font-size: 12px;
    line-height: 1.7;
}

body.dark .empty-state {
    box-shadow: 0 15px 45px rgba(0, 0, 0, .28);
}

/* --- English / LTR --- */
[dir="ltr"] .card-name span {
    text-align: left;
}

[dir="ltr"] .more-item {
    text-align: left;
}

[dir="ltr"] .more-item:hover {
    transform: translateX(3px);
}

[dir="ltr"] .language-option,
[dir="ltr"] .theme-option,
[dir="ltr"] .contact-item {
    text-align: left;
}

[dir="ltr"] .topbar {
    padding: 0 20px 0 16px;
}

[dir="ltr"] .history-row:hover {
    transform: translateX(3px);
}

[dir="ltr"] .history-name span {
    text-align: left;
}

@media (max-width: 760px) {
    .empty-state {
        padding: 34px 16px;
        border-radius: 20px;
    }

    .empty-state svg {
        width: 30px;
        height: 30px;
    }

    .empty-state strong {
        font-size: 13px;
    }

    .empty-state span {
        font-size: 11px;
    }
}

/* ============================================================
   History
   ============================================================ */

.history-panel {
    grid-column: 1 / -1;
    padding: 8px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--card-border);
    box-shadow: 0 15px 45px rgba(36, 72, 21, .07);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    overflow: hidden;
}

.history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 10px 12px;
}

.history-head strong {
    font-size: 14px;
}

.history-clear {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 11px;
    border-radius: 11px;
    background: var(--hover-veil);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    transition: background .2s ease, color .2s ease, transform .15s ease;
}

.history-clear svg {
    width: 15px;
    height: 15px;
}

.history-clear:hover {
    background: rgba(223, 98, 94, .13);
    color: var(--danger);
}

.history-clear:active {
    transform: scale(.95);
}

.history-rows {
    display: grid;
    gap: 5px;
}

.history-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 12px;
    padding: 9px 11px;
    border-radius: 16px;
    background: transparent;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}

.history-row:hover {
    background: var(--accent-soft);
    transform: translateX(-3px);
}

.history-row:active {
    transform: scale(.99);
}

.history-name {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.history-name strong {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-name span {
    font-size: 9px;
    color: var(--muted);
    direction: ltr;
    text-align: right;
}

.history-value {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.history-value strong {
    font-size: 14px;
    letter-spacing: -.4px;
    direction: ltr;
}

.history-time {
    padding: 4px 8px;
    border-radius: 9px;
    background: var(--hover-veil);
    color: var(--muted);
    font-size: 10px;
    white-space: nowrap;
}

.history-remove {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    transition: background .2s ease, color .2s ease, transform .15s ease;
}

.history-remove svg {
    width: 15px;
    height: 15px;
}

.history-remove:hover {
    background: rgba(223, 98, 94, .14);
    color: var(--danger);
}

.history-remove:active {
    transform: scale(.9);
}

body.dark .history-panel {
    box-shadow: 0 15px 45px rgba(0, 0, 0, .28);
}

@media (max-width: 760px) {
    .history-row {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        grid-template-areas:
            "icon name value remove"
            "icon time value remove";
        row-gap: 3px;
        gap: 9px;
        padding: 9px 10px;
    }

    .history-row > .asset-icon {
        grid-area: icon;
    }

    .history-name {
        grid-area: name;
    }

    .history-value {
        grid-area: value;
    }

    .history-time {
        grid-area: time;
        justify-self: start;
        padding: 0;
        background: transparent;
        font-size: 9px;
    }

    .history-remove {
        grid-area: remove;
    }
}

/* ============================================================
   Motion
   ------------------------------------------------------------
   Only transform / opacity / stroke-dashoffset are animated, so
   nothing here triggers layout or paint of the page behind the
   glass layers. Entrance stagger is capped at 10 steps and is
   skipped while typing in search or dragging the card slider.
   ============================================================ */

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes rowIn {
    from {
        opacity: 0;
        transform: translateY(9px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes softIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes drawLine {
    from {
        stroke-dashoffset: 1;
    }

    to {
        stroke-dashoffset: 0;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes iconIn {
    from {
        opacity: 0;
        transform: rotate(-40deg) scale(.6);
    }

    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

/* `backwards`, not `both` — a filled keyframe would win over :hover */
.market-grid.stagger .market-card {
    animation: cardIn .4s cubic-bezier(.2, .8, .2, 1) backwards;
    animation-delay: calc(var(--i, 0) * 35ms);
}

.market-grid.stagger .history-panel,
.market-grid.stagger .empty-state {
    animation: softIn .35s ease backwards;
}

.market-grid.stagger .history-row {
    animation: rowIn .35s cubic-bezier(.2, .8, .2, 1) backwards;
    animation-delay: calc(var(--i, 0) * 40ms);
}

.chart-line {
    stroke-dasharray: 1;
    animation: drawLine .9s cubic-bezier(.4, 0, .2, 1) both;
}

.chart-area {
    animation: fadeIn .7s ease .12s both;
}

#themeButton svg {
    animation: iconIn .35s cubic-bezier(.2, .8, .2, 1) both;
}

/* press feedback */
.nav-item:active {
    transform: scale(.93);
}

.category:active {
    transform: scale(.95);
}

.more-item:active {
    transform: scale(.985);
}

.show-more:active {
    transform: scale(.99);
}

.history-clear:active,
.history-remove:active,
.nav-item:active,
.category:active {
    transition-duration: .1s;
}

.option-btn,
.palette-btn,
.range-btn {
    transition: transform .15s ease, background .25s ease, color .25s ease;
}

.option-btn:active,
.palette-btn:active,
.range-btn:active {
    transform: scale(.96);
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-delay: 0ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* ============================================================
   Bottom-nav sliding indicator + badges
   ============================================================ */

.nav-indicator {
    position: absolute;
    top: 7px;
    bottom: 7px;
    left: 0;
    z-index: 0;
    border-radius: 18px;
    background: var(--accent);
    box-shadow: 0 9px 25px rgba(var(--accent-rgb), .25);
    opacity: 0;
    pointer-events: none;
    transition:
        transform .38s cubic-bezier(.2, .8, .2, 1),
        width .38s cubic-bezier(.2, .8, .2, 1),
        opacity .2s ease;
}

.nav-badge {
    position: absolute;
    top: -5px;
    right: -7px;
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--badge);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    font-style: normal;
    line-height: 1;
    display: grid;
    place-items: center;
    direction: ltr;
    box-shadow: 0 0 0 2px var(--surface-strong);
}

@media (max-width: 760px) {
    .bottom-nav {
        bottom: calc(10px + env(safe-area-inset-bottom));
    }
}

/* ---------------------------------------------------------------
   Tools — the «ابزارها» tab replaces the old history view
   --------------------------------------------------------------- */
.tools-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 2px;
}

.tool-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--card-border);
    text-decoration: none;
    color: var(--text);
    transition: transform .15s ease, background .25s ease, border-color .25s ease;
}

.tool-card:active {
    transform: scale(.985);
}

.tool-icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: var(--accent-ink);
    background: var(--accent-soft);
}

.tool-icon svg {
    width: 24px;
    height: 24px;
}

.tool-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tool-text strong {
    font-size: 15px;
    font-weight: 700;
}

.tool-text span {
    font-size: 12px;
    color: var(--muted);
}

.tool-arrow {
    margin-inline-start: auto;
    color: var(--muted);
}

.tool-arrow svg {
    width: 18px;
    height: 18px;
}
