/* Protocol Desk — Meta Ray-Ban Display web app.
   The panel is a 600x600 monocular HUD with a ~20° FOV, so the effective readable area is
   small: design BIG, high-contrast, and keep the live content inside the central safe zone.
   No mouse — input is the Neural Band D-pad, which arrives as arrow keys + Enter. */

:root {
  /* Desk palette (warm near-black + neon), carried over so the glasses feel like the desk. */
  --ground: #16140F;
  --surface: #201D17;
  --surface2: #27241C;
  --surface3: #2F2B22;
  --ink: #F0EDE6;
  --muted: #A19B8E;
  --faint: #736E62;
  --line: #34302704;
  --edge: #2DD4BF;   /* teal */
  --drift: #2DD4BF;
  --go: #3FE0A0;     /* green */
  --avoid: #F26B86;  /* pink */
  --theta: #F2B340;  /* amber */
  --print: #A78BFA;  /* purple */
  --blue: #6AA6F2;
  --acc: var(--edge);
}

/* Lane accent — drives --acc, which every card/badge/dot/gauge/bar reads. Matches the desk:
   drift = teal, theta = amber, single-print (event) = purple. Default (no lane) = teal edge. */
.lane-drift { --acc: var(--drift); }
.lane-theta { --acc: var(--theta); }
.lane-print { --acc: var(--print); }

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 600px; height: 600px;
  background: #000;
  color: var(--ink);
  font-family: "SF Pro Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* The 600x600 panel. A subtle inner safe-zone padding keeps text off the lens edge,
   where waveguide fringing is worst. */
#stage {
  position: relative;
  width: 600px; height: 600px;
  background:
    radial-gradient(120% 90% at 50% 0%, #1c1913 0%, var(--ground) 60%, #100e0a 100%);
  padding: 40px 56px 36px;
  display: flex; flex-direction: column;
}

/* ---- Section rail (which view: Edges / Positions / Today) ---- */
#rail {
  display: flex; gap: 10px; align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.rail-tab {
  font-size: 19px; font-weight: 700; letter-spacing: .04em;
  color: var(--faint); text-transform: uppercase;
  padding: 6px 14px; border-radius: 999px;
  white-space: nowrap;
}
.rail-tab.on { color: var(--ground); background: var(--acc); }
.rail-tab .n { opacity: .7; font-weight: 800; margin-left: 6px; }
.rail-dot { color: var(--faint); font-size: 13px; }

/* ---- Card area (the carousel) ---- */
#card { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; padding-top: 18px; overflow: hidden; }

