*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #1a1b26;
  color: #c0caf5;
  line-height: 1.5;
}

.app {
  display: flex;
  flex-direction: row;
  height: 100vh;
  min-height: 0;
}

/* Left: camera fills available space */
.camera-panel {
  flex: 1 1 60%;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  background: #16161e;
}

.video-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1b26;
}

.video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.frame-guide {
  position: absolute;
  inset: 24px;
  border: 3px solid rgba(122, 162, 247, 0.7);
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25);
}

/* Right: sidebar with controls + results */
.sidebar {
  flex: 0 0 380px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  background: #24283b;
  border-left: 1px solid #364a7c;
  overflow: hidden;
}

.sidebar-header {
  flex-shrink: 0;
  padding: 1rem 1.25rem 0.5rem;
  text-align: left;
}

.sidebar-header h1 {
  font-size: 1.35rem;
  font-weight: 600;
  color: #7aa2f7;
  margin: 0 0 0.35rem;
}

.subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: #a9b1d6;
}

.sidebar-controls {
  flex-shrink: 0;
  padding: 0 1.25rem 1rem;
}

.hint {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  color: #9aa5ce;
}

.live-score {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  min-height: 1.4em;
}

.live-score.low {
  color: #f7768e;
}

.live-score.ok {
  color: #9ece6a;
}

.actions {
  margin-bottom: 0.5rem;
}

button {
  font: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 8px;
  background: #7aa2f7;
  color: #1a1b26;
  cursor: pointer;
  font-weight: 600;
}

button:hover:not(:disabled) {
  background: #89b4fa;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.status {
  font-size: 0.85rem;
  min-height: 1.4em;
}

.status.loading {
  color: #e0af68;
}

.status.success {
  color: #9ece6a;
}

.status.error {
  color: #f7768e;
}

/* Scrollable results area only */
.sidebar-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 1.25rem 1.25rem;
}

.results-section {
  padding: 0;
  margin: 0;
}

.results-section h2 {
  font-size: 1.15rem;
  color: #7aa2f7;
  margin: 0 0 0.5rem;
}

.score-summary {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: #9ece6a;
}

.results-table {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th,
td {
  padding: 0.4rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid #364a7c;
}

th {
  color: #7aa2f7;
  font-weight: 600;
}

tr:last-child td {
  border-bottom: none;
}

.correct {
  color: #9ece6a;
}

.incorrect {
  color: #f7768e;
}

.error-section {
  background: rgba(247, 118, 142, 0.12);
  border: 1px solid rgba(247, 118, 142, 0.4);
  border-radius: 8px;
  padding: 0.75rem;
}

.error-message {
  margin: 0;
  font-size: 0.9rem;
  color: #f7768e;
}

.hidden {
  display: none !important;
}
