/* ===========================================================================
   DOGE Terminal — deep-space toy theme (shared art direction with
   YouGamePlay.com) crossed with a Matrix glyph-rain backdrop.
   Dark mode ONLY: one palette, no switcher, no prefers-color-scheme override.
   =========================================================================== */

:root {
  color-scheme: dark;
  --bg: #070b16;
  --bg-2: #0b1122;
  --panel: #141c30;
  --panel-2: #1b2540;
  --line: rgba(140, 200, 235, 0.14);
  --line-2: rgba(140, 200, 235, 0.30);
  --text: #e9f2f4;
  --muted: #aab8c9;
  --dim: #8c9bb0;
  --acc: #1ff0d0;
  --acc-soft: rgba(31, 240, 208, 0.14);
  --acc-line: rgba(31, 240, 208, 0.55);
  --hot: #ff2e63;   /* loss / serious */
  --gain: #2ee06f;  /* gain / good — always paired with a ▲/▼ or +/- glyph */
  --gold: #ffcf3f;
  --gold-ink: #6f4f08;
  --input-bg: #090f1d;

  /* Toy shading: one light from above — lit rim on top, shadow band below,
     interactive things sit on an extruded edge they press into. */
  --toy-rim: rgba(255, 255, 255, 0.11);
  --toy-rim-lit: rgba(255, 255, 255, 0.20);
  --toy-band: rgba(0, 0, 0, 0.30);
  --toy-edge: #070d1a;
  --round: 10px;

  --scanA: 0.05;
  --vigA: 0.5;
  --maxw: 100%; /* full-bleed layout — the chart is the centerpiece, give it the screen */
  --f-head: "Chakra Petch", system-ui, sans-serif;
  --f-mono: "Share Tech Mono", ui-monospace, monospace;
  --f-body: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--f-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(20px, 2.5vw, 40px); }
.mono { font-family: var(--f-mono); letter-spacing: .5px; }
.dim { color: var(--dim); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- Background stack ---------------------------------------------------- */
#bg-matrix {
  position: fixed; inset: 0; z-index: -3;
  width: 100%; height: 100%; display: block; pointer-events: none;
  background:
    radial-gradient(58% 46% at 82% -8%, rgba(86, 74, 176, 0.30), transparent 72%),
    radial-gradient(52% 44% at 12% 104%, rgba(24, 112, 150, 0.24), transparent 74%),
    linear-gradient(180deg, #060916 0%, #080d1e 46%, #0a1024 100%);
}
.bg-scanlines {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(31, 240, 208, var(--scanA)) 0px, transparent 1px, transparent 3px);
  mix-blend-mode: overlay;
}
.bg-vignette {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 100% at 50% 35%, transparent 58%, rgba(2, 3, 9, var(--vigA)) 100%);
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto !important; }
}

/* --- Top bar -------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: rgba(7, 11, 22, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-block: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-coin {
  width: 34px; height: 34px; display: grid; place-items: center;
  font-family: var(--f-head); font-weight: 700; font-size: 1.15rem;
  color: var(--gold-ink);
  background: linear-gradient(180deg, hsl(48 100% 78%), hsl(43 92% 62%));
  border-radius: 50%;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -3px 0 rgba(111,79,8,.35), 0 2px 0 var(--toy-edge);
}
.brand-name { font-family: var(--f-head); font-weight: 600; letter-spacing: 1px; font-size: 1rem; }
.brand-name b { color: var(--acc); font-weight: 700; }
.ticker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .8rem; color: var(--muted);
  padding: 6px 12px; border-radius: var(--round);
  background: var(--input-bg);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.5), inset 0 0 0 1px var(--line);
}
.ticker-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--dim); flex: none;
}
.ticker-dot.is-live { background: var(--gain); box-shadow: 0 0 8px var(--gain); }
.ticker-dot.is-err  { background: var(--hot);  box-shadow: 0 0 8px var(--hot); }

/* --- Stat tiles ----------------------------------------------------------- */
.tiles {
  display: grid; gap: 12px;
  grid-template-columns: repeat(4, 1fr);
  margin: 22px 0 16px;
}
.tile {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-radius: var(--round);
  padding: 14px 16px 12px;
  box-shadow:
    inset 0 1px 0 var(--toy-rim),
    inset 0 -10px 14px -12px var(--toy-band),
    0 3px 0 var(--toy-edge),
    inset 0 0 0 1px var(--line);
}
.tile-hero { box-shadow:
    inset 0 1px 0 var(--toy-rim-lit),
    inset 0 -10px 14px -12px var(--toy-band),
    0 3px 0 var(--toy-edge),
    inset 0 0 0 1px var(--acc-line); }
