* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #111;
  color: #eee;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

header {
  background: #1a1a2e;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: 600;
  border-bottom: 2px solid #e94560;
}

#mode-toggle {
  display: flex;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #444;
}

.mode-btn {
  padding: 6px 14px;
  border: none;
  background: #2a2a40;
  color: #888;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.mode-btn.active {
  background: #e94560;
  color: #fff;
}

body.remove-mode header {
  border-bottom-color: #f59e0b;
}

body.remove-mode .mode-btn.active {
  background: #f59e0b;
}

body.remove-mode #capture-btn {
  background: #f59e0b;
}

body.remove-mode .btn-primary {
  background: #f59e0b;
}

body.remove-mode .effective-label {
  color: #f59e0b;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* Capture screen */
#capture-screen {
  position: relative;
}

#video {
  width: 100%;
  flex: 1;
  object-fit: cover;
  background: #000;
}

#capture-btn {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #e94560;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

#capture-btn:active {
  background: #c33;
}

#file-input-label {
  position: absolute;
  bottom: 32px;
  right: 24px;
  color: #ccc;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}

#file-input {
  display: none;
}

/* Identifying screen */
#identifying-screen {
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #333;
  border-top-color: #e94560;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Photo preview */
#photo-preview {
  padding: 8px 12px;
  flex-shrink: 0;
}

#preview-img {
  width: 100%;
  max-height: 160px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #333;
}

/* Review screen */
#review-screen {
  padding: 12px;
  gap: 12px;
  overflow-y: auto;
}

/* Item card */
.item-card {
  background: #1e1e30;
  border-radius: 8px;
  padding: 10px;
  border: 1px solid #333;
}

.card-body {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.item-thumb {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
  border-radius: 6px;
  background: #2a2a40;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 1.5rem;
  border: 1px solid #444;
}

.item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.item-details .row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.item-details input,
.item-details select {
  background: #2a2a40;
  border: 1px solid #444;
  color: #eee;
  border-radius: 4px;
  padding: 5px 6px;
  font-size: 0.9rem;
}

.item-details input[type="text"] {
  flex: 1;
  min-width: 0;
}

.item-details input[type="date"] {
  flex: 1;
  min-width: 0;
}

.qty-select {
  width: 56px;
}

.location-select {
  flex: 1;
  min-width: 0;
}

.remove-btn {
  background: none;
  border: none;
  color: #e94560;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0 4px;
}

.confidence {
  font-size: 0.75rem;
  color: #888;
}

.effective-row {
  background: #222240;
  border-radius: 4px;
  padding: 4px 8px;
  text-align: center;
}

.effective-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #4fc3f7;
}

/* Slider rows */
.slider-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.slider-prefix {
  font-size: 0.8rem;
  color: #777;
  min-width: 24px;
}

.qty-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: #2a2a40;
  outline: none;
}

.qty-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e94560;
  cursor: pointer;
}

.qty-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #e94560;
  cursor: pointer;
  border: none;
}

.amount-slider::-webkit-slider-thumb {
  background: #45e980;
}

.amount-slider::-moz-range-thumb {
  background: #45e980;
}

.slider-label {
  font-size: 0.85rem;
  color: #aaa;
  min-width: 56px;
  text-align: right;
}

.btn-row {
  display: flex;
  gap: 8px;
  padding: 8px 0;
}

.btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: #e94560;
  color: #fff;
}

.btn-primary:disabled {
  background: #555;
  cursor: not-allowed;
}

.btn-secondary {
  background: #2a2a40;
  color: #ccc;
  border: 1px solid #444;
}

.btn-add {
  background: none;
  border: 1px dashed #555;
  color: #aaa;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}

/* Result screen */
#result-screen {
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
}

#result-screen .checkmark {
  font-size: 3rem;
}

#result-message {
  font-size: 1.1rem;
  line-height: 1.5;
  width: 100%;
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #333;
}

.result-row span {
  flex: 1;
  text-align: left;
}

.btn-shop {
  padding: 6px 12px;
  border: 1px solid #4fc3f7;
  background: none;
  color: #4fc3f7;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.btn-shop:disabled {
  border-color: #555;
  color: #555;
  cursor: default;
}
