/* Ink & Ember — tokens, reset, type, controls. One accent (ember), jade for gains, ink panels, hairlines. */
@font-face { font-family: 'PD Display'; src: url('../fonts/pd-display.woff2') format('woff2'); font-display: block; }
@font-face { font-family: 'PD Sans'; src: url('../fonts/pd-sans.woff2') format('woff2'); font-weight: 300 900; font-stretch: 100% 125%; font-display: swap; }

:root {
  color-scheme: dark;
  --room: #0e0c0b; --ink-1: #131110; --ink-2: #181413; --ink-3: #1f1a18; --ink-4: #2a2420;
  --line: rgba(240, 222, 204, .075); --line-2: rgba(240, 222, 204, .13); --line-3: rgba(240, 222, 204, .22);
  --text: #f1e9dd; --text-2: #b4aa9d; --text-3: #8a8075; --text-4: #625a52;
  --paper: #ece4d6; --paper-hi: #f7f0e4; --ink: #1d1814;
  --ember: #ff5a1f; --ember-2: #ff7a3d; --ember-hot: #ffb35c; --ember-dim: rgba(255, 90, 31, .13);
  --up: #4fc48f; --up-dim: rgba(79, 196, 143, .13); --down: #ff5a1f; --down-dim: rgba(255, 90, 31, .13);
  --grid: rgba(240, 222, 204, .05); --axis: #81776d; --accent: #ff5a1f; --chart-bg: #0e0c0b; --chart-tag: #0e0c0b;
  --cross: rgba(240, 222, 204, .3); --chart-text: #f1e9dd;
  --ui: 'PD Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', system-ui, sans-serif;
  --display: 'PD Display', 'PD Sans', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --bar-h: 56px;
  --r1: 6px; --r2: 8px; --r3: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { background: var(--room); color: var(--text); font: 400 14px/1.5 var(--ui); -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 12px); }
body { min-height: 100vh; min-height: 100dvh; overflow-x: hidden; display: flex; flex-direction: column; }
img, svg, canvas { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
table { border-collapse: collapse; }
::selection { background: rgba(255, 90, 31, .35); color: #fff; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 3px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* numbers: proportional face, tabular figures where columns must line up */
.num, td, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }
.up { color: var(--up); } .down { color: var(--down); } .mute { color: var(--text-3); } .dim { color: var(--text-4); }
.display { font-family: var(--display); font-weight: 400; letter-spacing: .005em; }
.cap { font-size: 11px; font-weight: 650; letter-spacing: .08em; color: var(--text-3); text-transform: uppercase; }
html[lang^="zh"] .cap { letter-spacing: .04em; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 36px; padding: 0 16px;
  border-radius: var(--r1); font-weight: 650; font-size: 14px; line-height: 1; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .15s var(--ease); user-select: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-paper { background: var(--paper); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 12px 32px -16px rgba(255, 130, 60, .45); }
.btn-paper:hover:not(:disabled) { background: var(--paper-hi); }
.btn-line { border: 1px solid var(--line-3); color: var(--text); }
.btn-line:hover:not(:disabled) { border-color: rgba(240, 222, 204, .38); background: var(--ink-2); }
.btn-quiet { color: var(--text-2); padding: 0 10px; }
.btn-quiet:hover:not(:disabled) { color: var(--text); background: var(--ink-2); }
.btn-ember { background: var(--ember); color: #170b05; }
.btn-ember:hover:not(:disabled) { background: var(--ember-2); }
.btn-lg { height: 52px; padding: 0 24px; font-size: 16px; border-radius: 9px; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--ink-2); color: var(--text-4); border: 1px solid var(--line); box-shadow: none; }
kbd { font: 650 10.5px/1 var(--ui); padding: 3px 5px 2px; border-radius: 4px; border: 1px solid currentColor; opacity: .55; letter-spacing: 0; }

/* inputs */
.field { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r1);
  background: var(--ink-1); color: var(--text-3); transition: border-color .15s; }
.field:focus-within { border-color: var(--line-3); color: var(--text-2); }
.field input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); font-size: 13.5px; }
.field input::placeholder { color: var(--text-3); }

/* segmented + tabs */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--r2); }
.seg button { height: 30px; border-radius: 6px; font-size: 13px; font-weight: 650; color: var(--text-3); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--ink-3); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }
.tabs { display: flex; gap: 2px; }
.tabs button { position: relative; padding: 10px 10px 11px; font-size: 13px; font-weight: 650; color: var(--text-3); }
.tabs button:hover { color: var(--text-2); }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--text); }
.tabs button .n { margin-left: 4px; color: var(--text-3); font-weight: 600; }

/* tags: used sparingly (sample, status) */
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 3px; font-size: 10.5px; font-weight: 750;
  letter-spacing: .06em; background: var(--text-2); color: var(--room); white-space: nowrap; }
.tag-line { background: none; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line-3); }
.tag-ember { background: var(--ember); color: #170b05; }

/* skeleton: fixed size, no layout shift */
.sk { display: inline-block; height: .8em; min-width: 3em; border-radius: 3px; vertical-align: -.05em;
  background: linear-gradient(90deg, var(--ink-2) 0%, var(--ink-3) 50%, var(--ink-2) 100%); background-size: 200% 100%; animation: sk 1.4s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* value flashes when a number changes */
.fl-up { animation: flUp .9s var(--ease); } .fl-down { animation: flDown .9s var(--ease); } .fl-new { animation: flNew 1.6s var(--ease); }
@keyframes flUp { 0% { color: var(--up); text-shadow: 0 0 12px rgba(79, 196, 143, .5); } 100% { } }
@keyframes flDown { 0% { color: var(--down); text-shadow: 0 0 12px rgba(255, 90, 31, .5); } 100% { } }
@keyframes flNew { 0% { background-color: var(--ember-dim); } 100% { background-color: transparent; } }

/* tooltips via data-tip */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { content: attr(data-tip); position: absolute; z-index: 50; left: 50%; bottom: calc(100% + 8px);
  transform: translateX(-50%); padding: 6px 9px; border-radius: 6px; background: var(--ink-4); color: var(--text); font: 500 12px/1.4 var(--ui);
  letter-spacing: 0; text-transform: none; white-space: normal; width: max-content; max-width: 280px; text-align: left; pointer-events: none; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }

.state { color: var(--text-3); font-size: 13px; }
.state-err { color: var(--text-2); }
.state-err::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ember); margin-right: 8px; vertical-align: 1px; animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .sk { animation: none; }
}
