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

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(23, 23, 23, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(23, 23, 23, 0.035) 1px, transparent 1px),
    #f4f2ec;
  background-size: 34px 34px;
}

button,
input {
  font: inherit;
}

.app {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.machine {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 22px;
  align-items: stretch;
  padding: 24px;
  border: 2px solid #171717;
  background: #fffaf0;
  box-shadow: 8px 8px 0 #171717;
}

.machine-panel {
  display: grid;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-light {
  width: 22px;
  height: 22px;
  border: 2px solid #171717;
  background: #d7352a;
  box-shadow: inset 0 0 0 4px #fffaf0;
}

.status-light.ready {
  background: #16845b;
}

h1 {
  margin: 0;
  font-size: clamp(36px, 8vw, 88px);
  line-height: 0.92;
  letter-spacing: 0;
  text-transform: uppercase;
}

p {
  margin: 8px 0 0;
  color: #5b554d;
}

.drop-zone {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 2px dashed #171717;
  background: #fefefe;
  cursor: pointer;
  text-align: center;
  transition: background 150ms ease, transform 150ms ease;
}

.drop-zone.dragging {
  background: #ffe89a;
  transform: translate(-2px, -2px);
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.drop-zone strong {
  font-size: 22px;
  text-transform: uppercase;
}

.drop-zone small {
  max-width: 520px;
  color: #5b554d;
}

.plate {
  width: min(260px, 70vw);
  aspect-ratio: 2.7;
  border: 3px solid #171717;
  border-radius: 999px;
  background:
    radial-gradient(ellipse at center, transparent 0 46%, #171717 47% 50%, transparent 51%),
    linear-gradient(90deg, #d7352a 0 18%, #f7b928 18% 82%, #d7352a 82%);
  box-shadow: 0 8px 0 #d8d0c0;
}

.controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.controls label {
  display: grid;
  gap: 6px;
  color: #5b554d;
  font-size: 13px;
  text-transform: uppercase;
}

.controls input {
  width: 100%;
  min-height: 42px;
  border: 2px solid #171717;
  border-radius: 0;
  padding: 0 10px;
  background: #fff;
}

.phone-demo {
  display: grid;
  place-items: center;
  min-height: 100%;
  border: 2px solid #171717;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.09) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    #25282e;
  background-size: 18px 18px;
  padding: 22px;
}

.phone-frame {
  position: relative;
  width: min(100%, 292px);
  aspect-ratio: 0.54;
  border: 10px solid #111419;
  border-radius: 34px;
  background: #111419;
  box-shadow: 0 12px 0 rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.speaker,
.camera,
.home-button {
  position: absolute;
  z-index: 3;
}

.speaker {
  top: 12px;
  left: 50%;
  width: 68px;
  height: 6px;
  border-radius: 999px;
  background: #2f343c;
  transform: translateX(-50%);
}

.camera {
  top: 11px;
  right: 66px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #243668;
  border: 2px solid #1a1c23;
}

.home-button {
  left: 50%;
  bottom: 10px;
  width: 36px;
  height: 36px;
  border: 3px solid #2d323a;
  border-radius: 50%;
  transform: translateX(-50%);
}

.phone-screen {
  position: absolute;
  inset: 36px 0 54px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at center, transparent 0 42%, rgba(23, 23, 23, 0.9) 43% 46%, transparent 47%),
    linear-gradient(90deg, #d7352a 0 18%, #f7b928 18% 82%, #d7352a 82%);
  background-size: cover;
  isolation: isolate;
}

.phone-screen.has-image {
  background-image: linear-gradient(rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.16)), var(--preview-image);
  background-position: center;
  background-size: cover;
}

.phone-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, 0.08);
}

.result-banner {
  width: 100%;
  min-height: 58px;
  display: grid;
  place-items: center;
  padding: 8px;
  background: rgba(16, 142, 42, 0.95);
  color: #fff;
  font-size: 31px;
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
  text-shadow:
    2px 2px 0 #171717,
    -1px -1px 0 #171717,
    1px -1px 0 #171717,
    -1px 1px 0 #171717;
}

.phone-screen.is-not .result-banner,
.phone-screen.is-error .result-banner {
  background: rgba(211, 53, 42, 0.95);
}

.phone-screen.is-evaluating .result-banner {
  align-self: end;
  min-height: auto;
  margin-bottom: 44px;
  background: transparent;
  font-size: 35px;
}

.checkmark {
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(16, 142, 42, 0.94);
  color: #fff;
  font-size: 82px;
  font-weight: 900;
  line-height: 1;
  text-shadow:
    2px 2px 0 #171717,
    -1px -1px 0 #171717,
    1px -1px 0 #171717,
    -1px 1px 0 #171717;
  transform: rotate(-9deg);
}

.phone-screen.is-not .checkmark,
.phone-screen.is-error .checkmark {
  background: rgba(211, 53, 42, 0.94);
}

.spinner {
  position: relative;
  width: 118px;
  height: 118px;
  animation: spin 1.2s linear infinite;
}

.spinner span {
  position: absolute;
  top: 6px;
  left: 52px;
  width: 14px;
  height: 14px;
  border: 2px solid #171717;
  border-radius: 50%;
  background: #d36685;
  transform-origin: 7px 53px;
}

.spinner span:nth-child(1) { transform: rotate(0deg); opacity: 1; }
.spinner span:nth-child(2) { transform: rotate(30deg); opacity: 0.92; }
.spinner span:nth-child(3) { transform: rotate(60deg); opacity: 0.84; }
.spinner span:nth-child(4) { transform: rotate(90deg); opacity: 0.76; }
.spinner span:nth-child(5) { transform: rotate(120deg); opacity: 0.68; }
.spinner span:nth-child(6) { transform: rotate(150deg); opacity: 0.6; }
.spinner span:nth-child(7) { transform: rotate(180deg); opacity: 0.52; }
.spinner span:nth-child(8) { transform: rotate(210deg); opacity: 0.44; }
.spinner span:nth-child(9) { transform: rotate(240deg); opacity: 0.36; }
.spinner span:nth-child(10) { transform: rotate(270deg); opacity: 0.32; background: #e9edf2; }
.spinner span:nth-child(11) { transform: rotate(300deg); opacity: 0.42; background: #e9edf2; }
.spinner span:nth-child(12) { transform: rotate(330deg); opacity: 0.56; background: #e9edf2; }

.phone-caption {
  width: calc(100% - 24px);
  min-height: 30px;
  margin-bottom: 10px;
  padding: 7px 8px;
  background: rgba(17, 20, 25, 0.72);
  color: #fff;
  font-size: 12px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

button {
  min-height: 42px;
  border: 2px solid #171717;
  border-radius: 0;
  background: #171717;
  color: #fff;
  cursor: pointer;
  text-transform: uppercase;
}

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

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
}

.summary div {
  border: 2px solid #171717;
  background: #fff;
  padding: 16px;
}

.summary span {
  display: block;
  font-size: 42px;
  font-weight: 900;
}

.summary small {
  color: #5b554d;
  text-transform: uppercase;
}

.summary .hot {
  background: #ffe89a;
}

.summary .not {
  background: #b7e4dc;
}

.summary .err {
  background: #ffd2cc;
}

.results-shell {
  margin-top: 20px;
  border: 2px solid #171717;
  background: #fff;
}

.table-actions {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 12px;
  border-bottom: 2px solid #171717;
}

progress {
  width: 100%;
  height: 42px;
  accent-color: #16845b;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #ded8ca;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

tbody tr {
  transition: background 120ms ease;
}

tbody tr.active-row {
  background: #fff4bd;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  color: #5b554d;
}

td:nth-child(1) {
  width: 34%;
}

td:nth-child(2) {
  width: 15%;
  font-weight: 900;
}

.verdict-hot {
  color: #9a1e17;
}

.verdict-not {
  color: #0f6548;
}

.image-cell {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  cursor: pointer;
  outline: none;
}

.image-cell:focus-visible {
  box-shadow: 0 0 0 3px #171717;
  background: #ffe89a;
}

.thumb {
  width: 74px;
  height: 58px;
  border: 2px solid #171717;
  background: #ded8ca;
  object-fit: cover;
}

.thumb.placeholder {
  display: block;
}

.empty td {
  color: #5b554d;
  text-align: center;
  padding: 34px;
}

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

  .phone-demo {
    min-height: 500px;
  }

  .controls,
  .summary {
    grid-template-columns: 1fr 1fr;
  }

  .controls button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100vw - 20px, 1180px);
    padding-top: 16px;
  }

  .machine {
    padding: 16px;
    box-shadow: 5px 5px 0 #171717;
  }

  .phone-demo {
    min-height: 440px;
    padding: 16px;
  }

  .phone-frame {
    width: min(100%, 250px);
  }

  .controls,
  .summary,
  .table-actions {
    grid-template-columns: 1fr;
  }
}
