/* Išdėstymas: viršuje gyva kaina, po ja įvedimo juosta, tada dideli P/L skaičiai ir grafikas per visą plotį. */
:root {
  --bg: #eceff3;
  --surface: #ffffff;
  --ink: #0f1620;
  --muted: #5a6676;
  --line: #d3dae3;
  --accent: #f7931a;
  --up: #0b8f5a;
  --down: #d03545;
  --up-soft: rgba(11,143,90,.14);
  --down-soft: rgba(208,53,69,.14);
  --font-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1118;
    --surface: #131a23;
    --ink: #e9eef4;
    --muted: #8a96a6;
    --line: #243040;
    --accent: #f7931a;
    --up: #3ddc97;
    --down: #ff6b78;
    --up-soft: rgba(61,220,151,.16);
    --down-soft: rgba(255,107,120,.16);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  padding-inline: 16px;
  padding-block: 24px 48px;
}
.wrap { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: 28px; letter-spacing: -.02em; margin: 0; line-height: 1.1; text-wrap: balance; }
h1 span { color: var(--accent); }
.live { text-align: right; }
.live .label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--up); animation: pulse 2s ease-in-out infinite; }
.dot.err { background: var(--down); }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .dot.on { animation: none; } }
.live .price { font-family: var(--font-data); font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }

.inputs { display: grid; grid-template-columns: 1fr 1fr 120px; gap: 12px; padding: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
input, select {
  font: inherit; font-family: var(--font-data); font-size: 16px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; width: 100%; min-width: 0;
}
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.note { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--muted); }
.note[hidden] { display: none; }

.result { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; padding: 20px; align-items: center; }
.pl-label { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pl-pct { font-family: var(--font-display); font-weight: 700; font-size: clamp(44px, 9vw, 72px); letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.pl-abs { font-family: var(--font-data); font-size: 18px; font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; font-family: var(--font-data); font-variant-numeric: tabular-nums; }

.chart-panel { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.chart-head h2 { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 500; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 3px; border-radius: 8px; }
.tabs button {
  font: inherit; font-size: 13px; border: 0; background: transparent; color: var(--muted);
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
#chart { position: relative; width: 100%; }
#chart svg { display: block; width: 100%; touch-action: pan-y; }
.axis-text { font-family: var(--font-data); font-size: 11px; fill: var(--muted); }
.grid-line { stroke: var(--line); stroke-width: 1; }
.zero-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.tip {
  position: absolute; pointer-events: none; background: var(--ink); color: var(--bg);
  font-family: var(--font-data); font-size: 12px; padding: 8px 10px; border-radius: 6px;
  line-height: 1.5; white-space: nowrap; transform: translate(-50%, -100%); z-index: 2;
}
.tip[hidden] { display: none; }
.chart-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); text-align: center; padding: 16px; }
.chart-msg button { font: inherit; background: var(--accent); color: #1b1100; border: 0; border-radius: 6px; padding: 8px 14px; cursor: pointer; font-weight: 500; }
.chart-msg[hidden] { display: none; }
.stats-row { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 13px; color: var(--muted); }
.stats-row b { font-family: var(--font-data); font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
footer { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

@media (max-width: 640px) {
  .inputs { grid-template-columns: 1fr 1fr; }
  .inputs .field:last-of-type { grid-column: 1 / -1; }
  .result { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
  .live { text-align: left; }
  .live .label { justify-content: flex-start; }
  h1 { font-size: 24px; }
}
