/* One night palette across pages, popovers and native form controls. */
html[data-theme="dark"]{color-scheme:dark;--night-raised:#233128;--night-accent:#e1bb6b;--night-line:#445448}
html[data-theme="dark"] body{background:var(--bg)}
html[data-theme="dark"] :is(.story-controls,.story-preview-wrap,.story-help,.story-help-grid>div,.detail-trend-summary>div,.market-answer,.formula-guide,.account-card,.api-guide,.api-try,.endpoint){background:var(--surface);border-color:var(--border);color:var(--text)}
html[data-theme="dark"] :is(.quick-calculator,.price-alert-card,.calculation-result){background:#1c3427;border-color:#46614c;color:#f0f1e7}
html[data-theme="dark"] :is(.quick-calculator,.price-alert-card) :is(p,label,small){color:#d2dfd0}
html[data-theme="dark"] :is(.market-tabs,.analysis-tabs,.rate-mode,.story-asset-list,.story-theme-options){background:#121c16;border-color:var(--border)}
html[data-theme="dark"] :is(.market-tabs,.analysis-tabs) :is(button,a).active{background:#304735;color:#f3d694;border-color:#607053}
html[data-theme="dark"] .rate-mode label:has(input:checked){background:#304735;color:#f3d694}
html[data-theme="dark"] :is(.field,.quick-calculator) input[readonly]{background:#263a2c;color:#f1e3ba;border-color:#5c7055}
html[data-theme="dark"] :is(input,select,textarea){color-scheme:dark}
html[data-theme="dark"] option{background:#1b231e;color:#f0f1e7}
html[data-theme] select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M2 2l5 5 5-5' fill='none' stroke='%23b58b36' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:left 14px center;background-size:14px 9px;padding-left:38px}
html[data-theme="dark"] :is(.analysis-stats>div,.chart-message,.chart-empty,.story-themes button){background:#213126;color:var(--text);border-color:var(--border)}
html[data-theme="dark"] :is(input,textarea)::placeholder{color:#a9b7a8;opacity:1}
html[data-theme="dark"] :is(.analysis-chart,.history-chart){background-color:#15231a;border-color:var(--border)}
html[data-theme="dark"] .chart-loading{background:#15231a;color:#d2dfd0}
html[data-theme="dark"] .chart-loading.message-only{background:#15231a}
html[data-theme="dark"] .chart-loading p{color:#d2dfd0}
html[data-theme="dark"] .chart-skeleton{opacity:.25}
html[data-theme="dark"] :is(.chart-legend,.detail-sidebar dt,.detail-sidebar>p,.article-byline){color:var(--muted)}
html[data-theme="dark"] .site-footer{background:#0d1711;border-color:var(--border)}
html[data-theme="dark"] .prose a,html[data-theme="dark"] .prose a:visited{color:#e1bb6b;text-decoration:underline;text-underline-offset:4px}
html[data-theme="dark"] .story-asset-list label:has(input:checked){background:#2b3e2d;border-color:#b19455}
html[data-theme="dark"] :is(.story-theme-options button,.story-help-grid>div){color:var(--text)}
html[data-theme="dark"] :is(.mobile-menu,.search-dialog){background:var(--surface);color:var(--text);border-color:var(--border)}
html[data-theme="dark"] :is(.mobile-menu a,#search-results a){color:var(--text);border-color:var(--border)}
html[data-theme="dark"] :is(.mobile-menu a,#search-results a):hover{background:var(--night-raised)}
html[data-theme="dark"] :is(.asset-picker-menu,.asset-picker-panel){background:#1b2d21;border-color:#647754;color:#f0f1e7}
html[data-theme="dark"] .asset-picker-trigger{background:#263a2c;color:#f0f1e7;border-color:#647754}
:is(.page-top h1,.reading-page h1){text-wrap:balance;overflow-wrap:break-word}
@media(max-width:640px){.page-top h1{font-size:25px;line-height:1.85}.quote-card .asset-title h3{line-height:1.8}.quote-card .asset-title{min-width:0}.quote-card .asset-title h3{overflow-wrap:break-word}}