.pager { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.pager .arrow { font-size: 26px; color: var(--acc); width: 28px; text-align: center; }
.pager .arrow.off { color: var(--faint); opacity: .35; }
.pager .pos { letter-spacing: .04em; }

/* A glance card: the at-a-glance face of an edge / position. */
.card {
  flex: 1 1 auto; min-height: 0;
  background: linear-gradient(160deg, var(--surface2), var(--surface));
  border: 1px solid #3a352a;
  border-left: 6px solid var(--acc);
  border-radius: 22px;
  padding: 24px 26px;
  display: flex; flex-direction: column;
  box-shadow: 0 0 0 1px #00000040, 0 0 34px -8px color-mix(in srgb, var(--acc) 45%, transparent);
}

.lane-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.lane-badge {
  font-size: 15px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  color: var(--acc); border: 1.5px solid color-mix(in srgb, var(--acc) 55%, transparent);
  background: color-mix(in srgb, var(--acc) 14%, transparent);
  padding: 4px 11px; border-radius: 999px;
}
.cat { font-size: 15px; color: var(--muted); font-weight: 600; }

.title { font-size: 27px; font-weight: 750; line-height: 1.18; color: var(--ink); margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.spacer { flex: 1 1 auto; }

/* Conviction headline + dots */
.conv { display: flex; align-items: baseline; gap: 12px; margin-top: 14px; }
.conv .pct { font-size: 58px; font-weight: 800; line-height: 1; color: var(--acc); letter-spacing: -.02em; }
.conv .lbl { font-size: 16px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.dots { display: flex; gap: 6px; margin-top: 12px; }
.dots i { width: 13px; height: 13px; border-radius: 50%; background: #4a443800; border: 2px solid var(--faint); }
.dots i.on { background: var(--acc); border-color: var(--acc); box-shadow: 0 0 8px -1px var(--acc); }

.callrow { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.call { font-size: 22px; font-weight: 800; padding: 7px 14px; border-radius: 12px; }
.call.up { color: var(--go); background: color-mix(in srgb, var(--go) 15%, transparent); }
.call.down { color: var(--avoid); background: color-mix(in srgb, var(--avoid) 15%, transparent); }
.edgepill { font-size: 18px; font-weight: 700; color: var(--muted); }
.edgepill b { color: var(--ink); font-size: 22px; }

.why { font-size: 18px; line-height: 1.4; color: var(--muted); margin-top: 14px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Fair-value / price gauge */
.gauge { margin-top: 18px; }
.gauge .track { position: relative; height: 12px; border-radius: 999px; background: #100e0a; border: 1px solid #3a352a; }
.gauge .fill { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 999px; background: var(--acc); opacity: .55; }
.gauge .mk { position: absolute; top: -5px; width: 4px; height: 22px; border-radius: 2px; transform: translateX(-2px); }
.gauge .mk.px { background: var(--ink); }
.gauge .mk.fv { background: var(--go); }
.gauge .labels { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-top: 9px; font-weight: 600; }

/* Position pulse gauge: entry → now → target */
.pulse { margin-top: 18px; }
.pulse .pnl { font-size: 50px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.pulse .sub { font-size: 17px; color: var(--muted); font-weight: 600; margin-top: 6px; }
.pulse .bar { position: relative; height: 14px; border-radius: 999px; background: #100e0a; border: 1px solid #3a352a; margin-top: 18px; }
.pulse .seg { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.pulse .now { position: absolute; top: -6px; width: 5px; height: 26px; border-radius: 3px; background: var(--ink); transform: translateX(-2px); box-shadow: 0 0 8px -1px var(--ink); }
.pulse .ends { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-top: 10px; font-weight: 600; }
.supports { font-size: 17px; font-weight: 700; margin-top: 14px; }
.supports.ok { color: var(--go); }
.supports.off { color: var(--avoid); }
.supports.neutral { color: var(--muted); }

/* ---- Expanded full card (overlay) ---- */
#overlay {
  position: absolute; inset: 0; z-index: 20;
  background: radial-gradient(120% 90% at 50% 0%, #1c1913 0%, var(--ground) 70%, #0c0a07 100%);
  padding: 30px 44px 30px;
  display: flex; flex-direction: column;
}
#overlay[hidden] { display: none; }
.ov-head { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; margin-bottom: 10px; }
.ov-back { font-size: 17px; color: var(--acc); font-weight: 700; }
.ov-scroll { flex: 1 1 auto; overflow: hidden; min-height: 0; position: relative; }
.ov-inner { position: absolute; left: 0; right: 0; top: 0; transition: top .12s ease-out; }
.ov-title { font-size: 25px; font-weight: 750; line-height: 1.18; margin-bottom: 14px; }

.block { background: var(--surface); border: 1px solid #34302a; border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; }
.block.acc { border-left: 5px solid var(--acc); }
.block h4 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; margin-bottom: 10px; }
.kv { display: flex; justify-content: space-between; align-items: baseline; font-size: 19px; margin: 7px 0; }
.kv span { color: var(--muted); font-weight: 600; }
.kv b { color: var(--ink); font-weight: 800; }
.kv b.go { color: var(--go); } .kv b.avoid { color: var(--avoid); } .kv b.acc { color: var(--acc); }
.para { font-size: 18px; line-height: 1.45; color: var(--ink); }
.para.muted { color: var(--muted); }

.fact { font-size: 16px; line-height: 1.4; margin: 9px 0; color: var(--ink); }
.fact .mk { font-weight: 800; margin-right: 6px; }
.fact.ok .mk { color: var(--go); }
.fact.warn { color: var(--muted); } .fact.warn .mk { color: var(--theta); }

/* Rank breakdown bar */
.rank { margin-top: 4px; }
.rank .rtrack { display: flex; height: 16px; border-radius: 999px; overflow: hidden; background: #100e0a; border: 1px solid #3a352a; }
.rank .rseg { height: 100%; }
.rank .rkey { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; }
.rank .rk { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.rank .rk i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.rank .rk b { color: var(--ink); }

.poly { font-size: 16px; font-weight: 700; padding: 8px 12px; border-radius: 10px; display: inline-block; }
.poly.aligned { color: var(--go); background: color-mix(in srgb, var(--go) 14%, transparent); }
.poly.diverged { color: var(--avoid); background: color-mix(in srgb, var(--avoid) 14%, transparent); }
.poly.thin { color: var(--muted); background: #ffffff0a; }

/* The re-forecast action — shown at the bottom of the expanded card, focusable. */
.reforecast {
  flex: 0 0 auto; margin-top: 12px;
  font-size: 21px; font-weight: 800; text-align: center;
  padding: 14px; border-radius: 14px;
  color: var(--ground); background: var(--acc);
  box-shadow: 0 0 20px -4px var(--acc);
}
.reforecast.busy { background: var(--surface3); color: var(--muted); box-shadow: none; }
.reforecast .small { display: block; font-size: 13px; font-weight: 600; opacity: .8; margin-top: 2px; }

/* ---- Performance view ---- */
/* Performance window switcher — visible Today / Week / Month / All tabs, ◀▶ moves between them. */
.ptabs { display: flex; gap: 8px; justify-content: center; margin-bottom: 9px; }
.ptab { flex: 1 1 0; text-align: center; font-size: 17px; font-weight: 700; letter-spacing: .02em;
  color: var(--muted); background: var(--surface); border: 1px solid #34302a; border-radius: 999px; padding: 8px 4px; }
.ptab.on { color: var(--ground); background: var(--acc); border-color: var(--acc); }

.perf { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.perf .net { font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.perf .net .cap { font-size: 15px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; display: block; margin-bottom: 4px; }
.perf .netsub { font-size: 15px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.curve { margin: 8px 0 2px; }
.pf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 6px; }
.pf-card { background: var(--surface); border: 1px solid #34302a; border-radius: 14px; padding: 9px 13px; }
.pf-card .l { font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pf-card .v { font-size: 24px; font-weight: 800; display: block; margin-top: 2px; }
.pf-card .s { font-size: 12px; color: var(--faint); font-weight: 600; }

/* ---- Hint bar ---- */
#hint { flex: 0 0 auto; display: flex; justify-content: center; gap: 22px; margin-top: 16px;
  font-size: 15px; color: var(--faint); font-weight: 600; }
#hint b { color: var(--muted); }
#hint .key { color: var(--acc); font-weight: 800; }

/* ---- States ---- */
.center { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.center .big { font-size: 26px; font-weight: 750; }
.center .sub { font-size: 18px; color: var(--muted); max-width: 420px; line-height: 1.4; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 5px solid #ffffff1a; border-top-color: var(--acc); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { font-size: 20px; color: var(--muted); flex: 1 1 auto; display: flex; align-items: center; justify-content: center; text-align: center; }

.flash { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 40;
  background: var(--surface3); border: 1px solid #4a4438; color: var(--ink);
  font-size: 15px; font-weight: 700; padding: 8px 16px; border-radius: 999px; }
