:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f5f2ec;
  color: #191817;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

button,
.image-upload {
  border: 1px solid #252525;
  border-radius: 8px;
  background: #ffffff;
  color: #171717;
  cursor: pointer;
  font-weight: 700;
  min-height: 42px;
  padding: 10px 14px;
}

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

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.intro {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.eyebrow {
  color: #c4451d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2.3rem, 6vw, 5.7rem);
  line-height: 0.94;
  margin-bottom: 0;
}

.subtitle {
  color: #4d4942;
  font-size: 1.15rem;
  margin-bottom: 0;
  max-width: 720px;
}

.workspace {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 18px;
  align-items: start;
}

.upload-panel,
.result-panel,
.history-panel {
  background: #ffffff;
  border: 1px solid #ded8cd;
  border-radius: 8px;
  box-shadow: 0 14px 40px rgba(23, 20, 16, 0.08);
}

.upload-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
  position: sticky;
  top: 16px;
}

.drop-zone {
  align-items: center;
  border: 2px dashed #b9afa0;
  border-radius: 8px;
  display: grid;
  min-height: 190px;
  overflow: hidden;
  padding: 18px;
  position: relative;
  text-align: center;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

.drop-zone.is-dragging {
  background: #fff7e7;
  border-color: #e97036;
}

.drop-zone input {
  cursor: pointer;
  inset: 0;
  opacity: 0;
  position: absolute;
  width: 100%;
}

.drop-copy {
  display: grid;
  gap: 10px;
  justify-items: center;
  pointer-events: none;
}

.icon {
  align-items: center;
  background: #191817;
  border-radius: 8px;
  color: #ffffff;
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 900;
  height: 46px;
  justify-content: center;
  width: 58px;
}

.drop-copy h2 {
  margin-bottom: 0;
}

.drop-copy p,
.status {
  color: #686158;
  margin-bottom: 0;
}

.camera-box {
  display: grid;
  gap: 10px;
}

video {
  aspect-ratio: 16 / 9;
  background: #111111;
  border-radius: 8px;
  display: none;
  object-fit: cover;
  width: 100%;
}

video.is-live {
  display: block;
}

.camera-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.camera-actions button,
.image-upload {
  align-items: center;
  display: inline-flex;
  font-size: 0.88rem;
  justify-content: center;
  text-align: center;
}

.image-upload input {
  display: none;
}

textarea {
  border: 1px solid #d3cbc1;
  border-radius: 8px;
  min-height: 150px;
  padding: 12px;
  resize: vertical;
}

.primary {
  background: #c4451d;
  border-color: #c4451d;
  color: #ffffff;
}

.result-panel {
  padding: 18px;
}

.result-header {
  align-items: start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.result-header h2 {
  margin-bottom: 0;
}

.risk-badge {
  border-radius: 999px;
  color: #ffffff;
  flex: 0 0 auto;
  font-size: 0.85rem;
  font-weight: 900;
  padding: 8px 12px;
}

.risk-badge.neutral {
  background: #77736c;
}

.risk-badge.low {
  background: #277c4d;
}

.risk-badge.medium {
  background: #c47b1d;
}

.risk-badge.high {
  background: #b42318;
}

.score-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.score-row div {
  background: #f7f4ee;
  border: 1px solid #ece5da;
  border-radius: 8px;
  padding: 14px;
}

.score-row strong {
  display: block;
  font-size: 1.9rem;
  line-height: 1;
}

.score-row span {
  color: #5f594f;
  font-size: 0.88rem;
}

.output-block {
  border-top: 1px solid #ece5da;
  padding: 18px 0 0;
}

.output-block + .output-block {
  margin-top: 18px;
}

.output-block h3 {
  font-size: 1rem;
  margin-bottom: 10px;
}

.clean-list {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.clean-list li:not(.question-item),
.risk-item {
  background: #fbfaf7;
  border: 1px solid #eee8dd;
  border-radius: 8px;
  padding: 11px 12px;
}

.question-item {
  display: block;
}

.question-button {
  align-items: center;
  background: #fbfaf7;
  border: 1px solid #eee8dd;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 54px;
  padding: 11px 12px;
  text-align: left;
  width: 100%;
}

.question-button:hover,
.question-button:focus-visible {
  background: #fff7e8;
  border-color: #d99058;
  outline: none;
}

.question-action {
  color: #c4451d;
  flex: 0 0 auto;
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.risk-list {
  display: grid;
  gap: 10px;
}

.risk-item mark {
  background: #ffe0d2;
  border-radius: 4px;
  color: #5c170b;
  font-weight: 800;
  padding: 1px 3px;
}

.risk-meta {
  color: #6c6256;
  font-size: 0.85rem;
  margin-top: 6px;
}

.history-panel {
  margin-top: 18px;
  padding: 16px;
}

.history-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.history-title h2 {
  font-size: 1.1rem;
  margin-bottom: 0;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-card {
  background: #fbfaf7;
  border: 1px solid #eee8dd;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
}

.history-card strong {
  display: block;
}

.history-card span {
  color: #6f685e;
  font-size: 0.86rem;
}

.answer-modal {
  align-items: center;
  background: rgba(17, 17, 17, 0.45);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 18px;
  position: fixed;
  z-index: 20;
}

.answer-modal[hidden] {
  display: none;
}

.answer-card {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
  max-height: min(720px, calc(100vh - 36px));
  max-width: 700px;
  overflow: auto;
  padding: 22px;
  position: relative;
  width: min(100%, 700px);
}

.answer-card h2 {
  font-size: 1.25rem;
  line-height: 1.25;
  margin-bottom: 12px;
  padding-right: 48px;
}

.answer-close {
  align-items: center;
  aspect-ratio: 1;
  background: #ffffff;
  display: inline-flex;
  font-size: 1rem;
  justify-content: center;
  min-height: 0;
  padding: 0;
  position: absolute;
  right: 14px;
  top: 14px;
  width: 34px;
}

.answer-evidence {
  border-top: 1px solid #ece5da;
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
}

.answer-evidence p {
  background: #fbfaf7;
  border: 1px solid #eee8dd;
  border-radius: 8px;
  color: #524a40;
  margin: 0;
  padding: 10px;
}

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

  .upload-panel {
    position: static;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 22px;
  }

  .camera-actions,
  .score-row {
    grid-template-columns: 1fr;
  }

  .result-header,
  .history-card {
    display: grid;
  }
}
