/* Public pages only (loaded after app.css; the admin panel keeps app.css alone). Satoshi font, chat button. */

/* Self-hosted Satoshi. The ?v= is the file's content hash, the same one page() stamps on the <link rel="preload">
   URLs, so the preloaded file is reused (test/unit.test.js checks they match: update both if a font changes). */
@font-face {
  font-family: "Satoshi"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/Satoshi-Regular.woff2?v=5aa97d938f") format("woff2");
}
@font-face {
  font-family: "Satoshi"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/Satoshi-Bold.woff2?v=6f979e75eb") format("woff2");
}

:root {
  --font: "Satoshi", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --green-border: #16a34a;
}

/* Body text, labels, inputs and buttons: Satoshi Regular; headings and card/section titles: Satoshi Bold. */
body, button, input, select, textarea { font-family: var(--font); font-weight: 400; }
h1, h2, h3, h4, h5, h6, .step, legend, .fee-table th { font-family: var(--font); font-weight: 700; }
.btn { font-family: var(--font); } /* labels stay bold (app.css) */

/* Addresses, amounts and hashes stay monospace: easy to read and copy. */
code, .mono, input[type="text"] { font-family: var(--mono); }
#contact { font-family: var(--font); } /* email / Telegram, not an address */

/* Buttons, selected choices, input focus and the progress bar keep app.css's TRON red. */

/* Refund page: "Can't send the exact amount?" */
#exchange-info { border: 1.5px solid var(--green-border); }

/* Sticky Telegram chat button (official logo, unmodified), bottom-right on every public page. common.js fades it
   out while it would sit over a button, input, QR code or the theme toggle, so it never covers them. */
