:root {
  color-scheme: dark;
  --bg: #050608;
  --panel: rgba(17, 21, 27, 0.82);
  --panel-strong: rgba(21, 27, 34, 0.96);
  --line: rgba(138, 151, 167, 0.2);
  --text: #f4f7fb;
  --muted: #94a3b8;
  --soft: #cbd5e1;
  --green: #27f09b;
  --red: #ff5f73;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(39, 240, 155, 0.08), transparent 32%),
    linear-gradient(215deg, rgba(84, 132, 255, 0.1), transparent 34%),
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.08), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

.shell {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 22px;
  min-height: 100vh;
  width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: clamp(18px, 4vw, 42px) 0 clamp(24px, 4vw, 52px);
}

.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 54px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.5rem, 4vw, 2.35rem);
  font-weight: 760;
  line-height: 1;
  letter-spacing: 0;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(39, 240, 155, 0.42);
  border-radius: 4px;
  background: rgba(39, 240, 155, 0.12);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 20px rgba(39, 240, 155, 0.9);
}

.domain {
  color: var(--muted);
  font-family: "SF Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
}

.domain:hover {
  color: var(--text);
}

.hero {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 112px;
}

.hero-copy {
  max-width: 820px;
}

.eyebrow {
  margin: 0;
  color: var(--soft);
  font-size: clamp(1.15rem, 2.1vw, 1.8rem);
  line-height: 1.35;
}

.online {
  margin: 10px 0 0;
  color: var(--green);
  font-size: 0.95rem;
  font-weight: 700;
}

.widget-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: stretch;
  min-height: min(720px, calc(100vh - 220px));
}

.widget-frame {
  position: relative;
  min-height: 620px;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(39, 240, 155, 0.08), rgba(5, 6, 8, 0.24)),
    var(--panel-strong);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

#valki-energy-markets {
  min-height: 620px;
  width: 100%;
}

.widget-loader,
.widget-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--soft);
  font-size: 0.98rem;
  text-align: center;
}

.widget-error {
  color: var(--red);
  background: rgba(5, 6, 8, 0.76);
}

[hidden] {
  display: none !important;
}

@media (max-width: 860px) {
  .shell {
    gap: 18px;
  }

  .hero {
    min-height: 92px;
  }

  .widget-stage {
    min-height: 620px;
  }
}

@media (max-width: 520px) {
  .shell {
    width: min(100vw - 24px, 1320px);
    gap: 18px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .hero {
    min-height: 86px;
  }

  .widget-frame,
  #valki-energy-markets {
    min-height: 640px;
  }
}