.tile-k { font-family: var(--f-head); font-weight: 600; font-size: .68rem; letter-spacing: 1.4px; color: var(--muted); }
.tile-v { font-size: 1.45rem; margin-top: 2px; }
.tile-hero .tile-v { color: var(--acc); font-size: 1.7rem; }
.tile-s { font-size: .72rem; color: var(--dim); margin-top: 1px; }
.tile-v.is-up { color: var(--gain); }
.tile-v.is-down { color: var(--hot); }

/* --- Panels --------------------------------------------------------------- */
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-radius: 14px;
  padding: 20px 22px 16px;
  margin-bottom: 22px;
  box-shadow:
    inset 0 1px 0 var(--toy-rim),
    inset 0 -14px 18px -16px var(--toy-band),
    0 4px 0 var(--toy-edge),
    inset 0 0 0 1px var(--line);
}
.panel-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 14px;
}
.panel-head h1, .panel-head h2 {
  font-family: var(--f-head); font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; margin: 6px 0 0;
  font-size: clamp(1.25rem, 3vw, 1.7rem);
}
.dim-sep { color: var(--dim); }
.kicker {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--f-head); font-weight: 600; font-size: .74rem;
  text-transform: uppercase; letter-spacing: 1px; color: var(--muted);
}
.kicker .idx {
  color: var(--acc); font-weight: 700;
  padding: 2px 7px; border-radius: 7px; background: var(--acc-soft);
  box-shadow: inset 0 1px 0 var(--toy-rim-lit), inset 0 0 0 1px var(--acc-line);
}
.panel-foot {
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  font-size: .72rem; color: var(--dim); margin-top: 10px;
}
.chart-legend { display: inline-flex; gap: 14px; flex-wrap: wrap; }
.lg { display: inline-flex; align-items: center; gap: 5px; }
.lg i { display: inline-block; width: 16px; border-top: 2px dashed; }
.lg-trend i { border-style: solid; border-color: var(--gold); }
.lg-proj i { border-color: var(--gold); opacity: .7; }
.lg-r i { border-color: var(--hot); }
.lg-s i { border-color: var(--gain); }
.lg-vp i { border-top: none; width: 10px; height: 9px; background: rgba(140, 200, 235, 0.25); }
/* CoinGecko fallback has no per-candle volume — hide the volume-based entries */
.chart-legend.no-vol .lg-r, .chart-legend.no-vol .lg-s, .chart-legend.no-vol .lg-vp { display: none; }

