/* Risk Lab v2: a guided, plain-language layout. Builds on tmc-v2.css (bg stack). */

body.tg-v2 {
  --t2-net1: 34, 230, 155;
  --t2-net2: 240, 199, 94;
  --tg-line: rgba(248,250,250,0.12);
  --tg-text: #f8fafa;
  --tg-muted: rgba(248,250,250,0.68);
  --tg-green: #7fd8a4;
  --tg-gold: #f2c36b;
  --tg-red: #ff9a8f;
  margin: 0;
  background: transparent;
  color: var(--tg-text);
  font-family: Sarabun, system-ui, sans-serif;
}
html:has(body.tg-v2) {
  background: #001319;
}
.tg *,
.tg *::before,
.tg *::after {
  box-sizing: border-box;
}
.tg {
  position: relative;
  padding-bottom: 80px;
  overflow-x: clip;
}
.tg h1,
.tg h2,
.tg p,
.tg ol {
  margin: 0;
  padding: 0;
}
.tg-wrap {
  width: min(1160px, calc(100% - 32px));
  margin-inline: auto;
}

/* ---------- hero ---------- */
.tg-hero {
  padding: clamp(28px, 5vw, 64px) 0 20px;
}
.tg-tag {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px !important;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--tg-green);
}
.tg-tag::before {
  content: "";
  width: 30px;
  height: 2px;
  background: linear-gradient(90deg, var(--tg-green), transparent);
}
.tg-hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}
.tg h1 {
  max-width: 14em;
  font-size: clamp(32px, 5.4vw, 64px);
  line-height: 1.25;
  font-weight: 800;
  text-wrap: balance;
  background: linear-gradient(100deg, #f8fafa, #e8d19b 60%, #7fd8a4);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tg-lead {
  max-width: 36em;
  margin-top: 14px !important;
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.75;
  color: var(--tg-muted);
}
.tg-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--tg-line);
  border-radius: 14px;
  background: rgba(248,250,250,0.05);
  color: var(--tg-text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.tg-ghost:hover:not(:disabled) {
  border-color: var(--tg-green);
  box-shadow: 0 0 24px rgba(127,216,164,0.2);
}
.tg-ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.tg-wide {
  width: 100%;
}

/* how it works */
.tg-how {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 26px !important;
}
.tg-how li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid var(--tg-line);
  border-radius: 18px;
  background: rgba(248,250,250,0.045);
}
.tg-how i {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--tg-gold);
  color: #001319;
  font-style: normal;
  font-weight: 800;
}
.tg-how b {
  display: block;
  font-size: 16.5px;
}
.tg-how span {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--tg-muted);
}
.tg-goal {
  margin-top: 14px !important;
  padding: 14px 18px;
  border-left: 3px solid var(--tg-gold);
  border-radius: 0 14px 14px 0;
  background: rgba(242,195,107,0.09);
  font-size: 15.5px;
  line-height: 1.65;
}
.tg-goal b {
  margin-right: 10px;
  color: var(--tg-gold);
}
.tg-goal span {
  color: var(--tg-text);
}

