:root {
  --tp-bg: #0b0814;
  --tp-panel: #150e1f;
  --tp-panel2: #1d1430;
  --tp-line: rgba(255,255,255,.09);
  --tp-line2: rgba(255,255,255,.14);
  --tp-txt: #f3f1f6;
  --tp-mut: #b3aac4;
  --tp-lead: #ddd6e8;
  --tp-purple: #8e43f0;
  --tp-purple2: #6300e2;
  --tp-coral: #ff6b61;
  --tp-red: #e53935;
  --tp-lilac: #c79bff;
  --tp-sky: #5ec8ff;
  --tp-gold: #ffb020;
}

/* Fill the parent only. Do not use 100vw / -50vw breakout: that stacks
   with Elementor's Stretch Section (itself width:100vw plus a negative
   left offset) and overflows on the right, especially on a phone. */
#tgcc-grid-wrap {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  position: relative;
  left: auto;
  right: auto;
  margin: 0;
  background: var(--tp-bg);
  border-top: 1px solid var(--tp-line);
  border-bottom: 1px solid var(--tp-line);
  padding: 8px 0 20px;
  overflow: hidden;
}
#tgcc-grid-wrap, #tgcc-grid-wrap * { box-sizing: border-box; }

#tgcc-grid {
  font-family: Montserrat, Arial, Helvetica, sans-serif;
  background: transparent;
  color: var(--tp-txt);
  width: 100%;
  max-width: 1360px;
  min-width: 0;
  margin: 0 auto;
  padding: 16px 16px 8px;
  border: 0;
  box-shadow: none;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
#tgcc-grid .tg-hero,
#tgcc-grid .tg-hero-card,
#tgcc-grid .tg-main,
#tgcc-grid .tg-mid,
#tgcc-grid .tg-panel,
#tgcc-grid .tg-stats,
#tgcc-grid .tg-stats-grid,
#tgcc-grid .tg-mix-layout,
#tgcc-grid .tg-int-grid,
#tgcc-grid .tg-chart,
#tgcc-grid .tg-gauge,
#tgcc-grid .tg-donut,
#tgcc-grid .tg-row,
#tgcc-grid .tg-head {
  min-width: 0;
  max-width: 100%;
}
#tgcc-grid .tg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
#tgcc-grid .tg-kicker {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--tp-lilac);
  font-weight: 700;
  margin: 0 0 4px;
}
#tgcc-grid h2.tg-title {
  font-size: clamp(1.35rem, 2.1vw, 2rem);
  font-weight: 800;
  letter-spacing: .2px;
  margin: 0;
  color: var(--tp-txt);
  line-height: 1.15;
}
#tgcc-grid .tg-updated {
  color: var(--tp-mut);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  margin: 0;
  padding: 0;
}
#tgcc-grid .tg-live-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: 4px 0 0;
  padding: 0;
  width: 100%;
}
#tgcc-grid .tg-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--tp-gold);
}
#tgcc-grid .tg-live i {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--tp-gold);
  box-shadow: 0 0 0 0 rgba(255,176,32,.7);
  animation: tg-pulse 2s ease-out infinite;
}
#tgcc-grid .tg-countdown {
  font-variant-numeric: tabular-nums;
  color: var(--tp-mut);
  font-size: 12px;
}
@keyframes tg-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,176,32,.55); }
  70% { box-shadow: 0 0 0 8px rgba(255,176,32,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,176,32,0); }
}

