/* =============================================================
 * styles-handwritten.css — layouts manuscritos pro /post
 * 5 templates: papel pautado · post-it · moleskine · recibo · polaroid
 * Família de fontes carregadas em index.html (Caveat, Patrick Hand,
 * Kalam, Special Elite, Architects Daughter).
 * ============================================================= */

/* --------- VARIÁVEIS DOS LAYOUTS --------- */
.pf-note {
  --ink:        #1A2842;
  --ink-soft:   #2E436E;
  --pencil:     #3a3a3a;
  --paper:      #F4EFE2;
  --paper-line: #B7D2EC;
  --paper-red:  #E08A8A;
  --postit:     #FFE36A;
  --postit-tone:#D9B926;
  --moleskine-cream: #EDE3CC;
  --moleskine-cover: #2A1F18;
  --thermal:    #FAF7EE;
}

/* Base do "note" 1080×1080 — herda o frame .pf-square */
.pf-note { position: absolute; inset: 0; overflow: hidden; }

/* =============================================================
 * M1 · PAPEL PAUTADO (caderno escolar)
 * ============================================================= */
.pf-m1 {
  background:
    linear-gradient(180deg, #F8F1DE 0%, #F0E7CF 100%);
}
.pf-m1::before { /* furos da espiral à esquerda */
  content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 96px;
  background:
    radial-gradient(circle at 50% 60px,  rgba(0,0,0,0.5) 11px, transparent 12px),
    radial-gradient(circle at 50% 180px, rgba(0,0,0,0.5) 11px, transparent 12px),
    radial-gradient(circle at 50% 300px, rgba(0,0,0,0.5) 11px, transparent 12px),
    radial-gradient(circle at 50% 420px, rgba(0,0,0,0.5) 11px, transparent 12px),
    radial-gradient(circle at 50% 540px, rgba(0,0,0,0.5) 11px, transparent 12px),
    radial-gradient(circle at 50% 660px, rgba(0,0,0,0.5) 11px, transparent 12px),
    radial-gradient(circle at 50% 780px, rgba(0,0,0,0.5) 11px, transparent 12px),
    radial-gradient(circle at 50% 900px, rgba(0,0,0,0.5) 11px, transparent 12px),
    radial-gradient(circle at 50% 1020px,rgba(0,0,0,0.5) 11px, transparent 12px),
    linear-gradient(90deg, transparent 95px, rgba(232,80,80,0.55) 95px 97px, transparent 97px);
}
.pf-m1::after { /* linhas horizontais pautadas */
  content: ''; position: absolute; top: 110px; left: 110px; right: 50px; bottom: 50px;
  background-image: repeating-linear-gradient(transparent, transparent 47px, rgba(120,160,200,0.55) 47px, rgba(120,160,200,0.55) 48px);
  pointer-events: none;
}
.pf-m1-content { position: absolute; top: 70px; left: 130px; right: 60px; bottom: 60px; }
.pf-m1 .pf-m1-date {
  position: absolute; top: 10px; right: 0;
  font-family: 'Caveat', cursive; font-size: 32px; color: #C04040; transform: rotate(-2deg);
}
.pf-m1 .pf-m1-title {
  font-family: 'Caveat', cursive; font-size: 78px; color: var(--ink);
  line-height: 1.0; letter-spacing: -1px; transform: rotate(-0.6deg);
  text-shadow: 0 0 1px rgba(26,40,66,0.25);
}
.pf-m1 .pf-m1-sub {
  font-family: 'Patrick Hand', cursive; font-size: 28px; color: #5A4A2C; margin-top: 6px;
  transform: rotate(-0.3deg);
}
.pf-m1 .pf-m1-list { margin-top: 50px; font-family: 'Patrick Hand', cursive; font-size: 38px; color: var(--ink); }
.pf-m1 .pf-m1-row { display: flex; align-items: baseline; gap: 18px; padding: 14px 0; border-bottom: 1px dashed rgba(120,160,200,0.5); transform: rotate(calc((var(--rx, 0)) * 1deg)); }
.pf-m1 .pf-m1-rank { font-family: 'Caveat', cursive; font-size: 64px; color: #C04040; min-width: 70px; line-height: 1; transform: rotate(-3deg); }
.pf-m1 .pf-m1-name { flex: 1; font-weight: 600; color: var(--ink); }
.pf-m1 .pf-m1-pct  { font-family: 'Caveat', cursive; font-size: 52px; color: #0E5C2F; min-width: 200px; text-align: right; line-height: 1; }
.pf-m1 .pf-m1-pct.neg { color: #B72C2C; }
.pf-m1 .pf-m1-meta { font-size: 24px; color: #6E7E96; min-width: 230px; text-align: right; }
.pf-m1 .pf-m1-circle {
  position: absolute; border: 4px solid #C04040; border-radius: 70% 30% 60% 40% / 50% 60% 40% 50%;
  pointer-events: none; opacity: 0.7;
}
.pf-m1 .pf-m1-foot {
  position: absolute; bottom: 60px; right: 60px;
  font-family: 'Caveat', cursive; font-size: 30px; color: var(--ink-soft); transform: rotate(-2deg);
}

/* =============================================================
 * M2 · POST-IT AMARELO
 * ============================================================= */
.pf-m2 {
  background:
    radial-gradient(circle at 35% 25%, #2A2218 0%, #100A06 70%, #050302 100%);
}
.pf-m2-desk {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(95deg, rgba(255,200,100,0.04) 0 8px, transparent 8px 32px);
}
.pf-m2-postit {
  position: absolute; top: 110px; left: 80px; width: 920px; height: 860px;
  background: linear-gradient(160deg, #FFE36A 0%, #F5C73E 100%);
  transform: rotate(-2.4deg);
  box-shadow: 0 24px 48px rgba(0,0,0,0.55), 0 4px 6px rgba(0,0,0,0.25);
  padding: 70px 70px 90px;
}
.pf-m2-tape {
  position: absolute; top: -22px; left: 380px; width: 220px; height: 56px;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.35));
  border-left: 1px dashed rgba(255,255,255,0.6); border-right: 1px dashed rgba(255,255,255,0.6);
  transform: rotate(3deg); box-shadow: 0 4px 8px rgba(0,0,0,0.25);
}
.pf-m2-pin {
  position: absolute; top: 38px; left: 480px;
  width: 36px; height: 36px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #FF6F6F, #B71F1F);
  box-shadow: 0 4px 8px rgba(0,0,0,0.5);
}
.pf-m2-header {
  font-family: 'Caveat', cursive; font-size: 42px; color: #5A4A0E; letter-spacing: 1px;
  transform: rotate(-1deg);
}
.pf-m2-pct {
  font-family: 'Caveat', cursive; font-size: 280px; color: #0E5C2F; line-height: 0.95;
  margin-top: 10px; transform: rotate(-0.8deg); letter-spacing: -8px;
}
.pf-m2-pct.neg { color: #8C1717; }
.pf-m2-usd {
  font-family: 'Caveat', cursive; font-size: 110px; color: #4D3500; line-height: 1;
  margin-top: -10px; transform: rotate(-1deg);
}
.pf-m2-note {
  margin-top: 32px;
  font-family: 'Patrick Hand', cursive; font-size: 40px; color: #2E2200; line-height: 1.25;
  transform: rotate(-0.4deg);
}
.pf-m2-sign {
  position: absolute; bottom: 24px; right: 60px;
  font-family: 'Caveat', cursive; font-size: 60px; color: #1F1A00; transform: rotate(-3deg);
}

/* =============================================================
 * M3 · MOLESKINE PRETA (caderno fechado lateral)
 * ============================================================= */
.pf-m3 {
  background:
    linear-gradient(120deg, #1A130D 0%, #0B0805 100%);
}
.pf-m3-page {
  position: absolute; top: 60px; left: 60px; right: 130px; bottom: 60px;
  background: linear-gradient(180deg, #EBE0C8 0%, #DCCFB0 100%);
  box-shadow:
    -8px 0 24px rgba(0,0,0,0.45),
    inset 0 0 80px rgba(120,90,40,0.18);
  padding: 70px 80px;
  background-image:
    repeating-linear-gradient(transparent, transparent 50px, rgba(80,55,20,0.15) 50px, rgba(80,55,20,0.15) 51px),
    linear-gradient(180deg, #EBE0C8 0%, #DCCFB0 100%);
}
.pf-m3-spine {
  position: absolute; top: 60px; bottom: 60px; right: 60px; width: 70px;
  background: linear-gradient(90deg, #060403, #1A120C 50%, #060403);
  border-left: 1px solid rgba(0,0,0,0.6);
  box-shadow: inset 2px 0 4px rgba(0,0,0,0.5), 4px 0 12px rgba(0,0,0,0.4);
}
.pf-m3-spine::after { /* elástico */
  content: ''; position: absolute; left: -60px; right: 0; top: 380px; height: 14px;
  background: linear-gradient(180deg, #0A0907, #2A1F14);
  box-shadow: 0 2px 4px rgba(0,0,0,0.6);
}
.pf-m3-date {
  font-family: 'Special Elite', monospace; font-size: 24px; color: #6E5230; letter-spacing: 3px;
}
.pf-m3-title {
  font-family: 'Architects Daughter', cursive; font-size: 64px; color: #1A3056; margin-top: 8px;
  line-height: 1.0; transform: rotate(-0.4deg);
}
.pf-m3-divider {
  margin: 28px 0 24px; height: 14px; opacity: 0.65;
}
.pf-m3-mega {
  font-family: 'Caveat', cursive; font-size: 220px; color: #0E5C2F; line-height: 0.9; letter-spacing: -6px;
}
.pf-m3-mega.neg { color: #8C1717; }
.pf-m3-usd {
  font-family: 'Architects Daughter', cursive; font-size: 64px; color: #5A4318; margin-top: -10px;
}
.pf-m3-list {
  margin-top: 30px; font-family: 'Architects Daughter', cursive; font-size: 30px; color: #1A3056; line-height: 1.45;
}
.pf-m3-bullet {
  display: flex; align-items: baseline; gap: 14px; padding: 8px 0;
  border-bottom: 1px dashed rgba(80,60,20,0.25);
}
.pf-m3-bullet b { color: #C04040; font-weight: normal; font-size: 38px; }
.pf-m3-sign {
  position: absolute; bottom: 60px; right: 0;
  font-family: 'Caveat', cursive; font-size: 56px; color: #1A3056; transform: rotate(-2deg);
}

/* =============================================================
 * M4 · RECIBO TÉRMICO (cupom)
 * ============================================================= */
.pf-m4 {
  background:
    linear-gradient(180deg, #14130E 0%, #060604 100%);
}
.pf-m4-paper {
  position: absolute; top: 60px; left: 280px; width: 520px; bottom: 60px;
  background: var(--thermal);
  box-shadow: 0 18px 36px rgba(0,0,0,0.6), inset 0 0 30px rgba(0,0,0,0.05);
  background-image:
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(0,0,0,0.025) 18px 19px),
    linear-gradient(180deg, #FAF7EE 0%, #ECE6D8 100%);
  padding: 60px 50px;
  display: flex; flex-direction: column;
}
.pf-m4-paper::before, .pf-m4-paper::after {
  content: ''; position: absolute; left: 0; right: 0; height: 18px;
  background:
    radial-gradient(circle at 9px 9px, var(--thermal) 9px, transparent 10px) repeat-x;
  background-size: 18px 18px;
}
.pf-m4-paper::before { top: -18px; transform: scaleY(-1); }
.pf-m4-paper::after  { bottom: -18px; }
.pf-m4-paper > * { font-family: 'Special Elite', monospace; color: #1A1A1A; }
.pf-m4-h1 { font-size: 22px; text-align: center; letter-spacing: 4px; }
.pf-m4-h2 { font-size: 14px; text-align: center; letter-spacing: 6px; margin-top: 6px; color: #555; }
.pf-m4-dash { text-align: center; letter-spacing: 4px; margin: 14px 0; font-size: 16px; }
.pf-m4-row { display: flex; justify-content: space-between; font-size: 18px; padding: 4px 0; }
.pf-m4-row b { font-weight: normal; }
.pf-m4-line { border-top: 1px dashed #555; margin: 12px 0; }
.pf-m4-total { font-size: 28px; font-weight: bold; display: flex; justify-content: space-between; padding-top: 8px; }
.pf-m4-stamp {
  margin: 22px auto 0; text-align: center; border: 3px solid #1A1A1A;
  padding: 10px 14px; font-size: 22px; letter-spacing: 6px; transform: rotate(-4deg);
  display: inline-block;
}
.pf-m4-barcode {
  margin-top: 26px; height: 60px;
  background-image: repeating-linear-gradient(90deg, #1A1A1A 0 2px, transparent 2px 4px, #1A1A1A 4px 5px, transparent 5px 8px, #1A1A1A 8px 11px, transparent 11px 13px);
}
.pf-m4-footer { text-align: center; font-size: 13px; letter-spacing: 3px; margin-top: 12px; color: #555; }

/* =============================================================
 * M5 · POLAROID
 * ============================================================= */
.pf-m5 {
  background:
    radial-gradient(circle at 30% 20%, #3A2A1C 0%, #1A1208 70%, #0A0703 100%);
}
.pf-m5-wood {
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(92deg, rgba(255,200,120,0.05) 0 22px, rgba(0,0,0,0.05) 22px 60px),
    repeating-linear-gradient(0deg,  rgba(0,0,0,0.04) 0 4px, transparent 4px 7px);
}
.pf-m5-card {
  position: absolute; top: 70px; left: 130px; width: 820px; height: 920px;
  background: linear-gradient(180deg, #FBF7ED 0%, #EFE9D7 100%);
  box-shadow: 0 30px 60px rgba(0,0,0,0.6), 0 6px 12px rgba(0,0,0,0.3);
  transform: rotate(-3deg);
  padding: 50px 50px 30px;
}
.pf-m5-photo {
  width: 100%; height: 640px;
  background:
    radial-gradient(circle at 50% 40%, rgba(0,229,255,0.45), transparent 60%),
    linear-gradient(135deg, #0B1218 0%, #1A2A38 60%, #2A1F0A 100%);
  position: relative; overflow: hidden;
  border: 1px solid rgba(0,0,0,0.15);
}
.pf-m5-photo::before { /* "screen scanlines" */
  content: ''; position: absolute; inset: 0;
  background-image: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0,0,0,0.08) 2px 3px);
  mix-blend-mode: overlay;
}
.pf-m5-photo-pct {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-family: 'Caveat', cursive; font-size: 280px; line-height: 1; letter-spacing: -10px;
  color: #00FFC8; text-shadow: 0 0 24px rgba(0,255,200,0.5), 0 0 4px rgba(0,0,0,0.4);
}
.pf-m5-photo-pct.neg { color: #FF6F7F; text-shadow: 0 0 24px rgba(255,80,100,0.5); }
.pf-m5-photo-usd {
  position: absolute; bottom: 30px; left: 0; right: 0; text-align: center;
  font-family: 'JetBrains Mono', monospace; font-size: 40px; color: #FFD33F; letter-spacing: 4px;
}
.pf-m5-caption {
  margin-top: 28px; text-align: center;
  font-family: 'Caveat', cursive; font-size: 56px; color: #2A2010; line-height: 1.0; transform: rotate(-0.4deg);
}
.pf-m5-cap-sub {
  text-align: center; margin-top: 6px;
  font-family: 'Patrick Hand', cursive; font-size: 30px; color: #6E5A30;
}
.pf-m5-stain {
  position: absolute; top: 22px; right: 32px; width: 80px; height: 80px;
  background: radial-gradient(circle at 50% 50%, rgba(120,70,20,0.35), rgba(120,70,20,0) 70%);
  transform: rotate(28deg); pointer-events: none;
}
.pf-m5-tag {
  position: absolute; top: 22px; left: 30px;
  font-family: 'Special Elite', monospace; font-size: 18px; color: #6E5A30; letter-spacing: 4px;
  transform: rotate(-3deg);
}

/* =============================================================
 * Botão CARROSSEL no QuickDash
 * ============================================================= */
.post-quick-actions .btn-carousel {
  border-color: #B584FF; color: #B584FF;
}
.post-quick-actions .btn-carousel:hover {
  background: rgba(181,132,255,0.10); box-shadow: 0 0 20px rgba(181,132,255,0.25);
}

/* Aba "MANUSCRITO" no sidebar */
.post2-tab.tab-note { letter-spacing: 2px; }

/* =============================================================
 * STAGE · garantir que a postagem caiba INTEIRA na visualização
 * ============================================================= */
.post2-stage-canvas {
  min-height: 62vh;
  overflow: auto;
}

/* Quick-dash compacto · 3 fileiras de cards em altura controlada */
.post-quick-dash {
  max-height: 38vh;
  overflow-y: auto;
}
.post-quick-btn .pq-dl {
  font-family: 'JetBrains Mono', monospace; font-weight: 800;
  text-shadow: 0 0 6px currentColor;
}
.post-quick-btn .pq-dl:hover {
  background: rgba(255,255,255,0.18) !important;
}

/* =============================================================
 * CÉREBRO NEURAL · tooltip ao passar o mouse
 * ============================================================= */
.brain-tooltip {
  position: absolute;
  display: none;
  pointer-events: none;
  z-index: 50;
  min-width: 200px; max-width: 260px;
  padding: 10px 12px;
  background: rgba(8, 14, 22, 0.95);
  border: 1px solid rgba(0, 212, 255, 0.45);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6), 0 0 22px rgba(0, 212, 255, 0.18);
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  color: #E8F2FF;
  backdrop-filter: blur(8px);
}
.brain-tooltip .bt-row { font-size: 11px; line-height: 1.45; }
.brain-tooltip .bt-type { font-weight: 700; letter-spacing: 1.5px; margin-bottom: 4px; text-transform: uppercase; }
.brain-tooltip .bt-title { font-weight: 600; font-size: 13px; color: #FFD33F; margin: 2px 0; }
.brain-tooltip .bt-sub { color: #BCD2EA; font-size: 11px; margin-bottom: 4px; }
.brain-tooltip .bt-meta { color: #87A6C8; font-size: 10px; letter-spacing: 0.5px; }
.brain-tooltip .bt-origin {
  margin-top: 6px; padding-top: 6px;
  border-top: 1px dashed rgba(0, 212, 255, 0.25);
  color: #6BA3D0; font-size: 9.5px; letter-spacing: 1.5px; text-transform: uppercase;
}
.brain-tooltip .bt-time {
  margin-top: 4px;
  color: #8AA0B4; font-size: 9.5px; letter-spacing: 0.5px;
}

/* =============================================================
 * FROTA · tabs ATIVAS / INATIVAS
 * ============================================================= */
.fleet-tabs {
  display: flex; gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.fleet-tab {
  flex: 1;
  background: transparent; color: var(--text-3);
  border: none; padding: 6px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 700; letter-spacing: 2px;
  cursor: pointer; transition: all 0.15s ease;
}
.fleet-tab:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.fleet-tab.is-active {
  color: var(--cyan); background: rgba(0, 212, 255, 0.08);
  box-shadow: inset 0 -2px 0 var(--cyan);
}
.fleet-empty {
  padding: 28px 20px; text-align: center;
  color: var(--text-3); font-family: 'JetBrains Mono', monospace;
  font-size: 11px; letter-spacing: 2px;
}
.fleet-node.is-inactive {
  opacity: 0.65;
  border-color: rgba(240, 176, 64, 0.35) !important;
  background: rgba(40, 30, 10, 0.18) !important;
}
.fleet-node.is-inactive .fleet-inactive-reason {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: #F0B040;
  letter-spacing: 1px; padding: 6px 0; opacity: 0.9;
}

/* =============================================================
 * RESPONSIVIDADE · cobre desktop grande até celular
 * ============================================================= */
/* Reforço geral · evita escalonamento horizontal e painéis "estourando" */
.tg > .panel {
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
.tg { overflow: auto !important; }
.brain-wrap { min-height: 200px; }

@media (max-width: 1280px) {
  .topbar-mid .hud-item:nth-child(n+3) { display: none; }  /* esconde MERCADO/LATÊNCIA */
  .topbar-tela { padding: 4px 8px !important; font-size: 10px !important; }
  .brand-sub { display: none; }
  .post-quick-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1024px) {
  .topbar-tela { display: none; }                 /* esconde TELA 1/2/3 */
  .topbar-mid { display: none; }                  /* HUD do topo */
  .statusbar-quotes { display: none; }            /* ticker do rodapé */
  .post2-view { grid-template-columns: 1fr !important; }
  .post2-side, .post2-customize { display: none !important; }   /* só preview no mobile */
  .fleet-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 1100px) {
  /* Em telas menores, força stack vertical pra evitar encavalamento do grid 12 colunas */
  .tg {
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: none !important;
    grid-auto-rows: minmax(240px, auto) !important;
    height: auto !important;
    overflow-y: auto !important;
  }
  .tg > .panel {
    grid-column: auto !important;
    grid-row: auto !important;
  }
  .s-graph, .s-equity, .s-fleet, .s-cortex, .s-news, .s-status {
    grid-column: 1 / -1 !important;
  }
}
@media (max-width: 820px) {
  .tg {
    grid-template-columns: 1fr !important;
    grid-auto-rows: minmax(260px, auto) !important;
  }
  .tg > .panel {
    grid-column: 1 !important;
    grid-row: auto !important;
    min-height: 260px;
  }
  .p-title { font-size: 11px !important; letter-spacing: 1px !important; }
  .p-meta { font-size: 9px !important; }
  .topbar { padding: 0 8px !important; }
  .topbar-nav a, .topbar-theme, .topbar-sound {
    padding: 4px 8px !important; font-size: 10px !important;
  }
  .statusbar { font-size: 9px !important; padding: 0 8px !important; }
  .statusbar-left .hud-item:nth-child(n+4) { display: none; }
  .fleet-grid { grid-template-columns: 1fr !important; }
  .post-quick-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .post-quick-btn .pq-label { font-size: 10px !important; }
  .post-quick-btn .pq-sub { font-size: 8px !important; }
  .brain-tooltip { max-width: 200px; font-size: 10px; }
  .brain-tooltip .bt-title { font-size: 11px; }
  /* Layouts manuscritos não precisam responder — eles renderizam em frame 1080×1080 fixo */
}
@media (max-width: 560px) {
  .brand-text { display: none !important; }
  .topbar-nav { gap: 4px !important; }
  .topbar-nav a { font-size: 9px !important; padding: 3px 6px !important; }
  .topbar-theme, .topbar-sound, .pill-live { display: none !important; }
  .pf, .pf-square, .pf-story {
    transform-origin: top left;
  }
  /* Esconde sidebar do post completo em telinhas, mostra só o stage */
  .post2-stage-toolbar .btn { padding: 4px 8px !important; font-size: 10px !important; }
}
