:root {
  --htue-border: #e3e3e3;
  --htue-muted: #616161;
  --htue-accent: #c8262d;
  --htue-selected: #005bd3;
  --htue-surface: #ffffff;
  --htue-subdued: #f7f7f7;
  font-family: -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, sans-serif;
  color: #303030;
}

body {
  margin: 0;
  background: #f1f1f1;
}

[hidden] {
  display: none !important;
}

.htue-loading {
  display: grid;
  place-items: center;
  min-height: 240px;
}

.htue {
  display: grid;
  gap: 16px;
}

.htue__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.htue__product {
  display: flex;
  align-items: center;
  gap: 12px;
}

.htue__product img {
  width: 40px;
  height: 40px;
  border: 1px solid var(--htue-border);
  border-radius: 8px;
  object-fit: cover;
}

.htue__product strong {
  display: block;
  font-size: 15px;
}

.htue__dirty {
  color: #8a6116;
  font-size: 13px;
}

.htue__uses {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.htue__use {
  padding: 7px 14px;
  border: 1px solid var(--htue-border);
  border-radius: 999px;
  background: var(--htue-surface);
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.htue__use.is-active {
  border-color: #303030;
  background: #303030;
  color: #fff;
}

.htue__use--add {
  border-style: dashed;
  color: var(--htue-muted);
}

.htue__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.htue__main,
.htue__side {
  padding: 16px;
  border-radius: 12px;
  background: var(--htue-surface);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.07), inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.htue__side {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.htue__modes {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--htue-subdued);
}

.htue__modes button {
  padding: 6px 16px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--htue-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.htue__modes button.is-active {
  background: var(--htue-surface);
  color: #303030;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.htue__help {
  margin: 12px 0;
  color: var(--htue-muted);
  font-size: 13px;
}

.htue__canvas-wrap--mobile {
  max-width: 380px;
  margin: 0 auto;
}

.htue__canvas {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: var(--htue-subdued);
  cursor: crosshair;
  user-select: none;
  touch-action: none;
}

.htue__canvas.is-locked {
  cursor: default;
}

.htue__canvas img {
  display: block;
  width: 100%;
  height: auto;
}

.htue__point {
  position: absolute;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--htue-accent);
  color: #fff;
  font: 700 13px/1 sans-serif;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transform: translate(-50%, -50%);
  cursor: grab;
  touch-action: none;
}

.htue__canvas.is-locked .htue__point {
  cursor: pointer;
  opacity: 0.85;
}

.htue__point.is-selected {
  background: var(--htue-selected);
  outline: 3px solid rgba(0, 91, 211, 0.35);
}

.htue__point.is-dragging {
  cursor: grabbing;
  transform: translate(-50%, -50%) scale(1.15);
}

.htue__point:focus-visible {
  outline: 3px solid #303030;
}

.htue__photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.htue__dropzone {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 48px 16px;
  border: 2px dashed var(--htue-border);
  border-radius: 10px;
  text-align: center;
}

.htue__dropzone p {
  margin: 0;
}

.htue__dropzone.is-over {
  border-color: var(--htue-selected);
  background: rgba(0, 91, 211, 0.05);
}

.htue__side-heading {
  margin: 8px 0 0;
  font-size: 14px;
}

.htue__muted {
  margin: 0;
  color: var(--htue-muted);
  font-size: 13px;
}

.htue__card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--htue-border);
  border-radius: 10px;
}

.htue__card.is-selected {
  border-color: var(--htue-selected);
  box-shadow: 0 0 0 1px var(--htue-selected);
}

.htue__card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.htue__badge {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--htue-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.htue__card.is-selected .htue__badge {
  background: var(--htue-selected);
}

.htue__card-tools {
  display: flex;
  gap: 4px;
}

.htue__icon {
  width: 28px;
  height: 28px;
  border: 1px solid var(--htue-border);
  border-radius: 6px;
  background: var(--htue-surface);
  color: inherit;
  font-size: 13px;
  cursor: pointer;
}

.htue__icon:disabled {
  opacity: 0.4;
  cursor: default;
}

.htue__icon--critical {
  color: #8e1f0b;
}

.htue__remove-use {
  margin-top: 8px;
}

@media (max-width: 900px) {
  .htue__layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .htue__side {
    position: static;
    max-height: none;
  }
}

.htue__photos {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.htue__photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
}

.htue__photo {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--htue-border);
  border-radius: 8px;
  background: var(--htue-subdued);
  aspect-ratio: 1;
  cursor: pointer;
}

.htue__photo:hover,
.htue__photo:focus-visible {
  border-color: var(--htue-selected);
  box-shadow: 0 0 0 1px var(--htue-selected);
}

.htue__photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.htue-list {
  display: grid;
  gap: 16px;
}

.htue-list__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.htue-list__title {
  margin: 0 0 4px;
  font-size: 18px;
}

.htue-list__actions {
  display: flex;
  gap: 8px;
}

.htue-list__body {
  overflow: hidden;
  border-radius: 12px;
  background: var(--htue-surface);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.07), inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.htue-list__body > .htue__dropzone {
  margin: 16px;
}

.htue-list__row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-bottom: 1px solid var(--htue-border);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.htue-list__row:last-child {
  border-bottom: 0;
}

.htue-list__row:hover,
.htue-list__row:focus-visible {
  background: var(--htue-subdued);
}

.htue-list__thumb {
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 1px solid var(--htue-border);
  border-radius: 8px;
  background: var(--htue-subdued);
}

.htue-list__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.htue-list__info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.htue-list__info strong,
.htue-list__info span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.htue-list__side {
  display: flex;
  align-items: center;
  gap: 12px;
}

.htue-list__edit {
  color: var(--htue-selected);
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 640px) {
  .htue-list__row {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .htue-list__side {
    grid-column: 2;
  }
}