#tgcc-grid .tg-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 16px;
  width: 100%;
}
@media (min-width: 960px) {
  #tgcc-grid { padding: 16px 24px 8px; }
  #tgcc-grid .tg-hero-card { padding: 16px 18px 14px; }
  #tgcc-grid .tg-hero { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
}
#tgcc-grid .tg-hero-card {
  background: var(--tp-panel);
  border: 1px solid var(--tp-line2);
  border-radius: 18px;
  padding: 14px 14px 12px;
  min-height: 0;
  min-width: 0;
  overflow-wrap: break-word;
  transition: background-color .6s ease;
}
#tgcc-grid .tg-hero-card:first-child {
  background: radial-gradient(500px 240px at 0 0, rgba(142,67,240,.2), transparent 70%), var(--tp-panel);
}
#tgcc-grid .tg-num {
  font-size: clamp(1.8rem, 3.2vw, 2.85rem);
  font-weight: 800;
  letter-spacing: .4px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  color: var(--tp-txt);
}
#tgcc-grid .tg-num .tg-unit {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--tp-mut);
  margin-left: 4px;
}
#tgcc-grid .tg-hero-note {
  margin: 6px 0 0;
  color: var(--tp-mut);
  font-size: 13px;
}

#tgcc-grid .tg-main,
#tgcc-grid .tg-mid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (min-width: 960px) {
  #tgcc-grid .tg-main { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.35fr); align-items: stretch; }
  #tgcc-grid .tg-mid { grid-template-columns: minmax(0, .7fr) minmax(0, 1.6fr); align-items: stretch; }
}

#tgcc-grid .tg-panel,
#tgcc-grid .tg-stats {
  background: var(--tp-panel);
  border: 1px solid var(--tp-line);
  border-radius: 18px;
  padding: 16px 18px 18px;
}
#tgcc-grid h3 {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--tp-lilac);
  font-weight: 700;
}
#tgcc-grid .tg-chart-caption {
  margin: -6px 0 10px;
  color: var(--tp-mut);
  font-size: 12px;
}

#tgcc-grid .tg-mix-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: center;
}
@media (min-width: 640px) {
  #tgcc-grid .tg-mix-layout { grid-template-columns: 160px minmax(0, 1fr); }
}
/* When the mix sits beside the 24h chart, keep the donut to the side
   but cap it so the bars stay readable. */
@media (min-width: 960px) {
  #tgcc-grid .tg-mix-layout { grid-template-columns: 150px minmax(0, 1fr); }
  #tgcc-grid .tg-donut { max-width: 150px; }
}

#tgcc-grid .tg-donut { width: 100%; max-width: 180px; margin: 0 auto; }
#tgcc-grid .tg-donut svg { display: block; width: 100%; height: auto; }
#tgcc-grid .tg-donut-center {
  font-size: 13px;
  fill: var(--tp-mut);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
#tgcc-grid .tg-donut-value {
  font-size: 22px;
  fill: var(--tp-txt);
  font-weight: 800;
}

#tgcc-grid .tg-row {
  display: grid;
  grid-template-columns: 8.4rem minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 5px 0;
  font-size: 14px;
}
#tgcc-grid .tg-row .tg-name { color: var(--tp-lead); font-weight: 600; line-height: 1.25; }
#tgcc-grid .tg-row .tg-name small {
  display: block;
  font-weight: 500;
  color: var(--tp-mut);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  margin-top: 1px;
}
#tgcc-grid .tg-bar {
  height: 10px;
  background: rgba(255,255,255,.06);
  border-radius: 99px;
  overflow: hidden;
}
#tgcc-grid .tg-bar > span {
  display: block;
  height: 100%;
  border-radius: 99px;
  width: 0;
  transform-origin: left center;
  transition: width .7s ease;
}
#tgcc-grid .tg-val {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--tp-txt);
  text-align: right;
  white-space: nowrap;
  min-width: 5.6rem;
}
#tgcc-grid .tg-val .tg-val-s {
  display: block;
  font-weight: 500;
  color: var(--tp-mut);
  font-size: 11px;
}

