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

body {
  overflow: hidden;
  width: 100dvw;
  height: 100dvh;
  background: #111;
}

#loading {
  position: fixed;
  inset: 0;
  background: #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
  transition: opacity 0.4s ease;
}

#loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #333;
  border-top-color: #aaa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-text {
  color: #888;
  font-family: sans-serif;
  font-size: 14px;
  letter-spacing: 0.05em;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

canvas:active {
  cursor: grabbing;
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: #1a1a1a;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 10;
  box-shadow: -4px 0 24px rgba(0,0,0,0.6);
}

.panel.open {
  transform: translateX(0);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 16px;
  background: #222;
  border-bottom: 1px solid #333;
  flex-shrink: 0;
}

.panel-close,
.panel-external {
  background: #333;
  border: none;
  color: #ddd;
  font-size: 20px;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: 6px;
  line-height: 1;
  text-decoration: none;
  display: flex;
  align-items: center;
}

.panel-close:hover,
.panel-external:hover {
  color: #fff;
  background: #555;
}

#panel-frame {
  flex: 1;
  border: none;
  background: #fff;
}
