* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: Arial, sans-serif;
  background: #f4f4f4;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #222;
  color: #fff;
  text-align: center;
  padding: 1rem;
  font-size: 1.2rem;
}

.controls {
  background: #eee;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
  padding: 1rem;
}

.controls > * {
  padding: .5rem 1rem;
  font-size: 1rem;
  border-radius: 6px;
  border: none;
  flex: 1 1 auto;
  min-width: 120px;
}

.controls select, .controls input[type='text'] {
  border: 1px solid #ccc;
}

.controls button {
  background: #222;
  color: white;
  cursor: pointer;
}

@media (max-width: 768px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .controls > * {
    width: 100%;
    font-size: 1rem;
  }
}

#palette {
  display: flex;
  flex: 1;
  overflow: auto;
}

.color-swatch {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  min-width: 20%;
  position: relative;
  cursor: grab;
  transition: transform .2s;
}

.color-swatch input[type='color'] {
  margin-top: auto;
  border: none;
  width: 100%;
  height: 40px;
  cursor: pointer;
}

.hex-label {
  background: rgba(0, 0, 0, .6);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  margin: 10px;
  cursor: pointer;
  font-weight: bold;
}

.hex-label::after {
  content: ' (click to copy)';
  font-size: .7rem;
  color: #ccc;
}

.copied::after {
  content: ' \2713 Copied!';
  color: #8f8;
}

@media (max-width: 768px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .controls > * {
    width: 100%;
    font-size: 1rem;
  }

  #palette {
    flex-direction: column;
  }

  .color-swatch {
    min-height: 220px;
    min-width: 100%;
  }
}

a {
  color: #0dcaf0;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}