#tgcc-grid .c-gas { background: var(--tp-coral); }
#tgcc-grid .c-wind { background: var(--tp-sky); }
#tgcc-grid .c-nuclear { background: var(--tp-lilac); }
#tgcc-grid .c-solar { background: var(--tp-gold); }
#tgcc-grid .c-biomass { background: #7bc47b; }
#tgcc-grid .c-hydro { background: #3aa0c8; }
#tgcc-grid .c-coal { background: #8a8396; }
#tgcc-grid .c-pumped { background: var(--tp-purple); }
#tgcc-grid .c-imports { background: #f0a36b; }
#tgcc-grid .c-other { background: #584d66; }
#tgcc-grid .c-gas-stroke { stroke: var(--tp-coral); }
#tgcc-grid .c-wind-stroke { stroke: var(--tp-sky); }
#tgcc-grid .c-nuclear-stroke { stroke: var(--tp-lilac); }
#tgcc-grid .c-solar-stroke { stroke: var(--tp-gold); }
#tgcc-grid .c-biomass-stroke { stroke: #7bc47b; }
#tgcc-grid .c-hydro-stroke { stroke: #3aa0c8; }
#tgcc-grid .c-coal-stroke { stroke: #8a8396; }
#tgcc-grid .c-pumped-stroke { stroke: var(--tp-purple); }
#tgcc-grid .c-imports-stroke { stroke: #f0a36b; }
#tgcc-grid .c-other-stroke { stroke: #584d66; }

#tgcc-grid .tg-chart { width: 100%; min-height: 260px; }
#tgcc-grid .tg-chart svg { display: block; width: 100%; height: auto; }
#tgcc-grid .tg-chart-axis { fill: var(--tp-mut); font-size: 11px; font-family: Montserrat, Arial, sans-serif; }
#tgcc-grid .tg-chart-grid { stroke: var(--tp-line); stroke-width: 1; }
#tgcc-grid .tg-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--tp-lead);
}
#tgcc-grid .tg-chart-legend i {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}

#tgcc-grid .tg-gauge { width: 100%; max-width: 360px; margin: 0 auto; }
#tgcc-grid .tg-gauge svg { display: block; width: 100%; height: auto; }
#tgcc-grid .tg-gauge-label { fill: var(--tp-mut); font-size: 12px; font-family: Montserrat, Arial, sans-serif; }
#tgcc-grid .tg-gauge-value { fill: var(--tp-txt); font-size: 28px; font-weight: 800; font-family: Montserrat, Arial, sans-serif; }
#tgcc-grid .tg-gauge-sub { fill: var(--tp-mut); font-size: 12px; font-family: Montserrat, Arial, sans-serif; }
#tgcc-grid .tg-gauge-caption { margin: 0; text-align: center; color: var(--tp-mut); font-size: 12px; line-height: 1.4; }

#tgcc-grid .tg-int-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 560px) {
  #tgcc-grid .tg-int-grid { grid-template-columns: 1fr 1fr; }
}
#tgcc-grid .tg-int {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--tp-panel2);
  border: 1px solid var(--tp-line);
  border-radius: 12px;
  font-size: 13px;
  transition: background-color .5s ease;
}
#tgcc-grid .tg-int .n { color: var(--tp-lead); }
#tgcc-grid .tg-int .v { font-weight: 700; font-variant-numeric: tabular-nums; }
#tgcc-grid .tg-int.is-export .v { color: var(--tp-mut); }
#tgcc-grid .tg-int.is-import .v { color: var(--tp-gold); }

#tgcc-grid .tg-stats { margin-bottom: 16px; }
#tgcc-grid .tg-stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px) {
  #tgcc-grid .tg-stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1100px) {
  #tgcc-grid .tg-stats-grid { grid-template-columns: 1fr 1fr 1fr; }
}
#tgcc-grid .tg-stat {
  background: var(--tp-panel2);
  border: 1px solid var(--tp-line);
  border-radius: 14px;
  padding: 14px 14px 12px;
  transition: background-color .5s ease;
}
#tgcc-grid .tg-stat h4 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--tp-mut);
  font-weight: 700;
}
#tgcc-grid .tg-stat .tg-big {
  font-size: 1.65rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--tp-txt);
  font-variant-numeric: tabular-nums;
}
#tgcc-grid .tg-stat p { margin: 8px 0 0; color: var(--tp-lead); font-size: 13px; }