.tg-chat {
  position: fixed; z-index: 50; inset-inline-end: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: 52px; height: 52px; border-radius: 50%; display: block;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: opacity 0.15s, transform 0.15s;
}
:root:not([data-theme="light"]) .tg-chat { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08); }
.tg-chat img { display: block; width: 100%; height: 100%; border-radius: 50%; }
.tg-chat:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.tg-chat.tg-hide { opacity: 0; pointer-events: none; transform: scale(0.85); }
@media (min-width: 640px) {
  .tg-chat { width: 56px; height: 56px; inset-inline-end: 24px; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
}
/* Tooltip on hover, only where there is a real pointer (desktop). */
@media (hover: hover) and (pointer: fine) {
  .tg-chat::before {
    content: attr(data-tip); position: absolute; inset-inline-end: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    white-space: nowrap; padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 700;
    background: var(--text); color: var(--bg); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    opacity: 0; pointer-events: none; transition: opacity 0.15s;
  }
  .tg-chat:hover::before, .tg-chat:focus-visible::before { opacity: 1; }
  .tg-chat:hover { transform: translateY(-2px); }
}
/* Room below the footer so the theme toggle and the last buttons can scroll clear of the chat button. */
@media (max-width: 759px) {
  footer { padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
}
@media print { .tg-chat { display: none; } }

/* Languages. Satoshi covers Latin script only: Chinese, Arabic and Russian pages use the device's system fonts (no
   webfont download, and lib/pages.js leaves out the Satoshi preloads there). */
:root:lang(zh) { --font: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", sans-serif; }
:root:lang(ar) { --font: system-ui, -apple-system, "Segoe UI", "Noto Sans Arabic", "Geeza Pro", Tahoma, sans-serif; }
:root:lang(ru) { --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
/* Letter spacing breaks Arabic joining and looks loose in Chinese; capitals do not exist in either. */
:root:lang(ar) .step, :root:lang(ar) .fee-table th, :root:lang(zh) .step, :root:lang(zh) .fee-table th { letter-spacing: 0; }
:root:lang(ar) body { line-height: 1.6; }

/* Header language menu (next to the nav link). */
header.top nav { display: flex; align-items: center; }
.lang-menu { position: relative; margin-inline-start: 14px; }
.lang-menu summary {
  list-style: none; display: flex; align-items: center; gap: 5px; cursor: pointer; color: var(--muted); font-size: 14px;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 999px; user-select: none;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover, .lang-menu[open] summary { color: var(--text); border-color: var(--red); }
.lang-menu summary:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.lang-menu svg { width: 16px; height: 16px; flex: none; }
.lang-menu .lang-code { display: none; font-weight: 700; font-size: 12px; }
.lang-list {
  position: absolute; z-index: 60; inset-inline-end: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none;
  min-width: 150px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}
.lang-list a { display: block; margin: 0; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 15px; }
.lang-list a:hover, .lang-list a:focus-visible { background: var(--surface-2); outline: none; }
.lang-list a[aria-current] { color: var(--red); font-weight: 700; }
/* Phones: the menu shows the language code only. Longer languages: logo a little smaller and the nav link may wrap
   to two lines (English keeps its header as it was). */
@media (max-width: 479px) {
  .lang-menu { margin-inline-start: 10px; }
  .lang-menu .lang-cur { display: none; }
  .lang-menu .lang-code { display: inline; }
  :root:not(:lang(en)) .logo img { height: 30px; }
  :root:not(:lang(en)) header.top nav a:not(.lang-opt) { margin-inline-start: 10px; font-size: 13px; line-height: 1.2; text-align: end; max-width: 9.5em; }
}

/* Footer language links. */
footer .foot-langs { flex-basis: 100%; }
footer .foot-langs ul { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; }
footer .foot-langs a { margin: 0; font-size: inherit; text-decoration: none; }
footer .foot-langs a:hover { color: var(--text); }
footer .foot-langs a[aria-current] { color: var(--text); font-weight: 700; }

/* "View in …?" offer on the English home page (common.js). */
.lang-offer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 16px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 14px;
}
.lang-offer-btns { display: flex; gap: 8px; }
.lang-offer .btn.small { margin: 0; }

/* "In case of any difference, the English version applies." (Fees and Refund pages, not in English). */
.legal { font-style: italic; }

/* Flags next to the language names (header menu and footer). Only markup with .flag / .has-flag / .with-flag uses
   these rules. 4:3 SVGs, a thin ring so white flags (US, RU, …) stay visible on both themes. */
.flag {
  width: 20px; height: 15px; flex: none; display: inline-block; vertical-align: -2px; object-fit: cover;
  border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}
:root:not([data-theme="light"]) .flag { box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.3); }
.lang-menu summary.has-flag { gap: 7px; padding: 6px 10px; }
.lang-menu summary.has-flag .lang-code { display: inline; }
.lang-list a.with-flag { display: flex; align-items: center; gap: 10px; }
footer .foot-langs a.with-flag { display: inline-flex; align-items: center; gap: 6px; }

/* Buy Energy / Buy Bandwidth switch at the top of both buy pages. */
.product-tabs { display: flex; gap: 6px; margin: 0 0 18px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); width: fit-content; }
.product-tabs a { margin: 0; padding: 7px 16px; border-radius: 999px; color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; }
.product-tabs a:hover { color: var(--text); }
.product-tabs a[aria-current="page"] { background: var(--red); color: #fff; }
/* Header: the extra link (Bandwidth / Order status) shows from 480 px up; phones reach it through the tabs and footer. */
@media (max-width: 479px) { header.top nav a.nav-wide { display: none; } }

/* Bandwidth custom amount: a full-width card under the package grid, dashed green border on a soft green wash (the
   theme's --ok colours, defined for light and dark) so it reads differently from the red package cards; solid border
   once chosen. Logical properties only, so it mirrors in Arabic. */
.custom-card {
  position: relative; margin-top: 12px; padding: 14px; border: 1.5px dashed var(--ok); border-radius: 12px;
  background: var(--ok-soft);
}
.custom-card.is-selected { border-style: solid; box-shadow: 0 0 0 1px var(--ok) inset; }
.custom-radio { position: absolute; opacity: 0; pointer-events: none; }
.custom-radio:focus-visible + .custom-head { outline: 2px solid var(--ok); outline-offset: 2px; border-radius: 6px; }
.custom-head { display: block; cursor: pointer; margin-bottom: 12px; }
.custom-title { display: block; font-weight: 700; font-size: 18px; }
/* Secondary text in full --text at 80 % rather than --muted, so it keeps its contrast on the green wash. */
.custom-sub { display: block; color: var(--text); opacity: 0.8; font-size: 13px; }
.custom-fields { display: flex; align-items: flex-end; gap: 10px; }
.custom-fields .field { flex: 1; min-width: 0; }
.custom-fields input { background: var(--surface); }
.custom-eq { padding-bottom: 14px; color: var(--text); opacity: 0.7; font-weight: 700; }
.custom-card .hint { margin-top: 8px; color: var(--text); opacity: 0.8; }
.custom-price { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--ok); }
.custom-price-figure { text-align: end; }
.custom-price .opt-price { margin-top: 0; display: block; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.custom-price .small, .custom-price .muted { color: var(--text); opacity: 0.8; font-size: 13px; }
/* The "below minimum / Use it" box keeps its red wash, laid on a solid surface so it doesn't turn muddy on the green. */
.custom-card .notice.warn { background: linear-gradient(var(--red-soft), var(--red-soft)), var(--surface); margin-bottom: 0; }
.custom-card .notice.warn .btn { margin-inline-start: 4px; background: var(--surface); }
@media (max-width: 479px) { .custom-fields { flex-direction: column; align-items: stretch; } .custom-eq { display: none; } }


/* Check Address page. The paste button (touch devices only, check.js) sits inside the input's row; logical
   properties so it mirrors in Arabic. */
.check-input { display: flex; gap: 8px; align-items: stretch; }
.check-input input { flex: 1; min-width: 0; }
.check-input .paste-btn { margin: 0; flex: none; padding-inline: 14px; font-size: 14px; }
.check-input .paste-btn[hidden] { display: none; }
.status-pill.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-kv { font-size: 15px; align-items: center; }
.check-kv dd { font-variant-numeric: tabular-nums; }
.check-explain { margin: 16px 0; font-weight: 600; }
.check-result .notice { margin-bottom: 14px; }
/* "Buy 65K / 131K energy" (one or both): green like the bandwidth custom-amount card (the theme's --ok colours, light and dark),
   the soft wash laid on a solid surface; padding trimmed for the border so the height stays the same. */
.buy-energy { background: linear-gradient(var(--ok-soft), var(--ok-soft)), var(--surface); border: 1.5px solid var(--ok); color: var(--ok); padding: 13.5px; }
.buy-energy:hover { background: linear-gradient(var(--ok-soft), var(--ok-soft)), linear-gradient(var(--ok-soft), var(--ok-soft)), var(--surface); }
.buy-energy:focus-visible { outline: 2px solid var(--ok); outline-offset: 2px; }
.buy-energy[hidden] { display: none; }
.buy-energy + .buy-energy { margin-top: 10px; }
/* Resources: bandwidth and energy rows, each with app.css's progress bar (logical properties, so the bar fills from
   the right in Arabic). */
.check-res { border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 16px; }
.check-res .step { margin-bottom: 6px; }
.res-row { margin: 12px 0 0; }
.res-head { display: flex; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; font-size: 15px; }
.res-head > span:last-child { font-weight: 600; font-variant-numeric: tabular-nums; }
.res-row .progress { margin-top: 6px; }
.res-row .hint { margin-top: 4px; font-variant-numeric: tabular-nums; }
#r-low-bw p { margin: 0 0 10px; }
/* Sender / recipient switch: the price guide's segmented control, above the address field. */
.check-mode { margin: 0 0 16px; }

/* Energy price guide. 65K / 131K switch (like the product tabs, but buttons), stat cards, chart boxes, legend. */
.seg { display: flex; gap: 4px; margin: 0 0 18px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.seg-btn {
  flex: 1; min-width: 0; padding: 8px 12px; border: 0; border-radius: 999px; background: transparent; color: var(--muted);
  font: inherit; font-weight: 600; font-size: 14px; line-height: 1.25; cursor: pointer;
}
.seg-btn:hover { color: var(--text); }
.seg-btn[aria-pressed="true"] { background: var(--red); color: var(--on-red); }
.seg-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.pg-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.pg-stats .card { margin: 0; }
.pg-stat .step { margin-bottom: 6px; }
.pg-figure { margin: 0; font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pg-when { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.pg-cheap { border-color: var(--ok); background: linear-gradient(var(--ok-soft), var(--ok-soft)), var(--surface); }
.pg-cheap .pg-figure { color: var(--ok); }
.pg-peak { border-color: var(--red); background: linear-gradient(var(--red-soft), var(--red-soft)), var(--surface); }
.pg-peak .pg-figure { color: var(--red); }
.pg-h2 { font-size: 18px; margin: 0 0 10px; }
.pg-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 10px; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.pg-legend li { display: inline-flex; align-items: center; gap: 6px; }
.pg-key { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.pg-key-cheap { background: var(--ok); }
.pg-key-peak { background: var(--red); }
.pg-key-other { background: var(--red); opacity: 0.3; }
/* Chart.js fills its box (responsive, no fixed aspect ratio): the box sets the height, min-width 0 stops overflow. */
.pg-chart { position: relative; height: 240px; min-width: 0; }
@media (min-width: 480px) { .pg-chart { height: 280px; } }
.pg-cta { text-align: center; }
.pg-cta p { margin: 0 0 12px; font-weight: 600; }

/* Cloudflare Turnstile widget on the order forms (shown only when Turnstile is on) */
.turnstile:not([hidden]) { display: flex; justify-content: center; min-height: 65px; margin: 4px 0 16px; }
