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

html, body {
  height: 100%;
  background: #000;
  color: #fff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Splash screen */
.splash {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  z-index: 100;
  transition: opacity 1.3s ease;
}

.splash span {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.15em;
  color: #fff;
  opacity: 0.7;
}

.splash.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-dots {
  margin-top: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 18px;
  font-weight: 300;
  letter-spacing: 0.3em;
  color: #fff;
  opacity: 0.4;
}

.loading-dots::after {
  content: '.';
  animation: dots 1.5s steps(1, end) infinite;
}

@keyframes dots {
  0% { content: '.'; }
  33% { content: '..'; }
  66% { content: '...'; }
}

main {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.container {
  text-align: center;
  width: 100%;
  max-width: 700px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.container.ready {
  opacity: 1;
}

.ticker {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.2em;
  opacity: 0.5;
  margin-bottom: 8px;
}

.price-wrapper {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
}

.currency {
  font-size: 32px;
  font-weight: 300;
  opacity: 0.6;
  margin-right: 4px;
}

.price {
  display: inline-flex;
  font-size: 72px;
  font-weight: 300;
  letter-spacing: -0.02em;
}

.digit-slot {
  display: inline-block;
  height: 1.15em;
  overflow: hidden;
  position: relative;
}

.digit-roll {
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.digit-roll span {
  height: 1.15em;
  line-height: 1.15em;
}

/* Price direction flash */
.price.flash-up .digit-roll span {
  color: #22c55e;
}

.price.flash-down .digit-roll span {
  color: #ef4444;
}

.price .digit-roll span {
  transition: color 0.8s ease;
}

/* Block stream */
.block-stream {
  position: relative;
  margin-top: 80px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* The horizontal line */
.stream-line {
  position: absolute;
  width: 100%;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
}

/* Container for flowing squares */
.stream-track {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
}

/* Individual square */
.stream-block {
  position: absolute;
  width: var(--block-size, 8px);
  height: var(--block-size, 8px);
  background: #fff;
  border-radius: 1px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  animation: streamFlow 8s linear forwards;
  will-change: transform, opacity;
}

@keyframes streamFlow {
  0% {
    right: -10px;
    opacity: 0;
  }
  2% {
    opacity: var(--block-opacity, 0.5);
  }
  95% {
    opacity: var(--block-opacity, 0.5);
  }
  100% {
    right: calc(100% + 10px);
    opacity: 0;
  }
}

/* Visualization container */
.visualization {
  position: relative;
  height: 160px;
  margin-top: 100px;
}

.block-stream {
  margin-top: 0;
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.block-stream.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Shatter animation - graceful dissolve */
.stream-block.shatter {
  animation: shatter 1s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
}

@keyframes shatter {
  0% {
    transform: translateY(-50%) scale(1);
    opacity: var(--block-opacity, 0.5);
    filter: blur(0);
  }
  30% {
    transform: translateY(-50%) scale(1.1);
    opacity: 0.8;
    filter: blur(0);
  }
  100% {
    transform: translateY(calc(-50% + var(--shatter-y, 40px))) translateX(var(--shatter-x, 0px)) scale(0.3);
    opacity: 0;
    filter: blur(4px);
  }
}

/* Chart container */
.chart-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-container.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

#chart {
  width: 100% !important;
  height: 100% !important;
}

/* Live indicator dot */
.live-indicator {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.5;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 8px 2px rgba(255, 255, 255, 0.3);
  }
}

/* Toggle button */
.toggle-btn {
  margin-top: 40px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  cursor: pointer;
  padding: 8px 16px;
  transition: color 0.2s ease;
}

.toggle-btn:hover {
  color: rgba(255, 255, 255, 0.5);
}

/* Mobile optimization */
@media (max-width: 600px) {
  main {
    padding: 30px 16px;
  }
  
  .container {
    max-width: 100%;
  }
  
  .ticker {
    font-size: 12px;
  }
  
  .currency {
    font-size: 24px;
  }
  
  .price {
    font-size: 48px;
  }
  
  .visualization {
    height: 120px;
    margin-top: 60px;
  }
  
  .toggle-btn {
    margin-top: 30px;
    font-size: 10px;
    padding: 10px 20px;
  }
  
  .splash span {
    font-size: 14px;
    padding: 0 20px;
    text-align: center;
  }
}

@media (max-width: 400px) {
  .price {
    font-size: 40px;
  }
  
  .currency {
    font-size: 20px;
  }
  
  .visualization {
    height: 100px;
    margin-top: 50px;
  }
}