/* ---------- stats ---------- */
.tg-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}
.tg-stats > div {
  padding: 14px 20px;
  border: 1px solid var(--tg-line);
  border-radius: 18px;
  background: rgba(248,250,250,0.05);
}
.tg-stats span {
  display: block;
  font-size: 13px;
  color: var(--tg-muted);
}
.tg-stats strong {
  display: block;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.3;
}
.tg-dots {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.tg-dots i {
  width: 26px;
  height: 6px;
  border-radius: 3px;
  background: rgba(248,250,250,0.14);
}
.tg-dots i.now {
  background: var(--tg-gold);
  box-shadow: 0 0 10px var(--tg-gold);
}
.tg-dots i.win {
  background: var(--tg-green);
}
.tg-dots i.miss {
  background: var(--tg-red);
}

/* ---------- workspace ---------- */
.tg-work {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
}
.tg-glass {
  border: 1px solid var(--tg-line);
  border-radius: 26px;
  background: rgba(248,250,250,0.05);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 24px 60px rgba(0,19,25,0.4), inset 0 1px 0 rgba(248,250,250,0.08);
}
.tg-chart {
  padding: clamp(14px, 2vw, 24px);
}
.tg-chart-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.tg-market {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tg-pair {
  font-size: 18px;
  font-weight: 800;
}
.tg-side {
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.1em;
}
.tg-side.buy {
  background: rgba(127,216,164,0.18);
  color: var(--tg-green);
}
.tg-side.sell {
  background: rgba(255,154,143,0.18);
  color: var(--tg-red);
}
.tg-sim {
  font-size: 12.5px;
  color: rgba(248,250,250,0.5);
}
.tg-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-bottom: 8px;
  font-size: 14px;
}
.tg-legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--tg-muted);
}
.tg-legend i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}
.tg-legend b {
  color: var(--tg-text);
}
.lg-entry i {
  background: #f8fafa;
}
.lg-sl i {
  background: var(--tg-red);
}
.lg-tp i {
  background: var(--tg-green);
}
#chart {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 18px;
  background: rgba(0,19,25,0.55);
}
.tg-chart-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--tg-muted);
  font-size: 14px;
}
.tg-chart-bottom > div {
  text-align: right;
}
.tg-chart-bottom small {
  display: block;
  font-size: 12px;
}
#floating {
  font-size: 28px;
  font-weight: 800;
}
.positive {
  color: var(--tg-green);
}
.negative {
  color: var(--tg-red);
}
.tg-result {
  display: none;
  margin-top: 14px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--tg-line);
}
.tg-result.show {
  display: grid;
  gap: 6px;
}
.tg-result.win {
  border-color: rgba(127,216,164,0.5);
  background: rgba(127,216,164,0.1);
}
.tg-result.loss {
  border-color: rgba(255,154,143,0.5);
  background: rgba(255,154,143,0.1);
}
.tg-result strong {
  font-size: 20px;
}
.tg-result span {
  font-size: 15.5px;
  line-height: 1.65;
}
.tg-result small {
  font-size: 13.5px;
  color: var(--tg-muted);
}

/* share block */
.tg-share {
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px dashed var(--tg-line);
  border-radius: 18px;
}
.tg-share[hidden] {
  display: none;
}
.tg-share h2 {
  font-size: 17px;
}
.tg-share p {
  margin-top: 4px !important;
  font-size: 14px;
  line-height: 1.6;
  color: var(--tg-muted);
}
.tg-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.tg-line {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, #e8d19b, #f2c36b);
  color: #001319;
  font-weight: 800;
  text-decoration: none;
}

