/* Arduino Corner · PSX Signals — dark-first, mobile-first. */
:root {
  --bg: #0b0e14;
  --surface: #131823;
  --surface-2: #1a2130;
  --border: #232b3a;
  --text: #e6e9ef;
  --muted: #8b95a7;
  --up: #22c55e;
  --up-bg: rgba(34, 197, 94, .14);
  --down: #ef4444;
  --down-bg: rgba(239, 68, 68, .14);
  --flat: #6b7280;
  --amber: #f59e0b;
  --indigo: #818cf8;
  --accent: #2dd4bf;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .18);
  --maxw: 1080px;
  font-synthesis: none;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6fa; --surface: #ffffff; --surface-2: #f7f9fc; --border: #e3e8f0;
    --text: #131823; --muted: #5b6472; --flat: #9aa3b2;
    --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }

/* --- Top bar ------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .7rem clamp(1rem, 4vw, 2rem);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .55rem; font-size: 1.02rem; letter-spacing: .1px; }
.brand b { color: var(--accent); font-weight: 700; }
.brand-mark { color: var(--accent); font-size: 1.1rem; }
.topbar nav { display: flex; gap: 1.2rem; font-size: .92rem; }
.topbar nav a { color: var(--muted); }
.topbar nav a:hover { color: var(--text); }
.top-right { display: flex; align-items: center; gap: 1.1rem; }

/* Gold / silver per-tola widget (top corner) */
.metals { display: flex; gap: .6rem; }
.metal {
  display: flex; flex-direction: column; line-height: 1.15;
  padding: .25rem .55rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); font-variant-numeric: tabular-nums;
}
.metal i { font-style: normal; font-size: .6rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.metal b { font-size: .9rem; font-weight: 700; }
.metal s { text-decoration: none; font-size: .62rem; color: var(--muted); }
.metal.gold { border-left: 3px solid #f5b301; }
.metal.gold b { color: #f5b301; }
.metal.silver { border-left: 3px solid #9aa7b4; }
.metal.silver b { color: #b9c2cd; }
@media (prefers-color-scheme: light) { .metal.silver b { color: #6b7683; } }
@media (max-width: 640px) {
  .top-right { flex-direction: column-reverse; align-items: flex-end; gap: .4rem; }
  .metals { gap: .4rem; }
  .metal { padding: .18rem .45rem; }
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 2rem) 3rem; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: clamp(1rem, 2.5vw, 1.5rem);
  box-shadow: var(--shadow); margin-bottom: 1.25rem;
}

/* --- Hero ---------------------------------------------------------------- */
.hero { margin: .5rem 0 1.4rem; }
.hero h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); margin: 0 0 .4rem; letter-spacing: -.5px; }
.hero .sub { color: var(--muted); max-width: 60ch; margin: 0; }

/* --- Market overview ----------------------------------------------------- */
.market-grid { display: flex; flex-wrap: wrap; gap: 1rem 1.6rem; align-items: center; }
.idx { display: flex; flex-direction: column; gap: .1rem; padding-right: 1.4rem; border-right: 1px solid var(--border); }
.idx.small { font-size: .9rem; }
.idx:last-of-type { border-right: none; }
.idx-name { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.idx-val { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.idx.small .idx-val { font-size: 1.1rem; }
.breadth { flex: 1 1 260px; min-width: 220px; }
.breadth-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--surface-2); }
.breadth-bar .seg.up { background: var(--up); }
.breadth-bar .seg.down { background: var(--down); }
.breadth-bar .seg.flat { background: var(--flat); }
.breadth-legend { display: flex; gap: 1rem; font-size: .82rem; margin-top: .4rem; color: var(--muted); }
.mood { margin: 1rem 0 0; padding-top: .9rem; border-top: 1px solid var(--border); color: var(--text); font-size: .95rem; }

.chip {
  display: inline-block; font-size: .8rem; font-weight: 600; padding: .1rem .45rem;
  border-radius: 6px; font-variant-numeric: tabular-nums;
}
.chip.up, .up { color: var(--up); }
.chip.down, .down { color: var(--down); }
.chip.flat, .flat { color: var(--flat); }
.chip.up { background: var(--up-bg); }
.chip.down { background: var(--down-bg); }

/* --- Picks --------------------------------------------------------------- */
.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
.col-h { font-size: 1rem; margin: 0 0 .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.col-h span { font-weight: 800; }
.col-h.buy span { color: var(--up); }
.col-h.sell span { color: var(--down); }
.pcard {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: .85rem 1rem; margin-bottom: .7rem; transition: border-color .15s, transform .15s;
}
.pcard:hover { border-color: var(--accent); transform: translateY(-1px); }
.pcard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.pcard-top b { font-size: 1.05rem; }
.co { display: block; color: var(--muted); font-size: .78rem; font-weight: 400; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-mid { display: flex; align-items: baseline; gap: .6rem; margin: .3rem 0 .4rem; }
.pcard-mid .price { font-weight: 700; font-variant-numeric: tabular-nums; }
.pcard-why { margin: 0; font-size: .85rem; color: var(--muted); }

/* --- Badges -------------------------------------------------------------- */
.badge {
  display: inline-block; font-size: .74rem; font-weight: 700; padding: .18rem .5rem;
  border-radius: 6px; letter-spacing: .02em; white-space: nowrap;
}
.badge.lg { font-size: .9rem; padding: .3rem .7rem; }
.badge.sbuy { background: var(--up); color: #04140a; }
.badge.buy { background: var(--up-bg); color: var(--up); border: 1px solid color-mix(in srgb, var(--up) 40%, transparent); }
.badge.hold { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.sell { background: var(--down-bg); color: var(--down); border: 1px solid color-mix(in srgb, var(--down) 40%, transparent); }
.badge.ssell { background: var(--down); color: #1a0505; }
.ai-dot { font-size: .62rem; font-weight: 800; color: var(--indigo); border: 1px solid var(--indigo); border-radius: 4px; padding: 0 .25rem; margin-left: .3rem; vertical-align: middle; }

/* --- Signals table ------------------------------------------------------- */
.all-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.all-head h2 { margin: 0; font-size: 1.15rem; }
.controls { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
#filter {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: .45rem .7rem; border-radius: 8px; font-size: .88rem; min-width: 200px;
}
.tabs { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.tab { background: none; border: none; color: var(--muted); padding: .45rem .8rem; font-size: .85rem; cursor: pointer; font-weight: 600; }
.tab.active { background: var(--accent); color: #04140a; }

.table-scroll { overflow-x: auto; margin: 0 -.3rem; }
table.signals { width: 100%; border-collapse: collapse; font-size: .9rem; }
.signals th { text-align: left; color: var(--muted); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; padding: .5rem .6rem; cursor: pointer; white-space: nowrap; border-bottom: 1px solid var(--border); }
.signals th.r, .signals td.r { text-align: right; }
.signals td { padding: .6rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; font-variant-numeric: tabular-nums; }
.signals tbody tr { cursor: pointer; }
.signals tbody tr:hover { background: var(--surface-2); }
.signals td.sym b { font-size: .95rem; }
.signals td.sym .co { max-width: 26ch; }
.tf { color: var(--muted); font-size: .82rem; }

.meter { display: inline-block; width: 60px; height: 6px; background: var(--surface-2); border-radius: 3px; vertical-align: middle; overflow: hidden; margin-right: .4rem; }
.meter-fill { display: block; height: 100%; }
.meter-fill.up { background: var(--up); }
.meter-fill.down { background: var(--down); }
.meter-fill.flat { background: var(--flat); }
.meter-num { font-size: .82rem; font-weight: 600; }

.hide-sm { }
.empty-note { text-align: center; color: var(--muted); padding: 1.5rem; }

/* --- Detail page --------------------------------------------------------- */
.crumb { margin: 0 0 1rem; }
.crumb a { color: var(--muted); font-size: .9rem; }
.detail-head { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between; align-items: flex-start; }
.dh-left h1 { margin: 0 0 .2rem; font-size: 1.7rem; }
.dh-co { color: var(--muted); font-size: 1rem; font-weight: 400; }
.dh-meta { color: var(--muted); font-size: .85rem; margin: 0 0 .7rem; }
.dh-price { display: flex; align-items: baseline; gap: .7rem; }
.dh-price .big { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.dh-verdict { text-align: right; min-width: 220px; }
.vscore { margin: .7rem 0 .3rem; }
.sbar { position: relative; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.sbar-mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--border); }
.sbar-fill { position: absolute; top: 0; bottom: 0; }
.sbar-fill.right { left: 50%; } .sbar-fill.left { right: 50%; }
.sbar-fill.up { background: var(--up); } .sbar-fill.down { background: var(--down); } .sbar-fill.flat { background: var(--flat); }
.sbar-num { font-size: .8rem; color: var(--muted); }
.vconf { font-size: .85rem; color: var(--muted); margin: .3rem 0 0; }

.summary { border-left: 4px solid var(--accent); }
.summary.sbuy-tint, .summary.buy-tint { border-left-color: var(--up); }
.summary.sell-tint, .summary.ssell-tint { border-left-color: var(--down); }
.summary.hold-tint { border-left-color: var(--flat); }
.summary-text { margin: 0; font-size: 1.1rem; }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }
.card-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.card-h h2 { margin: 0; font-size: 1.1rem; }
.legend { display: flex; gap: 1rem; font-size: .78rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: .3rem; }
.chart { width: 100%; height: auto; display: block; }
.chart-empty { color: var(--muted); padding: 2rem; text-align: center; }
.range { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); margin-top: .5rem; }
.range b { color: var(--text); }

.levels { list-style: none; margin: 0; padding: 0; }
.levels li { display: flex; justify-content: space-between; padding: .5rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.levels li:last-child { border-bottom: none; }
.levels li span { color: var(--muted); }
.levels li b { font-variant-numeric: tabular-nums; }
.levels li.stop b { color: var(--down); }
.levels li.target b { color: var(--up); }

.reasons { list-style: none; margin: 0; padding: 0; }
.reason { display: flex; gap: .7rem; align-items: flex-start; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.reason:last-child { border-bottom: none; }
.rdot { width: 9px; height: 9px; border-radius: 50%; margin-top: .45rem; flex: none; }
.reason.bull .rdot { background: var(--up); }
.reason.bear .rdot { background: var(--down); }
.reason.neutral .rdot { background: var(--flat); }

.ai-card { border-color: color-mix(in srgb, var(--indigo) 35%, var(--border)); }
.ai-body { font-size: .95rem; }
.ai-time { color: var(--muted); font-size: .8rem; margin: .8rem 0 0; }
.ai-card.pending { opacity: .85; }

.ind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.ibox { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .8rem; display: flex; flex-direction: column; gap: .1rem; }
.ilabel { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
.ival { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ihint { font-size: .76rem; color: var(--muted); }
.based-on { color: var(--muted); font-size: .8rem; margin: 1rem 0 0; }

/* --- Prose / about ------------------------------------------------------- */
.prose { max-width: 760px; }
.prose h1 { margin-top: 0; }
.prose h2 { font-size: 1.15rem; margin: 1.6rem 0 .5rem; }
.prose .lead { font-size: 1.08rem; color: var(--text); }
.prose ul { padding-left: 1.2rem; }
.prose li { margin: .3rem 0; }
.callout { border-radius: 10px; padding: 1rem 1.1rem; margin: 1.4rem 0; font-size: .9rem; }
.callout.warn { background: color-mix(in srgb, var(--amber) 12%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent); }

.btn { display: inline-block; background: var(--accent); color: #04140a; font-weight: 700; padding: .5rem 1rem; border-radius: 8px; font-size: .9rem; }
.muted { color: var(--muted); }
.center-card { text-align: center; }

/* --- Footer -------------------------------------------------------------- */
.foot { max-width: var(--maxw); margin: 0 auto; padding: 1.5rem clamp(1rem, 4vw, 2rem) 3rem; border-top: 1px solid var(--border); }
.disclaimer { font-size: .82rem; color: var(--muted); max-width: 80ch; }
.foot-meta { font-size: .78rem; color: var(--muted); }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 820px) {
  .picks { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .dh-verdict { text-align: left; }
}
@media (max-width: 560px) {
  .hide-sm { display: none !important; }
  .topbar nav { gap: .8rem; }
  .idx { padding-right: 1rem; }
}
