body, html {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #1a1a2e;
}

#webcam {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  object-fit: cover;
  pointer-events: none;
  transform: scaleX(-1);
  z-index: 1;
  opacity: 0.3;
}

#canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  transform: scaleX(-1);
  z-index: 3;
}

#three-canvas {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 2;
}

#instructions-section {
  margin-top: 10px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  font-size: 13px;
  line-height: 1.8;
}

#gesture-info {
  position: absolute;
  top: 75px;
  left: 20px;
  width: 250px;
}

#gesture-status {
  margin-bottom: 10px;
  font-weight: bold;
  color: #27ae60;
}

#confidence-details-title {
  margin-top: 15px;
  margin-bottom: 8px;
  font-weight: bold;
  color: #3498db;
  padding-top: 10px;
}

#confidence-details {
  font-size: 11px;
}

.confidence-row {
  display: flex;
  align-items: center;
  margin: 3px 0;
  height: 16px;
}

.conf-num {
  width: 20px;
  font-weight: bold;
  color: #333;
}

.conf-bar {
  flex: 1;
  height: 12px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  margin: 0 8px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.2);
}

.conf-fill {
  height: 100%;
  transition: width 0.2s ease;
  border-radius: 5px;
}

.conf-percent {
  width: 45px;
  text-align: right;
  font-weight: bold;
  color: #555;
}

#number-reference {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 220px;
}

.ref-title {
  font-weight: bold;
  margin-bottom: 10px;
  color: #3498db;
  font-size: 16px;
}

.ref-grid {
  display: grid;
  gap: 5px;
  font-size: 12px;
}

.ref-item {
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  border-left: 3px solid #3498db;
}


#detected-number {
  font-weight: bold;
  color: #0000ff;
  font-size: 20px;
}

#current-state {
  display: block;
  margin-top: 8px;
  padding: 8px;
  background: rgba(52, 152, 219, 0.1);
  border-radius: 5px;
  font-size: 15px;
  font-weight: bold;
}

.text-box {
  padding: 15px 20px;
  background-color: rgba(255, 255, 255, 0.95);
  color: black;
  border-radius: 10px;
  font-family: "Arial", sans-serif;
  border: 2px solid black;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
  font-size: 14px;
  z-index: 200;
  backdrop-filter: blur(10px);
}

.sudoku-cell {
  cursor: pointer;
}

.sudoku-cell.selected {
  background: rgba(0, 255, 255, 0.5) !important;
}

.sudoku-cell.preview {
  color: rgba(255, 255, 0, 0.8);
}

.sudoku-cell.locked {
  font-weight: bold;
  color: #333;
}

.sudoku-cell.user-filled {
  color: #0066ff;
  font-weight: bold;
}

/* Animation for number changes */
@keyframes numberPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.number-changed {
  animation: numberPop 0.3s ease;
}

/* Visual feedback for detection states */
.detecting {
  border-color: #f39c12 !important;
  box-shadow: 0 0 20px rgba(243, 156, 18, 0.5);
}

.detected {
  border-color: #27ae60 !important;
  box-shadow: 0 0 20px rgba(39, 174, 96, 0.5);
}

/* Completion messages */
#completion-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 30px 50px;
  border-radius: 15px;
  text-align: center;
  z-index: 1000;
  animation: slideDown 0.5s ease;
}

@keyframes slideDown {
  from {
    transform: translate(-50%, -150%);
    opacity: 0;
  }
  to {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

.success-message {
  background: linear-gradient(135deg, #27ae60, #2ecc71);
  color: white;
  box-shadow: 0 10px 40px rgba(39, 174, 96, 0.4);
}

.error-message {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
  box-shadow: 0 10px 40px rgba(231, 76, 60, 0.4);
}

#completion-message h2 {
  margin: 0 0 15px 0;
  font-size: 32px;
}

#completion-message p {
  margin: 0;
  font-size: 18px;
}

/* New Game Button */
#new-game-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 250px;
  padding: 12px 20px;
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  font-size: 16px;
  font-weight: bold;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.3);
  text-align: center;
}

#new-game-btn:hover {
  background: linear-gradient(135deg, #2980b9, #21618c);
  transform: translateY(-2px);
  box-shadow: 5px 5px 0px rgba(0, 0, 0, 0.3);
}

#new-game-btn.pinched {
  background: linear-gradient(135deg, #27ae60, #229954);
  transform: scale(0.95);
  box-shadow: 1px 1px 0px rgba(0, 0, 0, 0.3);
}