:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #182019;
  background: #f1f3ee;
  font-synthesis: none;
  --crop-accent: #2f7d3b;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  display: grid;
  grid-template-rows: 76px minmax(0, 1fr) 38px;
  background: #f1f3ee;
}

body[data-crop="maize"] {
  --crop-accent: #c59415;
}

button,
select {
  font: inherit;
  letter-spacing: 0;
}

.toolbar {
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 22px;
  border-bottom: 1px solid #ccd2c8;
  background: rgba(248, 249, 246, 0.95);
  backdrop-filter: blur(12px);
}

.brand-block {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
}

.brand-mark {
  width: 11px;
  height: 34px;
  border-radius: 2px;
  background: linear-gradient(180deg, #d6a826 0 47%, #2f7d3b 47% 100%);
}

h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-block p {
  margin: 4px 0 0;
  color: #687267;
  font-size: 11px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0;
}

.toolbar-actions,
.step-controls {
  display: flex;
  align-items: center;
}

.toolbar-actions {
  gap: 10px;
}

.step-controls {
  gap: 4px;
}

.select-control {
  display: grid;
  grid-template-columns: auto 108px;
  align-items: center;
  gap: 7px;
  color: #626d61;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.select-control-gdd {
  grid-template-columns: auto 84px;
}

.select-control select {
  width: 100%;
  height: 36px;
  padding: 0 30px 0 10px;
  border: 1px solid #cbd1c7;
  border-radius: 6px;
  color: #263026;
  background: #ffffff;
  cursor: pointer;
  text-transform: none;
}

.select-control select:focus-visible,
.icon-button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--crop-accent) 65%, white);
  outline-offset: 2px;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid #cbd1c7;
  border-radius: 6px;
  color: #374337;
  background: #ffffff;
  cursor: pointer;
}

.icon-button:hover:not(:disabled) {
  border-color: #929d91;
  background: #f5f7f2;
}

.icon-button:disabled {
  color: #aeb5ac;
  cursor: default;
}

.icon-button svg {
  width: 16px;
  height: 16px;
}

#viewport {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.loading,
.error {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #4e594d;
  font-size: 13px;
  pointer-events: none;
}

.error {
  max-width: min(440px, calc(100% - 32px));
  color: #8e352d;
  text-align: center;
}

.stage-badge {
  position: absolute;
  top: 18px;
  left: 20px;
  display: grid;
  grid-template-columns: 9px auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  padding: 9px 11px;
  border: 1px solid rgba(125, 136, 123, 0.32);
  border-radius: 6px;
  background: rgba(248, 249, 246, 0.84);
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.stage-badge span {
  grid-row: 1 / 3;
  align-self: stretch;
  width: 9px;
  min-height: 30px;
  border-radius: 2px;
  background: var(--crop-accent);
}

.stage-badge strong {
  font-size: 12px;
  line-height: 1.1;
  font-weight: 700;
}

.stage-badge i {
  margin-top: 3px;
  color: #687267;
  font-size: 11px;
  line-height: 1.1;
  font-style: normal;
  text-transform: capitalize;
}

.statusbar {
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 22px;
  border-top: 1px solid #ccd2c8;
  color: #626d61;
  background: #f8f9f6;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

#selection {
  color: #354035;
  font-weight: 650;
}

@media (max-width: 760px) {
  body {
    grid-template-rows: 126px minmax(0, 1fr) 54px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    align-content: center;
    gap: 10px;
    padding: 10px 12px;
  }

  .brand-block p {
    display: none;
  }

  .brand-mark {
    height: 27px;
  }

  h1 {
    font-size: 16px;
  }

  .toolbar-actions {
    width: 100%;
    gap: 6px;
  }

  .select-control {
    grid-template-columns: 1fr;
    flex: 1 1 auto;
    gap: 3px;
  }

  .select-control-gdd {
    max-width: 92px;
  }

  .select-control select {
    height: 34px;
    padding-left: 8px;
  }

  .step-controls .icon-button,
  #reset-view {
    width: 34px;
    height: 34px;
    margin-top: 14px;
  }

  .stage-badge {
    top: 10px;
    left: 10px;
  }

  .statusbar {
    display: grid;
    align-content: center;
    gap: 3px;
    padding: 0 12px;
    white-space: nowrap;
    overflow: hidden;
  }

  #metrics {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
