html, body, #root { margin: 0; min-height: 100%; }
body { background: var(--pr-paper); }

:root {
    --pr-ui-font: 'Cairo', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;

    /* paper + ink */
    --pr-paper: #fdfcfb;
    --pr-card: #ffffff;
    --pr-ink: #1a1712;
    --pr-ink-2: #6b645b;
    --pr-ink-3: #9a938a;
    --pr-line: #eae4db;
    --pr-line-2: #f1ece5;
    --pr-dark: #17150f;

    /* identity per asset class */
    --pr-fx: #2c7a6b;
    --pr-gold: #b8862b;
    --pr-silver: #77838f;
    --pr-oil: #7a5343;
    --pr-crypto: #6b4bd6;

    /* movement */
    --pr-up: #0f7a5f;
    --pr-up-bg: #e7f5ee;
    --pr-down: #c0392b;
    --pr-down-bg: #fdecea;
    --pr-flat: #6b6668;
    --pr-flat-bg: #f3f1ee;

    --pr-radius: 16px;
    --pr-shadow: 0 1px 2px rgba(26, 23, 18, 0.04);
}

/* ==== Shell ==== */
.pr-shell {
    max-width: 760px;
    margin: 0 auto;
    padding: 18px max(18px, env(safe-area-inset-right, 0px)) calc(30px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px));
}
@media (min-width: 720px) { .pr-shell { padding: 22px max(26px, env(safe-area-inset-right, 0px)) calc(40px + env(safe-area-inset-bottom, 0px)) max(26px, env(safe-area-inset-left, 0px)); } }

/* ==== Ticker: slim dark strip, continuous rightward scroll, RTL ==== */
.pr-ticker {
    position: sticky;
    top: 0;
    z-index: 40;
    box-sizing: border-box;
    height: calc(34px + env(safe-area-inset-top, 0px));
    padding-top: env(safe-area-inset-top, 0px);
    display: flex;
    align-items: center;
    overflow: hidden;
    background: var(--pr-dark);
    color: #f7f2e8;
    direction: ltr;
}
.pr-ticker::before,
.pr-ticker::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 26px;
    z-index: 2;
    pointer-events: none;
}
.pr-ticker::before { left: 0; background: linear-gradient(to right, var(--pr-dark), rgba(23, 21, 15, 0)); }
.pr-ticker::after { right: 0; background: linear-gradient(to left, var(--pr-dark), rgba(23, 21, 15, 0)); }

.pr-ticker-track {
    display: flex;
    align-items: center;
    width: max-content;
    animation: pr-tk-scroll 30s linear infinite;
    will-change: transform;
}
@keyframes pr-tk-scroll {
    from { transform: translate3d(-50%, 0, 0); }
    to { transform: translate3d(0, 0, 0); }
}
.pr-tk-half { display: flex; align-items: center; }
.pr-tk-item {
    line-height: 1.25;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 13px;
    border-inline-start: 1px solid rgba(247, 242, 232, 0.14);
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    direction: rtl;
}
.pr-tk-name { font-size: 11.5px; font-weight: 500; color: rgba(247, 242, 232, 0.66); }
.pr-tk-val {
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}
.pr-tk-up { font-size: 11px; font-weight: 700; color: #6fdcae; }
.pr-tk-down { font-size: 11px; font-weight: 700; color: #ff9c8d; }
.pr-tk-flat { font-size: 11px; font-weight: 600; color: rgba(247, 242, 232, 0.55); }

@media (prefers-reduced-motion: reduce) {
    .pr-ticker-track { animation: none; }
}

/* ==== Page head ==== */
.pr-head { padding: 14px 0 2px; }
.pr-h1 {
    margin: 0;
    font-size: 25px;
    font-weight: 700;
    line-height: 1.4;
    letter-spacing: -0.01em;
    color: var(--pr-ink);
}
.pr-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 7px 0 0;
    font-size: 12px;
    font-weight: 400;
    color: var(--pr-ink-3);
}
.pr-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pr-up);
    box-shadow: 0 0 0 3px rgba(15, 122, 95, 0.12);
}
.pr-intro {
    margin: 10px 0 0;
    max-width: 36ch;
    font-size: 13.5px;
    line-height: 1.8;
    color: var(--pr-ink-2);
}
@media (min-width: 720px) { .pr-h1 { font-size: 30px; } }

