/* Pentarchy 2.0 — BTC Social Trading Club.
   Bitcoin-orange skin over arena-v3.css + layout: equity chart + live-trades on
   top, five bot-settings blocks full-width below. Rendered by btc.js. */

/* ─── Theme: recolor the accent system + ambient glows to Bitcoin orange ─── */
:root {
  --accent: #f7931a;                 /* Bitcoin orange */
  --accent-2: oklch(80% .15 62);
  --accent-deep: oklch(70% .16 55);
  --accent-glow: oklch(80% .18 60 / .55);

  --bg: #080605;                     /* a hair warmer than the cosmic black */
  --bg-2: oklch(13% .015 60);
  --bg-3: oklch(17% .02 60);
}
.cosmos-glow-1 { background: radial-gradient(circle, oklch(72% .19 60 / .24), transparent 60%); }
.cosmos-glow-2 { background: radial-gradient(circle, oklch(64% .15 78 / .18), transparent 60%); }

/* ─── Layout shell ─────────────────────────────────────────────────────── */
.p2-wrap { max-width: var(--container); margin: 0 auto; padding: 36px 22px 80px; }

.p2-hero { text-align: center; margin: 12px 0 30px; }
.p2-title { font-size: clamp(28px, 5vw, 56px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.02; }
.p2-title-sep { color: var(--fg-4); }
.p2-title-accent { color: var(--accent); text-shadow: 0 0 28px var(--accent-glow); }
.p2-lead { max-width: 620px; margin: 12px auto 0; color: var(--fg-2); font-size: 15.5px; }

.p2-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.p2-stat { min-width: 148px; padding: 11px 18px; background: var(--bg-2); border: 1px solid var(--rule); border-radius: var(--radius-sm); display: flex; flex-direction: column; gap: 3px; }
.p2-stat-hero { border-color: var(--accent); box-shadow: 0 0 38px var(--accent-glow); }
.p2-stat-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg-3); }
.p2-stat-value { font-family: var(--mono); font-size: 21px; font-weight: 700; color: var(--fg); }

.p2-col-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.p2-col-eyebrow { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; color: var(--accent); }
.p2-col-note { font-size: 12px; color: var(--fg-3); }

.p2-panel { background: var(--bg-2); border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 16px 18px; }

/* ─── Row 1: chart + live trades ───────────────────────────────────────── */
.p2-top { display: grid; grid-template-columns: 1.7fr 1fr; gap: 18px; align-items: stretch; margin-bottom: 26px; }
@media (max-width: 880px) { .p2-top { grid-template-columns: 1fr; } }
.p2-chart { display: flex; flex-direction: column; }
.chart-frame { position: relative; flex: 1; min-height: 300px; }
.p2-trades-col { display: flex; flex-direction: column; }
.p2-trades-col .trades { flex: 1; }

/* ─── Live trades feed ─────────────────────────────────────────────────── */
.trades { overflow-y: auto; max-height: 340px; margin: 0 -18px -16px; border-top: 1px solid var(--rule); }
.trade-row { display: grid; grid-template-columns: 50px 1fr auto; gap: 10px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--rule); animation: trade-in 360ms var(--ease); }
.trade-row:last-child { border-bottom: none; }
@keyframes trade-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.trade-time { font-family: var(--mono); font-size: 11px; color: var(--fg-4); }
.trade-mid { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.trade-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--agent, var(--accent)); }
.trade-agent { font-weight: 600; font-size: 13px; }
.trade-act { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; }
.act-open { color: var(--accent); background: var(--accent-glow); filter: saturate(1.2); }
.act-close { color: var(--fg-2); background: var(--bg-3); }
.act-live { color: #1c1206; background: var(--accent); font-weight: 700; }
.trade-live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); animation: barPulse 1.6s ease-in-out infinite; }
.trade-side-long { color: var(--green); }
.trade-side-short { color: var(--red); }
.trade-right { text-align: right; font-family: var(--mono); font-size: 12px; }
.trade-meta { color: var(--fg-3); }
.trade-pnl { font-weight: 700; }

