/* ===== Animated colour tokens (smooth colour morph between states) ===== */
@property --g1 { syntax: '<color>'; inherits: true; initial-value: #9b5cff; }
@property --g2 { syntax: '<color>'; inherits: true; initial-value: #00c8ff; }
@property --g3 { syntax: '<color>'; inherits: true; initial-value: #00ffd0; }
@property --accent { syntax: '<color>'; inherits: true; initial-value: #00c8ff; }
@property --sgx-ang { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

.sgx {
  --ink: #060913;
  --panel: #0d1224;
  --panel-2: #131a3a;
  --line: #222c52;
  --text: #eef2ff;
  --muted: #8b95b8;
  --gold: #ffc233;
  --g1: #9b5cff;
  --g2: #00c8ff;
  --g3: #00ffd0;
  --accent: #00c8ff;
  position: relative;
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(14px, 3vw, 28px);
  color: var(--text);
  font-family: 'Sora', system-ui, -apple-system, 'Segoe UI', 'Noto Sans Bengali', sans-serif;
  line-height: 1.4;
  text-align: left;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 30px 90px -30px var(--g1);
  overflow: hidden;
  isolation: isolate;
  transition: --g1 .7s, --g2 .7s, --g3 .7s, --accent .7s;
}
.sgx *, .sgx *::before, .sgx *::after { box-sizing: border-box; }
.sgx > * { position: relative; z-index: 1; }

/* State palettes */
.sgx[data-state="scan"] { --g1: #ff3df5; --g2: #9b5cff; --g3: #00e5ff; --accent: #c36bff; }
.sgx[data-state="call"] { --g1: #00e5ff; --g2: #2dffa0; --g3: #d4ff3d; --accent: #2dffa0; }
.sgx[data-state="put"]  { --g1: #ffb020; --g2: #ff3b6e; --g3: #ff2fd0; --accent: #ff3b6e; }
.sgx[data-state="none"] { --g1: #ffe14d; --g2: #ffb020; --g3: #ff6a1f; --accent: #ffc233; }

/* Floating colour orbs (follow the state colour) */
.sgx > .sgx-orb { position: absolute; z-index: 0; border-radius: 50%; filter: blur(80px); opacity: .34; pointer-events: none; }
.sgx .sgx-orb-a { width: 360px; height: 360px; top: -140px; right: -90px; background: var(--g1); animation: sgx-drift-a 16s ease-in-out infinite alternate; }
.sgx .sgx-orb-b { width: 320px; height: 320px; bottom: -130px; left: -90px; background: var(--g3); animation: sgx-drift-b 20s ease-in-out infinite alternate; }

/* Rotating gradient border */
.sgx::before {
  content: ''; position: absolute; inset: 0; z-index: 3; border-radius: inherit; padding: 2px; pointer-events: none;
  background: conic-gradient(from var(--sgx-ang), transparent 0%, transparent 52%, var(--g1) 68%, var(--g2) 84%, var(--g3) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: sgx-spin 7s linear infinite;
}

/* ===== Header ===== */
.sgx .sgx-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sgx .sgx-brand { display: flex; align-items: center; gap: 14px; }
.sgx .sgx-mark { width: 52px; height: 52px; flex: none; filter: drop-shadow(0 6px 20px var(--g1)); }
.sgx .sgx-mark path { stroke-dasharray: 100; animation: sgx-draw 3.8s ease-in-out infinite; }
.sgx .sgx-title {
  margin: 0; padding: 0; border: 0;
  font-family: inherit; font-size: clamp(34px, 6vw, 48px); font-weight: 800; letter-spacing: -.035em; line-height: 1;
  color: #fff;
  background: linear-gradient(100deg, #fff 10%, var(--g1) 40%, var(--g2) 65%, var(--g3) 90%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: sgx-title 7s ease-in-out infinite alternate;
}
.sgx .sgx-tag { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.sgx .sgx-live {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(13, 18, 36, .75); backdrop-filter: blur(6px);
  font-size: 12px; font-weight: 700; letter-spacing: .06em; color: var(--muted);
}
.sgx .sgx-now { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; color: var(--text); letter-spacing: 0; }
.sgx .sgx-dot { width: 8px; height: 8px; border-radius: 50%; background: #2dffa0; box-shadow: 0 0 0 0 rgba(45, 255, 160, .6); animation: sgx-pulse 2s infinite; }

/* ===== Pair select ===== */
.sgx .sgx-pair { margin-top: 22px; position: relative; }
.sgx .sgx-pair::after {
  content: ''; position: absolute; right: 20px; top: 50%; width: 9px; height: 9px; margin-top: -6px;
  border-right: 2px solid var(--g2); border-bottom: 2px solid var(--g2); transform: rotate(45deg); pointer-events: none;
}
.sgx .sgx-select {
  display: block; width: 100%; height: auto; min-height: 0; margin: 0; padding: 16px 48px 16px 20px;
  appearance: none; -webkit-appearance: none; cursor: pointer;
  font-family: inherit; font-size: 16px; font-weight: 600; line-height: 1.4; color: var(--text);
  background: rgba(13, 18, 36, .85); border: 1px solid var(--line); border-radius: 16px; box-shadow: none;
  transition: border-color .25s, box-shadow .25s;
}
.sgx .sgx-select:hover { border-color: var(--g2); box-shadow: 0 0 22px -8px var(--g2); }
.sgx .sgx-select:focus-visible { outline: none; border-color: var(--g2); box-shadow: 0 0 0 3px rgba(0, 200, 255, .28); }
.sgx .sgx-select option { background: #0d1224; color: #eef2ff; }

/* ===== Layout ===== */
.sgx .sgx-main { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 18px; margin-top: 18px; }
.sgx .sgx-card {
  background: linear-gradient(180deg, rgba(25, 33, 74, .82), rgba(13, 18, 36, .82));
  border: 1px solid var(--line); border-radius: 22px; padding: 22px; backdrop-filter: blur(8px);
}

/* ===== Gauge ===== */
.sgx .sgx-gauge-card { display: flex; flex-direction: column; justify-content: center; }
.sgx .sgx-gauge { position: relative; width: 100%; max-width: 270px; aspect-ratio: 1; margin: 0 auto; }
.sgx .sgx-ring { width: 100%; height: 100%; display: block; overflow: visible; }
.sgx .sgx-s1 { stop-color: var(--g1); }
.sgx .sgx-s2 { stop-color: var(--g2); }
.sgx .sgx-s3 { stop-color: var(--g3); }
.sgx .sgx-orbit {
  fill: none; stroke: var(--g2); stroke-opacity: .55; stroke-width: 1.6; stroke-dasharray: 2 9; stroke-linecap: round;
  transform-box: view-box; transform-origin: 50% 50%; animation: sgx-orbit 40s linear infinite;
}
.sgx[data-state="scan"] .sgx-orbit { animation-duration: 2.4s; stroke-opacity: .9; }
.sgx .sgx-ring-bg { fill: none; stroke: #182047; stroke-width: 10; }
.sgx .sgx-ring-fg {
  fill: none; stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 552.92; stroke-dashoffset: 552.92;
  filter: drop-shadow(0 0 7px var(--accent));
}
.sgx[data-state="call"] .sgx-ring-fg,
.sgx[data-state="put"] .sgx-ring-fg { animation: sgx-glow 2s ease-in-out infinite alternate; }
.sgx .sgx-ring-tick { stroke: var(--gold); stroke-width: 3; stroke-linecap: round; filter: drop-shadow(0 0 4px var(--gold)); }
.sgx .sgx-ripple { position: absolute; inset: 7%; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; pointer-events: none; }
.sgx[data-state="call"] .sgx-ripple,
.sgx[data-state="put"] .sgx-ripple { animation: sgx-ripple 2.4s ease-out infinite; }
.sgx[data-state="call"] .sgx-ripple-2,
.sgx[data-state="put"] .sgx-ripple-2 { animation-delay: 1.2s; }

.sgx .sgx-core { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 34px; }
.sgx .sgx-sig { font-size: 24px; font-weight: 700; letter-spacing: -.01em; color: var(--muted); line-height: 1.1; }
.sgx .sgx-sub { margin-top: 8px; font-size: 12px; color: var(--muted); max-width: 170px; }
.sgx[data-state="scan"] .sgx-sig { color: var(--text); animation: sgx-blink 1s ease-in-out infinite; }
.sgx[data-state="call"] .sgx-sig,
.sgx[data-state="put"] .sgx-sig {
  font-size: 46px; font-weight: 800; letter-spacing: -.03em; color: var(--accent); text-shadow: 0 0 30px var(--accent);
  animation: sgx-pop-sig .7s cubic-bezier(.2, 1.5, .4, 1) both;
}
.sgx[data-state="none"] .sgx-sig { color: var(--accent); font-size: 26px; animation: sgx-pop-sig .6s cubic-bezier(.2, 1.4, .4, 1) both; }
.sgx[data-state="call"] .sgx-sub,
.sgx[data-state="put"] .sgx-sub,
.sgx[data-state="none"] .sgx-sub { color: var(--text); }

/* ===== Strategy pass bar ===== */
.sgx .sgx-pass { margin-top: 22px; }
.sgx .sgx-pass-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.sgx .sgx-pass-k { font-size: 13px; font-weight: 600; color: var(--muted); }
.sgx .sgx-pass-v { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: 15px; font-weight: 700; color: var(--muted); }
.sgx .sgx-pass-v b { font-size: 30px; font-weight: 700; color: #fff; transition: color .4s, text-shadow .4s; }
.sgx[data-state="call"] .sgx-pass-v b,
.sgx[data-state="put"] .sgx-pass-v b,
.sgx[data-state="none"] .sgx-pass-v b { color: var(--accent); text-shadow: 0 0 20px var(--accent); }

.sgx .sgx-bar { position: relative; }
.sgx .sgx-bar-track {
  position: relative; height: 30px; border-radius: 999px;
  background: linear-gradient(180deg, #0a0f28, #151d47);
  border: 1px solid #2b3874;
  box-shadow: 0 0 34px -8px var(--g2), inset 0 3px 8px rgba(0, 0, 0, .55);
}
.sgx .sgx-bar-fill {
  position: absolute; inset: 0; border-radius: 999px; overflow: hidden;
  background: linear-gradient(90deg, var(--g1), var(--g2), var(--g3), var(--g2), var(--g1));
  background-size: 200% 100%;
  -webkit-clip-path: inset(0 100% 0 0 round 999px); clip-path: inset(0 100% 0 0 round 999px);
  animation: sgx-flow 3.5s linear infinite;
}
.sgx .sgx-bar-fill::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, .22) 0 8px, transparent 8px 18px);
  background-size: 36px 100%; animation: sgx-stripes 1.1s linear infinite;
}
.sgx .sgx-bar-fill::after {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 52%;
  background: linear-gradient(180deg, rgba(255, 255, 255, .5), rgba(255, 255, 255, 0));
}
/* 10 ভাগে ভাগ করা দাগ */
.sgx .sgx-bar-seg {
  position: absolute; inset: 0; border-radius: 999px; pointer-events: none;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 2px), rgba(6, 9, 19, .6) calc(10% - 2px), rgba(6, 9, 19, .6) 10%);
}
.sgx .sgx-bar-knob {
  position: absolute; top: 50%; left: 0; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; opacity: 0;
  background: radial-gradient(circle at 35% 30%, #fff 0 35%, var(--g2) 100%);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .16), 0 0 18px 4px var(--g2);
  animation: sgx-knob 1.8s ease-in-out infinite;
}
.sgx .sgx-bar-tick {
  position: absolute; left: 96%; top: -5px; bottom: -7px; width: 3px; margin-left: -1px; border-radius: 3px;
  background: var(--gold); box-shadow: 0 0 10px var(--gold);
}
.sgx .sgx-bar-tick em {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 2px; padding: 1px 7px; border-radius: 7px;
  font: 700 10px/16px 'JetBrains Mono', ui-monospace, Consolas, monospace; font-style: normal; color: #1a1200; background: var(--gold);
}
.sgx .sgx-pass-foot { margin-top: 26px; text-align: center; }
.sgx .sgx-verdict {
  display: inline-block; padding: 8px 16px; border-radius: 999px; border: 1px solid transparent;
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  background: linear-gradient(rgba(13, 18, 36, .95), rgba(13, 18, 36, .95)) padding-box, linear-gradient(90deg, var(--g1), var(--g2), var(--g3)) border-box;
  transition: color .4s;
}
.sgx[data-state="call"] .sgx-verdict,
.sgx[data-state="put"] .sgx-verdict,
.sgx[data-state="none"] .sgx-verdict { color: var(--accent); }
.sgx[data-state="scan"] .sgx-verdict { color: var(--text); animation: sgx-blink 1s ease-in-out infinite; }

/* ===== Next candle ===== */
.sgx .sgx-next { display: flex; align-items: baseline; justify-content: space-between; margin-top: 18px; font-size: 13px; color: var(--muted); }
.sgx .sgx-next-v { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; font-size: 13px; }
.sgx .sgx-next-v b { display: inline-block; font-size: 22px; font-weight: 700; color: #fff; }
.sgx .sgx-clock.is-hot { color: var(--g2); text-shadow: 0 0 14px var(--g2); animation: sgx-beat 1s ease-in-out infinite; }
.sgx .sgx-minute-track { height: 5px; margin-top: 10px; border-radius: 5px; background: #182047; overflow: hidden; }
.sgx .sgx-minute { height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, var(--g1), var(--g2), var(--g3)); box-shadow: 0 0 12px var(--g2); transition: width 1s linear; }

/* ===== Strategy matrix ===== */
.sgx .sgx-matrix-card { display: flex; flex-direction: column; }
.sgx .sgx-matrix-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.sgx .sgx-matrix-title { font-size: 15px; font-weight: 700; }
.sgx .sgx-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sgx .sgx-legend b { font-family: 'JetBrains Mono', ui-monospace, Consolas, monospace; color: var(--text); margin-right: 8px; }
.sgx .sgx-key { width: 10px; height: 10px; border-radius: 3px; }
.sgx .sgx-key-p { background: linear-gradient(145deg, #2dffa0, #00c8ff); }
.sgx .sgx-key-f { background: linear-gradient(145deg, #ff3b6e, #ff8a1f); }
.sgx .sgx-grid-wrap { position: relative; margin: auto 0; border-radius: 12px; overflow: hidden; padding: 4px; }
.sgx .sgx-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: clamp(4px, 1vw, 8px); }
.sgx .sgx-cell {
  --sc: 1; aspect-ratio: 1; border-radius: 7px; background: #141b3b; border: 1px solid #1d2650;
  transition: background .3s, border-color .3s, box-shadow .3s, transform .3s;
}
.sgx .sgx-cell.p { --sc: 1; background: linear-gradient(145deg, #2dffa0, #00c8ff); border-color: transparent; box-shadow: 0 0 12px rgba(45, 255, 160, .35); animation: sgx-pop .55s cubic-bezier(.2, 1.4, .4, 1); }
.sgx .sgx-cell.f { --sc: .86; background: linear-gradient(145deg, #ff3b6e, #ff8a1f); border-color: transparent; box-shadow: 0 0 12px rgba(255, 59, 110, .45); transform: scale(.86); animation: sgx-pop .55s cubic-bezier(.2, 1.4, .4, 1); }
.sgx[data-state="idle"] .sgx-cell { animation: sgx-idle 3.4s ease-in-out infinite; }
.sgx .sgx-sweep {
  position: absolute; left: 0; right: 0; top: 0; height: 22%; opacity: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, .2));
  border-bottom: 2px solid rgba(255, 255, 255, .85); box-shadow: 0 8px 22px var(--g2);
}
.sgx[data-state="scan"] .sgx-sweep { animation: sgx-sweep .95s cubic-bezier(.4, 0, .2, 1) 1 both; }

/* ===== Chart ===== */
.sgx .sgx-chart { margin-top: 18px; height: 500px; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); background: #000; box-shadow: 0 0 44px -20px var(--g2); }
.sgx .sgx-frame { display: block; width: 100%; height: 100%; border: 0; }
.sgx .sgx-note { margin: 16px 4px 0; font-size: 12px; color: var(--muted); text-align: center; }

/* ===== Keyframes ===== */
@keyframes sgx-spin { to { --sgx-ang: 360deg; } }
@keyframes sgx-drift-a { to { transform: translate(-70px, 60px) scale(1.15); } }
@keyframes sgx-drift-b { to { transform: translate(80px, -50px) scale(1.2); } }
@keyframes sgx-title { to { background-position: 100% 0; } }
@keyframes sgx-draw { 0% { stroke-dashoffset: 100; } 45%, 70% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -100; } }
@keyframes sgx-pulse { 70% { box-shadow: 0 0 0 9px rgba(45, 255, 160, 0); } 100% { box-shadow: 0 0 0 0 rgba(45, 255, 160, 0); } }
@keyframes sgx-orbit { to { transform: rotate(360deg); } }
@keyframes sgx-glow { from { filter: drop-shadow(0 0 5px var(--accent)); } to { filter: drop-shadow(0 0 16px var(--accent)); } }
@keyframes sgx-ripple { 0% { transform: scale(.82); opacity: .75; } 100% { transform: scale(1.18); opacity: 0; } }
@keyframes sgx-blink { 50% { opacity: .35; } }
@keyframes sgx-pop-sig { 0% { transform: scale(.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes sgx-flow { to { background-position: 200% 0; } }
@keyframes sgx-stripes { to { background-position: 36px 0; } }
@keyframes sgx-knob { 50% { box-shadow: 0 0 0 7px rgba(255, 255, 255, .06), 0 0 26px 7px var(--g2); } }
@keyframes sgx-beat { 50% { transform: scale(1.3); } }
@keyframes sgx-pop { 0% { transform: scale(.2); opacity: .3; filter: brightness(2.2); } 60% { transform: scale(calc(var(--sc) * 1.2)); opacity: 1; } 100% { transform: scale(var(--sc)); filter: brightness(1); } }
@keyframes sgx-idle { 0%, 100% { background: #141b3b; border-color: #1d2650; } 50% { background: #1d2760; border-color: #4a3fb3; } }
@keyframes sgx-sweep { 0% { transform: translateY(-100%); opacity: 1; } 85% { opacity: 1; } 100% { transform: translateY(455%); opacity: 0; } }

/* ===== Responsive ===== */
@media (max-width: 760px) {
  .sgx { border-radius: 20px; }
  .sgx .sgx-main { grid-template-columns: minmax(0, 1fr); }
  .sgx .sgx-chart { height: 380px; }
  .sgx .sgx-live { margin-left: auto; }
}
@media (max-width: 380px) {
  .sgx .sgx-card { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .sgx, .sgx *, .sgx *::before, .sgx *::after { animation: none !important; transition: none !important; }
}