/* ==== Generated movement headline ==== */
.pr-lede {
    margin: 16px 0 16px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--pr-card);
    border: 1px solid var(--pr-line);
    box-shadow: var(--pr-shadow);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.55;
}
.pr-lede-up { border-color: #cfe9df; background: linear-gradient(180deg, #f1faf6, #ffffff); color: var(--pr-up); }
.pr-lede-down { border-color: #f4d7d3; background: linear-gradient(180deg, #fdf3f1, #ffffff); color: var(--pr-down); }
.pr-lede-flat { color: var(--pr-ink-2); font-weight: 600; }

/* ==== Tiles ==== */
.pr-hero { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 18px; }
.pr-hero .pr-tile { padding: 15px 15px 14px; border-radius: 18px; }
.pr-hero .pr-tile-value { font-size: 32px; }
.pr-hero .pr-tile-name { font-size: 12.5px; font-weight: 600; color: var(--pr-ink); }
@media (max-width: 359px) { .pr-hero .pr-tile-value { font-size: 27px; } }

.pr-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 720px) { .pr-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; } }

.pr-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 13px 14px;
    padding-inline-start: 16px;
    border: 1px solid var(--pr-line);
    border-radius: var(--pr-radius);
    background: var(--pr-card);
    box-shadow: var(--pr-shadow);
    color: inherit;
    text-decoration: none;
    overflow: hidden;
    transition: box-shadow 160ms ease, border-color 160ms ease;
}
.pr-tile::before {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 3px;
    background: var(--pr-accent, var(--pr-fx));
}
.pr-tile:hover { border-color: #ded6ca; box-shadow: 0 4px 16px rgba(26, 23, 18, 0.07); }
.pr-tile-name { display: flex; align-items: baseline; gap: 6px; font-size: 12px; font-weight: 500; color: var(--pr-ink-2); }
.pr-tile-code { font-size: 10px; letter-spacing: 0.06em; opacity: 0.7; }
.pr-tile-value {
    color: var(--pr-ink);
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.pr-tile-unit { margin-inline-start: 4px; font-size: 11px; font-weight: 400; color: var(--pr-ink-3); }
.pr-tile-note { font-size: 11px; color: var(--pr-ink-3); }
.pr-tile .pr-change { margin-top: 3px; }

.pr-tile-fx { --pr-accent: var(--pr-fx); }
.pr-tile-gold { --pr-accent: var(--pr-gold); }
.pr-tile-silver { --pr-accent: var(--pr-silver); }
.pr-tile-oil { --pr-accent: var(--pr-oil); }
.pr-tile-crypto { --pr-accent: var(--pr-crypto); }

/* ==== Movement chips ==== */
.pr-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: flex-start;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.pr-change-label { font-weight: 400; opacity: 0.72; }
.pr-up { background: var(--pr-up-bg); color: var(--pr-up); }
.pr-down { background: var(--pr-down-bg); color: var(--pr-down); }
.pr-flat { background: var(--pr-flat-bg); color: var(--pr-flat); }

/* ==== Sections ==== */
.pr-section { margin-top: 26px; }
.pr-section-head {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--pr-line);
}
.pr-kicker {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    color: var(--pr-ink-3);
}
.pr-h2 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--pr-ink);
}

/* ==== Asset pages ==== */
.pr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pr-grid .pr-item .pr-value { font-size: 26px; }
.pr-grid-one { grid-template-columns: 1fr; max-width: 440px; }
.pr-grid-one .pr-item .pr-value { font-size: 32px; }
@media (min-width: 720px) {
    .pr-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
    .pr-grid .pr-item .pr-value { font-size: 28px; }
}

