:root {
  --body-bg: #080a17;
  --surface-bg: #0e1421;
  --primary-color: #3eceb2;
  --secondary-color: #7c8bac;
  --success-color: #04dc9b;
  --danger-color: #ff2b41;
  --text-color: #ffffff;
  --text-secondary: #7c8bac;
  --grid-color: #313135;
  --scale-text-color: #737373;
  --header-height: 40px;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--body-bg);
  color: var(--text-color);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.kline-root {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
  background-color: var(--body-bg);
}

.kline-header {
  flex-shrink: 0;
  width: 100%;
  background-color: var(--surface-bg);
  border-bottom: 1px solid rgba(132, 142, 156, 0.12);
}

.kline-intervals {
  display: flex;
  align-items: center;
  gap: 4px;
  width: 100%;
  min-height: var(--header-height);
  padding: 0 8px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.kline-intervals::-webkit-scrollbar {
  display: none;
}

.kline-intervals span {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 0 8px;
  height: 32px;
  line-height: 32px;
  color: var(--secondary-color);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.kline-intervals span.active {
  position: relative;
  color: var(--primary-color);
  font-weight: 600;
}

.kline-intervals span.active::after {
  content: '';
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background-color: var(--primary-color);
}

.kline-chart {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 200px;
  overflow: hidden;
  background-color: var(--body-bg);
}

#tv_chart_container,
#tv_chart_container iframe {
  width: 100% !important;
  height: 100% !important;
  background-color: var(--body-bg);
}

.kline-loading,
.kline-error {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--body-bg);
}

.kline-error[hidden],
.kline-loading[hidden] {
  display: none !important;
}

.kline-error {
  z-index: 101;
  padding: 24px;
  text-align: center;
  gap: 12px;
}

.kline-error-title {
  color: var(--text-color);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.kline-error-desc {
  max-width: 280px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.kline-error-retry {
  margin-top: 8px;
  min-width: 120px;
  height: 36px;
  padding: 0 20px;
  border: none;
  border-radius: 6px;
  background-color: var(--primary-color);
  color: var(--body-bg);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.kline-error-retry:active {
  opacity: 0.85;
}

.loading-wave {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  width: min(100%, 280px);
  height: 72px;
}

.loading-bar {
  width: 16px;
  height: 12px;
  border-radius: 4px;
  animation: loading-wave-animation 1s ease-in-out infinite;
}

.loading-bar:nth-child(2) {
  animation-delay: 0.1s;
}

.loading-bar:nth-child(3) {
  animation-delay: 0.2s;
}

.loading-bar:nth-child(4) {
  animation-delay: 0.3s;
}

@keyframes loading-wave-animation {
  0%,
  100% {
    height: 12px;
  }

  50% {
    height: 44px;
  }
}

html.kline-embed,
html.kline-embed body,
html.kline-embed #app,
html.kline-embed .kline-root {
  height: 100%;
  min-height: 0;
}

html.kline-embed .kline-root {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

html.kline-embed .kline-chart {
  flex: 1;
  min-height: 0;
  height: auto;
}

html.kline-embed .kline-header {
  box-shadow: none;
}

@media (max-width: 480px) {
  .kline-intervals span {
    min-width: 46px;
    font-size: 11px;
  }
}