/* --- Range chips ----------------------------------------------------------- */
.range-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.coin-chips { padding-right: 14px; border-right: 1px solid var(--line-2); }
.chip {
  font-family: var(--f-head); font-weight: 700; font-size: .78rem;
  letter-spacing: .6px; color: var(--muted);
  padding: 7px 13px; border: 0; border-radius: var(--round);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: inset 0 1px 0 var(--toy-rim), 0 2px 0 var(--toy-edge), inset 0 0 0 1px var(--line);
  cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip.is-active {
  color: var(--acc);
  background: var(--acc-soft);
  transform: translateY(1px);
  box-shadow: inset 0 1px 0 var(--toy-rim-lit), 0 1px 0 var(--toy-edge), inset 0 0 0 1px var(--acc-line);
}

/* --- Chart stage ----------------------------------------------------------- */
.chart-stage { position: relative; height: min(58vh, 560px); min-height: 260px; }
#chart { width: 100%; height: 100%; display: block; cursor: crosshair; border-radius: 8px; }
.chart-tip {
  position: absolute; z-index: 3; pointer-events: none;
  font-size: .74rem; color: var(--text); white-space: nowrap;
  padding: 6px 10px; border-radius: 8px;
  background: rgba(7, 11, 22, 0.92);
  box-shadow: inset 0 0 0 1px var(--acc-line), 0 4px 12px rgba(0,0,0,.5);
}
.chart-tip b { color: var(--acc); font-weight: 400; }
.chart-msg {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: .85rem; color: var(--muted); text-align: center; padding: 20px;
}
.chart-msg[hidden] { display: none; }

/* --- Data tables ----------------------------------------------------------- */
.data-table-toggle { margin-top: 8px; }
.data-table-toggle summary {
  font-size: .72rem; color: var(--dim); cursor: pointer; width: max-content;
}
.data-table-toggle summary:hover { color: var(--acc); }
.data-table-scroll { overflow-x: auto; margin-top: 10px; }
.data-table {
  width: 100%; border-collapse: collapse;
  font-family: var(--f-mono); font-size: .8rem;
}
.data-table th, .data-table td {
  text-align: right; padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th {
  font-family: var(--f-head); font-weight: 600; font-size: .66rem;
  letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted);
}
#chart-table tbody { max-height: 300px; }
.pl-up { color: var(--gain); }
.pl-down { color: var(--hot); }

/* --- Portfolio ------------------------------------------------------------- */
.privacy-tag {
  font-size: .68rem; color: var(--dim);
  padding: 5px 10px; border-radius: 8px;
  background: var(--input-bg);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.5), inset 0 0 0 1px var(--line);
}
.lot-form {
  display: grid; gap: 12px; align-items: end;
  grid-template-columns: 1.2fr 1.2fr 1fr auto;
  margin-bottom: 16px;
}
.field label {
  display: block; font-family: var(--f-head); font-weight: 600;
  font-size: .68rem; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--muted); margin-bottom: 5px;
}
.field input {
  width: 100%; padding: 10px 12px;
  font-family: var(--f-mono); font-size: .92rem; color: var(--text);
  background: var(--input-bg); border: 0; border-radius: var(--round);
  box-shadow: inset 0 2px 3px rgba(0,0,0,.55), inset 0 0 0 1px var(--line);
}
.field input:focus {
  outline: none;
  box-shadow: inset 0 2px 3px rgba(0,0,0,.55), inset 0 0 0 1px var(--acc-line);
}
.field input::-webkit-calendar-picker-indicator { filter: invert(.7); }
.btn {
  font-family: var(--f-head); font-weight: 700; font-size: .82rem;
  letter-spacing: .8px; padding: 11px 18px;
  border: 0; border-radius: var(--round); cursor: pointer;
}
.btn-acc {
  color: #04241e;
  background: linear-gradient(180deg, #3ffadf, var(--acc) 55%, #14c8ac);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 3px 0 #0a6d5c, 0 5px 10px rgba(0,0,0,.35);
}
.btn-acc:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 1px 0 #0a6d5c; }
.btn-x {
  font-family: var(--f-mono); font-size: .78rem; color: var(--dim);
  background: none; padding: 4px 8px; border-radius: 7px;
}
.btn-x:hover { color: var(--hot); box-shadow: inset 0 0 0 1px rgba(255,46,99,.4); }
.tiles-portfolio { margin: 4px 0 6px; }
.empty-note { font-size: .78rem; color: var(--dim); text-align: center; padding: 14px 0 6px; }

/* --- Footer ---------------------------------------------------------------- */
.site-foot {
  font-size: .7rem; color: var(--dim); text-align: center;
  padding: 26px 0 34px;
}

/* --- Responsive ------------------------------------------------------------ */
@media (max-width: 860px) {
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .lot-form { grid-template-columns: 1fr 1fr; }
  .lot-form .btn { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile-v { font-size: 1.15rem; }
  .tile-hero .tile-v { font-size: 1.35rem; }
  .lot-form { grid-template-columns: 1fr; }
  .ticker { display: none; }
}