.pr-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 16px 16px;
    padding-inline-start: 19px;
    border: 1px solid var(--pr-line);
    border-radius: var(--pr-radius);
    background: var(--pr-card);
    box-shadow: var(--pr-shadow);
    overflow: hidden;
}
.pr-item::before {
    content: '';
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 3px;
    background: var(--pr-accent, var(--pr-fx));
}
.pr-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pr-name { display: flex; align-items: baseline; gap: 6px; font-size: 13px; font-weight: 500; color: var(--pr-ink-2); }
.pr-name-sub { font-size: 11px; opacity: 0.72; }
.pr-tone-crypto .pr-name { font-weight: 600; color: var(--pr-ink); letter-spacing: 0.02em; }
.pr-tile-crypto .pr-tile-name { font-weight: 600; }
.pr-value {
    color: var(--pr-ink);
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.pr-unit { margin-inline-start: 6px; font-size: 13px; font-weight: 400; color: var(--pr-ink-3); }
.pr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12px; }
.pr-usd { font-size: 12px; color: var(--pr-ink-2); }

.pr-tone-gold { --pr-accent: var(--pr-gold); }
.pr-tone-silver { --pr-accent: var(--pr-silver); }
.pr-tone-oil { --pr-accent: var(--pr-oil); }
.pr-tone-crypto { --pr-accent: var(--pr-crypto); }
.pr-tone-fx { --pr-accent: var(--pr-fx); }

/* ==== Movers strip ==== */
.pr-movers { margin: 0 0 4px; font-size: 12px; }
.pr-movers-label { display: block; margin-bottom: 7px; font-size: 11px; color: var(--pr-ink-3); }
.pr-mover {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-inline-end: 6px;
    margin-bottom: 5px;
    white-space: nowrap;
}
.pr-mover a { font-size: 12px; font-weight: 600; color: var(--pr-ink); text-decoration: none; }

/* ==== Conversion row on a currency page ==== */
.pr-fx {
    margin-top: 12px;
    border: 1px solid var(--pr-line);
    border-radius: var(--pr-radius);
    padding: 0 16px;
    background: var(--pr-card);
    box-shadow: var(--pr-shadow);
}
.pr-fx-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    column-gap: 12px;
    row-gap: 2px;
    padding: 13px 0;
}
.pr-fx-row + .pr-fx-row { border-top: 1px solid var(--pr-line-2); }
.pr-fx-name { font-size: 14px; font-weight: 600; }
.pr-fx-code { margin-inline-start: 8px; font-size: 11px; font-weight: 400; letter-spacing: 0.06em; color: var(--pr-ink-3); }
.pr-fx-val { font-size: 20px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pr-fx-row .pr-change { grid-column: 2; justify-self: end; }

/* ==== Text blocks ==== */
.pr-line { margin: 0; font-size: 15px; line-height: 26px; }
.pr-back { margin: 0; font-size: 14px; line-height: 26px; }
.pr-back a { color: var(--pr-ink); }
.pr-src { margin: 0; font-size: 12.5px; line-height: 1.7; color: var(--pr-ink-2); }

/* ==== Typography: Cairo (variable, Arabic + Latin subsets) ==== */
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('./assets/fonts/cairo-arabic.woff2') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+FB50-FDFF, U+FE70-FEFF;
}
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('./assets/fonts/cairo-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2190-21FF, U+25A0-25FF;
}

#root, #root * { font-family: var(--pr-ui-font); }
#root * { font-variant-numeric: normal; }
.pr-value, .pr-tile-value, .pr-fx-val, .pr-tk-val { font-variant-numeric: tabular-nums; }
.pr-value, .pr-tile-value, .pr-fx-val { letter-spacing: -0.01em; }

/* ==== Staleness: a failed source never looks current ==== */
.pr-stale {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fff1d6;
    color: #8a5600;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}
.pr-tile .pr-stale { margin-top: 2px; }
.pr-tile-stale .pr-tile-value, .pr-item-stale .pr-value { color: var(--pr-ink-2); }
.pr-tile-stale .pr-change, .pr-item-stale .pr-change { opacity: 0.45; }
.pr-tile-stale .pr-tile-unit, .pr-item-stale .pr-unit { opacity: 0.7; }

/* Nothing to show at all */
.pr-tile-value-off, .pr-hero .pr-tile-value-off {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--pr-flat);
    white-space: nowrap;
}
.pr-value-off {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--pr-flat);
}

/* ==== Captions and footer ==== */
.pr-caption { margin: 10px 0 0; font-size: 12px; line-height: 1.7; color: var(--pr-ink-3); }
.pr-foot { margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--pr-line); }
.pr-foot a { color: var(--pr-ink-2); }
