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

html, body {
  height: 100%;
  width: 100%;
  font-family: 'Segoe UI', sans-serif;
  background-color: hsl(217, 52%, 7%);
  overflow: hidden;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: #0f1b2d;
  color: white;
  height: 80px;
}

header h1 {
  font-size: 1.5rem;
}

.header-buttons button {
  margin-left: 1rem;
  padding: 0.6rem 1rem;
  font-size: 0.95rem;
  font-weight: bold;
  background-color: #ffffff15;
  border: 2px solid white;
  color: white;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.header-buttons button:hover {
  background-color: #ffffff30;
}

#palette-container {
  display: flex;
  width: 100%;
  height: calc(100vh - 80px);
  overflow: hidden;
}

.block-wrapper {
  position: relative;
  flex-grow: 1;
  height: 100%;
  transition: transform 0.2s ease;
}

.block-wrapper.dragging {
  transition: none;
  pointer-events: none;
  z-index: 10;
}

.color-block {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 1rem;
  transition: all 0.3s ease;
  user-select: none;
  height: 100%;
  position: relative;
}

.color-controls {
  width: 100%;
  padding: 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-name,
.hex-code {
  font-size: 1.6rem;
  font-weight: bold;
  text-align: center;
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  color: inherit;
  padding: 6px 0;
}

.hex-code {
  padding-bottom: 50px;
}

.color-controls {
  width: 100%;
  padding: 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
}  

.color-name:focus,
.hex-code:focus {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.color-picker {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.format-chip {
  position: absolute;
  right: 10px;
  bottom: 56px; /* sits near the value field */
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #ffffff66;
  border-radius: 6px;
  background: #ffffff1a;
  color: inherit;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.format-chip:hover {
  background: #ffffff33;
  border-color: #ffffffaa;
}

.insert-btn {
  position: absolute;
  top: 50%;
  width: 40px;
  height: 40px;
  background-color: white;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  font-size: 26px;
  font-weight: bold;
  font-family: monospace;
  display: none;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 20;
  transform: translateY(-50%);
  transition: background-color 0.2s ease;
}

.insert-btn:hover {
  background-color: #f0f0f0;
}

.insert-btn.show {
  display: flex;
}

.insert-btn.left {
  left: 0;
  transform: translate(-50%, -50%);
}

.insert-btn.right {
  right: 0;
  transform: translate(50%, -50%);
}

.remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 35px;
  height: 35px;
  background-color: rgba(255, 255, 255, 1);
  opacity: 0.15;
  border: 5px;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 14px;
  cursor: pointer;
  z-index: 5;
  transition: background 0.2s ease;
}

.remove-btn:hover {
  background-color: rgba(255, 0, 0, 1);
  color: white;
}

.mode-popup {
  position: absolute;
  background: #0f1b2d;
  border: 2px solid white;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 3000;
  padding: 8px;
  gap: 6px;
  min-width: 220px;
}

.mode-popup.hidden {
  display: none;
}

.mode-popup button {
  padding: 12px;
  color: white;
  background: #0f1b2d;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.mode-popup button:hover {
  background: rgb(48, 87, 145);
}
