* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: linear-gradient(135deg, #eef2ff, #f8fafc);
  color: #111827;
}

.app {
  max-width: 1300px;
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 32px;
}

.subtitle {
  margin: 0;
  color: #4b5563;
}

.mode-box {
  background: white;
  padding: 14px 16px;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}

.mode-box label {
  display: block;
  font-size: 14px;
  margin-bottom: 8px;
  color: #374151;
}

.mode-box select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  font-size: 15px;
}

.grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.card {
  background: white;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
}

.card h2 {
  margin-top: 0;
}

.camera-container {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

video,
canvas {
  width: 100%;
  max-width: 420px;
  height: 320px;
  object-fit: cover;
  border-radius: 16px;
  border: 2px solid #111827;
  background: #000;
}

#result {
  margin-top: 16px;
  text-align: center;
  font-size: 24px;
}

.practice-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.label {
  margin-bottom: 8px;
  color: #6b7280;
  font-size: 14px;
}

.target-sign,
.detected-sign {
  min-width: 120px;
  text-align: center;
  padding: 18px 24px;
  border-radius: 16px;
  font-size: 32px;
  font-weight: bold;
  background: #f3f4f6;
}

.score-row {
  display: flex;
  gap: 16px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.score-box {
  flex: 1;
  min-width: 120px;
  background: #eef2ff;
  padding: 16px;
  border-radius: 14px;
  text-align: center;
}

.score-box span {
  display: block;
  color: #4b5563;
  margin-bottom: 6px;
}

.score-box strong {
  font-size: 28px;
}

.button-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

button {
  border: none;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 15px;
  cursor: pointer;
  background: #2563eb;
  color: white;
  transition: 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}

button.danger {
  background: #dc2626;
}

.sign-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.sign-item {
  padding: 14px;
  text-align: center;
  background: #f3f4f6;
  border-radius: 12px;
  font-weight: bold;
  font-size: 20px;
}

.help-list {
  padding-left: 18px;
  line-height: 1.8;
  color: #374151;
}

.hint-list p {
  margin: 10px 0;
  color: #374151;
}

.correct {
  background: #dcfce7 !important;
  color: #166534 !important;
}

.wrong {
  background: #fee2e2 !important;
  color: #991b1b !important;
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .topbar h1 {
    font-size: 24px;
  }

  video,
  canvas {
    height: 240px;
  }

  #result {
    font-size: 20px;
  }

  .sign-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}