/* ==========================================================================
   MASTER ACCOUNT — our own money on both EAs (master.js).
   Colour roles from the theme: gold is ZEUS and money, silver (the theme's
   frost) is APOLLO, teal / ember only for monthly profit and loss.
   Deep glass panels, hairlines, mono figures, one draw-in on reveal.
   ========================================================================== */
.master { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.mledger__sample.sample-tag { position: absolute; top: 14px; right: 16px; bottom: auto; z-index: var(--z-raised); }

/* the ledger: what went in, what came out, what is there now, and the return */
.mledger { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.3fr); align-items: end; padding: clamp(22px, 2.8vw, 34px); border-radius: var(--r-window); background: var(--deep-glass); box-shadow: var(--sh-modal); }
.mledger__fig { padding: 0 22px; box-shadow: inset -1px 0 0 var(--edge-soft); }
.mledger__fig:first-child { padding-left: 0; }
.mledger__fig--hero { padding-right: 0; box-shadow: none; }
.mledger__fig b { display: block; margin-top: 10px; font-size: clamp(22px, 2.3vw, 30px); font-weight: 500; line-height: 1; color: var(--text-hi); }
.mledger__fig b.gold { color: transparent; }
.mledger__fig--hero b { font-family: var(--font-display); font-size: clamp(44px, 5vw, 66px); line-height: .95; }
.mledger__fig small { display: block; margin-top: 9px; font-size: 12.5px; line-height: 1.4; color: var(--text-4); }
.mledger__bar { grid-column: 1 / -1; display: flex; gap: 2px; height: 10px; margin-top: 28px; border-radius: 3px; overflow: hidden; }
.mledger__bar i { display: block; min-width: 3px; }
.mledger__key { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 12px; font-size: 13px; color: var(--text-3); }
.mledger__key i { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 2px; vertical-align: 1px; }
.k-cap { background: #4c5566; }
.k-out { background: var(--gold-hi); }
.k-gain, .k-zeus { background: var(--gold-grad); }
.k-apollo { background: linear-gradient(90deg, #98c0ef, #d8ecf8); }

/* the chart */
.mchart-card { padding: clamp(18px, 2.4vw, 28px); border-radius: var(--r-window); background: var(--deep-glass); box-shadow: var(--sh-modal); }
.mchart-card__top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 8px; }
.mlegend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--text-3); }
.mlegend i, .mchart__tip i { display: inline-block; width: 14px; height: 2px; margin-right: 8px; vertical-align: middle; border-radius: 2px; }
.lz { background: var(--gold); box-shadow: 0 0 6px rgba(242, 199, 92, .6); }
.la { background: var(--text-2); }
.ld { background: repeating-linear-gradient(90deg, rgba(186, 214, 247, .55) 0 4px, transparent 4px 7px); }
.lc { width: 9px !important; height: 9px !important; border-radius: 50% !important; background: var(--bg); box-shadow: inset 0 0 0 2px var(--gold-hi); }
.mchart { position: relative; height: clamp(300px, 32vw, 420px); cursor: crosshair; touch-action: pan-y; user-select: none; }
.mchart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mchart .g { stroke: rgba(186, 214, 247, .07); stroke-dasharray: 2 6; }
.mchart .mg { stroke: rgba(186, 214, 247, .045); }
.mchart .gl, .mchart .ml { font-family: var(--font-mono); font-size: 10.5px; fill: var(--text-4); }
.mchart .base { stroke: rgba(186, 214, 247, .38); stroke-dasharray: 4 6; }
.mchart .basel { font-size: 11.5px; fill: var(--text-3); }
.mchart .ar--zeus { fill: url(#mFillZeus); }
.mchart .ar--apollo { fill: url(#mFillApollo); }
.mchart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; }
.mchart .ln--zeus { stroke: var(--gold); filter: drop-shadow(0 0 6px rgba(242, 199, 92, .4)); }
.mchart .ln--apollo { stroke: var(--text-2); stroke-width: 1.6; }
.mchart .wl { stroke: rgba(255, 231, 163, .4); stroke-dasharray: 2 3; }
/* one orchestrated moment: the lines draw in once the board is on screen (and again when the view changes) */
.master.is-live .mchart .ln { animation: mDraw 1.8s ease-out both; }
.master.is-live .mchart .ar { animation: mRise 1.2s ease-out .25s both; }
@keyframes mDraw { from { stroke-dashoffset: 1; } }
@keyframes mRise { from { opacity: 0; } }

.mchart__marks { position: absolute; inset: 0; pointer-events: none; }
.mcoin { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 2px var(--gold-hi), 0 0 12px rgba(242, 199, 92, .55); }
.mcoin--apollo { box-shadow: inset 0 0 0 2px var(--text-hi), 0 0 10px rgba(216, 236, 248, .45); }
.mmark { position: absolute; display: grid; justify-items: center; gap: 3px; transform: translate(-50%, -100%); }
.mmark b { padding: 3px 9px; border-radius: var(--r-pill); white-space: nowrap; font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: #1b1305; background: var(--gold-grad); box-shadow: var(--sh-gold); }
.mmark--apollo b { color: var(--bg); background: linear-gradient(100deg, #98c0ef, #d8ecf8 50%, #98c0ef); box-shadow: 0 0 0 1px rgba(216, 236, 248, .5), 0 8px 20px -10px rgba(216, 236, 248, .5); }
.mmark small { white-space: nowrap; font-size: 10.5px; color: var(--text-3); }
.mnow { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--gold-hi); box-shadow: 0 0 0 4px rgba(242, 199, 92, .22), 0 0 14px rgba(242, 199, 92, .9); }
.mnow__tag { position: absolute; right: 0; padding: 3px 8px; border-radius: var(--r-pill); transform: translateY(-50%); font-family: var(--font-mono); font-size: 11px; font-weight: 600; color: #1b1305; background: var(--gold); }
.mchart__cross { position: absolute; left: 0; top: 34px; bottom: 26px; width: 1px; background: rgba(216, 236, 248, .3); pointer-events: none; }
.mchart__tip { position: absolute; left: 0; top: 40px; z-index: var(--z-raised); min-width: 188px; padding: 11px 13px; border-radius: 12px; pointer-events: none; font-size: 12.5px; color: var(--text-3); background: var(--deep-glass); box-shadow: var(--sh-modal); }
.mchart__tip b { display: block; margin-bottom: 7px; font-weight: 500; color: var(--text-hi); }
.mchart__tip div { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; }
.mchart__tip div span:last-child { font-family: var(--font-mono); color: var(--text-hi); }
.mchart__tip .tot { margin-top: 4px; padding-top: 6px; box-shadow: inset 0 1px 0 var(--edge-soft); }
.mchart__tip .tot span:last-child { color: var(--gold-hi); }
.mchart__tip .po span:last-child { color: var(--gold-hi); }

/* two panels side by side: every month, and where the profit came from */
.mgrid2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; }
.mblock { padding: clamp(18px, 2.2vw, 26px); border-radius: var(--r-window); background: var(--glass); box-shadow: var(--sh-card); }
.mblock h3 { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 16px; font-size: 18px; }
.mblock h3 span { font-family: var(--font-body); font-size: 12.5px; font-weight: 400; color: var(--text-4); }

.mmonths { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--glass-3) transparent; }
.mm { display: grid; grid-template-columns: 70px repeat(var(--n), minmax(46px, 1fr)) 72px; gap: 3px; min-width: min-content; }
.mm__h { padding: 2px 0 6px; text-align: center; font-family: var(--font-mono); font-size: 10.5px; line-height: 1.2; color: var(--text-4); white-space: nowrap; }
.mm__h em { display: block; font-style: normal; font-size: 9.5px; color: var(--text-4); opacity: .8; }
.mm__corner { position: sticky; left: 0; z-index: var(--z-raised); background: linear-gradient(var(--glass), var(--glass)), var(--bg); }
.mm__r { position: sticky; left: 0; z-index: var(--z-raised); display: flex; align-items: center; padding-right: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-2); background: linear-gradient(var(--glass), var(--glass)), var(--bg); }
.mm__r--zeus { color: var(--gold-hi); }
.mm__r--apollo { color: var(--text-hi); }
.mm__c { display: grid; place-items: center; padding: 9px 2px; border-radius: 6px; font-family: var(--font-mono); font-size: 12px; }
.mm__c b { font-weight: 500; }
.mm__t { display: grid; place-items: center; border-radius: 6px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--gold-hi); background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--gold-edge); }

.mmk { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 10px 0; }
.mmk + .mmk { box-shadow: inset 0 1px 0 var(--edge-soft); }
.mmk b { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--text-hi); }
.mmk__bar { display: flex; gap: 2px; height: 8px; border-radius: 4px; overflow: hidden; background: var(--glass-2); }
.mmk__bar i { display: block; height: 100%; }
.mmk__v { text-align: right; font-family: var(--font-mono); font-size: 13px; color: var(--text-hi); }
.mmk__v small { display: block; margin-top: 2px; font-family: var(--font-body); font-size: 11px; color: var(--text-4); }
.mmk__key { display: flex; gap: 18px; margin-top: 12px; font-size: 12.5px; color: var(--text-3); }
.mmk__key i { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 2px; vertical-align: 1px; }