/* ─── Row 2: five bot-settings blocks ──────────────────────────────────── */
.botboard { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
@media (max-width: 1000px) { .botboard { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .botboard { grid-template-columns: 1fr; } }

.botcard { position: relative; overflow: hidden; background: var(--bg-2); border: 1px solid var(--rule-2); border-radius: var(--radius); padding: 14px 14px; cursor: pointer; transition: border-color 160ms var(--ease), transform 160ms var(--ease), box-shadow 160ms var(--ease); }
.botcard::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--agent, var(--accent)); }
.botcard:hover { border-color: var(--agent, var(--accent)); transform: translateY(-2px); box-shadow: 0 12px 36px rgba(0,0,0,.45); }

.botcard-head { display: flex; align-items: center; gap: 9px; }
.botcard-avatar { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #0a0a0a; background: var(--agent, var(--accent)); }
.botcard-name { font-weight: 600; font-size: 14px; line-height: 1.1; }
.botcard-dir { margin-left: auto; font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 999px; }
.dir-long { color: var(--green); background: oklch(82% .22 145 / .14); }
.dir-short { color: var(--red); background: oklch(72% .22 25 / .14); }
.dir-flat { color: var(--fg-3); background: var(--bg-3); }

.botcard-status { display: inline-block; margin-top: 8px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.status-in { color: var(--accent); background: var(--accent-glow); filter: saturate(1.2); }
.status-wait { color: var(--fg-3); background: var(--bg-3); }

.botcard-rows { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule); display: flex; flex-direction: column; gap: 6px; }
.brow { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.brow-k { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-4); flex: 0 0 auto; }
.brow-v { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--fg-2); text-align: right; }
.brow-v.on { color: var(--accent); }
.brow-v.off { color: var(--fg-4); }

/* ─── Deal status (the bot's current live deal, under the settings) ─────── */
.deal { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule); }
.deal-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.deal-title { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.deal-pair { font-family: var(--mono); font-size: 10px; font-weight: 600; color: var(--fg-3); }
.deal-ruler { position: relative; height: 8px; margin: 0 10px 22px; background: linear-gradient(90deg, var(--accent-glow), var(--bg-3) 55%, oklch(82% .22 145 / .22)); border-radius: 999px; }
.dr-mark { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.dr-mark i { display: block; width: 9px; height: 9px; border-radius: 50%; background: var(--fg-3); box-shadow: 0 0 0 2px var(--bg-2); }
.dr-mark b { position: absolute; top: 9px; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-size: 8px; font-weight: 700; letter-spacing: 0.04em; color: var(--fg-4); }
.dr-cp i { background: var(--accent); box-shadow: 0 0 8px var(--accent-glow), 0 0 0 2px var(--bg-2); }
.dr-cp b { color: var(--accent); }
.dr-tp i { background: var(--green); }
.dr-zp i { background: var(--fg-2); }
.deal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }

.botcard-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--rule); display: flex; justify-content: space-between; align-items: baseline; }
.botcard-eq { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--fg); }
.botcard-roi { font-family: var(--mono); font-size: 12px; font-weight: 700; }
.pnl-pos { color: var(--green); }
.pnl-neg { color: var(--red); }

.p2-empty { padding: 36px 18px; text-align: center; color: var(--fg-3); font-size: 13px; }

/* ─── Reasoning drawer: force a full-height right-side sheet ──────────────────
   The shared arena-v3.css pins the fixed container with the `inset:0` shorthand.
   Some in-app WebViews (notably Telegram's, where the club lives) drop `inset`
   on a position:fixed element, so the panel loses its top/bottom anchors and
   collapses to its static spot near the end of <body> — a small chunk at the
   bottom. Re-state the geometry in explicit longhand plus an explicit
   width/height:100% so it always fills the viewport and reads as a panel
   anchored to the right edge. ID-level specificity guarantees this wins. */
#drawer.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%; height: 100%;
}
#drawer .drawer-overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%; height: 100%;
}
#drawer .drawer-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: auto;
  height: 100%;
  width: min(580px, 92vw);
  max-width: 100%;
}
