@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap');

:root {
    color-scheme: dark;
    --site-font: "Roboto Mono", monospace;
    --page-bg: #101112;
    --page-texture: url('/img/grain.png');
    --grain-opacity: .55;
    --surface: #191b1d;
    --surface-raised: #242628;
    --border: #414448;
    --text: #e6e6e6;
    --text-muted: #b5b5b5;
    --accent: #f2a900;
    --accent-contrast: #111;
}

html[data-theme="coffee"] {
    color-scheme: dark;
    --page-bg: #15110f;
    --grain-opacity: .44;
    --surface: #211a17;
    --surface-raised: #302520;
    --border: #59473c;
    --text: #f0e7e1;
    --text-muted: #bba9a0;
    --accent: #db9853;
    --accent-contrast: #1a100b;
}
html[data-theme="forest"] {
    color-scheme: dark;
    --page-bg: #0c1410;
    --grain-opacity: .46;
    --surface: #142019;
    --surface-raised: #1e3025;
    --border: #3b5846;
    --text: #e5eee8;
    --text-muted: #9fb2a5;
    --accent: #62c986;
    --accent-contrast: #07110a;
}
html[data-theme="ocean"] {
    color-scheme: dark;
    --page-bg: #07151b;
    --grain-opacity: .45;
    --surface: #10242c;
    --surface-raised: #18343e;
    --border: #315c6a;
    --text: #e3f0f3;
    --text-muted: #9bb7bf;
    --accent: #4bc1df;
    --accent-contrast: #041215;
}
html[data-theme="space"] {
    color-scheme: dark;
    --page-bg: #090b14;
    --grain-opacity: .5;
    --surface: #151827;
    --surface-raised: #22263a;
    --border: #474d6d;
    --text: #ededf5;
    --text-muted: #acaec5;
    --accent: #b58cff;
    --accent-contrast: #0e0918;
}
html[data-theme="electric"] {
    color-scheme: dark;
    --page-bg: #06110f;
    --grain-opacity: .48;
    --surface: #0d201d;
    --surface-raised: #15322c;
    --border: #2c6659;
    --text: #e7fff8;
    --text-muted: #99c4b8;
    --accent: #19e5ad;
    --accent-contrast: #03120e;
}
html[data-theme="ice"] {
    color-scheme: light;
    --page-bg: #f4f8fb;
    --grain-opacity: .15;
    --surface: #ffffff;
    --surface-raised: #e7f0f5;
    --border: #a9bac5;
    --text: #111820;
    --text-muted: #53636d;
    --accent: #087fa5;
    --accent-contrast: #fff;
}

html[data-theme]:not([data-theme="legacy"]) {
    --wallet-bg: var(--page-bg);
    --wallet-panel: var(--surface);
    --wallet-panel-strong: var(--surface-raised);
    --wallet-line: var(--border);
    --wallet-muted: var(--text-muted);
    --wallet-orange: var(--accent);
    --orange: var(--accent);
    --ink: var(--text);
    --muted: var(--text-muted);
    --panel: var(--surface);
    --line: var(--border);
}
html[data-theme]:not([data-theme="legacy"]) body {
    background-color: var(--page-bg) !important;
    color: var(--text);
}
html[data-theme]:not([data-theme="legacy"]) :where(#menu, dialog, .modal-content, .footer-modal-content, .site-help-dialog, .pwa-install-dialog) {
    color: var(--text);
    background-color: var(--surface);
    border-color: var(--border);
}
html[data-theme]:not([data-theme="legacy"]) :where(input, textarea, select) {
    color: var(--text);
    background-color: var(--surface-raised);
    border-color: var(--border);
}
html[data-theme="ice"] body::before { mix-blend-mode: multiply; }
html[data-theme="ice"] :where(main, article, section, dialog, nav, footer) { color: var(--text); }
html[data-theme="ice"] :where(h1, h2, h3, h4, h5, h6, p, li, dt, dd, label, summary, code, small) {
    color: inherit;
}
html[data-theme="ice"] :where(.footer-modal-content, .mempool-pool, .mempool-metric, .fee-lane, .qr-code-wrapper) {
    background-color: var(--surface) !important;
    border-color: var(--border) !important;
}
*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; }