/* ---------- controls ---------- */
.tg-panel {
  padding: clamp(18px, 2.4vw, 28px);
  position: sticky;
  top: 90px;
}
.tg-setup {
  display: grid;
  gap: 14px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--tg-line);
}
.tg-setup label,
.tg-field > span {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--tg-muted);
}
.tg-panel input[type="number"] {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  border: 1px solid var(--tg-line);
  border-radius: 14px;
  background: rgba(0,19,25,0.6);
  color: var(--tg-text);
  font: inherit;
  font-size: 17px;
}
.tg-panel input:focus {
  outline: none;
  border-color: var(--tg-green);
  box-shadow: 0 0 0 4px rgba(127,216,164,0.16);
}
.tg-field {
  display: grid;
  gap: 8px;
}
.tg-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tg-pills button {
  flex: 1;
  min-width: 64px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--tg-line);
  border-radius: 12px;
  background: rgba(248,250,250,0.05);
  color: var(--tg-text);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.tg-pills button.on {
  border-color: var(--tg-gold);
  background: rgba(242,195,107,0.18);
  color: #e8d19b;
}
.tg-pills button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tg-step {
  display: grid;
  gap: 12px;
  padding: 18px 0;
  border-bottom: 1px solid var(--tg-line);
}
.tg-step:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.tg-step-h {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 800;
}
.tg-step-h i {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--tg-gold);
  color: #001319;
  font-style: normal;
  font-size: 14px;
}
.tg-lot {
  position: relative;
}
.tg-lot input {
  font-size: 28px !important;
  font-weight: 800;
  min-height: 62px !important;
  padding-right: 70px !important;
}
.tg-unit {
  position: absolute;
  right: 18px;
  top: 50%;
  translate: 0 -50%;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--tg-gold);
}
.tg-range {
  width: 100%;
  accent-color: var(--tg-gold);
  height: 28px;
}
.tg-gauge {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--tg-line);
  border-radius: 16px;
  background: rgba(0,19,25,0.45);
}
.tg-gauge-bar {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: rgba(248,250,250,0.1);
  overflow: visible;
}
.tg-gauge-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  transition: width 0.25s, background 0.25s;
}
.tg-gauge.is-ok .tg-gauge-bar i {
  background: linear-gradient(90deg, #7fd8a4, var(--tg-green));
  box-shadow: 0 0 14px rgba(127,216,164,0.6);
}
.tg-gauge.is-over .tg-gauge-bar i {
  background: linear-gradient(90deg, #ff9a8f, var(--tg-red));
  box-shadow: 0 0 14px rgba(255,154,143,0.6);
}
.tg-gauge-bar b {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #f8fafa;
  box-shadow: 0 0 8px #f8fafa;
}
.tg-gauge p {
  margin: 0 !important;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--tg-muted);
}
.tg-gauge strong {
  color: var(--tg-text);
}
.tg-note {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.55;
}
.tg-note.ok {
  color: var(--tg-green);
}
.tg-note.danger {
  color: var(--tg-red);
}
.tg-preview {
  display: grid;
  gap: 8px;
}
.tg-preview > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(248,250,250,0.05);
  font-size: 14.5px;
}
.tg-preview span {
  color: var(--tg-muted);
}
.tg-preview b {
  font-size: 17px;
}
.tg-preview > div:nth-child(1) b {
  color: var(--tg-red);
}
.tg-preview > div:nth-child(2) b {
  color: var(--tg-green);
}
.tg-go {
  min-height: 60px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #e8d19b, #f2c36b);
  color: #001319;
  font: inherit;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 40px rgba(242,195,107,0.3), inset 0 1px 0 rgba(248,250,250,0.5);
  transition: transform 0.2s;
}
.tg-go:hover:not(:disabled) {
  transform: translateY(-2px);
}
.tg-go:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tg-go[hidden],
.tg-ghost[hidden] {
  display: none;
}
.tg-micro {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--tg-muted);
}

/* ---------- journal ---------- */
.tg-journal {
  margin-top: 18px;
  padding: clamp(16px, 2vw, 26px);
}
.tg-journal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.tg-journal h2 {
  font-size: 20px;
}
.tg-journal-head span {
  font-size: 13.5px;
  color: var(--tg-muted);
}
.tg-scroll {
  overflow-x: auto;
}
.tg-journal table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.tg-journal th,
.tg-journal td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--tg-line);
  white-space: nowrap;
}
.tg-journal th {
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--tg-muted);
}
.tg-details {
  margin-top: 14px;
  padding: 16px 20px;
  border: 1px solid var(--tg-line);
  border-radius: 18px;
  background: rgba(248,250,250,0.04);
}
.tg-details summary {
  cursor: pointer;
  font-weight: 700;
}
.tg-details p {
  margin-top: 10px !important;
  font-size: 14px;
  line-height: 1.75;
  color: var(--tg-muted);
}
.tg-details a {
  display: inline-block;
  margin-top: 10px;
  color: var(--tg-green);
}

@media (max-width: 980px) {
  .tg-work {
    grid-template-columns: minmax(0, 1fr);
  }
  .tg-panel {
    position: static;
  }
  .tg-how {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 640px) {
  .tg-hero-row {
    flex-direction: column;
  }
  .tg-stats {
    grid-template-columns: minmax(0, 1fr);
  }
  .tg-stats > div {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
  }
  .tg-dots {
    grid-column: 1 / -1;
  }
}