#tgcc-grid .tg-note, #tgcc-grid .tg-sources, #tgcc-grid .tg-err {
  color: var(--tp-mut);
  font-size: 12px;
  margin: 0;
}
#tgcc-grid .tg-sources { margin-top: 8px; }
#tgcc-grid .tg-sources a, #tgcc-grid a {
  color: var(--tp-lilac);
  text-decoration: underline;
  text-decoration-color: rgba(199,155,255,.45);
  text-underline-offset: 3px;
}
#tgcc-grid a:hover { color: var(--tp-coral); }
#tgcc-grid .tg-err {
  background: rgba(229,57,53,.12);
  border: 1px solid rgba(229,57,53,.35);
  color: var(--tp-lead);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
  display: none;
}
#tgcc-grid .tg-err.is-on { display: block; }

#tgcc-grid .tg-flash { animation: tg-flash .8s ease; }
@keyframes tg-flash {
  0% { background-color: rgba(199,155,255,.22); }
  100% { background-color: transparent; }
}

/* Skeleton */
#tgcc-grid .tg-skel-row,
#tgcc-grid .tg-skel-line {
  height: 16px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255,255,255,.04) 0%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.04) 100%);
  background-size: 200% 100%;
  animation: tg-shimmer 1.4s ease-in-out infinite;
  margin: 10px 0;
}
#tgcc-grid .tg-skel-line { height: 28px; width: 46%; }
#tgcc-grid.tg-skel .tg-hero-card .tg-num .tg-num-v {
  display: inline-block;
  width: 4.5rem;
  height: 1em;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255,255,255,.04) 0%, rgba(255,255,255,.1) 50%, rgba(255,255,255,.04) 100%);
  background-size: 200% 100%;
  animation: tg-shimmer 1.4s ease-in-out infinite;
  color: transparent;
}
#tgcc-grid.tg-skel .tg-chart,
#tgcc-grid.tg-skel .tg-donut,
#tgcc-grid.tg-skel .tg-gauge {
  min-height: 200px;
  border-radius: 14px;
  background: linear-gradient(90deg, rgba(255,255,255,.04) 0%, rgba(255,255,255,.08) 50%, rgba(255,255,255,.04) 100%);
  background-size: 200% 100%;
  animation: tg-shimmer 1.4s ease-in-out infinite;
}
@keyframes tg-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (max-width: 480px) {
  #tgcc-grid { padding: 12px 12px 6px; }
  #tgcc-grid .tg-head {
    flex-direction: column;
    align-items: flex-start;
  }
  #tgcc-grid .tg-updated {
    align-items: flex-start;
    text-align: left;
    width: 100%;
  }
  #tgcc-grid .tg-live-row {
    justify-content: flex-start;
    width: 100%;
  }
  #tgcc-grid .tg-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "name val" "bar bar";
    gap: 4px 8px;
  }
  #tgcc-grid .tg-row .tg-name { grid-area: name; }
  #tgcc-grid .tg-row .tg-val { grid-area: val; min-width: 0; }
  #tgcc-grid .tg-row .tg-bar { grid-area: bar; }
  #tgcc-grid .tg-hero { gap: 8px; }
  #tgcc-grid .tg-hero-card { min-height: 0; padding: 10px 10px; }
  #tgcc-grid .tg-num { font-size: 1.45rem; letter-spacing: 0; }
  #tgcc-grid .tg-num .tg-unit { font-size: 0.85rem; margin-left: 2px; }
  #tgcc-grid .tg-hero-note { font-size: 12px; }
  #tgcc-grid h2.tg-title { font-size: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  #tgcc-grid .tg-live i,
  #tgcc-grid .tg-skel-row,
  #tgcc-grid .tg-skel-line,
  #tgcc-grid.tg-skel .tg-hero-card .tg-num .tg-num-v,
  #tgcc-grid.tg-skel .tg-chart,
  #tgcc-grid.tg-skel .tg-donut,
  #tgcc-grid.tg-skel .tg-gauge,
  #tgcc-grid .tg-flash {
    animation: none !important;
  }
  #tgcc-grid .tg-bar > span,
  #tgcc-grid .tg-hero-card,
  #tgcc-grid .tg-int,
  #tgcc-grid .tg-stat {
    transition: none !important;
  }
}