/* Keep the hand-drawn home animation intact; use the quote face everywhere else. */
body:not(:has(#text1)),
body:not(:has(#text1)) :where(*:not(i):not(#satoshisValue):not([class^="lni"]):not([class*=" lni"]):not(.sticky-note):not(.sticky-note *):not(.note-font-select):not(.note-font-select *)) {
    font-family: var(--site-font) !important;
}

body {
    background-color: var(--page-bg);
    isolation: isolate;
    color: var(--text);
    min-height: 100svh;
    letter-spacing: 0;
}
body::before {
    content: '';
    position: fixed;
    inset: -256px;
    z-index: -1;
    pointer-events: none;
    background-image: var(--page-texture);
    background-repeat: repeat;
    background-size: 256px 256px;
    opacity: var(--grain-opacity);
    animation: site-grain 0.8s steps(1, end) infinite;
}
@keyframes site-grain {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-43px, 61px); }
    50% { transform: translate(79px, -37px); }
    75% { transform: translate(-91px, -73px); }
}
body:has(.footer) { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
img, video { max-width: 100%; height: auto; }
/* Match these widgets' default color scheme so their canvases stay transparent. */
iframe[src^="https://playtdt.com/widget/"],
iframe[src^="https://changenow.io/embeds/"] { color-scheme: normal; }
input, textarea, select { max-width: 100%; }
button, a, input, select, textarea { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
p, h1, h2, h3, h4, a, code { overflow-wrap: anywhere; }
#menu { max-width: calc(100vw - 32px); }
#menu { max-height: calc(100dvh - 110px); overflow-y: auto; }
#menu .submenu { position: static; min-width: 0; width: 100%; }
#menu .has-submenu.active .submenu { max-height: 45dvh; }
#menu a { min-height: 44px; display: flex; align-items: center; justify-content: center; }
.submenu li a { white-space: normal; }
.footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr);
    align-items: center;
    gap: 4px;
    padding: 4px 10px calc(4px + env(safe-area-inset-bottom));
}
.footer > a { grid-column: 2; grid-row: 1; margin: 0; }
.footer > i.lni.lni-bolt-2 { grid-column: 3; grid-row: 1; margin: 0; }
.footer #fee-rate, .footer #block-height {
    position: static;
    grid-row: 1;
    min-width: 0;
    overflow-wrap: anywhere;
    margin: 0;
}
.footer #block-height { grid-column: 1; justify-self: start; text-align: left; }
.footer #fee-rate { grid-column: 4; justify-self: end; text-align: right; }
.footer #block-height, .footer #fee-rate, .footer .site-footer-bolt { cursor: pointer; transition: color 160ms ease, text-shadow 160ms ease, transform 160ms ease; }
.footer #block-height:hover, .footer #fee-rate:hover, .footer .site-footer-bolt:hover { color: #f2a900; text-shadow: 0 0 12px rgba(242,169,0,.35); }
.footer .site-footer-bolt { font-size: 1rem; }
.footer-modal.description-modal { position: fixed; inset: 0; display: none; width: 100%; height: 100%; max-width: none; max-height: none; padding: max(16px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom)); place-items: center; overflow-y: auto; background: rgba(5,6,7,.82); backdrop-filter: blur(10px); }
.footer-modal.description-modal.active { display: grid; }
.footer-modal .footer-modal-content { position: relative; width: min(620px,100%); max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); margin: auto; padding: 28px; overflow-y: auto; color: var(--text); background: #17191b; border: 1px solid #414448; border-top: 2px solid #f2a900; border-radius: 8px; box-shadow: 0 24px 70px rgba(0,0,0,.58),0 0 28px rgba(242,169,0,.08); }
.footer-modal .close-icon { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; padding: 0; color: var(--text-muted); background: #242628; border: 1px solid var(--border); border-radius: 50%; font-size: 24px; line-height: 1; cursor: pointer; }
.footer-modal .close-icon:hover { color: #f2a900; border-color: #f2a900; }
.footer-modal-kicker { display: block; margin: 0 48px 6px 0; color: #f2a900; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.footer-modal h2 { margin: 0; color: #fff; font-size: clamp(1.35rem,4vw,2rem); line-height: 1.15; }
.footer-modal-intro { margin: 10px 0 22px; color: var(--text-muted); }
.mempool-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.mempool-title-row p { margin: 5px 0 0; color: var(--text-muted); font-size: .86rem; }
.mempool-block-nav { display: flex; align-items: center; flex: 0 0 auto; gap: 8px; }
.mempool-block-nav button { width: 36px; height: 36px; padding: 0; color: var(--text); background: var(--surface-raised); border: 1px solid var(--border); border-radius: 50%; font-size: 1.35rem; cursor: pointer; }
.mempool-block-nav button:disabled { opacity: .3; cursor: default; }
.mempool-block-nav span { color: var(--text-muted); font-size: .76rem; }
.mempool-pool { display: flex; align-items: center; gap: 13px; margin-bottom: 14px; padding: 12px; background: #202225; border: 1px solid #34373a; border-radius: 8px; }
.pool-logo { display: grid; place-items: center; flex: 0 0 48px; width: 48px; height: 48px; padding: 7px; overflow: hidden; color: #111; background: #f3f3f3; border-radius: 6px; font-size: 1.3rem; font-weight: 900; }
.pool-logo img { width: 100%; height: 100%; object-fit: contain; }
.mempool-pool div:last-child { min-width: 0; }
.mempool-pool div:last-child span { display: block; color: var(--text-muted); font-size: .72rem; }
.mempool-pool div:last-child strong { display: block; overflow-wrap: anywhere; color: #fff; font-size: 1.05rem; }
.mempool-metric-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.mempool-metric { min-width: 0; padding: 12px; background: #202225; border: 1px solid #34373a; border-radius: 6px; }
.mempool-metric span { display: block; margin-bottom: 5px; color: var(--text-muted); font-size: .7rem; }
.mempool-metric strong { display: block; color: #fff; font-size: .92rem; overflow-wrap: anywhere; }
.mempool-metric.accent strong { color: #f2a900; }
.mempool-hash { margin-top: 12px; padding-top: 12px; border-top: 1px solid #34373a; }
.mempool-hash span { display: block; margin-bottom: 5px; color: var(--text-muted); font-size: .7rem; }
.mempool-hash code { display: block; color: #cfd1d2; font-size: .74rem; word-break: break-all; }
.fee-lanes { display: grid; gap: 7px; margin-top: 20px; }
.fee-lane { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px 14px; background: #202225; border: 1px solid #34373a; border-radius: 6px; }
.fee-lane.recommended { border-color: rgba(242,169,0,.65); background: rgba(242,169,0,.07); }
.fee-lane strong, .fee-lane span { display: block; }
.fee-lane strong { color: #fff; font-size: .88rem; }
.fee-lane span { margin-top: 2px; color: var(--text-muted); font-size: .7rem; }
.fee-lane b { flex: 0 0 auto; color: #f2a900; font-size: 1.05rem; }
.fee-lane small { color: var(--text-muted); font-size: .68rem; font-weight: 600; }
.mempool-note, .mempool-error { margin: 14px 0 0; color: var(--text-muted); font-size: .78rem; }
.mempool-retry { margin-top: 16px; padding: 10px 16px; color: #111; background: #f2a900; border: 0; border-radius: 6px; font-weight: 800; cursor: pointer; }
.mempool-loader { display: flex; gap: 7px; margin-top: 24px; }
.mempool-loader i { width: 8px; height: 8px; background: #f2a900; border-radius: 50%; animation: mempool-pulse .9s ease-in-out infinite alternate; }
.mempool-loader i:nth-child(2) { animation-delay: .18s; }
.mempool-loader i:nth-child(3) { animation-delay: .36s; }
@keyframes mempool-pulse { to { opacity: .25; transform: translateY(-5px); } }
.support-modal-content { width: min(560px,100%) !important; }
.footer-modal .qr-code-container { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.footer-modal .qr-code-wrapper { min-width: 0; margin: 0; padding: 14px; background: #202225; border: 1px solid #34373a; border-radius: 8px; text-align: center; }
.footer-modal .qr-code { display: block; width: min(170px,100%); margin: 0 auto 10px; padding: 5px; background: #fff; border-radius: 4px; }
.footer-modal .qr-code-wrapper strong { color: #f2a900; }
.footer-modal .qr-code-text { margin: 5px 0 0; color: var(--text-muted); font-size: .68rem; word-break: break-all; }
@media (max-width: 560px) {
    .footer-modal .footer-modal-content { padding: 22px 16px 18px; }
    .mempool-title-row { padding-right: 38px; }
    .mempool-metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .footer-modal .qr-code-container { grid-template-columns: 1fr; }
    .footer-modal .qr-code { width: min(145px,60vw); }
}
#filters { position: absolute; width: 0; height: 0; pointer-events: none; }
#quotes { position: relative; top: auto; left: auto; transform: none; margin: 120px auto 48px; font-size: 1rem; }
.description-modal, #uploadModal, #infoModal, #qrCodeModal, #cookieConsentModal,
#mempoolTinyDataModal, #game39Modal, #bip39Modal, #lotteryExplainerModal {
    max-width: min(500px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    z-index: 4000;
    border-radius: 8px;
}
#contactModal { z-index: 4000; }
body.modal-open { overflow: hidden; }
#cookieConsentModal {
    width: min(440px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    box-sizing: border-box;
    overflow: hidden;
}
#cookieConsentModal .modal-content { max-height: none; overflow: visible; }
#cookieConsentModal h4 { margin: 0 0 8px; font-size: 18px; }
#cookieConsentModal p { margin: 0; font-size: 14px; line-height: 1.45; }
#cookieConsentModal .consent-question { margin-top: 12px; color: var(--text); font-weight: 600; }
#cookieConsentModal .consent-button-container { margin-top: 12px; }
@media (max-height: 420px) {
    #cookieConsentModal { padding: 12px; }
    #cookieConsentModal h4 { font-size: 16px; margin-bottom: 4px; }
    #cookieConsentModal p { font-size: 12px; line-height: 1.3; }
    #cookieConsentModal .consent-question,
    #cookieConsentModal .consent-button-container { margin-top: 6px; }
    #cookieConsentModal .consent-icon-button { font-size: 1.6rem; }
}
.contact-modal-content { border-radius: 8px; margin: 24px auto; }
.contact-icon { flex: 0 0 40px; margin-right: 16px; }
.contact-info { min-width: 0; overflow-wrap: anywhere; }
.contact-option { border-radius: 8px; }
.currency-input { width: 0; flex: 1 1 0; }
.qr-seed-form label { color: var(--text); }
.qr-seed-form input, .qr-seed-form textarea, .qr-seed-form select { background: var(--surface-raised); color: var(--text); border-color: var(--border); }
.isBip39questionTitle { position: relative; top: auto; left: auto; transform: none; margin: 110px auto 24px; }
.input-wrapper { width: min(400px, 100%); }
.centered-input-container { padding-inline: 16px; }
.bip39-helper-zone { position: relative; top: auto; left: auto; transform: none; }
.ticket-verifier-container { position: relative; inset: auto; margin: 90px 16px 24px; min-height: 60svh; padding: 64px 16px 24px; border-radius: 8px; }
.drop-zone { min-height: 220px; width: 100%; padding: 16px; }
.drop-zone-quote { max-width: calc(100% - 32px); text-align: center; }
.center-container { position: relative; top: auto; left: auto; transform: none; margin: 120px auto 40px; z-index: auto; }
.satoshis-display { font-size: 160px; max-width: 100%; }
@media (max-width: 600px) {
    #text1, #text2 { font-size: 72px; padding-inline: 16px; }
    .satoshis-display { font-size: 88px; }
    .ghost-qr-title { margin-top: 90px; }
    .currency-container { padding: 12px 8px; width: 100%; }
    #converter { padding-inline: 12px; }
    .contact-modal-content { padding: 20px 12px; }
    .contact-option { padding: 12px; }
    #gratitudeHeader { max-width: 100%; }
    .qr-seed-form { padding: 12px 0; }
    input, textarea, select { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.pwa-install-dialog {
    width: min(390px, calc(100vw - 32px));
    padding: 0;
    color: var(--text, #f4f4f4);
    background: #17191b;
    border: 1px solid #414448;
    border-top: 2px solid #f2a900;
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .58);
}

.pwa-install-dialog::backdrop {
    background: rgba(5, 6, 7, .82);
    backdrop-filter: blur(8px);
}

.pwa-install-content {
    position: relative;
    padding: 24px;
}

.pwa-install-content h2 {
    margin: 0 42px 8px 0;
    color: #f2a900;
    font-size: 1.2rem;
}

.pwa-install-message {
    margin: 0;
    color: var(--text-muted, #c4c7ca);
    line-height: 1.5;
}

.pwa-install-close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    color: var(--text-muted, #c4c7ca);
    background: #242628;
    border: 1px solid #414448;
    border-radius: 50%;
    cursor: pointer;
}

.pwa-install-close:hover,
.pwa-install-close:focus-visible {
    color: #f2a900;
    border-color: #f2a900;
}
