/* Outer wrapper fills entire app window */
#cv-root, .cv-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: black;
  overflow: hidden;
}

/* 4:3 aspect ratio box that scales responsively */
.cv-aspect-box {
  position: relative;
  height: 100%;
  max-height: 100%;
  aspect-ratio: 4 / 3;
  background: black;
}

/* Canvas fills the box, maintaining aspect ratio */
.cv-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Overlay content is pinned to canvas */
.cv-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

.cv-overlay button {
  pointer-events: auto;
}

/* Loading screen centered */
.cv-loading {
  position: absolute;
  z-index: 1000;
  width: 100%;
  height: 100%;
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
  display: flex;
  flex-direction: column;
}

.cv-loading img {
  width: 120px;
  height: auto;
}

/* Gesture trail styling */
#gesture-trail {
  position: absolute;
  bottom: 20px;
  left: 0px;
  font-size: 64px;
  white-space: nowrap;
  overflow-x: auto;
  pointer-events: none;
  width: 100%;
}

/* Gesture spell effect in center */
#gesture-spell {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 64px;
  pointer-events: none;
  text-align: center;
  white-space: nowrap;
  /* font should be white with glowing effect and black outline */
  color: white;
  text-shadow: 0 0 5px #00ffff;
  -webkit-text-stroke: 1px black;
}

/* Detected object list in top-right */
.detected-objects {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 12px;
  background: rgba(0,0,0,0.6);
  padding: 8px;
  border-radius: 4px;
  pointer-events: none;
  display: none; /* for now */
}

.detected-objects ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.loading-text {
  margin-top: 20px;
  color: white;
  font-size: 18px;
  font-family: monospace;
  text-align: center;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%   { opacity: 0.3; }
  50%  { opacity: 1; }
  100% { opacity: 0.3; }
}

.instruction-overlay {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2000;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  animation: fadeIn 1s ease-out;
  display: none;
}

.instruction-box {
  max-width: 400px;
  padding: 24px;
  background: rgba(30, 30, 30, 0.95);
  border-radius: 16px;
  box-shadow: 0 0 20px #00ffff55;
  pointer-events: auto;
}

.instruction-box p, h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: #fff;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.spell-guide {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  padding: 12px;
  border-radius: 8px;
  max-height: 80%;
  overflow-y: auto;
  font-family: sans-serif;
  font-size: 14px;
  z-index: 50; /* Should be below loading/instruction, above canvas */
  pointer-events: none;
}

.spell-guide h3 {
  margin-top: 0;
  font-size: 16px;
  color: #00f0ff;
}

#spell-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

#spell-list li {
  margin-bottom: 6px;
  color: #fff;
}

#toggle-dots-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  z-index: 100; /* Above everything else */
}