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

body {
  background: #0a0a0a;
  color: #fff;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

#globe-container {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

/* Loading */
#loading {
  position: fixed;
  inset: 0;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: opacity 0.6s;
  gap: 12px;
}
#loading.fade-out {
  opacity: 0;
  pointer-events: none;
}
#loading-text {
  font-size: 11px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 3px;
}
#loading-bar {
  width: 200px;
  height: 2px;
  background: #1a1a1a;
  border-radius: 1px;
  overflow: hidden;
}
#loading-bar-fill {
  height: 100%;
  width: 0%;
  background: #00ff88;
  transition: width 0.3s ease;
  border-radius: 1px;
}
#loading-count {
  font-size: 11px;
  color: #333;
  font-variant-numeric: tabular-nums;
}

/* Info panel */
#info-panel {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 10;
  pointer-events: none;
}
.info-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #444;
  margin-bottom: 8px;
}
#market-summary {
  font-size: 11px;
  color: #555;
  line-height: 1.6;
}

/* Chart modal */
#chart-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
#chart-modal.hidden {
  display: none;
}
#chart-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}
#chart-container {
  position: relative;
  background: #111;
  border: 1px solid #222;
  border-radius: 8px;
  width: min(90vw, 700px);
  overflow: hidden;
}
#chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #1a1a1a;
  gap: 12px;
}
#chart-country {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
#chart-name {
  font-size: 12px;
  color: #666;
  margin-left: 8px;
}
#chart-price {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
#chart-change {
  font-size: 13px;
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}
#chart-close {
  background: none;
  border: none;
  color: #555;
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}
#chart-close:hover {
  color: #fff;
}
#chart-body {
  height: 350px;
  padding: 8px;
}
#chart-footer {
  display: flex;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid #1a1a1a;
  font-size: 11px;
  color: #444;
}

/* Gain/Loss colors */
.gain { color: #00ff88; }
.loss { color: #ff3366; }
.neutral { color: #888; }

/* ── Bottom Sheet ─────────────────────────── */

#bottom-sheet {
  display: none;
}

@media (max-width: 767px) {
  #bottom-sheet {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 75vh;
    height: 75dvh;
    background: #0d0d0d;
    border-top: 1px solid #1a1a1a;
    border-radius: 16px 16px 0 0;
    z-index: 20;
    transform: translateY(100%);
    will-change: transform;
    touch-action: none;
  }
  #bottom-sheet.ready {
    /* set by JS after initial positioning */
  }

  #sheet-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 0 8px;
    cursor: grab;
    -webkit-tap-highlight-color: transparent;
  }
  #sheet-pill {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #333;
  }

  #sheet-content {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: calc(75vh - 48px);
    height: calc(75dvh - 48px);
    padding: 0 16px 24px;
  }

  .m-region {
    font-size: 10px;
    letter-spacing: 3px;
    color: #444;
    padding: 16px 0 8px;
    border-bottom: 1px solid #1a1a1a;
    text-transform: uppercase;
  }
  .m-region:first-child {
    padding-top: 4px;
  }

  .m-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0 12px;
    padding: 12px 0;
    border-bottom: 1px solid #111;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .m-row:active {
    background: #151515;
  }

  .m-left {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .m-dot {
    font-size: 6px;
    flex-shrink: 0;
  }
  .m-country {
    font-size: 13px;
    font-weight: 600;
    color: #ddd;
  }
  .m-name {
    font-size: 10px;
    color: #555;
    margin-top: 1px;
  }

  .m-right {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
  }
  .m-price {
    font-size: 14px;
    font-weight: 700;
    color: #ccc;
    font-variant-numeric: tabular-nums;
  }
  .m-change {
    font-size: 12px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-top: 1px;
  }

  .m-status {
    grid-column: 1 / -1;
    font-size: 9px;
    color: #333;
    margin-top: 2px;
  }

  /* Mobile chart adjustments */
  #chart-container {
    width: 95vw;
    border-radius: 12px;
  }
  #chart-header {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 4px;
  }
  #chart-body {
    height: 280px;
  }
  #info-panel {
    top: 12px;
    left: 12px;
  }
  .info-title {
    font-size: 12px;
    letter-spacing: 3px;
  }
}