.mstats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; margin: 0; border-radius: var(--r-card); overflow: hidden; background: var(--edge-soft); box-shadow: var(--sh-hair); }
.mstats div { padding: 16px 18px; background: var(--bg-2); }
.mstats dt { font-size: 12px; color: var(--text-4); }
.mstats dd { margin: 6px 0 0; font-family: var(--font-mono); font-size: 19px; font-weight: 500; color: var(--text-hi); }
/* beside the markets panel the stats become a two-column ledger of the same height */
.mgrid2 .mstats { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 1fr; border-radius: var(--r-window); }
.mgrid2 .mstats div { display: flex; flex-direction: column; justify-content: center; padding: 18px 22px; }
.mgrid2 .mstats div:last-child { grid-column: 1 / -1; }
.mgrid2 .mstats dd { font-size: clamp(20px, 2vw, 26px); }

.mtrades .pf-lock { min-height: 290px; }
.mtrades .pf-tr__sym .pf-prod { margin-right: 8px; }

@media (max-width: 1080px) {
  .mledger { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 26px; }
  .mledger__fig--hero { grid-column: 1 / -1; grid-row: 1; padding: 0; }
  .mledger__fig:nth-child(3) { box-shadow: none; }
  .mgrid2 { grid-template-columns: minmax(0, 1fr); }
  .mgrid2 .mstats { grid-template-columns: repeat(5, minmax(0, 1fr)); grid-auto-rows: auto; border-radius: var(--r-card); }
  .mgrid2 .mstats div { padding: 16px 18px; }
  .mgrid2 .mstats div:last-child { grid-column: auto; }
  .mgrid2 .mstats dd { font-size: 19px; }
}
@media (max-width: 760px) {
  .mledger { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 20px 18px; }
  .mledger__fig { padding: 0 14px; }
  .mledger__fig:nth-child(2) { box-shadow: none; padding-right: 0; }
  .mledger__fig:nth-child(3) { grid-column: 1 / -1; padding: 0; }
  .mledger__fig:nth-child(1), .mledger__fig:nth-child(3) { padding-left: 0; }
  .mledger__fig b { font-size: 24px; }
  .mledger__fig--hero b { font-size: 52px; }
  .mchart-card { padding: 16px 14px; }
  .mchart-card__top .seg { display: flex; width: 100%; }
  .mchart-card__top .seg button { flex: 1; padding: 0 6px; }
  .mchart { height: 280px; }
  .mmark small, .mview__more { display: none; }
  .mstats, .mgrid2 .mstats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mstats div:last-child, .mgrid2 .mstats div:last-child { grid-column: 1 / -1; }
  .mmk { grid-template-columns: 66px minmax(0, 1fr) auto; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { .master.is-live .mchart .ln, .master.is-live .mchart .ar { animation: none; } }
